Exim 4.86
[exim-website.git] / docbook / 4.86 / 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 26 Jul 2015
17 </date>
18 <author><firstname>Exim</firstname><surname>Maintainers</surname></author>
19 <authorinitials>EM</authorinitials>
20 <revhistory><revision>
21 <revnumber>4.86</revnumber>
22 <date>26 Jul 2015</date>
23   <authorinitials>EM</authorinitials>
24 </revision></revhistory>
25 <copyright><year>
26 2015
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 revisionflag="changed">
202 <indexterm role="concept">
203 <primary>documentation</primary>
204 </indexterm>
205 This edition of the Exim specification applies to version 4.86 of Exim.
206 Substantive changes from the 4.85 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 </tbody>
314 </tgroup>
315 </informaltable>
316 <para>
317 The main specification and the specification of the filtering language are also
318 available in other formats (HTML, PostScript, PDF, and Texinfo). Section
319 <xref linkend="SECTavail"/> below tells you how to get hold of these.
320 </para>
321 </section>
322 <section id="SECID2">
323 <title>FTP and web sites</title>
324 <para>
325 <indexterm role="concept">
326 <primary>web site</primary>
327 </indexterm>
328 <indexterm role="concept">
329 <primary>FTP site</primary>
330 </indexterm>
331 The primary site for Exim source distributions is currently the University of
332 Cambridge&#x2019;s FTP site, whose contents are described in <emphasis>Where to find the Exim
333 distribution</emphasis> below. In addition, there is a web site and an FTP site at
334 <option>exim.org</option>. These are now also hosted at the University of Cambridge. The
335 <option>exim.org</option> site was previously hosted for a number of years by Energis
336 Squared, formerly Planet Online Ltd, whose support I gratefully acknowledge.
337 </para>
338 <para>
339 <indexterm role="concept">
340 <primary>wiki</primary>
341 </indexterm>
342 <indexterm role="concept">
343 <primary>FAQ</primary>
344 </indexterm>
345 As well as Exim distribution tar files, the Exim web site contains a number of
346 differently formatted versions of the documentation. A recent addition to the
347 online information is the Exim wiki (<emphasis role="bold"><ulink url="http://wiki.exim.org">http://wiki.exim.org</ulink></emphasis>),
348 which contains what used to be a separate FAQ, as well as various other
349 examples, tips, and know-how that have been contributed by Exim users.
350 </para>
351 <para>
352 <indexterm role="concept">
353 <primary>Bugzilla</primary>
354 </indexterm>
355 An Exim Bugzilla exists at <emphasis role="bold"><ulink url="http://bugs.exim.org">http://bugs.exim.org</ulink></emphasis>. You can use
356 this to report bugs, and also to add items to the wish list. Please search
357 first to check that you are not duplicating a previous entry.
358 </para>
359 </section>
360 <section id="SECID3">
361 <title>Mailing lists</title>
362 <para>
363 <indexterm role="concept">
364 <primary>mailing lists</primary>
365 <secondary>for Exim users</secondary>
366 </indexterm>
367 The following Exim mailing lists exist:
368 </para>
369 <informaltable frame="none">
370 <tgroup cols="2" colsep="0" rowsep="0">
371 <colspec colwidth="140pt" align="left"/>
372 <colspec colwidth="254pt" align="left"/>
373 <tbody>
374 <row>
375 <entry><emphasis>exim-announce@exim.org</emphasis></entry>
376 <entry>Moderated, low volume announcements list</entry>
377 </row>
378 <row>
379 <entry><emphasis>exim-users@exim.org</emphasis></entry>
380 <entry>General discussion list</entry>
381 </row>
382 <row>
383 <entry><emphasis>exim-dev@exim.org</emphasis></entry>
384 <entry>Discussion of bugs, enhancements, etc.</entry>
385 </row>
386 <row>
387 <entry><emphasis>exim-cvs@exim.org</emphasis></entry>
388 <entry>Automated commit messages from the VCS</entry>
389 </row>
390 </tbody>
391 </tgroup>
392 </informaltable>
393 <para>
394 You can subscribe to these lists, change your existing subscriptions, and view
395 or search the archives via the mailing lists link on the Exim home page.
396 <indexterm role="concept">
397 <primary>Debian</primary>
398 <secondary>mailing list for</secondary>
399 </indexterm>
400 If you are using a Debian distribution of Exim, you may wish to subscribe to
401 the Debian-specific mailing list <emphasis>pkg-exim4-users@lists.alioth.debian.org</emphasis>
402 via this web page:
403 </para>
404 <literallayout>
405 <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>
406 </literallayout>
407 <para>
408 Please ask Debian-specific questions on this list and not on the general Exim
409 lists.
410 </para>
411 </section>
412 <section id="SECID4">
413 <title>Exim training</title>
414 <para>
415 <indexterm role="concept">
416 <primary>training courses</primary>
417 </indexterm>
418 Training courses in Cambridge (UK) used to be run annually by the author of
419 Exim, before he retired. At the time of writing, there are no plans to run
420 further Exim courses in Cambridge. However, if that changes, relevant
421 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>.
422 </para>
423 </section>
424 <section id="SECID5">
425 <title>Bug reports</title>
426 <para>
427 <indexterm role="concept">
428 <primary>bug reports</primary>
429 </indexterm>
430 <indexterm role="concept">
431 <primary>reporting bugs</primary>
432 </indexterm>
433 Reports of obvious bugs can be emailed to <emphasis>bugs@exim.org</emphasis> or reported
434 via the Bugzilla (<emphasis role="bold"><ulink url="http://bugs.exim.org">http://bugs.exim.org</ulink></emphasis>). However, if you are unsure
435 whether some behaviour is a bug or not, the best thing to do is to post a
436 message to the <emphasis>exim-dev</emphasis> mailing list and have it discussed.
437 </para>
438 </section>
439 <section id="SECTavail">
440 <title>Where to find the Exim distribution</title>
441 <para>
442 <indexterm role="concept">
443 <primary>FTP site</primary>
444 </indexterm>
445 <indexterm role="concept">
446 <primary>distribution</primary>
447 <secondary>ftp site</secondary>
448 </indexterm>
449 The master ftp site for the Exim distribution is
450 </para>
451 <literallayout>
452 <emphasis role="bold">ftp://ftp.csx.cam.ac.uk/pub/software/email/exim</emphasis>
453 </literallayout>
454 <para>
455 This is mirrored by
456 </para>
457 <literallayout>
458 <emphasis role="bold">ftp://ftp.exim.org/pub/exim</emphasis>
459 </literallayout>
460 <para>
461 The file references that follow are relative to the <filename>exim</filename> directories at
462 these sites. There are now quite a number of independent mirror sites around
463 the world. Those that I know about are listed in the file called <filename>Mirrors</filename>.
464 </para>
465 <para>
466 Within the <filename>exim</filename> directory there are subdirectories called <filename>exim3</filename> (for
467 previous Exim 3 distributions), <filename>exim4</filename> (for the latest Exim 4
468 distributions), and <filename>Testing</filename> for testing versions. In the <filename>exim4</filename>
469 subdirectory, the current release can always be found in files called
470 </para>
471 <literallayout>
472 <filename>exim-n.nn.tar.gz</filename>
473 <filename>exim-n.nn.tar.bz2</filename>
474 </literallayout>
475 <para>
476 where <emphasis>n.nn</emphasis> is the highest such version number in the directory. The two
477 files contain identical data; the only difference is the type of compression.
478 The <filename>.bz2</filename> file is usually a lot smaller than the <filename>.gz</filename> file.
479 </para>
480 <para>
481 <indexterm role="concept">
482 <primary>distribution</primary>
483 <secondary>signing details</secondary>
484 </indexterm>
485 <indexterm role="concept">
486 <primary>distribution</primary>
487 <secondary>public key</secondary>
488 </indexterm>
489 <indexterm role="concept">
490 <primary>public key for signed distribution</primary>
491 </indexterm>
492 The distributions will be PGP signed by an individual key of the Release
493 Coordinator.  This key will have a uid containing an email address in the
494 <emphasis>exim.org</emphasis> domain and will have signatures from other people, including
495 other Exim maintainers.  We expect that the key will be in the "strong set" of
496 PGP keys.  There should be a trust path to that key from Nigel Metheringham&#x2019;s
497 PGP key, a version of which can be found in the release directory in the file
498 <filename>nigel-pubkey.asc</filename>.  All keys used will be available in public keyserver pools,
499 such as <emphasis>pool.sks-keyservers.net</emphasis>.
500 </para>
501 <para>
502 At time of last update, releases were being made by Phil Pennock and signed with
503 key <emphasis>0x403043153903637F</emphasis>, although that key is expected to be replaced in 2013.
504 A trust path from Nigel&#x2019;s key to Phil&#x2019;s can be observed at
505 <emphasis role="bold"><ulink url="https://www.security.spodhuis.org/exim-trustpath">https://www.security.spodhuis.org/exim-trustpath</ulink></emphasis>.
506 </para>
507 <para>
508 Releases have also been authorized to be performed by Todd Lyons who signs with
509 key <emphasis>0xC4F4F94804D29EBA</emphasis>. A direct trust path exists between previous RE Phil
510 Pennock and Todd Lyons through a common associate.
511 </para>
512 <para>
513 The signatures for the tar bundles are in:
514 </para>
515 <literallayout>
516 <filename>exim-n.nn.tar.gz.asc</filename>
517 <filename>exim-n.nn.tar.bz2.asc</filename>
518 </literallayout>
519 <para>
520 For each released version, the log of changes is made separately available in a
521 separate file in the directory <filename>ChangeLogs</filename> so that it is possible to
522 find out what has changed without having to download the entire distribution.
523 </para>
524 <para>
525 <indexterm role="concept">
526 <primary>documentation</primary>
527 <secondary>available formats</secondary>
528 </indexterm>
529 The main distribution contains ASCII versions of this specification and other
530 documentation; other formats of the documents are available in separate files
531 inside the <filename>exim4</filename> directory of the FTP site:
532 </para>
533 <literallayout>
534 <filename>exim-html-n.nn.tar.gz</filename>
535 <filename>exim-pdf-n.nn.tar.gz</filename>
536 <filename>exim-postscript-n.nn.tar.gz</filename>
537 <filename>exim-texinfo-n.nn.tar.gz</filename>
538 </literallayout>
539 <para>
540 These tar files contain only the <filename>doc</filename> directory, not the complete
541 distribution, and are also available in <filename>.bz2</filename> as well as <filename>.gz</filename> forms.
542 </para>
543 </section>
544 <section id="SECID6">
545 <title>Limitations</title>
546 <itemizedlist>
547 <listitem>
548 <para>
549 <indexterm role="concept">
550 <primary>limitations of Exim</primary>
551 </indexterm>
552 <indexterm role="concept">
553 <primary>bang paths</primary>
554 <secondary>not handled by Exim</secondary>
555 </indexterm>
556 Exim is designed for use as an Internet MTA, and therefore handles addresses in
557 RFC 2822 domain format only. It cannot handle UUCP <quote>bang paths</quote>, though
558 simple two-component bang paths can be converted by a straightforward rewriting
559 configuration. This restriction does not prevent Exim from being interfaced to
560 UUCP as a transport mechanism, provided that domain addresses are used.
561 </para>
562 </listitem>
563 <listitem>
564 <para>
565 <indexterm role="concept">
566 <primary>domainless addresses</primary>
567 </indexterm>
568 <indexterm role="concept">
569 <primary>address</primary>
570 <secondary>without domain</secondary>
571 </indexterm>
572 Exim insists that every address it handles has a domain attached. For incoming
573 local messages, domainless addresses are automatically qualified with a
574 configured domain value. Configuration options specify from which remote
575 systems unqualified addresses are acceptable. These are then qualified on
576 arrival.
577 </para>
578 </listitem>
579 <listitem>
580 <para>
581 <indexterm role="concept">
582 <primary>transport</primary>
583 <secondary>external</secondary>
584 </indexterm>
585 <indexterm role="concept">
586 <primary>external transports</primary>
587 </indexterm>
588 The only external transport mechanisms that are currently implemented are SMTP
589 and LMTP over a TCP/IP network (including support for IPv6). However, a pipe
590 transport is available, and there are facilities for writing messages to files
591 and pipes, optionally in <emphasis>batched SMTP</emphasis> format; these facilities can be used
592 to send messages to other transport mechanisms such as UUCP, provided they can
593 handle domain-style addresses. Batched SMTP input is also catered for.
594 </para>
595 </listitem>
596 <listitem>
597 <para>
598 Exim is not designed for storing mail for dial-in hosts. When the volumes of
599 such mail are large, it is better to get the messages <quote>delivered</quote> into files
600 (that is, off Exim&#x2019;s queue) and subsequently passed on to the dial-in hosts by
601 other means.
602 </para>
603 </listitem>
604 <listitem>
605 <para>
606 Although Exim does have basic facilities for scanning incoming messages, these
607 are not comprehensive enough to do full virus or spam scanning. Such operations
608 are best carried out using additional specialized software packages. If you
609 compile Exim with the content-scanning extension, straightforward interfaces to
610 a number of common scanners are provided.
611 </para>
612 </listitem>
613 </itemizedlist>
614 </section>
615 <section id="SECID7">
616 <title>Run time configuration</title>
617 <para>
618 Exim&#x2019;s run time configuration is held in a single text file that is divided
619 into a number of sections. The entries in this file consist of keywords and
620 values, in the style of Smail 3 configuration files. A default configuration
621 file which is suitable for simple online installations is provided in the
622 distribution, and is described in chapter <xref linkend="CHAPdefconfil"/> below.
623 </para>
624 </section>
625 <section id="SECID8">
626 <title>Calling interface</title>
627 <para>
628 <indexterm role="concept">
629 <primary>Sendmail compatibility</primary>
630 <secondary>command line interface</secondary>
631 </indexterm>
632 Like many MTAs, Exim has adopted the Sendmail command line interface so that it
633 can be a straight replacement for <filename>/usr/lib/sendmail</filename> or
634 <filename>/usr/sbin/sendmail</filename> when sending mail, but you do not need to know anything
635 about Sendmail in order to run Exim. For actions other than sending messages,
636 Sendmail-compatible options also exist, but those that produce output (for
637 example, <option>-bp</option>, which lists the messages on the queue) do so in Exim&#x2019;s own
638 format. There are also some additional options that are compatible with Smail
639 3, and some further options that are new to Exim. Chapter <xref linkend="CHAPcommandline"/>
640 documents all Exim&#x2019;s command line options. This information is automatically
641 made into the man page that forms part of the Exim distribution.
642 </para>
643 <para>
644 Control of messages on the queue can be done via certain privileged command
645 line options. There is also an optional monitor program called <emphasis>eximon</emphasis>,
646 which displays current information in an X window, and which contains a menu
647 interface to Exim&#x2019;s command line administration options.
648 </para>
649 </section>
650 <section id="SECID9">
651 <title>Terminology</title>
652 <para>
653 <indexterm role="concept">
654 <primary>terminology definitions</primary>
655 </indexterm>
656 <indexterm role="concept">
657 <primary>body of message</primary>
658 <secondary>definition of</secondary>
659 </indexterm>
660 The <emphasis>body</emphasis> of a message is the actual data that the sender wants to transmit.
661 It is the last part of a message, and is separated from the <emphasis>header</emphasis> (see
662 below) by a blank line.
663 </para>
664 <para>
665 <indexterm role="concept">
666 <primary>bounce message</primary>
667 <secondary>definition of</secondary>
668 </indexterm>
669 When a message cannot be delivered, it is normally returned to the sender in a
670 delivery failure message or a <quote>non-delivery report</quote> (NDR). The term
671 <emphasis>bounce</emphasis> is commonly used for this action, and the error reports are often
672 called <emphasis>bounce messages</emphasis>. This is a convenient shorthand for <quote>delivery
673 failure error report</quote>. Such messages have an empty sender address in the
674 message&#x2019;s <emphasis>envelope</emphasis> (see below) to ensure that they cannot themselves give
675 rise to further bounce messages.
676 </para>
677 <para>
678 The term <emphasis>default</emphasis> appears frequently in this manual. It is used to qualify a
679 value which is used in the absence of any setting in the configuration. It may
680 also qualify an action which is taken unless a configuration setting specifies
681 otherwise.
682 </para>
683 <para>
684 The term <emphasis>defer</emphasis> is used when the delivery of a message to a specific
685 destination cannot immediately take place for some reason (a remote host may be
686 down, or a user&#x2019;s local mailbox may be full). Such deliveries are <emphasis>deferred</emphasis>
687 until a later time.
688 </para>
689 <para>
690 The word <emphasis>domain</emphasis> is sometimes used to mean all but the first component of a
691 host&#x2019;s name. It is <emphasis>not</emphasis> used in that sense here, where it normally refers to
692 the part of an email address following the @ sign.
693 </para>
694 <para>
695 <indexterm role="concept">
696 <primary>envelope, definition of</primary>
697 </indexterm>
698 <indexterm role="concept">
699 <primary>sender</primary>
700 <secondary>definition of</secondary>
701 </indexterm>
702 A message in transit has an associated <emphasis>envelope</emphasis>, as well as a header and a
703 body. The envelope contains a sender address (to which bounce messages should
704 be delivered), and any number of recipient addresses. References to the
705 sender or the recipients of a message usually mean the addresses in the
706 envelope. An MTA uses these addresses for delivery, and for returning bounce
707 messages, not the addresses that appear in the header lines.
708 </para>
709 <para>
710 <indexterm role="concept">
711 <primary>message</primary>
712 <secondary>header, definition of</secondary>
713 </indexterm>
714 <indexterm role="concept">
715 <primary>header section</primary>
716 <secondary>definition of</secondary>
717 </indexterm>
718 The <emphasis>header</emphasis> of a message is the first part of a message&#x2019;s text, consisting
719 of a number of lines, each of which has a name such as <emphasis>From:</emphasis>, <emphasis>To:</emphasis>,
720 <emphasis>Subject:</emphasis>, etc. Long header lines can be split over several text lines by
721 indenting the continuations. The header is separated from the body by a blank
722 line.
723 </para>
724 <para>
725 <indexterm role="concept">
726 <primary>local part</primary>
727 <secondary>definition of</secondary>
728 </indexterm>
729 <indexterm role="concept">
730 <primary>domain</primary>
731 <secondary>definition of</secondary>
732 </indexterm>
733 The term <emphasis>local part</emphasis>, which is taken from RFC 2822, is used to refer to that
734 part of an email address that precedes the @ sign. The part that follows the
735 @ sign is called the <emphasis>domain</emphasis> or <emphasis>mail domain</emphasis>.
736 </para>
737 <para>
738 <indexterm role="concept">
739 <primary>local delivery</primary>
740 <secondary>definition of</secondary>
741 </indexterm>
742 <indexterm role="concept">
743 <primary>remote delivery, definition of</primary>
744 </indexterm>
745 The terms <emphasis>local delivery</emphasis> and <emphasis>remote delivery</emphasis> are used to distinguish
746 delivery to a file or a pipe on the local host from delivery by SMTP over
747 TCP/IP to another host. As far as Exim is concerned, all hosts other than the
748 host it is running on are <emphasis>remote</emphasis>.
749 </para>
750 <para>
751 <indexterm role="concept">
752 <primary>return path</primary>
753 <secondary>definition of</secondary>
754 </indexterm>
755 <emphasis>Return path</emphasis> is another name that is used for the sender address in a
756 message&#x2019;s envelope.
757 </para>
758 <para>
759 <indexterm role="concept">
760 <primary>queue</primary>
761 <secondary>definition of</secondary>
762 </indexterm>
763 The term <emphasis>queue</emphasis> is used to refer to the set of messages awaiting delivery,
764 because this term is in widespread use in the context of MTAs. However, in
765 Exim&#x2019;s case the reality is more like a pool than a queue, because there is
766 normally no ordering of waiting messages.
767 </para>
768 <para>
769 <indexterm role="concept">
770 <primary>queue runner</primary>
771 <secondary>definition of</secondary>
772 </indexterm>
773 The term <emphasis>queue runner</emphasis> is used to describe a process that scans the queue
774 and attempts to deliver those messages whose retry times have come. This term
775 is used by other MTAs, and also relates to the command <option>runq</option>, but in Exim
776 the waiting messages are normally processed in an unpredictable order.
777 </para>
778 <para>
779 <indexterm role="concept">
780 <primary>spool directory</primary>
781 <secondary>definition of</secondary>
782 </indexterm>
783 The term <emphasis>spool directory</emphasis> is used for a directory in which Exim keeps the
784 messages on its queue &ndash; that is, those that it is in the process of
785 delivering. This should not be confused with the directory in which local
786 mailboxes are stored, which is called a <quote>spool directory</quote> by some people. In
787 the Exim documentation, <quote>spool</quote> is always used in the first sense.
788 </para>
789 </section>
790 </chapter>
791
792 <chapter id="CHID2">
793 <title>Incorporated code</title>
794 <para>
795 <indexterm role="concept">
796 <primary>incorporated code</primary>
797 </indexterm>
798 <indexterm role="concept">
799 <primary>regular expressions</primary>
800 <secondary>library</secondary>
801 </indexterm>
802 <indexterm role="concept">
803 <primary>PCRE</primary>
804 </indexterm>
805 <indexterm role="concept">
806 <primary>OpenDMARC</primary>
807 </indexterm>
808 A number of pieces of external code are included in the Exim distribution.
809 </para>
810 <itemizedlist>
811 <listitem>
812 <para>
813 Regular expressions are supported in the main Exim program and in the
814 Exim monitor using the freely-distributable PCRE library, copyright
815 &copy; University of Cambridge. The source to PCRE is no longer shipped with
816 Exim, so you will need to use the version of PCRE shipped with your system,
817 or obtain and install the full version of the library from
818 <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>.
819 </para>
820 </listitem>
821 <listitem>
822 <para>
823 <indexterm role="concept">
824 <primary>cdb</primary>
825 <secondary>acknowledgment</secondary>
826 </indexterm>
827 Support for the cdb (Constant DataBase) lookup method is provided by code
828 contributed by Nigel Metheringham of (at the time he contributed it) Planet
829 Online Ltd. The implementation is completely contained within the code of Exim.
830 It does not link against an external cdb library. The code contains the
831 following statements:
832 </para>
833 <blockquote>
834 <para>
835 Copyright &copy; 1998 Nigel Metheringham, Planet Online Ltd
836 </para>
837 <para>
838 This program is free software; you can redistribute it and/or modify it under
839 the terms of the GNU General Public License as published by the Free Software
840 Foundation; either version 2 of the License, or (at your option) any later
841 version.
842 This code implements Dan Bernstein&#x2019;s Constant DataBase (cdb) spec. Information,
843 the spec and sample code for cdb can be obtained from
844 <emphasis role="bold"><ulink url="http://www.pobox.com/~djb/cdb.html">http://www.pobox.com/~djb/cdb.html</ulink></emphasis>. This implementation borrows
845 some code from Dan Bernstein&#x2019;s implementation (which has no license
846 restrictions applied to it).
847 </para>
848 </blockquote>
849 </listitem>
850 <listitem>
851 <para>
852 <indexterm role="concept">
853 <primary>SPA authentication</primary>
854 </indexterm>
855 <indexterm role="concept">
856 <primary>Samba project</primary>
857 </indexterm>
858 <indexterm role="concept">
859 <primary>Microsoft Secure Password Authentication</primary>
860 </indexterm>
861 Client support for Microsoft&#x2019;s <emphasis>Secure Password Authentication</emphasis> is provided
862 by code contributed by Marc Prud&#x2019;hommeaux. Server support was contributed by
863 Tom Kistner. This includes code taken from the Samba project, which is released
864 under the Gnu GPL.
865 </para>
866 </listitem>
867 <listitem>
868 <para>
869 <indexterm role="concept">
870 <primary>Cyrus</primary>
871 </indexterm>
872 <indexterm role="concept">
873 <primary><emphasis>pwcheck</emphasis> daemon</primary>
874 </indexterm>
875 <indexterm role="concept">
876 <primary><emphasis>pwauthd</emphasis> daemon</primary>
877 </indexterm>
878 Support for calling the Cyrus <emphasis>pwcheck</emphasis> and <emphasis>saslauthd</emphasis> daemons is provided
879 by code taken from the Cyrus-SASL library and adapted by Alexander S.
880 Sabourenkov. The permission notice appears below, in accordance with the
881 conditions expressed therein.
882 </para>
883 <blockquote>
884 <para>
885 Copyright &copy; 2001 Carnegie Mellon University.  All rights reserved.
886 </para>
887 <para>
888 Redistribution and use in source and binary forms, with or without
889 modification, are permitted provided that the following conditions
890 are met:
891 </para>
892 <orderedlist numeration="arabic">
893 <listitem>
894 <para>
895 Redistributions of source code must retain the above copyright
896 notice, this list of conditions and the following disclaimer.
897 </para>
898 </listitem>
899 <listitem>
900 <para>
901 Redistributions in binary form must reproduce the above copyright
902 notice, this list of conditions and the following disclaimer in
903 the documentation and/or other materials provided with the
904 distribution.
905 </para>
906 </listitem>
907 <listitem>
908 <para>
909 The name <quote>Carnegie Mellon University</quote> must not be used to
910 endorse or promote products derived from this software without
911 prior written permission. For permission or any other legal
912 details, please contact
913 </para>
914 <literallayout>
915               Office of Technology Transfer
916               Carnegie Mellon University
917               5000 Forbes Avenue
918               Pittsburgh, PA  15213-3890
919               (412) 268-4387, fax: (412) 268-7395
920               tech-transfer@andrew.cmu.edu
921 </literallayout>
922 </listitem>
923 <listitem>
924 <para>
925 Redistributions of any form whatsoever must retain the following
926 acknowledgment:
927 </para>
928 <para>
929 <quote>This product includes software developed by Computing Services
930 at Carnegie Mellon University (<emphasis role="bold"><ulink url="http://www.cmu.edu/computing/">http://www.cmu.edu/computing/</ulink></emphasis>.</quote>
931 </para>
932 <para>
933 CARNEGIE MELLON UNIVERSITY DISCLAIMS ALL WARRANTIES WITH REGARD TO
934 THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
935 AND FITNESS, IN NO EVENT SHALL CARNEGIE MELLON UNIVERSITY BE LIABLE
936 FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
937 WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN
938 AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING
939 OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
940 </para>
941 </listitem>
942 </orderedlist>
943 </blockquote>
944 </listitem>
945 <listitem>
946 <para>
947 <indexterm role="concept">
948 <primary>Exim monitor</primary>
949 <secondary>acknowledgment</secondary>
950 </indexterm>
951 <indexterm role="concept">
952 <primary>X-windows</primary>
953 </indexterm>
954 <indexterm role="concept">
955 <primary>Athena</primary>
956 </indexterm>
957 The Exim Monitor program, which is an X-Window application, includes
958 modified versions of the Athena StripChart and TextPop widgets.
959 This code is copyright by DEC and MIT, and their permission notice appears
960 below, in accordance with the conditions expressed therein.
961 </para>
962 <blockquote>
963 <para>
964 Copyright 1987, 1988 by Digital Equipment Corporation, Maynard, Massachusetts,
965 and the Massachusetts Institute of Technology, Cambridge, Massachusetts.
966 </para>
967 <para>
968 All Rights Reserved
969 </para>
970 <para>
971 Permission to use, copy, modify, and distribute this software and its
972 documentation for any purpose and without fee is hereby granted,
973 provided that the above copyright notice appear in all copies and that
974 both that copyright notice and this permission notice appear in
975 supporting documentation, and that the names of Digital or MIT not be
976 used in advertising or publicity pertaining to distribution of the
977 software without specific, written prior permission.
978 </para>
979 <para>
980 DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
981 ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
982 DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR
983 ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
984 WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
985 ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
986 SOFTWARE.
987 </para>
988 </blockquote>
989 </listitem>
990 <listitem>
991 <para>
992 <indexterm role="concept">
993 <primary>opendmarc</primary>
994 <secondary>acknowledgment</secondary>
995 </indexterm>
996 The DMARC implementation uses the OpenDMARC library which is Copyrighted by
997 The Trusted Domain Project. Portions of Exim source which use OpenDMARC
998 derived code are indicated in the respective source files. The full OpenDMARC
999 license is provided in the LICENSE.opendmarc file contained in the distributed
1000 source code.
1001 </para>
1002 </listitem>
1003 <listitem>
1004 <para>
1005 Many people have contributed code fragments, some large, some small, that were
1006 not covered by any specific licence requirements. It is assumed that the
1007 contributors are happy to see their code incorporated into Exim under the GPL.
1008 </para>
1009 </listitem>
1010 </itemizedlist>
1011 </chapter>
1012
1013 <chapter id="CHID11">
1014 <title>How Exim receives and delivers mail</title>
1015 <titleabbrev>Receiving and delivering mail</titleabbrev>
1016 <section id="SECID10">
1017 <title>Overall philosophy</title>
1018 <para>
1019 <indexterm role="concept">
1020 <primary>design philosophy</primary>
1021 </indexterm>
1022 Exim is designed to work efficiently on systems that are permanently connected
1023 to the Internet and are handling a general mix of mail. In such circumstances,
1024 most messages can be delivered immediately. Consequently, Exim does not
1025 maintain independent queues of messages for specific domains or hosts, though
1026 it does try to send several messages in a single SMTP connection after a host
1027 has been down, and it also maintains per-host retry information.
1028 </para>
1029 </section>
1030 <section id="SECID11">
1031 <title>Policy control</title>
1032 <para>
1033 <indexterm role="concept">
1034 <primary>policy control</primary>
1035 <secondary>overview</secondary>
1036 </indexterm>
1037 Policy controls are now an important feature of MTAs that are connected to the
1038 Internet. Perhaps their most important job is to stop MTAs being abused as
1039 <quote>open relays</quote> by misguided individuals who send out vast amounts of
1040 unsolicited junk, and want to disguise its source. Exim provides flexible
1041 facilities for specifying policy controls on incoming mail:
1042 </para>
1043 <itemizedlist>
1044 <listitem>
1045 <para>
1046 <indexterm role="concept">
1047 <primary>access control lists (ACLs)</primary>
1048 <secondary>introduction</secondary>
1049 </indexterm>
1050 Exim 4 (unlike previous versions of Exim) implements policy controls on
1051 incoming mail by means of <emphasis>Access Control Lists</emphasis> (ACLs). Each list is a
1052 series of statements that may either grant or deny access. ACLs can be used at
1053 several places in the SMTP dialogue while receiving a message from a remote
1054 host. However, the most common places are after each RCPT command, and at the
1055 very end of the message. The sysadmin can specify conditions for accepting or
1056 rejecting individual recipients or the entire message, respectively, at these
1057 two points (see chapter <xref linkend="CHAPACL"/>). Denial of access results in an SMTP
1058 error code.
1059 </para>
1060 </listitem>
1061 <listitem>
1062 <para>
1063 An ACL is also available for locally generated, non-SMTP messages. In this
1064 case, the only available actions are to accept or deny the entire message.
1065 </para>
1066 </listitem>
1067 <listitem>
1068 <para>
1069 When Exim is compiled with the content-scanning extension, facilities are
1070 provided in the ACL mechanism for passing the message to external virus and/or
1071 spam scanning software. The result of such a scan is passed back to the ACL,
1072 which can then use it to decide what to do with the message.
1073 </para>
1074 </listitem>
1075 <listitem>
1076 <para>
1077 When a message has been received, either from a remote host or from the local
1078 host, but before the final acknowledgment has been sent, a locally supplied C
1079 function called <function>local_scan()</function> can be run to inspect the message and decide
1080 whether to accept it or not (see chapter <xref linkend="CHAPlocalscan"/>). If the message
1081 is accepted, the list of recipients can be modified by the function.
1082 </para>
1083 </listitem>
1084 <listitem>
1085 <para>
1086 Using the <function>local_scan()</function> mechanism is another way of calling external scanner
1087 software. The <option>SA-Exim</option> add-on package works this way. It does not require
1088 Exim to be compiled with the content-scanning extension.
1089 </para>
1090 </listitem>
1091 <listitem>
1092 <para>
1093 After a message has been accepted, a further checking mechanism is available in
1094 the form of the <emphasis>system filter</emphasis> (see chapter <xref linkend="CHAPsystemfilter"/>). This
1095 runs at the start of every delivery process.
1096 </para>
1097 </listitem>
1098 </itemizedlist>
1099 </section>
1100 <section id="SECID12">
1101 <title>User filters</title>
1102 <para>
1103 <indexterm role="concept">
1104 <primary>filter</primary>
1105 <secondary>introduction</secondary>
1106 </indexterm>
1107 <indexterm role="concept">
1108 <primary>Sieve filter</primary>
1109 </indexterm>
1110 In a conventional Exim configuration, users are able to run private filters by
1111 setting up appropriate <filename>.forward</filename> files in their home directories. See
1112 chapter <xref linkend="CHAPredirect"/> (about the <command>redirect</command> router) for the
1113 configuration needed to support this, and the separate document entitled
1114 <emphasis>Exim&#x2019;s interfaces to mail filtering</emphasis> for user details. Two different kinds
1115 of filtering are available:
1116 </para>
1117 <itemizedlist>
1118 <listitem>
1119 <para>
1120 Sieve filters are written in the standard filtering language that is defined
1121 by RFC 3028.
1122 </para>
1123 </listitem>
1124 <listitem>
1125 <para>
1126 Exim filters are written in a syntax that is unique to Exim, but which is more
1127 powerful than Sieve, which it pre-dates.
1128 </para>
1129 </listitem>
1130 </itemizedlist>
1131 <para>
1132 User filters are run as part of the routing process, described below.
1133 </para>
1134 </section>
1135 <section id="SECTmessiden">
1136 <title>Message identification</title>
1137 <para>
1138 <indexterm role="concept">
1139 <primary>message ids</primary>
1140 <secondary>details of format</secondary>
1141 </indexterm>
1142 <indexterm role="concept">
1143 <primary>format</primary>
1144 <secondary>of message id</secondary>
1145 </indexterm>
1146 <indexterm role="concept">
1147 <primary>id of message</primary>
1148 </indexterm>
1149 <indexterm role="concept">
1150 <primary>base62</primary>
1151 </indexterm>
1152 <indexterm role="concept">
1153 <primary>base36</primary>
1154 </indexterm>
1155 <indexterm role="concept">
1156 <primary>Darwin</primary>
1157 </indexterm>
1158 <indexterm role="concept">
1159 <primary>Cygwin</primary>
1160 </indexterm>
1161 Every message handled by Exim is given a <emphasis>message id</emphasis> which is sixteen
1162 characters long. It is divided into three parts, separated by hyphens, for
1163 example <literal>16VDhn-0001bo-D3</literal>. Each part is a sequence of letters and digits,
1164 normally encoding numbers in base 62. However, in the Darwin operating
1165 system (Mac OS X) and when Exim is compiled to run under Cygwin, base 36
1166 (avoiding the use of lower case letters) is used instead, because the message
1167 id is used to construct file names, and the names of files in those systems are
1168 not always case-sensitive.
1169 </para>
1170 <para>
1171 <indexterm role="concept">
1172 <primary>pid (process id)</primary>
1173 <secondary>re-use of</secondary>
1174 </indexterm>
1175 The detail of the contents of the message id have changed as Exim has evolved.
1176 Earlier versions relied on the operating system not re-using a process id (pid)
1177 within one second. On modern operating systems, this assumption can no longer
1178 be made, so the algorithm had to be changed. To retain backward compatibility,
1179 the format of the message id was retained, which is why the following rules are
1180 somewhat eccentric:
1181 </para>
1182 <itemizedlist>
1183 <listitem>
1184 <para>
1185 The first six characters of the message id are the time at which the message
1186 started to be received, to a granularity of one second. That is, this field
1187 contains the number of seconds since the start of the epoch (the normal Unix
1188 way of representing the date and time of day).
1189 </para>
1190 </listitem>
1191 <listitem>
1192 <para>
1193 After the first hyphen, the next six characters are the id of the process that
1194 received the message.
1195 </para>
1196 </listitem>
1197 <listitem>
1198 <para>
1199 There are two different possibilities for the final two characters:
1200 </para>
1201 <orderedlist numeration="arabic">
1202 <listitem>
1203 <para>
1204 <indexterm role="option">
1205 <primary><option>localhost_number</option></primary>
1206 </indexterm>
1207 If <option>localhost_number</option> is not set, this value is the fractional part of the
1208 time of reception, normally in units of 1/2000 of a second, but for systems
1209 that must use base 36 instead of base 62 (because of case-insensitive file
1210 systems), the units are 1/1000 of a second.
1211 </para>
1212 </listitem>
1213 <listitem>
1214 <para>
1215 If <option>localhost_number</option> is set, it is multiplied by 200 (100) and added to
1216 the fractional part of the time, which in this case is in units of 1/200
1217 (1/100) of a second.
1218 </para>
1219 </listitem>
1220 </orderedlist>
1221 </listitem>
1222 </itemizedlist>
1223 <para>
1224 After a message has been received, Exim waits for the clock to tick at the
1225 appropriate resolution before proceeding, so that if another message is
1226 received by the same process, or by another process with the same (re-used)
1227 pid, it is guaranteed that the time will be different. In most cases, the clock
1228 will already have ticked while the message was being received.
1229 </para>
1230 </section>
1231 <section id="SECID13">
1232 <title>Receiving mail</title>
1233 <para>
1234 <indexterm role="concept">
1235 <primary>receiving mail</primary>
1236 </indexterm>
1237 <indexterm role="concept">
1238 <primary>message</primary>
1239 <secondary>reception</secondary>
1240 </indexterm>
1241 The only way Exim can receive mail from another host is using SMTP over
1242 TCP/IP, in which case the sender and recipient addresses are transferred using
1243 SMTP commands. However, from a locally running process (such as a user&#x2019;s MUA),
1244 there are several possibilities:
1245 </para>
1246 <itemizedlist>
1247 <listitem>
1248 <para>
1249 If the process runs Exim with the <option>-bm</option> option, the message is read
1250 non-interactively (usually via a pipe), with the recipients taken from the
1251 command line, or from the body of the message if <option>-t</option> is also used.
1252 </para>
1253 </listitem>
1254 <listitem>
1255 <para>
1256 If the process runs Exim with the <option>-bS</option> option, the message is also read
1257 non-interactively, but in this case the recipients are listed at the start of
1258 the message in a series of SMTP RCPT commands, terminated by a DATA
1259 command. This is so-called <quote>batch SMTP</quote> format,
1260 but it isn&#x2019;t really SMTP. The SMTP commands are just another way of passing
1261 envelope addresses in a non-interactive submission.
1262 </para>
1263 </listitem>
1264 <listitem>
1265 <para>
1266 If the process runs Exim with the <option>-bs</option> option, the message is read
1267 interactively, using the SMTP protocol. A two-way pipe is normally used for
1268 passing data between the local process and the Exim process.
1269 This is <quote>real</quote> SMTP and is handled in the same way as SMTP over TCP/IP. For
1270 example, the ACLs for SMTP commands are used for this form of submission.
1271 </para>
1272 </listitem>
1273 <listitem>
1274 <para>
1275 A local process may also make a TCP/IP call to the host&#x2019;s loopback address
1276 (127.0.0.1) or any other of its IP addresses. When receiving messages, Exim
1277 does not treat the loopback address specially. It treats all such connections
1278 in the same way as connections from other hosts.
1279 </para>
1280 </listitem>
1281 </itemizedlist>
1282 <para>
1283 <indexterm role="concept">
1284 <primary>message sender, constructed by Exim</primary>
1285 </indexterm>
1286 <indexterm role="concept">
1287 <primary>sender</primary>
1288 <secondary>constructed by Exim</secondary>
1289 </indexterm>
1290 In the three cases that do not involve TCP/IP, the sender address is
1291 constructed from the login name of the user that called Exim and a default
1292 qualification domain (which can be set by the <option>qualify_domain</option> configuration
1293 option). For local or batch SMTP, a sender address that is passed using the
1294 SMTP MAIL command is ignored. However, the system administrator may allow
1295 certain users (<quote>trusted users</quote>) to specify a different sender address
1296 unconditionally, or all users to specify certain forms of different sender
1297 address. The <option>-f</option> option or the SMTP MAIL command is used to specify these
1298 different addresses. See section <xref linkend="SECTtrustedadmin"/> for details of trusted
1299 users, and the <option>untrusted_set_sender</option> option for a way of allowing untrusted
1300 users to change sender addresses.
1301 </para>
1302 <para>
1303 Messages received by either of the non-interactive mechanisms are subject to
1304 checking by the non-SMTP ACL, if one is defined. Messages received using SMTP
1305 (either over TCP/IP, or interacting with a local process) can be checked by a
1306 number of ACLs that operate at different times during the SMTP session. Either
1307 individual recipients, or the entire message, can be rejected if local policy
1308 requirements are not met. The <function>local_scan()</function> function (see chapter
1309 <xref linkend="CHAPlocalscan"/>) is run for all incoming messages.
1310 </para>
1311 <para>
1312 Exim can be configured not to start a delivery process when a message is
1313 received; this can be unconditional, or depend on the number of incoming SMTP
1314 connections or the system load. In these situations, new messages wait on the
1315 queue until a queue runner process picks them up. However, in standard
1316 configurations under normal conditions, delivery is started as soon as a
1317 message is received.
1318 </para>
1319 </section>
1320 <section id="SECID14">
1321 <title>Handling an incoming message</title>
1322 <para>
1323 <indexterm role="concept">
1324 <primary>spool directory</primary>
1325 <secondary>files that hold a message</secondary>
1326 </indexterm>
1327 <indexterm role="concept">
1328 <primary>file</primary>
1329 <secondary>how a message is held</secondary>
1330 </indexterm>
1331 When Exim accepts a message, it writes two files in its spool directory. The
1332 first contains the envelope information, the current status of the message, and
1333 the header lines, and the second contains the body of the message. The names of
1334 the two spool files consist of the message id, followed by <literal>-H</literal> for the
1335 file containing the envelope and header, and <literal>-D</literal> for the data file.
1336 </para>
1337 <para>
1338 <indexterm role="concept">
1339 <primary>spool directory</primary>
1340 <secondary><filename>input</filename> sub-directory</secondary>
1341 </indexterm>
1342 By default all these message files are held in a single directory called
1343 <filename>input</filename> inside the general Exim spool directory. Some operating systems do
1344 not perform very well if the number of files in a directory gets large; to
1345 improve performance in such cases, the <option>split_spool_directory</option> option can be
1346 used. This causes Exim to split up the input files into 62 sub-directories
1347 whose names are single letters or digits. When this is done, the queue is
1348 processed one sub-directory at a time instead of all at once, which can improve
1349 overall performance even when there are not enough files in each directory to
1350 affect file system performance.
1351 </para>
1352 <para>
1353 The envelope information consists of the address of the message&#x2019;s sender and
1354 the addresses of the recipients. This information is entirely separate from
1355 any addresses contained in the header lines. The status of the message includes
1356 a list of recipients who have already received the message. The format of the
1357 first spool file is described in chapter <xref linkend="CHAPspool"/>.
1358 </para>
1359 <para>
1360 <indexterm role="concept">
1361 <primary>rewriting</primary>
1362 <secondary>addresses</secondary>
1363 </indexterm>
1364 Address rewriting that is specified in the rewrite section of the configuration
1365 (see chapter <xref linkend="CHAPrewrite"/>) is done once and for all on incoming addresses,
1366 both in the header lines and the envelope, at the time the message is accepted.
1367 If during the course of delivery additional addresses are generated (for
1368 example, via aliasing), these new addresses are rewritten as soon as they are
1369 generated. At the time a message is actually delivered (transported) further
1370 rewriting can take place; because this is a transport option, it can be
1371 different for different forms of delivery. It is also possible to specify the
1372 addition or removal of certain header lines at the time the message is
1373 delivered (see chapters <xref linkend="CHAProutergeneric"/> and
1374 <xref linkend="CHAPtransportgeneric"/>).
1375 </para>
1376 </section>
1377 <section id="SECID15">
1378 <title>Life of a message</title>
1379 <para>
1380 <indexterm role="concept">
1381 <primary>message</primary>
1382 <secondary>life of</secondary>
1383 </indexterm>
1384 <indexterm role="concept">
1385 <primary>message</primary>
1386 <secondary>frozen</secondary>
1387 </indexterm>
1388 A message remains in the spool directory until it is completely delivered to
1389 its recipients or to an error address, or until it is deleted by an
1390 administrator or by the user who originally created it. In cases when delivery
1391 cannot proceed &ndash; for example, when a message can neither be delivered to its
1392 recipients nor returned to its sender, the message is marked <quote>frozen</quote> on the
1393 spool, and no more deliveries are attempted.
1394 </para>
1395 <para>
1396 <indexterm role="concept">
1397 <primary>frozen messages</primary>
1398 <secondary>thawing</secondary>
1399 </indexterm>
1400 <indexterm role="concept">
1401 <primary>message</primary>
1402 <secondary>thawing frozen</secondary>
1403 </indexterm>
1404 An administrator can <quote>thaw</quote> such messages when the problem has been
1405 corrected, and can also freeze individual messages by hand if necessary. In
1406 addition, an administrator can force a delivery error, causing a bounce message
1407 to be sent.
1408 </para>
1409 <para>
1410 <indexterm role="option">
1411 <primary><option>timeout_frozen_after</option></primary>
1412 </indexterm>
1413 <indexterm role="option">
1414 <primary><option>ignore_bounce_errors_after</option></primary>
1415 </indexterm>
1416 There are options called <option>ignore_bounce_errors_after</option> and
1417 <option>timeout_frozen_after</option>, which discard frozen messages after a certain time.
1418 The first applies only to frozen bounces, the second to any frozen messages.
1419 </para>
1420 <para>
1421 <indexterm role="concept">
1422 <primary>message</primary>
1423 <secondary>log file for</secondary>
1424 </indexterm>
1425 <indexterm role="concept">
1426 <primary>log</primary>
1427 <secondary>file for each message</secondary>
1428 </indexterm>
1429 While Exim is working on a message, it writes information about each delivery
1430 attempt to its main log file. This includes successful, unsuccessful, and
1431 delayed deliveries for each recipient (see chapter <xref linkend="CHAPlog"/>). The log
1432 lines are also written to a separate <emphasis>message log</emphasis> file for each message.
1433 These logs are solely for the benefit of the administrator, and are normally
1434 deleted along with the spool files when processing of a message is complete.
1435 The use of individual message logs can be disabled by setting
1436 <option>no_message_logs</option>; this might give an improvement in performance on very busy
1437 systems.
1438 </para>
1439 <para>
1440 <indexterm role="concept">
1441 <primary>journal file</primary>
1442 </indexterm>
1443 <indexterm role="concept">
1444 <primary>file</primary>
1445 <secondary>journal</secondary>
1446 </indexterm>
1447 All the information Exim itself needs to set up a delivery is kept in the first
1448 spool file, along with the header lines. When a successful delivery occurs, the
1449 address is immediately written at the end of a journal file, whose name is the
1450 message id followed by <literal>-J</literal>. At the end of a delivery run, if there are some
1451 addresses left to be tried again later, the first spool file (the <literal>-H</literal> file)
1452 is updated to indicate which these are, and the journal file is then deleted.
1453 Updating the spool file is done by writing a new file and renaming it, to
1454 minimize the possibility of data loss.
1455 </para>
1456 <para>
1457 Should the system or the program crash after a successful delivery but before
1458 the spool file has been updated, the journal is left lying around. The next
1459 time Exim attempts to deliver the message, it reads the journal file and
1460 updates the spool file before proceeding. This minimizes the chances of double
1461 deliveries caused by crashes.
1462 </para>
1463 </section>
1464 <section id="SECTprocaddress">
1465 <title>Processing an address for delivery</title>
1466 <para>
1467 <indexterm role="concept">
1468 <primary>drivers</primary>
1469 <secondary>definition of</secondary>
1470 </indexterm>
1471 <indexterm role="concept">
1472 <primary>router</primary>
1473 <secondary>definition of</secondary>
1474 </indexterm>
1475 <indexterm role="concept">
1476 <primary>transport</primary>
1477 <secondary>definition of</secondary>
1478 </indexterm>
1479 The main delivery processing elements of Exim are called <emphasis>routers</emphasis> and
1480 <emphasis>transports</emphasis>, and collectively these are known as <emphasis>drivers</emphasis>. Code for a
1481 number of them is provided in the source distribution, and compile-time options
1482 specify which ones are included in the binary. Run time options specify which
1483 ones are actually used for delivering messages.
1484 </para>
1485 <para>
1486 <indexterm role="concept">
1487 <primary>drivers</primary>
1488 <secondary>instance definition</secondary>
1489 </indexterm>
1490 Each driver that is specified in the run time configuration is an <emphasis>instance</emphasis>
1491 of that particular driver type. Multiple instances are allowed; for example,
1492 you can set up several different <command>smtp</command> transports, each with different
1493 option values that might specify different ports or different timeouts. Each
1494 instance has its own identifying name. In what follows we will normally use the
1495 instance name when discussing one particular instance (that is, one specific
1496 configuration of the driver), and the generic driver name when discussing
1497 the driver&#x2019;s features in general.
1498 </para>
1499 <para>
1500 A <emphasis>router</emphasis> is a driver that operates on an address, either determining how
1501 its delivery should happen, by assigning it to a specific transport, or
1502 converting the address into one or more new addresses (for example, via an
1503 alias file). A router may also explicitly choose to fail an address, causing it
1504 to be bounced.
1505 </para>
1506 <para>
1507 A <emphasis>transport</emphasis> is a driver that transmits a copy of the message from Exim&#x2019;s
1508 spool to some destination. There are two kinds of transport: for a <emphasis>local</emphasis>
1509 transport, the destination is a file or a pipe on the local host, whereas for a
1510 <emphasis>remote</emphasis> transport the destination is some other host. A message is passed
1511 to a specific transport as a result of successful routing. If a message has
1512 several recipients, it may be passed to a number of different transports.
1513 </para>
1514 <para>
1515 <indexterm role="concept">
1516 <primary>preconditions</primary>
1517 <secondary>definition of</secondary>
1518 </indexterm>
1519 An address is processed by passing it to each configured router instance in
1520 turn, subject to certain preconditions, until a router accepts the address or
1521 specifies that it should be bounced. We will describe this process in more
1522 detail shortly. First, as a simple example, we consider how each recipient
1523 address in a message is processed in a small configuration of three routers.
1524 </para>
1525 <para>
1526 To make this a more concrete example, it is described in terms of some actual
1527 routers, but remember, this is only an example. You can configure Exim&#x2019;s
1528 routers in many different ways, and there may be any number of routers in a
1529 configuration.
1530 </para>
1531 <para>
1532 The first router that is specified in a configuration is often one that handles
1533 addresses in domains that are not recognized specially by the local host. These
1534 are typically addresses for arbitrary domains on the Internet. A precondition
1535 is set up which looks for the special domains known to the host (for example,
1536 its own domain name), and the router is run for addresses that do <emphasis>not</emphasis>
1537 match. Typically, this is a router that looks up domains in the DNS in order to
1538 find the hosts to which this address routes. If it succeeds, the address is
1539 assigned to a suitable SMTP transport; if it does not succeed, the router is
1540 configured to fail the address.
1541 </para>
1542 <para>
1543 The second router is reached only when the domain is recognized as one that
1544 <quote>belongs</quote> to the local host. This router does redirection &ndash; also known as
1545 aliasing and forwarding. When it generates one or more new addresses from the
1546 original, each of them is routed independently from the start. Otherwise, the
1547 router may cause an address to fail, or it may simply decline to handle the
1548 address, in which case the address is passed to the next router.
1549 </para>
1550 <para>
1551 The final router in many configurations is one that checks to see if the
1552 address belongs to a local mailbox. The precondition may involve a check to
1553 see if the local part is the name of a login account, or it may look up the
1554 local part in a file or a database. If its preconditions are not met, or if
1555 the router declines, we have reached the end of the routers. When this happens,
1556 the address is bounced.
1557 </para>
1558 </section>
1559 <section id="SECID16">
1560 <title>Processing an address for verification</title>
1561 <para>
1562 <indexterm role="concept">
1563 <primary>router</primary>
1564 <secondary>for verification</secondary>
1565 </indexterm>
1566 <indexterm role="concept">
1567 <primary>verifying address</primary>
1568 <secondary>overview</secondary>
1569 </indexterm>
1570 As well as being used to decide how to deliver to an address, Exim&#x2019;s routers
1571 are also used for <emphasis>address verification</emphasis>. Verification can be requested as
1572 one of the checks to be performed in an ACL for incoming messages, on both
1573 sender and recipient addresses, and it can be tested using the <option>-bv</option> and
1574 <option>-bvs</option> command line options.
1575 </para>
1576 <para>
1577 When an address is being verified, the routers are run in <quote>verify mode</quote>. This
1578 does not affect the way the routers work, but it is a state that can be
1579 detected. By this means, a router can be skipped or made to behave differently
1580 when verifying. A common example is a configuration in which the first router
1581 sends all messages to a message-scanning program, unless they have been
1582 previously scanned. Thus, the first router accepts all addresses without any
1583 checking, making it useless for verifying. Normally, the <option>no_verify</option> option
1584 would be set for such a router, causing it to be skipped in verify mode.
1585 </para>
1586 </section>
1587 <section id="SECTrunindrou">
1588 <title>Running an individual router</title>
1589 <para>
1590 <indexterm role="concept">
1591 <primary>router</primary>
1592 <secondary>running details</secondary>
1593 </indexterm>
1594 <indexterm role="concept">
1595 <primary>preconditions</primary>
1596 <secondary>checking</secondary>
1597 </indexterm>
1598 <indexterm role="concept">
1599 <primary>router</primary>
1600 <secondary>result of running</secondary>
1601 </indexterm>
1602 As explained in the example above, a number of preconditions are checked before
1603 running a router. If any are not met, the router is skipped, and the address is
1604 passed to the next router. When all the preconditions on a router <emphasis>are</emphasis> met,
1605 the router is run. What happens next depends on the outcome, which is one of
1606 the following:
1607 </para>
1608 <itemizedlist>
1609 <listitem>
1610 <para>
1611 <emphasis>accept</emphasis>: The router accepts the address, and either assigns it to a
1612 transport, or generates one or more <quote>child</quote> addresses. Processing the
1613 original address ceases,
1614 <indexterm role="option">
1615 <primary><option>unseen</option></primary>
1616 </indexterm>
1617 unless the <option>unseen</option> option is set on the router. This option
1618 can be used to set up multiple deliveries with different routing (for example,
1619 for keeping archive copies of messages). When <option>unseen</option> is set, the address is
1620 passed to the next router. Normally, however, an <emphasis>accept</emphasis> return marks the
1621 end of routing.
1622 </para>
1623 <para>
1624 Any child addresses generated by the router are processed independently,
1625 starting with the first router by default. It is possible to change this by
1626 setting the <option>redirect_router</option> option to specify which router to start at for
1627 child addresses. Unlike <option>pass_router</option> (see below) the router specified by
1628 <option>redirect_router</option> may be anywhere in the router configuration.
1629 </para>
1630 </listitem>
1631 <listitem>
1632 <para>
1633 <emphasis>pass</emphasis>: The router recognizes the address, but cannot handle it itself. It
1634 requests that the address be passed to another router. By default the address
1635 is passed to the next router, but this can be changed by setting the
1636 <option>pass_router</option> option. However, (unlike <option>redirect_router</option>) the named router
1637 must be below the current router (to avoid loops).
1638 </para>
1639 </listitem>
1640 <listitem>
1641 <para>
1642 <emphasis>decline</emphasis>: The router declines to accept the address because it does not
1643 recognize it at all. By default, the address is passed to the next router, but
1644 this can be prevented by setting the <option>no_more</option> option. When <option>no_more</option> is
1645 set, all the remaining routers are skipped. In effect, <option>no_more</option> converts
1646 <emphasis>decline</emphasis> into <emphasis>fail</emphasis>.
1647 </para>
1648 </listitem>
1649 <listitem>
1650 <para>
1651 <emphasis>fail</emphasis>: The router determines that the address should fail, and queues it for
1652 the generation of a bounce message. There is no further processing of the
1653 original address unless <option>unseen</option> is set on the router.
1654 </para>
1655 </listitem>
1656 <listitem>
1657 <para>
1658 <emphasis>defer</emphasis>: The router cannot handle the address at the present time. (A
1659 database may be offline, or a DNS lookup may have timed out.) No further
1660 processing of the address happens in this delivery attempt. It is tried again
1661 next time the message is considered for delivery.
1662 </para>
1663 </listitem>
1664 <listitem>
1665 <para>
1666 <emphasis>error</emphasis>: There is some error in the router (for example, a syntax error in
1667 its configuration). The action is as for defer.
1668 </para>
1669 </listitem>
1670 </itemizedlist>
1671 <para>
1672 If an address reaches the end of the routers without having been accepted by
1673 any of them, it is bounced as unrouteable. The default error message in this
1674 situation is <quote>unrouteable address</quote>, but you can set your own message by
1675 making use of the <option>cannot_route_message</option> option. This can be set for any
1676 router; the value from the last router that <quote>saw</quote> the address is used.
1677 </para>
1678 <para>
1679 Sometimes while routing you want to fail a delivery when some conditions are
1680 met but others are not, instead of passing the address on for further routing.
1681 You can do this by having a second router that explicitly fails the delivery
1682 when the relevant conditions are met. The <command>redirect</command> router has a <quote>fail</quote>
1683 facility for this purpose.
1684 </para>
1685 </section>
1686 <section id="SECID17">
1687 <title>Duplicate addresses</title>
1688 <para>
1689 <indexterm role="concept">
1690 <primary>case of local parts</primary>
1691 </indexterm>
1692 <indexterm role="concept">
1693 <primary>address duplicate, discarding</primary>
1694 </indexterm>
1695 <indexterm role="concept">
1696 <primary>duplicate addresses</primary>
1697 </indexterm>
1698 Once routing is complete, Exim scans the addresses that are assigned to local
1699 and remote transports, and discards any duplicates that it finds. During this
1700 check, local parts are treated as case-sensitive. This happens only when
1701 actually delivering a message; when testing routers with <option>-bt</option>, all the
1702 routed addresses are shown.
1703 </para>
1704 </section>
1705 <section id="SECTrouprecon">
1706 <title>Router preconditions</title>
1707 <para>
1708 <indexterm role="concept">
1709 <primary>router</primary>
1710 <secondary>preconditions, order of processing</secondary>
1711 </indexterm>
1712 <indexterm role="concept">
1713 <primary>preconditions</primary>
1714 <secondary>order of processing</secondary>
1715 </indexterm>
1716 The preconditions that are tested for each router are listed below, in the
1717 order in which they are tested. The individual configuration options are
1718 described in more detail in chapter <xref linkend="CHAProutergeneric"/>.
1719 </para>
1720 <itemizedlist>
1721 <listitem>
1722 <para>
1723 The <option>local_part_prefix</option> and <option>local_part_suffix</option> options can specify that
1724 the local parts handled by the router may or must have certain prefixes and/or
1725 suffixes. If a mandatory affix (prefix or suffix) is not present, the router is
1726 skipped. These conditions are tested first. When an affix is present, it is
1727 removed from the local part before further processing, including the evaluation
1728 of any other conditions.
1729 </para>
1730 </listitem>
1731 <listitem>
1732 <para>
1733 Routers can be designated for use only when not verifying an address, that is,
1734 only when routing it for delivery (or testing its delivery routing). If the
1735 <option>verify</option> option is set false, the router is skipped when Exim is verifying an
1736 address.
1737 Setting the <option>verify</option> option actually sets two options, <option>verify_sender</option> and
1738 <option>verify_recipient</option>, which independently control the use of the router for
1739 sender and recipient verification. You can set these options directly if
1740 you want a router to be used for only one type of verification.
1741 Note that cutthrough delivery is classed as a recipient verification for this purpose.
1742 </para>
1743 </listitem>
1744 <listitem>
1745 <para>
1746 If the <option>address_test</option> option is set false, the router is skipped when Exim is
1747 run with the <option>-bt</option> option to test an address routing. This can be helpful
1748 when the first router sends all new messages to a scanner of some sort; it
1749 makes it possible to use <option>-bt</option> to test subsequent delivery routing without
1750 having to simulate the effect of the scanner.
1751 </para>
1752 </listitem>
1753 <listitem>
1754 <para>
1755 Routers can be designated for use only when verifying an address, as
1756 opposed to routing it for delivery. The <option>verify_only</option> option controls this.
1757 Again, cutthrough delivery counts as a verification.
1758 </para>
1759 </listitem>
1760 <listitem>
1761 <para>
1762 Individual routers can be explicitly skipped when running the routers to
1763 check an address given in the SMTP EXPN command (see the <option>expn</option> option).
1764 </para>
1765 </listitem>
1766 <listitem>
1767 <para>
1768 If the <option>domains</option> option is set, the domain of the address must be in the set
1769 of domains that it defines.
1770 </para>
1771 </listitem>
1772 <listitem>
1773 <para>
1774 <indexterm role="variable">
1775 <primary><varname>$local_part_prefix</varname></primary>
1776 </indexterm>
1777 <indexterm role="variable">
1778 <primary><varname>$local_part</varname></primary>
1779 </indexterm>
1780 <indexterm role="variable">
1781 <primary><varname>$local_part_suffix</varname></primary>
1782 </indexterm>
1783 If the <option>local_parts</option> option is set, the local part of the address must be in
1784 the set of local parts that it defines. If <option>local_part_prefix</option> or
1785 <option>local_part_suffix</option> is in use, the prefix or suffix is removed from the local
1786 part before this check. If you want to do precondition tests on local parts
1787 that include affixes, you can do so by using a <option>condition</option> option (see below)
1788 that uses the variables <varname>$local_part</varname>, <varname>$local_part_prefix</varname>, and
1789 <varname>$local_part_suffix</varname> as necessary.
1790 </para>
1791 </listitem>
1792 <listitem>
1793 <para>
1794 <indexterm role="variable">
1795 <primary><varname>$local_user_uid</varname></primary>
1796 </indexterm>
1797 <indexterm role="variable">
1798 <primary><varname>$local_user_gid</varname></primary>
1799 </indexterm>
1800 <indexterm role="variable">
1801 <primary><varname>$home</varname></primary>
1802 </indexterm>
1803 If the <option>check_local_user</option> option is set, the local part must be the name of
1804 an account on the local host. If this check succeeds, the uid and gid of the
1805 local user are placed in <varname>$local_user_uid</varname> and <varname>$local_user_gid</varname> and the
1806 user&#x2019;s home directory is placed in <varname>$home</varname>; these values can be used in the
1807 remaining preconditions.
1808 </para>
1809 </listitem>
1810 <listitem>
1811 <para>
1812 If the <option>router_home_directory</option> option is set, it is expanded at this point,
1813 because it overrides the value of <varname>$home</varname>. If this expansion were left till
1814 later, the value of <varname>$home</varname> as set by <option>check_local_user</option> would be used in
1815 subsequent tests. Having two different values of <varname>$home</varname> in the same router
1816 could lead to confusion.
1817 </para>
1818 </listitem>
1819 <listitem>
1820 <para>
1821 If the <option>senders</option> option is set, the envelope sender address must be in the
1822 set of addresses that it defines.
1823 </para>
1824 </listitem>
1825 <listitem>
1826 <para>
1827 If the <option>require_files</option> option is set, the existence or non-existence of
1828 specified files is tested.
1829 </para>
1830 </listitem>
1831 <listitem>
1832 <para>
1833 <indexterm role="concept">
1834 <primary>customizing</primary>
1835 <secondary>precondition</secondary>
1836 </indexterm>
1837 If the <option>condition</option> option is set, it is evaluated and tested. This option
1838 uses an expanded string to allow you to set up your own custom preconditions.
1839 Expanded strings are described in chapter <xref linkend="CHAPexpand"/>.
1840 </para>
1841 </listitem>
1842 </itemizedlist>
1843 <para>
1844 Note that <option>require_files</option> comes near the end of the list, so you cannot use
1845 it to check for the existence of a file in which to lookup up a domain, local
1846 part, or sender. However, as these options are all expanded, you can use the
1847 <option>exists</option> expansion condition to make such tests within each condition. The
1848 <option>require_files</option> option is intended for checking files that the router may be
1849 going to use internally, or which are needed by a specific transport (for
1850 example, <filename>.procmailrc</filename>).
1851 </para>
1852 </section>
1853 <section id="SECID18">
1854 <title>Delivery in detail</title>
1855 <para>
1856 <indexterm role="concept">
1857 <primary>delivery</primary>
1858 <secondary>in detail</secondary>
1859 </indexterm>
1860 When a message is to be delivered, the sequence of events is as follows:
1861 </para>
1862 <itemizedlist>
1863 <listitem>
1864 <para>
1865 If a system-wide filter file is specified, the message is passed to it. The
1866 filter may add recipients to the message, replace the recipients, discard the
1867 message, cause a new message to be generated, or cause the message delivery to
1868 fail. The format of the system filter file is the same as for Exim user filter
1869 files, described in the separate document entitled <emphasis>Exim&#x2019;s interfaces to mail
1870 filtering</emphasis>.
1871 <indexterm role="concept">
1872 <primary>Sieve filter</primary>
1873 <secondary>not available for system filter</secondary>
1874 </indexterm>
1875 (<emphasis role="bold">Note</emphasis>: Sieve cannot be used for system filter files.)
1876 </para>
1877 <para>
1878 Some additional features are available in system filters &ndash; see chapter
1879 <xref linkend="CHAPsystemfilter"/> for details. Note that a message is passed to the system
1880 filter only once per delivery attempt, however many recipients it has. However,
1881 if there are several delivery attempts because one or more addresses could not
1882 be immediately delivered, the system filter is run each time. The filter
1883 condition <option>first_delivery</option> can be used to detect the first run of the system
1884 filter.
1885 </para>
1886 </listitem>
1887 <listitem>
1888 <para>
1889 Each recipient address is offered to each configured router in turn, subject to
1890 its preconditions, until one is able to handle it. If no router can handle the
1891 address, that is, if they all decline, the address is failed. Because routers
1892 can be targeted at particular domains, several locally handled domains can be
1893 processed entirely independently of each other.
1894 </para>
1895 </listitem>
1896 <listitem>
1897 <para>
1898 <indexterm role="concept">
1899 <primary>routing</primary>
1900 <secondary>loops in</secondary>
1901 </indexterm>
1902 <indexterm role="concept">
1903 <primary>loop</primary>
1904 <secondary>while routing</secondary>
1905 </indexterm>
1906 A router that accepts an address may assign it to a local or a remote
1907 transport. However, the transport is not run at this time. Instead, the address
1908 is placed on a list for the particular transport, which will be run later.
1909 Alternatively, the router may generate one or more new addresses (typically
1910 from alias, forward, or filter files). New addresses are fed back into this
1911 process from the top, but in order to avoid loops, a router ignores any address
1912 which has an identically-named ancestor that was processed by itself.
1913 </para>
1914 </listitem>
1915 <listitem>
1916 <para>
1917 When all the routing has been done, addresses that have been successfully
1918 handled are passed to their assigned transports. When local transports are
1919 doing real local deliveries, they handle only one address at a time, but if a
1920 local transport is being used as a pseudo-remote transport (for example, to
1921 collect batched SMTP messages for transmission by some other means) multiple
1922 addresses can be handled. Remote transports can always handle more than one
1923 address at a time, but can be configured not to do so, or to restrict multiple
1924 addresses to the same domain.
1925 </para>
1926 </listitem>
1927 <listitem>
1928 <para>
1929 Each local delivery to a file or a pipe runs in a separate process under a
1930 non-privileged uid, and these deliveries are run one at a time. Remote
1931 deliveries also run in separate processes, normally under a uid that is private
1932 to Exim (<quote>the Exim user</quote>), but in this case, several remote deliveries can be
1933 run in parallel. The maximum number of simultaneous remote deliveries for any
1934 one message is set by the <option>remote_max_parallel</option> option.
1935 The order in which deliveries are done is not defined, except that all local
1936 deliveries happen before any remote deliveries.
1937 </para>
1938 </listitem>
1939 <listitem>
1940 <para>
1941 <indexterm role="concept">
1942 <primary>queue runner</primary>
1943 </indexterm>
1944 When it encounters a local delivery during a queue run, Exim checks its retry
1945 database to see if there has been a previous temporary delivery failure for the
1946 address before running the local transport. If there was a previous failure,
1947 Exim does not attempt a new delivery until the retry time for the address is
1948 reached. However, this happens only for delivery attempts that are part of a
1949 queue run. Local deliveries are always attempted when delivery immediately
1950 follows message reception, even if retry times are set for them. This makes for
1951 better behaviour if one particular message is causing problems (for example,
1952 causing quota overflow, or provoking an error in a filter file).
1953 </para>
1954 </listitem>
1955 <listitem>
1956 <para>
1957 <indexterm role="concept">
1958 <primary>delivery</primary>
1959 <secondary>retry in remote transports</secondary>
1960 </indexterm>
1961 Remote transports do their own retry handling, since an address may be
1962 deliverable to one of a number of hosts, each of which may have a different
1963 retry time. If there have been previous temporary failures and no host has
1964 reached its retry time, no delivery is attempted, whether in a queue run or
1965 not. See chapter <xref linkend="CHAPretry"/> for details of retry strategies.
1966 </para>
1967 </listitem>
1968 <listitem>
1969 <para>
1970 If there were any permanent errors, a bounce message is returned to an
1971 appropriate address (the sender in the common case), with details of the error
1972 for each failing address. Exim can be configured to send copies of bounce
1973 messages to other addresses.
1974 </para>
1975 </listitem>
1976 <listitem>
1977 <para>
1978 <indexterm role="concept">
1979 <primary>delivery</primary>
1980 <secondary>deferral</secondary>
1981 </indexterm>
1982 If one or more addresses suffered a temporary failure, the message is left on
1983 the queue, to be tried again later. Delivery of these addresses is said to be
1984 <emphasis>deferred</emphasis>.
1985 </para>
1986 </listitem>
1987 <listitem>
1988 <para>
1989 When all the recipient addresses have either been delivered or bounced,
1990 handling of the message is complete. The spool files and message log are
1991 deleted, though the message log can optionally be preserved if required.
1992 </para>
1993 </listitem>
1994 </itemizedlist>
1995 </section>
1996 <section id="SECID19">
1997 <title>Retry mechanism</title>
1998 <para>
1999 <indexterm role="concept">
2000 <primary>delivery</primary>
2001 <secondary>retry mechanism</secondary>
2002 </indexterm>
2003 <indexterm role="concept">
2004 <primary>retry</primary>
2005 <secondary>description of mechanism</secondary>
2006 </indexterm>
2007 <indexterm role="concept">
2008 <primary>queue runner</primary>
2009 </indexterm>
2010 Exim&#x2019;s mechanism for retrying messages that fail to get delivered at the first
2011 attempt is the queue runner process. You must either run an Exim daemon that
2012 uses the <option>-q</option> option with a time interval to start queue runners at regular
2013 intervals, or use some other means (such as <emphasis>cron</emphasis>) to start them. If you do
2014 not arrange for queue runners to be run, messages that fail temporarily at the
2015 first attempt will remain on your queue for ever. A queue runner process works
2016 its way through the queue, one message at a time, trying each delivery that has
2017 passed its retry time.
2018 You can run several queue runners at once.
2019 </para>
2020 <para>
2021 Exim uses a set of configured rules to determine when next to retry the failing
2022 address (see chapter <xref linkend="CHAPretry"/>). These rules also specify when Exim
2023 should give up trying to deliver to the address, at which point it generates a
2024 bounce message. If no retry rules are set for a particular host, address, and
2025 error combination, no retries are attempted, and temporary errors are treated
2026 as permanent.
2027 </para>
2028 </section>
2029 <section id="SECID20">
2030 <title>Temporary delivery failure</title>
2031 <para>
2032 <indexterm role="concept">
2033 <primary>delivery</primary>
2034 <secondary>temporary failure</secondary>
2035 </indexterm>
2036 There are many reasons why a message may not be immediately deliverable to a
2037 particular address. Failure to connect to a remote machine (because it, or the
2038 connection to it, is down) is one of the most common. Temporary failures may be
2039 detected during routing as well as during the transport stage of delivery.
2040 Local deliveries may be delayed if NFS files are unavailable, or if a mailbox
2041 is on a file system where the user is over quota. Exim can be configured to
2042 impose its own quotas on local mailboxes; where system quotas are set they will
2043 also apply.
2044 </para>
2045 <para>
2046 If a host is unreachable for a period of time, a number of messages may be
2047 waiting for it by the time it recovers, and sending them in a single SMTP
2048 connection is clearly beneficial. Whenever a delivery to a remote host is
2049 deferred,
2050 <indexterm role="concept">
2051 <primary>hints database</primary>
2052 </indexterm>
2053 Exim makes a note in its hints database, and whenever a successful
2054 SMTP delivery has happened, it looks to see if any other messages are waiting
2055 for the same host. If any are found, they are sent over the same SMTP
2056 connection, subject to a configuration limit as to the maximum number in any
2057 one connection.
2058 </para>
2059 </section>
2060 <section id="SECID21">
2061 <title>Permanent delivery failure</title>
2062 <para>
2063 <indexterm role="concept">
2064 <primary>delivery</primary>
2065 <secondary>permanent failure</secondary>
2066 </indexterm>
2067 <indexterm role="concept">
2068 <primary>bounce message</primary>
2069 <secondary>when generated</secondary>
2070 </indexterm>
2071 When a message cannot be delivered to some or all of its intended recipients, a
2072 bounce message is generated. Temporary delivery failures turn into permanent
2073 errors when their timeout expires. All the addresses that fail in a given
2074 delivery attempt are listed in a single message. If the original message has
2075 many recipients, it is possible for some addresses to fail in one delivery
2076 attempt and others to fail subsequently, giving rise to more than one bounce
2077 message. The wording of bounce messages can be customized by the administrator.
2078 See chapter <xref linkend="CHAPemsgcust"/> for details.
2079 </para>
2080 <para>
2081 <indexterm role="concept">
2082 <primary><emphasis>X-Failed-Recipients:</emphasis> header line</primary>
2083 </indexterm>
2084 Bounce messages contain an <emphasis>X-Failed-Recipients:</emphasis> header line that lists the
2085 failed addresses, for the benefit of programs that try to analyse such messages
2086 automatically.
2087 </para>
2088 <para>
2089 <indexterm role="concept">
2090 <primary>bounce message</primary>
2091 <secondary>recipient of</secondary>
2092 </indexterm>
2093 A bounce message is normally sent to the sender of the original message, as
2094 obtained from the message&#x2019;s envelope. For incoming SMTP messages, this is the
2095 address given in the MAIL command. However, when an address is expanded via a
2096 forward or alias file, an alternative address can be specified for delivery
2097 failures of the generated addresses. For a mailing list expansion (see section
2098 <xref linkend="SECTmailinglists"/>) it is common to direct bounce messages to the manager
2099 of the list.
2100 </para>
2101 </section>
2102 <section id="SECID22">
2103 <title>Failures to deliver bounce messages</title>
2104 <para>
2105 <indexterm role="concept">
2106 <primary>bounce message</primary>
2107 <secondary>failure to deliver</secondary>
2108 </indexterm>
2109 If a bounce message (either locally generated or received from a remote host)
2110 itself suffers a permanent delivery failure, the message is left on the queue,
2111 but it is frozen, awaiting the attention of an administrator. There are options
2112 that can be used to make Exim discard such failed messages, or to keep them
2113 for only a short time (see <option>timeout_frozen_after</option> and
2114 <option>ignore_bounce_errors_after</option>).
2115 </para>
2116 </section>
2117 </chapter>
2118
2119 <chapter id="CHID3">
2120 <title>Building and installing Exim</title>
2121 <para>
2122 <indexterm role="concept" id="IIDbuex" class="startofrange">
2123 <primary>building Exim</primary>
2124 </indexterm>
2125 </para>
2126 <section id="SECID23">
2127 <title>Unpacking</title>
2128 <para>
2129 Exim is distributed as a gzipped or bzipped tar file which, when unpacked,
2130 creates a directory with the name of the current release (for example,
2131 <filename>exim-4.86</filename>) into which the following files are placed:
2132 </para>
2133 <informaltable frame="none">
2134 <tgroup cols="2" colsep="0" rowsep="0">
2135 <colspec colwidth="140pt" align="left"/>
2136 <colspec colwidth="254pt" align="left"/>
2137 <tbody>
2138 <row>
2139 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<filename>ACKNOWLEDGMENTS</filename></entry>
2140 <entry>contains some acknowledgments</entry>
2141 </row>
2142 <row>
2143 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<filename>CHANGES</filename></entry>
2144 <entry>contains a reference to where changes are documented</entry>
2145 </row>
2146 <row>
2147 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<filename>LICENCE</filename></entry>
2148 <entry>the GNU General Public Licence</entry>
2149 </row>
2150 <row>
2151 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<filename>Makefile</filename></entry>
2152 <entry>top-level make file</entry>
2153 </row>
2154 <row>
2155 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<filename>NOTICE</filename></entry>
2156 <entry>conditions for the use of Exim</entry>
2157 </row>
2158 <row>
2159 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<filename>README</filename></entry>
2160 <entry>list of files, directories and simple build instructions</entry>
2161 </row>
2162 </tbody>
2163 </tgroup>
2164 </informaltable>
2165 <para>
2166 Other files whose names begin with <filename>README</filename> may also be present. The
2167 following subdirectories are created:
2168 </para>
2169 <informaltable frame="none">
2170 <tgroup cols="2" colsep="0" rowsep="0">
2171 <colspec colwidth="140pt" align="left"/>
2172 <colspec colwidth="254pt" align="left"/>
2173 <tbody>
2174 <row>
2175 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<filename>Local</filename></entry>
2176 <entry>an empty directory for local configuration files</entry>
2177 </row>
2178 <row>
2179 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<filename>OS</filename></entry>
2180 <entry>OS-specific files</entry>
2181 </row>
2182 <row>
2183 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<filename>doc</filename></entry>
2184 <entry>documentation files</entry>
2185 </row>
2186 <row>
2187 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<filename>exim_monitor</filename></entry>
2188 <entry>source files for the Exim monitor</entry>
2189 </row>
2190 <row>
2191 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<filename>scripts</filename></entry>
2192 <entry>scripts used in the build process</entry>
2193 </row>
2194 <row>
2195 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<filename>src</filename></entry>
2196 <entry>remaining source files</entry>
2197 </row>
2198 <row>
2199 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<filename>util</filename></entry>
2200 <entry>independent utilities</entry>
2201 </row>
2202 </tbody>
2203 </tgroup>
2204 </informaltable>
2205 <para>
2206 The main utility programs are contained in the <filename>src</filename> directory, and are built
2207 with the Exim binary. The <filename>util</filename> directory contains a few optional scripts
2208 that may be useful to some sites.
2209 </para>
2210 </section>
2211 <section id="SECID24">
2212 <title>Multiple machine architectures and operating systems</title>
2213 <para>
2214 <indexterm role="concept">
2215 <primary>building Exim</primary>
2216 <secondary>multiple OS/architectures</secondary>
2217 </indexterm>
2218 The building process for Exim is arranged to make it easy to build binaries for
2219 a number of different architectures and operating systems from the same set of
2220 source files. Compilation does not take place in the <filename>src</filename> directory.
2221 Instead, a <emphasis>build directory</emphasis> is created for each architecture and operating
2222 system.
2223 <indexterm role="concept">
2224 <primary>symbolic link</primary>
2225 <secondary>to build directory</secondary>
2226 </indexterm>
2227 Symbolic links to the sources are installed in this directory, which is where
2228 the actual building takes place. In most cases, Exim can discover the machine
2229 architecture and operating system for itself, but the defaults can be
2230 overridden if necessary.
2231 </para>
2232 </section>
2233 <section id="SECTpcre">
2234 <title>PCRE library</title>
2235 <para>
2236 <indexterm role="concept">
2237 <primary>PCRE library</primary>
2238 </indexterm>
2239 Exim no longer has an embedded PCRE library as the vast majority of
2240 modern systems include PCRE as a system library, although you may need
2241 to install the PCRE or PCRE development package for your operating
2242 system. If your system has a normal PCRE installation the Exim build
2243 process will need no further configuration. If the library or the
2244 headers are in an unusual location you will need to either set the PCRE_LIBS
2245 and INCLUDE directives appropriately,
2246 or set PCRE_CONFIG=yes to use the installed <command>pcre-config</command> command.
2247 If your operating system has no
2248 PCRE support then you will need to obtain and build the current PCRE
2249 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>.
2250 More information on PCRE is available at <emphasis role="bold"><ulink url="http://www.pcre.org/">http://www.pcre.org/</ulink></emphasis>.
2251 </para>
2252 </section>
2253 <section id="SECTdb">
2254 <title>DBM libraries</title>
2255 <para>
2256 <indexterm role="concept">
2257 <primary>DBM libraries</primary>
2258 <secondary>discussion of</secondary>
2259 </indexterm>
2260 <indexterm role="concept">
2261 <primary>hints database</primary>
2262 <secondary>DBM files used for</secondary>
2263 </indexterm>
2264 Even if you do not use any DBM files in your configuration, Exim still needs a
2265 DBM library in order to operate, because it uses indexed files for its hints
2266 databases. Unfortunately, there are a number of DBM libraries in existence, and
2267 different operating systems often have different ones installed.
2268 </para>
2269 <para>
2270 <indexterm role="concept">
2271 <primary>Solaris</primary>
2272 <secondary>DBM library for</secondary>
2273 </indexterm>
2274 <indexterm role="concept">
2275 <primary>IRIX, DBM library for</primary>
2276 </indexterm>
2277 <indexterm role="concept">
2278 <primary>BSD, DBM library for</primary>
2279 </indexterm>
2280 <indexterm role="concept">
2281 <primary>Linux, DBM library for</primary>
2282 </indexterm>
2283 If you are using Solaris, IRIX, one of the modern BSD systems, or a modern
2284 Linux distribution, the DBM configuration should happen automatically, and you
2285 may be able to ignore this section. Otherwise, you may have to learn more than
2286 you would like about DBM libraries from what follows.
2287 </para>
2288 <para>
2289 <indexterm role="concept">
2290 <primary><emphasis>ndbm</emphasis> DBM library</primary>
2291 </indexterm>
2292 Licensed versions of Unix normally contain a library of DBM functions operating
2293 via the <emphasis>ndbm</emphasis> interface, and this is what Exim expects by default. Free
2294 versions of Unix seem to vary in what they contain as standard. In particular,
2295 some early versions of Linux have no default DBM library, and different
2296 distributors have chosen to bundle different libraries with their packaged
2297 versions. However, the more recent releases seem to have standardized on the
2298 Berkeley DB library.
2299 </para>
2300 <para>
2301 Different DBM libraries have different conventions for naming the files they
2302 use. When a program opens a file called <filename>dbmfile</filename>, there are several
2303 possibilities:
2304 </para>
2305 <orderedlist numeration="arabic">
2306 <listitem>
2307 <para>
2308 A traditional <emphasis>ndbm</emphasis> implementation, such as that supplied as part of
2309 Solaris, operates on two files called <filename>dbmfile.dir</filename> and <filename>dbmfile.pag</filename>.
2310 </para>
2311 </listitem>
2312 <listitem>
2313 <para>
2314 <indexterm role="concept">
2315 <primary><emphasis>gdbm</emphasis> DBM library</primary>
2316 </indexterm>
2317 The GNU library, <emphasis>gdbm</emphasis>, operates on a single file. If used via its <emphasis>ndbm</emphasis>
2318 compatibility interface it makes two different hard links to it with names
2319 <filename>dbmfile.dir</filename> and <filename>dbmfile.pag</filename>, but if used via its native interface, the
2320 file name is used unmodified.
2321 </para>
2322 </listitem>
2323 <listitem>
2324 <para>
2325 <indexterm role="concept">
2326 <primary>Berkeley DB library</primary>
2327 </indexterm>
2328 The Berkeley DB package, if called via its <emphasis>ndbm</emphasis> compatibility interface,
2329 operates on a single file called <filename>dbmfile.db</filename>, but otherwise looks to the
2330 programmer exactly the same as the traditional <emphasis>ndbm</emphasis> implementation.
2331 </para>
2332 </listitem>
2333 <listitem>
2334 <para>
2335 If the Berkeley package is used in its native mode, it operates on a single
2336 file called <filename>dbmfile</filename>; the programmer&#x2019;s interface is somewhat different to
2337 the traditional <emphasis>ndbm</emphasis> interface.
2338 </para>
2339 </listitem>
2340 <listitem>
2341 <para>
2342 To complicate things further, there are several very different versions of the
2343 Berkeley DB package. Version 1.85 was stable for a very long time, releases
2344 2.<emphasis>x</emphasis> and 3.<emphasis>x</emphasis> were current for a while, but the latest versions are now
2345 numbered 4.<emphasis>x</emphasis>. Maintenance of some of the earlier releases has ceased. All
2346 versions of Berkeley DB can be obtained from
2347 <emphasis role="bold"><ulink url="http://www.sleepycat.com/">http://www.sleepycat.com/</ulink></emphasis>.
2348 </para>
2349 </listitem>
2350 <listitem>
2351 <para>
2352 <indexterm role="concept">
2353 <primary><emphasis>tdb</emphasis> DBM library</primary>
2354 </indexterm>
2355 Yet another DBM library, called <emphasis>tdb</emphasis>, is available from
2356 <emphasis role="bold"><ulink url="http://download.sourceforge.net/tdb">http://download.sourceforge.net/tdb</ulink></emphasis>. It has its own interface, and also
2357 operates on a single file.
2358 </para>
2359 </listitem>
2360 </orderedlist>
2361 <para>
2362 <indexterm role="concept">
2363 <primary>USE_DB</primary>
2364 </indexterm>
2365 <indexterm role="concept">
2366 <primary>DBM libraries</primary>
2367 <secondary>configuration for building</secondary>
2368 </indexterm>
2369 Exim and its utilities can be compiled to use any of these interfaces. In order
2370 to use any version of the Berkeley DB package in native mode, you must set
2371 USE_DB in an appropriate configuration file (typically
2372 <filename>Local/Makefile</filename>). For example:
2373 </para>
2374 <literallayout class="monospaced">
2375 USE_DB=yes
2376 </literallayout>
2377 <para>
2378 Similarly, for gdbm you set USE_GDBM, and for tdb you set USE_TDB. An
2379 error is diagnosed if you set more than one of these.
2380 </para>
2381 <para>
2382 At the lowest level, the build-time configuration sets none of these options,
2383 thereby assuming an interface of type (1). However, some operating system
2384 configuration files (for example, those for the BSD operating systems and
2385 Linux) assume type (4) by setting USE_DB as their default, and the
2386 configuration files for Cygwin set USE_GDBM. Anything you set in
2387 <filename>Local/Makefile</filename>, however, overrides these system defaults.
2388 </para>
2389 <para>
2390 As well as setting USE_DB, USE_GDBM, or USE_TDB, it may also be
2391 necessary to set DBMLIB, to cause inclusion of the appropriate library, as
2392 in one of these lines:
2393 </para>
2394 <literallayout class="monospaced">
2395 DBMLIB = -ldb
2396 DBMLIB = -ltdb
2397 </literallayout>
2398 <para>
2399 Settings like that will work if the DBM library is installed in the standard
2400 place. Sometimes it is not, and the library&#x2019;s header file may also not be in
2401 the default path. You may need to set INCLUDE to specify where the header
2402 file is, and to specify the path to the library more fully in DBMLIB, as in
2403 this example:
2404 </para>
2405 <literallayout class="monospaced">
2406 INCLUDE=-I/usr/local/include/db-4.1
2407 DBMLIB=/usr/local/lib/db-4.1/libdb.a
2408 </literallayout>
2409 <para>
2410 There is further detailed discussion about the various DBM libraries in the
2411 file <filename>doc/dbm.discuss.txt</filename> in the Exim distribution.
2412 </para>
2413 </section>
2414 <section id="SECID25">
2415 <title>Pre-building configuration</title>
2416 <para>
2417 <indexterm role="concept">
2418 <primary>building Exim</primary>
2419 <secondary>pre-building configuration</secondary>
2420 </indexterm>
2421 <indexterm role="concept">
2422 <primary>configuration for building Exim</primary>
2423 </indexterm>
2424 <indexterm role="concept">
2425 <primary><filename>Local/Makefile</filename></primary>
2426 </indexterm>
2427 <indexterm role="concept">
2428 <primary><filename>src/EDITME</filename></primary>
2429 </indexterm>
2430 Before building Exim, a local configuration file that specifies options
2431 independent of any operating system has to be created with the name
2432 <filename>Local/Makefile</filename>. A template for this file is supplied as the file
2433 <filename>src/EDITME</filename>, and it contains full descriptions of all the option settings
2434 therein. These descriptions are therefore not repeated here. If you are
2435 building Exim for the first time, the simplest thing to do is to copy
2436 <filename>src/EDITME</filename> to <filename>Local/Makefile</filename>, then read it and edit it appropriately.
2437 </para>
2438 <para>
2439 There are three settings that you must supply, because Exim will not build
2440 without them. They are the location of the run time configuration file
2441 (CONFIGURE_FILE), the directory in which Exim binaries will be installed
2442 (BIN_DIRECTORY), and the identity of the Exim user (EXIM_USER and
2443 maybe EXIM_GROUP as well). The value of CONFIGURE_FILE can in fact be
2444 a colon-separated list of file names; Exim uses the first of them that exists.
2445 </para>
2446 <para>
2447 There are a few other parameters that can be specified either at build time or
2448 at run time, to enable the same binary to be used on a number of different
2449 machines. However, if the locations of Exim&#x2019;s spool directory and log file
2450 directory (if not within the spool directory) are fixed, it is recommended that
2451 you specify them in <filename>Local/Makefile</filename> instead of at run time, so that errors
2452 detected early in Exim&#x2019;s execution (such as a malformed configuration file) can
2453 be logged.
2454 </para>
2455 <para>
2456 <indexterm role="concept">
2457 <primary>content scanning</primary>
2458 <secondary>specifying at build time</secondary>
2459 </indexterm>
2460 Exim&#x2019;s interfaces for calling virus and spam scanning software directly from
2461 access control lists are not compiled by default. If you want to include these
2462 facilities, you need to set
2463 </para>
2464 <literallayout class="monospaced">
2465 WITH_CONTENT_SCAN=yes
2466 </literallayout>
2467 <para>
2468 in your <filename>Local/Makefile</filename>. For details of the facilities themselves, see
2469 chapter <xref linkend="CHAPexiscan"/>.
2470 </para>
2471 <para>
2472 <indexterm role="concept">
2473 <primary><filename>Local/eximon.conf</filename></primary>
2474 </indexterm>
2475 <indexterm role="concept">
2476 <primary><filename>exim_monitor/EDITME</filename></primary>
2477 </indexterm>
2478 If you are going to build the Exim monitor, a similar configuration process is
2479 required. The file <filename>exim_monitor/EDITME</filename> must be edited appropriately for
2480 your installation and saved under the name <filename>Local/eximon.conf</filename>. If you are
2481 happy with the default settings described in <filename>exim_monitor/EDITME</filename>,
2482 <filename>Local/eximon.conf</filename> can be empty, but it must exist.
2483 </para>
2484 <para>
2485 This is all the configuration that is needed in straightforward cases for known
2486 operating systems. However, the building process is set up so that it is easy
2487 to override options that are set by default or by operating-system-specific
2488 configuration files, for example to change the name of the C compiler, which
2489 defaults to <option>gcc</option>. See section <xref linkend="SECToverride"/> below for details of how to
2490 do this.
2491 </para>
2492 </section>
2493 <section id="SECID26">
2494 <title>Support for iconv()</title>
2495 <para>
2496 <indexterm role="concept">
2497 <primary><function>iconv()</function> support</primary>
2498 </indexterm>
2499 <indexterm role="concept">
2500 <primary>RFC 2047</primary>
2501 </indexterm>
2502 The contents of header lines in messages may be encoded according to the rules
2503 described RFC 2047. This makes it possible to transmit characters that are not
2504 in the ASCII character set, and to label them as being in a particular
2505 character set. When Exim is inspecting header lines by means of the <option>$h_</option>
2506 mechanism, it decodes them, and translates them into a specified character set
2507 (default ISO-8859-1). The translation is possible only if the operating system
2508 supports the <function>iconv()</function> function.
2509 </para>
2510 <para>
2511 However, some of the operating systems that supply <function>iconv()</function> do not support
2512 very many conversions. The GNU <option>libiconv</option> library (available from
2513 <emphasis role="bold"><ulink url="http://www.gnu.org/software/libiconv/">http://www.gnu.org/software/libiconv/</ulink></emphasis>) can be installed on such
2514 systems to remedy this deficiency, as well as on systems that do not supply
2515 <function>iconv()</function> at all. After installing <option>libiconv</option>, you should add
2516 </para>
2517 <literallayout class="monospaced">
2518 HAVE_ICONV=yes
2519 </literallayout>
2520 <para>
2521 to your <filename>Local/Makefile</filename> and rebuild Exim.
2522 </para>
2523 </section>
2524 <section id="SECTinctlsssl">
2525 <title>Including TLS/SSL encryption support</title>
2526 <para>
2527 <indexterm role="concept">
2528 <primary>TLS</primary>
2529 <secondary>including support for TLS</secondary>
2530 </indexterm>
2531 <indexterm role="concept">
2532 <primary>encryption</primary>
2533 <secondary>including support for</secondary>
2534 </indexterm>
2535 <indexterm role="concept">
2536 <primary>SUPPORT_TLS</primary>
2537 </indexterm>
2538 <indexterm role="concept">
2539 <primary>OpenSSL</primary>
2540 <secondary>building Exim with</secondary>
2541 </indexterm>
2542 <indexterm role="concept">
2543 <primary>GnuTLS</primary>
2544 <secondary>building Exim with</secondary>
2545 </indexterm>
2546 Exim can be built to support encrypted SMTP connections, using the STARTTLS
2547 command as per RFC 2487. It can also support legacy clients that expect to
2548 start a TLS session immediately on connection to a non-standard port (see the
2549 <option>tls_on_connect_ports</option> runtime option and the <option>-tls-on-connect</option> command
2550 line option).
2551 </para>
2552 <para>
2553 If you want to build Exim with TLS support, you must first install either the
2554 OpenSSL or GnuTLS library. There is no cryptographic code in Exim itself for
2555 implementing SSL.
2556 </para>
2557 <para>
2558 If OpenSSL is installed, you should set
2559 </para>
2560 <literallayout class="monospaced">
2561 SUPPORT_TLS=yes
2562 TLS_LIBS=-lssl -lcrypto
2563 </literallayout>
2564 <para>
2565 in <filename>Local/Makefile</filename>. You may also need to specify the locations of the
2566 OpenSSL library and include files. For example:
2567 </para>
2568 <literallayout class="monospaced">
2569 SUPPORT_TLS=yes
2570 TLS_LIBS=-L/usr/local/openssl/lib -lssl -lcrypto
2571 TLS_INCLUDE=-I/usr/local/openssl/include/
2572 </literallayout>
2573 <para>
2574 <indexterm role="concept">
2575 <primary>pkg-config</primary>
2576 <secondary>OpenSSL</secondary>
2577 </indexterm>
2578 If you have <emphasis>pkg-config</emphasis> available, then instead you can just use:
2579 </para>
2580 <literallayout class="monospaced">
2581 SUPPORT_TLS=yes
2582 USE_OPENSSL_PC=openssl
2583 </literallayout>
2584 <para>
2585 <indexterm role="concept">
2586 <primary>USE_GNUTLS</primary>
2587 </indexterm>
2588 If GnuTLS is installed, you should set
2589 </para>
2590 <literallayout class="monospaced">
2591 SUPPORT_TLS=yes
2592 USE_GNUTLS=yes
2593 TLS_LIBS=-lgnutls -ltasn1 -lgcrypt
2594 </literallayout>
2595 <para>
2596 in <filename>Local/Makefile</filename>, and again you may need to specify the locations of the
2597 library and include files. For example:
2598 </para>
2599 <literallayout class="monospaced">
2600 SUPPORT_TLS=yes
2601 USE_GNUTLS=yes
2602 TLS_LIBS=-L/usr/gnu/lib -lgnutls -ltasn1 -lgcrypt
2603 TLS_INCLUDE=-I/usr/gnu/include
2604 </literallayout>
2605 <para>
2606 <indexterm role="concept">
2607 <primary>pkg-config</primary>
2608 <secondary>GnuTLS</secondary>
2609 </indexterm>
2610 If you have <emphasis>pkg-config</emphasis> available, then instead you can just use:
2611 </para>
2612 <literallayout class="monospaced">
2613 SUPPORT_TLS=yes
2614 USE_GNUTLS=yes
2615 USE_GNUTLS_PC=gnutls
2616 </literallayout>
2617 <para>
2618 You do not need to set TLS_INCLUDE if the relevant directory is already
2619 specified in INCLUDE. Details of how to configure Exim to make use of TLS are
2620 given in chapter <xref linkend="CHAPTLS"/>.
2621 </para>
2622 </section>
2623 <section id="SECID27">
2624 <title>Use of tcpwrappers</title>
2625 <para>
2626 <indexterm role="concept">
2627 <primary>tcpwrappers, building Exim to support</primary>
2628 </indexterm>
2629 <indexterm role="concept">
2630 <primary>USE_TCP_WRAPPERS</primary>
2631 </indexterm>
2632 <indexterm role="concept">
2633 <primary>TCP_WRAPPERS_DAEMON_NAME</primary>
2634 </indexterm>
2635 <indexterm role="concept">
2636 <primary>tcp_wrappers_daemon_name</primary>
2637 </indexterm>
2638 Exim can be linked with the <emphasis>tcpwrappers</emphasis> library in order to check incoming
2639 SMTP calls using the <emphasis>tcpwrappers</emphasis> control files. This may be a convenient
2640 alternative to Exim&#x2019;s own checking facilities for installations that are
2641 already making use of <emphasis>tcpwrappers</emphasis> for other purposes. To do this, you
2642 should set USE_TCP_WRAPPERS in <filename>Local/Makefile</filename>, arrange for the file
2643 <filename>tcpd.h</filename> to be available at compile time, and also ensure that the library
2644 <filename>libwrap.a</filename> is available at link time, typically by including <option>-lwrap</option> in
2645 EXTRALIBS_EXIM. For example, if <emphasis>tcpwrappers</emphasis> is installed in <filename>/usr/local</filename>,
2646 you might have
2647 </para>
2648 <literallayout class="monospaced">
2649 USE_TCP_WRAPPERS=yes
2650 CFLAGS=-O -I/usr/local/include
2651 EXTRALIBS_EXIM=-L/usr/local/lib -lwrap
2652 </literallayout>
2653 <para>
2654 in <filename>Local/Makefile</filename>. The daemon name to use in the <emphasis>tcpwrappers</emphasis> control
2655 files is <quote>exim</quote>. For example, the line
2656 </para>
2657 <literallayout class="monospaced">
2658 exim : LOCAL  192.168.1.  .friendly.domain.example
2659 </literallayout>
2660 <para>
2661 in your <filename>/etc/hosts.allow</filename> file allows connections from the local host, from
2662 the subnet 192.168.1.0/24, and from all hosts in <emphasis>friendly.domain.example</emphasis>.
2663 All other connections are denied. The daemon name used by <emphasis>tcpwrappers</emphasis>
2664 can be changed at build time by setting TCP_WRAPPERS_DAEMON_NAME in
2665 <filename>Local/Makefile</filename>, or by setting tcp_wrappers_daemon_name in the
2666 configure file. Consult the <emphasis>tcpwrappers</emphasis> documentation for
2667 further details.
2668 </para>
2669 </section>
2670 <section id="SECID28">
2671 <title>Including support for IPv6</title>
2672 <para>
2673 <indexterm role="concept">
2674 <primary>IPv6</primary>
2675 <secondary>including support for</secondary>
2676 </indexterm>
2677 Exim contains code for use on systems that have IPv6 support. Setting
2678 <literal>HAVE_IPV6=YES</literal> in <filename>Local/Makefile</filename> causes the IPv6 code to be included;
2679 it may also be necessary to set IPV6_INCLUDE and IPV6_LIBS on systems
2680 where the IPv6 support is not fully integrated into the normal include and
2681 library files.
2682 </para>
2683 <para>
2684 Two different types of DNS record for handling IPv6 addresses have been
2685 defined. AAAA records (analogous to A records for IPv4) are in use, and are
2686 currently seen as the mainstream. Another record type called A6 was proposed
2687 as better than AAAA because it had more flexibility. However, it was felt to be
2688 over-complex, and its status was reduced to <quote>experimental</quote>.
2689 </para>
2690 <para revisionflag="changed">
2691 Exim used to
2692 have a compile option for including A6 record support but this has now been
2693 withdrawn.
2694 </para>
2695 </section>
2696 <section id="SECTdynamicmodules">
2697 <title>Dynamically loaded lookup module support</title>
2698 <para>
2699 <indexterm role="concept">
2700 <primary>lookup modules</primary>
2701 </indexterm>
2702 <indexterm role="concept">
2703 <primary>dynamic modules</primary>
2704 </indexterm>
2705 <indexterm role="concept">
2706 <primary>.so building</primary>
2707 </indexterm>
2708 On some platforms, Exim supports not compiling all lookup types directly into
2709 the main binary, instead putting some into external modules which can be loaded
2710 on demand.
2711 This permits packagers to build Exim with support for lookups with extensive
2712 library dependencies without requiring all users to install all of those
2713 dependencies.
2714 Most, but not all, lookup types can be built this way.
2715 </para>
2716 <para>
2717 Set <literal>LOOKUP_MODULE_DIR</literal> to the directory into which the modules will be
2718 installed; Exim will only load modules from that directory, as a security
2719 measure.  You will need to set <literal>CFLAGS_DYNAMIC</literal> if not already defined
2720 for your OS; see <filename>OS/Makefile-Linux</filename> for an example.
2721 Some other requirements for adjusting <literal>EXTRALIBS</literal> may also be necessary,
2722 see <filename>src/EDITME</filename> for details.
2723 </para>
2724 <para>
2725 Then, for each module to be loaded dynamically, define the relevant
2726 <literal>LOOKUP_</literal>&lt;<emphasis>lookup_type</emphasis>&gt; flags to have the value "2" instead of "yes".
2727 For example, this will build in lsearch but load sqlite and mysql support
2728 on demand:
2729 </para>
2730 <literallayout class="monospaced">
2731 LOOKUP_LSEARCH=yes
2732 LOOKUP_SQLITE=2
2733 LOOKUP_MYSQL=2
2734 </literallayout>
2735 </section>
2736 <section id="SECID29">
2737 <title>The building process</title>
2738 <para>
2739 <indexterm role="concept">
2740 <primary>build directory</primary>
2741 </indexterm>
2742 Once <filename>Local/Makefile</filename> (and <filename>Local/eximon.conf</filename>, if required) have been
2743 created, run <emphasis>make</emphasis> at the top level. It determines the architecture and
2744 operating system types, and creates a build directory if one does not exist.
2745 For example, on a Sun system running Solaris 8, the directory
2746 <filename>build-SunOS5-5.8-sparc</filename> is created.
2747 <indexterm role="concept">
2748 <primary>symbolic link</primary>
2749 <secondary>to source files</secondary>
2750 </indexterm>
2751 Symbolic links to relevant source files are installed in the build directory.
2752 </para>
2753 <para>
2754 If this is the first time <emphasis>make</emphasis> has been run, it calls a script that builds
2755 a make file inside the build directory, using the configuration files from the
2756 <filename>Local</filename> directory. The new make file is then passed to another instance of
2757 <emphasis>make</emphasis>. This does the real work, building a number of utility scripts, and
2758 then compiling and linking the binaries for the Exim monitor (if configured), a
2759 number of utility programs, and finally Exim itself. The command <literal>make
2760 makefile</literal> can be used to force a rebuild of the make file in the build
2761 directory, should this ever be necessary.
2762 </para>
2763 <para>
2764 If you have problems building Exim, check for any comments there may be in the
2765 <filename>README</filename> file concerning your operating system, and also take a look at the
2766 FAQ, where some common problems are covered.
2767 </para>
2768 </section>
2769 <section id="SECID283">
2770 <title>Output from <quote>make</quote></title>
2771 <para>
2772 The output produced by the <emphasis>make</emphasis> process for compile lines is often very
2773 unreadable, because these lines can be very long. For this reason, the normal
2774 output is suppressed by default, and instead output similar to that which
2775 appears when compiling the 2.6 Linux kernel is generated: just a short line for
2776 each module that is being compiled or linked. However, it is still possible to
2777 get the full output, by calling <emphasis>make</emphasis> like this:
2778 </para>
2779 <literallayout class="monospaced">
2780 FULLECHO='' make -e
2781 </literallayout>
2782 <para>
2783 The value of FULLECHO defaults to <quote>@</quote>, the flag character that suppresses
2784 command reflection in <emphasis>make</emphasis>. When you ask for the full output, it is
2785 given in addition to the short output.
2786 </para>
2787 </section>
2788 <section id="SECToverride">
2789 <title>Overriding build-time options for Exim</title>
2790 <para>
2791 <indexterm role="concept">
2792 <primary>build-time options, overriding</primary>
2793 </indexterm>
2794 The main make file that is created at the beginning of the building process
2795 consists of the concatenation of a number of files which set configuration
2796 values, followed by a fixed set of <emphasis>make</emphasis> instructions. If a value is set
2797 more than once, the last setting overrides any previous ones. This provides a
2798 convenient way of overriding defaults. The files that are concatenated are, in
2799 order:
2800 </para>
2801 <literallayout>
2802 <filename>OS/Makefile-Default</filename>
2803 <filename>OS/Makefile-</filename>&lt;<emphasis>ostype</emphasis>&gt;
2804 <filename>Local/Makefile</filename>
2805 <filename>Local/Makefile-</filename>&lt;<emphasis>ostype</emphasis>&gt;
2806 <filename>Local/Makefile-</filename>&lt;<emphasis>archtype</emphasis>&gt;
2807 <filename>Local/Makefile-</filename>&lt;<emphasis>ostype</emphasis>&gt;-&lt;<emphasis>archtype</emphasis>&gt;
2808 <filename>OS/Makefile-Base</filename>
2809 </literallayout>
2810 <para>
2811 <indexterm role="concept">
2812 <primary><filename>Local/Makefile</filename></primary>
2813 </indexterm>
2814 <indexterm role="concept">
2815 <primary>building Exim</primary>
2816 <secondary>operating system type</secondary>
2817 </indexterm>
2818 <indexterm role="concept">
2819 <primary>building Exim</primary>
2820 <secondary>architecture type</secondary>
2821 </indexterm>
2822 where &lt;<emphasis>ostype</emphasis>&gt; is the operating system type and &lt;<emphasis>archtype</emphasis>&gt; is the
2823 architecture type. <filename>Local/Makefile</filename> is required to exist, and the building
2824 process fails if it is absent. The other three <filename>Local</filename> files are optional,
2825 and are often not needed.
2826 </para>
2827 <para>
2828 The values used for &lt;<emphasis>ostype</emphasis>&gt; and &lt;<emphasis>archtype</emphasis>&gt; are obtained from scripts
2829 called <filename>scripts/os-type</filename> and <filename>scripts/arch-type</filename> respectively. If either of
2830 the environment variables EXIM_OSTYPE or EXIM_ARCHTYPE is set, their
2831 values are used, thereby providing a means of forcing particular settings.
2832 Otherwise, the scripts try to get values from the <option>uname</option> command. If this
2833 fails, the shell variables OSTYPE and ARCHTYPE are inspected. A number
2834 of <emphasis>ad hoc</emphasis> transformations are then applied, to produce the standard names
2835 that Exim expects. You can run these scripts directly from the shell in order
2836 to find out what values are being used on your system.
2837 </para>
2838 <para>
2839 <filename>OS/Makefile-Default</filename> contains comments about the variables that are set
2840 therein. Some (but not all) are mentioned below. If there is something that
2841 needs changing, review the contents of this file and the contents of the make
2842 file for your operating system (<filename>OS/Makefile-&lt;ostype&gt;</filename>) to see what the
2843 default values are.
2844 </para>
2845 <para>
2846 <indexterm role="concept">
2847 <primary>building Exim</primary>
2848 <secondary>overriding default settings</secondary>
2849 </indexterm>
2850 If you need to change any of the values that are set in <filename>OS/Makefile-Default</filename>
2851 or in <filename>OS/Makefile-&lt;ostype&gt;</filename>, or to add any new definitions, you do not
2852 need to change the original files. Instead, you should make the changes by
2853 putting the new values in an appropriate <filename>Local</filename> file. For example,
2854 <indexterm role="concept">
2855 <primary>Tru64-Unix build-time settings</primary>
2856 </indexterm>
2857 when building Exim in many releases of the Tru64-Unix (formerly Digital UNIX,
2858 formerly DEC-OSF1) operating system, it is necessary to specify that the C
2859 compiler is called <emphasis>cc</emphasis> rather than <emphasis>gcc</emphasis>. Also, the compiler must be
2860 called with the option <option>-std1</option>, to make it recognize some of the features of
2861 Standard C that Exim uses. (Most other compilers recognize Standard C by
2862 default.) To do this, you should create a file called <filename>Local/Makefile-OSF1</filename>
2863 containing the lines
2864 </para>
2865 <literallayout class="monospaced">
2866 CC=cc
2867 CFLAGS=-std1
2868 </literallayout>
2869 <para>
2870 If you are compiling for just one operating system, it may be easier to put
2871 these lines directly into <filename>Local/Makefile</filename>.
2872 </para>
2873 <para>
2874 Keeping all your local configuration settings separate from the distributed
2875 files makes it easy to transfer them to new versions of Exim simply by copying
2876 the contents of the <filename>Local</filename> directory.
2877 </para>
2878 <para>
2879 <indexterm role="concept">
2880 <primary>NIS lookup type</primary>
2881 <secondary>including support for</secondary>
2882 </indexterm>
2883 <indexterm role="concept">
2884 <primary>NIS+ lookup type</primary>
2885 <secondary>including support for</secondary>
2886 </indexterm>
2887 <indexterm role="concept">
2888 <primary>LDAP</primary>
2889 <secondary>including support for</secondary>
2890 </indexterm>
2891 <indexterm role="concept">
2892 <primary>lookup</primary>
2893 <secondary>inclusion in binary</secondary>
2894 </indexterm>
2895 Exim contains support for doing LDAP, NIS, NIS+, and other kinds of file
2896 lookup, but not all systems have these components installed, so the default is
2897 not to include the relevant code in the binary. All the different kinds of file
2898 and database lookup that Exim supports are implemented as separate code modules
2899 which are included only if the relevant compile-time options are set. In the
2900 case of LDAP, NIS, and NIS+, the settings for <filename>Local/Makefile</filename> are:
2901 </para>
2902 <literallayout class="monospaced">
2903 LOOKUP_LDAP=yes
2904 LOOKUP_NIS=yes
2905 LOOKUP_NISPLUS=yes
2906 </literallayout>
2907 <para>
2908 and similar settings apply to the other lookup types. They are all listed in
2909 <filename>src/EDITME</filename>. In many cases the relevant include files and interface
2910 libraries need to be installed before compiling Exim.
2911 <indexterm role="concept">
2912 <primary>cdb</primary>
2913 <secondary>including support for</secondary>
2914 </indexterm>
2915 However, there are some optional lookup types (such as cdb) for which
2916 the code is entirely contained within Exim, and no external include
2917 files or libraries are required. When a lookup type is not included in the
2918 binary, attempts to configure Exim to use it cause run time configuration
2919 errors.
2920 </para>
2921 <para>
2922 <indexterm role="concept">
2923 <primary>pkg-config</primary>
2924 <secondary>lookups</secondary>
2925 </indexterm>
2926 <indexterm role="concept">
2927 <primary>pkg-config</primary>
2928 <secondary>authenticators</secondary>
2929 </indexterm>
2930 Many systems now use a tool called <emphasis>pkg-config</emphasis> to encapsulate information
2931 about how to compile against a library; Exim has some initial support for
2932 being able to use pkg-config for lookups and authenticators.  For any given
2933 makefile variable which starts <literal>LOOKUP_</literal> or <literal>AUTH_</literal>, you can add a new
2934 variable with the <literal>_PC</literal> suffix in the name and assign as the value the
2935 name of the package to be queried.  The results of querying via the
2936 <emphasis>pkg-config</emphasis> command will be added to the appropriate Makefile variables
2937 with <literal>+=</literal> directives, so your version of <emphasis>make</emphasis> will need to support that
2938 syntax.  For instance:
2939 </para>
2940 <literallayout class="monospaced">
2941 LOOKUP_SQLITE=yes
2942 LOOKUP_SQLITE_PC=sqlite3
2943 AUTH_GSASL=yes
2944 AUTH_GSASL_PC=libgsasl
2945 AUTH_HEIMDAL_GSSAPI=yes
2946 AUTH_HEIMDAL_GSSAPI_PC=heimdal-gssapi
2947 </literallayout>
2948 <para>
2949 <indexterm role="concept">
2950 <primary>Perl</primary>
2951 <secondary>including support for</secondary>
2952 </indexterm>
2953 Exim can be linked with an embedded Perl interpreter, allowing Perl
2954 subroutines to be called during string expansion. To enable this facility,
2955 </para>
2956 <literallayout class="monospaced">
2957 EXIM_PERL=perl.o
2958 </literallayout>
2959 <para>
2960 must be defined in <filename>Local/Makefile</filename>. Details of this facility are given in
2961 chapter <xref linkend="CHAPperl"/>.
2962 </para>
2963 <para>
2964 <indexterm role="concept">
2965 <primary>X11 libraries, location of</primary>
2966 </indexterm>
2967 The location of the X11 libraries is something that varies a lot between
2968 operating systems, and there may be different versions of X11 to cope
2969 with. Exim itself makes no use of X11, but if you are compiling the Exim
2970 monitor, the X11 libraries must be available.
2971 The following three variables are set in <filename>OS/Makefile-Default</filename>:
2972 </para>
2973 <literallayout class="monospaced">
2974 X11=/usr/X11R6
2975 XINCLUDE=-I$(X11)/include
2976 XLFLAGS=-L$(X11)/lib
2977 </literallayout>
2978 <para>
2979 These are overridden in some of the operating-system configuration files. For
2980 example, in <filename>OS/Makefile-SunOS5</filename> there is
2981 </para>
2982 <literallayout class="monospaced">
2983 X11=/usr/openwin
2984 XINCLUDE=-I$(X11)/include
2985 XLFLAGS=-L$(X11)/lib -R$(X11)/lib
2986 </literallayout>
2987 <para>
2988 If you need to override the default setting for your operating system, place a
2989 definition of all three of these variables into your
2990 <filename>Local/Makefile-&lt;ostype&gt;</filename> file.
2991 </para>
2992 <para>
2993 <indexterm role="concept">
2994 <primary>EXTRALIBS</primary>
2995 </indexterm>
2996 If you need to add any extra libraries to the link steps, these can be put in a
2997 variable called EXTRALIBS, which appears in all the link commands, but by
2998 default is not defined. In contrast, EXTRALIBS_EXIM is used only on the
2999 command for linking the main Exim binary, and not for any associated utilities.
3000 </para>
3001 <para>
3002 <indexterm role="concept">
3003 <primary>DBM libraries</primary>
3004 <secondary>configuration for building</secondary>
3005 </indexterm>
3006 There is also DBMLIB, which appears in the link commands for binaries that
3007 use DBM functions (see also section <xref linkend="SECTdb"/>). Finally, there is
3008 EXTRALIBS_EXIMON, which appears only in the link step for the Exim monitor
3009 binary, and which can be used, for example, to include additional X11
3010 libraries.
3011 </para>
3012 <para>
3013 <indexterm role="concept">
3014 <primary>configuration file</primary>
3015 <secondary>editing</secondary>
3016 </indexterm>
3017 The make file copes with rebuilding Exim correctly if any of the configuration
3018 files are edited. However, if an optional configuration file is deleted, it is
3019 necessary to touch the associated non-optional file (that is,
3020 <filename>Local/Makefile</filename> or <filename>Local/eximon.conf</filename>) before rebuilding.
3021 </para>
3022 </section>
3023 <section id="SECID30">
3024 <title>OS-specific header files</title>
3025 <para>
3026 <indexterm role="concept">
3027 <primary><filename>os.h</filename></primary>
3028 </indexterm>
3029 <indexterm role="concept">
3030 <primary>building Exim</primary>
3031 <secondary>OS-specific C header files</secondary>
3032 </indexterm>
3033 The <filename>OS</filename> directory contains a number of files with names of the form
3034 <filename>os.h-&lt;ostype&gt;</filename>. These are system-specific C header files that should not
3035 normally need to be changed. There is a list of macro settings that are
3036 recognized in the file <filename>OS/os.configuring</filename>, which should be consulted if you
3037 are porting Exim to a new operating system.
3038 </para>
3039 </section>
3040 <section id="SECID31">
3041 <title>Overriding build-time options for the monitor</title>
3042 <para>
3043 <indexterm role="concept">
3044 <primary>building Eximon</primary>
3045 </indexterm>
3046 A similar process is used for overriding things when building the Exim monitor,
3047 where the files that are involved are
3048 </para>
3049 <literallayout>
3050 <filename>OS/eximon.conf-Default</filename>
3051 <filename>OS/eximon.conf-</filename>&lt;<emphasis>ostype</emphasis>&gt;
3052 <filename>Local/eximon.conf</filename>
3053 <filename>Local/eximon.conf-</filename>&lt;<emphasis>ostype</emphasis>&gt;
3054 <filename>Local/eximon.conf-</filename>&lt;<emphasis>archtype</emphasis>&gt;
3055 <filename>Local/eximon.conf-</filename>&lt;<emphasis>ostype</emphasis>&gt;-&lt;<emphasis>archtype</emphasis>&gt;
3056 </literallayout>
3057 <para>
3058 <indexterm role="concept">
3059 <primary><filename>Local/eximon.conf</filename></primary>
3060 </indexterm>
3061 As with Exim itself, the final three files need not exist, and in this case the
3062 <filename>OS/eximon.conf-&lt;ostype&gt;</filename> file is also optional. The default values in
3063 <filename>OS/eximon.conf-Default</filename> can be overridden dynamically by setting environment
3064 variables of the same name, preceded by EXIMON_. For example, setting
3065 EXIMON_LOG_DEPTH in the environment overrides the value of
3066 LOG_DEPTH at run time.
3067 <indexterm role="concept" startref="IIDbuex" class="endofrange"/>
3068 </para>
3069 </section>
3070 <section id="SECID32">
3071 <title>Installing Exim binaries and scripts</title>
3072 <para>
3073 <indexterm role="concept">
3074 <primary>installing Exim</primary>
3075 </indexterm>
3076 <indexterm role="concept">
3077 <primary>BIN_DIRECTORY</primary>
3078 </indexterm>
3079 The command <literal>make install</literal> runs the <command>exim_install</command> script with no
3080 arguments. The script copies binaries and utility scripts into the directory
3081 whose name is specified by the BIN_DIRECTORY setting in <filename>Local/Makefile</filename>.
3082 <indexterm role="concept">
3083 <primary>setuid</primary>
3084 <secondary>installing Exim with</secondary>
3085 </indexterm>
3086 The install script copies files only if they are newer than the files they are
3087 going to replace. The Exim binary is required to be owned by root and have the
3088 <emphasis>setuid</emphasis> bit set, for normal configurations. Therefore, you must run <literal>make
3089 install</literal> as root so that it can set up the Exim binary in this way. However, in
3090 some special situations (for example, if a host is doing no local deliveries)
3091 it may be possible to run Exim without making the binary setuid root (see
3092 chapter <xref linkend="CHAPsecurity"/> for details).
3093 </para>
3094 <para>
3095 <indexterm role="concept">
3096 <primary>CONFIGURE_FILE</primary>
3097 </indexterm>
3098 Exim&#x2019;s run time configuration file is named by the CONFIGURE_FILE setting
3099 in <filename>Local/Makefile</filename>. If this names a single file, and the file does not
3100 exist, the default configuration file <filename>src/configure.default</filename> is copied there
3101 by the installation script. If a run time configuration file already exists, it
3102 is left alone. If CONFIGURE_FILE is a colon-separated list, naming several
3103 alternative files, no default is installed.
3104 </para>
3105 <para>
3106 <indexterm role="concept">
3107 <primary>system aliases file</primary>
3108 </indexterm>
3109 <indexterm role="concept">
3110 <primary><filename>/etc/aliases</filename></primary>
3111 </indexterm>
3112 One change is made to the default configuration file when it is installed: the
3113 default configuration contains a router that references a system aliases file.
3114 The path to this file is set to the value specified by
3115 SYSTEM_ALIASES_FILE in <filename>Local/Makefile</filename> (<filename>/etc/aliases</filename> by default).
3116 If the system aliases file does not exist, the installation script creates it,
3117 and outputs a comment to the user.
3118 </para>
3119 <para>
3120 The created file contains no aliases, but it does contain comments about the
3121 aliases a site should normally have. Mail aliases have traditionally been
3122 kept in <filename>/etc/aliases</filename>. However, some operating systems are now using
3123 <filename>/etc/mail/aliases</filename>. You should check if yours is one of these, and change
3124 Exim&#x2019;s configuration if necessary.
3125 </para>
3126 <para>
3127 The default configuration uses the local host&#x2019;s name as the only local domain,
3128 and is set up to do local deliveries into the shared directory <filename>/var/mail</filename>,
3129 running as the local user. System aliases and <filename>.forward</filename> files in users&#x2019; home
3130 directories are supported, but no NIS or NIS+ support is configured. Domains
3131 other than the name of the local host are routed using the DNS, with delivery
3132 over SMTP.
3133 </para>
3134 <para>
3135 It is possible to install Exim for special purposes (such as building a binary
3136 distribution) in a private part of the file system. You can do this by a
3137 command such as
3138 </para>
3139 <literallayout class="monospaced">
3140 make DESTDIR=/some/directory/ install
3141 </literallayout>
3142 <para>
3143 This has the effect of pre-pending the specified directory to all the file
3144 paths, except the name of the system aliases file that appears in the default
3145 configuration. (If a default alias file is created, its name <emphasis>is</emphasis> modified.)
3146 For backwards compatibility, ROOT is used if DESTDIR is not set,
3147 but this usage is deprecated.
3148 </para>
3149 <para>
3150 <indexterm role="concept">
3151 <primary>installing Exim</primary>
3152 <secondary>what is not installed</secondary>
3153 </indexterm>
3154 Running <emphasis>make install</emphasis> does not copy the Exim 4 conversion script
3155 <emphasis>convert4r4</emphasis>. You will probably run this only once if you are
3156 upgrading from Exim 3. None of the documentation files in the <filename>doc</filename>
3157 directory are copied, except for the info files when you have set
3158 INFO_DIRECTORY, as described in section <xref linkend="SECTinsinfdoc"/> below.
3159 </para>
3160 <para>
3161 For the utility programs, old versions are renamed by adding the suffix <filename>.O</filename>
3162 to their names. The Exim binary itself, however, is handled differently. It is
3163 installed under a name that includes the version number and the compile number,
3164 for example <filename>exim-4.86-1</filename>. The script then arranges for a symbolic link
3165 called <filename>exim</filename> to point to the binary. If you are updating a previous version
3166 of Exim, the script takes care to ensure that the name <filename>exim</filename> is never absent
3167 from the directory (as seen by other processes).
3168 </para>
3169 <para>
3170 <indexterm role="concept">
3171 <primary>installing Exim</primary>
3172 <secondary>testing the script</secondary>
3173 </indexterm>
3174 If you want to see what the <emphasis>make install</emphasis> will do before running it for
3175 real, you can pass the <option>-n</option> option to the installation script by this
3176 command:
3177 </para>
3178 <literallayout class="monospaced">
3179 make INSTALL_ARG=-n install
3180 </literallayout>
3181 <para>
3182 The contents of the variable INSTALL_ARG are passed to the installation
3183 script. You do not need to be root to run this test. Alternatively, you can run
3184 the installation script directly, but this must be from within the build
3185 directory. For example, from the top-level Exim directory you could use this
3186 command:
3187 </para>
3188 <literallayout class="monospaced">
3189 (cd build-SunOS5-5.5.1-sparc; ../scripts/exim_install -n)
3190 </literallayout>
3191 <para>
3192 <indexterm role="concept">
3193 <primary>installing Exim</primary>
3194 <secondary>install script options</secondary>
3195 </indexterm>
3196 There are two other options that can be supplied to the installation script.
3197 </para>
3198 <itemizedlist>
3199 <listitem>
3200 <para>
3201 <option>-no_chown</option> bypasses the call to change the owner of the installed binary
3202 to root, and the call to make it a setuid binary.
3203 </para>
3204 </listitem>
3205 <listitem>
3206 <para>
3207 <option>-no_symlink</option> bypasses the setting up of the symbolic link <filename>exim</filename> to the
3208 installed binary.
3209 </para>
3210 </listitem>
3211 </itemizedlist>
3212 <para>
3213 INSTALL_ARG can be used to pass these options to the script. For example:
3214 </para>
3215 <literallayout class="monospaced">
3216 make INSTALL_ARG=-no_symlink install
3217 </literallayout>
3218 <para>
3219 The installation script can also be given arguments specifying which files are
3220 to be copied. For example, to install just the Exim binary, and nothing else,
3221 without creating the symbolic link, you could use:
3222 </para>
3223 <literallayout class="monospaced">
3224 make INSTALL_ARG='-no_symlink exim' install
3225 </literallayout>
3226 </section>
3227 <section id="SECTinsinfdoc">
3228 <title>Installing info documentation</title>
3229 <para>
3230 <indexterm role="concept">
3231 <primary>installing Exim</primary>
3232 <secondary><emphasis>info</emphasis> documentation</secondary>
3233 </indexterm>
3234 Not all systems use the GNU <emphasis>info</emphasis> system for documentation, and for this
3235 reason, the Texinfo source of Exim&#x2019;s documentation is not included in the main
3236 distribution. Instead it is available separately from the ftp site (see section
3237 <xref linkend="SECTavail"/>).
3238 </para>
3239 <para>
3240 If you have defined INFO_DIRECTORY in <filename>Local/Makefile</filename> and the Texinfo
3241 source of the documentation is found in the source tree, running <literal>make
3242 install</literal> automatically builds the info files and installs them.
3243 </para>
3244 </section>
3245 <section id="SECID33">
3246 <title>Setting up the spool directory</title>
3247 <para>
3248 <indexterm role="concept">
3249 <primary>spool directory</primary>
3250 <secondary>creating</secondary>
3251 </indexterm>
3252 When it starts up, Exim tries to create its spool directory if it does not
3253 exist. The Exim uid and gid are used for the owner and group of the spool
3254 directory. Sub-directories are automatically created in the spool directory as
3255 necessary.
3256 </para>
3257 </section>
3258 <section id="SECID34">
3259 <title>Testing</title>
3260 <para>
3261 <indexterm role="concept">
3262 <primary>testing</primary>
3263 <secondary>installation</secondary>
3264 </indexterm>
3265 Having installed Exim, you can check that the run time configuration file is
3266 syntactically valid by running the following command, which assumes that the
3267 Exim binary directory is within your PATH environment variable:
3268 </para>
3269 <literallayout class="monospaced">
3270 exim -bV
3271 </literallayout>
3272 <para>
3273 If there are any errors in the configuration file, Exim outputs error messages.
3274 Otherwise it outputs the version number and build date,
3275 the DBM library that is being used, and information about which drivers and
3276 other optional code modules are included in the binary.
3277 Some simple routing tests can be done by using the address testing option. For
3278 example,
3279 </para>
3280 <literallayout>
3281 <literal>exim -bt</literal> &lt;<emphasis>local username</emphasis>&gt;
3282 </literallayout>
3283 <para>
3284 should verify that it recognizes a local mailbox, and
3285 </para>
3286 <literallayout>
3287 <literal>exim -bt</literal> &lt;<emphasis>remote address</emphasis>&gt;
3288 </literallayout>
3289 <para>
3290 a remote one. Then try getting it to deliver mail, both locally and remotely.
3291 This can be done by passing messages directly to Exim, without going through a
3292 user agent. For example:
3293 </para>
3294 <literallayout class="monospaced">
3295 exim -v postmaster@your.domain.example
3296 From: user@your.domain.example
3297 To: postmaster@your.domain.example
3298 Subject: Testing Exim
3299
3300 This is a test message.
3301 ^D
3302 </literallayout>
3303 <para>
3304 The <option>-v</option> option causes Exim to output some verification of what it is doing.
3305 In this case you should see copies of three log lines, one for the message&#x2019;s
3306 arrival, one for its delivery, and one containing <quote>Completed</quote>.
3307 </para>
3308 <para>
3309 <indexterm role="concept">
3310 <primary>delivery</primary>
3311 <secondary>problems with</secondary>
3312 </indexterm>
3313 If you encounter problems, look at Exim&#x2019;s log files (<emphasis>mainlog</emphasis> and
3314 <emphasis>paniclog</emphasis>) to see if there is any relevant information there. Another source
3315 of information is running Exim with debugging turned on, by specifying the
3316 <option>-d</option> option. If a message is stuck on Exim&#x2019;s spool, you can force a delivery
3317 with debugging turned on by a command of the form
3318 </para>
3319 <literallayout>
3320 <literal>exim -d -M</literal> &lt;<emphasis>exim-message-id</emphasis>&gt;
3321 </literallayout>
3322 <para>
3323 You must be root or an <quote>admin user</quote> in order to do this. The <option>-d</option> option
3324 produces rather a lot of output, but you can cut this down to specific areas.
3325 For example, if you use <option>-d-all+route</option> only the debugging information
3326 relevant to routing is included. (See the <option>-d</option> option in chapter
3327 <xref linkend="CHAPcommandline"/> for more details.)
3328 </para>
3329 <para>
3330 <indexterm role="concept">
3331 <primary><quote>sticky</quote> bit</primary>
3332 </indexterm>
3333 <indexterm role="concept">
3334 <primary>lock files</primary>
3335 </indexterm>
3336 One specific problem that has shown up on some sites is the inability to do
3337 local deliveries into a shared mailbox directory, because it does not have the
3338 <quote>sticky bit</quote> set on it. By default, Exim tries to create a lock file before
3339 writing to a mailbox file, and if it cannot create the lock file, the delivery
3340 is deferred. You can get round this either by setting the <quote>sticky bit</quote> on the
3341 directory, or by setting a specific group for local deliveries and allowing
3342 that group to create files in the directory (see the comments above the
3343 <command>local_delivery</command> transport in the default configuration file). Another
3344 approach is to configure Exim not to use lock files, but just to rely on
3345 <function>fcntl()</function> locking instead. However, you should do this only if all user
3346 agents also use <function>fcntl()</function> locking. For further discussion of locking issues,
3347 see chapter <xref linkend="CHAPappendfile"/>.
3348 </para>
3349 <para>
3350 One thing that cannot be tested on a system that is already running an MTA is
3351 the receipt of incoming SMTP mail on the standard SMTP port. However, the
3352 <option>-oX</option> option can be used to run an Exim daemon that listens on some other
3353 port, or <emphasis>inetd</emphasis> can be used to do this. The <option>-bh</option> option and the
3354 <emphasis>exim_checkaccess</emphasis> utility can be used to check out policy controls on
3355 incoming SMTP mail.
3356 </para>
3357 <para>
3358 Testing a new version on a system that is already running Exim can most easily
3359 be done by building a binary with a different CONFIGURE_FILE setting. From
3360 within the run time configuration, all other file and directory names
3361 that Exim uses can be altered, in order to keep it entirely clear of the
3362 production version.
3363 </para>
3364 </section>
3365 <section id="SECID35">
3366 <title>Replacing another MTA with Exim</title>
3367 <para>
3368 <indexterm role="concept">
3369 <primary>replacing another MTA</primary>
3370 </indexterm>
3371 Building and installing Exim for the first time does not of itself put it in
3372 general use. The name by which the system&#x2019;s MTA is called by mail user agents
3373 is either <filename>/usr/sbin/sendmail</filename>, or <filename>/usr/lib/sendmail</filename> (depending on the
3374 operating system), and it is necessary to make this name point to the <emphasis>exim</emphasis>
3375 binary in order to get the user agents to pass messages to Exim. This is
3376 normally done by renaming any existing file and making <filename>/usr/sbin/sendmail</filename>
3377 or <filename>/usr/lib/sendmail</filename>
3378 <indexterm role="concept">
3379 <primary>symbolic link</primary>
3380 <secondary>to <emphasis>exim</emphasis> binary</secondary>
3381 </indexterm>
3382 a symbolic link to the <emphasis>exim</emphasis> binary. It is a good idea to remove any setuid
3383 privilege and executable status from the old MTA. It is then necessary to stop
3384 and restart the mailer daemon, if one is running.
3385 </para>
3386 <para>
3387 <indexterm role="concept">
3388 <primary>FreeBSD, MTA indirection</primary>
3389 </indexterm>
3390 <indexterm role="concept">
3391 <primary><filename>/etc/mail/mailer.conf</filename></primary>
3392 </indexterm>
3393 Some operating systems have introduced alternative ways of switching MTAs. For
3394 example, if you are running FreeBSD, you need to edit the file
3395 <filename>/etc/mail/mailer.conf</filename> instead of setting up a symbolic link as just
3396 described. A typical example of the contents of this file for running Exim is
3397 as follows:
3398 </para>
3399 <literallayout class="monospaced">
3400 sendmail            /usr/exim/bin/exim
3401 send-mail           /usr/exim/bin/exim
3402 mailq               /usr/exim/bin/exim -bp
3403 newaliases          /usr/bin/true
3404 </literallayout>
3405 <para>
3406 Once you have set up the symbolic link, or edited <filename>/etc/mail/mailer.conf</filename>,
3407 your Exim installation is <quote>live</quote>. Check it by sending a message from your
3408 favourite user agent.
3409 </para>
3410 <para>
3411 You should consider what to tell your users about the change of MTA. Exim may
3412 have different capabilities to what was previously running, and there are
3413 various operational differences such as the text of messages produced by
3414 command line options and in bounce messages. If you allow your users to make
3415 use of Exim&#x2019;s filtering capabilities, you should make the document entitled
3416 <emphasis>Exim&#x2019;s interface to mail filtering</emphasis> available to them.
3417 </para>
3418 </section>
3419 <section id="SECID36">
3420 <title>Upgrading Exim</title>
3421 <para>
3422 <indexterm role="concept">
3423 <primary>upgrading Exim</primary>
3424 </indexterm>
3425 If you are already running Exim on your host, building and installing a new
3426 version automatically makes it available to MUAs, or any other programs that
3427 call the MTA directly. However, if you are running an Exim daemon, you do need
3428 to send it a HUP signal, to make it re-execute itself, and thereby pick up the
3429 new binary. You do not need to stop processing mail in order to install a new
3430 version of Exim. The install script does not modify an existing runtime
3431 configuration file.
3432 </para>
3433 </section>
3434 <section id="SECID37">
3435 <title>Stopping the Exim daemon on Solaris</title>
3436 <para>
3437 <indexterm role="concept">
3438 <primary>Solaris</primary>
3439 <secondary>stopping Exim on</secondary>
3440 </indexterm>
3441 The standard command for stopping the mailer daemon on Solaris is
3442 </para>
3443 <literallayout class="monospaced">
3444 /etc/init.d/sendmail stop
3445 </literallayout>
3446 <para>
3447 If <filename>/usr/lib/sendmail</filename> has been turned into a symbolic link, this script
3448 fails to stop Exim because it uses the command <emphasis>ps -e</emphasis> and greps the output
3449 for the text <quote>sendmail</quote>; this is not present because the actual program name
3450 (that is, <quote>exim</quote>) is given by the <emphasis>ps</emphasis> command with these options. A
3451 solution is to replace the line that finds the process id with something like
3452 </para>
3453 <literallayout class="monospaced">
3454 pid=`cat /var/spool/exim/exim-daemon.pid`
3455 </literallayout>
3456 <para>
3457 to obtain the daemon&#x2019;s pid directly from the file that Exim saves it in.
3458 </para>
3459 <para>
3460 Note, however, that stopping the daemon does not <quote>stop Exim</quote>. Messages can
3461 still be received from local processes, and if automatic delivery is configured
3462 (the normal case), deliveries will still occur.
3463 </para>
3464 </section>
3465 </chapter>
3466
3467 <chapter id="CHAPcommandline">
3468 <title>The Exim command line</title>
3469 <para>
3470 <indexterm role="concept" id="IIDclo1" class="startofrange">
3471 <primary>command line</primary>
3472 <secondary>options</secondary>
3473 </indexterm>
3474 <indexterm role="concept" id="IIDclo2" class="startofrange">
3475 <primary>options</primary>
3476 <secondary>command line</secondary>
3477 </indexterm>
3478 Exim&#x2019;s command line takes the standard Unix form of a sequence of options,
3479 each starting with a hyphen character, followed by a number of arguments. The
3480 options are compatible with the main options of Sendmail, and there are also
3481 some additional options, some of which are compatible with Smail 3. Certain
3482 combinations of options do not make sense, and provoke an error if used.
3483 The form of the arguments depends on which options are set.
3484 </para>
3485 <section id="SECID38">
3486 <title>Setting options by program name</title>
3487 <para>
3488 <indexterm role="concept">
3489 <primary><emphasis>mailq</emphasis></primary>
3490 </indexterm>
3491 If Exim is called under the name <emphasis>mailq</emphasis>, it behaves as if the option <option>-bp</option>
3492 were present before any other options.
3493 The <option>-bp</option> option requests a listing of the contents of the mail queue on the
3494 standard output.
3495 This feature is for compatibility with some systems that contain a command of
3496 that name in one of the standard libraries, symbolically linked to
3497 <filename>/usr/sbin/sendmail</filename> or <filename>/usr/lib/sendmail</filename>.
3498 </para>
3499 <para>
3500 <indexterm role="concept">
3501 <primary><emphasis>rsmtp</emphasis></primary>
3502 </indexterm>
3503 If Exim is called under the name <emphasis>rsmtp</emphasis> it behaves as if the option <option>-bS</option>
3504 were present before any other options, for compatibility with Smail. The
3505 <option>-bS</option> option is used for reading in a number of messages in batched SMTP
3506 format.
3507 </para>
3508 <para>
3509 <indexterm role="concept">
3510 <primary><emphasis>rmail</emphasis></primary>
3511 </indexterm>
3512 If Exim is called under the name <emphasis>rmail</emphasis> it behaves as if the <option>-i</option> and
3513 <option>-oee</option> options were present before any other options, for compatibility with
3514 Smail. The name <emphasis>rmail</emphasis> is used as an interface by some UUCP systems.
3515 </para>
3516 <para>
3517 <indexterm role="concept">
3518 <primary><emphasis>runq</emphasis></primary>
3519 </indexterm>
3520 <indexterm role="concept">
3521 <primary>queue runner</primary>
3522 </indexterm>
3523 If Exim is called under the name <emphasis>runq</emphasis> it behaves as if the option <option>-q</option>
3524 were present before any other options, for compatibility with Smail. The <option>-q</option>
3525 option causes a single queue runner process to be started.
3526 </para>
3527 <para>
3528 <indexterm role="concept">
3529 <primary><emphasis>newaliases</emphasis></primary>
3530 </indexterm>
3531 <indexterm role="concept">
3532 <primary>alias file</primary>
3533 <secondary>building</secondary>
3534 </indexterm>
3535 <indexterm role="concept">
3536 <primary>Sendmail compatibility</primary>
3537 <secondary>calling Exim as <emphasis>newaliases</emphasis></secondary>
3538 </indexterm>
3539 If Exim is called under the name <emphasis>newaliases</emphasis> it behaves as if the option
3540 <option>-bi</option> were present before any other options, for compatibility with Sendmail.
3541 This option is used for rebuilding Sendmail&#x2019;s alias file. Exim does not have
3542 the concept of a single alias file, but can be configured to run a given
3543 command if called with the <option>-bi</option> option.
3544 </para>
3545 </section>
3546 <section id="SECTtrustedadmin">
3547 <title>Trusted and admin users</title>
3548 <para>
3549 Some Exim options are available only to <emphasis>trusted users</emphasis> and others are
3550 available only to <emphasis>admin users</emphasis>. In the description below, the phrases <quote>Exim
3551 user</quote> and <quote>Exim group</quote> mean the user and group defined by EXIM_USER and
3552 EXIM_GROUP in <filename>Local/Makefile</filename> or set by the <option>exim_user</option> and
3553 <option>exim_group</option> options. These do not necessarily have to use the name <quote>exim</quote>.
3554 </para>
3555 <itemizedlist>
3556 <listitem>
3557 <para>
3558 <indexterm role="concept">
3559 <primary>trusted users</primary>
3560 <secondary>definition of</secondary>
3561 </indexterm>
3562 <indexterm role="concept">
3563 <primary>user</primary>
3564 <secondary>trusted definition of</secondary>
3565 </indexterm>
3566 The trusted users are root, the Exim user, any user listed in the
3567 <option>trusted_users</option> configuration option, and any user whose current group or any
3568 supplementary group is one of those listed in the <option>trusted_groups</option>
3569 configuration option. Note that the Exim group is not automatically trusted.
3570 </para>
3571 <para>
3572 <indexterm role="concept">
3573 <primary><quote>From</quote> line</primary>
3574 </indexterm>
3575 <indexterm role="concept">
3576 <primary>envelope sender</primary>
3577 </indexterm>
3578 Trusted users are always permitted to use the <option>-f</option> option or a leading
3579 <quote>From&nbsp;</quote> line to specify the envelope sender of a message that is passed to
3580 Exim through the local interface (see the <option>-bm</option> and <option>-f</option> options below).
3581 See the <option>untrusted_set_sender</option> option for a way of permitting non-trusted
3582 users to set envelope senders.
3583 </para>
3584 <para>
3585 <indexterm role="concept">
3586 <primary><emphasis>From:</emphasis> header line</primary>
3587 </indexterm>
3588 <indexterm role="concept">
3589 <primary><emphasis>Sender:</emphasis> header line</primary>
3590 </indexterm>
3591 For a trusted user, there is never any check on the contents of the <emphasis>From:</emphasis>
3592 header line, and a <emphasis>Sender:</emphasis> line is never added. Furthermore, any existing
3593 <emphasis>Sender:</emphasis> line in incoming local (non-TCP/IP) messages is not removed.
3594 </para>
3595 <para>
3596 Trusted users may also specify a host name, host address, interface address,
3597 protocol name, ident value, and authentication data when submitting a message
3598 locally. Thus, they are able to insert messages into Exim&#x2019;s queue locally that
3599 have the characteristics of messages received from a remote host. Untrusted
3600 users may in some circumstances use <option>-f</option>, but can never set the other values
3601 that are available to trusted users.
3602 </para>
3603 </listitem>
3604 <listitem>
3605 <para>
3606 <indexterm role="concept">
3607 <primary>user</primary>
3608 <secondary>admin definition of</secondary>
3609 </indexterm>
3610 <indexterm role="concept">
3611 <primary>admin user</primary>
3612 <secondary>definition of</secondary>
3613 </indexterm>
3614 The admin users are root, the Exim user, and any user that is a member of the
3615 Exim group or of any group listed in the <option>admin_groups</option> configuration option.
3616 The current group does not have to be one of these groups.
3617 </para>
3618 <para>
3619 Admin users are permitted to list the queue, and to carry out certain
3620 operations on messages, for example, to force delivery failures. It is also
3621 necessary to be an admin user in order to see the full information provided by
3622 the Exim monitor, and full debugging output.
3623 </para>
3624 <para>
3625 By default, the use of the <option>-M</option>, <option>-q</option>, <option>-R</option>, and <option>-S</option> options to cause
3626 Exim to attempt delivery of messages on its queue is restricted to admin users.
3627 However, this restriction can be relaxed by setting the <option>prod_requires_admin</option>
3628 option false (that is, specifying <option>no_prod_requires_admin</option>).
3629 </para>
3630 <para>
3631 Similarly, the use of the <option>-bp</option> option to list all the messages in the queue
3632 is restricted to admin users unless <option>queue_list_requires_admin</option> is set
3633 false.
3634 </para>
3635 </listitem>
3636 </itemizedlist>
3637 <para>
3638 <emphasis role="bold">Warning</emphasis>: If you configure your system so that admin users are able to
3639 edit Exim&#x2019;s configuration file, you are giving those users an easy way of
3640 getting root. There is further discussion of this issue at the start of chapter
3641 <xref linkend="CHAPconf"/>.
3642 </para>
3643 </section>
3644 <section id="SECID39">
3645 <title>Command line options</title>
3646 <para>
3647 Exim&#x2019;s command line options are described in alphabetical order below. If none
3648 of the options that specifies a specific action (such as starting the daemon or
3649 a queue runner, or testing an address, or receiving a message in a specific
3650 format, or listing the queue) are present, and there is at least one argument
3651 on the command line, <option>-bm</option> (accept a local message on the standard input,
3652 with the arguments specifying the recipients) is assumed. Otherwise, Exim
3653 outputs a brief message about itself and exits.
3654 </para>
3655 <!-- === Start of command line options === -->
3656 <variablelist>
3657 <varlistentry>
3658 <term><option>--</option></term>
3659 <listitem>
3660 <para>
3661 <indexterm role="option">
3662 <primary>--</primary>
3663 </indexterm>
3664 <indexterm role="concept">
3665 <primary>options</primary>
3666 <secondary>command line; terminating</secondary>
3667 </indexterm>
3668 This is a pseudo-option whose only purpose is to terminate the options and
3669 therefore to cause subsequent command line items to be treated as arguments
3670 rather than options, even if they begin with hyphens.
3671 </para>
3672 </listitem></varlistentry>
3673 <varlistentry>
3674 <term><option>--help</option></term>
3675 <listitem>
3676 <para>
3677 <indexterm role="option">
3678 <primary><option>--help</option></primary>
3679 </indexterm>
3680 This option causes Exim to output a few sentences stating what it is.
3681 The same output is generated if the Exim binary is called with no options and
3682 no arguments.
3683 </para>
3684 </listitem></varlistentry>
3685 <varlistentry>
3686 <term><option>--version</option></term>
3687 <listitem>
3688 <para>
3689 <indexterm role="option">
3690 <primary><option>--version</option></primary>
3691 </indexterm>
3692 This option is an alias for <option>-bV</option> and causes version information to be
3693 displayed.
3694 </para>
3695 </listitem></varlistentry>
3696 <varlistentry>
3697 <term><option>-Ac</option></term>
3698 <term><option>-Am</option></term>
3699 <listitem>
3700 <para>
3701 <indexterm role="option">
3702 <primary><option>-Ac</option></primary>
3703 </indexterm>
3704 <indexterm role="option">
3705 <primary><option>-Am</option></primary>
3706 </indexterm>
3707 These options are used by Sendmail for selecting configuration files and are
3708 ignored by Exim.
3709 </para>
3710 </listitem></varlistentry>
3711 <varlistentry>
3712 <term><option>-B</option>&lt;<emphasis>type</emphasis>&gt;</term>
3713 <listitem>
3714 <para>
3715 <indexterm role="option">
3716 <primary><option>-B</option></primary>
3717 </indexterm>
3718 <indexterm role="concept">
3719 <primary>8-bit characters</primary>
3720 </indexterm>
3721 <indexterm role="concept">
3722 <primary>Sendmail compatibility</primary>
3723 <secondary>8-bit characters</secondary>
3724 </indexterm>
3725 This is a Sendmail option for selecting 7 or 8 bit processing. Exim is 8-bit
3726 clean; it ignores this option.
3727 </para>
3728 </listitem></varlistentry>
3729 <varlistentry>
3730 <term><option>-bd</option></term>
3731 <listitem>
3732 <para>
3733 <indexterm role="option">
3734 <primary><option>-bd</option></primary>
3735 </indexterm>
3736 <indexterm role="concept">
3737 <primary>daemon</primary>
3738 </indexterm>
3739 <indexterm role="concept">
3740 <primary>SMTP</primary>
3741 <secondary>listener</secondary>
3742 </indexterm>
3743 <indexterm role="concept">
3744 <primary>queue runner</primary>
3745 </indexterm>
3746 This option runs Exim as a daemon, awaiting incoming SMTP connections. Usually
3747 the <option>-bd</option> option is combined with the <option>-q</option>&lt;<emphasis>time</emphasis>&gt; option, to specify
3748 that the daemon should also initiate periodic queue runs.
3749 </para>
3750 <para>
3751 The <option>-bd</option> option can be used only by an admin user. If either of the <option>-d</option>
3752 (debugging) or <option>-v</option> (verifying) options are set, the daemon does not
3753 disconnect from the controlling terminal. When running this way, it can be
3754 stopped by pressing ctrl-C.
3755 </para>
3756 <para>
3757 By default, Exim listens for incoming connections to the standard SMTP port on
3758 all the host&#x2019;s running interfaces. However, it is possible to listen on other
3759 ports, on multiple ports, and only on specific interfaces. Chapter
3760 <xref linkend="CHAPinterfaces"/> contains a description of the options that control this.
3761 </para>
3762 <para>
3763 When a listening daemon
3764 <indexterm role="concept">
3765 <primary>daemon</primary>
3766 <secondary>process id (pid)</secondary>
3767 </indexterm>
3768 <indexterm role="concept">
3769 <primary>pid (process id)</primary>
3770 <secondary>of daemon</secondary>
3771 </indexterm>
3772 is started without the use of <option>-oX</option> (that is, without overriding the normal
3773 configuration), it writes its process id to a file called <filename>exim-daemon.pid</filename>
3774 in Exim&#x2019;s spool directory. This location can be overridden by setting
3775 PID_FILE_PATH in <filename>Local/Makefile</filename>. The file is written while Exim is still
3776 running as root.
3777 </para>
3778 <para>
3779 When <option>-oX</option> is used on the command line to start a listening daemon, the
3780 process id is not written to the normal pid file path. However, <option>-oP</option> can be
3781 used to specify a path on the command line if a pid file is required.
3782 </para>
3783 <para>
3784 The SIGHUP signal
3785 <indexterm role="concept">
3786 <primary>SIGHUP</primary>
3787 </indexterm>
3788 <indexterm role="concept">
3789 <primary>daemon</primary>
3790 <secondary>restarting</secondary>
3791 </indexterm>
3792 can be used to cause the daemon to re-execute itself. This should be done
3793 whenever Exim&#x2019;s configuration file, or any file that is incorporated into it by
3794 means of the <option>.include</option> facility, is changed, and also whenever a new version
3795 of Exim is installed. It is not necessary to do this when other files that are
3796 referenced from the configuration (for example, alias files) are changed,
3797 because these are reread each time they are used.
3798 </para>
3799 </listitem></varlistentry>
3800 <varlistentry>
3801 <term><option>-bdf</option></term>
3802 <listitem>
3803 <para>
3804 <indexterm role="option">
3805 <primary><option>-bdf</option></primary>
3806 </indexterm>
3807 This option has the same effect as <option>-bd</option> except that it never disconnects
3808 from the controlling terminal, even when no debugging is specified.
3809 </para>
3810 </listitem></varlistentry>
3811 <varlistentry>
3812 <term><option>-be</option></term>
3813 <listitem>
3814 <para>
3815 <indexterm role="option">
3816 <primary><option>-be</option></primary>
3817 </indexterm>
3818 <indexterm role="concept">
3819 <primary>testing</primary>
3820 <secondary>string expansion</secondary>
3821 </indexterm>
3822 <indexterm role="concept">
3823 <primary>expansion</primary>
3824 <secondary>testing</secondary>
3825 </indexterm>
3826 Run Exim in expansion testing mode. Exim discards its root privilege, to
3827 prevent ordinary users from using this mode to read otherwise inaccessible
3828 files. If no arguments are given, Exim runs interactively, prompting for lines
3829 of data. Otherwise, it processes each argument in turn.
3830 </para>
3831 <para>
3832 If Exim was built with USE_READLINE=yes in <filename>Local/Makefile</filename>, it tries
3833 to load the <option>libreadline</option> library dynamically whenever the <option>-be</option> option is
3834 used without command line arguments. If successful, it uses the <function>readline()</function>
3835 function, which provides extensive line-editing facilities, for reading the
3836 test data. A line history is supported.
3837 </para>
3838 <para>
3839 Long expansion expressions can be split over several lines by using backslash
3840 continuations. As in Exim&#x2019;s run time configuration, white space at the start of
3841 continuation lines is ignored. Each argument or data line is passed through the
3842 string expansion mechanism, and the result is output. Variable values from the
3843 configuration file (for example, <varname>$qualify_domain</varname>) are available, but no
3844 message-specific values (such as <varname>$sender_domain</varname>) are set, because no message
3845 is being processed (but see <option>-bem</option> and <option>-Mset</option>).
3846 </para>
3847 <para>
3848 <emphasis role="bold">Note</emphasis>: If you use this mechanism to test lookups, and you change the data
3849 files or databases you are using, you must exit and restart Exim before trying
3850 the same lookup again. Otherwise, because each Exim process caches the results
3851 of lookups, you will just get the same result as before.
3852 </para>
3853 </listitem></varlistentry>
3854 <varlistentry>
3855 <term><option>-bem</option>&nbsp;&lt;<emphasis>filename</emphasis>&gt;</term>
3856 <listitem>
3857 <para>
3858 <indexterm role="option">
3859 <primary><option>-bem</option></primary>
3860 </indexterm>
3861 <indexterm role="concept">
3862 <primary>testing</primary>
3863 <secondary>string expansion</secondary>
3864 </indexterm>
3865 <indexterm role="concept">
3866 <primary>expansion</primary>
3867 <secondary>testing</secondary>
3868 </indexterm>
3869 This option operates like <option>-be</option> except that it must be followed by the name
3870 of a file. For example:
3871 </para>
3872 <literallayout class="monospaced">
3873 exim -bem /tmp/testmessage
3874 </literallayout>
3875 <para>
3876 The file is read as a message (as if receiving a locally-submitted non-SMTP
3877 message) before any of the test expansions are done. Thus, message-specific
3878 variables such as <varname>$message_size</varname> and <varname>$header_from:</varname> are available. However,
3879 no <emphasis>Received:</emphasis> header is added to the message. If the <option>-t</option> option is set,
3880 recipients are read from the headers in the normal way, and are shown in the
3881 <varname>$recipients</varname> variable. Note that recipients cannot be given on the command
3882 line, because further arguments are taken as strings to expand (just like
3883 <option>-be</option>).
3884 </para>
3885 </listitem></varlistentry>
3886 <varlistentry>
3887 <term><option>-bF</option>&nbsp;&lt;<emphasis>filename</emphasis>&gt;</term>
3888 <listitem>
3889 <para>
3890 <indexterm role="option">
3891 <primary><option>-bF</option></primary>
3892 </indexterm>
3893 <indexterm role="concept">
3894 <primary>system filter</primary>
3895 <secondary>testing</secondary>
3896 </indexterm>
3897 <indexterm role="concept">
3898 <primary>testing</primary>
3899 <secondary>system filter</secondary>
3900 </indexterm>
3901 This option is the same as <option>-bf</option> except that it assumes that the filter being
3902 tested is a system filter. The additional commands that are available only in
3903 system filters are recognized.
3904 </para>
3905 </listitem></varlistentry>
3906 <varlistentry>
3907 <term><option>-bf</option>&nbsp;&lt;<emphasis>filename</emphasis>&gt;</term>
3908 <listitem>
3909 <para>
3910 <indexterm role="option">
3911 <primary><option>-bf</option></primary>
3912 </indexterm>
3913 <indexterm role="concept">
3914 <primary>filter</primary>
3915 <secondary>testing</secondary>
3916 </indexterm>
3917 <indexterm role="concept">
3918 <primary>testing</primary>
3919 <secondary>filter file</secondary>
3920 </indexterm>
3921 <indexterm role="concept">
3922 <primary>forward file</primary>
3923 <secondary>testing</secondary>
3924 </indexterm>
3925 <indexterm role="concept">
3926 <primary>testing</primary>
3927 <secondary>forward file</secondary>
3928 </indexterm>
3929 <indexterm role="concept">
3930 <primary>Sieve filter</primary>
3931 <secondary>testing</secondary>
3932 </indexterm>
3933 This option runs Exim in user filter testing mode; the file is the filter file
3934 to be tested, and a test message must be supplied on the standard input. If
3935 there are no message-dependent tests in the filter, an empty file can be
3936 supplied.
3937 </para>
3938 <para>
3939 If you want to test a system filter file, use <option>-bF</option> instead of <option>-bf</option>. You
3940 can use both <option>-bF</option> and <option>-bf</option> on the same command, in order to test a system
3941 filter and a user filter in the same run. For example:
3942 </para>
3943 <literallayout class="monospaced">
3944 exim -bF /system/filter -bf /user/filter &lt;/test/message
3945 </literallayout>
3946 <para>
3947 This is helpful when the system filter adds header lines or sets filter
3948 variables that are used by the user filter.
3949 </para>
3950 <para>
3951 If the test filter file does not begin with one of the special lines
3952 </para>
3953 <literallayout class="monospaced">
3954 # Exim filter
3955 # Sieve filter
3956 </literallayout>
3957 <para>
3958 it is taken to be a normal <filename>.forward</filename> file, and is tested for validity under
3959 that interpretation. See sections <xref linkend="SECTitenonfilred"/> to
3960 <xref linkend="SECTspecitredli"/> for a description of the possible contents of non-filter
3961 redirection lists.
3962 </para>
3963 <para>
3964 The result of an Exim command that uses <option>-bf</option>, provided no errors are
3965 detected, is a list of the actions that Exim would try to take if presented
3966 with the message for real. More details of filter testing are given in the
3967 separate document entitled <emphasis>Exim&#x2019;s interfaces to mail filtering</emphasis>.
3968 </para>
3969 <para>
3970 When testing a filter file,
3971 <indexterm role="concept">
3972 <primary><quote>From</quote> line</primary>
3973 </indexterm>
3974 <indexterm role="concept">
3975 <primary>envelope sender</primary>
3976 </indexterm>
3977 <indexterm role="option">
3978 <primary><option>-f</option></primary>
3979 <secondary>for filter testing</secondary>
3980 </indexterm>
3981 the envelope sender can be set by the <option>-f</option> option,
3982 or by a <quote>From&nbsp;</quote> line at the start of the test message. Various parameters
3983 that would normally be taken from the envelope recipient address of the message
3984 can be set by means of additional command line options (see the next four
3985 options).
3986 </para>
3987 </listitem></varlistentry>
3988 <varlistentry>
3989 <term><option>-bfd</option>&nbsp;&lt;<emphasis>domain</emphasis>&gt;</term>
3990 <listitem>
3991 <para>
3992 <indexterm role="option">
3993 <primary><option>-bfd</option></primary>
3994 </indexterm>
3995 <indexterm role="variable">
3996 <primary><varname>$qualify_domain</varname></primary>
3997 </indexterm>
3998 This sets the domain of the recipient address when a filter file is being
3999 tested by means of the <option>-bf</option> option. The default is the value of
4000 <varname>$qualify_domain</varname>.
4001 </para>
4002 </listitem></varlistentry>
4003 <varlistentry>
4004 <term><option>-bfl</option>&nbsp;&lt;<emphasis>local&nbsp;part</emphasis>&gt;</term>
4005 <listitem>
4006 <para>
4007 <indexterm role="option">
4008 <primary><option>-bfl</option></primary>
4009 </indexterm>
4010 This sets the local part of the recipient address when a filter file is being
4011 tested by means of the <option>-bf</option> option. The default is the username of the
4012 process that calls Exim. A local part should be specified with any prefix or
4013 suffix stripped, because that is how it appears to the filter when a message is
4014 actually being delivered.
4015 </para>
4016 </listitem></varlistentry>
4017 <varlistentry>
4018 <term><option>-bfp</option>&nbsp;&lt;<emphasis>prefix</emphasis>&gt;</term>
4019 <listitem>
4020 <para>
4021 <indexterm role="option">
4022 <primary><option>-bfp</option></primary>
4023 </indexterm>
4024 This sets the prefix of the local part of the recipient address when a filter
4025 file is being tested by means of the <option>-bf</option> option. The default is an empty
4026 prefix.
4027 </para>
4028 </listitem></varlistentry>
4029 <varlistentry>
4030 <term><option>-bfs</option>&nbsp;&lt;<emphasis>suffix</emphasis>&gt;</term>
4031 <listitem>
4032 <para>
4033 <indexterm role="option">
4034 <primary><option>-bfs</option></primary>
4035 </indexterm>
4036 This sets the suffix of the local part of the recipient address when a filter
4037 file is being tested by means of the <option>-bf</option> option. The default is an empty
4038 suffix.
4039 </para>
4040 </listitem></varlistentry>
4041 <varlistentry>
4042 <term><option>-bh</option>&nbsp;&lt;<emphasis>IP&nbsp;address</emphasis>&gt;</term>
4043 <listitem>
4044 <para>
4045 <indexterm role="option">
4046 <primary><option>-bh</option></primary>
4047 </indexterm>
4048 <indexterm role="concept">
4049 <primary>testing</primary>
4050 <secondary>incoming SMTP</secondary>
4051 </indexterm>
4052 <indexterm role="concept">
4053 <primary>SMTP</primary>
4054 <secondary>testing incoming</secondary>
4055 </indexterm>
4056 <indexterm role="concept">
4057 <primary>testing</primary>
4058 <secondary>relay control</secondary>
4059 </indexterm>
4060 <indexterm role="concept">
4061 <primary>relaying</primary>
4062 <secondary>testing configuration</secondary>
4063 </indexterm>
4064 <indexterm role="concept">
4065 <primary>policy control</primary>
4066 <secondary>testing</secondary>
4067 </indexterm>
4068 <indexterm role="concept">
4069 <primary>debugging</primary>
4070 <secondary><option>-bh</option> option</secondary>
4071 </indexterm>
4072 This option runs a fake SMTP session as if from the given IP address, using the
4073 standard input and output. The IP address may include a port number at the end,
4074 after a full stop. For example:
4075 </para>
4076 <literallayout class="monospaced">
4077 exim -bh 10.9.8.7.1234
4078 exim -bh fe80::a00:20ff:fe86:a061.5678
4079 </literallayout>
4080 <para>
4081 When an IPv6 address is given, it is converted into canonical form. In the case
4082 of the second example above, the value of <varname>$sender_host_address</varname> after
4083 conversion to the canonical form is
4084 <literal>fe80:0000:0000:0a00:20ff:fe86:a061.5678</literal>.
4085 </para>
4086 <para>
4087 Comments as to what is going on are written to the standard error file. These
4088 include lines beginning with <quote>LOG</quote> for anything that would have been logged.
4089 This facility is provided for testing configuration options for incoming
4090 messages, to make sure they implement the required policy. For example, you can
4091 test your relay controls using <option>-bh</option>.
4092 </para>
4093 <para>
4094 <emphasis role="bold">Warning 1</emphasis>:
4095 <indexterm role="concept">
4096 <primary>RFC 1413</primary>
4097 </indexterm>
4098 You can test features of the configuration that rely on ident (RFC 1413)
4099 information by using the <option>-oMt</option> option. However, Exim cannot actually perform
4100 an ident callout when testing using <option>-bh</option> because there is no incoming SMTP
4101 connection.
4102 </para>
4103 <para>
4104 <emphasis role="bold">Warning 2</emphasis>: Address verification callouts (see section <xref linkend="SECTcallver"/>)
4105 are also skipped when testing using <option>-bh</option>. If you want these callouts to
4106 occur, use <option>-bhc</option> instead.
4107 </para>
4108 <para>
4109 Messages supplied during the testing session are discarded, and nothing is
4110 written to any of the real log files. There may be pauses when DNS (and other)
4111 lookups are taking place, and of course these may time out. The <option>-oMi</option> option
4112 can be used to specify a specific IP interface and port if this is important,
4113 and <option>-oMaa</option> and <option>-oMai</option> can be used to set parameters as if the SMTP
4114 session were authenticated.
4115 </para>
4116 <para>
4117 The <emphasis>exim_checkaccess</emphasis> utility is a <quote>packaged</quote> version of <option>-bh</option> whose
4118 output just states whether a given recipient address from a given host is
4119 acceptable or not. See section <xref linkend="SECTcheckaccess"/>.
4120 </para>
4121 <para>
4122 Features such as authentication and encryption, where the client input is not
4123 plain text, cannot easily be tested with <option>-bh</option>. Instead, you should use a
4124 specialized SMTP test program such as
4125 <emphasis role="bold"><ulink url="http://jetmore.org/john/code/#swaks">swaks</ulink></emphasis>.
4126 </para>
4127 </listitem></varlistentry>
4128 <varlistentry>
4129 <term><option>-bhc</option>&nbsp;&lt;<emphasis>IP&nbsp;address</emphasis>&gt;</term>
4130 <listitem>
4131 <para>
4132 <indexterm role="option">
4133 <primary><option>-bhc</option></primary>
4134 </indexterm>
4135 This option operates in the same way as <option>-bh</option>, except that address
4136 verification callouts are performed if required. This includes consulting and
4137 updating the callout cache database.
4138 </para>
4139 </listitem></varlistentry>
4140 <varlistentry>
4141 <term><option>-bi</option></term>
4142 <listitem>
4143 <para>
4144 <indexterm role="option">
4145 <primary><option>-bi</option></primary>
4146 </indexterm>
4147 <indexterm role="concept">
4148 <primary>alias file</primary>
4149 <secondary>building</secondary>
4150 </indexterm>
4151 <indexterm role="concept">
4152 <primary>building alias file</primary>
4153 </indexterm>
4154 <indexterm role="concept">
4155 <primary>Sendmail compatibility</primary>
4156 <secondary><option>-bi</option> option</secondary>
4157 </indexterm>
4158 Sendmail interprets the <option>-bi</option> option as a request to rebuild its alias file.
4159 Exim does not have the concept of a single alias file, and so it cannot mimic
4160 this behaviour. However, calls to <filename>/usr/lib/sendmail</filename> with the <option>-bi</option> option
4161 tend to appear in various scripts such as NIS make files, so the option must be
4162 recognized.
4163 </para>
4164 <para>
4165 If <option>-bi</option> is encountered, the command specified by the <option>bi_command</option>
4166 configuration option is run, under the uid and gid of the caller of Exim. If
4167 the <option>-oA</option> option is used, its value is passed to the command as an argument.
4168 The command set by <option>bi_command</option> may not contain arguments. The command can
4169 use the <emphasis>exim_dbmbuild</emphasis> utility, or some other means, to rebuild alias files
4170 if this is required. If the <option>bi_command</option> option is not set, calling Exim with
4171 <option>-bi</option> is a no-op.
4172 </para>
4173 </listitem></varlistentry>
4174 <varlistentry>
4175 <term><option>-bI:help</option></term>
4176 <listitem>
4177 <para>
4178 <indexterm role="option">
4179 <primary><option>-bI:help</option></primary>
4180 </indexterm>
4181 <indexterm role="concept">
4182 <primary>querying exim information</primary>
4183 </indexterm>
4184 We shall provide various options starting <literal>-bI:</literal> for querying Exim for
4185 information.  The output of many of these will be intended for machine
4186 consumption.  This one is not.  The <option>-bI:help</option> option asks Exim for a
4187 synopsis of supported options beginning <literal>-bI:</literal>.  Use of any of these
4188 options shall cause Exim to exit after producing the requested output.
4189 </para>
4190 </listitem></varlistentry>
4191 <varlistentry>
4192 <term><option>-bI:dscp</option></term>
4193 <listitem>
4194 <para>
4195 <indexterm role="option">
4196 <primary><option>-bI:dscp</option></primary>
4197 </indexterm>
4198 <indexterm role="concept">
4199 <primary>DSCP</primary>
4200 <secondary>values</secondary>
4201 </indexterm>
4202 This option causes Exim to emit an alphabetically sorted list of all
4203 recognised DSCP names.
4204 </para>
4205 </listitem></varlistentry>
4206 <varlistentry>
4207 <term><option>-bI:sieve</option></term>
4208 <listitem>
4209 <para>
4210 <indexterm role="option">
4211 <primary><option>-bI:sieve</option></primary>
4212 </indexterm>
4213 <indexterm role="concept">
4214 <primary>Sieve filter</primary>
4215 <secondary>capabilities</secondary>
4216 </indexterm>
4217 This option causes Exim to emit an alphabetically sorted list of all supported
4218 Sieve protocol extensions on stdout, one per line.  This is anticipated to be
4219 useful for ManageSieve (RFC 5804) implementations, in providing that protocol&#x2019;s
4220 <literal>SIEVE</literal> capability response line.  As the precise list may depend upon
4221 compile-time build options, which this option will adapt to, this is the only
4222 way to guarantee a correct response.
4223 </para>
4224 </listitem></varlistentry>
4225 <varlistentry>
4226 <term><option>-bm</option></term>
4227 <listitem>
4228 <para>
4229 <indexterm role="option">
4230 <primary><option>-bm</option></primary>
4231 </indexterm>
4232 <indexterm role="concept">
4233 <primary>local message reception</primary>
4234 </indexterm>
4235 This option runs an Exim receiving process that accepts an incoming,
4236 locally-generated message on the standard input. The recipients are given as the
4237 command arguments (except when <option>-t</option> is also present &ndash; see below). Each
4238 argument can be a comma-separated list of RFC 2822 addresses. This is the
4239 default option for selecting the overall action of an Exim call; it is assumed
4240 if no other conflicting option is present.
4241 </para>
4242 <para>
4243 If any addresses in the message are unqualified (have no domain), they are
4244 qualified by the values of the <option>qualify_domain</option> or <option>qualify_recipient</option>
4245 options, as appropriate. The <option>-bnq</option> option (see below) provides a way of
4246 suppressing this for special cases.
4247 </para>
4248 <para>
4249 Policy checks on the contents of local messages can be enforced by means of
4250 the non-SMTP ACL. See chapter <xref linkend="CHAPACL"/> for details.
4251 </para>
4252 <para>
4253 <indexterm role="concept">
4254 <primary>return code</primary>
4255 <secondary>for <option>-bm</option></secondary>
4256 </indexterm>
4257 The return code is zero if the message is successfully accepted. Otherwise, the
4258 action is controlled by the <option>-oe</option><emphasis>x</emphasis> option setting &ndash; see below.
4259 </para>
4260 <para>
4261 The format
4262 <indexterm role="concept">
4263 <primary>message</primary>
4264 <secondary>format</secondary>
4265 </indexterm>
4266 <indexterm role="concept">
4267 <primary>format</primary>
4268 <secondary>message</secondary>
4269 </indexterm>
4270 <indexterm role="concept">
4271 <primary><quote>From</quote> line</primary>
4272 </indexterm>
4273 <indexterm role="concept">
4274 <primary>UUCP</primary>
4275 <secondary><quote>From</quote> line</secondary>
4276 </indexterm>
4277 <indexterm role="concept">
4278 <primary>Sendmail compatibility</primary>
4279 <secondary><quote>From</quote> line</secondary>
4280 </indexterm>
4281 of the message must be as defined in RFC 2822, except that, for
4282 compatibility with Sendmail and Smail, a line in one of the forms
4283 </para>
4284 <literallayout class="monospaced">
4285 From sender Fri Jan  5 12:55 GMT 1997
4286 From sender Fri, 5 Jan 97 12:55:01
4287 </literallayout>
4288 <para>
4289 (with the weekday optional, and possibly with additional text after the date)
4290 is permitted to appear at the start of the message. There appears to be no
4291 authoritative specification of the format of this line. Exim recognizes it by
4292 matching against the regular expression defined by the <option>uucp_from_pattern</option>
4293 option, which can be changed if necessary.
4294 </para>
4295 <para>
4296 <indexterm role="option">
4297 <primary><option>-f</option></primary>
4298 <secondary>overriding <quote>From</quote> line</secondary>
4299 </indexterm>
4300 The specified sender is treated as if it were given as the argument to the
4301 <option>-f</option> option, but if a <option>-f</option> option is also present, its argument is used in
4302 preference to the address taken from the message. The caller of Exim must be a
4303 trusted user for the sender of a message to be set in this way.
4304 </para>
4305 </listitem></varlistentry>
4306 <varlistentry>
4307 <term><option>-bmalware</option>&nbsp;&lt;<emphasis>filename</emphasis>&gt;</term>
4308 <listitem>
4309 <para>
4310 <indexterm role="option">
4311 <primary><option>-bmalware</option></primary>
4312 </indexterm>
4313 <indexterm role="concept">
4314 <primary>testing</primary>
4315 <secondary>,</secondary>
4316 </indexterm>
4317 <indexterm role="concept">
4318 <primary>malware scan test</primary>
4319 </indexterm>
4320 This debugging option causes Exim to scan the given file,
4321 using the malware scanning framework.  The option of <option>av_scanner</option> influences
4322 this option, so if <option>av_scanner</option>&#x2019;s value is dependent upon an expansion then
4323 the expansion should have defaults which apply to this invocation.  ACLs are
4324 not invoked, so if <option>av_scanner</option> references an ACL variable then that variable
4325 will never be populated and <option>-bmalware</option> will fail.
4326 </para>
4327 <para>
4328 Exim will have changed working directory before resolving the filename, so
4329 using fully qualified pathnames is advisable.  Exim will be running as the Exim
4330 user when it tries to open the file, rather than as the invoking user.
4331 This option requires admin privileges.
4332 </para>
4333 <para>
4334 The <option>-bmalware</option> option will not be extended to be more generally useful,
4335 there are better tools for file-scanning.  This option exists to help
4336 administrators verify their Exim and AV scanner configuration.
4337 </para>
4338 </listitem></varlistentry>
4339 <varlistentry>
4340 <term><option>-bnq</option></term>
4341 <listitem>
4342 <para>
4343 <indexterm role="option">
4344 <primary><option>-bnq</option></primary>
4345 </indexterm>
4346 <indexterm role="concept">
4347 <primary>address qualification, suppressing</primary>
4348 </indexterm>
4349 By default, Exim automatically qualifies unqualified addresses (those
4350 without domains) that appear in messages that are submitted locally (that
4351 is, not over TCP/IP). This qualification applies both to addresses in
4352 envelopes, and addresses in header lines. Sender addresses are qualified using
4353 <option>qualify_domain</option>, and recipient addresses using <option>qualify_recipient</option> (which
4354 defaults to the value of <option>qualify_domain</option>).
4355 </para>
4356 <para>
4357 Sometimes, qualification is not wanted. For example, if <option>-bS</option> (batch SMTP) is
4358 being used to re-submit messages that originally came from remote hosts after
4359 content scanning, you probably do not want to qualify unqualified addresses in
4360 header lines. (Such lines will be present only if you have not enabled a header
4361 syntax check in the appropriate ACL.)
4362 </para>
4363 <para>
4364 The <option>-bnq</option> option suppresses all qualification of unqualified addresses in
4365 messages that originate on the local host. When this is used, unqualified
4366 addresses in the envelope provoke errors (causing message rejection) and
4367 unqualified addresses in header lines are left alone.
4368 </para>
4369 </listitem></varlistentry>
4370 <varlistentry>
4371 <term><option>-bP</option></term>
4372 <listitem>
4373 <para>
4374 <indexterm role="option">
4375 <primary><option>-bP</option></primary>
4376 </indexterm>
4377 <indexterm role="concept">
4378 <primary>configuration options</primary>
4379 <secondary>extracting</secondary>
4380 </indexterm>
4381 <indexterm role="concept">
4382 <primary>options</primary>
4383 <secondary>configuration &ndash; extracting</secondary>
4384 </indexterm>
4385 If this option is given with no arguments, it causes the values of all Exim&#x2019;s
4386 main configuration options to be written to the standard output. The values
4387 of one or more specific options can be requested by giving their names as
4388 arguments, for example:
4389 </para>
4390 <literallayout class="monospaced">
4391 exim -bP qualify_domain hold_domains
4392 </literallayout>
4393 <para>
4394 <indexterm role="concept">
4395 <primary>hiding configuration option values</primary>
4396 </indexterm>
4397 <indexterm role="concept">
4398 <primary>configuration options</primary>
4399 <secondary>hiding value of</secondary>
4400 </indexterm>
4401 <indexterm role="concept">
4402 <primary>options</primary>
4403 <secondary>hiding value of</secondary>
4404 </indexterm>
4405 However, any option setting that is preceded by the word <quote>hide</quote> in the
4406 configuration file is not shown in full, except to an admin user. For other
4407 users, the output is as in this example:
4408 </para>
4409 <literallayout class="monospaced">
4410 mysql_servers = &lt;value not displayable&gt;
4411 </literallayout>
4412 <para>
4413 If <option>configure_file</option> is given as an argument, the name of the run time
4414 configuration file is output.
4415 If a list of configuration files was supplied, the value that is output here
4416 is the name of the file that was actually used.
4417 </para>
4418 <para>
4419 <indexterm role="concept">
4420 <primary>options</primary>
4421 <secondary>hiding name of</secondary>
4422 </indexterm>
4423 If the <option>-n</option> flag is given, then for most modes of <option>-bP</option> operation the
4424 name will not be output.
4425 </para>
4426 <para>
4427 <indexterm role="concept">
4428 <primary>daemon</primary>
4429 <secondary>process id (pid)</secondary>
4430 </indexterm>
4431 <indexterm role="concept">
4432 <primary>pid (process id)</primary>
4433 <secondary>of daemon</secondary>
4434 </indexterm>
4435 If <option>log_file_path</option> or <option>pid_file_path</option> are given, the names of the
4436 directories where log files and daemon pid files are written are output,
4437 respectively. If these values are unset, log files are written in a
4438 sub-directory of the spool directory called <option>log</option>, and the pid file is
4439 written directly into the spool directory.
4440 </para>
4441 <para>
4442 If <option>-bP</option> is followed by a name preceded by <literal>+</literal>, for example,
4443 </para>
4444 <literallayout class="monospaced">
4445 exim -bP +local_domains
4446 </literallayout>
4447 <para>
4448 it searches for a matching named list of any type (domain, host, address, or
4449 local part) and outputs what it finds.
4450 </para>
4451 <para>
4452 <indexterm role="concept">
4453 <primary>options</primary>
4454 <secondary>router &ndash; extracting</secondary>
4455 </indexterm>
4456 <indexterm role="concept">
4457 <primary>options</primary>
4458 <secondary>transport &ndash; extracting</secondary>
4459 </indexterm>
4460 <indexterm role="concept">
4461 <primary>options</primary>
4462 <secondary>authenticator &ndash; extracting</secondary>
4463 </indexterm>
4464 If one of the words <option>router</option>, <option>transport</option>, or <option>authenticator</option> is given,
4465 followed by the name of an appropriate driver instance, the option settings for
4466 that driver are output. For example:
4467 </para>
4468 <literallayout class="monospaced">
4469 exim -bP transport local_delivery
4470 </literallayout>
4471 <para>
4472 The generic driver options are output first, followed by the driver&#x2019;s private
4473 options. A list of the names of drivers of a particular type can be obtained by
4474 using one of the words <option>router_list</option>, <option>transport_list</option>, or
4475 <option>authenticator_list</option>, and a complete list of all drivers with their option
4476 settings can be obtained by using <option>routers</option>, <option>transports</option>, or
4477 <option>authenticators</option>.
4478 </para>
4479 <para>
4480 <indexterm role="concept">
4481 <primary>options</primary>
4482 <secondary>macro &ndash; extracting</secondary>
4483 </indexterm>
4484 If invoked by an admin user, then <option>macro</option>, <option>macro_list</option> and <option>macros</option>
4485 are available, similarly to the drivers.  Because macros are sometimes used
4486 for storing passwords, this option is restricted.
4487 The output format is one item per line.
4488 </para>
4489 </listitem></varlistentry>
4490 <varlistentry>
4491 <term><option>-bp</option></term>
4492 <listitem>
4493 <para>
4494 <indexterm role="option">
4495 <primary><option>-bp</option></primary>
4496 </indexterm>
4497 <indexterm role="concept">
4498 <primary>queue</primary>
4499 <secondary>listing messages on</secondary>
4500 </indexterm>
4501 <indexterm role="concept">
4502 <primary>listing</primary>
4503 <secondary>messages on the queue</secondary>
4504 </indexterm>
4505 This option requests a listing of the contents of the mail queue on the
4506 standard output. If the <option>-bp</option> option is followed by a list of message ids,
4507 just those messages are listed. By default, this option can be used only by an
4508 admin user. However, the <option>queue_list_requires_admin</option> option can be set false
4509 to allow any user to see the queue.
4510 </para>
4511 <para>
4512 Each message on the queue is displayed as in the following example:
4513 </para>
4514 <literallayout class="monospaced">
4515 25m  2.9K 0t5C6f-0000c8-00 &lt;alice@wonderland.fict.example&gt;
4516           red.king@looking-glass.fict.example
4517           &lt;other addresses&gt;
4518 </literallayout>
4519 <para>
4520 <indexterm role="concept">
4521 <primary>message</primary>
4522 <secondary>size in queue listing</secondary>
4523 </indexterm>
4524 <indexterm role="concept">
4525 <primary>size</primary>
4526 <secondary>of message</secondary>
4527 </indexterm>
4528 The first line contains the length of time the message has been on the queue
4529 (in this case 25 minutes), the size of the message (2.9K), the unique local
4530 identifier for the message, and the message sender, as contained in the
4531 envelope. For bounce messages, the sender address is empty, and appears as
4532 <quote>&lt;&gt;</quote>. If the message was submitted locally by an untrusted user who overrode
4533 the default sender address, the user&#x2019;s login name is shown in parentheses
4534 before the sender address.
4535 </para>
4536 <para>
4537 <indexterm role="concept">
4538 <primary>frozen messages</primary>
4539 <secondary>in queue listing</secondary>
4540 </indexterm>
4541 If the message is frozen (attempts to deliver it are suspended) then the text
4542 <quote>*** frozen ***</quote> is displayed at the end of this line.
4543 </para>
4544 <para>
4545 The recipients of the message (taken from the envelope, not the headers) are
4546 displayed on subsequent lines. Those addresses to which the message has already
4547 been delivered are marked with the letter D. If an original address gets
4548 expanded into several addresses via an alias or forward file, the original is
4549 displayed with a D only when deliveries for all of its child addresses are
4550 complete.
4551 </para>
4552 </listitem></varlistentry>
4553 <varlistentry>
4554 <term><option>-bpa</option></term>
4555 <listitem>
4556 <para>
4557 <indexterm role="option">
4558 <primary><option>-bpa</option></primary>
4559 </indexterm>
4560 This option operates like <option>-bp</option>, but in addition it shows delivered addresses
4561 that were generated from the original top level address(es) in each message by
4562 alias or forwarding operations. These addresses are flagged with <quote>+D</quote> instead
4563 of just <quote>D</quote>.
4564 </para>
4565 </listitem></varlistentry>
4566 <varlistentry>
4567 <term><option>-bpc</option></term>
4568 <listitem>
4569 <para>
4570 <indexterm role="option">
4571 <primary><option>-bpc</option></primary>
4572 </indexterm>
4573 <indexterm role="concept">
4574 <primary>queue</primary>
4575 <secondary>count of messages on</secondary>
4576 </indexterm>
4577 This option counts the number of messages on the queue, and writes the total
4578 to the standard output. It is restricted to admin users, unless
4579 <option>queue_list_requires_admin</option> is set false.
4580 </para>
4581 </listitem></varlistentry>
4582 <varlistentry>
4583 <term><option>-bpr</option></term>
4584 <listitem>
4585 <para>
4586 <indexterm role="option">
4587 <primary><option>-bpr</option></primary>
4588 </indexterm>
4589 This option operates like <option>-bp</option>, but the output is not sorted into
4590 chronological order of message arrival. This can speed it up when there are
4591 lots of messages on the queue, and is particularly useful if the output is
4592 going to be post-processed in a way that doesn&#x2019;t need the sorting.
4593 </para>
4594 </listitem></varlistentry>
4595 <varlistentry>
4596 <term><option>-bpra</option></term>
4597 <listitem>
4598 <para>
4599 <indexterm role="option">
4600 <primary><option>-bpra</option></primary>
4601 </indexterm>
4602 This option is a combination of <option>-bpr</option> and <option>-bpa</option>.
4603 </para>
4604 </listitem></varlistentry>
4605 <varlistentry>
4606 <term><option>-bpru</option></term>
4607 <listitem>
4608 <para>
4609 <indexterm role="option">
4610 <primary><option>-bpru</option></primary>
4611 </indexterm>
4612 This option is a combination of <option>-bpr</option> and <option>-bpu</option>.
4613 </para>
4614 </listitem></varlistentry>
4615 <varlistentry>
4616 <term><option>-bpu</option></term>
4617 <listitem>
4618 <para>
4619 <indexterm role="option">
4620 <primary><option>-bpu</option></primary>
4621 </indexterm>
4622 This option operates like <option>-bp</option> but shows only undelivered top-level
4623 addresses for each message displayed. Addresses generated by aliasing or
4624 forwarding are not shown, unless the message was deferred after processing by a
4625 router with the <option>one_time</option> option set.
4626 </para>
4627 </listitem></varlistentry>
4628 <varlistentry>
4629 <term><option>-brt</option></term>
4630 <listitem>
4631 <para>
4632 <indexterm role="option">
4633 <primary><option>-brt</option></primary>
4634 </indexterm>
4635 <indexterm role="concept">
4636 <primary>testing</primary>
4637 <secondary>retry configuration</secondary>
4638 </indexterm>
4639 <indexterm role="concept">
4640 <primary>retry</primary>
4641 <secondary>configuration testing</secondary>
4642 </indexterm>
4643 This option is for testing retry rules, and it must be followed by up to three
4644 arguments. It causes Exim to look for a retry rule that matches the values
4645 and to write it to the standard output. For example:
4646 </para>
4647 <literallayout class="monospaced">
4648 exim -brt bach.comp.mus.example
4649 Retry rule: *.comp.mus.example  F,2h,15m; F,4d,30m;
4650 </literallayout>
4651 <para>
4652 See chapter <xref linkend="CHAPretry"/> for a description of Exim&#x2019;s retry rules. The first
4653 argument, which is required, can be a complete address in the form
4654 <emphasis>local_part@domain</emphasis>, or it can be just a domain name. If the second argument
4655 contains a dot, it is interpreted as an optional second domain name; if no
4656 retry rule is found for the first argument, the second is tried. This ties in
4657 with Exim&#x2019;s behaviour when looking for retry rules for remote hosts &ndash; if no
4658 rule is found that matches the host, one that matches the mail domain is
4659 sought. Finally, an argument that is the name of a specific delivery error, as
4660 used in setting up retry rules, can be given. For example:
4661 </para>
4662 <literallayout class="monospaced">
4663 exim -brt haydn.comp.mus.example quota_3d
4664 Retry rule: *@haydn.comp.mus.example quota_3d  F,1h,15m
4665 </literallayout>
4666 </listitem></varlistentry>
4667 <varlistentry>
4668 <term><option>-brw</option></term>
4669 <listitem>
4670 <para>
4671 <indexterm role="option">
4672 <primary><option>-brw</option></primary>
4673 </indexterm>
4674 <indexterm role="concept">
4675 <primary>testing</primary>
4676 <secondary>rewriting</secondary>
4677 </indexterm>
4678 <indexterm role="concept">
4679 <primary>rewriting</primary>
4680 <secondary>testing</secondary>
4681 </indexterm>
4682 This option is for testing address rewriting rules, and it must be followed by
4683 a single argument, consisting of either a local part without a domain, or a
4684 complete address with a fully qualified domain. Exim outputs how this address
4685 would be rewritten for each possible place it might appear. See chapter
4686 <xref linkend="CHAPrewrite"/> for further details.
4687 </para>
4688 </listitem></varlistentry>
4689 <varlistentry>
4690 <term><option>-bS</option></term>
4691 <listitem>
4692 <para>
4693 <indexterm role="option">
4694 <primary><option>-bS</option></primary>
4695 </indexterm>
4696 <indexterm role="concept">
4697 <primary>SMTP</primary>
4698 <secondary>batched incoming</secondary>
4699 </indexterm>
4700 <indexterm role="concept">
4701 <primary>batched SMTP input</primary>
4702 </indexterm>
4703 This option is used for batched SMTP input, which is an alternative interface
4704 for non-interactive local message submission. A number of messages can be
4705 submitted in a single run. However, despite its name, this is not really SMTP
4706 input. Exim reads each message&#x2019;s envelope from SMTP commands on the standard
4707 input, but generates no responses. If the caller is trusted, or
4708 <option>untrusted_set_sender</option> is set, the senders in the SMTP MAIL commands are
4709 believed; otherwise the sender is always the caller of Exim.
4710 </para>
4711 <para>
4712 The message itself is read from the standard input, in SMTP format (leading
4713 dots doubled), terminated by a line containing just a single dot. An error is
4714 provoked if the terminating dot is missing. A further message may then follow.
4715 </para>
4716 <para>
4717 As for other local message submissions, the contents of incoming batch SMTP
4718 messages can be checked using the non-SMTP ACL (see chapter <xref linkend="CHAPACL"/>).
4719 Unqualified addresses are automatically qualified using <option>qualify_domain</option> and
4720 <option>qualify_recipient</option>, as appropriate, unless the <option>-bnq</option> option is used.
4721 </para>
4722 <para>
4723 Some other SMTP commands are recognized in the input. HELO and EHLO act
4724 as RSET; VRFY, EXPN, ETRN, and HELP act as NOOP;
4725 QUIT quits, ignoring the rest of the standard input.
4726 </para>
4727 <para>
4728 <indexterm role="concept">
4729 <primary>return code</primary>
4730 <secondary>for <option>-bS</option></secondary>
4731 </indexterm>
4732 If any error is encountered, reports are written to the standard output and
4733 error streams, and Exim gives up immediately. The return code is 0 if no error
4734 was detected; it is 1 if one or more messages were accepted before the error
4735 was detected; otherwise it is 2.
4736 </para>
4737 <para>
4738 More details of input using batched SMTP are given in section
4739 <xref linkend="SECTincomingbatchedSMTP"/>.
4740 </para>
4741 </listitem></varlistentry>
4742 <varlistentry>
4743 <term><option>-bs</option></term>
4744 <listitem>
4745 <para>
4746 <indexterm role="option">
4747 <primary><option>-bs</option></primary>
4748 </indexterm>
4749 <indexterm role="concept">
4750 <primary>SMTP</primary>
4751 <secondary>local input</secondary>
4752 </indexterm>
4753 <indexterm role="concept">
4754 <primary>local SMTP input</primary>
4755 </indexterm>
4756 This option causes Exim to accept one or more messages by reading SMTP commands
4757 on the standard input, and producing SMTP replies on the standard output. SMTP
4758 policy controls, as defined in ACLs (see chapter <xref linkend="CHAPACL"/>) are applied.
4759 Some user agents use this interface as a way of passing locally-generated
4760 messages to the MTA.
4761 </para>
4762 <para>
4763 In
4764 <indexterm role="concept">
4765 <primary>sender</primary>
4766 <secondary>source of</secondary>
4767 </indexterm>
4768 this usage, if the caller of Exim is trusted, or <option>untrusted_set_sender</option> is
4769 set, the senders of messages are taken from the SMTP MAIL commands.
4770 Otherwise the content of these commands is ignored and the sender is set up as
4771 the calling user. Unqualified addresses are automatically qualified using
4772 <option>qualify_domain</option> and <option>qualify_recipient</option>, as appropriate, unless the
4773 <option>-bnq</option> option is used.
4774 </para>
4775 <para>
4776 <indexterm role="concept">
4777 <primary>inetd</primary>
4778 </indexterm>
4779 The
4780 <option>-bs</option> option is also used to run Exim from <emphasis>inetd</emphasis>, as an alternative to
4781 using a listening daemon. Exim can distinguish the two cases by checking
4782 whether the standard input is a TCP/IP socket. When Exim is called from
4783 <emphasis>inetd</emphasis>, the source of the mail is assumed to be remote, and the comments
4784 above concerning senders and qualification do not apply. In this situation,
4785 Exim behaves in exactly the same way as it does when receiving a message via
4786 the listening daemon.
4787 </para>
4788 </listitem></varlistentry>
4789 <varlistentry>
4790 <term><option>-bt</option></term>
4791 <listitem>
4792 <para>
4793 <indexterm role="option">
4794 <primary><option>-bt</option></primary>
4795 </indexterm>
4796 <indexterm role="concept">
4797 <primary>testing</primary>
4798 <secondary>addresses</secondary>
4799 </indexterm>
4800 <indexterm role="concept">
4801 <primary>address</primary>
4802 <secondary>testing</secondary>
4803 </indexterm>
4804 This option runs Exim in address testing mode, in which each argument is taken
4805 as a recipient address to be tested for deliverability. The results are
4806 written to the standard output. If a test fails, and the caller is not an admin
4807 user, no details of the failure are output, because these might contain
4808 sensitive information such as usernames and passwords for database lookups.
4809 </para>
4810 <para>
4811 If no arguments are given, Exim runs in an interactive manner, prompting with a
4812 right angle bracket for addresses to be tested.
4813 </para>
4814 <para>
4815 Unlike the <option>-be</option> test option, you cannot arrange for Exim to use the
4816 <function>readline()</function> function, because it is running as <emphasis>root</emphasis> and there are
4817 security issues.
4818 </para>
4819 <para>
4820 Each address is handled as if it were the recipient address of a message
4821 (compare the <option>-bv</option> option). It is passed to the routers and the result is
4822 written to the standard output. However, any router that has
4823 <option>no_address_test</option> set is bypassed. This can make <option>-bt</option> easier to use for
4824 genuine routing tests if your first router passes everything to a scanner
4825 program.
4826 </para>
4827 <para>
4828 <indexterm role="concept">
4829 <primary>return code</primary>
4830 <secondary>for <option>-bt</option></secondary>
4831 </indexterm>
4832 The return code is 2 if any address failed outright; it is 1 if no address
4833 failed outright but at least one could not be resolved for some reason. Return
4834 code 0 is given only when all addresses succeed.
4835 </para>
4836 <para>
4837 <indexterm role="concept">
4838 <primary>duplicate addresses</primary>
4839 </indexterm>
4840 <emphasis role="bold">Note</emphasis>: When actually delivering a message, Exim removes duplicate recipient
4841 addresses after routing is complete, so that only one delivery takes place.
4842 This does not happen when testing with <option>-bt</option>; the full results of routing are
4843 always shown.
4844 </para>
4845 <para>
4846 <emphasis role="bold">Warning</emphasis>: <option>-bt</option> can only do relatively simple testing. If any of the
4847 routers in the configuration makes any tests on the sender address of a
4848 message,
4849 <indexterm role="option">
4850 <primary><option>-f</option></primary>
4851 <secondary>for address testing</secondary>
4852 </indexterm>
4853 you can use the <option>-f</option> option to set an appropriate sender when running
4854 <option>-bt</option> tests. Without it, the sender is assumed to be the calling user at the
4855 default qualifying domain. However, if you have set up (for example) routers
4856 whose behaviour depends on the contents of an incoming message, you cannot test
4857 those conditions using <option>-bt</option>. The <option>-N</option> option provides a possible way of
4858 doing such tests.
4859 </para>
4860 </listitem></varlistentry>
4861 <varlistentry>
4862 <term><option>-bV</option></term>
4863 <listitem>
4864 <para>
4865 <indexterm role="option">
4866 <primary><option>-bV</option></primary>
4867 </indexterm>
4868 <indexterm role="concept">
4869 <primary>version number of Exim</primary>
4870 </indexterm>
4871 This option causes Exim to write the current version number, compilation
4872 number, and compilation date of the <emphasis>exim</emphasis> binary to the standard output.
4873 It also lists the DBM library that is being used, the optional modules (such as
4874 specific lookup types), the drivers that are included in the binary, and the
4875 name of the run time configuration file that is in use.
4876 </para>
4877 <para>
4878 As part of its operation, <option>-bV</option> causes Exim to read and syntax check its
4879 configuration file. However, this is a static check only. It cannot check
4880 values that are to be expanded. For example, although a misspelt ACL verb is
4881 detected, an error in the verb&#x2019;s arguments is not. You cannot rely on <option>-bV</option>
4882 alone to discover (for example) all the typos in the configuration; some
4883 realistic testing is needed. The <option>-bh</option> and <option>-N</option> options provide more
4884 dynamic testing facilities.
4885 </para>
4886 </listitem></varlistentry>
4887 <varlistentry>
4888 <term><option>-bv</option></term>
4889 <listitem>
4890 <para>
4891 <indexterm role="option">
4892 <primary><option>-bv</option></primary>
4893 </indexterm>
4894 <indexterm role="concept">
4895 <primary>verifying address</primary>
4896 <secondary>using <option>-bv</option></secondary>
4897 </indexterm>
4898 <indexterm role="concept">
4899 <primary>address</primary>
4900 <secondary>verification</secondary>
4901 </indexterm>
4902 This option runs Exim in address verification mode, in which each argument is
4903 taken as a recipient address to be verified by the routers. (This does
4904 not involve any verification callouts). During normal operation, verification
4905 happens mostly as a consequence processing a <option>verify</option> condition in an ACL
4906 (see chapter <xref linkend="CHAPACL"/>). If you want to test an entire ACL, possibly
4907 including callouts, see the <option>-bh</option> and <option>-bhc</option> options.
4908 </para>
4909 <para>
4910 If verification fails, and the caller is not an admin user, no details of the
4911 failure are output, because these might contain sensitive information such as
4912 usernames and passwords for database lookups.
4913 </para>
4914 <para>
4915 If no arguments are given, Exim runs in an interactive manner, prompting with a
4916 right angle bracket for addresses to be verified.
4917 </para>
4918 <para>
4919 Unlike the <option>-be</option> test option, you cannot arrange for Exim to use the
4920 <function>readline()</function> function, because it is running as <emphasis>exim</emphasis> and there are
4921 security issues.
4922 </para>
4923 <para>
4924 Verification differs from address testing (the <option>-bt</option> option) in that routers
4925 that have <option>no_verify</option> set are skipped, and if the address is accepted by a
4926 router that has <option>fail_verify</option> set, verification fails. The address is
4927 verified as a recipient if <option>-bv</option> is used; to test verification for a sender
4928 address, <option>-bvs</option> should be used.
4929 </para>
4930 <para>
4931 If the <option>-v</option> option is not set, the output consists of a single line for each
4932 address, stating whether it was verified or not, and giving a reason in the
4933 latter case. Without <option>-v</option>, generating more than one address by redirection
4934 causes verification to end successfully, without considering the generated
4935 addresses. However, if just one address is generated, processing continues,
4936 and the generated address must verify successfully for the overall verification
4937 to succeed.
4938 </para>
4939 <para>
4940 When <option>-v</option> is set, more details are given of how the address has been handled,
4941 and in the case of address redirection, all the generated addresses are also
4942 considered. Verification may succeed for some and fail for others.
4943 </para>
4944 <para>
4945 The
4946 <indexterm role="concept">
4947 <primary>return code</primary>
4948 <secondary>for <option>-bv</option></secondary>
4949 </indexterm>
4950 return code is 2 if any address failed outright; it is 1 if no address
4951 failed outright but at least one could not be resolved for some reason. Return
4952 code 0 is given only when all addresses succeed.
4953 </para>
4954 <para>
4955 If any of the routers in the configuration makes any tests on the sender
4956 address of a message, you should use the <option>-f</option> option to set an appropriate
4957 sender when running <option>-bv</option> tests. Without it, the sender is assumed to be the
4958 calling user at the default qualifying domain.
4959 </para>
4960 </listitem></varlistentry>
4961 <varlistentry>
4962 <term><option>-bvs</option></term>
4963 <listitem>
4964 <para>
4965 <indexterm role="option">
4966 <primary><option>-bvs</option></primary>
4967 </indexterm>
4968 This option acts like <option>-bv</option>, but verifies the address as a sender rather
4969 than a recipient address. This affects any rewriting and qualification that
4970 might happen.
4971 </para>
4972 </listitem></varlistentry>
4973 <varlistentry>
4974 <term><option>-bw</option></term>
4975 <listitem>
4976 <para>
4977 <indexterm role="option">
4978 <primary><option>-bw</option></primary>
4979 </indexterm>
4980 <indexterm role="concept">
4981 <primary>daemon</primary>
4982 </indexterm>
4983 <indexterm role="concept">
4984 <primary>inetd</primary>
4985 </indexterm>
4986 <indexterm role="concept">
4987 <primary>inetd</primary>
4988 <secondary>wait mode</secondary>
4989 </indexterm>
4990 This option runs Exim as a daemon, awaiting incoming SMTP connections,
4991 similarly to the <option>-bd</option> option.  All port specifications on the command-line
4992 and in the configuration file are ignored.  Queue-running may not be specified.
4993 </para>
4994 <para>
4995 In this mode, Exim expects to be passed a socket as fd 0 (stdin) which is
4996 listening for connections.  This permits the system to start up and have
4997 inetd (or equivalent) listen on the SMTP ports, starting an Exim daemon for
4998 each port only when the first connection is received.
4999 </para>
5000 <para>
5001 If the option is given as <option>-bw</option>&lt;<emphasis>time</emphasis>&gt; then the time is a timeout, after
5002 which the daemon will exit, which should cause inetd to listen once more.
5003 </para>
5004 </listitem></varlistentry>
5005 <varlistentry>
5006 <term><option>-C</option>&nbsp;&lt;<emphasis>filelist</emphasis>&gt;</term>
5007 <listitem>
5008 <para>
5009 <indexterm role="option">
5010 <primary><option>-C</option></primary>
5011 </indexterm>
5012 <indexterm role="concept">
5013 <primary>configuration file</primary>
5014 <secondary>alternate</secondary>
5015 </indexterm>
5016 <indexterm role="concept">
5017 <primary>CONFIGURE_FILE</primary>
5018 </indexterm>
5019 <indexterm role="concept">
5020 <primary>alternate configuration file</primary>
5021 </indexterm>
5022 This option causes Exim to find the run time configuration file from the given
5023 list instead of from the list specified by the CONFIGURE_FILE
5024 compile-time setting. Usually, the list will consist of just a single file
5025 name, but it can be a colon-separated list of names. In this case, the first
5026 file that exists is used. Failure to open an existing file stops Exim from
5027 proceeding any further along the list, and an error is generated.
5028 </para>
5029 <para>
5030 When this option is used by a caller other than root, and the list is different
5031 from the compiled-in list, Exim gives up its root privilege immediately, and
5032 runs with the real and effective uid and gid set to those of the caller.
5033 However, if a TRUSTED_CONFIG_LIST file is defined in <filename>Local/Makefile</filename>, that
5034 file contains a list of full pathnames, one per line, for configuration files
5035 which are trusted. Root privilege is retained for any configuration file so
5036 listed, as long as the caller is the Exim user (or the user specified in the
5037 CONFIGURE_OWNER option, if any), and as long as the configuration file is
5038 not writeable by inappropriate users or groups.
5039 </para>
5040 <para>
5041 Leaving TRUSTED_CONFIG_LIST unset precludes the possibility of testing a
5042 configuration using <option>-C</option> right through message reception and delivery,
5043 even if the caller is root. The reception works, but by that time, Exim is
5044 running as the Exim user, so when it re-executes to regain privilege for the
5045 delivery, the use of <option>-C</option> causes privilege to be lost. However, root can
5046 test reception and delivery using two separate commands (one to put a message
5047 on the queue, using <option>-odq</option>, and another to do the delivery, using <option>-M</option>).
5048 </para>
5049 <para>
5050 If ALT_CONFIG_PREFIX is defined <filename>in Local/Makefile</filename>, it specifies a
5051 prefix string with which any file named in a <option>-C</option> command line option
5052 must start. In addition, the file name must not contain the sequence <literal>/../</literal>.
5053 However, if the value of the <option>-C</option> option is identical to the value of
5054 CONFIGURE_FILE in <filename>Local/Makefile</filename>, Exim ignores <option>-C</option> and proceeds as
5055 usual. There is no default setting for ALT_CONFIG_PREFIX; when it is
5056 unset, any file name can be used with <option>-C</option>.
5057 </para>
5058 <para>
5059 ALT_CONFIG_PREFIX can be used to confine alternative configuration files
5060 to a directory to which only root has access. This prevents someone who has
5061 broken into the Exim account from running a privileged Exim with an arbitrary
5062 configuration file.
5063 </para>
5064 <para>
5065 The <option>-C</option> facility is useful for ensuring that configuration files are
5066 syntactically correct, but cannot be used for test deliveries, unless the
5067 caller is privileged, or unless it is an exotic configuration that does not
5068 require privilege. No check is made on the owner or group of the files
5069 specified by this option.
5070 </para>
5071 </listitem></varlistentry>
5072 <varlistentry>
5073 <term><option>-D</option>&lt;<emphasis>macro</emphasis>&gt;=&lt;<emphasis>value</emphasis>&gt;</term>
5074 <listitem>
5075 <para>
5076 <indexterm role="option">
5077 <primary><option>-D</option></primary>
5078 </indexterm>
5079 <indexterm role="concept">
5080 <primary>macro</primary>
5081 <secondary>setting on command line</secondary>
5082 </indexterm>
5083 This option can be used to override macro definitions in the configuration file
5084 (see section <xref linkend="SECTmacrodefs"/>). However, like <option>-C</option>, if it is used by an
5085 unprivileged caller, it causes Exim to give up its root privilege.
5086 If DISABLE_D_OPTION is defined in <filename>Local/Makefile</filename>, the use of <option>-D</option> is
5087 completely disabled, and its use causes an immediate error exit.
5088 </para>
5089 <para>
5090 If WHITELIST_D_MACROS is defined in <filename>Local/Makefile</filename> then it should be a
5091 colon-separated list of macros which are considered safe and, if <option>-D</option> only
5092 supplies macros from this list, and the values are acceptable, then Exim will
5093 not give up root privilege if the caller is root, the Exim run-time user, or
5094 the CONFIGURE_OWNER, if set.  This is a transition mechanism and is expected
5095 to be removed in the future.  Acceptable values for the macros satisfy the
5096 regexp: <literal>^[A-Za-z0-9_/.-]*$</literal>
5097 </para>
5098 <para>
5099 The entire option (including equals sign if present) must all be within one
5100 command line item. <option>-D</option> can be used to set the value of a macro to the empty
5101 string, in which case the equals sign is optional. These two commands are
5102 synonymous:
5103 </para>
5104 <literallayout class="monospaced">
5105 exim -DABC  ...
5106 exim -DABC= ...
5107 </literallayout>
5108 <para>
5109 To include spaces in a macro definition item, quotes must be used. If you use
5110 quotes, spaces are permitted around the macro name and the equals sign. For
5111 example:
5112 </para>
5113 <literallayout class="monospaced">
5114 exim '-D ABC = something' ...
5115 </literallayout>
5116 <para>
5117 <option>-D</option> may be repeated up to 10 times on a command line.
5118 </para>
5119 </listitem></varlistentry>
5120 <varlistentry>
5121 <term><option>-d</option>&lt;<emphasis>debug&nbsp;options</emphasis>&gt;</term>
5122 <listitem>
5123 <para>
5124 <indexterm role="option">
5125 <primary><option>-d</option></primary>
5126 </indexterm>
5127 <indexterm role="concept">
5128 <primary>debugging</primary>
5129 <secondary>list of selectors</secondary>
5130 </indexterm>
5131 <indexterm role="concept">
5132 <primary>debugging</primary>
5133 <secondary><option>-d</option> option</secondary>
5134 </indexterm>
5135 This option causes debugging information to be written to the standard
5136 error stream. It is restricted to admin users because debugging output may show
5137 database queries that contain password information. Also, the details of users&#x2019;
5138 filter files should be protected. If a non-admin user uses <option>-d</option>, Exim
5139 writes an error message to the standard error stream and exits with a non-zero
5140 return code.
5141 </para>
5142 <para>
5143 When <option>-d</option> is used, <option>-v</option> is assumed. If <option>-d</option> is given on its own, a lot of
5144 standard debugging data is output. This can be reduced, or increased to include
5145 some more rarely needed information, by directly following <option>-d</option> with a string
5146 made up of names preceded by plus or minus characters. These add or remove sets
5147 of debugging data, respectively. For example, <option>-d+filter</option> adds filter
5148 debugging, whereas <option>-d-all+filter</option> selects only filter debugging. Note that
5149 no spaces are allowed in the debug setting. The available debugging categories
5150 are:
5151 </para>
5152 <literallayout>
5153 <literal>acl            </literal> ACL interpretation
5154 <literal>auth           </literal> authenticators
5155 <literal>deliver        </literal> general delivery logic
5156 <literal>dns            </literal> DNS lookups (see also resolver)
5157 <literal>dnsbl          </literal> DNS black list (aka RBL) code
5158 <literal>exec           </literal> arguments for <function>execv()</function> calls
5159 <literal>expand         </literal> detailed debugging for string expansions
5160 <literal>filter         </literal> filter handling
5161 <literal>hints_lookup   </literal> hints data lookups
5162 <literal>host_lookup    </literal> all types of name-to-IP address handling
5163 <literal>ident          </literal> ident lookup
5164 <literal>interface      </literal> lists of local interfaces
5165 <literal>lists          </literal> matching things in lists
5166 <literal>load           </literal> system load checks
5167 <literal>local_scan     </literal> can be used by <function>local_scan()</function> (see chapter <xref linkend="CHAPlocalscan"/>)
5168 <literal>lookup         </literal> general lookup code and all lookups
5169 <literal>memory         </literal> memory handling
5170 <literal>pid            </literal> add pid to debug output lines
5171 <literal>process_info   </literal> setting info for the process log
5172 <literal>queue_run      </literal> queue runs
5173 <literal>receive        </literal> general message reception logic
5174 <literal>resolver       </literal> turn on the DNS resolver&#x2019;s debugging output
5175 <literal>retry          </literal> retry handling
5176 <literal>rewrite        </literal> address rewriting
5177 <literal>route          </literal> address routing
5178 <literal>timestamp      </literal> add timestamp to debug output lines
5179 <literal>tls            </literal> TLS logic
5180 <literal>transport      </literal> transports
5181 <literal>uid            </literal> changes of uid/gid and looking up uid/gid
5182 <literal>verify         </literal> address verification logic
5183 <literal>all            </literal> almost all of the above (see below), and also <option>-v</option>
5184 </literallayout>
5185 <para>
5186 The <literal>all</literal> option excludes <literal>memory</literal> when used as <literal>+all</literal>, but includes it
5187 for <literal>-all</literal>. The reason for this is that <literal>+all</literal> is something that people
5188 tend to use when generating debug output for Exim maintainers. If <literal>+memory</literal>
5189 is included, an awful lot of output that is very rarely of interest is
5190 generated, so it now has to be explicitly requested. However, <literal>-all</literal> does
5191 turn everything off.
5192 </para>
5193 <para>
5194 <indexterm role="concept">
5195 <primary>resolver, debugging output</primary>
5196 </indexterm>
5197 <indexterm role="concept">
5198 <primary>DNS resolver, debugging output</primary>
5199 </indexterm>
5200 The <literal>resolver</literal> option produces output only if the DNS resolver was compiled
5201 with DEBUG enabled. This is not the case in some operating systems. Also,
5202 unfortunately, debugging output from the DNS resolver is written to stdout
5203 rather than stderr.
5204 </para>
5205 <para>
5206 The default (<option>-d</option> with no argument) omits <literal>expand</literal>, <literal>filter</literal>,
5207 <literal>interface</literal>, <literal>load</literal>, <literal>memory</literal>, <literal>pid</literal>, <literal>resolver</literal>, and <literal>timestamp</literal>.
5208 However, the <literal>pid</literal> selector is forced when debugging is turned on for a
5209 daemon, which then passes it on to any re-executed Exims. Exim also
5210 automatically adds the pid to debug lines when several remote deliveries are
5211 run in parallel.
5212 </para>
5213 <para>
5214 The <literal>timestamp</literal> selector causes the current time to be inserted at the start
5215 of all debug output lines. This can be useful when trying to track down delays
5216 in processing.
5217 </para>
5218 <para>
5219 If the <option>debug_print</option> option is set in any driver, it produces output whenever
5220 any debugging is selected, or if <option>-v</option> is used.
5221 </para>
5222 </listitem></varlistentry>
5223 <varlistentry>
5224 <term><option>-dd</option>&lt;<emphasis>debug&nbsp;options</emphasis>&gt;</term>
5225 <listitem>
5226 <para>
5227 <indexterm role="option">
5228 <primary><option>-dd</option></primary>
5229 </indexterm>
5230 This option behaves exactly like <option>-d</option> except when used on a command that
5231 starts a daemon process. In that case, debugging is turned off for the
5232 subprocesses that the daemon creates. Thus, it is useful for monitoring the
5233 behaviour of the daemon without creating as much output as full debugging does.
5234 </para>
5235 </listitem></varlistentry>
5236 <varlistentry>
5237 <term><option>-dropcr</option></term>
5238 <listitem>
5239 <para>
5240 <indexterm role="option">
5241 <primary><option>-dropcr</option></primary>
5242 </indexterm>
5243 This is an obsolete option that is now a no-op. It used to affect the way Exim
5244 handled CR and LF characters in incoming messages. What happens now is
5245 described in section <xref linkend="SECTlineendings"/>.
5246 </para>
5247 </listitem></varlistentry>
5248 <varlistentry>
5249 <term><option>-E</option></term>
5250 <listitem>
5251 <para>
5252 <indexterm role="option">
5253 <primary><option>-E</option></primary>
5254 </indexterm>
5255 <indexterm role="concept">
5256 <primary>bounce message</primary>
5257 <secondary>generating</secondary>
5258 </indexterm>
5259 This option specifies that an incoming message is a locally-generated delivery
5260 failure report. It is used internally by Exim when handling delivery failures
5261 and is not intended for external use. Its only effect is to stop Exim
5262 generating certain messages to the postmaster, as otherwise message cascades
5263 could occur in some situations. As part of the same option, a message id may
5264 follow the characters <option>-E</option>. If it does, the log entry for the receipt of the
5265 new message contains the id, following <quote>R=</quote>, as a cross-reference.
5266 </para>
5267 </listitem></varlistentry>
5268 <varlistentry>
5269 <term><option>-e</option><emphasis>x</emphasis></term>
5270 <listitem>
5271 <para>
5272 <indexterm role="option">
5273 <primary><option>-e</option><emphasis>x</emphasis></primary>
5274 </indexterm>
5275 There are a number of Sendmail options starting with <option>-oe</option> which seem to be
5276 called by various programs without the leading <option>o</option> in the option. For
5277 example, the <option>vacation</option> program uses <option>-eq</option>. Exim treats all options of the
5278 form <option>-e</option><emphasis>x</emphasis> as synonymous with the corresponding <option>-oe</option><emphasis>x</emphasis> options.
5279 </para>
5280 </listitem></varlistentry>
5281 <varlistentry>
5282 <term><option>-F</option>&nbsp;&lt;<emphasis>string</emphasis>&gt;</term>
5283 <listitem>
5284 <para>
5285 <indexterm role="option">
5286 <primary><option>-F</option></primary>
5287 </indexterm>
5288 <indexterm role="concept">
5289 <primary>sender</primary>
5290 <secondary>name</secondary>
5291 </indexterm>
5292 <indexterm role="concept">
5293 <primary>name</primary>
5294 <secondary>of sender</secondary>
5295 </indexterm>
5296 This option sets the sender&#x2019;s full name for use when a locally-generated
5297 message is being accepted. In the absence of this option, the user&#x2019;s <emphasis>gecos</emphasis>
5298 entry from the password data is used. As users are generally permitted to alter
5299 their <emphasis>gecos</emphasis> entries, no security considerations are involved. White space
5300 between <option>-F</option> and the &lt;<emphasis>string</emphasis>&gt; is optional.
5301 </para>
5302 </listitem></varlistentry>
5303 <varlistentry>
5304 <term><option>-f</option>&nbsp;&lt;<emphasis>address</emphasis>&gt;</term>
5305 <listitem>
5306 <para>
5307 <indexterm role="option">
5308 <primary><option>-f</option></primary>
5309 </indexterm>
5310 <indexterm role="concept">
5311 <primary>sender</primary>
5312 <secondary>address</secondary>
5313 </indexterm>
5314 <indexterm role="concept">
5315 <primary>address</primary>
5316 <secondary>sender</secondary>
5317 </indexterm>
5318 <indexterm role="concept">
5319 <primary>trusted users</primary>
5320 </indexterm>
5321 <indexterm role="concept">
5322 <primary>envelope sender</primary>
5323 </indexterm>
5324 <indexterm role="concept">
5325 <primary>user</primary>
5326 <secondary>trusted</secondary>
5327 </indexterm>
5328 This option sets the address of the envelope sender of a locally-generated
5329 message (also known as the return path). The option can normally be used only
5330 by a trusted user, but <option>untrusted_set_sender</option> can be set to allow untrusted
5331 users to use it.
5332 </para>
5333 <para>
5334 Processes running as root or the Exim user are always trusted. Other
5335 trusted users are defined by the <option>trusted_users</option> or <option>trusted_groups</option>
5336 options. In the absence of <option>-f</option>, or if the caller is not trusted, the sender
5337 of a local message is set to the caller&#x2019;s login name at the default qualify
5338 domain.
5339 </para>
5340 <para>
5341 There is one exception to the restriction on the use of <option>-f</option>: an empty sender
5342 can be specified by any user, trusted or not, to create a message that can
5343 never provoke a bounce. An empty sender can be specified either as an empty
5344 string, or as a pair of angle brackets with nothing between them, as in these
5345 examples of shell commands:
5346 </para>
5347 <literallayout class="monospaced">
5348 exim -f '&lt;&gt;' user@domain
5349 exim -f "" user@domain
5350 </literallayout>
5351 <para>
5352 In addition, the use of <option>-f</option> is not restricted when testing a filter file
5353 with <option>-bf</option> or when testing or verifying addresses using the <option>-bt</option> or
5354 <option>-bv</option> options.
5355 </para>
5356 <para>
5357 Allowing untrusted users to change the sender address does not of itself make
5358 it possible to send anonymous mail. Exim still checks that the <emphasis>From:</emphasis> header
5359 refers to the local user, and if it does not, it adds a <emphasis>Sender:</emphasis> header,
5360 though this can be overridden by setting <option>no_local_from_check</option>.
5361 </para>
5362 <para>
5363 White
5364 <indexterm role="concept">
5365 <primary><quote>From</quote> line</primary>
5366 </indexterm>
5367 space between <option>-f</option> and the &lt;<emphasis>address</emphasis>&gt; is optional (that is, they can be
5368 given as two arguments or one combined argument). The sender of a
5369 locally-generated message can also be set (when permitted) by an initial
5370 <quote>From&nbsp;</quote> line in the message &ndash; see the description of <option>-bm</option> above &ndash; but
5371 if <option>-f</option> is also present, it overrides <quote>From&nbsp;</quote>.
5372 </para>
5373 </listitem></varlistentry>
5374 <varlistentry>
5375 <term><option>-G</option></term>
5376 <listitem>
5377 <para>
5378 <indexterm role="option">
5379 <primary><option>-G</option></primary>
5380 </indexterm>
5381 <indexterm role="concept">
5382 <primary>submission fixups, suppressing (command-line)</primary>
5383 </indexterm>
5384 This option is equivalent to an ACL applying:
5385 </para>
5386 <literallayout class="monospaced">
5387 control = suppress_local_fixups
5388 </literallayout>
5389 <para>
5390 for every message received.  Note that Sendmail will complain about such
5391 bad formatting, where Exim silently just does not fix it up.  This may change
5392 in future.
5393 </para>
5394 <para>
5395 As this affects audit information, the caller must be a trusted user to use
5396 this option.
5397 </para>
5398 </listitem></varlistentry>
5399 <varlistentry>
5400 <term><option>-h</option>&nbsp;&lt;<emphasis>number</emphasis>&gt;</term>
5401 <listitem>
5402 <para>
5403 <indexterm role="option">
5404 <primary><option>-h</option></primary>
5405 </indexterm>
5406 <indexterm role="concept">
5407 <primary>Sendmail compatibility</primary>
5408 <secondary><option>-h</option> option ignored</secondary>
5409 </indexterm>
5410 This option is accepted for compatibility with Sendmail, but has no effect. (In
5411 Sendmail it overrides the <quote>hop count</quote> obtained by counting <emphasis>Received:</emphasis>
5412 headers.)
5413 </para>
5414 </listitem></varlistentry>
5415 <varlistentry>
5416 <term><option>-i</option></term>
5417 <listitem>
5418 <para>
5419 <indexterm role="option">
5420 <primary><option>-i</option></primary>
5421 </indexterm>
5422 <indexterm role="concept">
5423 <primary>Solaris</primary>
5424 <secondary><emphasis>mail</emphasis> command</secondary>
5425 </indexterm>
5426 <indexterm role="concept">
5427 <primary>dot</primary>
5428 <secondary>in incoming non-SMTP message</secondary>
5429 </indexterm>
5430 This option, which has the same effect as <option>-oi</option>, specifies that a dot on a
5431 line by itself should not terminate an incoming, non-SMTP message. I can find
5432 no documentation for this option in Solaris 2.4 Sendmail, but the <emphasis>mailx</emphasis>
5433 command in Solaris 2.4 uses it. See also <option>-ti</option>.
5434 </para>
5435 </listitem></varlistentry>
5436 <varlistentry>
5437 <term><option>-L</option>&nbsp;&lt;<emphasis>tag</emphasis>&gt;</term>
5438 <listitem>
5439 <para>
5440 <indexterm role="option">
5441 <primary><option>-L</option></primary>
5442 </indexterm>
5443 <indexterm role="concept">
5444 <primary>syslog</primary>
5445 <secondary>process name; set with flag</secondary>
5446 </indexterm>
5447 This option is equivalent to setting <option>syslog_processname</option> in the config
5448 file and setting <option>log_file_path</option> to <literal>syslog</literal>.
5449 Its use is restricted to administrators.  The configuration file has to be
5450 read and parsed, to determine access rights, before this is set and takes
5451 effect, so early configuration file errors will not honour this flag.
5452 </para>
5453 <para>
5454 The tag should not be longer than 32 characters.
5455 </para>
5456 </listitem></varlistentry>
5457 <varlistentry>
5458 <term><option>-M</option>&nbsp;&lt;<emphasis>message&nbsp;id</emphasis>&gt;&nbsp;&lt;<emphasis>message&nbsp;id</emphasis>&gt;&nbsp;...</term>
5459 <listitem>
5460 <para>
5461 <indexterm role="option">
5462 <primary><option>-M</option></primary>
5463 </indexterm>
5464 <indexterm role="concept">
5465 <primary>forcing delivery</primary>
5466 </indexterm>
5467 <indexterm role="concept">
5468 <primary>delivery</primary>
5469 <secondary>forcing attempt</secondary>
5470 </indexterm>
5471 <indexterm role="concept">
5472 <primary>frozen messages</primary>
5473 <secondary>forcing delivery</secondary>
5474 </indexterm>
5475 This option requests Exim to run a delivery attempt on each message in turn. If
5476 any of the messages are frozen, they are automatically thawed before the
5477 delivery attempt. The settings of <option>queue_domains</option>, <option>queue_smtp_domains</option>,
5478 and <option>hold_domains</option> are ignored.
5479 </para>
5480 <para>
5481 Retry
5482 <indexterm role="concept">
5483 <primary>hints database</primary>
5484 <secondary>overriding retry hints</secondary>
5485 </indexterm>
5486 hints for any of the addresses are overridden &ndash; Exim tries to deliver even if
5487 the normal retry time has not yet been reached. This option requires the caller
5488 to be an admin user. However, there is an option called <option>prod_requires_admin</option>
5489 which can be set false to relax this restriction (and also the same requirement
5490 for the <option>-q</option>, <option>-R</option>, and <option>-S</option> options).
5491 </para>
5492 <para>
5493 The deliveries happen synchronously, that is, the original Exim process does
5494 not terminate until all the delivery attempts have finished. No output is
5495 produced unless there is a serious error. If you want to see what is happening,
5496 use the <option>-v</option> option as well, or inspect Exim&#x2019;s main log.
5497 </para>
5498 </listitem></varlistentry>
5499 <varlistentry>
5500 <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>
5501 <listitem>
5502 <para>
5503 <indexterm role="option">
5504 <primary><option>-Mar</option></primary>
5505 </indexterm>
5506 <indexterm role="concept">
5507 <primary>message</primary>
5508 <secondary>adding recipients</secondary>
5509 </indexterm>
5510 <indexterm role="concept">
5511 <primary>recipient</primary>
5512 <secondary>adding</secondary>
5513 </indexterm>
5514 This option requests Exim to add the addresses to the list of recipients of the
5515 message (<quote>ar</quote> for <quote>add recipients</quote>). The first argument must be a message
5516 id, and the remaining ones must be email addresses. However, if the message is
5517 active (in the middle of a delivery attempt), it is not altered. This option
5518 can be used only by an admin user.
5519 </para>
5520 </listitem></varlistentry>
5521 <varlistentry>
5522 <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>
5523 <listitem>
5524 <para>
5525 <indexterm role="option">
5526 <primary><option>-MC</option></primary>
5527 </indexterm>
5528 <indexterm role="concept">
5529 <primary>SMTP</primary>
5530 <secondary>passed connection</secondary>
5531 </indexterm>
5532 <indexterm role="concept">
5533 <primary>SMTP</primary>
5534 <secondary>multiple deliveries</secondary>
5535 </indexterm>
5536 <indexterm role="concept">
5537 <primary>multiple SMTP deliveries</primary>
5538 </indexterm>
5539 This option is not intended for use by external callers. It is used internally
5540 by Exim to invoke another instance of itself to deliver a waiting message using
5541 an existing SMTP connection, which is passed as the standard input. Details are
5542 given in chapter <xref linkend="CHAPSMTP"/>. This must be the final option, and the caller
5543 must be root or the Exim user in order to use it.
5544 </para>
5545 </listitem></varlistentry>
5546 <varlistentry>
5547 <term><option>-MCA</option></term>
5548 <listitem>
5549 <para>
5550 <indexterm role="option">
5551 <primary><option>-MCA</option></primary>
5552 </indexterm>
5553 This option is not intended for use by external callers. It is used internally
5554 by Exim in conjunction with the <option>-MC</option> option. It signifies that the
5555 connection to the remote host has been authenticated.
5556 </para>
5557 </listitem></varlistentry>
5558 <varlistentry revisionflag="changed">
5559 <term><option>-MCD</option></term>
5560 <listitem>
5561 <para revisionflag="changed">
5562 <indexterm role="option">
5563 <primary><option>-MCD</option></primary>
5564 </indexterm>
5565 This option is not intended for use by external callers. It is used internally
5566 by Exim in conjunction with the <option>-MC</option> option. It signifies that the
5567 remote host supports the ESMTP <filename>DSN</filename> extension.
5568 </para>
5569 </listitem></varlistentry>
5570 <varlistentry>
5571 <term><option>-MCP</option></term>
5572 <listitem>
5573 <para>
5574 <indexterm role="option">
5575 <primary><option>-MCP</option></primary>
5576 </indexterm>
5577 This option is not intended for use by external callers. It is used internally
5578 by Exim in conjunction with the <option>-MC</option> option. It signifies that the server to
5579 which Exim is connected supports pipelining.
5580 </para>
5581 </listitem></varlistentry>
5582 <varlistentry>
5583 <term><option>-MCQ</option>&nbsp;&lt;<emphasis>process&nbsp;id</emphasis>&gt;&nbsp;&lt;<emphasis>pipe&nbsp;fd</emphasis>&gt;</term>
5584 <listitem>
5585 <para>
5586 <indexterm role="option">
5587 <primary><option>-MCQ</option></primary>
5588 </indexterm>
5589 This option is not intended for use by external callers. It is used internally
5590 by Exim in conjunction with the <option>-MC</option> option when the original delivery was
5591 started by a queue runner. It passes on the process id of the queue runner,
5592 together with the file descriptor number of an open pipe. Closure of the pipe
5593 signals the final completion of the sequence of processes that are passing
5594 messages through the same SMTP connection.
5595 </para>
5596 </listitem></varlistentry>
5597 <varlistentry>
5598 <term><option>-MCS</option></term>
5599 <listitem>
5600 <para>
5601 <indexterm role="option">
5602 <primary><option>-MCS</option></primary>
5603 </indexterm>
5604 This option is not intended for use by external callers. It is used internally
5605 by Exim in conjunction with the <option>-MC</option> option, and passes on the fact that the
5606 SMTP SIZE option should be used on messages delivered down the existing
5607 connection.
5608 </para>
5609 </listitem></varlistentry>
5610 <varlistentry>
5611 <term><option>-MCT</option></term>
5612 <listitem>
5613 <para>
5614 <indexterm role="option">
5615 <primary><option>-MCT</option></primary>
5616 </indexterm>
5617 This option is not intended for use by external callers. It is used internally
5618 by Exim in conjunction with the <option>-MC</option> option, and passes on the fact that the
5619 host to which Exim is connected supports TLS encryption.
5620 </para>
5621 </listitem></varlistentry>
5622 <varlistentry>
5623 <term><option>-Mc</option>&nbsp;&lt;<emphasis>message&nbsp;id</emphasis>&gt;&nbsp;&lt;<emphasis>message&nbsp;id</emphasis>&gt;&nbsp;...</term>
5624 <listitem>
5625 <para>
5626 <indexterm role="option">
5627 <primary><option>-Mc</option></primary>
5628 </indexterm>
5629 <indexterm role="concept">
5630 <primary>hints database</primary>
5631 <secondary>not overridden by <option>-Mc</option></secondary>
5632 </indexterm>
5633 <indexterm role="concept">
5634 <primary>delivery</primary>
5635 <secondary>manually started &ndash; not forced</secondary>
5636 </indexterm>
5637 This option requests Exim to run a delivery attempt on each message in turn,
5638 but unlike the <option>-M</option> option, it does check for retry hints, and respects any
5639 that are found. This option is not very useful to external callers. It is
5640 provided mainly for internal use by Exim when it needs to re-invoke itself in
5641 order to regain root privilege for a delivery (see chapter <xref linkend="CHAPsecurity"/>).
5642 However, <option>-Mc</option> can be useful when testing, in order to run a delivery that
5643 respects retry times and other options such as <option>hold_domains</option> that are
5644 overridden when <option>-M</option> is used. Such a delivery does not count as a queue run.
5645 If you want to run a specific delivery as if in a queue run, you should use
5646 <option>-q</option> with a message id argument. A distinction between queue run deliveries
5647 and other deliveries is made in one or two places.
5648 </para>
5649 </listitem></varlistentry>
5650 <varlistentry>
5651 <term><option>-Mes</option>&nbsp;&lt;<emphasis>message&nbsp;id</emphasis>&gt;&nbsp;&lt;<emphasis>address</emphasis>&gt;</term>
5652 <listitem>
5653 <para>
5654 <indexterm role="option">
5655 <primary><option>-Mes</option></primary>
5656 </indexterm>
5657 <indexterm role="concept">
5658 <primary>message</primary>
5659 <secondary>changing sender</secondary>
5660 </indexterm>
5661 <indexterm role="concept">
5662 <primary>sender</primary>
5663 <secondary>changing</secondary>
5664 </indexterm>
5665 This option requests Exim to change the sender address in the message to the
5666 given address, which must be a fully qualified address or <quote>&lt;&gt;</quote> (<quote>es</quote> for
5667 <quote>edit sender</quote>). There must be exactly two arguments. The first argument must
5668 be a message id, and the second one an email address. However, if the message
5669 is active (in the middle of a delivery attempt), its status is not altered.
5670 This option can be used only by an admin user.
5671 </para>
5672 </listitem></varlistentry>
5673 <varlistentry>
5674 <term><option>-Mf</option>&nbsp;&lt;<emphasis>message&nbsp;id</emphasis>&gt;&nbsp;&lt;<emphasis>message&nbsp;id</emphasis>&gt;&nbsp;...</term>
5675 <listitem>
5676 <para>
5677 <indexterm role="option">
5678 <primary><option>-Mf</option></primary>
5679 </indexterm>
5680 <indexterm role="concept">
5681 <primary>freezing messages</primary>
5682 </indexterm>
5683 <indexterm role="concept">
5684 <primary>message</primary>
5685 <secondary>manually freezing</secondary>
5686 </indexterm>
5687 This option requests Exim to mark each listed message as <quote>frozen</quote>. This
5688 prevents any delivery attempts taking place until the message is <quote>thawed</quote>,
5689 either manually or as a result of the <option>auto_thaw</option> configuration option.
5690 However, if any of the messages are active (in the middle of a delivery
5691 attempt), their status is not altered. This option can be used only by an admin
5692 user.
5693 </para>
5694 </listitem></varlistentry>
5695 <varlistentry>
5696 <term><option>-Mg</option>&nbsp;&lt;<emphasis>message&nbsp;id</emphasis>&gt;&nbsp;&lt;<emphasis>message&nbsp;id</emphasis>&gt;&nbsp;...</term>
5697 <listitem>
5698 <para>
5699 <indexterm role="option">
5700 <primary><option>-Mg</option></primary>
5701 </indexterm>
5702 <indexterm role="concept">
5703 <primary>giving up on messages</primary>
5704 </indexterm>
5705 <indexterm role="concept">
5706 <primary>message</primary>
5707 <secondary>abandoning delivery attempts</secondary>
5708 </indexterm>
5709 <indexterm role="concept">
5710 <primary>delivery</primary>
5711 <secondary>abandoning further attempts</secondary>
5712 </indexterm>
5713 This option requests Exim to give up trying to deliver the listed messages,
5714 including any that are frozen. However, if any of the messages are active,
5715 their status is not altered. For non-bounce messages, a delivery error message
5716 is sent to the sender, containing the text <quote>cancelled by administrator</quote>.
5717 Bounce messages are just discarded. This option can be used only by an admin
5718 user.
5719 </para>
5720 </listitem></varlistentry>
5721 <varlistentry>
5722 <term><option>-Mmad</option>&nbsp;&lt;<emphasis>message&nbsp;id</emphasis>&gt;&nbsp;&lt;<emphasis>message&nbsp;id</emphasis>&gt;&nbsp;...</term>
5723 <listitem>
5724 <para>
5725 <indexterm role="option">
5726 <primary><option>-Mmad</option></primary>
5727 </indexterm>
5728 <indexterm role="concept">
5729 <primary>delivery</primary>
5730 <secondary>cancelling all</secondary>
5731 </indexterm>
5732 This option requests Exim to mark all the recipient addresses in the messages
5733 as already delivered (<quote>mad</quote> for <quote>mark all delivered</quote>). However, if any
5734 message is active (in the middle of a delivery attempt), its status is not
5735 altered. This option can be used only by an admin user.
5736 </para>
5737 </listitem></varlistentry>
5738 <varlistentry>
5739 <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>
5740 <listitem>
5741 <para>
5742 <indexterm role="option">
5743 <primary><option>-Mmd</option></primary>
5744 </indexterm>
5745 <indexterm role="concept">
5746 <primary>delivery</primary>
5747 <secondary>cancelling by address</secondary>
5748 </indexterm>
5749 <indexterm role="concept">
5750 <primary>recipient</primary>
5751 <secondary>removing</secondary>
5752 </indexterm>
5753 <indexterm role="concept">
5754 <primary>removing recipients</primary>
5755 </indexterm>
5756 This option requests Exim to mark the given addresses as already delivered
5757 (<quote>md</quote> for <quote>mark delivered</quote>). The first argument must be a message id, and
5758 the remaining ones must be email addresses. These are matched to recipient
5759 addresses in the message in a case-sensitive manner. If the message is active
5760 (in the middle of a delivery attempt), its status is not altered. This option
5761 can be used only by an admin user.
5762 </para>
5763 </listitem></varlistentry>
5764 <varlistentry>
5765 <term><option>-Mrm</option>&nbsp;&lt;<emphasis>message&nbsp;id</emphasis>&gt;&nbsp;&lt;<emphasis>message&nbsp;id</emphasis>&gt;&nbsp;...</term>
5766 <listitem>
5767 <para>
5768 <indexterm role="option">
5769 <primary><option>-Mrm</option></primary>
5770 </indexterm>
5771 <indexterm role="concept">
5772 <primary>removing messages</primary>
5773 </indexterm>
5774 <indexterm role="concept">
5775 <primary>abandoning mail</primary>
5776 </indexterm>
5777 <indexterm role="concept">
5778 <primary>message</primary>
5779 <secondary>manually discarding</secondary>
5780 </indexterm>
5781 This option requests Exim to remove the given messages from the queue. No
5782 bounce messages are sent; each message is simply forgotten. However, if any of
5783 the messages are active, their status is not altered. This option can be used
5784 only by an admin user or by the user who originally caused the message to be
5785 placed on the queue.
5786 </para>
5787 </listitem></varlistentry>
5788 <varlistentry>
5789 <term><option>-Mset</option>&nbsp;&lt;<emphasis>message&nbsp;id</emphasis>&gt;</term>
5790 <listitem>
5791 <para>
5792 <indexterm role="option">
5793 <primary><option>-Mset</option></primary>
5794 </indexterm>
5795 <indexterm role="concept">
5796 <primary>testing</primary>
5797 <secondary>string expansion</secondary>
5798 </indexterm>
5799 <indexterm role="concept">
5800 <primary>expansion</primary>
5801 <secondary>testing</secondary>
5802 </indexterm>
5803 This option is useful only in conjunction with <option>-be</option> (that is, when testing
5804 string expansions). Exim loads the given message from its spool before doing
5805 the test expansions, thus setting message-specific variables such as
5806 <varname>$message_size</varname> and the header variables. The <varname>$recipients</varname> variable is made
5807 available. This feature is provided to make it easier to test expansions that
5808 make use of these variables. However, this option can be used only by an admin
5809 user. See also <option>-bem</option>.
5810 </para>
5811 </listitem></varlistentry>
5812 <varlistentry>
5813 <term><option>-Mt</option>&nbsp;&lt;<emphasis>message&nbsp;id</emphasis>&gt;&nbsp;&lt;<emphasis>message&nbsp;id</emphasis>&gt;&nbsp;...</term>
5814 <listitem>
5815 <para>
5816 <indexterm role="option">
5817 <primary><option>-Mt</option></primary>
5818 </indexterm>
5819 <indexterm role="concept">
5820 <primary>thawing messages</primary>
5821 </indexterm>
5822 <indexterm role="concept">
5823 <primary>unfreezing messages</primary>
5824 </indexterm>
5825 <indexterm role="concept">
5826 <primary>frozen messages</primary>
5827 <secondary>thawing</secondary>
5828 </indexterm>
5829 <indexterm role="concept">
5830 <primary>message</primary>
5831 <secondary>thawing frozen</secondary>
5832 </indexterm>
5833 This option requests Exim to <quote>thaw</quote> any of the listed messages that are
5834 <quote>frozen</quote>, so that delivery attempts can resume. However, if any of the
5835 messages are active, their status is not altered. This option can be used only
5836 by an admin user.
5837 </para>
5838 </listitem></varlistentry>
5839 <varlistentry>
5840 <term><option>-Mvb</option>&nbsp;&lt;<emphasis>message&nbsp;id</emphasis>&gt;</term>
5841 <listitem>
5842 <para>
5843 <indexterm role="option">
5844 <primary><option>-Mvb</option></primary>
5845 </indexterm>
5846 <indexterm role="concept">
5847 <primary>listing</primary>
5848 <secondary>message body</secondary>
5849 </indexterm>
5850 <indexterm role="concept">
5851 <primary>message</primary>
5852 <secondary>listing body of</secondary>
5853 </indexterm>
5854 This option causes the contents of the message body (-D) spool file to be
5855 written to the standard output. This option can be used only by an admin user.
5856 </para>
5857 </listitem></varlistentry>
5858 <varlistentry>
5859 <term><option>-Mvc</option>&nbsp;&lt;<emphasis>message&nbsp;id</emphasis>&gt;</term>
5860 <listitem>
5861 <para>
5862 <indexterm role="option">
5863 <primary><option>-Mvc</option></primary>
5864 </indexterm>
5865 <indexterm role="concept">
5866 <primary>message</primary>
5867 <secondary>listing in RFC 2822 format</secondary>
5868 </indexterm>
5869 <indexterm role="concept">
5870 <primary>listing</primary>
5871 <secondary>message in RFC 2822 format</secondary>
5872 </indexterm>
5873 This option causes a copy of the complete message (header lines plus body) to
5874 be written to the standard output in RFC 2822 format. This option can be used
5875 only by an admin user.
5876 </para>
5877 </listitem></varlistentry>
5878 <varlistentry>
5879 <term><option>-Mvh</option>&nbsp;&lt;<emphasis>message&nbsp;id</emphasis>&gt;</term>
5880 <listitem>
5881 <para>
5882 <indexterm role="option">
5883 <primary><option>-Mvh</option></primary>
5884 </indexterm>
5885 <indexterm role="concept">
5886 <primary>listing</primary>
5887 <secondary>message headers</secondary>
5888 </indexterm>
5889 <indexterm role="concept">
5890 <primary>header lines</primary>
5891 <secondary>listing</secondary>
5892 </indexterm>
5893 <indexterm role="concept">
5894 <primary>message</primary>
5895 <secondary>listing header lines</secondary>
5896 </indexterm>
5897 This option causes the contents of the message headers (-H) spool file to be
5898 written to the standard output. This option can be used only by an admin user.
5899 </para>
5900 </listitem></varlistentry>
5901 <varlistentry>
5902 <term><option>-Mvl</option>&nbsp;&lt;<emphasis>message&nbsp;id</emphasis>&gt;</term>
5903 <listitem>
5904 <para>
5905 <indexterm role="option">
5906 <primary><option>-Mvl</option></primary>
5907 </indexterm>
5908 <indexterm role="concept">
5909 <primary>listing</primary>
5910 <secondary>message log</secondary>
5911 </indexterm>
5912 <indexterm role="concept">
5913 <primary>message</primary>
5914 <secondary>listing message log</secondary>
5915 </indexterm>
5916 This option causes the contents of the message log spool file to be written to
5917 the standard output. This option can be used only by an admin user.
5918 </para>
5919 </listitem></varlistentry>
5920 <varlistentry>
5921 <term><option>-m</option></term>
5922 <listitem>
5923 <para>
5924 <indexterm role="option">
5925 <primary><option>-m</option></primary>
5926 </indexterm>
5927 This is apparently a synonym for <option>-om</option> that is accepted by Sendmail, so Exim
5928 treats it that way too.
5929 </para>
5930 </listitem></varlistentry>
5931 <varlistentry>
5932 <term><option>-N</option></term>
5933 <listitem>
5934 <para>
5935 <indexterm role="option">
5936 <primary><option>-N</option></primary>
5937 </indexterm>
5938 <indexterm role="concept">
5939 <primary>debugging</primary>
5940 <secondary><option>-N</option> option</secondary>
5941 </indexterm>
5942 <indexterm role="concept">
5943 <primary>debugging</primary>
5944 <secondary>suppressing delivery</secondary>
5945 </indexterm>
5946 This is a debugging option that inhibits delivery of a message at the transport
5947 level. It implies <option>-v</option>. Exim goes through many of the motions of delivery &ndash;
5948 it just doesn&#x2019;t actually transport the message, but instead behaves as if it
5949 had successfully done so. However, it does not make any updates to the retry
5950 database, and the log entries for deliveries are flagged with <quote>*&gt;</quote> rather
5951 than <quote>=&gt;</quote>.
5952 </para>
5953 <para>
5954 Because <option>-N</option> discards any message to which it applies, only root or the Exim
5955 user are allowed to use it with <option>-bd</option>, <option>-q</option>, <option>-R</option> or <option>-M</option>. In other
5956 words, an ordinary user can use it only when supplying an incoming message to
5957 which it will apply. Although transportation never fails when <option>-N</option> is set, an
5958 address may be deferred because of a configuration problem on a transport, or a
5959 routing problem. Once <option>-N</option> has been used for a delivery attempt, it sticks to
5960 the message, and applies to any subsequent delivery attempts that may happen
5961 for that message.
5962 </para>
5963 </listitem></varlistentry>
5964 <varlistentry>
5965 <term><option>-n</option></term>
5966 <listitem>
5967 <para>
5968 <indexterm role="option">
5969 <primary><option>-n</option></primary>
5970 </indexterm>
5971 This option is interpreted by Sendmail to mean <quote>no aliasing</quote>.
5972 For normal modes of operation, it is ignored by Exim.
5973 When combined with <option>-bP</option> it suppresses the name of an option from being output.
5974 </para>
5975 </listitem></varlistentry>
5976 <varlistentry>
5977 <term><option>-O</option>&nbsp;&lt;<emphasis>data</emphasis>&gt;</term>
5978 <listitem>
5979 <para>
5980 <indexterm role="option">
5981 <primary><option>-O</option></primary>
5982 </indexterm>
5983 This option is interpreted by Sendmail to mean <literal>set option</literal>. It is ignored by
5984 Exim.
5985 </para>
5986 </listitem></varlistentry>
5987 <varlistentry>
5988 <term><option>-oA</option>&nbsp;&lt;<emphasis>file&nbsp;name</emphasis>&gt;</term>
5989 <listitem>
5990 <para>
5991 <indexterm role="option">
5992 <primary><option>-oA</option></primary>
5993 </indexterm>
5994 <indexterm role="concept">
5995 <primary>Sendmail compatibility</primary>
5996 <secondary><option>-oA</option> option</secondary>
5997 </indexterm>
5998 This option is used by Sendmail in conjunction with <option>-bi</option> to specify an
5999 alternative alias file name. Exim handles <option>-bi</option> differently; see the
6000 description above.
6001 </para>
6002 </listitem></varlistentry>
6003 <varlistentry>
6004 <term><option>-oB</option>&nbsp;&lt;<emphasis>n</emphasis>&gt;</term>
6005 <listitem>
6006 <para>
6007 <indexterm role="option">
6008 <primary><option>-oB</option></primary>
6009 </indexterm>
6010 <indexterm role="concept">
6011 <primary>SMTP</primary>
6012 <secondary>passed connection</secondary>
6013 </indexterm>
6014 <indexterm role="concept">
6015 <primary>SMTP</primary>
6016 <secondary>multiple deliveries</secondary>
6017 </indexterm>
6018 <indexterm role="concept">
6019 <primary>multiple SMTP deliveries</primary>
6020 </indexterm>
6021 This is a debugging option which limits the maximum number of messages that can
6022 be delivered down one SMTP connection, overriding the value set in any <command>smtp</command>
6023 transport. If &lt;<emphasis>n</emphasis>&gt; is omitted, the limit is set to 1.
6024 </para>
6025 </listitem></varlistentry>
6026 <varlistentry>
6027 <term><option>-odb</option></term>
6028 <listitem>
6029 <para>
6030 <indexterm role="option">
6031 <primary><option>-odb</option></primary>
6032 </indexterm>
6033 <indexterm role="concept">
6034 <primary>background delivery</primary>
6035 </indexterm>
6036 <indexterm role="concept">
6037 <primary>delivery</primary>
6038 <secondary>in the background</secondary>
6039 </indexterm>
6040 This option applies to all modes in which Exim accepts incoming messages,
6041 including the listening daemon. It requests <quote>background</quote> delivery of such
6042 messages, which means that the accepting process automatically starts a
6043 delivery process for each message received, but does not wait for the delivery
6044 processes to finish.
6045 </para>
6046 <para>
6047 When all the messages have been received, the reception process exits,
6048 leaving the delivery processes to finish in their own time. The standard output
6049 and error streams are closed at the start of each delivery process.
6050 This is the default action if none of the <option>-od</option> options are present.
6051 </para>
6052 <para>
6053 If one of the queueing options in the configuration file
6054 (<option>queue_only</option> or <option>queue_only_file</option>, for example) is in effect, <option>-odb</option>
6055 overrides it if <option>queue_only_override</option> is set true, which is the default
6056 setting. If <option>queue_only_override</option> is set false, <option>-odb</option> has no effect.
6057 </para>
6058 </listitem></varlistentry>
6059 <varlistentry>
6060 <term><option>-odf</option></term>
6061 <listitem>
6062 <para>
6063 <indexterm role="option">
6064 <primary><option>-odf</option></primary>
6065 </indexterm>
6066 <indexterm role="concept">
6067 <primary>foreground delivery</primary>
6068 </indexterm>
6069 <indexterm role="concept">
6070 <primary>delivery</primary>
6071 <secondary>in the foreground</secondary>
6072 </indexterm>
6073 This option requests <quote>foreground</quote> (synchronous) delivery when Exim has
6074 accepted a locally-generated message. (For the daemon it is exactly the same as
6075 <option>-odb</option>.) A delivery process is automatically started to deliver the message,
6076 and Exim waits for it to complete before proceeding.
6077 </para>
6078 <para>
6079 The original Exim reception process does not finish until the delivery
6080 process for the final message has ended. The standard error stream is left open
6081 during deliveries.
6082 </para>
6083 <para>
6084 However, like <option>-odb</option>, this option has no effect if <option>queue_only_override</option> is
6085 false and one of the queueing options in the configuration file is in effect.
6086 </para>
6087 <para>
6088 If there is a temporary delivery error during foreground delivery, the
6089 message is left on the queue for later delivery, and the original reception
6090 process exits. See chapter <xref linkend="CHAPnonqueueing"/> for a way of setting up a
6091 restricted configuration that never queues messages.
6092 </para>
6093 </listitem></varlistentry>
6094 <varlistentry>
6095 <term><option>-odi</option></term>
6096 <listitem>
6097 <para>
6098 <indexterm role="option">
6099 <primary><option>-odi</option></primary>
6100 </indexterm>
6101 This option is synonymous with <option>-odf</option>. It is provided for compatibility with
6102 Sendmail.
6103 </para>
6104 </listitem></varlistentry>
6105 <varlistentry>
6106 <term><option>-odq</option></term>
6107 <listitem>
6108 <para>
6109 <indexterm role="option">
6110 <primary><option>-odq</option></primary>
6111 </indexterm>
6112 <indexterm role="concept">
6113 <primary>non-immediate delivery</primary>
6114 </indexterm>
6115 <indexterm role="concept">
6116 <primary>delivery</primary>
6117 <secondary>suppressing immediate</secondary>
6118 </indexterm>
6119 <indexterm role="concept">
6120 <primary>queueing incoming messages</primary>
6121 </indexterm>
6122 This option applies to all modes in which Exim accepts incoming messages,
6123 including the listening daemon. It specifies that the accepting process should
6124 not automatically start a delivery process for each message received. Messages
6125 are placed on the queue, and remain there until a subsequent queue runner
6126 process encounters them. There are several configuration options (such as
6127 <option>queue_only</option>) that can be used to queue incoming messages under certain
6128 conditions. This option overrides all of them and also <option>-odqs</option>. It always
6129 forces queueing.
6130 </para>
6131 </listitem></varlistentry>
6132 <varlistentry>
6133 <term><option>-odqs</option></term>
6134 <listitem>
6135 <para>
6136 <indexterm role="option">
6137 <primary><option>-odqs</option></primary>
6138 </indexterm>
6139 <indexterm role="concept">
6140 <primary>SMTP</primary>
6141 <secondary>delaying delivery</secondary>
6142 </indexterm>
6143 This option is a hybrid between <option>-odb</option>/<option>-odi</option> and <option>-odq</option>.
6144 However, like <option>-odb</option> and <option>-odi</option>, this option has no effect if
6145 <option>queue_only_override</option> is false and one of the queueing options in the
6146 configuration file is in effect.
6147 </para>
6148 <para>
6149 When <option>-odqs</option> does operate, a delivery process is started for each incoming
6150 message, in the background by default, but in the foreground if <option>-odi</option> is
6151 also present. The recipient addresses are routed, and local deliveries are done
6152 in the normal way. However, if any SMTP deliveries are required, they are not
6153 done at this time, so the message remains on the queue until a subsequent queue
6154 runner process encounters it. Because routing was done, Exim knows which
6155 messages are waiting for which hosts, and so a number of messages for the same
6156 host can be sent in a single SMTP connection. The <option>queue_smtp_domains</option>
6157 configuration option has the same effect for specific domains. See also the
6158 <option>-qq</option> option.
6159 </para>
6160 </listitem></varlistentry>
6161 <varlistentry>
6162 <term><option>-oee</option></term>
6163 <listitem>
6164 <para>
6165 <indexterm role="option">
6166 <primary><option>-oee</option></primary>
6167 </indexterm>
6168 <indexterm role="concept">
6169 <primary>error</primary>
6170 <secondary>reporting</secondary>
6171 </indexterm>
6172 If an error is detected while a non-SMTP message is being received (for
6173 example, a malformed address), the error is reported to the sender in a mail
6174 message.
6175 </para>
6176 <para>
6177 <indexterm role="concept">
6178 <primary>return code</primary>
6179 <secondary>for <option>-oee</option></secondary>
6180 </indexterm>
6181 Provided
6182 this error message is successfully sent, the Exim receiving process
6183 exits with a return code of zero. If not, the return code is 2 if the problem
6184 is that the original message has no recipients, or 1 for any other error.
6185 This is the default <option>-oe</option><emphasis>x</emphasis> option if Exim is called as <emphasis>rmail</emphasis>.
6186 </para>
6187 </listitem></varlistentry>
6188 <varlistentry>
6189 <term><option>-oem</option></term>
6190 <listitem>
6191 <para>
6192 <indexterm role="option">
6193 <primary><option>-oem</option></primary>
6194 </indexterm>
6195 <indexterm role="concept">
6196 <primary>error</primary>
6197 <secondary>reporting</secondary>
6198 </indexterm>
6199 <indexterm role="concept">
6200 <primary>return code</primary>
6201 <secondary>for <option>-oem</option></secondary>
6202 </indexterm>
6203 This is the same as <option>-oee</option>, except that Exim always exits with a non-zero
6204 return code, whether or not the error message was successfully sent.
6205 This is the default <option>-oe</option><emphasis>x</emphasis> option, unless Exim is called as <emphasis>rmail</emphasis>.
6206 </para>
6207 </listitem></varlistentry>
6208 <varlistentry>
6209 <term><option>-oep</option></term>
6210 <listitem>
6211 <para>
6212 <indexterm role="option">
6213 <primary><option>-oep</option></primary>
6214 </indexterm>
6215 <indexterm role="concept">
6216 <primary>error</primary>
6217 <secondary>reporting</secondary>
6218 </indexterm>
6219 If an error is detected while a non-SMTP message is being received, the
6220 error is reported by writing a message to the standard error file (stderr).
6221 <indexterm role="concept">
6222 <primary>return code</primary>
6223 <secondary>for <option>-oep</option></secondary>
6224 </indexterm>
6225 The return code is 1 for all errors.
6226 </para>
6227 </listitem></varlistentry>
6228 <varlistentry>
6229 <term><option>-oeq</option></term>
6230 <listitem>
6231 <para>
6232 <indexterm role="option">
6233 <primary><option>-oeq</option></primary>
6234 </indexterm>
6235 <indexterm role="concept">
6236 <primary>error</primary>
6237 <secondary>reporting</secondary>
6238 </indexterm>
6239 This option is supported for compatibility with Sendmail, but has the same
6240 effect as <option>-oep</option>.
6241 </para>
6242 </listitem></varlistentry>
6243 <varlistentry>
6244 <term><option>-oew</option></term>
6245 <listitem>
6246 <para>
6247 <indexterm role="option">
6248 <primary><option>-oew</option></primary>
6249 </indexterm>
6250 <indexterm role="concept">
6251 <primary>error</primary>
6252 <secondary>reporting</secondary>
6253 </indexterm>
6254 This option is supported for compatibility with Sendmail, but has the same
6255 effect as <option>-oem</option>.
6256 </para>
6257 </listitem></varlistentry>
6258 <varlistentry>
6259 <term><option>-oi</option></term>
6260 <listitem>
6261 <para>
6262 <indexterm role="option">
6263 <primary><option>-oi</option></primary>
6264 </indexterm>
6265 <indexterm role="concept">
6266 <primary>dot</primary>
6267 <secondary>in incoming non-SMTP message</secondary>
6268 </indexterm>
6269 This option, which has the same effect as <option>-i</option>, specifies that a dot on a
6270 line by itself should not terminate an incoming, non-SMTP message. Otherwise, a
6271 single dot does terminate, though Exim does no special processing for other
6272 lines that start with a dot. This option is set by default if Exim is called as
6273 <emphasis>rmail</emphasis>. See also <option>-ti</option>.
6274 </para>
6275 </listitem></varlistentry>
6276 <varlistentry>
6277 <term><option>-oitrue</option></term>
6278 <listitem>
6279 <para>
6280 <indexterm role="option">
6281 <primary><option>-oitrue</option></primary>
6282 </indexterm>
6283 This option is treated as synonymous with <option>-oi</option>.
6284 </para>
6285 </listitem></varlistentry>
6286 <varlistentry>
6287 <term><option>-oMa</option>&nbsp;&lt;<emphasis>host&nbsp;address</emphasis>&gt;</term>
6288 <listitem>
6289 <para>
6290 <indexterm role="option">
6291 <primary><option>-oMa</option></primary>
6292 </indexterm>
6293 <indexterm role="concept">
6294 <primary>sender</primary>
6295 <secondary>host address, specifying for local message</secondary>
6296 </indexterm>
6297 A number of options starting with <option>-oM</option> can be used to set values associated
6298 with remote hosts on locally-submitted messages (that is, messages not received
6299 over TCP/IP). These options can be used by any caller in conjunction with the
6300 <option>-bh</option>, <option>-be</option>, <option>-bf</option>, <option>-bF</option>, <option>-bt</option>, or <option>-bv</option> testing options. In
6301 other circumstances, they are ignored unless the caller is trusted.
6302 </para>
6303 <para>
6304 The <option>-oMa</option> option sets the sender host address. This may include a port
6305 number at the end, after a full stop (period). For example:
6306 </para>
6307 <literallayout class="monospaced">
6308 exim -bs -oMa 10.9.8.7.1234
6309 </literallayout>
6310 <para>
6311 An alternative syntax is to enclose the IP address in square brackets,
6312 followed by a colon and the port number:
6313 </para>
6314 <literallayout class="monospaced">
6315 exim -bs -oMa [10.9.8.7]:1234
6316 </literallayout>
6317 <para>
6318 The IP address is placed in the <varname>$sender_host_address</varname> variable, and the
6319 port, if present, in <varname>$sender_host_port</varname>. If both <option>-oMa</option> and <option>-bh</option>
6320 are present on the command line, the sender host IP address is taken from
6321 whichever one is last.
6322 </para>
6323 </listitem></varlistentry>
6324 <varlistentry>
6325 <term><option>-oMaa</option>&nbsp;&lt;<emphasis>name</emphasis>&gt;</term>
6326 <listitem>
6327 <para>
6328 <indexterm role="option">
6329 <primary><option>-oMaa</option></primary>
6330 </indexterm>
6331 <indexterm role="concept">
6332 <primary>authentication</primary>
6333 <secondary>name, specifying for local message</secondary>
6334 </indexterm>
6335 See <option>-oMa</option> above for general remarks about the <option>-oM</option> options. The <option>-oMaa</option>
6336 option sets the value of <varname>$sender_host_authenticated</varname> (the authenticator
6337 name). See chapter <xref linkend="CHAPSMTPAUTH"/> for a discussion of SMTP authentication.
6338 This option can be used with <option>-bh</option> and <option>-bs</option> to set up an
6339 authenticated SMTP session without actually using the SMTP AUTH command.
6340 </para>
6341 </listitem></varlistentry>
6342 <varlistentry>
6343 <term><option>-oMai</option>&nbsp;&lt;<emphasis>string</emphasis>&gt;</term>
6344 <listitem>
6345 <para>
6346 <indexterm role="option">
6347 <primary><option>-oMai</option></primary>
6348 </indexterm>
6349 <indexterm role="concept">
6350 <primary>authentication</primary>
6351 <secondary>id, specifying for local message</secondary>
6352 </indexterm>
6353 See <option>-oMa</option> above for general remarks about the <option>-oM</option> options. The <option>-oMai</option>
6354 option sets the value of <varname>$authenticated_id</varname> (the id that was authenticated).
6355 This overrides the default value (the caller&#x2019;s login id, except with <option>-bh</option>,
6356 where there is no default) for messages from local sources. See chapter
6357 <xref linkend="CHAPSMTPAUTH"/> for a discussion of authenticated ids.
6358 </para>
6359 </listitem></varlistentry>
6360 <varlistentry>
6361 <term><option>-oMas</option>&nbsp;&lt;<emphasis>address</emphasis>&gt;</term>
6362 <listitem>
6363 <para>
6364 <indexterm role="option">
6365 <primary><option>-oMas</option></primary>
6366 </indexterm>
6367 <indexterm role="concept">
6368 <primary>authentication</primary>
6369 <secondary>sender, specifying for local message</secondary>
6370 </indexterm>
6371 See <option>-oMa</option> above for general remarks about the <option>-oM</option> options. The <option>-oMas</option>
6372 option sets the authenticated sender value in <varname>$authenticated_sender</varname>. It
6373 overrides the sender address that is created from the caller&#x2019;s login id for
6374 messages from local sources, except when <option>-bh</option> is used, when there is no
6375 default. For both <option>-bh</option> and <option>-bs</option>, an authenticated sender that is
6376 specified on a MAIL command overrides this value. See chapter
6377 <xref linkend="CHAPSMTPAUTH"/> for a discussion of authenticated senders.
6378 </para>
6379 </listitem></varlistentry>
6380 <varlistentry>
6381 <term><option>-oMi</option>&nbsp;&lt;<emphasis>interface&nbsp;address</emphasis>&gt;</term>
6382 <listitem>
6383 <para>
6384 <indexterm role="option">
6385 <primary><option>-oMi</option></primary>
6386 </indexterm>
6387 <indexterm role="concept">
6388 <primary>interface</primary>
6389 <secondary>address, specifying for local message</secondary>
6390 </indexterm>
6391 See <option>-oMa</option> above for general remarks about the <option>-oM</option> options. The <option>-oMi</option>
6392 option sets the IP interface address value. A port number may be included,
6393 using the same syntax as for <option>-oMa</option>. The interface address is placed in
6394 <varname>$received_ip_address</varname> and the port number, if present, in <varname>$received_port</varname>.
6395 </para>
6396 </listitem></varlistentry>
6397 <varlistentry>
6398 <term><option>-oMm</option>&nbsp;&lt;<emphasis>message&nbsp;reference</emphasis>&gt;</term>
6399 <listitem>
6400 <para>
6401 <indexterm role="option">
6402 <primary><option>-oMm</option></primary>
6403 </indexterm>
6404 <indexterm role="concept">
6405 <primary>message reference</primary>
6406 <secondary>message reference, specifying for local message</secondary>
6407 </indexterm>
6408 See <option>-oMa</option> above for general remarks about the <option>-oM</option> options. The <option>-oMm</option>
6409 option sets the message reference, e.g. message-id, and is logged during
6410 delivery. This is useful when some kind of audit trail is required to tie
6411 messages together. The format of the message reference is checked and will
6412 abort if the format is invalid. The option will only be accepted if exim is
6413 running in trusted mode, not as any regular user.
6414 </para>
6415 <para>
6416 The best example of a message reference is when Exim sends a bounce message.
6417 The message reference is the message-id of the original message for which Exim
6418 is sending the bounce.
6419 </para>
6420 </listitem></varlistentry>
6421 <varlistentry>
6422 <term><option>-oMr</option>&nbsp;&lt;<emphasis>protocol&nbsp;name</emphasis>&gt;</term>
6423 <listitem>
6424 <para>
6425 <indexterm role="option">
6426 <primary><option>-oMr</option></primary>
6427 </indexterm>
6428 <indexterm role="concept">
6429 <primary>protocol, specifying for local message</primary>
6430 </indexterm>
6431 <indexterm role="variable">
6432 <primary><varname>$received_protocol</varname></primary>
6433 </indexterm>
6434 See <option>-oMa</option> above for general remarks about the <option>-oM</option> options. The <option>-oMr</option>
6435 option sets the received protocol value that is stored in
6436 <varname>$received_protocol</varname>. However, it does not apply (and is ignored) when <option>-bh</option>
6437 or <option>-bs</option> is used. For <option>-bh</option>, the protocol is forced to one of the standard
6438 SMTP protocol names (see the description of <varname>$received_protocol</varname> in section
6439 <xref linkend="SECTexpvar"/>). For <option>-bs</option>, the protocol is always <quote>local-</quote> followed by
6440 one of those same names. For <option>-bS</option> (batched SMTP) however, the protocol can
6441 be set by <option>-oMr</option>.
6442 </para>
6443 </listitem></varlistentry>
6444 <varlistentry>
6445 <term><option>-oMs</option>&nbsp;&lt;<emphasis>host&nbsp;name</emphasis>&gt;</term>
6446 <listitem>
6447 <para>
6448 <indexterm role="option">
6449 <primary><option>-oMs</option></primary>
6450 </indexterm>
6451 <indexterm role="concept">
6452 <primary>sender</primary>
6453 <secondary>host name, specifying for local message</secondary>
6454 </indexterm>
6455 See <option>-oMa</option> above for general remarks about the <option>-oM</option> options. The <option>-oMs</option>
6456 option sets the sender host name in <varname>$sender_host_name</varname>. When this option is
6457 present, Exim does not attempt to look up a host name from an IP address; it
6458 uses the name it is given.
6459 </para>
6460 </listitem></varlistentry>
6461 <varlistentry>
6462 <term><option>-oMt</option>&nbsp;&lt;<emphasis>ident&nbsp;string</emphasis>&gt;</term>
6463 <listitem>
6464 <para>
6465 <indexterm role="option">
6466 <primary><option>-oMt</option></primary>
6467 </indexterm>
6468 <indexterm role="concept">
6469 <primary>sender</primary>
6470 <secondary>ident string, specifying for local message</secondary>
6471 </indexterm>
6472 See <option>-oMa</option> above for general remarks about the <option>-oM</option> options. The <option>-oMt</option>
6473 option sets the sender ident value in <varname>$sender_ident</varname>. The default setting for
6474 local callers is the login id of the calling process, except when <option>-bh</option> is
6475 used, when there is no default.
6476 </para>
6477 </listitem></varlistentry>
6478 <varlistentry>
6479 <term><option>-om</option></term>
6480 <listitem>
6481 <para>
6482 <indexterm role="option">
6483 <primary><option>-om</option></primary>
6484 </indexterm>
6485 <indexterm role="concept">
6486 <primary>Sendmail compatibility</primary>
6487 <secondary><option>-om</option> option ignored</secondary>
6488 </indexterm>
6489 In Sendmail, this option means <quote>me too</quote>, indicating that the sender of a
6490 message should receive a copy of the message if the sender appears in an alias
6491 expansion. Exim always does this, so the option does nothing.
6492 </para>
6493 </listitem></varlistentry>
6494 <varlistentry>
6495 <term><option>-oo</option></term>
6496 <listitem>
6497 <para>
6498 <indexterm role="option">
6499 <primary><option>-oo</option></primary>
6500 </indexterm>
6501 <indexterm role="concept">
6502 <primary>Sendmail compatibility</primary>
6503 <secondary><option>-oo</option> option ignored</secondary>
6504 </indexterm>
6505 This option is ignored. In Sendmail it specifies <quote>old style headers</quote>,
6506 whatever that means.
6507 </para>
6508 </listitem></varlistentry>
6509 <varlistentry>
6510 <term><option>-oP</option>&nbsp;&lt;<emphasis>path</emphasis>&gt;</term>
6511 <listitem>
6512 <para>
6513 <indexterm role="option">
6514 <primary><option>-oP</option></primary>
6515 </indexterm>
6516 <indexterm role="concept">
6517 <primary>pid (process id)</primary>
6518 <secondary>of daemon</secondary>
6519 </indexterm>
6520 <indexterm role="concept">
6521 <primary>daemon</primary>
6522 <secondary>process id (pid)</secondary>
6523 </indexterm>
6524 This option is useful only in conjunction with <option>-bd</option> or <option>-q</option> with a time
6525 value. The option specifies the file to which the process id of the daemon is
6526 written. When <option>-oX</option> is used with <option>-bd</option>, or when <option>-q</option> with a time is used
6527 without <option>-bd</option>, this is the only way of causing Exim to write a pid file,
6528 because in those cases, the normal pid file is not used.
6529 </para>
6530 </listitem></varlistentry>
6531 <varlistentry>
6532 <term><option>-or</option>&nbsp;&lt;<emphasis>time</emphasis>&gt;</term>
6533 <listitem>
6534 <para>
6535 <indexterm role="option">
6536 <primary><option>-or</option></primary>
6537 </indexterm>
6538 <indexterm role="concept">
6539 <primary>timeout</primary>
6540 <secondary>for non-SMTP input</secondary>
6541 </indexterm>
6542 This option sets a timeout value for incoming non-SMTP messages. If it is not
6543 set, Exim will wait forever for the standard input. The value can also be set
6544 by the <option>receive_timeout</option> option. The format used for specifying times is
6545 described in section <xref linkend="SECTtimeformat"/>.
6546 </para>
6547 </listitem></varlistentry>
6548 <varlistentry>
6549 <term><option>-os</option>&nbsp;&lt;<emphasis>time</emphasis>&gt;</term>
6550 <listitem>
6551 <para>
6552 <indexterm role="option">
6553 <primary><option>-os</option></primary>
6554 </indexterm>
6555 <indexterm role="concept">
6556 <primary>timeout</primary>
6557 <secondary>for SMTP input</secondary>
6558 </indexterm>
6559 <indexterm role="concept">
6560 <primary>SMTP</primary>
6561 <secondary>input timeout</secondary>
6562 </indexterm>
6563 This option sets a timeout value for incoming SMTP messages. The timeout
6564 applies to each SMTP command and block of data. The value can also be set by
6565 the <option>smtp_receive_timeout</option> option; it defaults to 5 minutes. The format used
6566 for specifying times is described in section <xref linkend="SECTtimeformat"/>.
6567 </para>
6568 </listitem></varlistentry>
6569 <varlistentry>
6570 <term><option>-ov</option></term>
6571 <listitem>
6572 <para>
6573 <indexterm role="option">
6574 <primary><option>-ov</option></primary>
6575 </indexterm>
6576 This option has exactly the same effect as <option>-v</option>.
6577 </para>
6578 </listitem></varlistentry>
6579 <varlistentry>
6580 <term><option>-oX</option>&nbsp;&lt;<emphasis>number&nbsp;or&nbsp;string</emphasis>&gt;</term>
6581 <listitem>
6582 <para>
6583 <indexterm role="option">
6584 <primary><option>-oX</option></primary>
6585 </indexterm>
6586 <indexterm role="concept">
6587 <primary>TCP/IP</primary>
6588 <secondary>setting listening ports</secondary>
6589 </indexterm>
6590 <indexterm role="concept">
6591 <primary>TCP/IP</primary>
6592 <secondary>setting listening interfaces</secondary>
6593 </indexterm>
6594 <indexterm role="concept">
6595 <primary>port</primary>
6596 <secondary>receiving TCP/IP</secondary>
6597 </indexterm>
6598 This option is relevant only when the <option>-bd</option> (start listening daemon) option
6599 is also given. It controls which ports and interfaces the daemon uses. Details
6600 of the syntax, and how it interacts with configuration file options, are given
6601 in chapter <xref linkend="CHAPinterfaces"/>. When <option>-oX</option> is used to start a daemon, no pid
6602 file is written unless <option>-oP</option> is also present to specify a pid file name.
6603 </para>
6604 </listitem></varlistentry>
6605 <varlistentry>
6606 <term><option>-pd</option></term>
6607 <listitem>
6608 <para>
6609 <indexterm role="option">
6610 <primary><option>-pd</option></primary>
6611 </indexterm>
6612 <indexterm role="concept">
6613 <primary>Perl</primary>
6614 <secondary>starting the interpreter</secondary>
6615 </indexterm>
6616 This option applies when an embedded Perl interpreter is linked with Exim (see
6617 chapter <xref linkend="CHAPperl"/>). It overrides the setting of the <option>perl_at_start</option>
6618 option, forcing the starting of the interpreter to be delayed until it is
6619 needed.
6620 </para>
6621 </listitem></varlistentry>
6622 <varlistentry>
6623 <term><option>-ps</option></term>
6624 <listitem>
6625 <para>
6626 <indexterm role="option">
6627 <primary><option>-ps</option></primary>
6628 </indexterm>
6629 <indexterm role="concept">
6630 <primary>Perl</primary>
6631 <secondary>starting the interpreter</secondary>
6632 </indexterm>
6633 This option applies when an embedded Perl interpreter is linked with Exim (see
6634 chapter <xref linkend="CHAPperl"/>). It overrides the setting of the <option>perl_at_start</option>
6635 option, forcing the starting of the interpreter to occur as soon as Exim is
6636 started.
6637 </para>
6638 </listitem></varlistentry>
6639 <varlistentry>
6640 <term><option>-p</option>&lt;<emphasis>rval</emphasis>&gt;:&lt;<emphasis>sval</emphasis>&gt;</term>
6641 <listitem>
6642 <para>
6643 <indexterm role="option">
6644 <primary><option>-p</option></primary>
6645 </indexterm>
6646 For compatibility with Sendmail, this option is equivalent to
6647 </para>
6648 <literallayout>
6649 <literal>-oMr</literal> &lt;<emphasis>rval</emphasis>&gt; <literal>-oMs</literal> &lt;<emphasis>sval</emphasis>&gt;
6650 </literallayout>
6651 <para>
6652 It sets the incoming protocol and host name (for trusted callers). The
6653 host name and its colon can be omitted when only the protocol is to be set.
6654 Note the Exim already has two private options, <option>-pd</option> and <option>-ps</option>, that refer
6655 to embedded Perl. It is therefore impossible to set a protocol value of <literal>d</literal>
6656 or <literal>s</literal> using this option (but that does not seem a real limitation).
6657 </para>
6658 </listitem></varlistentry>
6659 <varlistentry>
6660 <term><option>-q</option></term>
6661 <listitem>
6662 <para>
6663 <indexterm role="option">
6664 <primary><option>-q</option></primary>
6665 </indexterm>
6666 <indexterm role="concept">
6667 <primary>queue runner</primary>
6668 <secondary>starting manually</secondary>
6669 </indexterm>
6670 This option is normally restricted to admin users. However, there is a
6671 configuration option called <option>prod_requires_admin</option> which can be set false to
6672 relax this restriction (and also the same requirement for the <option>-M</option>, <option>-R</option>,
6673 and <option>-S</option> options).
6674 </para>
6675 <para>
6676 <indexterm role="concept">
6677 <primary>queue runner</primary>
6678 <secondary>description of operation</secondary>
6679 </indexterm>
6680 The <option>-q</option> option starts one queue runner process. This scans the queue of
6681 waiting messages, and runs a delivery process for each one in turn. It waits
6682 for each delivery process to finish before starting the next one. A delivery
6683 process may not actually do any deliveries if the retry times for the addresses
6684 have not been reached. Use <option>-qf</option> (see below) if you want to override this.
6685 </para>
6686 <para>
6687 If
6688 <indexterm role="concept">
6689 <primary>SMTP</primary>
6690 <secondary>passed connection</secondary>
6691 </indexterm>
6692 <indexterm role="concept">
6693 <primary>SMTP</primary>
6694 <secondary>multiple deliveries</secondary>
6695 </indexterm>
6696 <indexterm role="concept">
6697 <primary>multiple SMTP deliveries</primary>
6698 </indexterm>
6699 the delivery process spawns other processes to deliver other messages down
6700 passed SMTP connections, the queue runner waits for these to finish before
6701 proceeding.
6702 </para>
6703 <para>
6704 When all the queued messages have been considered, the original queue runner
6705 process terminates. In other words, a single pass is made over the waiting
6706 mail, one message at a time. Use <option>-q</option> with a time (see below) if you want
6707 this to be repeated periodically.
6708 </para>
6709 <para>
6710 Exim processes the waiting messages in an unpredictable order. It isn&#x2019;t very
6711 random, but it is likely to be different each time, which is all that matters.
6712 If one particular message screws up a remote MTA, other messages to the same
6713 MTA have a chance of getting through if they get tried first.
6714 </para>
6715 <para>
6716 It is possible to cause the messages to be processed in lexical message id
6717 order, which is essentially the order in which they arrived, by setting the
6718 <option>queue_run_in_order</option> option, but this is not recommended for normal use.
6719 </para>
6720 </listitem></varlistentry>
6721 <varlistentry>
6722 <term><option>-q</option>&lt;<emphasis>qflags</emphasis>&gt;</term>
6723 <listitem>
6724 <para>
6725 The <option>-q</option> option may be followed by one or more flag letters that change its
6726 behaviour. They are all optional, but if more than one is present, they must
6727 appear in the correct order. Each flag is described in a separate item below.
6728 </para>
6729 </listitem></varlistentry>
6730 <varlistentry>
6731 <term><option>-qq...</option></term>
6732 <listitem>
6733 <para>
6734 <indexterm role="option">
6735 <primary><option>-qq</option></primary>
6736 </indexterm>
6737 <indexterm role="concept">
6738 <primary>queue</primary>
6739 <secondary>double scanning</secondary>
6740 </indexterm>
6741 <indexterm role="concept">
6742 <primary>queue</primary>
6743 <secondary>routing</secondary>
6744 </indexterm>
6745 <indexterm role="concept">
6746 <primary>routing</primary>
6747 <secondary>whole queue before delivery</secondary>
6748 </indexterm>
6749 An option starting with <option>-qq</option> requests a two-stage queue run. In the first
6750 stage, the queue is scanned as if the <option>queue_smtp_domains</option> option matched
6751 every domain. Addresses are routed, local deliveries happen, but no remote
6752 transports are run.
6753 </para>
6754 <para>
6755 <indexterm role="concept">
6756 <primary>hints database</primary>
6757 <secondary>remembering routing</secondary>
6758 </indexterm>
6759 The hints database that remembers which messages are waiting for specific hosts
6760 is updated, as if delivery to those hosts had been deferred. After this is
6761 complete, a second, normal queue scan happens, with routing and delivery taking
6762 place as normal. Messages that are routed to the same host should mostly be
6763 delivered down a single SMTP
6764 <indexterm role="concept">
6765 <primary>SMTP</primary>
6766 <secondary>passed connection</secondary>
6767 </indexterm>
6768 <indexterm role="concept">
6769 <primary>SMTP</primary>
6770 <secondary>multiple deliveries</secondary>
6771 </indexterm>
6772 <indexterm role="concept">
6773 <primary>multiple SMTP deliveries</primary>
6774 </indexterm>
6775 connection because of the hints that were set up during the first queue scan.
6776 This option may be useful for hosts that are connected to the Internet
6777 intermittently.
6778 </para>
6779 </listitem></varlistentry>
6780 <varlistentry>
6781 <term><option>-q[q]i...</option></term>
6782 <listitem>
6783 <para>
6784 <indexterm role="option">
6785 <primary><option>-qi</option></primary>
6786 </indexterm>
6787 <indexterm role="concept">
6788 <primary>queue</primary>
6789 <secondary>initial delivery</secondary>
6790 </indexterm>
6791 If the <emphasis>i</emphasis> flag is present, the queue runner runs delivery processes only for
6792 those messages that haven&#x2019;t previously been tried. (<emphasis>i</emphasis> stands for <quote>initial
6793 delivery</quote>.) This can be helpful if you are putting messages on the queue using
6794 <option>-odq</option> and want a queue runner just to process the new messages.
6795 </para>
6796 </listitem></varlistentry>
6797 <varlistentry>
6798 <term><option>-q[q][i]f...</option></term>
6799 <listitem>
6800 <para>
6801 <indexterm role="option">
6802 <primary><option>-qf</option></primary>
6803 </indexterm>
6804 <indexterm role="concept">
6805 <primary>queue</primary>
6806 <secondary>forcing delivery</secondary>
6807 </indexterm>
6808 <indexterm role="concept">
6809 <primary>delivery</primary>
6810 <secondary>forcing in queue run</secondary>
6811 </indexterm>
6812 If one <emphasis>f</emphasis> flag is present, a delivery attempt is forced for each non-frozen
6813 message, whereas without <emphasis>f</emphasis> only those non-frozen addresses that have passed
6814 their retry times are tried.
6815 </para>
6816 </listitem></varlistentry>
6817 <varlistentry>
6818 <term><option>-q[q][i]ff...</option></term>
6819 <listitem>
6820 <para>
6821 <indexterm role="option">
6822 <primary><option>-qff</option></primary>
6823 </indexterm>
6824 <indexterm role="concept">
6825 <primary>frozen messages</primary>
6826 <secondary>forcing delivery</secondary>
6827 </indexterm>
6828 If <emphasis>ff</emphasis> is present, a delivery attempt is forced for every message, whether
6829 frozen or not.
6830 </para>
6831 </listitem></varlistentry>
6832 <varlistentry>
6833 <term><option>-q[q][i][f[f]]l</option></term>
6834 <listitem>
6835 <para>
6836 <indexterm role="option">
6837 <primary><option>-ql</option></primary>
6838 </indexterm>
6839 <indexterm role="concept">
6840 <primary>queue</primary>
6841 <secondary>local deliveries only</secondary>
6842 </indexterm>
6843 The <emphasis>l</emphasis> (the letter <quote>ell</quote>) flag specifies that only local deliveries are to
6844 be done. If a message requires any remote deliveries, it remains on the queue
6845 for later delivery.
6846 </para>
6847 </listitem></varlistentry>
6848 <varlistentry>
6849 <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>
6850 <listitem>
6851 <para>
6852 <indexterm role="concept">
6853 <primary>queue</primary>
6854 <secondary>delivering specific messages</secondary>
6855 </indexterm>
6856 When scanning the queue, Exim can be made to skip over messages whose ids are
6857 lexically less than a given value by following the <option>-q</option> option with a
6858 starting message id. For example:
6859 </para>
6860 <literallayout class="monospaced">
6861 exim -q 0t5C6f-0000c8-00
6862 </literallayout>
6863 <para>
6864 Messages that arrived earlier than <literal>0t5C6f-0000c8-00</literal> are not inspected. If a
6865 second message id is given, messages whose ids are lexically greater than it
6866 are also skipped. If the same id is given twice, for example,
6867 </para>
6868 <literallayout class="monospaced">
6869 exim -q 0t5C6f-0000c8-00 0t5C6f-0000c8-00
6870 </literallayout>
6871 <para>
6872 just one delivery process is started, for that message. This differs from
6873 <option>-M</option> in that retry data is respected, and it also differs from <option>-Mc</option> in
6874 that it counts as a delivery from a queue run. Note that the selection
6875 mechanism does not affect the order in which the messages are scanned. There
6876 are also other ways of selecting specific sets of messages for delivery in a
6877 queue run &ndash; see <option>-R</option> and <option>-S</option>.
6878 </para>
6879 </listitem></varlistentry>
6880 <varlistentry>
6881 <term><option>-q</option>&lt;<emphasis>qflags</emphasis>&gt;&lt;<emphasis>time</emphasis>&gt;</term>
6882 <listitem>
6883 <para>
6884 <indexterm role="concept">
6885 <primary>queue runner</primary>
6886 <secondary>starting periodically</secondary>
6887 </indexterm>
6888 <indexterm role="concept">
6889 <primary>periodic queue running</primary>
6890 </indexterm>
6891 When a time value is present, the <option>-q</option> option causes Exim to run as a daemon,
6892 starting a queue runner process at intervals specified by the given time value
6893 (whose format is described in section <xref linkend="SECTtimeformat"/>). This form of the
6894 <option>-q</option> option is commonly combined with the <option>-bd</option> option, in which case a
6895 single daemon process handles both functions. A common way of starting up a
6896 combined daemon at system boot time is to use a command such as
6897 </para>
6898 <literallayout class="monospaced">
6899 /usr/exim/bin/exim -bd -q30m
6900 </literallayout>
6901 <para>
6902 Such a daemon listens for incoming SMTP calls, and also starts a queue runner
6903 process every 30 minutes.
6904 </para>
6905 <para>
6906 When a daemon is started by <option>-q</option> with a time value, but without <option>-bd</option>, no
6907 pid file is written unless one is explicitly requested by the <option>-oP</option> option.
6908 </para>
6909 </listitem></varlistentry>
6910 <varlistentry>
6911 <term><option>-qR</option>&lt;<emphasis>rsflags</emphasis>&gt;&nbsp;&lt;<emphasis>string</emphasis>&gt;</term>
6912 <listitem>
6913 <para>
6914 <indexterm role="option">
6915 <primary><option>-qR</option></primary>
6916 </indexterm>
6917 This option is synonymous with <option>-R</option>. It is provided for Sendmail
6918 compatibility.
6919 </para>
6920 </listitem></varlistentry>
6921 <varlistentry>
6922 <term><option>-qS</option>&lt;<emphasis>rsflags</emphasis>&gt;&nbsp;&lt;<emphasis>string</emphasis>&gt;</term>
6923 <listitem>
6924 <para>
6925 <indexterm role="option">
6926 <primary><option>-qS</option></primary>
6927 </indexterm>
6928 This option is synonymous with <option>-S</option>.
6929 </para>
6930 </listitem></varlistentry>
6931 <varlistentry>
6932 <term><option>-R</option>&lt;<emphasis>rsflags</emphasis>&gt;&nbsp;&lt;<emphasis>string</emphasis>&gt;</term>
6933 <listitem>
6934 <para>
6935 <indexterm role="option">
6936 <primary><option>-R</option></primary>
6937 </indexterm>
6938 <indexterm role="concept">
6939 <primary>queue runner</primary>
6940 <secondary>for specific recipients</secondary>
6941 </indexterm>
6942 <indexterm role="concept">
6943 <primary>delivery</primary>
6944 <secondary>to given domain</secondary>
6945 </indexterm>
6946 <indexterm role="concept">
6947 <primary>domain</primary>
6948 <secondary>delivery to</secondary>
6949 </indexterm>
6950 The &lt;<emphasis>rsflags</emphasis>&gt; may be empty, in which case the white space before the string
6951 is optional, unless the string is <emphasis>f</emphasis>, <emphasis>ff</emphasis>, <emphasis>r</emphasis>, <emphasis>rf</emphasis>, or <emphasis>rff</emphasis>,
6952 which are the possible values for &lt;<emphasis>rsflags</emphasis>&gt;. White space is required if
6953 &lt;<emphasis>rsflags</emphasis>&gt; is not empty.
6954 </para>
6955 <para>
6956 This option is similar to <option>-q</option> with no time value, that is, it causes Exim to
6957 perform a single queue run, except that, when scanning the messages on the
6958 queue, Exim processes only those that have at least one undelivered recipient
6959 address containing the given string, which is checked in a case-independent
6960 way. If the &lt;<emphasis>rsflags</emphasis>&gt; start with <emphasis>r</emphasis>, &lt;<emphasis>string</emphasis>&gt; is interpreted as a
6961 regular expression; otherwise it is a literal string.
6962 </para>
6963 <para>
6964 If you want to do periodic queue runs for messages with specific recipients,
6965 you can combine <option>-R</option> with <option>-q</option> and a time value. For example:
6966 </para>
6967 <literallayout class="monospaced">
6968 exim -q25m -R @special.domain.example
6969 </literallayout>
6970 <para>
6971 This example does a queue run for messages with recipients in the given domain
6972 every 25 minutes. Any additional flags that are specified with <option>-q</option> are
6973 applied to each queue run.
6974 </para>
6975 <para>
6976 Once a message is selected for delivery by this mechanism, all its addresses
6977 are processed. For the first selected message, Exim overrides any retry
6978 information and forces a delivery attempt for each undelivered address. This
6979 means that if delivery of any address in the first message is successful, any
6980 existing retry information is deleted, and so delivery attempts for that
6981 address in subsequently selected messages (which are processed without forcing)
6982 will run. However, if delivery of any address does not succeed, the retry
6983 information is updated, and in subsequently selected messages, the failing
6984 address will be skipped.
6985 </para>
6986 <para>
6987 <indexterm role="concept">
6988 <primary>frozen messages</primary>
6989 <secondary>forcing delivery</secondary>
6990 </indexterm>
6991 If the &lt;<emphasis>rsflags</emphasis>&gt; contain <emphasis>f</emphasis> or <emphasis>ff</emphasis>, the delivery forcing applies to
6992 all selected messages, not just the first; frozen messages are included when
6993 <emphasis>ff</emphasis> is present.
6994 </para>
6995 <para>
6996 The <option>-R</option> option makes it straightforward to initiate delivery of all messages
6997 to a given domain after a host has been down for some time. When the SMTP
6998 command ETRN is accepted by its ACL (see chapter <xref linkend="CHAPACL"/>), its default
6999 effect is to run Exim with the <option>-R</option> option, but it can be configured to run
7000 an arbitrary command instead.
7001 </para>
7002 </listitem></varlistentry>
7003 <varlistentry>
7004 <term><option>-r</option></term>
7005 <listitem>
7006 <para>
7007 <indexterm role="option">
7008 <primary><option>-r</option></primary>
7009 </indexterm>
7010 This is a documented (for Sendmail) obsolete alternative name for <option>-f</option>.
7011 </para>
7012 </listitem></varlistentry>
7013 <varlistentry>
7014 <term><option>-S</option>&lt;<emphasis>rsflags</emphasis>&gt;&nbsp;&lt;<emphasis>string</emphasis>&gt;</term>
7015 <listitem>
7016 <para>
7017 <indexterm role="option">
7018 <primary><option>-S</option></primary>
7019 </indexterm>
7020 <indexterm role="concept">
7021 <primary>delivery</primary>
7022 <secondary>from given sender</secondary>
7023 </indexterm>
7024 <indexterm role="concept">
7025 <primary>queue runner</primary>
7026 <secondary>for specific senders</secondary>
7027 </indexterm>
7028 This option acts like <option>-R</option> except that it checks the string against each
7029 message&#x2019;s sender instead of against the recipients. If <option>-R</option> is also set, both
7030 conditions must be met for a message to be selected. If either of the options
7031 has <emphasis>f</emphasis> or <emphasis>ff</emphasis> in its flags, the associated action is taken.
7032 </para>
7033 </listitem></varlistentry>
7034 <varlistentry>
7035 <term><option>-Tqt</option>&nbsp;&lt;<emphasis>times</emphasis>&gt;</term>
7036 <listitem>
7037 <para>
7038 <indexterm role="option">
7039 <primary><option>-Tqt</option></primary>
7040 </indexterm>
7041 This is an option that is exclusively for use by the Exim testing suite. It is not
7042 recognized when Exim is run normally. It allows for the setting up of explicit
7043 <quote>queue times</quote> so that various warning/retry features can be tested.
7044 </para>
7045 </listitem></varlistentry>
7046 <varlistentry>
7047 <term><option>-t</option></term>
7048 <listitem>
7049 <para>
7050 <indexterm role="option">
7051 <primary><option>-t</option></primary>
7052 </indexterm>
7053 <indexterm role="concept">
7054 <primary>recipient</primary>
7055 <secondary>extracting from header lines</secondary>
7056 </indexterm>
7057 <indexterm role="concept">
7058 <primary><emphasis>Bcc:</emphasis> header line</primary>
7059 </indexterm>
7060 <indexterm role="concept">
7061 <primary><emphasis>Cc:</emphasis> header line</primary>
7062 </indexterm>
7063 <indexterm role="concept">
7064 <primary><emphasis>To:</emphasis> header line</primary>
7065 </indexterm>
7066 When Exim is receiving a locally-generated, non-SMTP message on its standard
7067 input, the <option>-t</option> option causes the recipients of the message to be obtained
7068 from the <emphasis>To:</emphasis>, <emphasis>Cc:</emphasis>, and <emphasis>Bcc:</emphasis> header lines in the message instead of
7069 from the command arguments. The addresses are extracted before any rewriting
7070 takes place and the <emphasis>Bcc:</emphasis> header line, if present, is then removed.
7071 </para>
7072 <para>
7073 <indexterm role="concept">
7074 <primary>Sendmail compatibility</primary>
7075 <secondary><option>-t</option> option</secondary>
7076 </indexterm>
7077 If the command has any arguments, they specify addresses to which the message
7078 is <emphasis>not</emphasis> to be delivered. That is, the argument addresses are removed from
7079 the recipients list obtained from the headers. This is compatible with Smail 3
7080 and in accordance with the documented behaviour of several versions of
7081 Sendmail, as described in man pages on a number of operating systems (e.g.
7082 Solaris 8, IRIX 6.5, HP-UX 11). However, some versions of Sendmail <emphasis>add</emphasis>
7083 argument addresses to those obtained from the headers, and the O&#x2019;Reilly
7084 Sendmail book documents it that way. Exim can be made to add argument addresses
7085 instead of subtracting them by setting the option
7086 <option>extract_addresses_remove_arguments</option> false.
7087 </para>
7088 <para>
7089 <indexterm role="concept">
7090 <primary><option>Resent-</option> header lines</primary>
7091 <secondary>with <option>-t</option></secondary>
7092 </indexterm>
7093 If there are any <option>Resent-</option> header lines in the message, Exim extracts
7094 recipients from all <emphasis>Resent-To:</emphasis>, <emphasis>Resent-Cc:</emphasis>, and <emphasis>Resent-Bcc:</emphasis> header
7095 lines instead of from <emphasis>To:</emphasis>, <emphasis>Cc:</emphasis>, and <emphasis>Bcc:</emphasis>. This is for compatibility
7096 with Sendmail and other MTAs. (Prior to release 4.20, Exim gave an error if
7097 <option>-t</option> was used in conjunction with <option>Resent-</option> header lines.)
7098 </para>
7099 <para>
7100 RFC 2822 talks about different sets of <option>Resent-</option> header lines (for when a
7101 message is resent several times). The RFC also specifies that they should be
7102 added at the front of the message, and separated by <emphasis>Received:</emphasis> lines. It is
7103 not at all clear how <option>-t</option> should operate in the present of multiple sets,
7104 nor indeed exactly what constitutes a <quote>set</quote>.
7105 In practice, it seems that MUAs do not follow the RFC. The <option>Resent-</option> lines
7106 are often added at the end of the header, and if a message is resent more than
7107 once, it is common for the original set of <option>Resent-</option> headers to be renamed as
7108 <option>X-Resent-</option> when a new set is added. This removes any possible ambiguity.
7109 </para>
7110 </listitem></varlistentry>
7111 <varlistentry>
7112 <term><option>-ti</option></term>
7113 <listitem>
7114 <para>
7115 <indexterm role="option">
7116 <primary><option>-ti</option></primary>
7117 </indexterm>
7118 This option is exactly equivalent to <option>-t</option> <option>-i</option>. It is provided for
7119 compatibility with Sendmail.
7120 </para>
7121 </listitem></varlistentry>
7122 <varlistentry>
7123 <term><option>-tls-on-connect</option></term>
7124 <listitem>
7125 <para>
7126 <indexterm role="option">
7127 <primary><option>-tls-on-connect</option></primary>
7128 </indexterm>
7129 <indexterm role="concept">
7130 <primary>TLS</primary>
7131 <secondary>use without STARTTLS</secondary>
7132 </indexterm>
7133 <indexterm role="concept">
7134 <primary>TLS</primary>
7135 <secondary>automatic start</secondary>
7136 </indexterm>
7137 This option is available when Exim is compiled with TLS support. It forces all
7138 incoming SMTP connections to behave as if the incoming port is listed in the
7139 <option>tls_on_connect_ports</option> option. See section <xref linkend="SECTsupobssmt"/> and chapter
7140 <xref linkend="CHAPTLS"/> for further details.
7141 </para>
7142 </listitem></varlistentry>
7143 <varlistentry>
7144 <term><option>-U</option></term>
7145 <listitem>
7146 <para>
7147 <indexterm role="option">
7148 <primary><option>-U</option></primary>
7149 </indexterm>
7150 <indexterm role="concept">
7151 <primary>Sendmail compatibility</primary>
7152 <secondary><option>-U</option> option ignored</secondary>
7153 </indexterm>
7154 Sendmail uses this option for <quote>initial message submission</quote>, and its
7155 documentation states that in future releases, it may complain about
7156 syntactically invalid messages rather than fixing them when this flag is not
7157 set. Exim ignores this option.
7158 </para>
7159 </listitem></varlistentry>
7160 <varlistentry>
7161 <term><option>-v</option></term>
7162 <listitem>
7163 <para>
7164 <indexterm role="option">
7165 <primary><option>-v</option></primary>
7166 </indexterm>
7167 This option causes Exim to write information to the standard error stream,
7168 describing what it is doing. In particular, it shows the log lines for
7169 receiving and delivering a message, and if an SMTP connection is made, the SMTP
7170 dialogue is shown. Some of the log lines shown may not actually be written to
7171 the log if the setting of <option>log_selector</option> discards them. Any relevant
7172 selectors are shown with each log line. If none are shown, the logging is
7173 unconditional.
7174 </para>
7175 </listitem></varlistentry>
7176 <varlistentry>
7177 <term><option>-x</option></term>
7178 <listitem>
7179 <para>
7180 <indexterm role="option">
7181 <primary><option>-x</option></primary>
7182 </indexterm>
7183 AIX uses <option>-x</option> for a private purpose (<quote>mail from a local mail program has
7184 National Language Support extended characters in the body of the mail item</quote>).
7185 It sets <option>-x</option> when calling the MTA from its <option>mail</option> command. Exim ignores
7186 this option.
7187 </para>
7188 </listitem></varlistentry>
7189 <varlistentry>
7190 <term><option>-X</option>&nbsp;&lt;<emphasis>logfile</emphasis>&gt;</term>
7191 <listitem>
7192 <para>
7193 <indexterm role="option">
7194 <primary><option>-X</option></primary>
7195 </indexterm>
7196 This option is interpreted by Sendmail to cause debug information to be sent
7197 to the named file.  It is ignored by Exim.
7198 </para>
7199 </listitem></varlistentry>
7200 <varlistentry revisionflag="changed">
7201 <term><option>-z</option>&nbsp;&lt;<emphasis>log-line</emphasis>&gt;</term>
7202 <listitem>
7203 <para revisionflag="changed">
7204 <indexterm role="option">
7205 <primary><option>-z</option></primary>
7206 </indexterm>
7207 This option writes its argument to Exim&#x2019;s logfile.
7208 Use is restricted to administrators; the intent is for operational notes.
7209 Quotes should be used to maintain a multi-word item as a single argument,
7210 under most shells.
7211 </para>
7212 </listitem></varlistentry>
7213 </variablelist>
7214 <para>
7215 <indexterm role="concept" startref="IIDclo1" class="endofrange"/>
7216 <indexterm role="concept" startref="IIDclo2" class="endofrange"/>
7217 </para>
7218 <!-- === End of command line options === -->
7219 </section>
7220 </chapter>
7221
7222 <chapter id="CHAPconf">
7223 <title>The Exim run time configuration file</title>
7224 <titleabbrev>The runtime configuration file</titleabbrev>
7225 <para>
7226 <indexterm role="concept">
7227 <primary>run time configuration</primary>
7228 </indexterm>
7229 <indexterm role="concept">
7230 <primary>configuration file</primary>
7231 <secondary>general description</secondary>
7232 </indexterm>
7233 <indexterm role="concept">
7234 <primary>CONFIGURE_FILE</primary>
7235 </indexterm>
7236 <indexterm role="concept">
7237 <primary>configuration file</primary>
7238 <secondary>errors in</secondary>
7239 </indexterm>
7240 <indexterm role="concept">
7241 <primary>error</primary>
7242 <secondary>in configuration file</secondary>
7243 </indexterm>
7244 <indexterm role="concept">
7245 <primary>return code</primary>
7246 <secondary>for bad configuration</secondary>
7247 </indexterm>
7248 Exim uses a single run time configuration file that is read whenever an Exim
7249 binary is executed. Note that in normal operation, this happens frequently,
7250 because Exim is designed to operate in a distributed manner, without central
7251 control.
7252 </para>
7253 <para>
7254 If a syntax error is detected while reading the configuration file, Exim
7255 writes a message on the standard error, and exits with a non-zero return code.
7256 The message is also written to the panic log. <emphasis role="bold">Note</emphasis>: Only simple syntax
7257 errors can be detected at this time. The values of any expanded options are
7258 not checked until the expansion happens, even when the expansion does not
7259 actually alter the string.
7260 </para>
7261 <para>
7262 The name of the configuration file is compiled into the binary for security
7263 reasons, and is specified by the CONFIGURE_FILE compilation option. In
7264 most configurations, this specifies a single file. However, it is permitted to
7265 give a colon-separated list of file names, in which case Exim uses the first
7266 existing file in the list.
7267 </para>
7268 <para>
7269 <indexterm role="concept">
7270 <primary>EXIM_USER</primary>
7271 </indexterm>
7272 <indexterm role="concept">
7273 <primary>EXIM_GROUP</primary>
7274 </indexterm>
7275 <indexterm role="concept">
7276 <primary>CONFIGURE_OWNER</primary>
7277 </indexterm>
7278 <indexterm role="concept">
7279 <primary>CONFIGURE_GROUP</primary>
7280 </indexterm>
7281 <indexterm role="concept">
7282 <primary>configuration file</primary>
7283 <secondary>ownership</secondary>
7284 </indexterm>
7285 <indexterm role="concept">
7286 <primary>ownership</primary>
7287 <secondary>configuration file</secondary>
7288 </indexterm>
7289 The run time configuration file must be owned by root or by the user that is
7290 specified at compile time by the CONFIGURE_OWNER option (if set). The
7291 configuration file must not be world-writeable, or group-writeable unless its
7292 group is the root group or the one specified at compile time by the
7293 CONFIGURE_GROUP option.
7294 </para>
7295 <para>
7296 <emphasis role="bold">Warning</emphasis>: In a conventional configuration, where the Exim binary is setuid
7297 to root, anybody who is able to edit the run time configuration file has an
7298 easy way to run commands as root. If you specify a user or group in the
7299 CONFIGURE_OWNER or CONFIGURE_GROUP options, then that user and/or any users
7300 who are members of that group will trivially be able to obtain root privileges.
7301 </para>
7302 <para>
7303 Up to Exim version 4.72, the run time configuration file was also permitted to
7304 be writeable by the Exim user and/or group. That has been changed in Exim 4.73
7305 since it offered a simple privilege escalation for any attacker who managed to
7306 compromise the Exim user account.
7307 </para>
7308 <para>
7309 A default configuration file, which will work correctly in simple situations,
7310 is provided in the file <filename>src/configure.default</filename>. If CONFIGURE_FILE
7311 defines just one file name, the installation process copies the default
7312 configuration to a new file of that name if it did not previously exist. If
7313 CONFIGURE_FILE is a list, no default is automatically installed. Chapter
7314 <xref linkend="CHAPdefconfil"/> is a <quote>walk-through</quote> discussion of the default
7315 configuration.
7316 </para>
7317 <section id="SECID40">
7318 <title>Using a different configuration file</title>
7319 <para>
7320 <indexterm role="concept">
7321 <primary>configuration file</primary>
7322 <secondary>alternate</secondary>
7323 </indexterm>
7324 A one-off alternate configuration can be specified by the <option>-C</option> command line
7325 option, which may specify a single file or a list of files. However, when
7326 <option>-C</option> is used, Exim gives up its root privilege, unless called by root (or
7327 unless the argument for <option>-C</option> is identical to the built-in value from
7328 CONFIGURE_FILE), or is listed in the TRUSTED_CONFIG_LIST file and the caller
7329 is the Exim user or the user specified in the CONFIGURE_OWNER setting. <option>-C</option>
7330 is useful mainly for checking the syntax of configuration files before
7331 installing them. No owner or group checks are done on a configuration file
7332 specified by <option>-C</option>, if root privilege has been dropped.
7333 </para>
7334 <para>
7335 Even the Exim user is not trusted to specify an arbitrary configuration file
7336 with the <option>-C</option> option to be used with root privileges, unless that file is
7337 listed in the TRUSTED_CONFIG_LIST file. This locks out the possibility of
7338 testing a configuration using <option>-C</option> right through message reception and
7339 delivery, even if the caller is root. The reception works, but by that time,
7340 Exim is running as the Exim user, so when it re-execs to regain privilege for
7341 the delivery, the use of <option>-C</option> causes privilege to be lost. However, root
7342 can test reception and delivery using two separate commands (one to put a
7343 message on the queue, using <option>-odq</option>, and another to do the delivery, using
7344 <option>-M</option>).
7345 </para>
7346 <para>
7347 If ALT_CONFIG_PREFIX is defined <filename>in Local/Makefile</filename>, it specifies a
7348 prefix string with which any file named in a <option>-C</option> command line option must
7349 start. In addition, the file name must not contain the sequence <quote><literal>/../</literal></quote>.
7350 There is no default setting for ALT_CONFIG_PREFIX; when it is unset, any file
7351 name can be used with <option>-C</option>.
7352 </para>
7353 <para>
7354 One-off changes to a configuration can be specified by the <option>-D</option> command line
7355 option, which defines and overrides values for macros used inside the
7356 configuration file. However, like <option>-C</option>, the use of this option by a
7357 non-privileged user causes Exim to discard its root privilege.
7358 If DISABLE_D_OPTION is defined in <filename>Local/Makefile</filename>, the use of <option>-D</option> is
7359 completely disabled, and its use causes an immediate error exit.
7360 </para>
7361 <para>
7362 The WHITELIST_D_MACROS option in <filename>Local/Makefile</filename> permits the binary builder
7363 to declare certain macro names trusted, such that root privilege will not
7364 necessarily be discarded.
7365 WHITELIST_D_MACROS defines a colon-separated list of macros which are
7366 considered safe and, if <option>-D</option> only supplies macros from this list, and the
7367 values are acceptable, then Exim will not give up root privilege if the caller
7368 is root, the Exim run-time user, or the CONFIGURE_OWNER, if set.  This is a
7369 transition mechanism and is expected to be removed in the future.  Acceptable
7370 values for the macros satisfy the regexp: <literal>^[A-Za-z0-9_/.-]*$</literal>
7371 </para>
7372 <para>
7373 Some sites may wish to use the same Exim binary on different machines that
7374 share a file system, but to use different configuration files on each machine.
7375 If CONFIGURE_FILE_USE_NODE is defined in <filename>Local/Makefile</filename>, Exim first
7376 looks for a file whose name is the configuration file name followed by a dot
7377 and the machine&#x2019;s node name, as obtained from the <function>uname()</function> function. If this
7378 file does not exist, the standard name is tried. This processing occurs for
7379 each file name in the list given by CONFIGURE_FILE or <option>-C</option>.
7380 </para>
7381 <para>
7382 In some esoteric situations different versions of Exim may be run under
7383 different effective uids and the CONFIGURE_FILE_USE_EUID is defined to
7384 help with this. See the comments in <filename>src/EDITME</filename> for details.
7385 </para>
7386 </section>
7387 <section id="SECTconffilfor">
7388 <title>Configuration file format</title>
7389 <para>
7390 <indexterm role="concept">
7391 <primary>configuration file</primary>
7392 <secondary>format of</secondary>
7393 </indexterm>
7394 <indexterm role="concept">
7395 <primary>format</primary>
7396 <secondary>configuration file</secondary>
7397 </indexterm>
7398 Exim&#x2019;s configuration file is divided into a number of different parts. General
7399 option settings must always appear at the start of the file. The other parts
7400 are all optional, and may appear in any order. Each part other than the first
7401 is introduced by the word <quote>begin</quote> followed by the name of the part. The
7402 optional parts are:
7403 </para>
7404 <itemizedlist>
7405 <listitem>
7406 <para>
7407 <emphasis>ACL</emphasis>: Access control lists for controlling incoming SMTP mail (see chapter
7408 <xref linkend="CHAPACL"/>).
7409 </para>
7410 </listitem>
7411 <listitem>
7412 <para>
7413 <indexterm role="concept">
7414 <primary>AUTH</primary>
7415 <secondary>configuration</secondary>
7416 </indexterm>
7417 <emphasis>authenticators</emphasis>: Configuration settings for the authenticator drivers. These
7418 are concerned with the SMTP AUTH command (see chapter <xref linkend="CHAPSMTPAUTH"/>).
7419 </para>
7420 </listitem>
7421 <listitem>
7422 <para>
7423 <emphasis>routers</emphasis>: Configuration settings for the router drivers. Routers process
7424 addresses and determine how the message is to be delivered (see chapters
7425 <xref linkend="CHAProutergeneric"/>&ndash;<xref linkend="CHAPredirect"/>).
7426 </para>
7427 </listitem>
7428 <listitem>
7429 <para>
7430 <emphasis>transports</emphasis>: Configuration settings for the transport drivers. Transports
7431 define mechanisms for copying messages to destinations (see chapters
7432 <xref linkend="CHAPtransportgeneric"/>&ndash;<xref linkend="CHAPsmtptrans"/>).
7433 </para>
7434 </listitem>
7435 <listitem>
7436 <para>
7437 <emphasis>retry</emphasis>: Retry rules, for use when a message cannot be delivered immediately.
7438 If there is no retry section, or if it is empty (that is, no retry rules are
7439 defined), Exim will not retry deliveries. In this situation, temporary errors
7440 are treated the same as permanent errors. Retry rules are discussed in chapter
7441 <xref linkend="CHAPretry"/>.
7442 </para>
7443 </listitem>
7444 <listitem>
7445 <para>
7446 <emphasis>rewrite</emphasis>: Global address rewriting rules, for use when a message arrives and
7447 when new addresses are generated during delivery. Rewriting is discussed in
7448 chapter <xref linkend="CHAPrewrite"/>.
7449 </para>
7450 </listitem>
7451 <listitem>
7452 <para>
7453 <emphasis>local_scan</emphasis>: Private options for the <function>local_scan()</function> function. If you
7454 want to use this feature, you must set
7455 </para>
7456 <literallayout class="monospaced">
7457 LOCAL_SCAN_HAS_OPTIONS=yes
7458 </literallayout>
7459 <para>
7460 in <filename>Local/Makefile</filename> before building Exim. Details of the <function>local_scan()</function>
7461 facility are given in chapter <xref linkend="CHAPlocalscan"/>.
7462 </para>
7463 </listitem>
7464 </itemizedlist>
7465 <para>
7466 <indexterm role="concept">
7467 <primary>configuration file</primary>
7468 <secondary>leading white space in</secondary>
7469 </indexterm>
7470 <indexterm role="concept">
7471 <primary>configuration file</primary>
7472 <secondary>trailing white space in</secondary>
7473 </indexterm>
7474 <indexterm role="concept">
7475 <primary>white space</primary>
7476 <secondary>in configuration file</secondary>
7477 </indexterm>
7478 Leading and trailing white space in configuration lines is always ignored.
7479 </para>
7480 <para>
7481 Blank lines in the file, and lines starting with a # character (ignoring
7482 leading white space) are treated as comments and are ignored. <emphasis role="bold">Note</emphasis>: A
7483 # character other than at the beginning of a line is not treated specially,
7484 and does not introduce a comment.
7485 </para>
7486 <para>
7487 Any non-comment line can be continued by ending it with a backslash. Note that
7488 the general rule for white space means that trailing white space after the
7489 backslash and leading white space at the start of continuation
7490 lines is ignored. Comment lines beginning with # (but not empty lines) may
7491 appear in the middle of a sequence of continuation lines.
7492 </para>
7493 <para>
7494 A convenient way to create a configuration file is to start from the
7495 default, which is supplied in <filename>src/configure.default</filename>, and add, delete, or
7496 change settings as required.
7497 </para>
7498 <para>
7499 The ACLs, retry rules, and rewriting rules have their own syntax which is
7500 described in chapters <xref linkend="CHAPACL"/>, <xref linkend="CHAPretry"/>, and <xref linkend="CHAPrewrite"/>,
7501 respectively. The other parts of the configuration file have some syntactic
7502 items in common, and these are described below, from section <xref linkend="SECTcos"/>
7503 onwards. Before that, the inclusion, macro, and conditional facilities are
7504 described.
7505 </para>
7506 </section>
7507 <section id="SECID41">
7508 <title>File inclusions in the configuration file</title>
7509 <para>
7510 <indexterm role="concept">
7511 <primary>inclusions in configuration file</primary>
7512 </indexterm>
7513 <indexterm role="concept">
7514 <primary>configuration file</primary>
7515 <secondary>including other files</secondary>
7516 </indexterm>
7517 <indexterm role="concept">
7518 <primary><literal>.include</literal> in configuration file</primary>
7519 </indexterm>
7520 <indexterm role="concept">
7521 <primary><literal>.include_if_exists</literal> in configuration file</primary>
7522 </indexterm>
7523 You can include other files inside Exim&#x2019;s run time configuration file by
7524 using this syntax:
7525 </para>
7526 <literallayout>
7527 <literal>.include</literal> &lt;<emphasis>file name</emphasis>&gt;
7528 <literal>.include_if_exists</literal> &lt;<emphasis>file name</emphasis>&gt;
7529 </literallayout>
7530 <para>
7531 on a line by itself. Double quotes round the file name are optional. If you use
7532 the first form, a configuration error occurs if the file does not exist; the
7533 second form does nothing for non-existent files. In all cases, an absolute file
7534 name is required.
7535 </para>
7536 <para>
7537 Includes may be nested to any depth, but remember that Exim reads its
7538 configuration file often, so it is a good idea to keep them to a minimum.
7539 If you change the contents of an included file, you must HUP the daemon,
7540 because an included file is read only when the configuration itself is read.
7541 </para>
7542 <para>
7543 The processing of inclusions happens early, at a physical line level, so, like
7544 comment lines, an inclusion can be used in the middle of an option setting,
7545 for example:
7546 </para>
7547 <literallayout class="monospaced">
7548 hosts_lookup = a.b.c \
7549                .include /some/file
7550 </literallayout>
7551 <para>
7552 Include processing happens after macro processing (see below). Its effect is to
7553 process the lines of the included file as if they occurred inline where the
7554 inclusion appears.
7555 </para>
7556 </section>
7557 <section id="SECTmacrodefs">
7558 <title>Macros in the configuration file</title>
7559 <para>
7560 <indexterm role="concept">
7561 <primary>macro</primary>
7562 <secondary>description of</secondary>
7563 </indexterm>
7564 <indexterm role="concept">
7565 <primary>configuration file</primary>
7566 <secondary>macros</secondary>
7567 </indexterm>
7568 If a line in the main part of the configuration (that is, before the first
7569 <quote>begin</quote> line) begins with an upper case letter, it is taken as a macro
7570 definition, and must be of the form
7571 </para>
7572 <literallayout>
7573 &lt;<emphasis>name</emphasis>&gt; = &lt;<emphasis>rest of line</emphasis>&gt;
7574 </literallayout>
7575 <para>
7576 The name must consist of letters, digits, and underscores, and need not all be
7577 in upper case, though that is recommended. The rest of the line, including any
7578 continuations, is the replacement text, and has leading and trailing white
7579 space removed. Quotes are not removed. The replacement text can never end with
7580 a backslash character, but this doesn&#x2019;t seem to be a serious limitation.
7581 </para>
7582 <para>
7583 Macros may also be defined between router, transport, authenticator, or ACL
7584 definitions. They may not, however, be defined within an individual driver or
7585 ACL, or in the <option>local_scan</option>, retry, or rewrite sections of the configuration.
7586 </para>
7587 </section>
7588 <section id="SECID42">
7589 <title>Macro substitution</title>
7590 <para>
7591 Once a macro is defined, all subsequent lines in the file (and any included
7592 files) are scanned for the macro name; if there are several macros, the line is
7593 scanned for each in turn, in the order in which the macros are defined. The
7594 replacement text is not re-scanned for the current macro, though it is scanned
7595 for subsequently defined macros. For this reason, a macro name may not contain
7596 the name of a previously defined macro as a substring. You could, for example,
7597 define
7598 </para>
7599 <literallayout>
7600 <literal>ABCD_XYZ = </literal>&lt;<emphasis>something</emphasis>&gt;
7601 <literal>ABCD = </literal>&lt;<emphasis>something else</emphasis>&gt;
7602 </literallayout>
7603 <para>
7604 but putting the definitions in the opposite order would provoke a configuration
7605 error. Macro expansion is applied to individual physical lines from the file,
7606 before checking for line continuation or file inclusion (see above). If a line
7607 consists solely of a macro name, and the expansion of the macro is empty, the
7608 line is ignored. A macro at the start of a line may turn the line into a
7609 comment line or a <literal>.include</literal> line.
7610 </para>
7611 </section>
7612 <section id="SECID43">
7613 <title>Redefining macros</title>
7614 <para>
7615 Once defined, the value of a macro can be redefined later in the configuration
7616 (or in an included file). Redefinition is specified by using <emphasis>==</emphasis> instead of
7617 <emphasis>=</emphasis>. For example:
7618 </para>
7619 <literallayout class="monospaced">
7620 MAC =  initial value
7621 ...
7622 MAC == updated value
7623 </literallayout>
7624 <para>
7625 Redefinition does not alter the order in which the macros are applied to the
7626 subsequent lines of the configuration file. It is still the same order in which
7627 the macros were originally defined. All that changes is the macro&#x2019;s value.
7628 Redefinition makes it possible to accumulate values. For example:
7629 </para>
7630 <literallayout class="monospaced">
7631 MAC =  initial value
7632 ...
7633 MAC == MAC and something added
7634 </literallayout>
7635 <para>
7636 This can be helpful in situations where the configuration file is built
7637 from a number of other files.
7638 </para>
7639 </section>
7640 <section id="SECID44">
7641 <title>Overriding macro values</title>
7642 <para>
7643 The values set for macros in the configuration file can be overridden by the
7644 <option>-D</option> command line option, but Exim gives up its root privilege when <option>-D</option> is
7645 used, unless called by root or the Exim user. A definition on the command line
7646 using the <option>-D</option> option causes all definitions and redefinitions within the
7647 file to be ignored.
7648 </para>
7649 </section>
7650 <section id="SECID45">
7651 <title>Example of macro usage</title>
7652 <para>
7653 As an example of macro usage, consider a configuration where aliases are looked
7654 up in a MySQL database. It helps to keep the file less cluttered if long
7655 strings such as SQL statements are defined separately as macros, for example:
7656 </para>
7657 <literallayout class="monospaced">
7658 ALIAS_QUERY = select mailbox from user where \
7659               login='${quote_mysql:$local_part}';
7660 </literallayout>
7661 <para>
7662 This can then be used in a <command>redirect</command> router setting like this:
7663 </para>
7664 <literallayout class="monospaced">
7665 data = ${lookup mysql{ALIAS_QUERY}}
7666 </literallayout>
7667 <para>
7668 In earlier versions of Exim macros were sometimes used for domain, host, or
7669 address lists. In Exim 4 these are handled better by named lists &ndash; see
7670 section <xref linkend="SECTnamedlists"/>.
7671 </para>
7672 </section>
7673 <section id="SECID46">
7674 <title>Conditional skips in the configuration file</title>
7675 <para>
7676 <indexterm role="concept">
7677 <primary>configuration file</primary>
7678 <secondary>conditional skips</secondary>
7679 </indexterm>
7680 <indexterm role="concept">
7681 <primary><literal>.ifdef</literal></primary>
7682 </indexterm>
7683 You can use the directives <literal>.ifdef</literal>, <literal>.ifndef</literal>, <literal>.elifdef</literal>,
7684 <literal>.elifndef</literal>, <literal>.else</literal>, and <literal>.endif</literal> to dynamically include or exclude
7685 portions of the configuration file. The processing happens whenever the file is
7686 read (that is, when an Exim binary starts to run).
7687 </para>
7688 <para>
7689 The implementation is very simple. Instances of the first four directives must
7690 be followed by text that includes the names of one or macros. The condition
7691 that is tested is whether or not any macro substitution has taken place in the
7692 line. Thus:
7693 </para>
7694 <literallayout class="monospaced">
7695 .ifdef AAA
7696 message_size_limit = 50M
7697 .else
7698 message_size_limit = 100M
7699 .endif
7700 </literallayout>
7701 <para>
7702 sets a message size limit of 50M if the macro <literal>AAA</literal> is defined
7703 (or <literal>A</literal> or <literal>AA</literal>), and 100M
7704 otherwise. If there is more than one macro named on the line, the condition
7705 is true if any of them are defined. That is, it is an <quote>or</quote> condition. To
7706 obtain an <quote>and</quote> condition, you need to use nested <literal>.ifdef</literal>s.
7707 </para>
7708 <para>
7709 Although you can use a macro expansion to generate one of these directives,
7710 it is not very useful, because the condition <quote>there was a macro substitution
7711 in this line</quote> will always be true.
7712 </para>
7713 <para>
7714 Text following <literal>.else</literal> and <literal>.endif</literal> is ignored, and can be used as comment
7715 to clarify complicated nestings.
7716 </para>
7717 </section>
7718 <section id="SECTcos">
7719 <title>Common option syntax</title>
7720 <para>
7721 <indexterm role="concept">
7722 <primary>common option syntax</primary>
7723 </indexterm>
7724 <indexterm role="concept">
7725 <primary>syntax of common options</primary>
7726 </indexterm>
7727 <indexterm role="concept">
7728 <primary>configuration file</primary>
7729 <secondary>common option syntax</secondary>
7730 </indexterm>
7731 For the main set of options, driver options, and <function>local_scan()</function> options,
7732 each setting is on a line by itself, and starts with a name consisting of
7733 lower-case letters and underscores. Many options require a data value, and in
7734 these cases the name must be followed by an equals sign (with optional white
7735 space) and then the value. For example:
7736 </para>
7737 <literallayout class="monospaced">
7738 qualify_domain = mydomain.example.com
7739 </literallayout>
7740 <para>
7741 <indexterm role="concept">
7742 <primary>hiding configuration option values</primary>
7743 </indexterm>
7744 <indexterm role="concept">
7745 <primary>configuration options</primary>
7746 <secondary>hiding value of</secondary>
7747 </indexterm>
7748 <indexterm role="concept">
7749 <primary>options</primary>
7750 <secondary>hiding value of</secondary>
7751 </indexterm>
7752 Some option settings may contain sensitive data, for example, passwords for
7753 accessing databases. To stop non-admin users from using the <option>-bP</option> command
7754 line option to read these values, you can precede the option settings with the
7755 word <quote>hide</quote>. For example:
7756 </para>
7757 <literallayout class="monospaced">
7758 hide mysql_servers = localhost/users/admin/secret-password
7759 </literallayout>
7760 <para>
7761 For non-admin users, such options are displayed like this:
7762 </para>
7763 <literallayout class="monospaced">
7764 mysql_servers = &lt;value not displayable&gt;
7765 </literallayout>
7766 <para>
7767 If <quote>hide</quote> is used on a driver option, it hides the value of that option on
7768 all instances of the same driver.
7769 </para>
7770 <para>
7771 The following sections describe the syntax used for the different data types
7772 that are found in option settings.
7773 </para>
7774 </section>
7775 <section id="SECID47">
7776 <title>Boolean options</title>
7777 <para>
7778 <indexterm role="concept">
7779 <primary>format</primary>
7780 <secondary>boolean</secondary>
7781 </indexterm>
7782 <indexterm role="concept">
7783 <primary>boolean configuration values</primary>
7784 </indexterm>
7785 <indexterm role="option">
7786 <primary><option>no_</option><emphasis>xxx</emphasis></primary>
7787 </indexterm>
7788 <indexterm role="option">
7789 <primary><option>not_</option><emphasis>xxx</emphasis></primary>
7790 </indexterm>
7791 Options whose type is given as boolean are on/off switches. There are two
7792 different ways of specifying such options: with and without a data value. If
7793 the option name is specified on its own without data, the switch is turned on;
7794 if it is preceded by <quote>no_</quote> or <quote>not_</quote> the switch is turned off. However,
7795 boolean options may be followed by an equals sign and one of the words
7796 <quote>true</quote>, <quote>false</quote>, <quote>yes</quote>, or <quote>no</quote>, as an alternative syntax. For example,
7797 the following two settings have exactly the same effect:
7798 </para>
7799 <literallayout class="monospaced">
7800 queue_only
7801 queue_only = true
7802 </literallayout>
7803 <para>
7804 The following two lines also have the same (opposite) effect:
7805 </para>
7806 <literallayout class="monospaced">
7807 no_queue_only
7808 queue_only = false
7809 </literallayout>
7810 <para>
7811 You can use whichever syntax you prefer.
7812 </para>
7813 </section>
7814 <section id="SECID48">
7815 <title>Integer values</title>
7816 <para>
7817 <indexterm role="concept">
7818 <primary>integer configuration values</primary>
7819 </indexterm>
7820 <indexterm role="concept">
7821 <primary>format</primary>
7822 <secondary>integer</secondary>
7823 </indexterm>
7824 If an option&#x2019;s type is given as <quote>integer</quote>, the value can be given in decimal,
7825 hexadecimal, or octal. If it starts with a digit greater than zero, a decimal
7826 number is assumed. Otherwise, it is treated as an octal number unless it starts
7827 with the characters <quote>0x</quote>, in which case the remainder is interpreted as a
7828 hexadecimal number.
7829 </para>
7830 <para>
7831 If an integer value is followed by the letter K, it is multiplied by 1024; if
7832 it is followed by the letter M, it is multiplied by 1024x1024. When the values
7833 of integer option settings are output, values which are an exact multiple of
7834 1024 or 1024x1024 are sometimes, but not always, printed using the letters K
7835 and M. The printing style is independent of the actual input format that was
7836 used.
7837 </para>
7838 </section>
7839 <section id="SECID49">
7840 <title>Octal integer values</title>
7841 <para>
7842 <indexterm role="concept">
7843 <primary>integer format</primary>
7844 </indexterm>
7845 <indexterm role="concept">
7846 <primary>format</primary>
7847 <secondary>octal integer</secondary>
7848 </indexterm>
7849 If an option&#x2019;s type is given as <quote>octal integer</quote>, its value is always
7850 interpreted as an octal number, whether or not it starts with the digit zero.
7851 Such options are always output in octal.
7852 </para>
7853 </section>
7854 <section id="SECID50">
7855 <title>Fixed point numbers</title>
7856 <para>
7857 <indexterm role="concept">
7858 <primary>fixed point configuration values</primary>
7859 </indexterm>
7860 <indexterm role="concept">
7861 <primary>format</primary>
7862 <secondary>fixed point</secondary>
7863 </indexterm>
7864 If an option&#x2019;s type is given as <quote>fixed-point</quote>, its value must be a decimal
7865 integer, optionally followed by a decimal point and up to three further digits.
7866 </para>
7867 </section>
7868 <section id="SECTtimeformat">
7869 <title>Time intervals</title>
7870 <para>
7871 <indexterm role="concept">
7872 <primary>time interval</primary>
7873 <secondary>specifying in configuration</secondary>
7874 </indexterm>
7875 <indexterm role="concept">
7876 <primary>format</primary>
7877 <secondary>time interval</secondary>
7878 </indexterm>
7879 A time interval is specified as a sequence of numbers, each followed by one of
7880 the following letters, with no intervening white space:
7881 </para>
7882 <informaltable frame="none">
7883 <tgroup cols="2" colsep="0" rowsep="0">
7884 <colspec colwidth="30pt" align="left"/>
7885 <colspec colwidth="254pt" align="left"/>
7886 <tbody>
7887 <row>
7888 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<option>s</option></entry>
7889 <entry>seconds</entry>
7890 </row>
7891 <row>
7892 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<option>m</option></entry>
7893 <entry>minutes</entry>
7894 </row>
7895 <row>
7896 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<option>h</option></entry>
7897 <entry>hours</entry>
7898 </row>
7899 <row>
7900 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<option>d</option></entry>
7901 <entry>days</entry>
7902 </row>
7903 <row>
7904 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<option>w</option></entry>
7905 <entry>weeks</entry>
7906 </row>
7907 </tbody>
7908 </tgroup>
7909 </informaltable>
7910 <para>
7911 For example, <quote>3h50m</quote> specifies 3 hours and 50 minutes. The values of time
7912 intervals are output in the same format. Exim does not restrict the values; it
7913 is perfectly acceptable, for example, to specify <quote>90m</quote> instead of <quote>1h30m</quote>.
7914 </para>
7915 </section>
7916 <section id="SECTstrings">
7917 <title>String values</title>
7918 <para>
7919 <indexterm role="concept">
7920 <primary>string</primary>
7921 <secondary>format of configuration values</secondary>
7922 </indexterm>
7923 <indexterm role="concept">
7924 <primary>format</primary>
7925 <secondary>string</secondary>
7926 </indexterm>
7927 If an option&#x2019;s type is specified as <quote>string</quote>, the value can be specified with
7928 or without double-quotes. If it does not start with a double-quote, the value
7929 consists of the remainder of the line plus any continuation lines, starting at
7930 the first character after any leading white space, with trailing white space
7931 removed, and with no interpretation of the characters in the string. Because
7932 Exim removes comment lines (those beginning with #) at an early stage, they can
7933 appear in the middle of a multi-line string. The following two settings are
7934 therefore equivalent:
7935 </para>
7936 <literallayout class="monospaced">
7937 trusted_users = uucp:mail
7938 trusted_users = uucp:\
7939                 # This comment line is ignored
7940                 mail
7941 </literallayout>
7942 <para>
7943 <indexterm role="concept">
7944 <primary>string</primary>
7945 <secondary>quoted</secondary>
7946 </indexterm>
7947 <indexterm role="concept">
7948 <primary>escape characters in quoted strings</primary>
7949 </indexterm>
7950 If a string does start with a double-quote, it must end with a closing
7951 double-quote, and any backslash characters other than those used for line
7952 continuation are interpreted as escape characters, as follows:
7953 </para>
7954 <informaltable frame="none">
7955 <tgroup cols="2" colsep="0" rowsep="0">
7956 <colspec colwidth="100pt" align="left"/>
7957 <colspec colwidth="254pt" align="left"/>
7958 <tbody>
7959 <row>
7960 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<literal>\\</literal></entry>
7961 <entry>single backslash</entry>
7962 </row>
7963 <row>
7964 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<literal>\n</literal></entry>
7965 <entry>newline</entry>
7966 </row>
7967 <row>
7968 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<literal>\r</literal></entry>
7969 <entry>carriage return</entry>
7970 </row>
7971 <row>
7972 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<literal>\t</literal></entry>
7973 <entry>tab</entry>
7974 </row>
7975 <row>
7976 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<literal>\</literal>&lt;<emphasis>octal digits</emphasis>&gt;</entry>
7977 <entry>up to 3 octal digits specify one character</entry>
7978 </row>
7979 <row>
7980 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<literal>\x</literal>&lt;<emphasis>hex digits</emphasis>&gt;</entry>
7981 <entry>up to 2 hexadecimal digits specify one character</entry>
7982 </row>
7983 </tbody>
7984 </tgroup>
7985 </informaltable>
7986 <para>
7987 If a backslash is followed by some other character, including a double-quote
7988 character, that character replaces the pair.
7989 </para>
7990 <para>
7991 Quoting is necessary only if you want to make use of the backslash escapes to
7992 insert special characters, or if you need to specify a value with leading or
7993 trailing spaces. These cases are rare, so quoting is almost never needed in
7994 current versions of Exim. In versions of Exim before 3.14, quoting was required
7995 in order to continue lines, so you may come across older configuration files
7996 and examples that apparently quote unnecessarily.
7997 </para>
7998 </section>
7999 <section id="SECID51">
8000 <title>Expanded strings</title>
8001 <para>
8002 <indexterm role="concept">
8003 <primary>expansion</primary>
8004 <secondary>definition of</secondary>
8005 </indexterm>
8006 Some strings in the configuration file are subjected to <emphasis>string expansion</emphasis>,
8007 by which means various parts of the string may be changed according to the
8008 circumstances (see chapter <xref linkend="CHAPexpand"/>). The input syntax for such strings
8009 is as just described; in particular, the handling of backslashes in quoted
8010 strings is done as part of the input process, before expansion takes place.
8011 However, backslash is also an escape character for the expander, so any
8012 backslashes that are required for that reason must be doubled if they are
8013 within a quoted configuration string.
8014 </para>
8015 </section>
8016 <section id="SECID52">
8017 <title>User and group names</title>
8018 <para>
8019 <indexterm role="concept">
8020 <primary>user name</primary>
8021 <secondary>format of</secondary>
8022 </indexterm>
8023 <indexterm role="concept">
8024 <primary>format</primary>
8025 <secondary>user name</secondary>
8026 </indexterm>
8027 <indexterm role="concept">
8028 <primary>groups</primary>
8029 <secondary>name format</secondary>
8030 </indexterm>
8031 <indexterm role="concept">
8032 <primary>format</primary>
8033 <secondary>group name</secondary>
8034 </indexterm>
8035 User and group names are specified as strings, using the syntax described
8036 above, but the strings are interpreted specially. A user or group name must
8037 either consist entirely of digits, or be a name that can be looked up using the
8038 <function>getpwnam()</function> or <function>getgrnam()</function> function, as appropriate.
8039 </para>
8040 </section>
8041 <section id="SECTlistconstruct">
8042 <title>List construction</title>
8043 <para>
8044 <indexterm role="concept">
8045 <primary>list</primary>
8046 <secondary>syntax of in configuration</secondary>
8047 </indexterm>
8048 <indexterm role="concept">
8049 <primary>format</primary>
8050 <secondary>list item in configuration</secondary>
8051 </indexterm>
8052 <indexterm role="concept">
8053 <primary>string</primary>
8054 <secondary>list, definition of</secondary>
8055 </indexterm>
8056 The data for some configuration options is a list of items, with colon as the
8057 default separator. Many of these options are shown with type <quote>string list</quote> in
8058 the descriptions later in this document. Others are listed as <quote>domain list</quote>,
8059 <quote>host list</quote>, <quote>address list</quote>, or <quote>local part list</quote>. Syntactically, they
8060 are all the same; however, those other than <quote>string list</quote> are subject to
8061 particular kinds of interpretation, as described in chapter
8062 <xref linkend="CHAPdomhosaddlists"/>.
8063 </para>
8064 <para>
8065 In all these cases, the entire list is treated as a single string as far as the
8066 input syntax is concerned. The <option>trusted_users</option> setting in section
8067 <xref linkend="SECTstrings"/> above is an example. If a colon is actually needed in an item
8068 in a list, it must be entered as two colons. Leading and trailing white space
8069 on each item in a list is ignored. This makes it possible to include items that
8070 start with a colon, and in particular, certain forms of IPv6 address. For
8071 example, the list
8072 </para>
8073 <literallayout class="monospaced">
8074 local_interfaces = 127.0.0.1 : ::::1
8075 </literallayout>
8076 <para>
8077 contains two IP addresses, the IPv4 address 127.0.0.1 and the IPv6 address ::1.
8078 </para>
8079 <para>
8080 <emphasis role="bold">Note</emphasis>: Although leading and trailing white space is ignored in individual
8081 list items, it is not ignored when parsing the list. The space after the first
8082 colon in the example above is necessary. If it were not there, the list would
8083 be interpreted as the two items 127.0.0.1:: and 1.
8084 </para>
8085 </section>
8086 <section id="SECTlistsepchange">
8087 <title>Changing list separators</title>
8088 <para>
8089 <indexterm role="concept">
8090 <primary>list separator</primary>
8091 <secondary>changing</secondary>
8092 </indexterm>
8093 <indexterm role="concept">
8094 <primary>IPv6</primary>
8095 <secondary>addresses in lists</secondary>
8096 </indexterm>
8097 Doubling colons in IPv6 addresses is an unwelcome chore, so a mechanism was
8098 introduced to allow the separator character to be changed. If a list begins
8099 with a left angle bracket, followed by any punctuation character, that
8100 character is used instead of colon as the list separator. For example, the list
8101 above can be rewritten to use a semicolon separator like this:
8102 </para>
8103 <literallayout class="monospaced">
8104 local_interfaces = &lt;; 127.0.0.1 ; ::1
8105 </literallayout>
8106 <para>
8107 This facility applies to all lists, with the exception of the list in
8108 <option>log_file_path</option>. It is recommended that the use of non-colon separators be
8109 confined to circumstances where they really are needed.
8110 </para>
8111 <para>
8112 <indexterm role="concept">
8113 <primary>list separator</primary>
8114 <secondary>newline as</secondary>
8115 </indexterm>
8116 <indexterm role="concept">
8117 <primary>newline</primary>
8118 <secondary>as list separator</secondary>
8119 </indexterm>
8120 It is also possible to use newline and other control characters (those with
8121 code values less than 32, plus DEL) as separators in lists. Such separators
8122 must be provided literally at the time the list is processed. For options that
8123 are string-expanded, you can write the separator using a normal escape
8124 sequence. This will be processed by the expander before the string is
8125 interpreted as a list. For example, if a newline-separated list of domains is
8126 generated by a lookup, you can process it directly by a line such as this:
8127 </para>
8128 <literallayout class="monospaced">
8129 domains = &lt;\n ${lookup mysql{.....}}
8130 </literallayout>
8131 <para>
8132 This avoids having to change the list separator in such data. You are unlikely
8133 to want to use a control character as a separator in an option that is not
8134 expanded, because the value is literal text. However, it can be done by giving
8135 the value in quotes. For example:
8136 </para>
8137 <literallayout class="monospaced">
8138 local_interfaces = "&lt;\n 127.0.0.1 \n ::1"
8139 </literallayout>
8140 <para>
8141 Unlike printing character separators, which can be included in list items by
8142 doubling, it is not possible to include a control character as data when it is
8143 set as the separator. Two such characters in succession are interpreted as
8144 enclosing an empty list item.
8145 </para>
8146 </section>
8147 <section id="SECTempitelis">
8148 <title>Empty items in lists</title>
8149 <para>
8150 <indexterm role="concept">
8151 <primary>list</primary>
8152 <secondary>empty item in</secondary>
8153 </indexterm>
8154 An empty item at the end of a list is always ignored. In other words, trailing
8155 separator characters are ignored. Thus, the list in
8156 </para>
8157 <literallayout class="monospaced">
8158 senders = user@domain :
8159 </literallayout>
8160 <para>
8161 contains only a single item. If you want to include an empty string as one item
8162 in a list, it must not be the last item. For example, this list contains three
8163 items, the second of which is empty:
8164 </para>
8165 <literallayout class="monospaced">
8166 senders = user1@domain : : user2@domain
8167 </literallayout>
8168 <para>
8169 <emphasis role="bold">Note</emphasis>: There must be white space between the two colons, as otherwise they
8170 are interpreted as representing a single colon data character (and the list
8171 would then contain just one item). If you want to specify a list that contains
8172 just one, empty item, you can do it as in this example:
8173 </para>
8174 <literallayout class="monospaced">
8175 senders = :
8176 </literallayout>
8177 <para>
8178 In this case, the first item is empty, and the second is discarded because it
8179 is at the end of the list.
8180 </para>
8181 </section>
8182 <section id="SECTfordricon">
8183 <title>Format of driver configurations</title>
8184 <para>
8185 <indexterm role="concept">
8186 <primary>drivers</primary>
8187 <secondary>configuration format</secondary>
8188 </indexterm>
8189 There are separate parts in the configuration for defining routers, transports,
8190 and authenticators. In each part, you are defining a number of driver
8191 instances, each with its own set of options. Each driver instance is defined by
8192 a sequence of lines like this:
8193 </para>
8194 <literallayout>
8195 &lt;<emphasis>instance name</emphasis>&gt;:
8196   &lt;<emphasis>option</emphasis>&gt;
8197   ...
8198   &lt;<emphasis>option</emphasis>&gt;
8199 </literallayout>
8200 <para>
8201 In the following example, the instance name is <command>localuser</command>, and it is
8202 followed by three options settings:
8203 </para>
8204 <literallayout class="monospaced">
8205 localuser:
8206   driver = accept
8207   check_local_user
8208   transport = local_delivery
8209 </literallayout>
8210 <para>
8211 For each driver instance, you specify which Exim code module it uses &ndash; by the
8212 setting of the <option>driver</option> option &ndash; and (optionally) some configuration
8213 settings. For example, in the case of transports, if you want a transport to
8214 deliver with SMTP you would use the <command>smtp</command> driver; if you want to deliver to
8215 a local file you would use the <command>appendfile</command> driver. Each of the drivers is
8216 described in detail in its own separate chapter later in this manual.
8217 </para>
8218 <para>
8219 You can have several routers, transports, or authenticators that are based on
8220 the same underlying driver (each must have a different instance name).
8221 </para>
8222 <para>
8223 The order in which routers are defined is important, because addresses are
8224 passed to individual routers one by one, in order. The order in which
8225 transports are defined does not matter at all. The order in which
8226 authenticators are defined is used only when Exim, as a client, is searching
8227 them to find one that matches an authentication mechanism offered by the
8228 server.
8229 </para>
8230 <para>
8231 <indexterm role="concept">
8232 <primary>generic options</primary>
8233 </indexterm>
8234 <indexterm role="concept">
8235 <primary>options</primary>
8236 <secondary>generic &ndash; definition of</secondary>
8237 </indexterm>
8238 Within a driver instance definition, there are two kinds of option: <emphasis>generic</emphasis>
8239 and <emphasis>private</emphasis>. The generic options are those that apply to all drivers of the
8240 same type (that is, all routers, all transports or all authenticators). The
8241 <option>driver</option> option is a generic option that must appear in every definition.
8242 <indexterm role="concept">
8243 <primary>private options</primary>
8244 </indexterm>
8245 The private options are special for each driver, and none need appear, because
8246 they all have default values.
8247 </para>
8248 <para>
8249 The options may appear in any order, except that the <option>driver</option> option must
8250 precede any private options, since these depend on the particular driver. For
8251 this reason, it is recommended that <option>driver</option> always be the first option.
8252 </para>
8253 <para>
8254 Driver instance names, which are used for reference in log entries and
8255 elsewhere, can be any sequence of letters, digits, and underscores (starting
8256 with a letter) and must be unique among drivers of the same type. A router and
8257 a transport (for example) can each have the same name, but no two router
8258 instances can have the same name. The name of a driver instance should not be
8259 confused with the name of the underlying driver module. For example, the
8260 configuration lines:
8261 </para>
8262 <literallayout class="monospaced">
8263 remote_smtp:
8264   driver = smtp
8265 </literallayout>
8266 <para>
8267 create an instance of the <command>smtp</command> transport driver whose name is
8268 <command>remote_smtp</command>. The same driver code can be used more than once, with
8269 different instance names and different option settings each time. A second
8270 instance of the <command>smtp</command> transport, with different options, might be defined
8271 thus:
8272 </para>
8273 <literallayout class="monospaced">
8274 special_smtp:
8275   driver = smtp
8276   port = 1234
8277   command_timeout = 10s
8278 </literallayout>
8279 <para>
8280 The names <command>remote_smtp</command> and <command>special_smtp</command> would be used to reference
8281 these transport instances from routers, and these names would appear in log
8282 lines.
8283 </para>
8284 <para>
8285 Comment lines may be present in the middle of driver specifications. The full
8286 list of option settings for any particular driver instance, including all the
8287 defaulted values, can be extracted by making use of the <option>-bP</option> command line
8288 option.
8289 </para>
8290 </section>
8291 </chapter>
8292
8293 <chapter id="CHAPdefconfil">
8294 <title>The default configuration file</title>
8295 <para>
8296 <indexterm role="concept" id="IIDconfiwal" class="startofrange">
8297 <primary>configuration file</primary>
8298 <secondary>default <quote>walk through</quote></secondary>
8299 </indexterm>
8300 <indexterm role="concept">
8301 <primary>default</primary>
8302 <secondary>configuration file <quote>walk through</quote></secondary>
8303 </indexterm>
8304 The default configuration file supplied with Exim as <filename>src/configure.default</filename>
8305 is sufficient for a host with simple mail requirements. As an introduction to
8306 the way Exim is configured, this chapter <quote>walks through</quote> the default
8307 configuration, giving brief explanations of the settings. Detailed descriptions
8308 of the options are given in subsequent chapters. The default configuration file
8309 itself contains extensive comments about ways you might want to modify the
8310 initial settings. However, note that there are many options that are not
8311 mentioned at all in the default configuration.
8312 </para>
8313 <section id="SECTdefconfmain">
8314 <title>Main configuration settings</title>
8315 <para>
8316 The main (global) configuration option settings must always come first in the
8317 file. The first thing you&#x2019;ll see in the file, after some initial comments, is
8318 the line
8319 </para>
8320 <literallayout class="monospaced">
8321 # primary_hostname =
8322 </literallayout>
8323 <para>
8324 This is a commented-out setting of the <option>primary_hostname</option> option. Exim needs
8325 to know the official, fully qualified name of your host, and this is where you
8326 can specify it. However, in most cases you do not need to set this option. When
8327 it is unset, Exim uses the <function>uname()</function> system function to obtain the host name.
8328 </para>
8329 <para>
8330 The first three non-comment configuration lines are as follows:
8331 </para>
8332 <literallayout class="monospaced">
8333 domainlist local_domains    = @
8334 domainlist relay_to_domains =
8335 hostlist   relay_from_hosts = 127.0.0.1
8336 </literallayout>
8337 <para>
8338 These are not, in fact, option settings. They are definitions of two named
8339 domain lists and one named host list. Exim allows you to give names to lists of
8340 domains, hosts, and email addresses, in order to make it easier to manage the
8341 configuration file (see section <xref linkend="SECTnamedlists"/>).
8342 </para>
8343 <para>
8344 The first line defines a domain list called <emphasis>local_domains</emphasis>; this is used
8345 later in the configuration to identify domains that are to be delivered
8346 on the local host.
8347 </para>
8348 <para>
8349 <indexterm role="concept">
8350 <primary>@ in a domain list</primary>
8351 </indexterm>
8352 There is just one item in this list, the string <quote>@</quote>. This is a special form
8353 of entry which means <quote>the name of the local host</quote>. Thus, if the local host is
8354 called <emphasis>a.host.example</emphasis>, mail to <emphasis>any.user@a.host.example</emphasis> is expected to
8355 be delivered locally. Because the local host&#x2019;s name is referenced indirectly,
8356 the same configuration file can be used on different hosts.
8357 </para>
8358 <para>
8359 The second line defines a domain list called <emphasis>relay_to_domains</emphasis>, but the
8360 list itself is empty. Later in the configuration we will come to the part that
8361 controls mail relaying through the local host; it allows relaying to any
8362 domains in this list. By default, therefore, no relaying on the basis of a mail
8363 domain is permitted.
8364 </para>
8365 <para>
8366 The third line defines a host list called <emphasis>relay_from_hosts</emphasis>. This list is
8367 used later in the configuration to permit relaying from any host or IP address
8368 that matches the list. The default contains just the IP address of the IPv4
8369 loopback interface, which means that processes on the local host are able to
8370 submit mail for relaying by sending it over TCP/IP to that interface. No other
8371 hosts are permitted to submit messages for relaying.
8372 </para>
8373 <para>
8374 Just to be sure there&#x2019;s no misunderstanding: at this point in the configuration
8375 we aren&#x2019;t actually setting up any controls. We are just defining some domains
8376 and hosts that will be used in the controls that are specified later.
8377 </para>
8378 <para>
8379 The next two configuration lines are genuine option settings:
8380 </para>
8381 <literallayout class="monospaced">
8382 acl_smtp_rcpt = acl_check_rcpt
8383 acl_smtp_data = acl_check_data
8384 </literallayout>
8385 <para>
8386 These options specify <emphasis>Access Control Lists</emphasis> (ACLs) that are to be used
8387 during an incoming SMTP session for every recipient of a message (every RCPT
8388 command), and after the contents of the message have been received,
8389 respectively. The names of the lists are <emphasis>acl_check_rcpt</emphasis> and
8390 <emphasis>acl_check_data</emphasis>, and we will come to their definitions below, in the ACL
8391 section of the configuration. The RCPT ACL controls which recipients are
8392 accepted for an incoming message &ndash; if a configuration does not provide an ACL
8393 to check recipients, no SMTP mail can be accepted. The DATA ACL allows the
8394 contents of a message to be checked.
8395 </para>
8396 <para>
8397 Two commented-out option settings are next:
8398 </para>
8399 <literallayout class="monospaced">
8400 # av_scanner = clamd:/tmp/clamd
8401 # spamd_address = 127.0.0.1 783
8402 </literallayout>
8403 <para>
8404 These are example settings that can be used when Exim is compiled with the
8405 content-scanning extension. The first specifies the interface to the virus
8406 scanner, and the second specifies the interface to SpamAssassin. Further
8407 details are given in chapter <xref linkend="CHAPexiscan"/>.
8408 </para>
8409 <para>
8410 Three more commented-out option settings follow:
8411 </para>
8412 <literallayout class="monospaced">
8413 # tls_advertise_hosts = *
8414 # tls_certificate = /etc/ssl/exim.crt
8415 # tls_privatekey = /etc/ssl/exim.pem
8416 </literallayout>
8417 <para>
8418 These are example settings that can be used when Exim is compiled with
8419 support for TLS (aka SSL) as described in section <xref linkend="SECTinctlsssl"/>. The
8420 first one specifies the list of clients that are allowed to use TLS when
8421 connecting to this server; in this case the wildcard means all clients. The
8422 other options specify where Exim should find its TLS certificate and private
8423 key, which together prove the server&#x2019;s identity to any clients that connect.
8424 More details are given in chapter <xref linkend="CHAPTLS"/>.
8425 </para>
8426 <para>
8427 Another two commented-out option settings follow:
8428 </para>
8429 <literallayout class="monospaced">
8430 # daemon_smtp_ports = 25 : 465 : 587
8431 # tls_on_connect_ports = 465
8432 </literallayout>
8433 <para>
8434 <indexterm role="concept">
8435 <primary>port</primary>
8436 <secondary>465 and 587</secondary>
8437 </indexterm>
8438 <indexterm role="concept">
8439 <primary>port</primary>
8440 <secondary>for message submission</secondary>
8441 </indexterm>
8442 <indexterm role="concept">
8443 <primary>message</primary>
8444 <secondary>submission, ports for</secondary>
8445 </indexterm>
8446 <indexterm role="concept">
8447 <primary>ssmtp protocol</primary>
8448 </indexterm>
8449 <indexterm role="concept">
8450 <primary>smtps protocol</primary>
8451 </indexterm>
8452 <indexterm role="concept">
8453 <primary>SMTP</primary>
8454 <secondary>ssmtp protocol</secondary>
8455 </indexterm>
8456 <indexterm role="concept">
8457 <primary>SMTP</primary>
8458 <secondary>smtps protocol</secondary>
8459 </indexterm>
8460 These options provide better support for roaming users who wish to use this
8461 server for message submission. They are not much use unless you have turned on
8462 TLS (as described in the previous paragraph) and authentication (about which
8463 more in section <xref linkend="SECTdefconfauth"/>). The usual SMTP port 25 is often blocked
8464 on end-user networks, so RFC 4409 specifies that message submission should use
8465 port 587 instead. However some software (notably Microsoft Outlook) cannot be
8466 configured to use port 587 correctly, so these settings also enable the
8467 non-standard <quote>smtps</quote> (aka <quote>ssmtp</quote>) port 465 (see section
8468 <xref linkend="SECTsupobssmt"/>).
8469 </para>
8470 <para>
8471 Two more commented-out options settings follow:
8472 </para>
8473 <literallayout class="monospaced">
8474 # qualify_domain =
8475 # qualify_recipient =
8476 </literallayout>
8477 <para>
8478 The first of these specifies a domain that Exim uses when it constructs a
8479 complete email address from a local login name. This is often needed when Exim
8480 receives a message from a local process. If you do not set <option>qualify_domain</option>,
8481 the value of <option>primary_hostname</option> is used. If you set both of these options,
8482 you can have different qualification domains for sender and recipient
8483 addresses. If you set only the first one, its value is used in both cases.
8484 </para>
8485 <para>
8486 <indexterm role="concept">
8487 <primary>domain literal</primary>
8488 <secondary>recognizing format</secondary>
8489 </indexterm>
8490 The following line must be uncommented if you want Exim to recognize
8491 addresses of the form <emphasis>user@[10.11.12.13]</emphasis> that is, with a <quote>domain literal</quote>
8492 (an IP address within square brackets) instead of a named domain.
8493 </para>
8494 <literallayout class="monospaced">
8495 # allow_domain_literals
8496 </literallayout>
8497 <para>
8498 The RFCs still require this form, but many people think that in the modern
8499 Internet it makes little sense to permit mail to be sent to specific hosts by
8500 quoting their IP addresses. This ancient format has been used by people who
8501 try to abuse hosts by using them for unwanted relaying. However, some
8502 people believe there are circumstances (for example, messages addressed to
8503 <emphasis>postmaster</emphasis>) where domain literals are still useful.
8504 </para>
8505 <para>
8506 The next configuration line is a kind of trigger guard:
8507 </para>
8508 <literallayout class="monospaced">
8509 never_users = root
8510 </literallayout>
8511 <para>
8512 It specifies that no delivery must ever be run as the root user. The normal
8513 convention is to set up <emphasis>root</emphasis> as an alias for the system administrator. This
8514 setting is a guard against slips in the configuration.
8515 The list of users specified by <option>never_users</option> is not, however, the complete
8516 list; the build-time configuration in <filename>Local/Makefile</filename> has an option called
8517 FIXED_NEVER_USERS specifying a list that cannot be overridden. The
8518 contents of <option>never_users</option> are added to this list. By default
8519 FIXED_NEVER_USERS also specifies root.
8520 </para>
8521 <para>
8522 When a remote host connects to Exim in order to send mail, the only information
8523 Exim has about the host&#x2019;s identity is its IP address. The next configuration
8524 line,
8525 </para>
8526 <literallayout class="monospaced">
8527 host_lookup = *
8528 </literallayout>
8529 <para>
8530 specifies that Exim should do a reverse DNS lookup on all incoming connections,
8531 in order to get a host name. This improves the quality of the logging
8532 information, but if you feel it is too expensive, you can remove it entirely,
8533 or restrict the lookup to hosts on <quote>nearby</quote> networks.
8534 Note that it is not always possible to find a host name from an IP address,
8535 because not all DNS reverse zones are maintained, and sometimes DNS servers are
8536 unreachable.
8537 </para>
8538 <para>
8539 The next two lines are concerned with <emphasis>ident</emphasis> callbacks, as defined by RFC
8540 1413 (hence their names):
8541 </para>
8542 <literallayout class="monospaced">
8543 rfc1413_hosts = *
8544 rfc1413_query_timeout = 0s
8545 </literallayout>
8546 <para>
8547 These settings cause Exim to avoid ident callbacks for all incoming SMTP calls.
8548 Few hosts offer RFC1413 service these days; calls have to be
8549 terminated by a timeout and this needlessly delays the startup
8550 of an incoming SMTP connection.
8551 If you have hosts for which you trust RFC1413 and need this
8552 information, you can change this.
8553 </para>
8554 <para>
8555 This line enables an efficiency SMTP option.  It is negotiated by clients
8556 and not expected to cause problems but can be disabled if needed.
8557 </para>
8558 <literallayout class="monospaced">
8559 prdr_enable = true
8560 </literallayout>
8561 <para>
8562 When Exim receives messages over SMTP connections, it expects all addresses to
8563 be fully qualified with a domain, as required by the SMTP definition. However,
8564 if you are running a server to which simple clients submit messages, you may
8565 find that they send unqualified addresses. The two commented-out options:
8566 </para>
8567 <literallayout class="monospaced">
8568 # sender_unqualified_hosts =
8569 # recipient_unqualified_hosts =
8570 </literallayout>
8571 <para>
8572 show how you can specify hosts that are permitted to send unqualified sender
8573 and recipient addresses, respectively.
8574 </para>
8575 <para revisionflag="changed">
8576 The <option>log_selector</option> option is used to increase the detail of logging
8577 over the default:
8578 </para>
8579 <literallayout class="monospaced" revisionflag="changed">
8580 log_selector = +smtp_protocol_error +smtp_syntax_error \
8581                +tls_certificate_verified
8582 </literallayout>
8583 <para>
8584 The <option>percent_hack_domains</option> option is also commented out:
8585 </para>
8586 <literallayout class="monospaced">
8587 # percent_hack_domains =
8588 </literallayout>
8589 <para>
8590 It provides a list of domains for which the <quote>percent hack</quote> is to operate.
8591 This is an almost obsolete form of explicit email routing. If you do not know
8592 anything about it, you can safely ignore this topic.
8593 </para>
8594 <para>
8595 The last two settings in the main part of the default configuration are
8596 concerned with messages that have been <quote>frozen</quote> on Exim&#x2019;s queue. When a
8597 message is frozen, Exim no longer continues to try to deliver it. Freezing
8598 occurs when a bounce message encounters a permanent failure because the sender
8599 address of the original message that caused the bounce is invalid, so the
8600 bounce cannot be delivered. This is probably the most common case, but there
8601 are also other conditions that cause freezing, and frozen messages are not
8602 always bounce messages.
8603 </para>
8604 <literallayout class="monospaced">
8605 ignore_bounce_errors_after = 2d
8606 timeout_frozen_after = 7d
8607 </literallayout>
8608 <para>
8609 The first of these options specifies that failing bounce messages are to be
8610 discarded after 2 days on the queue. The second specifies that any frozen
8611 message (whether a bounce message or not) is to be timed out (and discarded)
8612 after a week. In this configuration, the first setting ensures that no failing
8613 bounce message ever lasts a week.
8614 </para>
8615 </section>
8616 <section id="SECID54">
8617 <title>ACL configuration</title>
8618 <para>
8619 <indexterm role="concept">
8620 <primary>default</primary>
8621 <secondary>ACLs</secondary>
8622 </indexterm>
8623 <indexterm role="concept">
8624 <primary>access control lists (ACLs)</primary>
8625 <secondary>default configuration</secondary>
8626 </indexterm>
8627 In the default configuration, the ACL section follows the main configuration.
8628 It starts with the line
8629 </para>
8630 <literallayout class="monospaced">
8631 begin acl
8632 </literallayout>
8633 <para>
8634 and it contains the definitions of two ACLs, called <emphasis>acl_check_rcpt</emphasis> and
8635 <emphasis>acl_check_data</emphasis>, that were referenced in the settings of <option>acl_smtp_rcpt</option>
8636 and <option>acl_smtp_data</option> above.
8637 </para>
8638 <para>
8639 <indexterm role="concept">
8640 <primary>RCPT</primary>
8641 <secondary>ACL for</secondary>
8642 </indexterm>
8643 The first ACL is used for every RCPT command in an incoming SMTP message. Each
8644 RCPT command specifies one of the message&#x2019;s recipients. The ACL statements
8645 are considered in order, until the recipient address is either accepted or
8646 rejected. The RCPT command is then accepted or rejected, according to the
8647 result of the ACL processing.
8648 </para>
8649 <literallayout class="monospaced">
8650 acl_check_rcpt:
8651 </literallayout>
8652 <para>
8653 This line, consisting of a name terminated by a colon, marks the start of the
8654 ACL, and names it.
8655 </para>
8656 <literallayout class="monospaced">
8657 accept  hosts = :
8658 </literallayout>
8659 <para>
8660 This ACL statement accepts the recipient if the sending host matches the list.
8661 But what does that strange list mean? It doesn&#x2019;t actually contain any host
8662 names or IP addresses. The presence of the colon puts an empty item in the
8663 list; Exim matches this only if the incoming message did not come from a remote
8664 host, because in that case, the remote hostname is empty. The colon is
8665 important. Without it, the list itself is empty, and can never match anything.
8666 </para>
8667 <para>
8668 What this statement is doing is to accept unconditionally all recipients in
8669 messages that are submitted by SMTP from local processes using the standard
8670 input and output (that is, not using TCP/IP). A number of MUAs operate in this
8671 manner.
8672 </para>
8673 <literallayout class="monospaced">
8674 deny    message       = Restricted characters in address
8675         domains       = +local_domains
8676         local_parts   = ^[.] : ^.*[@%!/|]
8677
8678 deny    message       = Restricted characters in address
8679         domains       = !+local_domains
8680         local_parts   = ^[./|] : ^.*[@%!] : ^.*/\\.\\./
8681 </literallayout>
8682 <para>
8683 These statements are concerned with local parts that contain any of the
8684 characters <quote>@</quote>, <quote>%</quote>, <quote>!</quote>, <quote>/</quote>, <quote>|</quote>, or dots in unusual places.
8685 Although these characters are entirely legal in local parts (in the case of
8686 <quote>@</quote> and leading dots, only if correctly quoted), they do not commonly occur
8687 in Internet mail addresses.
8688 </para>
8689 <para>
8690 The first three have in the past been associated with explicitly routed
8691 addresses (percent is still sometimes used &ndash; see the <option>percent_hack_domains</option>
8692 option). Addresses containing these characters are regularly tried by spammers
8693 in an attempt to bypass relaying restrictions, and also by open relay testing
8694 programs. Unless you really need them it is safest to reject these characters
8695 at this early stage. This configuration is heavy-handed in rejecting these
8696 characters for all messages it accepts from remote hosts. This is a deliberate
8697 policy of being as safe as possible.
8698 </para>
8699 <para>
8700 The first rule above is stricter, and is applied to messages that are addressed
8701 to one of the local domains handled by this host. This is implemented by the
8702 first condition, which restricts it to domains that are listed in the
8703 <emphasis>local_domains</emphasis> domain list. The <quote>+</quote> character is used to indicate a
8704 reference to a named list. In this configuration, there is just one domain in
8705 <emphasis>local_domains</emphasis>, but in general there may be many.
8706 </para>
8707 <para>
8708 The second condition on the first statement uses two regular expressions to
8709 block local parts that begin with a dot or contain <quote>@</quote>, <quote>%</quote>, <quote>!</quote>, <quote>/</quote>,
8710 or <quote>|</quote>. If you have local accounts that include these characters, you will
8711 have to modify this rule.
8712 </para>
8713 <para>
8714 Empty components (two dots in a row) are not valid in RFC 2822, but Exim
8715 allows them because they have been encountered in practice. (Consider the
8716 common convention of local parts constructed as
8717 <quote><emphasis>first-initial.second-initial.family-name</emphasis></quote> when applied to someone like
8718 the author of Exim, who has no second initial.) However, a local part starting
8719 with a dot or containing <quote>/../</quote> can cause trouble if it is used as part of a
8720 file name (for example, for a mailing list). This is also true for local parts
8721 that contain slashes. A pipe symbol can also be troublesome if the local part
8722 is incorporated unthinkingly into a shell command line.
8723 </para>
8724 <para>
8725 The second rule above applies to all other domains, and is less strict. This
8726 allows your own users to send outgoing messages to sites that use slashes
8727 and vertical bars in their local parts. It blocks local parts that begin
8728 with a dot, slash, or vertical bar, but allows these characters within the
8729 local part. However, the sequence <quote>/../</quote> is barred. The use of <quote>@</quote>, <quote>%</quote>,
8730 and <quote>!</quote> is blocked, as before. The motivation here is to prevent your users
8731 (or your users&#x2019; viruses) from mounting certain kinds of attack on remote sites.
8732 </para>
8733 <literallayout class="monospaced">
8734 accept  local_parts   = postmaster
8735         domains       = +local_domains
8736 </literallayout>
8737 <para>
8738 This statement, which has two conditions, accepts an incoming address if the
8739 local part is <emphasis>postmaster</emphasis> and the domain is one of those listed in the
8740 <emphasis>local_domains</emphasis> domain list. The <quote>+</quote> character is used to indicate a
8741 reference to a named list. In this configuration, there is just one domain in
8742 <emphasis>local_domains</emphasis>, but in general there may be many.
8743 </para>
8744 <para>
8745 The presence of this statement means that mail to postmaster is never blocked
8746 by any of the subsequent tests. This can be helpful while sorting out problems
8747 in cases where the subsequent tests are incorrectly denying access.
8748 </para>
8749 <literallayout class="monospaced">
8750 require verify        = sender
8751 </literallayout>
8752 <para>
8753 This statement requires the sender address to be verified before any subsequent
8754 ACL statement can be used. If verification fails, the incoming recipient
8755 address is refused. Verification consists of trying to route the address, to
8756 see if a bounce message could be delivered to it. In the case of remote
8757 addresses, basic verification checks only the domain, but <emphasis>callouts</emphasis> can be
8758 used for more verification if required. Section <xref linkend="SECTaddressverification"/>
8759 discusses the details of address verification.
8760 </para>
8761 <literallayout class="monospaced">
8762 accept  hosts         = +relay_from_hosts
8763         control       = submission
8764 </literallayout>
8765 <para>
8766 This statement accepts the address if the message is coming from one of the
8767 hosts that are defined as being allowed to relay through this host. Recipient
8768 verification is omitted here, because in many cases the clients are dumb MUAs
8769 that do not cope well with SMTP error responses. For the same reason, the
8770 second line specifies <quote>submission mode</quote> for messages that are accepted. This
8771 is described in detail in section <xref linkend="SECTsubmodnon"/>; it causes Exim to fix
8772 messages that are deficient in some way, for example, because they lack a
8773 <emphasis>Date:</emphasis> header line. If you are actually relaying out from MTAs, you should
8774 probably add recipient verification here, and disable submission mode.
8775 </para>
8776 <literallayout class="monospaced">
8777 accept  authenticated = *
8778         control       = submission
8779 </literallayout>
8780 <para>
8781 This statement accepts the address if the client host has authenticated itself.
8782 Submission mode is again specified, on the grounds that such messages are most
8783 likely to come from MUAs. The default configuration does not define any
8784 authenticators, though it does include some nearly complete commented-out
8785 examples described in <xref linkend="SECTdefconfauth"/>. This means that no client can in
8786 fact authenticate until you complete the authenticator definitions.
8787 </para>
8788 <literallayout class="monospaced">
8789 require message = relay not permitted
8790         domains = +local_domains : +relay_to_domains
8791 </literallayout>
8792 <para>
8793 This statement rejects the address if its domain is neither a local domain nor
8794 one of the domains for which this host is a relay.
8795 </para>
8796 <literallayout class="monospaced">
8797 require verify = recipient
8798 </literallayout>
8799 <para>
8800 This statement requires the recipient address to be verified; if verification
8801 fails, the address is rejected.
8802 </para>
8803 <literallayout class="monospaced">
8804 # deny    message     = rejected because $sender_host_address \
8805 #                       is in a black list at $dnslist_domain\n\
8806 #                       $dnslist_text
8807 #         dnslists    = black.list.example
8808 #
8809 # warn    dnslists    = black.list.example
8810 #         add_header  = X-Warning: $sender_host_address is in \
8811 #                       a black list at $dnslist_domain
8812 #         log_message = found in $dnslist_domain
8813 </literallayout>
8814 <para>
8815 These commented-out lines are examples of how you could configure Exim to check
8816 sending hosts against a DNS black list. The first statement rejects messages
8817 from blacklisted hosts, whereas the second just inserts a warning header
8818 line.
8819 </para>
8820 <literallayout class="monospaced">
8821 # require verify = csa
8822 </literallayout>
8823 <para>
8824 This commented-out line is an example of how you could turn on client SMTP
8825 authorization (CSA) checking. Such checks do DNS lookups for special SRV
8826 records.
8827 </para>
8828 <literallayout class="monospaced">
8829 accept
8830 </literallayout>
8831 <para>
8832 The final statement in the first ACL unconditionally accepts any recipient
8833 address that has successfully passed all the previous tests.
8834 </para>
8835 <literallayout class="monospaced">
8836 acl_check_data:
8837 </literallayout>
8838 <para>
8839 This line marks the start of the second ACL, and names it. Most of the contents
8840 of this ACL are commented out:
8841 </para>
8842 <literallayout class="monospaced">
8843 # deny    malware   = *
8844 #         message   = This message contains a virus \
8845 #                     ($malware_name).
8846 </literallayout>
8847 <para>
8848 These lines are examples of how to arrange for messages to be scanned for
8849 viruses when Exim has been compiled with the content-scanning extension, and a
8850 suitable virus scanner is installed. If the message is found to contain a
8851 virus, it is rejected with the given custom error message.
8852 </para>
8853 <literallayout class="monospaced">
8854 # warn    spam      = nobody
8855 #         message   = X-Spam_score: $spam_score\n\
8856 #                     X-Spam_score_int: $spam_score_int\n\
8857 #                     X-Spam_bar: $spam_bar\n\
8858 #                     X-Spam_report: $spam_report
8859 </literallayout>
8860 <para>
8861 These lines are an example of how to arrange for messages to be scanned by
8862 SpamAssassin when Exim has been compiled with the content-scanning extension,
8863 and SpamAssassin has been installed. The SpamAssassin check is run with
8864 <literal>nobody</literal> as its user parameter, and the results are added to the message as a
8865 series of extra header line. In this case, the message is not rejected,
8866 whatever the spam score.
8867 </para>
8868 <literallayout class="monospaced">
8869 accept
8870 </literallayout>
8871 <para>
8872 This final line in the DATA ACL accepts the message unconditionally.
8873 </para>
8874 </section>
8875 <section id="SECID55">
8876 <title>Router configuration</title>
8877 <para>
8878 <indexterm role="concept">
8879 <primary>default</primary>
8880 <secondary>routers</secondary>
8881 </indexterm>
8882 <indexterm role="concept">
8883 <primary>routers</primary>
8884 <secondary>default</secondary>
8885 </indexterm>
8886 The router configuration comes next in the default configuration, introduced
8887 by the line
8888 </para>
8889 <literallayout class="monospaced">
8890 begin routers
8891 </literallayout>
8892 <para>
8893 Routers are the modules in Exim that make decisions about where to send
8894 messages. An address is passed to each router in turn, until it is either
8895 accepted, or failed. This means that the order in which you define the routers
8896 matters. Each router is fully described in its own chapter later in this
8897 manual. Here we give only brief overviews.
8898 </para>
8899 <literallayout class="monospaced">
8900 # domain_literal:
8901 #   driver = ipliteral
8902 #   domains = !+local_domains
8903 #   transport = remote_smtp
8904 </literallayout>
8905 <para>
8906 <indexterm role="concept">
8907 <primary>domain literal</primary>
8908 <secondary>default router</secondary>
8909 </indexterm>
8910 This router is commented out because the majority of sites do not want to
8911 support domain literal addresses (those of the form <emphasis>user@[10.9.8.7]</emphasis>). If
8912 you uncomment this router, you also need to uncomment the setting of
8913 <option>allow_domain_literals</option> in the main part of the configuration.
8914 </para>
8915 <literallayout class="monospaced">
8916 dnslookup:
8917   driver = dnslookup
8918   domains = ! +local_domains
8919   transport = remote_smtp
8920   ignore_target_hosts = 0.0.0.0 : 127.0.0.0/8
8921   no_more
8922 </literallayout>
8923 <para>
8924 The first uncommented router handles addresses that do not involve any local
8925 domains. This is specified by the line
8926 </para>
8927 <literallayout class="monospaced">
8928 domains = ! +local_domains
8929 </literallayout>
8930 <para>
8931 The <option>domains</option> option lists the domains to which this router applies, but the
8932 exclamation mark is a negation sign, so the router is used only for domains
8933 that are not in the domain list called <emphasis>local_domains</emphasis> (which was defined at
8934 the start of the configuration). The plus sign before <emphasis>local_domains</emphasis>
8935 indicates that it is referring to a named list. Addresses in other domains are
8936 passed on to the following routers.
8937 </para>
8938 <para>
8939 The name of the router driver is <command>dnslookup</command>,
8940 and is specified by the <option>driver</option> option. Do not be confused by the fact that
8941 the name of this router instance is the same as the name of the driver. The
8942 instance name is arbitrary, but the name set in the <option>driver</option> option must be
8943 one of the driver modules that is in the Exim binary.
8944 </para>
8945 <para>
8946 The <command>dnslookup</command> router routes addresses by looking up their domains in the
8947 DNS in order to obtain a list of hosts to which the address is routed. If the
8948 router succeeds, the address is queued for the <command>remote_smtp</command> transport, as
8949 specified by the <option>transport</option> option. If the router does not find the domain
8950 in the DNS, no further routers are tried because of the <option>no_more</option> setting, so
8951 the address fails and is bounced.
8952 </para>
8953 <para>
8954 The <option>ignore_target_hosts</option> option specifies a list of IP addresses that are to
8955 be entirely ignored. This option is present because a number of cases have been
8956 encountered where MX records in the DNS point to host names
8957 whose IP addresses are 0.0.0.0 or are in the 127 subnet (typically 127.0.0.1).
8958 Completely ignoring these IP addresses causes Exim to fail to route the
8959 email address, so it bounces. Otherwise, Exim would log a routing problem, and
8960 continue to try to deliver the message periodically until the address timed
8961 out.
8962 </para>
8963 <literallayout class="monospaced">
8964 system_aliases:
8965   driver = redirect
8966   allow_fail
8967   allow_defer
8968   data = ${lookup{$local_part}lsearch{/etc/aliases}}
8969 # user = exim
8970   file_transport = address_file
8971   pipe_transport = address_pipe
8972 </literallayout>
8973 <para>
8974 Control reaches this and subsequent routers only for addresses in the local
8975 domains. This router checks to see whether the local part is defined as an
8976 alias in the <filename>/etc/aliases</filename> file, and if so, redirects it according to the
8977 data that it looks up from that file. If no data is found for the local part,
8978 the value of the <option>data</option> option is empty, causing the address to be passed to
8979 the next router.
8980 </para>
8981 <para>
8982 <filename>/etc/aliases</filename> is a conventional name for the system aliases file that is
8983 often used. That is why it is referenced by from the default configuration
8984 file. However, you can change this by setting SYSTEM_ALIASES_FILE in
8985 <filename>Local/Makefile</filename> before building Exim.
8986 </para>
8987 <literallayout class="monospaced">
8988 userforward:
8989   driver = redirect
8990   check_local_user
8991 # local_part_suffix = +* : -*
8992 # local_part_suffix_optional
8993   file = $home/.forward
8994 # allow_filter
8995   no_verify
8996   no_expn
8997   check_ancestor
8998   file_transport = address_file
8999   pipe_transport = address_pipe
9000   reply_transport = address_reply
9001 </literallayout>
9002 <para>
9003 This is the most complicated router in the default configuration. It is another
9004 redirection router, but this time it is looking for forwarding data set up by
9005 individual users. The <option>check_local_user</option> setting specifies a check that the
9006 local part of the address is the login name of a local user. If it is not, the
9007 router is skipped. The two commented options that follow <option>check_local_user</option>,
9008 namely:
9009 </para>
9010 <literallayout class="monospaced">
9011 # local_part_suffix = +* : -*
9012 # local_part_suffix_optional
9013 </literallayout>
9014 <para>
9015 <indexterm role="variable">
9016 <primary><varname>$local_part_suffix</varname></primary>
9017 </indexterm>
9018 show how you can specify the recognition of local part suffixes. If the first
9019 is uncommented, a suffix beginning with either a plus or a minus sign, followed
9020 by any sequence of characters, is removed from the local part and placed in the
9021 variable <varname>$local_part_suffix</varname>. The second suffix option specifies that the
9022 presence of a suffix in the local part is optional. When a suffix is present,
9023 the check for a local login uses the local part with the suffix removed.
9024 </para>
9025 <para>
9026 When a local user account is found, the file called <filename>.forward</filename> in the user&#x2019;s
9027 home directory is consulted. If it does not exist, or is empty, the router
9028 declines. Otherwise, the contents of <filename>.forward</filename> are interpreted as
9029 redirection data (see chapter <xref linkend="CHAPredirect"/> for more details).
9030 </para>
9031 <para>
9032 <indexterm role="concept">
9033 <primary>Sieve filter</primary>
9034 <secondary>enabling in default router</secondary>
9035 </indexterm>
9036 Traditional <filename>.forward</filename> files contain just a list of addresses, pipes, or
9037 files. Exim supports this by default. However, if <option>allow_filter</option> is set (it
9038 is commented out by default), the contents of the file are interpreted as a set
9039 of Exim or Sieve filtering instructions, provided the file begins with <quote>#Exim
9040 filter</quote> or <quote>#Sieve filter</quote>, respectively. User filtering is discussed in the
9041 separate document entitled <emphasis>Exim&#x2019;s interfaces to mail filtering</emphasis>.
9042 </para>
9043 <para>
9044 The <option>no_verify</option> and <option>no_expn</option> options mean that this router is skipped when
9045 verifying addresses, or when running as a consequence of an SMTP EXPN command.
9046 There are two reasons for doing this:
9047 </para>
9048 <orderedlist numeration="arabic">
9049 <listitem>
9050 <para>
9051 Whether or not a local user has a <filename>.forward</filename> file is not really relevant when
9052 checking an address for validity; it makes sense not to waste resources doing
9053 unnecessary work.
9054 </para>
9055 </listitem>
9056 <listitem>
9057 <para>
9058 More importantly, when Exim is verifying addresses or handling an EXPN
9059 command during an SMTP session, it is running as the Exim user, not as root.
9060 The group is the Exim group, and no additional groups are set up.
9061 It may therefore not be possible for Exim to read users&#x2019; <filename>.forward</filename> files at
9062 this time.
9063 </para>
9064 </listitem>
9065 </orderedlist>
9066 <para>
9067 The setting of <option>check_ancestor</option> prevents the router from generating a new
9068 address that is the same as any previous address that was redirected. (This
9069 works round a problem concerning a bad interaction between aliasing and
9070 forwarding &ndash; see section <xref linkend="SECTredlocmai"/>).
9071 </para>
9072 <para>
9073 The final three option settings specify the transports that are to be used when
9074 forwarding generates a direct delivery to a file, or to a pipe, or sets up an
9075 auto-reply, respectively. For example, if a <filename>.forward</filename> file contains
9076 </para>
9077 <literallayout class="monospaced">
9078 a.nother@elsewhere.example, /home/spqr/archive
9079 </literallayout>
9080 <para>
9081 the delivery to <filename>/home/spqr/archive</filename> is done by running the <option>address_file</option>
9082 transport.
9083 </para>
9084 <literallayout class="monospaced">
9085 localuser:
9086   driver = accept
9087   check_local_user
9088 # local_part_suffix = +* : -*
9089 # local_part_suffix_optional
9090   transport = local_delivery
9091 </literallayout>
9092 <para>
9093 The final router sets up delivery into local mailboxes, provided that the local
9094 part is the name of a local login, by accepting the address and assigning it to
9095 the <command>local_delivery</command> transport. Otherwise, we have reached the end of the
9096 routers, so the address is bounced. The commented suffix settings fulfil the
9097 same purpose as they do for the <command>userforward</command> router.
9098 </para>
9099 </section>
9100 <section id="SECID56">
9101 <title>Transport configuration</title>
9102 <para>
9103 <indexterm role="concept">
9104 <primary>default</primary>
9105 <secondary>transports</secondary>
9106 </indexterm>
9107 <indexterm role="concept">
9108 <primary>transports</primary>
9109 <secondary>default</secondary>
9110 </indexterm>
9111 Transports define mechanisms for actually delivering messages. They operate
9112 only when referenced from routers, so the order in which they are defined does
9113 not matter. The transports section of the configuration starts with
9114 </para>
9115 <literallayout class="monospaced">
9116 begin transports
9117 </literallayout>
9118 <para>
9119 One remote transport and four local transports are defined.
9120 </para>
9121 <literallayout class="monospaced">
9122 remote_smtp:
9123   driver = smtp
9124   hosts_try_prdr = *
9125 </literallayout>
9126 <para>
9127 This transport is used for delivering messages over SMTP connections.
9128 The list of remote hosts comes from the router.
9129 The <option>hosts_try_prdr</option> option enables an efficiency SMTP option.
9130 It is negotiated between client and server
9131 and not expected to cause problems but can be disabled if needed.
9132 All other options are defaulted.
9133 </para>
9134 <literallayout class="monospaced">
9135 local_delivery:
9136   driver = appendfile
9137   file = /var/mail/$local_part
9138   delivery_date_add
9139   envelope_to_add
9140   return_path_add
9141 # group = mail
9142 # mode = 0660
9143 </literallayout>
9144 <para>
9145 This <command>appendfile</command> transport is used for local delivery to user mailboxes in
9146 traditional BSD mailbox format. By default it runs under the uid and gid of the
9147 local user, which requires the sticky bit to be set on the <filename>/var/mail</filename>
9148 directory. Some systems use the alternative approach of running mail deliveries
9149 under a particular group instead of using the sticky bit. The commented options
9150 show how this can be done.
9151 </para>
9152 <para>
9153 Exim adds three headers to the message as it delivers it: <emphasis>Delivery-date:</emphasis>,
9154 <emphasis>Envelope-to:</emphasis> and <emphasis>Return-path:</emphasis>. This action is requested by the three
9155 similarly-named options above.
9156 </para>
9157 <literallayout class="monospaced">
9158 address_pipe:
9159   driver = pipe
9160   return_output
9161 </literallayout>
9162 <para>
9163 This transport is used for handling deliveries to pipes that are generated by
9164 redirection (aliasing or users&#x2019; <filename>.forward</filename> files). The <option>return_output</option>
9165 option specifies that any output generated by the pipe is to be returned to the
9166 sender.
9167 </para>
9168 <literallayout class="monospaced">
9169 address_file:
9170   driver = appendfile
9171   delivery_date_add
9172   envelope_to_add
9173   return_path_add
9174 </literallayout>
9175 <para>
9176 This transport is used for handling deliveries to files that are generated by
9177 redirection. The name of the file is not specified in this instance of
9178 <command>appendfile</command>, because it comes from the <command>redirect</command> router.
9179 </para>
9180 <literallayout class="monospaced">
9181 address_reply:
9182   driver = autoreply
9183 </literallayout>
9184 <para>
9185 This transport is used for handling automatic replies generated by users&#x2019;
9186 filter files.
9187 </para>
9188 </section>
9189 <section id="SECID57">
9190 <title>Default retry rule</title>
9191 <para>
9192 <indexterm role="concept">
9193 <primary>retry</primary>
9194 <secondary>default rule</secondary>
9195 </indexterm>
9196 <indexterm role="concept">
9197 <primary>default</primary>
9198 <secondary>retry rule</secondary>
9199 </indexterm>
9200 The retry section of the configuration file contains rules which affect the way
9201 Exim retries deliveries that cannot be completed at the first attempt. It is
9202 introduced by the line
9203 </para>
9204 <literallayout class="monospaced">
9205 begin retry
9206 </literallayout>
9207 <para>
9208 In the default configuration, there is just one rule, which applies to all
9209 errors:
9210 </para>
9211 <literallayout class="monospaced">
9212 *   *   F,2h,15m; G,16h,1h,1.5; F,4d,6h
9213 </literallayout>
9214 <para>
9215 This causes any temporarily failing address to be retried every 15 minutes for
9216 2 hours, then at intervals starting at one hour and increasing by a factor of
9217 1.5 until 16 hours have passed, then every 6 hours up to 4 days. If an address
9218 is not delivered after 4 days of temporary failure, it is bounced.
9219 </para>
9220 <para>
9221 If the retry section is removed from the configuration, or is empty (that is,
9222 if no retry rules are defined), Exim will not retry deliveries. This turns
9223 temporary errors into permanent errors.
9224 </para>
9225 </section>
9226 <section id="SECID58">
9227 <title>Rewriting configuration</title>
9228 <para>
9229 The rewriting section of the configuration, introduced by
9230 </para>
9231 <literallayout class="monospaced">
9232 begin rewrite
9233 </literallayout>
9234 <para>
9235 contains rules for rewriting addresses in messages as they arrive. There are no
9236 rewriting rules in the default configuration file.
9237 </para>
9238 </section>
9239 <section id="SECTdefconfauth">
9240 <title>Authenticators configuration</title>
9241 <para>
9242 <indexterm role="concept">
9243 <primary>AUTH</primary>
9244 <secondary>configuration</secondary>
9245 </indexterm>
9246 The authenticators section of the configuration, introduced by
9247 </para>
9248 <literallayout class="monospaced">
9249 begin authenticators
9250 </literallayout>
9251 <para>
9252 defines mechanisms for the use of the SMTP AUTH command. The default
9253 configuration file contains two commented-out example authenticators
9254 which support plaintext username/password authentication using the
9255 standard PLAIN mechanism and the traditional but non-standard LOGIN
9256 mechanism, with Exim acting as the server. PLAIN and LOGIN are enough
9257 to support most MUA software.
9258 </para>
9259 <para>
9260 The example PLAIN authenticator looks like this:
9261 </para>
9262 <literallayout class="monospaced">
9263 #PLAIN:
9264 #  driver                  = plaintext
9265 #  server_set_id           = $auth2
9266 #  server_prompts          = :
9267 #  server_condition        = Authentication is not yet configured
9268 #  server_advertise_condition = ${if def:tls_in_cipher }
9269 </literallayout>
9270 <para>
9271 And the example LOGIN authenticator looks like this:
9272 </para>
9273 <literallayout class="monospaced">
9274 #LOGIN:
9275 #  driver                  = plaintext
9276 #  server_set_id           = $auth1
9277 #  server_prompts          = &lt;| Username: | Password:
9278 #  server_condition        = Authentication is not yet configured
9279 #  server_advertise_condition = ${if def:tls_in_cipher }
9280 </literallayout>
9281 <para>
9282 The <option>server_set_id</option> option makes Exim remember the authenticated username
9283 in <varname>$authenticated_id</varname>, which can be used later in ACLs or routers. The
9284 <option>server_prompts</option> option configures the <command>plaintext</command> authenticator so
9285 that it implements the details of the specific authentication mechanism,
9286 i.e. PLAIN or LOGIN. The <option>server_advertise_condition</option> setting controls
9287 when Exim offers authentication to clients; in the examples, this is only
9288 when TLS or SSL has been started, so to enable the authenticators you also
9289 need to add support for TLS as described in section <xref linkend="SECTdefconfmain"/>.
9290 </para>
9291 <para>
9292 The <option>server_condition</option> setting defines how to verify that the username and
9293 password are correct. In the examples it just produces an error message.
9294 To make the authenticators work, you can use a string expansion
9295 expression like one of the examples in chapter <xref linkend="CHAPplaintext"/>.
9296 </para>
9297 <para>
9298 Beware that the sequence of the parameters to PLAIN and LOGIN differ; the
9299 usercode and password are in different positions.
9300 Chapter <xref linkend="CHAPplaintext"/> covers both.
9301 </para>
9302 <para>
9303 <indexterm role="concept" startref="IIDconfiwal" class="endofrange"/>
9304 </para>
9305 </section>
9306 </chapter>
9307
9308 <chapter id="CHAPregexp">
9309 <title>Regular expressions</title>
9310 <para>
9311 <indexterm role="concept">
9312 <primary>regular expressions</primary>
9313 <secondary>library</secondary>
9314 </indexterm>
9315 <indexterm role="concept">
9316 <primary>PCRE</primary>
9317 </indexterm>
9318 Exim supports the use of regular expressions in many of its options. It
9319 uses the PCRE regular expression library; this provides regular expression
9320 matching that is compatible with Perl 5. The syntax and semantics of
9321 regular expressions is discussed in many Perl reference books, and also in
9322 Jeffrey Friedl&#x2019;s <emphasis>Mastering Regular Expressions</emphasis>, which is published by
9323 O&#x2019;Reilly (see <emphasis role="bold"><ulink url="http://www.oreilly.com/catalog/regex2/">http://www.oreilly.com/catalog/regex2/</ulink></emphasis>).
9324 </para>
9325 <para>
9326 The documentation for the syntax and semantics of the regular expressions that
9327 are supported by PCRE is included in the PCRE distribution, and no further
9328 description is included here. The PCRE functions are called from Exim using
9329 the default option settings (that is, with no PCRE options set), except that
9330 the PCRE_CASELESS option is set when the matching is required to be
9331 case-insensitive.
9332 </para>
9333 <para>
9334 In most cases, when a regular expression is required in an Exim configuration,
9335 it has to start with a circumflex, in order to distinguish it from plain text
9336 or an <quote>ends with</quote> wildcard. In this example of a configuration setting, the
9337 second item in the colon-separated list is a regular expression.
9338 </para>
9339 <literallayout class="monospaced">
9340 domains = a.b.c : ^\\d{3} : *.y.z : ...
9341 </literallayout>
9342 <para>
9343 The doubling of the backslash is required because of string expansion that
9344 precedes interpretation &ndash; see section <xref linkend="SECTlittext"/> for more discussion
9345 of this issue, and a way of avoiding the need for doubling backslashes. The
9346 regular expression that is eventually used in this example contains just one
9347 backslash. The circumflex is included in the regular expression, and has the
9348 normal effect of <quote>anchoring</quote> it to the start of the string that is being
9349 matched.
9350 </para>
9351 <para>
9352 There are, however, two cases where a circumflex is not required for the
9353 recognition of a regular expression: these are the <option>match</option> condition in a
9354 string expansion, and the <option>matches</option> condition in an Exim filter file. In
9355 these cases, the relevant string is always treated as a regular expression; if
9356 it does not start with a circumflex, the expression is not anchored, and can
9357 match anywhere in the subject string.
9358 </para>
9359 <para>
9360 In all cases, if you want a regular expression to match at the end of a string,
9361 you must code the $ metacharacter to indicate this. For example:
9362 </para>
9363 <literallayout class="monospaced">
9364 domains = ^\\d{3}\\.example
9365 </literallayout>
9366 <para>
9367 matches the domain <emphasis>123.example</emphasis>, but it also matches <emphasis>123.example.com</emphasis>.
9368 You need to use:
9369 </para>
9370 <literallayout class="monospaced">
9371 domains = ^\\d{3}\\.example\$
9372 </literallayout>
9373 <para>
9374 if you want <emphasis>example</emphasis> to be the top-level domain. The backslash before the
9375 $ is needed because string expansion also interprets dollar characters.
9376 </para>
9377 </chapter>
9378
9379 <chapter id="CHAPfdlookup">
9380 <title>File and database lookups</title>
9381 <para>
9382 <indexterm role="concept" id="IIDfidalo1" class="startofrange">
9383 <primary>file</primary>
9384 <secondary>lookups</secondary>
9385 </indexterm>
9386 <indexterm role="concept" id="IIDfidalo2" class="startofrange">
9387 <primary>database</primary>
9388 <secondary>lookups</secondary>
9389 </indexterm>
9390 <indexterm role="concept">
9391 <primary>lookup</primary>
9392 <secondary>description of</secondary>
9393 </indexterm>
9394 Exim can be configured to look up data in files or databases as it processes
9395 messages. Two different kinds of syntax are used:
9396 </para>
9397 <orderedlist numeration="arabic">
9398 <listitem>
9399 <para>
9400 A string that is to be expanded may contain explicit lookup requests. These
9401 cause parts of the string to be replaced by data that is obtained from the
9402 lookup. Lookups of this type are conditional expansion items. Different results
9403 can be defined for the cases of lookup success and failure. See chapter
9404 <xref linkend="CHAPexpand"/>, where string expansions are described in detail.
9405 </para>
9406 </listitem>
9407 <listitem>
9408 <para>
9409 Lists of domains, hosts, and email addresses can contain lookup requests as a
9410 way of avoiding excessively long linear lists. In this case, the data that is
9411 returned by the lookup is often (but not always) discarded; whether the lookup
9412 succeeds or fails is what really counts. These kinds of list are described in
9413 chapter <xref linkend="CHAPdomhosaddlists"/>.
9414 </para>
9415 </listitem>
9416 </orderedlist>
9417 <para>
9418 String expansions, lists, and lookups interact with each other in such a way
9419 that there is no order in which to describe any one of them that does not
9420 involve references to the others. Each of these three chapters makes more sense
9421 if you have read the other two first. If you are reading this for the first
9422 time, be aware that some of it will make a lot more sense after you have read
9423 chapters <xref linkend="CHAPdomhosaddlists"/> and <xref linkend="CHAPexpand"/>.
9424 </para>
9425 <section id="SECID60">
9426 <title>Examples of different lookup syntax</title>
9427 <para>
9428 It is easy to confuse the two different kinds of lookup, especially as the
9429 lists that may contain the second kind are always expanded before being
9430 processed as lists. Therefore, they may also contain lookups of the first kind.
9431 Be careful to distinguish between the following two examples:
9432 </para>
9433 <literallayout class="monospaced">
9434 domains = ${lookup{$sender_host_address}lsearch{/some/file}}
9435 domains = lsearch;/some/file
9436 </literallayout>
9437 <para>
9438 The first uses a string expansion, the result of which must be a domain list.
9439 No strings have been specified for a successful or a failing lookup; the
9440 defaults in this case are the looked-up data and an empty string, respectively.
9441 The expansion takes place before the string is processed as a list, and the
9442 file that is searched could contain lines like this:
9443 </para>
9444 <literallayout class="monospaced">
9445 192.168.3.4: domain1:domain2:...
9446 192.168.1.9: domain3:domain4:...
9447 </literallayout>
9448 <para>
9449 When the lookup succeeds, the result of the expansion is a list of domains (and
9450 possibly other types of item that are allowed in domain lists).
9451 </para>
9452 <para>
9453 In the second example, the lookup is a single item in a domain list. It causes
9454 Exim to use a lookup to see if the domain that is being processed can be found
9455 in the file. The file could contains lines like this:
9456 </para>
9457 <literallayout class="monospaced">
9458 domain1:
9459 domain2:
9460 </literallayout>
9461 <para>
9462 Any data that follows the keys is not relevant when checking that the domain
9463 matches the list item.
9464 </para>
9465 <para>
9466 It is possible, though no doubt confusing, to use both kinds of lookup at once.
9467 Consider a file containing lines like this:
9468 </para>
9469 <literallayout class="monospaced">
9470 192.168.5.6: lsearch;/another/file
9471 </literallayout>
9472 <para>
9473 If the value of <varname>$sender_host_address</varname> is 192.168.5.6, expansion of the
9474 first <option>domains</option> setting above generates the second setting, which therefore
9475 causes a second lookup to occur.
9476 </para>
9477 <para>
9478 The rest of this chapter describes the different lookup types that are
9479 available. Any of them can be used in any part of the configuration where a
9480 lookup is permitted.
9481 </para>
9482 </section>
9483 <section id="SECID61">
9484 <title>Lookup types</title>
9485 <para>
9486 <indexterm role="concept">
9487 <primary>lookup</primary>
9488 <secondary>types of</secondary>
9489 </indexterm>
9490 <indexterm role="concept">
9491 <primary>single-key lookup</primary>
9492 <secondary>definition of</secondary>
9493 </indexterm>
9494 Two different types of data lookup are implemented:
9495 </para>
9496 <itemizedlist>
9497 <listitem>
9498 <para>
9499 The <emphasis>single-key</emphasis> type requires the specification of a file in which to look,
9500 and a single key to search for. The key must be a non-empty string for the
9501 lookup to succeed. The lookup type determines how the file is searched.
9502 </para>
9503 </listitem>
9504 <listitem>
9505 <para>
9506 <indexterm role="concept">
9507 <primary>query-style lookup</primary>
9508 <secondary>definition of</secondary>
9509 </indexterm>
9510 The <emphasis>query-style</emphasis> type accepts a generalized database query. No particular
9511 key value is assumed by Exim for query-style lookups. You can use whichever
9512 Exim variables you need to construct the database query.
9513 </para>
9514 </listitem>
9515 </itemizedlist>
9516 <para>
9517 The code for each lookup type is in a separate source file that is included in
9518 the binary of Exim only if the corresponding compile-time option is set. The
9519 default settings in <filename>src/EDITME</filename> are:
9520 </para>
9521 <literallayout class="monospaced">
9522 LOOKUP_DBM=yes
9523 LOOKUP_LSEARCH=yes
9524 </literallayout>
9525 <para>
9526 which means that only linear searching and DBM lookups are included by default.
9527 For some types of lookup (e.g. SQL databases), you need to install appropriate
9528 libraries and header files before building Exim.
9529 </para>
9530 </section>
9531 <section id="SECTsinglekeylookups">
9532 <title>Single-key lookup types</title>
9533 <para>
9534 <indexterm role="concept">
9535 <primary>lookup</primary>
9536 <secondary>single-key types</secondary>
9537 </indexterm>
9538 <indexterm role="concept">
9539 <primary>single-key lookup</primary>
9540 <secondary>list of types</secondary>
9541 </indexterm>
9542 The following single-key lookup types are implemented:
9543 </para>
9544 <itemizedlist>
9545 <listitem>
9546 <para>
9547 <indexterm role="concept">
9548 <primary>cdb</primary>
9549 <secondary>description of</secondary>
9550 </indexterm>
9551 <indexterm role="concept">
9552 <primary>lookup</primary>
9553 <secondary>cdb</secondary>
9554 </indexterm>
9555 <indexterm role="concept">
9556 <primary>binary zero</primary>
9557 <secondary>in lookup key</secondary>
9558 </indexterm>
9559 <command>cdb</command>: The given file is searched as a Constant DataBase file, using the key
9560 string without a terminating binary zero. The cdb format is designed for
9561 indexed files that are read frequently and never updated, except by total
9562 re-creation. As such, it is particularly suitable for large files containing
9563 aliases or other indexed data referenced by an MTA. Information about cdb can
9564 be found in several places:
9565 </para>
9566 <literallayout>
9567 <emphasis role="bold"><ulink url="http://www.pobox.com/~djb/cdb.html">http://www.pobox.com/~djb/cdb.html</ulink></emphasis>
9568 <emphasis role="bold"><ulink url="ftp://ftp.corpit.ru/pub/tinycdb/">ftp://ftp.corpit.ru/pub/tinycdb/</ulink></emphasis>
9569 <emphasis role="bold"><ulink url="http://packages.debian.org/stable/utils/freecdb.html">http://packages.debian.org/stable/utils/freecdb.html</ulink></emphasis>
9570 </literallayout>
9571 <para>
9572 A cdb distribution is not needed in order to build Exim with cdb support,
9573 because the code for reading cdb files is included directly in Exim itself.
9574 However, no means of building or testing cdb files is provided with Exim, so
9575 you need to obtain a cdb distribution in order to do this.
9576 </para>
9577 </listitem>
9578 <listitem>
9579 <para>
9580 <indexterm role="concept">
9581 <primary>DBM</primary>
9582 <secondary>lookup type</secondary>
9583 </indexterm>
9584 <indexterm role="concept">
9585 <primary>lookup</primary>
9586 <secondary>dbm</secondary>
9587 </indexterm>
9588 <indexterm role="concept">
9589 <primary>binary zero</primary>
9590 <secondary>in lookup key</secondary>
9591 </indexterm>
9592 <command>dbm</command>: Calls to DBM library functions are used to extract data from the given
9593 DBM file by looking up the record with the given key. A terminating binary
9594 zero is included in the key that is passed to the DBM library. See section
9595 <xref linkend="SECTdb"/> for a discussion of DBM libraries.
9596 </para>
9597 <para>
9598 <indexterm role="concept">
9599 <primary>Berkeley DB library</primary>
9600 <secondary>file format</secondary>
9601 </indexterm>
9602 For all versions of Berkeley DB, Exim uses the DB_HASH style of database
9603 when building DBM files using the <option>exim_dbmbuild</option> utility. However, when
9604 using Berkeley DB versions 3 or 4, it opens existing databases for reading with
9605 the DB_UNKNOWN option. This enables it to handle any of the types of database
9606 that the library supports, and can be useful for accessing DBM files created by
9607 other applications. (For earlier DB versions, DB_HASH is always used.)
9608 </para>
9609 </listitem>
9610 <listitem>
9611 <para>
9612 <indexterm role="concept">
9613 <primary>lookup</primary>
9614 <secondary>dbmjz</secondary>
9615 </indexterm>
9616 <indexterm role="concept">
9617 <primary>lookup</primary>
9618 <secondary>dbm &ndash; embedded NULs</secondary>
9619 </indexterm>
9620 <indexterm role="concept">
9621 <primary>sasldb2</primary>
9622 </indexterm>
9623 <indexterm role="concept">
9624 <primary>dbmjz lookup type</primary>
9625 </indexterm>
9626 <command>dbmjz</command>: This is the same as <command>dbm</command>, except that the lookup key is
9627 interpreted as an Exim list; the elements of the list are joined together with
9628 ASCII NUL characters to form the lookup key.  An example usage would be to
9629 authenticate incoming SMTP calls using the passwords from Cyrus SASL&#x2019;s
9630 <filename>/etc/sasldb2</filename> file with the <command>gsasl</command> authenticator or Exim&#x2019;s own
9631 <command>cram_md5</command> authenticator.
9632 </para>
9633 </listitem>
9634 <listitem>
9635 <para>
9636 <indexterm role="concept">
9637 <primary>lookup</primary>
9638 <secondary>dbmnz</secondary>
9639 </indexterm>
9640 <indexterm role="concept">
9641 <primary>lookup</primary>
9642 <secondary>dbm &ndash; terminating zero</secondary>
9643 </indexterm>
9644 <indexterm role="concept">
9645 <primary>binary zero</primary>
9646 <secondary>in lookup key</secondary>
9647 </indexterm>
9648 <indexterm role="concept">
9649 <primary>Courier</primary>
9650 </indexterm>
9651 <indexterm role="concept">
9652 <primary><filename>/etc/userdbshadow.dat</filename></primary>
9653 </indexterm>
9654 <indexterm role="concept">
9655 <primary>dbmnz lookup type</primary>
9656 </indexterm>
9657 <command>dbmnz</command>: This is the same as <command>dbm</command>, except that a terminating binary zero
9658 is not included in the key that is passed to the DBM library. You may need this
9659 if you want to look up data in files that are created by or shared with some
9660 other application that does not use terminating zeros. For example, you need to
9661 use <command>dbmnz</command> rather than <command>dbm</command> if you want to authenticate incoming SMTP
9662 calls using the passwords from Courier&#x2019;s <filename>/etc/userdbshadow.dat</filename> file. Exim&#x2019;s
9663 utility program for creating DBM files (<emphasis>exim_dbmbuild</emphasis>) includes the zeros
9664 by default, but has an option to omit them (see section <xref linkend="SECTdbmbuild"/>).
9665 </para>
9666 </listitem>
9667 <listitem>
9668 <para>
9669 <indexterm role="concept">
9670 <primary>lookup</primary>
9671 <secondary>dsearch</secondary>
9672 </indexterm>
9673 <indexterm role="concept">
9674 <primary>dsearch lookup type</primary>
9675 </indexterm>
9676 <command>dsearch</command>: The given file must be a directory; this is searched for an entry
9677 whose name is the key by calling the <function>lstat()</function> function. The key may not
9678 contain any forward slash characters. If <function>lstat()</function> succeeds, the result of
9679 the lookup is the name of the entry, which may be a file, directory,
9680 symbolic link, or any other kind of directory entry. An example of how this
9681 lookup can be used to support virtual domains is given in section
9682 <xref linkend="SECTvirtualdomains"/>.
9683 </para>
9684 </listitem>
9685 <listitem>
9686 <para>
9687 <indexterm role="concept">
9688 <primary>lookup</primary>
9689 <secondary>iplsearch</secondary>
9690 </indexterm>
9691 <indexterm role="concept">
9692 <primary>iplsearch lookup type</primary>
9693 </indexterm>
9694 <command>iplsearch</command>: The given file is a text file containing keys and data. A key is
9695 terminated by a colon or white space or the end of the line. The keys in the
9696 file must be IP addresses, or IP addresses with CIDR masks. Keys that involve
9697 IPv6 addresses must be enclosed in quotes to prevent the first internal colon
9698 being interpreted as a key terminator. For example:
9699 </para>
9700 <literallayout class="monospaced">
9701 1.2.3.4:           data for 1.2.3.4
9702 192.168.0.0/16:    data for 192.168.0.0/16
9703 "abcd::cdab":      data for abcd::cdab
9704 "abcd:abcd::/32"   data for abcd:abcd::/32
9705 </literallayout>
9706 <para>
9707 The key for an <command>iplsearch</command> lookup must be an IP address (without a mask). The
9708 file is searched linearly, using the CIDR masks where present, until a matching
9709 key is found. The first key that matches is used; there is no attempt to find a
9710 <quote>best</quote> match. Apart from the way the keys are matched, the processing for
9711 <command>iplsearch</command> is the same as for <command>lsearch</command>.
9712 </para>
9713 <para>
9714 <emphasis role="bold">Warning 1</emphasis>: Unlike most other single-key lookup types, a file of data for
9715 <command>iplsearch</command> can <emphasis>not</emphasis> be turned into a DBM or cdb file, because those
9716 lookup types support only literal keys.
9717 </para>
9718 <para>
9719 <emphasis role="bold">Warning 2</emphasis>: In a host list, you must always use <command>net-iplsearch</command> so that
9720 the implicit key is the host&#x2019;s IP address rather than its name (see section
9721 <xref linkend="SECThoslispatsikey"/>).
9722 </para>
9723 </listitem>
9724 <listitem>
9725 <para>
9726 <indexterm role="concept">
9727 <primary>linear search</primary>
9728 </indexterm>
9729 <indexterm role="concept">
9730 <primary>lookup</primary>
9731 <secondary>lsearch</secondary>
9732 </indexterm>
9733 <indexterm role="concept">
9734 <primary>lsearch lookup type</primary>
9735 </indexterm>
9736 <indexterm role="concept">
9737 <primary>case sensitivity</primary>
9738 <secondary>in lsearch lookup</secondary>
9739 </indexterm>
9740 <command>lsearch</command>: The given file is a text file that is searched linearly for a
9741 line beginning with the search key, terminated by a colon or white space or the
9742 end of the line. The search is case-insensitive; that is, upper and lower case
9743 letters are treated as the same. The first occurrence of the key that is found
9744 in the file is used.
9745 </para>
9746 <para>
9747 White space between the key and the colon is permitted. The remainder of the
9748 line, with leading and trailing white space removed, is the data. This can be
9749 continued onto subsequent lines by starting them with any amount of white
9750 space, but only a single space character is included in the data at such a
9751 junction. If the data begins with a colon, the key must be terminated by a
9752 colon, for example:
9753 </para>
9754 <literallayout class="monospaced">
9755 baduser:  :fail:
9756 </literallayout>
9757 <para>
9758 Empty lines and lines beginning with # are ignored, even if they occur in the
9759 middle of an item. This is the traditional textual format of alias files. Note
9760 that the keys in an <command>lsearch</command> file are literal strings. There is no
9761 wildcarding of any kind.
9762 </para>
9763 <para>
9764 <indexterm role="concept">
9765 <primary>lookup</primary>
9766 <secondary>lsearch &ndash; colons in keys</secondary>
9767 </indexterm>
9768 <indexterm role="concept">
9769 <primary>white space</primary>
9770 <secondary>in lsearch key</secondary>
9771 </indexterm>
9772 In most <command>lsearch</command> files, keys are not required to contain colons or #
9773 characters, or white space. However, if you need this feature, it is available.
9774 If a key begins with a doublequote character, it is terminated only by a
9775 matching quote (or end of line), and the normal escaping rules apply to its
9776 contents (see section <xref linkend="SECTstrings"/>). An optional colon is permitted after
9777 quoted keys (exactly as for unquoted keys). There is no special handling of
9778 quotes for the data part of an <command>lsearch</command> line.
9779 </para>
9780 </listitem>
9781 <listitem>
9782 <para>
9783 <indexterm role="concept">
9784 <primary>NIS lookup type</primary>
9785 </indexterm>
9786 <indexterm role="concept">
9787 <primary>lookup</primary>
9788 <secondary>NIS</secondary>
9789 </indexterm>
9790 <indexterm role="concept">
9791 <primary>binary zero</primary>
9792 <secondary>in lookup key</secondary>
9793 </indexterm>
9794 <command>nis</command>: The given file is the name of a NIS map, and a NIS lookup is done with
9795 the given key, without a terminating binary zero. There is a variant called
9796 <command>nis0</command> which does include the terminating binary zero in the key. This is
9797 reportedly needed for Sun-style alias files. Exim does not recognize NIS
9798 aliases; the full map names must be used.
9799 </para>
9800 </listitem>
9801 <listitem>
9802 <para>
9803 <indexterm role="concept">
9804 <primary>wildlsearch lookup type</primary>
9805 </indexterm>
9806 <indexterm role="concept">
9807 <primary>lookup</primary>
9808 <secondary>wildlsearch</secondary>
9809 </indexterm>
9810 <indexterm role="concept">
9811 <primary>nwildlsearch lookup type</primary>
9812 </indexterm>
9813 <indexterm role="concept">
9814 <primary>lookup</primary>
9815 <secondary>nwildlsearch</secondary>
9816 </indexterm>
9817 <command>wildlsearch</command> or <command>nwildlsearch</command>: These search a file linearly, like
9818 <command>lsearch</command>, but instead of being interpreted as a literal string, each key in
9819 the file may be wildcarded. The difference between these two lookup types is
9820 that for <command>wildlsearch</command>, each key in the file is string-expanded before being
9821 used, whereas for <command>nwildlsearch</command>, no expansion takes place.
9822 </para>
9823 <para>
9824 <indexterm role="concept">
9825 <primary>case sensitivity</primary>
9826 <secondary>in (n)wildlsearch lookup</secondary>
9827 </indexterm>
9828 Like <command>lsearch</command>, the testing is done case-insensitively. However, keys in the
9829 file that are regular expressions can be made case-sensitive by the use of
9830 <literal>(-i)</literal> within the pattern. The following forms of wildcard are recognized:
9831 </para>
9832 <orderedlist numeration="arabic">
9833 <listitem>
9834 <para>
9835 The string may begin with an asterisk to mean <quote>ends with</quote>. For example:
9836 </para>
9837 <literallayout class="monospaced">
9838     *.a.b.c       data for anything.a.b.c
9839     *fish         data for anythingfish
9840 </literallayout>
9841 </listitem>
9842 <listitem>
9843 <para>
9844 The string may begin with a circumflex to indicate a regular expression. For
9845 example, for <command>wildlsearch</command>:
9846 </para>
9847 <literallayout class="monospaced">
9848     ^\N\d+\.a\.b\N    data for &lt;digits&gt;.a.b
9849 </literallayout>
9850 <para>
9851 Note the use of <literal>\N</literal> to disable expansion of the contents of the regular
9852 expression. If you are using <command>nwildlsearch</command>, where the keys are not
9853 string-expanded, the equivalent entry is:
9854 </para>
9855 <literallayout class="monospaced">
9856     ^\d+\.a\.b        data for &lt;digits&gt;.a.b
9857 </literallayout>
9858 <para>
9859 The case-insensitive flag is set at the start of compiling the regular
9860 expression, but it can be turned off by using <literal>(-i)</literal> at an appropriate point.
9861 For example, to make the entire pattern case-sensitive:
9862 </para>
9863 <literallayout class="monospaced">
9864     ^(?-i)\d+\.a\.b        data for &lt;digits&gt;.a.b
9865 </literallayout>
9866 <para>
9867 If the regular expression contains white space or colon characters, you must
9868 either quote it (see <command>lsearch</command> above), or represent these characters in other
9869 ways. For example, <literal>\s</literal> can be used for white space and <literal>\x3A</literal> for a
9870 colon. This may be easier than quoting, because if you quote, you have to
9871 escape all the backslashes inside the quotes.
9872 </para>
9873 <para>
9874 <emphasis role="bold">Note</emphasis>: It is not possible to capture substrings in a regular expression
9875 match for later use, because the results of all lookups are cached. If a lookup
9876 is repeated, the result is taken from the cache, and no actual pattern matching
9877 takes place. The values of all the numeric variables are unset after a
9878 <command>(n)wildlsearch</command> match.
9879 </para>
9880 </listitem>
9881 <listitem>
9882 <para>
9883 Although I cannot see it being of much use, the general matching function that
9884 is used to implement <command>(n)wildlsearch</command> means that the string may begin with a
9885 lookup name terminated by a semicolon, and followed by lookup data. For
9886 example:
9887 </para>
9888 <literallayout class="monospaced">
9889     cdb;/some/file  data for keys that match the file
9890 </literallayout>
9891 <para>
9892 The data that is obtained from the nested lookup is discarded.
9893 </para>
9894 </listitem>
9895 </orderedlist>
9896 <para>
9897 Keys that do not match any of these patterns are interpreted literally. The
9898 continuation rules for the data are the same as for <command>lsearch</command>, and keys may
9899 be followed by optional colons.
9900 </para>
9901 <para>
9902 <emphasis role="bold">Warning</emphasis>: Unlike most other single-key lookup types, a file of data for
9903 <command>(n)wildlsearch</command> can <emphasis>not</emphasis> be turned into a DBM or cdb file, because those
9904 lookup types support only literal keys.
9905 </para>
9906 </listitem>
9907 </itemizedlist>
9908 </section>
9909 <section id="SECID62">
9910 <title>Query-style lookup types</title>
9911 <para>
9912 <indexterm role="concept">
9913 <primary>lookup</primary>
9914 <secondary>query-style types</secondary>
9915 </indexterm>
9916 <indexterm role="concept">
9917 <primary>query-style lookup</primary>
9918 <secondary>list of types</secondary>
9919 </indexterm>
9920 The supported query-style lookup types are listed below. Further details about
9921 many of them are given in later sections.
9922 </para>
9923 <itemizedlist>
9924 <listitem>
9925 <para>
9926 <indexterm role="concept">
9927 <primary>DNS</primary>
9928 <secondary>as a lookup type</secondary>
9929 </indexterm>
9930 <indexterm role="concept">
9931 <primary>lookup</primary>
9932 <secondary>DNS</secondary>
9933 </indexterm>
9934 <command>dnsdb</command>: This does a DNS search for one or more records whose domain names
9935 are given in the supplied query. The resulting data is the contents of the
9936 records. See section <xref linkend="SECTdnsdb"/>.
9937 </para>
9938 </listitem>
9939 <listitem>
9940 <para>
9941 <indexterm role="concept">
9942 <primary>InterBase lookup type</primary>
9943 </indexterm>
9944 <indexterm role="concept">
9945 <primary>lookup</primary>
9946 <secondary>InterBase</secondary>
9947 </indexterm>
9948 <command>ibase</command>: This does a lookup in an InterBase database.
9949 </para>
9950 </listitem>
9951 <listitem>
9952 <para>
9953 <indexterm role="concept">
9954 <primary>LDAP</primary>
9955 <secondary>lookup type</secondary>
9956 </indexterm>
9957 <indexterm role="concept">
9958 <primary>lookup</primary>
9959 <secondary>LDAP</secondary>
9960 </indexterm>
9961 <command>ldap</command>: This does an LDAP lookup using a query in the form of a URL, and
9962 returns attributes from a single entry. There is a variant called <command>ldapm</command>
9963 that permits values from multiple entries to be returned. A third variant
9964 called <command>ldapdn</command> returns the Distinguished Name of a single entry instead of
9965 any attribute values. See section <xref linkend="SECTldap"/>.
9966 </para>
9967 </listitem>
9968 <listitem>
9969 <para>
9970 <indexterm role="concept">
9971 <primary>MySQL</primary>
9972 <secondary>lookup type</secondary>
9973 </indexterm>
9974 <indexterm role="concept">
9975 <primary>lookup</primary>
9976 <secondary>MySQL</secondary>
9977 </indexterm>
9978 <command>mysql</command>: The format of the query is an SQL statement that is passed to a
9979 MySQL database. See section <xref linkend="SECTsql"/>.
9980 </para>
9981 </listitem>
9982 <listitem>
9983 <para>
9984 <indexterm role="concept">
9985 <primary>NIS+ lookup type</primary>
9986 </indexterm>
9987 <indexterm role="concept">
9988 <primary>lookup</primary>
9989 <secondary>NIS+</secondary>
9990 </indexterm>
9991 <command>nisplus</command>: This does a NIS+ lookup using a query that can specify the name of
9992 the field to be returned. See section <xref linkend="SECTnisplus"/>.
9993 </para>
9994 </listitem>
9995 <listitem>
9996 <para>
9997 <indexterm role="concept">
9998 <primary>Oracle</primary>
9999 <secondary>lookup type</secondary>
10000 </indexterm>
10001 <indexterm role="concept">
10002 <primary>lookup</primary>
10003 <secondary>Oracle</secondary>
10004 </indexterm>
10005 <command>oracle</command>: The format of the query is an SQL statement that is passed to an
10006 Oracle database. See section <xref linkend="SECTsql"/>.
10007 </para>
10008 </listitem>
10009 <listitem>
10010 <para>
10011 <indexterm role="concept">
10012 <primary>lookup</primary>
10013 <secondary>passwd</secondary>
10014 </indexterm>
10015 <indexterm role="concept">
10016 <primary>passwd lookup type</primary>
10017 </indexterm>
10018 <indexterm role="concept">
10019 <primary><filename>/etc/passwd</filename></primary>
10020 </indexterm>
10021 <command>passwd</command> is a query-style lookup with queries that are just user names. The
10022 lookup calls <function>getpwnam()</function> to interrogate the system password data, and on
10023 success, the result string is the same as you would get from an <command>lsearch</command>
10024 lookup on a traditional <filename>/etc/passwd file</filename>, though with <literal>*</literal> for the
10025 password value. For example:
10026 </para>
10027 <literallayout class="monospaced">
10028 *:42:42:King Rat:/home/kr:/bin/bash
10029 </literallayout>
10030 </listitem>
10031 <listitem>
10032 <para>
10033 <indexterm role="concept">
10034 <primary>PostgreSQL lookup type</primary>
10035 </indexterm>
10036 <indexterm role="concept">
10037 <primary>lookup</primary>
10038 <secondary>PostgreSQL</secondary>
10039 </indexterm>
10040 <command>pgsql</command>: The format of the query is an SQL statement that is passed to a
10041 PostgreSQL database. See section <xref linkend="SECTsql"/>.
10042 </para>
10043 </listitem>
10044 <listitem>
10045 <para>
10046 <indexterm role="concept">
10047 <primary>sqlite lookup type</primary>
10048 </indexterm>
10049 <indexterm role="concept">
10050 <primary>lookup</primary>
10051 <secondary>sqlite</secondary>
10052 </indexterm>
10053 <command>sqlite</command>: The format of the query is a file name followed by an SQL statement
10054 that is passed to an SQLite database. See section <xref linkend="SECTsqlite"/>.
10055 </para>
10056 </listitem>
10057 <listitem>
10058 <para>
10059 <command>testdb</command>: This is a lookup type that is used for testing Exim. It is
10060 not likely to be useful in normal operation.
10061 </para>
10062 </listitem>
10063 <listitem>
10064 <para>
10065 <indexterm role="concept">
10066 <primary>whoson lookup type</primary>
10067 </indexterm>
10068 <indexterm role="concept">
10069 <primary>lookup</primary>
10070 <secondary>whoson</secondary>
10071 </indexterm>
10072 <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
10073 allows a server to check whether a particular (dynamically allocated) IP
10074 address is currently allocated to a known (trusted) user and, optionally, to
10075 obtain the identity of the said user. For SMTP servers, <emphasis>Whoson</emphasis> was popular
10076 at one time for <quote>POP before SMTP</quote> authentication, but that approach has been
10077 superseded by SMTP authentication. In Exim, <emphasis>Whoson</emphasis> can be used to implement
10078 <quote>POP before SMTP</quote> checking using ACL statements such as
10079 </para>
10080 <literallayout class="monospaced">
10081 require condition = \
10082   ${lookup whoson {$sender_host_address}{yes}{no}}
10083 </literallayout>
10084 <para>
10085 The query consists of a single IP address. The value returned is the name of
10086 the authenticated user, which is stored in the variable <varname>$value</varname>. However, in
10087 this example, the data in <varname>$value</varname> is not used; the result of the lookup is
10088 one of the fixed strings <quote>yes</quote> or <quote>no</quote>.
10089 </para>
10090 </listitem>
10091 </itemizedlist>
10092 </section>
10093 <section id="SECID63">
10094 <title>Temporary errors in lookups</title>
10095 <para>
10096 <indexterm role="concept">
10097 <primary>lookup</primary>
10098 <secondary>temporary error in</secondary>
10099 </indexterm>
10100 Lookup functions can return temporary error codes if the lookup cannot be
10101 completed. For example, an SQL or LDAP database might be unavailable. For this
10102 reason, it is not advisable to use a lookup that might do this for critical
10103 options such as a list of local domains.
10104 </para>
10105 <para>
10106 When a lookup cannot be completed in a router or transport, delivery
10107 of the message (to the relevant address) is deferred, as for any other
10108 temporary error. In other circumstances Exim may assume the lookup has failed,
10109 or may give up altogether.
10110 </para>
10111 </section>
10112 <section id="SECTdefaultvaluelookups">
10113 <title>Default values in single-key lookups</title>
10114 <para>
10115 <indexterm role="concept">
10116 <primary>wildcard lookups</primary>
10117 </indexterm>
10118 <indexterm role="concept">
10119 <primary>lookup</primary>
10120 <secondary>default values</secondary>
10121 </indexterm>
10122 <indexterm role="concept">
10123 <primary>lookup</primary>
10124 <secondary>wildcard</secondary>
10125 </indexterm>
10126 <indexterm role="concept">
10127 <primary>lookup</primary>
10128 <secondary>* added to type</secondary>
10129 </indexterm>
10130 <indexterm role="concept">
10131 <primary>default</primary>
10132 <secondary>in single-key lookups</secondary>
10133 </indexterm>
10134 In this context, a <quote>default value</quote> is a value specified by the administrator
10135 that is to be used if a lookup fails.
10136 </para>
10137 <para>
10138 <emphasis role="bold">Note:</emphasis> This section applies only to single-key lookups. For query-style
10139 lookups, the facilities of the query language must be used. An attempt to
10140 specify a default for a query-style lookup provokes an error.
10141 </para>
10142 <para>
10143 If <quote>*</quote> is added to a single-key lookup type (for example, <option>lsearch*</option>)
10144 and the initial lookup fails, the key <quote>*</quote> is looked up in the file to
10145 provide a default value. See also the section on partial matching below.
10146 </para>
10147 <para>
10148 <indexterm role="concept">
10149 <primary>*@ with single-key lookup</primary>
10150 </indexterm>
10151 <indexterm role="concept">
10152 <primary>lookup</primary>
10153 <secondary>*@ added to type</secondary>
10154 </indexterm>
10155 <indexterm role="concept">
10156 <primary>alias file</primary>
10157 <secondary>per-domain default</secondary>
10158 </indexterm>
10159 Alternatively, if <quote>*@</quote> is added to a single-key lookup type (for example
10160 <option>dbm*@</option>) then, if the initial lookup fails and the key contains an @
10161 character, a second lookup is done with everything before the last @ replaced
10162 by *. This makes it possible to provide per-domain defaults in alias files
10163 that include the domains in the keys. If the second lookup fails (or doesn&#x2019;t
10164 take place because there is no @ in the key), <quote>*</quote> is looked up.
10165 For example, a <command>redirect</command> router might contain:
10166 </para>
10167 <literallayout class="monospaced">
10168 data = ${lookup{$local_part@$domain}lsearch*@{/etc/mix-aliases}}
10169 </literallayout>
10170 <para>
10171 Suppose the address that is being processed is <emphasis>jane@eyre.example</emphasis>. Exim
10172 looks up these keys, in this order:
10173 </para>
10174 <literallayout class="monospaced">
10175 jane@eyre.example
10176 *@eyre.example
10177 *
10178 </literallayout>
10179 <para>
10180 The data is taken from whichever key it finds first. <emphasis role="bold">Note</emphasis>: In an
10181 <command>lsearch</command> file, this does not mean the first of these keys in the file. A
10182 complete scan is done for each key, and only if it is not found at all does
10183 Exim move on to try the next key.
10184 </para>
10185 </section>
10186 <section id="SECTpartiallookup">
10187 <title>Partial matching in single-key lookups</title>
10188 <para>
10189 <indexterm role="concept">
10190 <primary>partial matching</primary>
10191 </indexterm>
10192 <indexterm role="concept">
10193 <primary>wildcard lookups</primary>
10194 </indexterm>
10195 <indexterm role="concept">
10196 <primary>lookup</primary>
10197 <secondary>partial matching</secondary>
10198 </indexterm>
10199 <indexterm role="concept">
10200 <primary>lookup</primary>
10201 <secondary>wildcard</secondary>
10202 </indexterm>
10203 <indexterm role="concept">
10204 <primary>asterisk</primary>
10205 <secondary>in search type</secondary>
10206 </indexterm>
10207 The normal operation of a single-key lookup is to search the file for an exact
10208 match with the given key. However, in a number of situations where domains are
10209 being looked up, it is useful to be able to do partial matching. In this case,
10210 information in the file that has a key starting with <quote>*.</quote> is matched by any
10211 domain that ends with the components that follow the full stop. For example, if
10212 a key in a DBM file is
10213 </para>
10214 <literallayout class="monospaced">
10215 *.dates.fict.example
10216 </literallayout>
10217 <para>
10218 then when partial matching is enabled this is matched by (amongst others)
10219 <emphasis>2001.dates.fict.example</emphasis> and <emphasis>1984.dates.fict.example</emphasis>. It is also matched
10220 by <emphasis>dates.fict.example</emphasis>, if that does not appear as a separate key in the
10221 file.
10222 </para>
10223 <para>
10224 <emphasis role="bold">Note</emphasis>: Partial matching is not available for query-style lookups. It is
10225 also not available for any lookup items in address lists (see section
10226 <xref linkend="SECTaddresslist"/>).
10227 </para>
10228 <para>
10229 Partial matching is implemented by doing a series of separate lookups using
10230 keys constructed by modifying the original subject key. This means that it can
10231 be used with any of the single-key lookup types, provided that
10232 partial matching keys
10233 beginning with a special prefix (default <quote>*.</quote>) are included in the data file.
10234 Keys in the file that do not begin with the prefix are matched only by
10235 unmodified subject keys when partial matching is in use.
10236 </para>
10237 <para>
10238 Partial matching is requested by adding the string <quote>partial-</quote> to the front of
10239 the name of a single-key lookup type, for example, <option>partial-dbm</option>. When this
10240 is done, the subject key is first looked up unmodified; if that fails, <quote>*.</quote>
10241 is added at the start of the subject key, and it is looked up again. If that
10242 fails, further lookups are tried with dot-separated components removed from the
10243 start of the subject key, one-by-one, and <quote>*.</quote> added on the front of what
10244 remains.
10245 </para>
10246 <para>
10247 A minimum number of two non-* components are required. This can be adjusted
10248 by including a number before the hyphen in the search type. For example,
10249 <option>partial3-lsearch</option> specifies a minimum of three non-* components in the
10250 modified keys. Omitting the number is equivalent to <quote>partial2-</quote>. If the
10251 subject key is <emphasis>2250.dates.fict.example</emphasis> then the following keys are looked
10252 up when the minimum number of non-* components is two:
10253 </para>
10254 <literallayout class="monospaced">
10255 2250.dates.fict.example
10256 *.2250.dates.fict.example
10257 *.dates.fict.example
10258 *.fict.example
10259 </literallayout>
10260 <para>
10261 As soon as one key in the sequence is successfully looked up, the lookup
10262 finishes.
10263 </para>
10264 <para>
10265 <indexterm role="concept">
10266 <primary>lookup</primary>
10267 <secondary>partial matching &ndash; changing prefix</secondary>
10268 </indexterm>
10269 <indexterm role="concept">
10270 <primary>prefix</primary>
10271 <secondary>for partial matching</secondary>
10272 </indexterm>
10273 The use of <quote>*.</quote> as the partial matching prefix is a default that can be
10274 changed. The motivation for this feature is to allow Exim to operate with file
10275 formats that are used by other MTAs. A different prefix can be supplied in
10276 parentheses instead of the hyphen after <quote>partial</quote>. For example:
10277 </para>
10278 <literallayout class="monospaced">
10279 domains = partial(.)lsearch;/some/file
10280 </literallayout>
10281 <para>
10282 In this example, if the domain is <emphasis>a.b.c</emphasis>, the sequence of lookups is
10283 <literal>a.b.c</literal>, <literal>.a.b.c</literal>, and <literal>.b.c</literal> (the default minimum of 2 non-wild
10284 components is unchanged). The prefix may consist of any punctuation characters
10285 other than a closing parenthesis. It may be empty, for example:
10286 </para>
10287 <literallayout class="monospaced">
10288 domains = partial1()cdb;/some/file
10289 </literallayout>
10290 <para>
10291 For this example, if the domain is <emphasis>a.b.c</emphasis>, the sequence of lookups is
10292 <literal>a.b.c</literal>, <literal>b.c</literal>, and <literal>c</literal>.
10293 </para>
10294 <para>
10295 If <quote>partial0</quote> is specified, what happens at the end (when the lookup with
10296 just one non-wild component has failed, and the original key is shortened right
10297 down to the null string) depends on the prefix:
10298 </para>
10299 <itemizedlist>
10300 <listitem>
10301 <para>
10302 If the prefix has zero length, the whole lookup fails.
10303 </para>
10304 </listitem>
10305 <listitem>
10306 <para>
10307 If the prefix has length 1, a lookup for just the prefix is done. For
10308 example, the final lookup for <quote>partial0(.)</quote> is for <literal>.</literal> alone.
10309 </para>
10310 </listitem>
10311 <listitem>
10312 <para>
10313 Otherwise, if the prefix ends in a dot, the dot is removed, and the
10314 remainder is looked up. With the default prefix, therefore, the final lookup is
10315 for <quote>*</quote> on its own.
10316 </para>
10317 </listitem>
10318 <listitem>
10319 <para>
10320 Otherwise, the whole prefix is looked up.
10321 </para>
10322 </listitem>
10323 </itemizedlist>
10324 <para>
10325 If the search type ends in <quote>*</quote> or <quote>*@</quote> (see section
10326 <xref linkend="SECTdefaultvaluelookups"/> above), the search for an ultimate default that
10327 this implies happens after all partial lookups have failed. If <quote>partial0</quote> is
10328 specified, adding <quote>*</quote> to the search type has no effect with the default
10329 prefix, because the <quote>*</quote> key is already included in the sequence of partial
10330 lookups. However, there might be a use for lookup types such as
10331 <quote>partial0(.)lsearch*</quote>.
10332 </para>
10333 <para>
10334 The use of <quote>*</quote> in lookup partial matching differs from its use as a wildcard
10335 in domain lists and the like. Partial matching works only in terms of
10336 dot-separated components; a key such as <literal>*fict.example</literal>
10337 in a database file is useless, because the asterisk in a partial matching
10338 subject key is always followed by a dot.
10339 </para>
10340 </section>
10341 <section id="SECID64">
10342 <title>Lookup caching</title>
10343 <para>
10344 <indexterm role="concept">
10345 <primary>lookup</primary>
10346 <secondary>caching</secondary>
10347 </indexterm>
10348 <indexterm role="concept">
10349 <primary>caching</primary>
10350 <secondary>lookup data</secondary>
10351 </indexterm>
10352 Exim caches all lookup results in order to avoid needless repetition of
10353 lookups. However, because (apart from the daemon) Exim operates as a collection
10354 of independent, short-lived processes, this caching applies only within a
10355 single Exim process. There is no inter-process lookup caching facility.
10356 </para>
10357 <para>
10358 For single-key lookups, Exim keeps the relevant files open in case there is
10359 another lookup that needs them. In some types of configuration this can lead to
10360 many files being kept open for messages with many recipients. To avoid hitting
10361 the operating system limit on the number of simultaneously open files, Exim
10362 closes the least recently used file when it needs to open more files than its
10363 own internal limit, which can be changed via the <option>lookup_open_max</option> option.
10364 </para>
10365 <para>
10366 The single-key lookup files are closed and the lookup caches are flushed at
10367 strategic points during delivery &ndash; for example, after all routing is
10368 complete.
10369 </para>
10370 </section>
10371 <section id="SECID65">
10372 <title>Quoting lookup data</title>
10373 <para>
10374 <indexterm role="concept">
10375 <primary>lookup</primary>
10376 <secondary>quoting</secondary>
10377 </indexterm>
10378 <indexterm role="concept">
10379 <primary>quoting</primary>
10380 <secondary>in lookups</secondary>
10381 </indexterm>
10382 When data from an incoming message is included in a query-style lookup, there
10383 is the possibility of special characters in the data messing up the syntax of
10384 the query. For example, a NIS+ query that contains
10385 </para>
10386 <literallayout class="monospaced">
10387 [name=$local_part]
10388 </literallayout>
10389 <para>
10390 will be broken if the local part happens to contain a closing square bracket.
10391 For NIS+, data can be enclosed in double quotes like this:
10392 </para>
10393 <literallayout class="monospaced">
10394 [name="$local_part"]
10395 </literallayout>
10396 <para>
10397 but this still leaves the problem of a double quote in the data. The rule for
10398 NIS+ is that double quotes must be doubled. Other lookup types have different
10399 rules, and to cope with the differing requirements, an expansion operator
10400 of the following form is provided:
10401 </para>
10402 <literallayout class="monospaced">
10403 ${quote_&lt;lookup-type&gt;:&lt;string&gt;}
10404 </literallayout>
10405 <para>
10406 For example, the safest way to write the NIS+ query is
10407 </para>
10408 <literallayout class="monospaced">
10409 [name="${quote_nisplus:$local_part}"]
10410 </literallayout>
10411 <para>
10412 See chapter <xref linkend="CHAPexpand"/> for full coverage of string expansions. The quote
10413 operator can be used for all lookup types, but has no effect for single-key
10414 lookups, since no quoting is ever needed in their key strings.
10415 </para>
10416 </section>
10417 <section id="SECTdnsdb">
10418 <title>More about dnsdb</title>
10419 <para>
10420 <indexterm role="concept">
10421 <primary>dnsdb lookup</primary>
10422 </indexterm>
10423 <indexterm role="concept">
10424 <primary>lookup</primary>
10425 <secondary>dnsdb</secondary>
10426 </indexterm>
10427 <indexterm role="concept">
10428 <primary>DNS</primary>
10429 <secondary>as a lookup type</secondary>
10430 </indexterm>
10431 The <command>dnsdb</command> lookup type uses the DNS as its database. A simple query consists
10432 of a record type and a domain name, separated by an equals sign. For example,
10433 an expansion string could contain:
10434 </para>
10435 <literallayout class="monospaced">
10436 ${lookup dnsdb{mx=a.b.example}{$value}fail}
10437 </literallayout>
10438 <para>
10439 If the lookup succeeds, the result is placed in <varname>$value</varname>, which in this case
10440 is used on its own as the result. If the lookup does not succeed, the
10441 <literal>fail</literal> keyword causes a <emphasis>forced expansion failure</emphasis> &ndash; see section
10442 <xref linkend="SECTforexpfai"/> for an explanation of what this means.
10443 </para>
10444 <para revisionflag="changed">
10445 The supported DNS record types are A, CNAME, MX, NS, PTR, SOA, SPF, SRV, TLSA
10446 and TXT, and, when Exim is compiled with IPv6 support, AAAA.
10447 If no type is given, TXT is assumed.
10448 </para>
10449 <para>
10450 For any record type, if multiple records are found, the data is returned as a
10451 concatenation, with newline as the default separator. The order, of course,
10452 depends on the DNS resolver. You can specify a different separator character
10453 between multiple records by putting a right angle-bracket followed immediately
10454 by the new separator at the start of the query. For example:
10455 </para>
10456 <literallayout class="monospaced">
10457 ${lookup dnsdb{&gt;: a=host1.example}}
10458 </literallayout>
10459 <para>
10460 It is permitted to specify a space as the separator character. Further
10461 white space is ignored.
10462 For lookup types that return multiple fields per record,
10463 an alternate field separator can be specified using a comma after the main
10464 separator character, followed immediately by the field separator.
10465 </para>
10466 <para>
10467 <indexterm role="concept">
10468 <primary>PTR record</primary>
10469 <secondary>in <command>dnsdb</command> lookup</secondary>
10470 </indexterm>
10471 When the type is PTR,
10472 the data can be an IP address, written as normal; inversion and the addition of
10473 <option>in-addr.arpa</option> or <option>ip6.arpa</option> happens automatically. For example:
10474 </para>
10475 <literallayout class="monospaced">
10476 ${lookup dnsdb{ptr=192.168.4.5}{$value}fail}
10477 </literallayout>
10478 <para>
10479 If the data for a PTR record is not a syntactically valid IP address, it is not
10480 altered and nothing is added.
10481 </para>
10482 <para>
10483 <indexterm role="concept">
10484 <primary>MX record</primary>
10485 <secondary>in <command>dnsdb</command> lookup</secondary>
10486 </indexterm>
10487 <indexterm role="concept">
10488 <primary>SRV record</primary>
10489 <secondary>in <command>dnsdb</command> lookup</secondary>
10490 </indexterm>
10491 For an MX lookup, both the preference value and the host name are returned for
10492 each record, separated by a space. For an SRV lookup, the priority, weight,
10493 port, and host name are returned for each record, separated by spaces.
10494 The field separator can be modified as above.
10495 </para>
10496 <para>
10497 <indexterm role="concept">
10498 <primary>TXT record</primary>
10499 <secondary>in <command>dnsdb</command> lookup</secondary>
10500 </indexterm>
10501 <indexterm role="concept">
10502 <primary>SPF record</primary>
10503 <secondary>in <command>dnsdb</command> lookup</secondary>
10504 </indexterm>
10505 For TXT records with multiple items of data, only the first item is returned,
10506 unless a field separator is specified.
10507 To concatenate items without a separator, use a semicolon instead.
10508 For SPF records the
10509 default behaviour is to concatenate multiple items without using a separator.
10510 </para>
10511 <literallayout class="monospaced">
10512 ${lookup dnsdb{&gt;\n,: txt=a.b.example}}
10513 ${lookup dnsdb{&gt;\n; txt=a.b.example}}
10514 ${lookup dnsdb{spf=example.org}}
10515 </literallayout>
10516 <para>
10517 It is permitted to specify a space as the separator character. Further
10518 white space is ignored.
10519 </para>
10520 <para revisionflag="changed">
10521 <indexterm role="concept">
10522 <primary>SOA record</primary>
10523 <secondary>in <command>dnsdb</command> lookup</secondary>
10524 </indexterm>
10525 For an SOA lookup, while no result is obtained the lookup is redone with
10526 successively more leading components dropped from the given domain.
10527 Only the primary-nameserver field is returned unless a field separator is
10528 specified.
10529 </para>
10530 <literallayout class="monospaced" revisionflag="changed">
10531 ${lookup dnsdb{&gt;:,; soa=a.b.example.com}}
10532 </literallayout>
10533 </section>
10534 <section id="SECTdnsdb_mod">
10535 <title>Dnsdb lookup modifiers</title>
10536 <para>
10537 <indexterm role="concept">
10538 <primary>dnsdb modifiers</primary>
10539 </indexterm>
10540 <indexterm role="concept">
10541 <primary>modifiers</primary>
10542 <secondary>dnsdb</secondary>
10543 </indexterm>
10544 <indexterm role="concept">
10545 <primary>options</primary>
10546 <secondary>dnsdb</secondary>
10547 </indexterm>
10548 Modifiers for <command>dnsdb</command> lookups are given by optional keywords,
10549 each followed by a comma,
10550 that may appear before the record type.
10551 </para>
10552 <para>
10553 The <command>dnsdb</command> lookup fails only if all the DNS lookups fail. If there is a
10554 temporary DNS error for any of them, the behaviour is controlled by
10555 a defer-option modifier.
10556 The possible keywords are
10557 <quote>defer_strict</quote>, <quote>defer_never</quote>, and <quote>defer_lax</quote>.
10558 With <quote>strict</quote> behaviour, any temporary DNS error causes the
10559 whole lookup to defer. With <quote>never</quote> behaviour, a temporary DNS error is
10560 ignored, and the behaviour is as if the DNS lookup failed to find anything.
10561 With <quote>lax</quote> behaviour, all the queries are attempted, but a temporary DNS
10562 error causes the whole lookup to defer only if none of the other lookups
10563 succeed. The default is <quote>lax</quote>, so the following lookups are equivalent:
10564 </para>
10565 <literallayout class="monospaced">
10566 ${lookup dnsdb{defer_lax,a=one.host.com:two.host.com}}
10567 ${lookup dnsdb{a=one.host.com:two.host.com}}
10568 </literallayout>
10569 <para>
10570 Thus, in the default case, as long as at least one of the DNS lookups
10571 yields some data, the lookup succeeds.
10572 </para>
10573 <para>
10574 <indexterm role="concept">
10575 <primary>DNSSEC</primary>
10576 <secondary>dns lookup</secondary>
10577 </indexterm>
10578 Use of <command>DNSSEC</command> is controlled by a dnssec modifier.
10579 The possible keywords are
10580 <quote>dnssec_strict</quote>, <quote>dnssec_lax</quote>, and <quote>dnssec_never</quote>.
10581 With <quote>strict</quote> or <quote>lax</quote> DNSSEC information is requested
10582 with the lookup.
10583 With <quote>strict</quote> a response from the DNS resolver that
10584 is not labelled as authenticated data
10585 is treated as equivalent to a temporary DNS error.
10586 The default is <quote>never</quote>.
10587 </para>
10588 <para>
10589 See also the <varname>$lookup_dnssec_authenticated</varname> variable.
10590 </para>
10591 <para revisionflag="changed">
10592 <indexterm role="concept">
10593 <primary>timeout</primary>
10594 <secondary>dns lookup</secondary>
10595 </indexterm>
10596 <indexterm role="concept">
10597 <primary>DNS</primary>
10598 <secondary>timeout</secondary>
10599 </indexterm>
10600 Timeout for the dnsdb lookup can be controlled by a retrans modifier.
10601 The form is <quote>retrans_VAL</quote> where VAL is an Exim time specification
10602 (e.g. <quote>5s</quote>).
10603 The default value is set by the main configuration option <option>dns_retrans</option>.
10604 </para>
10605 <para revisionflag="changed">
10606 Retries for the dnsdb lookup can be controlled by a retry modifier.
10607 The form if <quote>retry_VAL</quote> where VAL is an integer.
10608 The default count is set by the main configuration option <option>dns_retry</option>.
10609 </para>
10610 </section>
10611 <section id="SECID66">
10612 <title>Pseudo dnsdb record types</title>
10613 <para>
10614 <indexterm role="concept">
10615 <primary>MX record</primary>
10616 <secondary>in <command>dnsdb</command> lookup</secondary>
10617 </indexterm>
10618 By default, both the preference value and the host name are returned for
10619 each MX record, separated by a space. If you want only host names, you can use
10620 the pseudo-type MXH:
10621 </para>
10622 <literallayout class="monospaced">
10623 ${lookup dnsdb{mxh=a.b.example}}
10624 </literallayout>
10625 <para>
10626 In this case, the preference values are omitted, and just the host names are
10627 returned.
10628 </para>
10629 <para>
10630 <indexterm role="concept">
10631 <primary>name server for enclosing domain</primary>
10632 </indexterm>
10633 Another pseudo-type is ZNS (for <quote>zone NS</quote>). It performs a lookup for NS
10634 records on the given domain, but if none are found, it removes the first
10635 component of the domain name, and tries again. This process continues until NS
10636 records are found or there are no more components left (or there is a DNS
10637 error). In other words, it may return the name servers for a top-level domain,
10638 but it never returns the root name servers. If there are no NS records for the
10639 top-level domain, the lookup fails. Consider these examples:
10640 </para>
10641 <literallayout class="monospaced">
10642 ${lookup dnsdb{zns=xxx.quercite.com}}
10643 ${lookup dnsdb{zns=xxx.edu}}
10644 </literallayout>
10645 <para>
10646 Assuming that in each case there are no NS records for the full domain name,
10647 the first returns the name servers for <option>quercite.com</option>, and the second returns
10648 the name servers for <option>edu</option>.
10649 </para>
10650 <para>
10651 You should be careful about how you use this lookup because, unless the
10652 top-level domain does not exist, the lookup always returns some host names. The
10653 sort of use to which this might be put is for seeing if the name servers for a
10654 given domain are on a blacklist. You can probably assume that the name servers
10655 for the high-level domains such as <option>com</option> or <option>co.uk</option> are not going to be on
10656 such a list.
10657 </para>
10658 <para>
10659 <indexterm role="concept">
10660 <primary>CSA</primary>
10661 <secondary>in <command>dnsdb</command> lookup</secondary>
10662 </indexterm>
10663 A third pseudo-type is CSA (Client SMTP Authorization). This looks up SRV
10664 records according to the CSA rules, which are described in section
10665 <xref linkend="SECTverifyCSA"/>. Although <command>dnsdb</command> supports SRV lookups directly, this is
10666 not sufficient because of the extra parent domain search behaviour of CSA. The
10667 result of a successful lookup such as:
10668 </para>
10669 <literallayout class="monospaced">
10670 ${lookup dnsdb {csa=$sender_helo_name}}
10671 </literallayout>
10672 <para>
10673 has two space-separated fields: an authorization code and a target host name.
10674 The authorization code can be <quote>Y</quote> for yes, <quote>N</quote> for no, <quote>X</quote> for explicit
10675 authorization required but absent, or <quote>?</quote> for unknown.
10676 </para>
10677 <para>
10678 <indexterm role="concept">
10679 <primary>A+</primary>
10680 <secondary>in <command>dnsdb</command> lookup</secondary>
10681 </indexterm>
10682 The pseudo-type A+ performs an AAAA
10683 and then an A lookup.  All results are returned; defer processing
10684 (see below) is handled separately for each lookup.  Example:
10685 </para>
10686 <literallayout class="monospaced">
10687 ${lookup dnsdb {&gt;; a+=$sender_helo_name}}
10688 </literallayout>
10689 </section>
10690 <section id="SECID67">
10691 <title>Multiple dnsdb lookups</title>
10692 <para>
10693 In the previous sections, <command>dnsdb</command> lookups for a single domain are described.
10694 However, you can specify a list of domains or IP addresses in a single
10695 <command>dnsdb</command> lookup. The list is specified in the normal Exim way, with colon as
10696 the default separator, but with the ability to change this. For example:
10697 </para>
10698 <literallayout class="monospaced">
10699 ${lookup dnsdb{one.domain.com:two.domain.com}}
10700 ${lookup dnsdb{a=one.host.com:two.host.com}}
10701 ${lookup dnsdb{ptr = &lt;; 1.2.3.4 ; 4.5.6.8}}
10702 </literallayout>
10703 <para>
10704 In order to retain backwards compatibility, there is one special case: if
10705 the lookup type is PTR and no change of separator is specified, Exim looks
10706 to see if the rest of the string is precisely one IPv6 address. In this
10707 case, it does not treat it as a list.
10708 </para>
10709 <para>
10710 The data from each lookup is concatenated, with newline separators by default,
10711 in the same way that multiple DNS records for a single item are handled. A
10712 different separator can be specified, as described above.
10713 </para>
10714 </section>
10715 <section id="SECTldap">
10716 <title>More about LDAP</title>
10717 <para>
10718 <indexterm role="concept">
10719 <primary>LDAP</primary>
10720 <secondary>lookup, more about</secondary>
10721 </indexterm>
10722 <indexterm role="concept">
10723 <primary>lookup</primary>
10724 <secondary>LDAP</secondary>
10725 </indexterm>
10726 <indexterm role="concept">
10727 <primary>Solaris</primary>
10728 <secondary>LDAP</secondary>
10729 </indexterm>
10730 The original LDAP implementation came from the University of Michigan; this has
10731 become <quote>Open LDAP</quote>, and there are now two different releases. Another
10732 implementation comes from Netscape, and Solaris 7 and subsequent releases
10733 contain inbuilt LDAP support. Unfortunately, though these are all compatible at
10734 the lookup function level, their error handling is different. For this reason
10735 it is necessary to set a compile-time variable when building Exim with LDAP, to
10736 indicate which LDAP library is in use. One of the following should appear in
10737 your <filename>Local/Makefile</filename>:
10738 </para>
10739 <literallayout class="monospaced">
10740 LDAP_LIB_TYPE=UMICHIGAN
10741 LDAP_LIB_TYPE=OPENLDAP1
10742 LDAP_LIB_TYPE=OPENLDAP2
10743 LDAP_LIB_TYPE=NETSCAPE
10744 LDAP_LIB_TYPE=SOLARIS
10745 </literallayout>
10746 <para>
10747 If LDAP_LIB_TYPE is not set, Exim assumes <literal>OPENLDAP1</literal>, which has the
10748 same interface as the University of Michigan version.
10749 </para>
10750 <para>
10751 There are three LDAP lookup types in Exim. These behave slightly differently in
10752 the way they handle the results of a query:
10753 </para>
10754 <itemizedlist>
10755 <listitem>
10756 <para>
10757 <command>ldap</command> requires the result to contain just one entry; if there are more, it
10758 gives an error.
10759 </para>
10760 </listitem>
10761 <listitem>
10762 <para>
10763 <command>ldapdn</command> also requires the result to contain just one entry, but it is the
10764 Distinguished Name that is returned rather than any attribute values.
10765 </para>
10766 </listitem>
10767 <listitem>
10768 <para>
10769 <command>ldapm</command> permits the result to contain more than one entry; the attributes
10770 from all of them are returned.
10771 </para>
10772 </listitem>
10773 </itemizedlist>
10774 <para>
10775 For <command>ldap</command> and <command>ldapm</command>, if a query finds only entries with no attributes,
10776 Exim behaves as if the entry did not exist, and the lookup fails. The format of
10777 the data returned by a successful lookup is described in the next section.
10778 First we explain how LDAP queries are coded.
10779 </para>
10780 </section>
10781 <section id="SECTforldaque">
10782 <title>Format of LDAP queries</title>
10783 <para>
10784 <indexterm role="concept">
10785 <primary>LDAP</primary>
10786 <secondary>query format</secondary>
10787 </indexterm>
10788 An LDAP query takes the form of a URL as defined in RFC 2255. For example, in
10789 the configuration of a <command>redirect</command> router one might have this setting:
10790 </para>
10791 <literallayout class="monospaced">
10792 data = ${lookup ldap \
10793   {ldap:///cn=$local_part,o=University%20of%20Cambridge,\
10794   c=UK?mailbox?base?}}
10795 </literallayout>
10796 <para>
10797 <indexterm role="concept">
10798 <primary>LDAP</primary>
10799 <secondary>with TLS</secondary>
10800 </indexterm>
10801 The URL may begin with <literal>ldap</literal> or <literal>ldaps</literal> if your LDAP library supports
10802 secure (encrypted) LDAP connections. The second of these ensures that an
10803 encrypted TLS connection is used.
10804 </para>
10805 <para>
10806 With sufficiently modern LDAP libraries, Exim supports forcing TLS over regular
10807 LDAP connections, rather than the SSL-on-connect <literal>ldaps</literal>.
10808 See the <option>ldap_start_tls</option> option.
10809 </para>
10810 <para>
10811 Starting with Exim 4.83, the initialization of LDAP with TLS is more tightly
10812 controlled. Every part of the TLS configuration can be configured by settings in
10813 <filename>exim.conf</filename>. Depending on the version of the client libraries installed on
10814 your system, some of the initialization may have required setting options in
10815 <filename>/etc/ldap.conf</filename> or <filename>~/.ldaprc</filename> to get TLS working with self-signed
10816 certificates. This revealed a nuance where the current UID that exim was
10817 running as could affect which config files it read. With Exim 4.83, these
10818 methods become optional, only taking effect if not specifically set in
10819 <filename>exim.conf</filename>.
10820 </para>
10821 </section>
10822 <section id="SECID68">
10823 <title>LDAP quoting</title>
10824 <para>
10825 <indexterm role="concept">
10826 <primary>LDAP</primary>
10827 <secondary>quoting</secondary>
10828 </indexterm>
10829 Two levels of quoting are required in LDAP queries, the first for LDAP itself
10830 and the second because the LDAP query is represented as a URL. Furthermore,
10831 within an LDAP query, two different kinds of quoting are required. For this
10832 reason, there are two different LDAP-specific quoting operators.
10833 </para>
10834 <para>
10835 The <option>quote_ldap</option> operator is designed for use on strings that are part of
10836 filter specifications. Conceptually, it first does the following conversions on
10837 the string:
10838 </para>
10839 <literallayout class="monospaced">
10840 *   =&gt;   \2A
10841 (   =&gt;   \28
10842 )   =&gt;   \29
10843 \   =&gt;   \5C
10844 </literallayout>
10845 <para>
10846 in accordance with RFC 2254. The resulting string is then quoted according
10847 to the rules for URLs, that is, all non-alphanumeric characters except
10848 </para>
10849 <literallayout class="monospaced">
10850 ! $ ' - . _ ( ) * +
10851 </literallayout>
10852 <para>
10853 are converted to their hex values, preceded by a percent sign. For example:
10854 </para>
10855 <literallayout class="monospaced">
10856 ${quote_ldap: a(bc)*, a&lt;yz&gt;; }
10857 </literallayout>
10858 <para>
10859 yields
10860 </para>
10861 <literallayout class="monospaced">
10862 %20a%5C28bc%5C29%5C2A%2C%20a%3Cyz%3E%3B%20
10863 </literallayout>
10864 <para>
10865 Removing the URL quoting, this is (with a leading and a trailing space):
10866 </para>
10867 <literallayout class="monospaced">
10868 a\28bc\29\2A, a&lt;yz&gt;;
10869 </literallayout>
10870 <para>
10871 The <option>quote_ldap_dn</option> operator is designed for use on strings that are part of
10872 base DN specifications in queries. Conceptually, it first converts the string
10873 by inserting a backslash in front of any of the following characters:
10874 </para>
10875 <literallayout class="monospaced">
10876 , + " \ &lt; &gt; ;
10877 </literallayout>
10878 <para>
10879 It also inserts a backslash before any leading spaces or # characters, and
10880 before any trailing spaces. (These rules are in RFC 2253.) The resulting string
10881 is then quoted according to the rules for URLs. For example:
10882 </para>
10883 <literallayout class="monospaced">
10884 ${quote_ldap_dn: a(bc)*, a&lt;yz&gt;; }
10885 </literallayout>
10886 <para>
10887 yields
10888 </para>
10889 <literallayout class="monospaced">
10890 %5C%20a(bc)*%5C%2C%20a%5C%3Cyz%5C%3E%5C%3B%5C%20
10891 </literallayout>
10892 <para>
10893 Removing the URL quoting, this is (with a trailing space):
10894 </para>
10895 <literallayout class="monospaced">
10896 \ a(bc)*\, a\&lt;yz\&gt;\;\
10897 </literallayout>
10898 <para>
10899 There are some further comments about quoting in the section on LDAP
10900 authentication below.
10901 </para>
10902 </section>
10903 <section id="SECID69">
10904 <title>LDAP connections</title>
10905 <para>
10906 <indexterm role="concept">
10907 <primary>LDAP</primary>
10908 <secondary>connections</secondary>
10909 </indexterm>
10910 The connection to an LDAP server may either be over TCP/IP, or, when OpenLDAP
10911 is in use, via a Unix domain socket. The example given above does not specify
10912 an LDAP server. A server that is reached by TCP/IP can be specified in a query
10913 by starting it with
10914 </para>
10915 <literallayout class="monospaced">
10916 ldap://&lt;hostname&gt;:&lt;port&gt;/...
10917 </literallayout>
10918 <para>
10919 If the port (and preceding colon) are omitted, the standard LDAP port (389) is
10920 used. When no server is specified in a query, a list of default servers is
10921 taken from the <option>ldap_default_servers</option> configuration option. This supplies a
10922 colon-separated list of servers which are tried in turn until one successfully
10923 handles a query, or there is a serious error. Successful handling either
10924 returns the requested data, or indicates that it does not exist. Serious errors
10925 are syntactical, or multiple values when only a single value is expected.
10926 Errors which cause the next server to be tried are connection failures, bind
10927 failures, and timeouts.
10928 </para>
10929 <para>
10930 For each server name in the list, a port number can be given. The standard way
10931 of specifying a host and port is to use a colon separator (RFC 1738). Because
10932 <option>ldap_default_servers</option> is a colon-separated list, such colons have to be
10933 doubled. For example
10934 </para>
10935 <literallayout class="monospaced">
10936 ldap_default_servers = ldap1.example.com::145:ldap2.example.com
10937 </literallayout>
10938 <para>
10939 If <option>ldap_default_servers</option> is unset, a URL with no server name is passed
10940 to the LDAP library with no server name, and the library&#x2019;s default (normally
10941 the local host) is used.
10942 </para>
10943 <para>
10944 If you are using the OpenLDAP library, you can connect to an LDAP server using
10945 a Unix domain socket instead of a TCP/IP connection. This is specified by using
10946 <literal>ldapi</literal> instead of <literal>ldap</literal> in LDAP queries. What follows here applies only
10947 to OpenLDAP. If Exim is compiled with a different LDAP library, this feature is
10948 not available.
10949 </para>
10950 <para>
10951 For this type of connection, instead of a host name for the server, a pathname
10952 for the socket is required, and the port number is not relevant. The pathname
10953 can be specified either as an item in <option>ldap_default_servers</option>, or inline in
10954 the query. In the former case, you can have settings such as
10955 </para>
10956 <literallayout class="monospaced">
10957 ldap_default_servers = /tmp/ldap.sock : backup.ldap.your.domain
10958 </literallayout>
10959 <para>
10960 When the pathname is given in the query, you have to escape the slashes as
10961 <literal>%2F</literal> to fit in with the LDAP URL syntax. For example:
10962 </para>
10963 <literallayout class="monospaced">
10964 ${lookup ldap {ldapi://%2Ftmp%2Fldap.sock/o=...
10965 </literallayout>
10966 <para>
10967 When Exim processes an LDAP lookup and finds that the <quote>hostname</quote> is really
10968 a pathname, it uses the Unix domain socket code, even if the query actually
10969 specifies <literal>ldap</literal> or <literal>ldaps</literal>. In particular, no encryption is used for a
10970 socket connection. This behaviour means that you can use a setting of
10971 <option>ldap_default_servers</option> such as in the example above with traditional <literal>ldap</literal>
10972 or <literal>ldaps</literal> queries, and it will work. First, Exim tries a connection via
10973 the Unix domain socket; if that fails, it tries a TCP/IP connection to the
10974 backup host.
10975 </para>
10976 <para>
10977 If an explicit <literal>ldapi</literal> type is given in a query when a host name is
10978 specified, an error is diagnosed. However, if there are more items in
10979 <option>ldap_default_servers</option>, they are tried. In other words:
10980 </para>
10981 <itemizedlist>
10982 <listitem>
10983 <para>
10984 Using a pathname with <literal>ldap</literal> or <literal>ldaps</literal> forces the use of the Unix domain
10985 interface.
10986 </para>
10987 </listitem>
10988 <listitem>
10989 <para>
10990 Using <literal>ldapi</literal> with a host name causes an error.
10991 </para>
10992 </listitem>
10993 </itemizedlist>
10994 <para>
10995 Using <literal>ldapi</literal> with no host or path in the query, and no setting of
10996 <option>ldap_default_servers</option>, does whatever the library does by default.
10997 </para>
10998 </section>
10999 <section id="SECID70">
11000 <title>LDAP authentication and control information</title>
11001 <para>
11002 <indexterm role="concept">
11003 <primary>LDAP</primary>
11004 <secondary>authentication</secondary>
11005 </indexterm>
11006 The LDAP URL syntax provides no way of passing authentication and other control
11007 information to the server. To make this possible, the URL in an LDAP query may
11008 be preceded by any number of &lt;<emphasis>name</emphasis>&gt;=&lt;<emphasis>value</emphasis>&gt; settings, separated by
11009 spaces. If a value contains spaces it must be enclosed in double quotes, and
11010 when double quotes are used, backslash is interpreted in the usual way inside
11011 them. The following names are recognized:
11012 </para>
11013 <literallayout>
11014 <literal>DEREFERENCE</literal>  set the dereferencing parameter
11015 <literal>NETTIME    </literal>  set a timeout for a network operation
11016 <literal>USER       </literal>  set the DN, for authenticating the LDAP bind
11017 <literal>PASS       </literal>  set the password, likewise
11018 <literal>REFERRALS  </literal>  set the referrals parameter
11019 <literal>SERVERS    </literal>  set alternate server list for this query only
11020 <literal>SIZE       </literal>  set the limit for the number of entries returned
11021 <literal>TIME       </literal>  set the maximum waiting time for a query
11022 </literallayout>
11023 <para>
11024 The value of the DEREFERENCE parameter must be one of the words <quote>never</quote>,
11025 <quote>searching</quote>, <quote>finding</quote>, or <quote>always</quote>. The value of the REFERRALS parameter
11026 must be <quote>follow</quote> (the default) or <quote>nofollow</quote>. The latter stops the LDAP
11027 library from trying to follow referrals issued by the LDAP server.
11028 </para>
11029 <para>
11030 The name CONNECT is an obsolete name for NETTIME, retained for
11031 backwards compatibility. This timeout (specified as a number of seconds) is
11032 enforced from the client end for operations that can be carried out over a
11033 network. Specifically, it applies to network connections and calls to the
11034 <emphasis>ldap_result()</emphasis> function. If the value is greater than zero, it is used if
11035 LDAP_OPT_NETWORK_TIMEOUT is defined in the LDAP headers (OpenLDAP), or
11036 if LDAP_X_OPT_CONNECT_TIMEOUT is defined in the LDAP headers (Netscape
11037 SDK 4.1). A value of zero forces an explicit setting of <quote>no timeout</quote> for
11038 Netscape SDK; for OpenLDAP no action is taken.
11039 </para>
11040 <para>
11041 The TIME parameter (also a number of seconds) is passed to the server to
11042 set a server-side limit on the time taken to complete a search.
11043 </para>
11044 <para>
11045 The SERVERS parameter allows you to specify an alternate list of ldap servers
11046 to use for an individual lookup.  The global ldap_servers option provides a
11047 default list of ldap servers, and a single lookup can specify a single ldap
11048 server to use.  But when you need to do a lookup with a list of servers that is
11049 different than the default list (maybe different order, maybe a completely
11050 different set of servers), the SERVERS parameter allows you to specify this
11051 alternate list (colon-separated).
11052 </para>
11053 <para>
11054 Here is an example of an LDAP query in an Exim lookup that uses some of these
11055 values. This is a single line, folded to fit on the page:
11056 </para>
11057 <literallayout class="monospaced">
11058 ${lookup ldap
11059   {user="cn=manager,o=University of Cambridge,c=UK" pass=secret
11060   ldap:///o=University%20of%20Cambridge,c=UK?sn?sub?(cn=foo)}
11061   {$value}fail}
11062 </literallayout>
11063 <para>
11064 The encoding of spaces as <literal>%20</literal> is a URL thing which should not be done for
11065 any of the auxiliary data. Exim configuration settings that include lookups
11066 which contain password information should be preceded by <quote>hide</quote> to prevent
11067 non-admin users from using the <option>-bP</option> option to see their values.
11068 </para>
11069 <para>
11070 The auxiliary data items may be given in any order. The default is no
11071 connection timeout (the system timeout is used), no user or password, no limit
11072 on the number of entries returned, and no time limit on queries.
11073 </para>
11074 <para>
11075 When a DN is quoted in the USER= setting for LDAP authentication, Exim
11076 removes any URL quoting that it may contain before passing it LDAP. Apparently
11077 some libraries do this for themselves, but some do not. Removing the URL
11078 quoting has two advantages:
11079 </para>
11080 <itemizedlist>
11081 <listitem>
11082 <para>
11083 It makes it possible to use the same <option>quote_ldap_dn</option> expansion for USER=
11084 DNs as with DNs inside actual queries.
11085 </para>
11086 </listitem>
11087 <listitem>
11088 <para>
11089 It permits spaces inside USER= DNs.
11090 </para>
11091 </listitem>
11092 </itemizedlist>
11093 <para>
11094 For example, a setting such as
11095 </para>
11096 <literallayout class="monospaced">
11097 USER=cn=${quote_ldap_dn:$1}
11098 </literallayout>
11099 <para>
11100 should work even if <varname>$1</varname> contains spaces.
11101 </para>
11102 <para>
11103 Expanded data for the PASS= value should be quoted using the <option>quote</option>
11104 expansion operator, rather than the LDAP quote operators. The only reason this
11105 field needs quoting is to ensure that it conforms to the Exim syntax, which
11106 does not allow unquoted spaces. For example:
11107 </para>
11108 <literallayout class="monospaced">
11109 PASS=${quote:$3}
11110 </literallayout>
11111 <para>
11112 The LDAP authentication mechanism can be used to check passwords as part of
11113 SMTP authentication. See the <option>ldapauth</option> expansion string condition in chapter
11114 <xref linkend="CHAPexpand"/>.
11115 </para>
11116 </section>
11117 <section id="SECID71">
11118 <title>Format of data returned by LDAP</title>
11119 <para>
11120 <indexterm role="concept">
11121 <primary>LDAP</primary>
11122 <secondary>returned data formats</secondary>
11123 </indexterm>
11124 The <command>ldapdn</command> lookup type returns the Distinguished Name from a single entry
11125 as a sequence of values, for example
11126 </para>
11127 <literallayout class="monospaced">
11128 cn=manager, o=University of Cambridge, c=UK
11129 </literallayout>
11130 <para>
11131 The <command>ldap</command> lookup type generates an error if more than one entry matches the
11132 search filter, whereas <command>ldapm</command> permits this case, and inserts a newline in
11133 the result between the data from different entries. It is possible for multiple
11134 values to be returned for both <command>ldap</command> and <command>ldapm</command>, but in the former case
11135 you know that whatever values are returned all came from a single entry in the
11136 directory.
11137 </para>
11138 <para>
11139 In the common case where you specify a single attribute in your LDAP query, the
11140 result is not quoted, and does not contain the attribute name. If the attribute
11141 has multiple values, they are separated by commas.
11142 </para>
11143 <para>
11144 If you specify multiple attributes, the result contains space-separated, quoted
11145 strings, each preceded by the attribute name and an equals sign. Within the
11146 quotes, the quote character, backslash, and newline are escaped with
11147 backslashes, and commas are used to separate multiple values for the attribute.
11148 Any commas in attribute values are doubled
11149 (permitting treatment of the values as a comma-separated list).
11150 Apart from the escaping, the string within quotes takes the same form as the
11151 output when a single attribute is requested. Specifying no attributes is the
11152 same as specifying all of an entry&#x2019;s attributes.
11153 </para>
11154 <para>
11155 Here are some examples of the output format. The first line of each pair is an
11156 LDAP query, and the second is the data that is returned. The attribute called
11157 <option>attr1</option> has two values, one of them with an embedded comma, whereas
11158 <option>attr2</option> has only one value:
11159 </para>
11160 <literallayout class="monospaced">
11161 ldap:///o=base?attr1?sub?(uid=fred)
11162 value1.1,value1,,2
11163
11164 ldap:///o=base?attr2?sub?(uid=fred)
11165 value two
11166
11167 ldap:///o=base?attr1,attr2?sub?(uid=fred)
11168 attr1="value1.1,value1,,2" attr2="value two"
11169
11170 ldap:///o=base??sub?(uid=fred)
11171 objectClass="top" attr1="value1.1,value1,,2" attr2="value two"
11172 </literallayout>
11173 <para>
11174 You can
11175 make use of Exim&#x2019;s <option>-be</option> option to run expansion tests and thereby check the
11176 results of LDAP lookups.
11177 The <option>extract</option> operator in string expansions can be used to pick out
11178 individual fields from data that consists of <emphasis>key</emphasis>=<emphasis>value</emphasis> pairs.
11179 The <option>listextract</option> operator should be used to pick out individual values
11180 of attributes, even when only a single value is expected.
11181 The doubling of embedded commas allows you to use the returned data as a
11182 comma separated list (using the "&lt;," syntax for changing the input list separator).
11183 </para>
11184 </section>
11185 <section id="SECTnisplus">
11186 <title>More about NIS+</title>
11187 <para>
11188 <indexterm role="concept">
11189 <primary>NIS+ lookup type</primary>
11190 </indexterm>
11191 <indexterm role="concept">
11192 <primary>lookup</primary>
11193 <secondary>NIS+</secondary>
11194 </indexterm>
11195 NIS+ queries consist of a NIS+ <emphasis>indexed name</emphasis> followed by an optional colon
11196 and field name. If this is given, the result of a successful query is the
11197 contents of the named field; otherwise the result consists of a concatenation
11198 of <emphasis>field-name=field-value</emphasis> pairs, separated by spaces. Empty values and
11199 values containing spaces are quoted. For example, the query
11200 </para>
11201 <literallayout class="monospaced">
11202 [name=mg1456],passwd.org_dir
11203 </literallayout>
11204 <para>
11205 might return the string
11206 </para>
11207 <literallayout class="monospaced">
11208 name=mg1456 passwd="" uid=999 gid=999 gcos="Martin Guerre"
11209 home=/home/mg1456 shell=/bin/bash shadow=""
11210 </literallayout>
11211 <para>
11212 (split over two lines here to fit on the page), whereas
11213 </para>
11214 <literallayout class="monospaced">
11215 [name=mg1456],passwd.org_dir:gcos
11216 </literallayout>
11217 <para>
11218 would just return
11219 </para>
11220 <literallayout class="monospaced">
11221 Martin Guerre
11222 </literallayout>
11223 <para>
11224 with no quotes. A NIS+ lookup fails if NIS+ returns more than one table entry
11225 for the given indexed key. The effect of the <option>quote_nisplus</option> expansion
11226 operator is to double any quote characters within the text.
11227 </para>
11228 </section>
11229 <section id="SECTsql">
11230 <title>SQL lookups</title>
11231 <para>
11232 <indexterm role="concept">
11233 <primary>SQL lookup types</primary>
11234 </indexterm>
11235 <indexterm role="concept">
11236 <primary>MySQL</primary>
11237 <secondary>lookup type</secondary>
11238 </indexterm>
11239 <indexterm role="concept">
11240 <primary>PostgreSQL lookup type</primary>
11241 </indexterm>
11242 <indexterm role="concept">
11243 <primary>lookup</primary>
11244 <secondary>MySQL</secondary>
11245 </indexterm>
11246 <indexterm role="concept">
11247 <primary>lookup</primary>
11248 <secondary>PostgreSQL</secondary>
11249 </indexterm>
11250 <indexterm role="concept">
11251 <primary>Oracle</primary>
11252 <secondary>lookup type</secondary>
11253 </indexterm>
11254 <indexterm role="concept">
11255 <primary>lookup</primary>
11256 <secondary>Oracle</secondary>
11257 </indexterm>
11258 <indexterm role="concept">
11259 <primary>InterBase lookup type</primary>
11260 </indexterm>
11261 <indexterm role="concept">
11262 <primary>lookup</primary>
11263 <secondary>InterBase</secondary>
11264 </indexterm>
11265 Exim can support lookups in InterBase, MySQL, Oracle, PostgreSQL, and SQLite
11266 databases. Queries for these databases contain SQL statements, so an example
11267 might be
11268 </para>
11269 <literallayout class="monospaced">
11270 ${lookup mysql{select mailbox from users where id='userx'}\
11271   {$value}fail}
11272 </literallayout>
11273 <para>
11274 If the result of the query contains more than one field, the data for each
11275 field in the row is returned, preceded by its name, so the result of
11276 </para>
11277 <literallayout class="monospaced">
11278 ${lookup pgsql{select home,name from users where id='userx'}\
11279   {$value}}
11280 </literallayout>
11281 <para>
11282 might be
11283 </para>
11284 <literallayout class="monospaced">
11285 home=/home/userx name="Mister X"
11286 </literallayout>
11287 <para>
11288 Empty values and values containing spaces are double quoted, with embedded
11289 quotes escaped by a backslash. If the result of the query contains just one
11290 field, the value is passed back verbatim, without a field name, for example:
11291 </para>
11292 <literallayout class="monospaced">
11293 Mister X
11294 </literallayout>
11295 <para>
11296 If the result of the query yields more than one row, it is all concatenated,
11297 with a newline between the data for each row.
11298 </para>
11299 </section>
11300 <section id="SECID72">
11301 <title>More about MySQL, PostgreSQL, Oracle, and InterBase</title>
11302 <para>
11303 <indexterm role="concept">
11304 <primary>MySQL</primary>
11305 <secondary>lookup type</secondary>
11306 </indexterm>
11307 <indexterm role="concept">
11308 <primary>PostgreSQL lookup type</primary>
11309 </indexterm>
11310 <indexterm role="concept">
11311 <primary>lookup</primary>
11312 <secondary>MySQL</secondary>
11313 </indexterm>
11314 <indexterm role="concept">
11315 <primary>lookup</primary>
11316 <secondary>PostgreSQL</secondary>
11317 </indexterm>
11318 <indexterm role="concept">
11319 <primary>Oracle</primary>
11320 <secondary>lookup type</secondary>
11321 </indexterm>
11322 <indexterm role="concept">
11323 <primary>lookup</primary>
11324 <secondary>Oracle</secondary>
11325 </indexterm>
11326 <indexterm role="concept">
11327 <primary>InterBase lookup type</primary>
11328 </indexterm>
11329 <indexterm role="concept">
11330 <primary>lookup</primary>
11331 <secondary>InterBase</secondary>
11332 </indexterm>
11333 If any MySQL, PostgreSQL, Oracle, or InterBase lookups are used, the
11334 <option>mysql_servers</option>, <option>pgsql_servers</option>, <option>oracle_servers</option>, or <option>ibase_servers</option>
11335 option (as appropriate) must be set to a colon-separated list of server
11336 information.
11337 (For MySQL and PostgreSQL only, the global option need not be set if all
11338 queries contain their own server information &ndash; see section
11339 <xref linkend="SECTspeserque"/>.) Each item in the list is a slash-separated list of four
11340 items: host name, database name, user name, and password. In the case of
11341 Oracle, the host name field is used for the <quote>service name</quote>, and the database
11342 name field is not used and should be empty. For example:
11343 </para>
11344 <literallayout class="monospaced">
11345 hide oracle_servers = oracle.plc.example//userx/abcdwxyz
11346 </literallayout>
11347 <para>
11348 Because password data is sensitive, you should always precede the setting with
11349 <quote>hide</quote>, to prevent non-admin users from obtaining the setting via the <option>-bP</option>
11350 option. Here is an example where two MySQL servers are listed:
11351 </para>
11352 <literallayout class="monospaced">
11353 hide mysql_servers = localhost/users/root/secret:\
11354                      otherhost/users/root/othersecret
11355 </literallayout>
11356 <para>
11357 For MySQL and PostgreSQL, a host may be specified as &lt;<emphasis>name</emphasis>&gt;:&lt;<emphasis>port</emphasis>&gt; but
11358 because this is a colon-separated list, the colon has to be doubled. For each
11359 query, these parameter groups are tried in order until a connection is made and
11360 a query is successfully processed. The result of a query may be that no data is
11361 found, but that is still a successful query. In other words, the list of
11362 servers provides a backup facility, not a list of different places to look.
11363 </para>
11364 <para>
11365 The <option>quote_mysql</option>, <option>quote_pgsql</option>, and <option>quote_oracle</option> expansion operators
11366 convert newline, tab, carriage return, and backspace to \n, \t, \r, and \b
11367 respectively, and the characters single-quote, double-quote, and backslash
11368 itself are escaped with backslashes. The <option>quote_pgsql</option> expansion operator, in
11369 addition, escapes the percent and underscore characters. This cannot be done
11370 for MySQL because these escapes are not recognized in contexts where these
11371 characters are not special.
11372 </para>
11373 </section>
11374 <section id="SECTspeserque">
11375 <title>Specifying the server in the query</title>
11376 <para>
11377 For MySQL and PostgreSQL lookups (but not currently for Oracle and InterBase),
11378 it is possible to specify a list of servers with an individual query. This is
11379 done by starting the query with
11380 </para>
11381 <literallayout>
11382 <literal>servers=</literal><emphasis>server1:server2:server3:...</emphasis><literal>;</literal>
11383 </literallayout>
11384 <para>
11385 Each item in the list may take one of two forms:
11386 </para>
11387 <orderedlist numeration="arabic">
11388 <listitem>
11389 <para>
11390 If it contains no slashes it is assumed to be just a host name. The appropriate
11391 global option (<option>mysql_servers</option> or <option>pgsql_servers</option>) is searched for a host
11392 of the same name, and the remaining parameters (database, user, password) are
11393 taken from there.
11394 </para>
11395 </listitem>
11396 <listitem>
11397 <para>
11398 If it contains any slashes, it is taken as a complete parameter set.
11399 </para>
11400 </listitem>
11401 </orderedlist>
11402 <para>
11403 The list of servers is used in exactly the same way as the global list.
11404 Once a connection to a server has happened and a query has been
11405 successfully executed, processing of the lookup ceases.
11406 </para>
11407 <para>
11408 This feature is intended for use in master/slave situations where updates
11409 are occurring and you want to update the master rather than a slave. If the
11410 master is in the list as a backup for reading, you might have a global setting
11411 like this:
11412 </para>
11413 <literallayout class="monospaced">
11414 mysql_servers = slave1/db/name/pw:\
11415                 slave2/db/name/pw:\
11416                 master/db/name/pw
11417 </literallayout>
11418 <para>
11419 In an updating lookup, you could then write:
11420 </para>
11421 <literallayout class="monospaced">
11422 ${lookup mysql{servers=master; UPDATE ...} }
11423 </literallayout>
11424 <para>
11425 That query would then be sent only to the master server. If, on the other hand,
11426 the master is not to be used for reading, and so is not present in the global
11427 option, you can still update it by a query of this form:
11428 </para>
11429 <literallayout class="monospaced">
11430 ${lookup pgsql{servers=master/db/name/pw; UPDATE ...} }
11431 </literallayout>
11432 </section>
11433 <section id="SECID73">
11434 <title>Special MySQL features</title>
11435 <para>
11436 For MySQL, an empty host name or the use of <quote>localhost</quote> in <option>mysql_servers</option>
11437 causes a connection to the server on the local host by means of a Unix domain
11438 socket. An alternate socket can be specified in parentheses. The full syntax of
11439 each item in <option>mysql_servers</option> is:
11440 </para>
11441 <literallayout>
11442 &lt;<emphasis>hostname</emphasis>&gt;::&lt;<emphasis>port</emphasis>&gt;(&lt;<emphasis>socket name</emphasis>&gt;)/&lt;<emphasis>database</emphasis>&gt;/&lt;<emphasis>user</emphasis>&gt;/&lt;<emphasis>password</emphasis>&gt;
11443 </literallayout>
11444 <para>
11445 Any of the three sub-parts of the first field can be omitted. For normal use on
11446 the local host it can be left blank or set to just <quote>localhost</quote>.
11447 </para>
11448 <para>
11449 No database need be supplied &ndash; but if it is absent here, it must be given in
11450 the queries.
11451 </para>
11452 <para>
11453 If a MySQL query is issued that does not request any data (an insert, update,
11454 or delete command), the result of the lookup is the number of rows affected.
11455 </para>
11456 <para>
11457 <emphasis role="bold">Warning</emphasis>: This can be misleading. If an update does not actually change
11458 anything (for example, setting a field to the value it already has), the result
11459 is zero because no rows are affected.
11460 </para>
11461 </section>
11462 <section id="SECID74">
11463 <title>Special PostgreSQL features</title>
11464 <para>
11465 PostgreSQL lookups can also use Unix domain socket connections to the database.
11466 This is usually faster and costs less CPU time than a TCP/IP connection.
11467 However it can be used only if the mail server runs on the same machine as the
11468 database server. A configuration line for PostgreSQL via Unix domain sockets
11469 looks like this:
11470 </para>
11471 <literallayout class="monospaced">
11472 hide pgsql_servers = (/tmp/.s.PGSQL.5432)/db/user/password : ...
11473 </literallayout>
11474 <para>
11475 In other words, instead of supplying a host name, a path to the socket is
11476 given. The path name is enclosed in parentheses so that its slashes aren&#x2019;t
11477 visually confused with the delimiters for the other server parameters.
11478 </para>
11479 <para>
11480 If a PostgreSQL query is issued that does not request any data (an insert,
11481 update, or delete command), the result of the lookup is the number of rows
11482 affected.
11483 </para>
11484 </section>
11485 <section id="SECTsqlite">
11486 <title>More about SQLite</title>
11487 <para>
11488 <indexterm role="concept">
11489 <primary>lookup</primary>
11490 <secondary>SQLite</secondary>
11491 </indexterm>
11492 <indexterm role="concept">
11493 <primary>sqlite lookup type</primary>
11494 </indexterm>
11495 SQLite is different to the other SQL lookups because a file name is required in
11496 addition to the SQL query. An SQLite database is a single file, and there is no
11497 daemon as in the other SQL databases. The interface to Exim requires the name
11498 of the file, as an absolute path, to be given at the start of the query. It is
11499 separated from the query by white space. This means that the path name cannot
11500 contain white space. Here is a lookup expansion example:
11501 </para>
11502 <literallayout class="monospaced">
11503 ${lookup sqlite {/some/thing/sqlitedb \
11504   select name from aliases where id='userx';}}
11505 </literallayout>
11506 <para>
11507 In a list, the syntax is similar. For example:
11508 </para>
11509 <literallayout class="monospaced">
11510 domainlist relay_to_domains = sqlite;/some/thing/sqlitedb \
11511    select * from relays where ip='$sender_host_address';
11512 </literallayout>
11513 <para>
11514 The only character affected by the <option>quote_sqlite</option> operator is a single
11515 quote, which it doubles.
11516 </para>
11517 <para>
11518 The SQLite library handles multiple simultaneous accesses to the database
11519 internally. Multiple readers are permitted, but only one process can
11520 update at once. Attempts to access the database while it is being updated
11521 are rejected after a timeout period, during which the SQLite library
11522 waits for the lock to be released. In Exim, the default timeout is set
11523 to 5 seconds, but it can be changed by means of the <option>sqlite_lock_timeout</option>
11524 option.
11525 <indexterm role="concept" startref="IIDfidalo1" class="endofrange"/>
11526 <indexterm role="concept" startref="IIDfidalo2" class="endofrange"/>
11527 </para>
11528 </section>
11529 </chapter>
11530
11531 <chapter id="CHAPdomhosaddlists">
11532 <title>Domain, host, address, and local part lists</title>
11533 <titleabbrev>Domain, host, and address lists</titleabbrev>
11534 <para>
11535 <indexterm role="concept" id="IIDdohoadli" class="startofrange">
11536 <primary>lists of domains; hosts; etc.</primary>
11537 </indexterm>
11538 A number of Exim configuration options contain lists of domains, hosts,
11539 email addresses, or local parts. For example, the <option>hold_domains</option> option
11540 contains a list of domains whose delivery is currently suspended. These lists
11541 are also used as data in ACL statements (see chapter <xref linkend="CHAPACL"/>), and as
11542 arguments to expansion conditions such as <option>match_domain</option>.
11543 </para>
11544 <para>
11545 Each item in one of these lists is a pattern to be matched against a domain,
11546 host, email address, or local part, respectively. In the sections below, the
11547 different types of pattern for each case are described, but first we cover some
11548 general facilities that apply to all four kinds of list.
11549 </para>
11550 <para revisionflag="changed">
11551 Note that other parts of Exim use a <emphasis>string list</emphasis> which does not
11552 support all the complexity available in
11553 domain, host, address and local part lists.
11554 </para>
11555 <section id="SECID75">
11556 <title>Expansion of lists</title>
11557 <para>
11558 <indexterm role="concept">
11559 <primary>expansion</primary>
11560 <secondary>of lists</secondary>
11561 </indexterm>
11562 Each list is expanded as a single string before it is used. The result of
11563 expansion must be a list, possibly containing empty items, which is split up
11564 into separate items for matching. By default, colon is the separator character,
11565 but this can be varied if necessary. See sections <xref linkend="SECTlistconstruct"/> and
11566 <xref linkend="SECTempitelis"/> for details of the list syntax; the second of these
11567 discusses the way to specify empty list items.
11568 </para>
11569 <para>
11570 If the string expansion is forced to fail, Exim behaves as if the item it is
11571 testing (domain, host, address, or local part) is not in the list. Other
11572 expansion failures cause temporary errors.
11573 </para>
11574 <para>
11575 If an item in a list is a regular expression, backslashes, dollars and possibly
11576 other special characters in the expression must be protected against
11577 misinterpretation by the string expander. The easiest way to do this is to use
11578 the <literal>\N</literal> expansion feature to indicate that the contents of the regular
11579 expression should not be expanded. For example, in an ACL you might have:
11580 </para>
11581 <literallayout class="monospaced">
11582 deny senders = \N^\d{8}\w@.*\.baddomain\.example$\N : \
11583                ${lookup{$domain}lsearch{/badsenders/bydomain}}
11584 </literallayout>
11585 <para>
11586 The first item is a regular expression that is protected from expansion by
11587 <literal>\N</literal>, whereas the second uses the expansion to obtain a list of unwanted
11588 senders based on the receiving domain.
11589 </para>
11590 </section>
11591 <section id="SECID76">
11592 <title>Negated items in lists</title>
11593 <para>
11594 <indexterm role="concept">
11595 <primary>list</primary>
11596 <secondary>negation</secondary>
11597 </indexterm>
11598 <indexterm role="concept">
11599 <primary>negation</primary>
11600 <secondary>in lists</secondary>
11601 </indexterm>
11602 Items in a list may be positive or negative. Negative items are indicated by a
11603 leading exclamation mark, which may be followed by optional white space. A list
11604 defines a set of items (domains, etc). When Exim processes one of these lists,
11605 it is trying to find out whether a domain, host, address, or local part
11606 (respectively) is in the set that is defined by the list. It works like this:
11607 </para>
11608 <para>
11609 The list is scanned from left to right. If a positive item is matched, the
11610 subject that is being checked is in the set; if a negative item is matched, the
11611 subject is not in the set. If the end of the list is reached without the
11612 subject having matched any of the patterns, it is in the set if the last item
11613 was a negative one, but not if it was a positive one. For example, the list in
11614 </para>
11615 <literallayout class="monospaced">
11616 domainlist relay_to_domains = !a.b.c : *.b.c
11617 </literallayout>
11618 <para>
11619 matches any domain ending in <emphasis>.b.c</emphasis> except for <emphasis>a.b.c</emphasis>. Domains that match
11620 neither <emphasis>a.b.c</emphasis> nor <emphasis>*.b.c</emphasis> do not match, because the last item in the
11621 list is positive. However, if the setting were
11622 </para>
11623 <literallayout class="monospaced">
11624 domainlist relay_to_domains = !a.b.c
11625 </literallayout>
11626 <para>
11627 then all domains other than <emphasis>a.b.c</emphasis> would match because the last item in the
11628 list is negative. In other words, a list that ends with a negative item behaves
11629 as if it had an extra item <literal>:*</literal> on the end.
11630 </para>
11631 <para>
11632 Another way of thinking about positive and negative items in lists is to read
11633 the connector as <quote>or</quote> after a positive item and as <quote>and</quote> after a negative
11634 item.
11635 </para>
11636 </section>
11637 <section id="SECTfilnamlis">
11638 <title>File names in lists</title>
11639 <para>
11640 <indexterm role="concept">
11641 <primary>list</primary>
11642 <secondary>file name in</secondary>
11643 </indexterm>
11644 If an item in a domain, host, address, or local part list is an absolute file
11645 name (beginning with a slash character), each line of the file is read and
11646 processed as if it were an independent item in the list, except that further
11647 file names are not allowed,
11648 and no expansion of the data from the file takes place.
11649 Empty lines in the file are ignored, and the file may also contain comment
11650 lines:
11651 </para>
11652 <itemizedlist>
11653 <listitem>
11654 <para>
11655 For domain and host lists, if a # character appears anywhere in a line of the
11656 file, it and all following characters are ignored.
11657 </para>
11658 </listitem>
11659 <listitem>
11660 <para>
11661 Because local parts may legitimately contain # characters, a comment in an
11662 address list or local part list file is recognized only if # is preceded by
11663 white space or the start of the line. For example:
11664 </para>
11665 <literallayout class="monospaced">
11666 not#comment@x.y.z   # but this is a comment
11667 </literallayout>
11668 </listitem>
11669 </itemizedlist>
11670 <para>
11671 Putting a file name in a list has the same effect as inserting each line of the
11672 file as an item in the list (blank lines and comments excepted). However, there
11673 is one important difference: the file is read each time the list is processed,
11674 so if its contents vary over time, Exim&#x2019;s behaviour changes.
11675 </para>
11676 <para>
11677 If a file name is preceded by an exclamation mark, the sense of any match
11678 within the file is inverted. For example, if
11679 </para>
11680 <literallayout class="monospaced">
11681 hold_domains = !/etc/nohold-domains
11682 </literallayout>
11683 <para>
11684 and the file contains the lines
11685 </para>
11686 <literallayout class="monospaced">
11687 !a.b.c
11688 *.b.c
11689 </literallayout>
11690 <para>
11691 then <emphasis>a.b.c</emphasis> is in the set of domains defined by <option>hold_domains</option>, whereas
11692 any domain matching <literal>*.b.c</literal> is not.
11693 </para>
11694 </section>
11695 <section id="SECID77">
11696 <title>An lsearch file is not an out-of-line list</title>
11697 <para>
11698 As will be described in the sections that follow, lookups can be used in lists
11699 to provide indexed methods of checking list membership. There has been some
11700 confusion about the way <command>lsearch</command> lookups work in lists. Because
11701 an <command>lsearch</command> file contains plain text and is scanned sequentially, it is
11702 sometimes thought that it is allowed to contain wild cards and other kinds of
11703 non-constant pattern. This is not the case. The keys in an <command>lsearch</command> file are
11704 always fixed strings, just as for any other single-key lookup type.
11705 </para>
11706 <para>
11707 If you want to use a file to contain wild-card patterns that form part of a
11708 list, just give the file name on its own, without a search type, as described
11709 in the previous section. You could also use the <command>wildlsearch</command> or
11710 <command>nwildlsearch</command>, but there is no advantage in doing this.
11711 </para>
11712 </section>
11713 <section id="SECTnamedlists">
11714 <title>Named lists</title>
11715 <para>
11716 <indexterm role="concept">
11717 <primary>named lists</primary>
11718 </indexterm>
11719 <indexterm role="concept">
11720 <primary>list</primary>
11721 <secondary>named</secondary>
11722 </indexterm>
11723 A list of domains, hosts, email addresses, or local parts can be given a name
11724 which is then used to refer to the list elsewhere in the configuration. This is
11725 particularly convenient if the same list is required in several different
11726 places. It also allows lists to be given meaningful names, which can improve
11727 the readability of the configuration. For example, it is conventional to define
11728 a domain list called <emphasis>local_domains</emphasis> for all the domains that are handled
11729 locally on a host, using a configuration line such as
11730 </para>
11731 <literallayout class="monospaced">
11732 domainlist local_domains = localhost:my.dom.example
11733 </literallayout>
11734 <para>
11735 Named lists are referenced by giving their name preceded by a plus sign, so,
11736 for example, a router that is intended to handle local domains would be
11737 configured with the line
11738 </para>
11739 <literallayout class="monospaced">
11740 domains = +local_domains
11741 </literallayout>
11742 <para>
11743 The first router in a configuration is often one that handles all domains
11744 except the local ones, using a configuration with a negated item like this:
11745 </para>
11746 <literallayout class="monospaced">
11747 dnslookup:
11748   driver = dnslookup
11749   domains = ! +local_domains
11750   transport = remote_smtp
11751   no_more
11752 </literallayout>
11753 <para>
11754 The four kinds of named list are created by configuration lines starting with
11755 the words <option>domainlist</option>, <option>hostlist</option>, <option>addresslist</option>, or <option>localpartlist</option>,
11756 respectively. Then there follows the name that you are defining, followed by an
11757 equals sign and the list itself. For example:
11758 </para>
11759 <literallayout class="monospaced">
11760 hostlist    relay_from_hosts = 192.168.23.0/24 : my.friend.example
11761 addresslist bad_senders = cdb;/etc/badsenders
11762 </literallayout>
11763 <para>
11764 A named list may refer to other named lists:
11765 </para>
11766 <literallayout class="monospaced">
11767 domainlist  dom1 = first.example : second.example
11768 domainlist  dom2 = +dom1 : third.example
11769 domainlist  dom3 = fourth.example : +dom2 : fifth.example
11770 </literallayout>
11771 <para>
11772 <emphasis role="bold">Warning</emphasis>: If the last item in a referenced list is a negative one, the
11773 effect may not be what you intended, because the negation does not propagate
11774 out to the higher level. For example, consider:
11775 </para>
11776 <literallayout class="monospaced">
11777 domainlist  dom1 = !a.b
11778 domainlist  dom2 = +dom1 : *.b
11779 </literallayout>
11780 <para>
11781 The second list specifies <quote>either in the <option>dom1</option> list or <emphasis>*.b</emphasis></quote>. The first
11782 list specifies just <quote>not <emphasis>a.b</emphasis></quote>, so the domain <emphasis>x.y</emphasis> matches it. That
11783 means it matches the second list as well. The effect is not the same as
11784 </para>
11785 <literallayout class="monospaced">
11786 domainlist  dom2 = !a.b : *.b
11787 </literallayout>
11788 <para>
11789 where <emphasis>x.y</emphasis> does not match. It&#x2019;s best to avoid negation altogether in
11790 referenced lists if you can.
11791 </para>
11792 <para>
11793 Named lists may have a performance advantage. When Exim is routing an
11794 address or checking an incoming message, it caches the result of tests on named
11795 lists. So, if you have a setting such as
11796 </para>
11797 <literallayout class="monospaced">
11798 domains = +local_domains
11799 </literallayout>
11800 <para>
11801 on several of your routers
11802 or in several ACL statements,
11803 the actual test is done only for the first one. However, the caching works only
11804 if there are no expansions within the list itself or any sublists that it
11805 references. In other words, caching happens only for lists that are known to be
11806 the same each time they are referenced.
11807 </para>
11808 <para>
11809 By default, there may be up to 16 named lists of each type. This limit can be
11810 extended by changing a compile-time variable. The use of domain and host lists
11811 is recommended for concepts such as local domains, relay domains, and relay
11812 hosts. The default configuration is set up like this.
11813 </para>
11814 </section>
11815 <section id="SECID78">
11816 <title>Named lists compared with macros</title>
11817 <para>
11818 <indexterm role="concept">
11819 <primary>list</primary>
11820 <secondary>named compared with macro</secondary>
11821 </indexterm>
11822 <indexterm role="concept">
11823 <primary>macro</primary>
11824 <secondary>compared with named list</secondary>
11825 </indexterm>
11826 At first sight, named lists might seem to be no different from macros in the
11827 configuration file. However, macros are just textual substitutions. If you
11828 write
11829 </para>
11830 <literallayout class="monospaced">
11831 ALIST = host1 : host2
11832 auth_advertise_hosts = !ALIST
11833 </literallayout>
11834 <para>
11835 it probably won&#x2019;t do what you want, because that is exactly the same as
11836 </para>
11837 <literallayout class="monospaced">
11838 auth_advertise_hosts = !host1 : host2
11839 </literallayout>
11840 <para>
11841 Notice that the second host name is not negated. However, if you use a host
11842 list, and write
11843 </para>
11844 <literallayout class="monospaced">
11845 hostlist alist = host1 : host2
11846 auth_advertise_hosts = ! +alist
11847 </literallayout>
11848 <para>
11849 the negation applies to the whole list, and so that is equivalent to
11850 </para>
11851 <literallayout class="monospaced">
11852 auth_advertise_hosts = !host1 : !host2
11853 </literallayout>
11854 </section>
11855 <section id="SECID79">
11856 <title>Named list caching</title>
11857 <para>
11858 <indexterm role="concept">
11859 <primary>list</primary>
11860 <secondary>caching of named</secondary>
11861 </indexterm>
11862 <indexterm role="concept">
11863 <primary>caching</primary>
11864 <secondary>named lists</secondary>
11865 </indexterm>
11866 While processing a message, Exim caches the result of checking a named list if
11867 it is sure that the list is the same each time. In practice, this means that
11868 the cache operates only if the list contains no $ characters, which guarantees
11869 that it will not change when it is expanded. Sometimes, however, you may have
11870 an expanded list that you know will be the same each time within a given
11871 message. For example:
11872 </para>
11873 <literallayout class="monospaced">
11874 domainlist special_domains = \
11875            ${lookup{$sender_host_address}cdb{/some/file}}
11876 </literallayout>
11877 <para>
11878 This provides a list of domains that depends only on the sending host&#x2019;s IP
11879 address. If this domain list is referenced a number of times (for example,
11880 in several ACL lines, or in several routers) the result of the check is not
11881 cached by default, because Exim does not know that it is going to be the
11882 same list each time.
11883 </para>
11884 <para>
11885 By appending <literal>_cache</literal> to <literal>domainlist</literal> you can tell Exim to go ahead and
11886 cache the result anyway. For example:
11887 </para>
11888 <literallayout class="monospaced">
11889 domainlist_cache special_domains = ${lookup{...
11890 </literallayout>
11891 <para>
11892 If you do this, you should be absolutely sure that caching is going to do
11893 the right thing in all cases. When in doubt, leave it out.
11894 </para>
11895 </section>
11896 <section id="SECTdomainlist">
11897 <title>Domain lists</title>
11898 <para>
11899 <indexterm role="concept">
11900 <primary>domain list</primary>
11901 <secondary>patterns for</secondary>
11902 </indexterm>
11903 <indexterm role="concept">
11904 <primary>list</primary>
11905 <secondary>domain list</secondary>
11906 </indexterm>
11907 Domain lists contain patterns that are to be matched against a mail domain.
11908 The following types of item may appear in domain lists:
11909 </para>
11910 <itemizedlist>
11911 <listitem>
11912 <para>
11913 <indexterm role="concept">
11914 <primary>primary host name</primary>
11915 </indexterm>
11916 <indexterm role="concept">
11917 <primary>host name</primary>
11918 <secondary>matched in domain list</secondary>
11919 </indexterm>
11920 <indexterm role="option">
11921 <primary><option>primary_hostname</option></primary>
11922 </indexterm>
11923 <indexterm role="concept">
11924 <primary>domain list</primary>
11925 <secondary>matching primary host name</secondary>
11926 </indexterm>
11927 <indexterm role="concept">
11928 <primary>@ in a domain list</primary>
11929 </indexterm>
11930 If a pattern consists of a single @ character, it matches the local host name,
11931 as set by the <option>primary_hostname</option> option (or defaulted). This makes it
11932 possible to use the same configuration file on several different hosts that
11933 differ only in their names.
11934 </para>
11935 </listitem>
11936 <listitem>
11937 <para>
11938 <indexterm role="concept">
11939 <primary>@[] in a domain list</primary>
11940 </indexterm>
11941 <indexterm role="concept">
11942 <primary>domain list</primary>
11943 <secondary>matching local IP interfaces</secondary>
11944 </indexterm>
11945 <indexterm role="concept">
11946 <primary>domain literal</primary>
11947 </indexterm>
11948 If a pattern consists of the string <literal>@[]</literal> it matches an IP address enclosed
11949 in square brackets (as in an email address that contains a domain literal), but
11950 only if that IP address is recognized as local for email routing purposes. The
11951 <option>local_interfaces</option> and <option>extra_local_interfaces</option> options can be used to
11952 control which of a host&#x2019;s several IP addresses are treated as local.
11953 In today&#x2019;s Internet, the use of domain literals is controversial.
11954 </para>
11955 </listitem>
11956 <listitem>
11957 <para>
11958 <indexterm role="concept">
11959 <primary>@mx_any</primary>
11960 </indexterm>
11961 <indexterm role="concept">
11962 <primary>@mx_primary</primary>
11963 </indexterm>
11964 <indexterm role="concept">
11965 <primary>@mx_secondary</primary>
11966 </indexterm>
11967 <indexterm role="concept">
11968 <primary>domain list</primary>
11969 <secondary>matching MX pointers to local host</secondary>
11970 </indexterm>
11971 If a pattern consists of the string <literal>@mx_any</literal> it matches any domain that
11972 has an MX record pointing to the local host or to any host that is listed in
11973 <indexterm role="option">
11974 <primary><option>hosts_treat_as_local</option></primary>
11975 </indexterm>
11976 <option>hosts_treat_as_local</option>. The items <literal>@mx_primary</literal> and <literal>@mx_secondary</literal>
11977 are similar, except that the first matches only when a primary MX target is the
11978 local host, and the second only when no primary MX target is the local host,
11979 but a secondary MX target is. <quote>Primary</quote> means an MX record with the lowest
11980 preference value &ndash; there may of course be more than one of them.
11981 </para>
11982 <para>
11983 The MX lookup that takes place when matching a pattern of this type is
11984 performed with the resolver options for widening names turned off. Thus, for
11985 example, a single-component domain will <emphasis>not</emphasis> be expanded by adding the
11986 resolver&#x2019;s default domain. See the <option>qualify_single</option> and <option>search_parents</option>
11987 options of the <command>dnslookup</command> router for a discussion of domain widening.
11988 </para>
11989 <para>
11990 Sometimes you may want to ignore certain IP addresses when using one of these
11991 patterns. You can specify this by following the pattern with <literal>/ignore=</literal>&lt;<emphasis>ip
11992 list</emphasis>&gt;, where &lt;<emphasis>ip list</emphasis>&gt; is a list of IP addresses. These addresses are
11993 ignored when processing the pattern (compare the <option>ignore_target_hosts</option> option
11994 on a router). For example:
11995 </para>
11996 <literallayout class="monospaced">
11997 domains = @mx_any/ignore=127.0.0.1
11998 </literallayout>
11999 <para>
12000 This example matches any domain that has an MX record pointing to one of
12001 the local host&#x2019;s IP addresses other than 127.0.0.1.
12002 </para>
12003 <para>
12004 The list of IP addresses is in fact processed by the same code that processes
12005 host lists, so it may contain CIDR-coded network specifications and it may also
12006 contain negative items.
12007 </para>
12008 <para>
12009 Because the list of IP addresses is a sublist within a domain list, you have to
12010 be careful about delimiters if there is more than one address. Like any other
12011 list, the default delimiter can be changed. Thus, you might have:
12012 </para>
12013 <literallayout class="monospaced">
12014 domains = @mx_any/ignore=&lt;;127.0.0.1;0.0.0.0 : \
12015           an.other.domain : ...
12016 </literallayout>
12017 <para>
12018 so that the sublist uses semicolons for delimiters. When IPv6 addresses are
12019 involved, it is easiest to change the delimiter for the main list as well:
12020 </para>
12021 <literallayout class="monospaced">
12022 domains = &lt;? @mx_any/ignore=&lt;;127.0.0.1;::1 ? \
12023           an.other.domain ? ...
12024 </literallayout>
12025 </listitem>
12026 <listitem>
12027 <para>
12028 <indexterm role="concept">
12029 <primary>asterisk</primary>
12030 <secondary>in domain list</secondary>
12031 </indexterm>
12032 <indexterm role="concept">
12033 <primary>domain list</primary>
12034 <secondary>asterisk in</secondary>
12035 </indexterm>
12036 <indexterm role="concept">
12037 <primary>domain list</primary>
12038 <secondary>matching <quote>ends with</quote></secondary>
12039 </indexterm>
12040 If a pattern starts with an asterisk, the remaining characters of the pattern
12041 are compared with the terminating characters of the domain. The use of <quote>*</quote> in
12042 domain lists differs from its use in partial matching lookups. In a domain
12043 list, the character following the asterisk need not be a dot, whereas partial
12044 matching works only in terms of dot-separated components. For example, a domain
12045 list item such as <literal>*key.ex</literal> matches <emphasis>donkey.ex</emphasis> as well as
12046 <emphasis>cipher.key.ex</emphasis>.
12047 </para>
12048 </listitem>
12049 <listitem>
12050 <para>
12051 <indexterm role="concept">
12052 <primary>regular expressions</primary>
12053 <secondary>in domain list</secondary>
12054 </indexterm>
12055 <indexterm role="concept">
12056 <primary>domain list</primary>
12057 <secondary>matching regular expression</secondary>
12058 </indexterm>
12059 If a pattern starts with a circumflex character, it is treated as a regular
12060 expression, and matched against the domain using a regular expression matching
12061 function. The circumflex is treated as part of the regular expression.
12062 Email domains are case-independent, so this regular expression match is by
12063 default case-independent, but you can make it case-dependent by starting it
12064 with <literal>(?-i)</literal>. References to descriptions of the syntax of regular expressions
12065 are given in chapter <xref linkend="CHAPregexp"/>.
12066 </para>
12067 <para>
12068 <emphasis role="bold">Warning</emphasis>: Because domain lists are expanded before being processed, you
12069 must escape any backslash and dollar characters in the regular expression, or
12070 use the special <literal>\N</literal> sequence (see chapter <xref linkend="CHAPexpand"/>) to specify that
12071 it is not to be expanded (unless you really do want to build a regular
12072 expression by expansion, of course).
12073 </para>
12074 </listitem>
12075 <listitem>
12076 <para>
12077 <indexterm role="concept">
12078 <primary>lookup</primary>
12079 <secondary>in domain list</secondary>
12080 </indexterm>
12081 <indexterm role="concept">
12082 <primary>domain list</primary>
12083 <secondary>matching by lookup</secondary>
12084 </indexterm>
12085 If a pattern starts with the name of a single-key lookup type followed by a
12086 semicolon (for example, <quote>dbm;</quote> or <quote>lsearch;</quote>), the remainder of the pattern
12087 must be a file name in a suitable format for the lookup type. For example, for
12088 <quote>cdb;</quote> it must be an absolute path:
12089 </para>
12090 <literallayout class="monospaced">
12091 domains = cdb;/etc/mail/local_domains.cdb
12092 </literallayout>
12093 <para>
12094 The appropriate type of lookup is done on the file using the domain name as the
12095 key. In most cases, the data that is looked up is not used; Exim is interested
12096 only in whether or not the key is present in the file. However, when a lookup
12097 is used for the <option>domains</option> option on a router
12098 or a <option>domains</option> condition in an ACL statement, the data is preserved in the
12099 <varname>$domain_data</varname> variable and can be referred to in other router options or
12100 other statements in the same ACL.
12101 </para>
12102 </listitem>
12103 <listitem>
12104 <para>
12105 Any of the single-key lookup type names may be preceded by
12106 <literal>partial</literal>&lt;<emphasis>n</emphasis>&gt;<literal>-</literal>, where the &lt;<emphasis>n</emphasis>&gt; is optional, for example,
12107 </para>
12108 <literallayout class="monospaced">
12109 domains = partial-dbm;/partial/domains
12110 </literallayout>
12111 <para>
12112 This causes partial matching logic to be invoked; a description of how this
12113 works is given in section <xref linkend="SECTpartiallookup"/>.
12114 </para>
12115 </listitem>
12116 <listitem>
12117 <para>
12118 <indexterm role="concept">
12119 <primary>asterisk</primary>
12120 <secondary>in lookup type</secondary>
12121 </indexterm>
12122 Any of the single-key lookup types may be followed by an asterisk. This causes
12123 a default lookup for a key consisting of a single asterisk to be done if the
12124 original lookup fails. This is not a useful feature when using a domain list to
12125 select particular domains (because any domain would match), but it might have
12126 value if the result of the lookup is being used via the <varname>$domain_data</varname>
12127 expansion variable.
12128 </para>
12129 </listitem>
12130 <listitem>
12131 <para>
12132 If the pattern starts with the name of a query-style lookup type followed by a
12133 semicolon (for example, <quote>nisplus;</quote> or <quote>ldap;</quote>), the remainder of the
12134 pattern must be an appropriate query for the lookup type, as described in
12135 chapter <xref linkend="CHAPfdlookup"/>. For example:
12136 </para>
12137 <literallayout class="monospaced">
12138 hold_domains = mysql;select domain from holdlist \
12139   where domain = '${quote_mysql:$domain}';
12140 </literallayout>
12141 <para>
12142 In most cases, the data that is looked up is not used (so for an SQL query, for
12143 example, it doesn&#x2019;t matter what field you select). Exim is interested only in
12144 whether or not the query succeeds. However, when a lookup is used for the
12145 <option>domains</option> option on a router, the data is preserved in the <varname>$domain_data</varname>
12146 variable and can be referred to in other options.
12147 </para>
12148 </listitem>
12149 <listitem>
12150 <para>
12151 <indexterm role="concept">
12152 <primary>domain list</primary>
12153 <secondary>matching literal domain name</secondary>
12154 </indexterm>
12155 If none of the above cases apply, a caseless textual comparison is made
12156 between the pattern and the domain.
12157 </para>
12158 </listitem>
12159 </itemizedlist>
12160 <para>
12161 Here is an example that uses several different kinds of pattern:
12162 </para>
12163 <literallayout class="monospaced">
12164 domainlist funny_domains = \
12165   @ : \
12166   lib.unseen.edu : \
12167   *.foundation.fict.example : \
12168   \N^[1-2]\d{3}\.fict\.example$\N : \
12169   partial-dbm;/opt/data/penguin/book : \
12170   nis;domains.byname : \
12171   nisplus;[name=$domain,status=local],domains.org_dir
12172 </literallayout>
12173 <para>
12174 There are obvious processing trade-offs among the various matching modes. Using
12175 an asterisk is faster than a regular expression, and listing a few names
12176 explicitly probably is too. The use of a file or database lookup is expensive,
12177 but may be the only option if hundreds of names are required. Because the
12178 patterns are tested in order, it makes sense to put the most commonly matched
12179 patterns earlier.
12180 </para>
12181 </section>
12182 <section id="SECThostlist">
12183 <title>Host lists</title>
12184 <para>
12185 <indexterm role="concept">
12186 <primary>host list</primary>
12187 <secondary>patterns in</secondary>
12188 </indexterm>
12189 <indexterm role="concept">
12190 <primary>list</primary>
12191 <secondary>host list</secondary>
12192 </indexterm>
12193 Host lists are used to control what remote hosts are allowed to do. For
12194 example, some hosts may be allowed to use the local host as a relay, and some
12195 may be permitted to use the SMTP ETRN command. Hosts can be identified in
12196 two different ways, by name or by IP address. In a host list, some types of
12197 pattern are matched to a host name, and some are matched to an IP address.
12198 You need to be particularly careful with this when single-key lookups are
12199 involved, to ensure that the right value is being used as the key.
12200 </para>
12201 </section>
12202 <section id="SECID80">
12203 <title>Special host list patterns</title>
12204 <para>
12205 <indexterm role="concept">
12206 <primary>empty item in hosts list</primary>
12207 </indexterm>
12208 <indexterm role="concept">
12209 <primary>host list</primary>
12210 <secondary>empty string in</secondary>
12211 </indexterm>
12212 If a host list item is the empty string, it matches only when no remote host is
12213 involved. This is the case when a message is being received from a local
12214 process using SMTP on the standard input, that is, when a TCP/IP connection is
12215 not used.
12216 </para>
12217 <para>
12218 <indexterm role="concept">
12219 <primary>asterisk</primary>
12220 <secondary>in host list</secondary>
12221 </indexterm>
12222 The special pattern <quote>*</quote> in a host list matches any host or no host. Neither
12223 the IP address nor the name is actually inspected.
12224 </para>
12225 </section>
12226 <section id="SECThoslispatip">
12227 <title>Host list patterns that match by IP address</title>
12228 <para>
12229 <indexterm role="concept">
12230 <primary>host list</primary>
12231 <secondary>matching IP addresses</secondary>
12232 </indexterm>
12233 If an IPv4 host calls an IPv6 host and the call is accepted on an IPv6 socket,
12234 the incoming address actually appears in the IPv6 host as
12235 <literal>::ffff:</literal>&lt;<emphasis>v4address</emphasis>&gt;. When such an address is tested against a host
12236 list, it is converted into a traditional IPv4 address first. (Not all operating
12237 systems accept IPv4 calls on IPv6 sockets, as there have been some security
12238 concerns.)
12239 </para>
12240 <para>
12241 The following types of pattern in a host list check the remote host by
12242 inspecting its IP address:
12243 </para>
12244 <itemizedlist>
12245 <listitem>
12246 <para>
12247 If the pattern is a plain domain name (not a regular expression, not starting
12248 with *, not a lookup of any kind), Exim calls the operating system function
12249 to find the associated IP address(es). Exim uses the newer
12250 <function>getipnodebyname()</function> function when available, otherwise <function>gethostbyname()</function>.
12251 This typically causes a forward DNS lookup of the name. The result is compared
12252 with the IP address of the subject host.
12253 </para>
12254 <para>
12255 If there is a temporary problem (such as a DNS timeout) with the host name
12256 lookup, a temporary error occurs. For example, if the list is being used in an
12257 ACL condition, the ACL gives a <quote>defer</quote> response, usually leading to a
12258 temporary SMTP error code. If no IP address can be found for the host name,
12259 what happens is described in section <xref linkend="SECTbehipnot"/> below.
12260 </para>
12261 </listitem>
12262 <listitem>
12263 <para>
12264 <indexterm role="concept">
12265 <primary>@ in a host list</primary>
12266 </indexterm>
12267 If the pattern is <quote>@</quote>, the primary host name is substituted and used as a
12268 domain name, as just described.
12269 </para>
12270 </listitem>
12271 <listitem>
12272 <para>
12273 If the pattern is an IP address, it is matched against the IP address of the
12274 subject host. IPv4 addresses are given in the normal <quote>dotted-quad</quote> notation.
12275 IPv6 addresses can be given in colon-separated format, but the colons have to
12276 be doubled so as not to be taken as item separators when the default list
12277 separator is used. IPv6 addresses are recognized even when Exim is compiled
12278 without IPv6 support. This means that if they appear in a host list on an
12279 IPv4-only host, Exim will not treat them as host names. They are just addresses
12280 that can never match a client host.
12281 </para>
12282 </listitem>
12283 <listitem>
12284 <para>
12285 <indexterm role="concept">
12286 <primary>@[] in a host list</primary>
12287 </indexterm>
12288 If the pattern is <quote>@[]</quote>, it matches the IP address of any IP interface on
12289 the local host. For example, if the local host is an IPv4 host with one
12290 interface address 10.45.23.56, these two ACL statements have the same effect:
12291 </para>
12292 <literallayout class="monospaced">
12293 accept hosts = 127.0.0.1 : 10.45.23.56
12294 accept hosts = @[]
12295 </literallayout>
12296 </listitem>
12297 <listitem>
12298 <para>
12299 <indexterm role="concept">
12300 <primary>CIDR notation</primary>
12301 </indexterm>
12302 If the pattern is an IP address followed by a slash and a mask length (for
12303 example 10.11.42.0/24), it is matched against the IP address of the subject
12304 host under the given mask. This allows, an entire network of hosts to be
12305 included (or excluded) by a single item. The mask uses CIDR notation; it
12306 specifies the number of address bits that must match, starting from the most
12307 significant end of the address.
12308 </para>
12309 <para>
12310 <emphasis role="bold">Note</emphasis>: The mask is <emphasis>not</emphasis> a count of addresses, nor is it the high number
12311 of a range of addresses. It is the number of bits in the network portion of the
12312 address. The above example specifies a 24-bit netmask, so it matches all 256
12313 addresses in the 10.11.42.0 network. An item such as
12314 </para>
12315 <literallayout class="monospaced">
12316 192.168.23.236/31
12317 </literallayout>
12318 <para>
12319 matches just two addresses, 192.168.23.236 and 192.168.23.237. A mask value of
12320 32 for an IPv4 address is the same as no mask at all; just a single address
12321 matches.
12322 </para>
12323 <para>
12324 Here is another example which shows an IPv4 and an IPv6 network:
12325 </para>
12326 <literallayout class="monospaced">
12327 recipient_unqualified_hosts = 192.168.0.0/16: \
12328                               3ffe::ffff::836f::::/48
12329 </literallayout>
12330 <para>
12331 The doubling of list separator characters applies only when these items
12332 appear inline in a host list. It is not required when indirecting via a file.
12333 For example:
12334 </para>
12335 <literallayout class="monospaced">
12336 recipient_unqualified_hosts = /opt/exim/unqualnets
12337 </literallayout>
12338 <para>
12339 could make use of a file containing
12340 </para>
12341 <literallayout class="monospaced">
12342 172.16.0.0/12
12343 3ffe:ffff:836f::/48
12344 </literallayout>
12345 <para>
12346 to have exactly the same effect as the previous example. When listing IPv6
12347 addresses inline, it is usually more convenient to use the facility for
12348 changing separator characters. This list contains the same two networks:
12349 </para>
12350 <literallayout class="monospaced">
12351 recipient_unqualified_hosts = &lt;; 172.16.0.0/12; \
12352                                  3ffe:ffff:836f::/48
12353 </literallayout>
12354 <para>
12355 The separator is changed to semicolon by the leading <quote>&lt;;</quote> at the start of the
12356 list.
12357 </para>
12358 </listitem>
12359 </itemizedlist>
12360 </section>
12361 <section id="SECThoslispatsikey">
12362 <title>Host list patterns for single-key lookups by host address</title>
12363 <para>
12364 <indexterm role="concept">
12365 <primary>host list</primary>
12366 <secondary>lookup of IP address</secondary>
12367 </indexterm>
12368 When a host is to be identified by a single-key lookup of its complete IP
12369 address, the pattern takes this form:
12370 </para>
12371 <literallayout>
12372 <literal>net-&lt;</literal><emphasis>single-key-search-type</emphasis><literal>&gt;;&lt;</literal><emphasis>search-data</emphasis><literal>&gt;</literal>
12373 </literallayout>
12374 <para>
12375 For example:
12376 </para>
12377 <literallayout class="monospaced">
12378 hosts_lookup = net-cdb;/hosts-by-ip.db
12379 </literallayout>
12380 <para>
12381 The text form of the IP address of the subject host is used as the lookup key.
12382 IPv6 addresses are converted to an unabbreviated form, using lower case
12383 letters, with dots as separators because colon is the key terminator in
12384 <command>lsearch</command> files. [Colons can in fact be used in keys in <command>lsearch</command> files by
12385 quoting the keys, but this is a facility that was added later.] The data
12386 returned by the lookup is not used.
12387 </para>
12388 <para>
12389 <indexterm role="concept">
12390 <primary>IP address</primary>
12391 <secondary>masking</secondary>
12392 </indexterm>
12393 <indexterm role="concept">
12394 <primary>host list</primary>
12395 <secondary>masked IP address</secondary>
12396 </indexterm>
12397 Single-key lookups can also be performed using masked IP addresses, using
12398 patterns of this form:
12399 </para>
12400 <literallayout>
12401 <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>
12402 </literallayout>
12403 <para>
12404 For example:
12405 </para>
12406 <literallayout class="monospaced">
12407 net24-dbm;/networks.db
12408 </literallayout>
12409 <para>
12410 The IP address of the subject host is masked using &lt;<emphasis>number</emphasis>&gt; as the mask
12411 length. A textual string is constructed from the masked value, followed by the
12412 mask, and this is used as the lookup key. For example, if the host&#x2019;s IP address
12413 is 192.168.34.6, the key that is looked up for the above example is
12414 <quote>192.168.34.0/24</quote>.
12415 </para>
12416 <para>
12417 When an IPv6 address is converted to a string, dots are normally used instead
12418 of colons, so that keys in <command>lsearch</command> files need not contain colons (which
12419 terminate <command>lsearch</command> keys). This was implemented some time before the ability
12420 to quote keys was made available in <command>lsearch</command> files. However, the more
12421 recently implemented <command>iplsearch</command> files do require colons in IPv6 keys
12422 (notated using the quoting facility) so as to distinguish them from IPv4 keys.
12423 For this reason, when the lookup type is <command>iplsearch</command>, IPv6 addresses are
12424 converted using colons and not dots. In all cases, full, unabbreviated IPv6
12425 addresses are always used.
12426 </para>
12427 <para>
12428 Ideally, it would be nice to tidy up this anomalous situation by changing to
12429 colons in all cases, given that quoting is now available for <command>lsearch</command>.
12430 However, this would be an incompatible change that might break some existing
12431 configurations.
12432 </para>
12433 <para>
12434 <emphasis role="bold">Warning</emphasis>: Specifying <option>net32-</option> (for an IPv4 address) or <option>net128-</option> (for an
12435 IPv6 address) is not the same as specifying just <option>net-</option> without a number. In
12436 the former case the key strings include the mask value, whereas in the latter
12437 case the IP address is used on its own.
12438 </para>
12439 </section>
12440 <section id="SECThoslispatnam">
12441 <title>Host list patterns that match by host name</title>
12442 <para>
12443 <indexterm role="concept">
12444 <primary>host</primary>
12445 <secondary>lookup failures</secondary>
12446 </indexterm>
12447 <indexterm role="concept">
12448 <primary>unknown host name</primary>
12449 </indexterm>
12450 <indexterm role="concept">
12451 <primary>host list</primary>
12452 <secondary>matching host name</secondary>
12453 </indexterm>
12454 There are several types of pattern that require Exim to know the name of the
12455 remote host. These are either wildcard patterns or lookups by name. (If a
12456 complete hostname is given without any wildcarding, it is used to find an IP
12457 address to match against, as described in section <xref linkend="SECThoslispatip"/>
12458 above.)
12459 </para>
12460 <para>
12461 If the remote host name is not already known when Exim encounters one of these
12462 patterns, it has to be found from the IP address.
12463 Although many sites on the Internet are conscientious about maintaining reverse
12464 DNS data for their hosts, there are also many that do not do this.
12465 Consequently, a name cannot always be found, and this may lead to unwanted
12466 effects. Take care when configuring host lists with wildcarded name patterns.
12467 Consider what will happen if a name cannot be found.
12468 </para>
12469 <para>
12470 Because of the problems of determining host names from IP addresses, matching
12471 against host names is not as common as matching against IP addresses.
12472 </para>
12473 <para>
12474 By default, in order to find a host name, Exim first does a reverse DNS lookup;
12475 if no name is found in the DNS, the system function (<function>gethostbyaddr()</function> or
12476 <function>getipnodebyaddr()</function> if available) is tried. The order in which these lookups
12477 are done can be changed by setting the <option>host_lookup_order</option> option. For
12478 security, once Exim has found one or more names, it looks up the IP addresses
12479 for these names and compares them with the IP address that it started with.
12480 Only those names whose IP addresses match are accepted. Any other names are
12481 discarded. If no names are left, Exim behaves as if the host name cannot be
12482 found. In the most common case there is only one name and one IP address.
12483 </para>
12484 <para>
12485 There are some options that control what happens if a host name cannot be
12486 found. These are described in section <xref linkend="SECTbehipnot"/> below.
12487 </para>
12488 <para>
12489 <indexterm role="concept">
12490 <primary>host</primary>
12491 <secondary>alias for</secondary>
12492 </indexterm>
12493 <indexterm role="concept">
12494 <primary>alias for host</primary>
12495 </indexterm>
12496 As a result of aliasing, hosts may have more than one name. When processing any
12497 of the following types of pattern, all the host&#x2019;s names are checked:
12498 </para>
12499 <itemizedlist>
12500 <listitem>
12501 <para>
12502 <indexterm role="concept">
12503 <primary>asterisk</primary>
12504 <secondary>in host list</secondary>
12505 </indexterm>
12506 If a pattern starts with <quote>*</quote> the remainder of the item must match the end of
12507 the host name. For example, <literal>*.b.c</literal> matches all hosts whose names end in
12508 <emphasis>.b.c</emphasis>. This special simple form is provided because this is a very common
12509 requirement. Other kinds of wildcarding require the use of a regular
12510 expression.
12511 </para>
12512 </listitem>
12513 <listitem>
12514 <para>
12515 <indexterm role="concept">
12516 <primary>regular expressions</primary>
12517 <secondary>in host list</secondary>
12518 </indexterm>
12519 <indexterm role="concept">
12520 <primary>host list</primary>
12521 <secondary>regular expression in</secondary>
12522 </indexterm>
12523 If the item starts with <quote>^</quote> it is taken to be a regular expression which is
12524 matched against the host name. Host names are case-independent, so this regular
12525 expression match is by default case-independent, but you can make it
12526 case-dependent by starting it with <literal>(?-i)</literal>. References to descriptions of the
12527 syntax of regular expressions are given in chapter <xref linkend="CHAPregexp"/>. For
12528 example,
12529 </para>
12530 <literallayout class="monospaced">
12531 ^(a|b)\.c\.d$
12532 </literallayout>
12533 <para>
12534 is a regular expression that matches either of the two hosts <emphasis>a.c.d</emphasis> or
12535 <emphasis>b.c.d</emphasis>. When a regular expression is used in a host list, you must take care
12536 that backslash and dollar characters are not misinterpreted as part of the
12537 string expansion. The simplest way to do this is to use <literal>\N</literal> to mark that
12538 part of the string as non-expandable. For example:
12539 </para>
12540 <literallayout class="monospaced">
12541 sender_unqualified_hosts = \N^(a|b)\.c\.d$\N : ....
12542 </literallayout>
12543 <para>
12544 <emphasis role="bold">Warning</emphasis>: If you want to match a complete host name, you must include the
12545 <literal>$</literal> terminating metacharacter in the regular expression, as in the above
12546 example. Without it, a match at the start of the host name is all that is
12547 required.
12548 </para>
12549 </listitem>
12550 </itemizedlist>
12551 </section>
12552 <section id="SECTbehipnot">
12553 <title>Behaviour when an IP address or name cannot be found</title>
12554 <para>
12555 <indexterm role="concept">
12556 <primary>host</primary>
12557 <secondary>lookup failures, permanent</secondary>
12558 </indexterm>
12559 While processing a host list, Exim may need to look up an IP address from a
12560 name (see section <xref linkend="SECThoslispatip"/>), or it may need to look up a host name
12561 from an IP address (see section <xref linkend="SECThoslispatnam"/>). In either case, the
12562 behaviour when it fails to find the information it is seeking is the same.
12563 </para>
12564 <para>
12565 <emphasis role="bold">Note</emphasis>: This section applies to permanent lookup failures. It does <emphasis>not</emphasis>
12566 apply to temporary DNS errors, whose handling is described in the next section.
12567 </para>
12568 <para>
12569 <indexterm role="concept">
12570 <primary><literal>+include_unknown</literal></primary>
12571 </indexterm>
12572 <indexterm role="concept">
12573 <primary><literal>+ignore_unknown</literal></primary>
12574 </indexterm>
12575 Exim parses a host list from left to right. If it encounters a permanent
12576 lookup failure in any item in the host list before it has found a match,
12577 Exim treats it as a failure and the default behavior is as if the host
12578 does not match the list. This may not always be what you want to happen.
12579 To change Exim&#x2019;s behaviour, the special items <literal>+include_unknown</literal> or
12580 <literal>+ignore_unknown</literal> may appear in the list (at top level &ndash; they are
12581 not recognized in an indirected file).
12582 </para>
12583 <itemizedlist>
12584 <listitem>
12585 <para>
12586 If any item that follows <literal>+include_unknown</literal> requires information that
12587 cannot found, Exim behaves as if the host does match the list. For example,
12588 </para>
12589 <literallayout class="monospaced">
12590 host_reject_connection = +include_unknown:*.enemy.ex
12591 </literallayout>
12592 <para>
12593 rejects connections from any host whose name matches <literal>*.enemy.ex</literal>, and also
12594 any hosts whose name it cannot find.
12595 </para>
12596 </listitem>
12597 <listitem>
12598 <para>
12599 If any item that follows <literal>+ignore_unknown</literal> requires information that cannot
12600 be found, Exim ignores that item and proceeds to the rest of the list. For
12601 example:
12602 </para>
12603 <literallayout class="monospaced">
12604 accept hosts = +ignore_unknown : friend.example : \
12605                192.168.4.5
12606 </literallayout>
12607 <para>
12608 accepts from any host whose name is <emphasis>friend.example</emphasis> and from 192.168.4.5,
12609 whether or not its host name can be found. Without <literal>+ignore_unknown</literal>, if no
12610 name can be found for 192.168.4.5, it is rejected.
12611 </para>
12612 </listitem>
12613 </itemizedlist>
12614 <para>
12615 Both <literal>+include_unknown</literal> and <literal>+ignore_unknown</literal> may appear in the same
12616 list. The effect of each one lasts until the next, or until the end of the
12617 list.
12618 </para>
12619 </section>
12620 <section id="SECTmixwilhos">
12621 <title>Mixing wildcarded host names and addresses in host lists</title>
12622 <para>
12623 <indexterm role="concept">
12624 <primary>host list</primary>
12625 <secondary>mixing names and addresses in</secondary>
12626 </indexterm>
12627 </para>
12628 <para>
12629 This section explains the host/ip processing logic with the same concepts
12630 as the previous section, but specifically addresses what happens when a
12631 wildcarded hostname is one of the items in the hostlist.
12632 </para>
12633 <itemizedlist>
12634 <listitem>
12635 <para>
12636 If you have name lookups or wildcarded host names and
12637 IP addresses in the same host list, you should normally put the IP
12638 addresses first. For example, in an ACL you could have:
12639 </para>
12640 <literallayout class="monospaced">
12641 accept hosts = 10.9.8.7 : *.friend.example
12642 </literallayout>
12643 <para>
12644 The reason you normally would order it this way lies in the
12645 left-to-right way that Exim processes lists.  It can test IP addresses
12646 without doing any DNS lookups, but when it reaches an item that requires
12647 a host name, it fails if it cannot find a host name to compare with the
12648 pattern. If the above list is given in the opposite order, the
12649 <option>accept</option> statement fails for a host whose name cannot be found, even
12650 if its IP address is 10.9.8.7.
12651 </para>
12652 </listitem>
12653 <listitem>
12654 <para>
12655 If you really do want to do the name check first, and still recognize the IP
12656 address, you can rewrite the ACL like this:
12657 </para>
12658 <literallayout class="monospaced">
12659 accept hosts = *.friend.example
12660 accept hosts = 10.9.8.7
12661 </literallayout>
12662 <para>
12663 If the first <option>accept</option> fails, Exim goes on to try the second one. See chapter
12664 <xref linkend="CHAPACL"/> for details of ACLs. Alternatively, you can use
12665 <literal>+ignore_unknown</literal>, which was discussed in depth in the first example in
12666 this section.
12667 </para>
12668 </listitem>
12669 </itemizedlist>
12670 </section>
12671 <section id="SECTtemdnserr">
12672 <title>Temporary DNS errors when looking up host information</title>
12673 <para>
12674 <indexterm role="concept">
12675 <primary>host</primary>
12676 <secondary>lookup failures, temporary</secondary>
12677 </indexterm>
12678 <indexterm role="concept">
12679 <primary><literal>+include_defer</literal></primary>
12680 </indexterm>
12681 <indexterm role="concept">
12682 <primary><literal>+ignore_defer</literal></primary>
12683 </indexterm>
12684 A temporary DNS lookup failure normally causes a defer action (except when
12685 <option>dns_again_means_nonexist</option> converts it into a permanent error). However,
12686 host lists can include <literal>+ignore_defer</literal> and <literal>+include_defer</literal>, analogous to
12687 <literal>+ignore_unknown</literal> and <literal>+include_unknown</literal>, as described in the previous
12688 section. These options should be used with care, probably only in non-critical
12689 host lists such as whitelists.
12690 </para>
12691 </section>
12692 <section id="SECThoslispatnamsk">
12693 <title>Host list patterns for single-key lookups by host name</title>
12694 <para>
12695 <indexterm role="concept">
12696 <primary>unknown host name</primary>
12697 </indexterm>
12698 <indexterm role="concept">
12699 <primary>host list</primary>
12700 <secondary>matching host name</secondary>
12701 </indexterm>
12702 If a pattern is of the form
12703 </para>
12704 <literallayout>
12705 &lt;<emphasis>single-key-search-type</emphasis>&gt;;&lt;<emphasis>search-data</emphasis>&gt;
12706 </literallayout>
12707 <para>
12708 for example
12709 </para>
12710 <literallayout class="monospaced">
12711 dbm;/host/accept/list
12712 </literallayout>
12713 <para>
12714 a single-key lookup is performed, using the host name as its key. If the
12715 lookup succeeds, the host matches the item. The actual data that is looked up
12716 is not used.
12717 </para>
12718 <para>
12719 <emphasis role="bold">Reminder</emphasis>: With this kind of pattern, you must have host <emphasis>names</emphasis> as
12720 keys in the file, not IP addresses. If you want to do lookups based on IP
12721 addresses, you must precede the search type with <quote>net-</quote> (see section
12722 <xref linkend="SECThoslispatsikey"/>). There is, however, no reason why you could not use
12723 two items in the same list, one doing an address lookup and one doing a name
12724 lookup, both using the same file.
12725 </para>
12726 </section>
12727 <section id="SECID81">
12728 <title>Host list patterns for query-style lookups</title>
12729 <para>
12730 If a pattern is of the form
12731 </para>
12732 <literallayout>
12733 &lt;<emphasis>query-style-search-type</emphasis>&gt;;&lt;<emphasis>query</emphasis>&gt;
12734 </literallayout>
12735 <para>
12736 the query is obeyed, and if it succeeds, the host matches the item. The actual
12737 data that is looked up is not used. The variables <varname>$sender_host_address</varname> and
12738 <varname>$sender_host_name</varname> can be used in the query. For example:
12739 </para>
12740 <literallayout class="monospaced">
12741 hosts_lookup = pgsql;\
12742   select ip from hostlist where ip='$sender_host_address'
12743 </literallayout>
12744 <para>
12745 The value of <varname>$sender_host_address</varname> for an IPv6 address contains colons. You
12746 can use the <option>sg</option> expansion item to change this if you need to. If you want to
12747 use masked IP addresses in database queries, you can use the <option>mask</option> expansion
12748 operator.
12749 </para>
12750 <para>
12751 If the query contains a reference to <varname>$sender_host_name</varname>, Exim automatically
12752 looks up the host name if it has not already done so. (See section
12753 <xref linkend="SECThoslispatnam"/> for comments on finding host names.)
12754 </para>
12755 <para>
12756 Historical note: prior to release 4.30, Exim would always attempt to find a
12757 host name before running the query, unless the search type was preceded by
12758 <literal>net-</literal>. This is no longer the case. For backwards compatibility, <literal>net-</literal> is
12759 still recognized for query-style lookups, but its presence or absence has no
12760 effect. (Of course, for single-key lookups, <literal>net-</literal> <emphasis>is</emphasis> important.
12761 See section <xref linkend="SECThoslispatsikey"/>.)
12762 </para>
12763 </section>
12764 <section id="SECTaddresslist">
12765 <title>Address lists</title>
12766 <para>
12767 <indexterm role="concept">
12768 <primary>list</primary>
12769 <secondary>address list</secondary>
12770 </indexterm>
12771 <indexterm role="concept">
12772 <primary>address list</primary>
12773 <secondary>empty item</secondary>
12774 </indexterm>
12775 <indexterm role="concept">
12776 <primary>address list</primary>
12777 <secondary>patterns</secondary>
12778 </indexterm>
12779 Address lists contain patterns that are matched against mail addresses. There
12780 is one special case to be considered: the sender address of a bounce message is
12781 always empty. You can test for this by providing an empty item in an address
12782 list. For example, you can set up a router to process bounce messages by
12783 using this option setting:
12784 </para>
12785 <literallayout class="monospaced">
12786 senders = :
12787 </literallayout>
12788 <para>
12789 The presence of the colon creates an empty item. If you do not provide any
12790 data, the list is empty and matches nothing. The empty sender can also be
12791 detected by a regular expression that matches an empty string,
12792 and by a query-style lookup that succeeds when <varname>$sender_address</varname> is empty.
12793 </para>
12794 <para>
12795 Non-empty items in an address list can be straightforward email addresses. For
12796 example:
12797 </para>
12798 <literallayout class="monospaced">
12799 senders = jbc@askone.example : hs@anacreon.example
12800 </literallayout>
12801 <para>
12802 A certain amount of wildcarding is permitted. If a pattern contains an @
12803 character, but is not a regular expression and does not begin with a
12804 semicolon-terminated lookup type (described below), the local part of the
12805 subject address is compared with the local part of the pattern, which may start
12806 with an asterisk. If the local parts match, the domain is checked in exactly
12807 the same way as for a pattern in a domain list. For example, the domain can be
12808 wildcarded, refer to a named list, or be a lookup:
12809 </para>
12810 <literallayout class="monospaced">
12811 deny senders = *@*.spamming.site:\
12812                *@+hostile_domains:\
12813                bozo@partial-lsearch;/list/of/dodgy/sites:\
12814                *@dbm;/bad/domains.db
12815 </literallayout>
12816 <para>
12817 <indexterm role="concept">
12818 <primary>local part</primary>
12819 <secondary>starting with !</secondary>
12820 </indexterm>
12821 <indexterm role="concept">
12822 <primary>address list</primary>
12823 <secondary>local part starting with !</secondary>
12824 </indexterm>
12825 If a local part that begins with an exclamation mark is required, it has to be
12826 specified using a regular expression, because otherwise the exclamation mark is
12827 treated as a sign of negation, as is standard in lists.
12828 </para>
12829 <para>
12830 If a non-empty pattern that is not a regular expression or a lookup does not
12831 contain an @ character, it is matched against the domain part of the subject
12832 address. The only two formats that are recognized this way are a literal
12833 domain, or a domain pattern that starts with *. In both these cases, the effect
12834 is the same as if <literal>*@</literal> preceded the pattern. For example:
12835 </para>
12836 <literallayout class="monospaced">
12837 deny senders = enemy.domain : *.enemy.domain
12838 </literallayout>
12839 <para>
12840 The following kinds of more complicated address list pattern can match any
12841 address, including the empty address that is characteristic of bounce message
12842 senders:
12843 </para>
12844 <itemizedlist>
12845 <listitem>
12846 <para>
12847 <indexterm role="concept">
12848 <primary>regular expressions</primary>
12849 <secondary>in address list</secondary>
12850 </indexterm>
12851 <indexterm role="concept">
12852 <primary>address list</primary>
12853 <secondary>regular expression in</secondary>
12854 </indexterm>
12855 If (after expansion) a pattern starts with <quote>^</quote>, a regular expression match is
12856 done against the complete address, with the pattern as the regular expression.
12857 You must take care that backslash and dollar characters are not misinterpreted
12858 as part of the string expansion. The simplest way to do this is to use <literal>\N</literal>
12859 to mark that part of the string as non-expandable. For example:
12860 </para>
12861 <literallayout class="monospaced">
12862 deny senders = \N^.*this.*@example\.com$\N : \
12863                \N^\d{8}.+@spamhaus.example$\N : ...
12864 </literallayout>
12865 <para>
12866 The <literal>\N</literal> sequences are removed by the expansion, so these items do indeed
12867 start with <quote>^</quote> by the time they are being interpreted as address patterns.
12868 </para>
12869 </listitem>
12870 <listitem>
12871 <para>
12872 <indexterm role="concept">
12873 <primary>address list</primary>
12874 <secondary>lookup for complete address</secondary>
12875 </indexterm>
12876 Complete addresses can be looked up by using a pattern that starts with a
12877 lookup type terminated by a semicolon, followed by the data for the lookup. For
12878 example:
12879 </para>
12880 <literallayout class="monospaced">
12881 deny senders = cdb;/etc/blocked.senders : \
12882   mysql;select address from blocked where \
12883   address='${quote_mysql:$sender_address}'
12884 </literallayout>
12885 <para>
12886 Both query-style and single-key lookup types can be used. For a single-key
12887 lookup type, Exim uses the complete address as the key. However, empty keys are
12888 not supported for single-key lookups, so a match against the empty address
12889 always fails. This restriction does not apply to query-style lookups.
12890 </para>
12891 <para>
12892 Partial matching for single-key lookups (section <xref linkend="SECTpartiallookup"/>)
12893 cannot be used, and is ignored if specified, with an entry being written to the
12894 panic log.
12895 <indexterm role="concept">
12896 <primary>*@ with single-key lookup</primary>
12897 </indexterm>
12898 However, you can configure lookup defaults, as described in section
12899 <xref linkend="SECTdefaultvaluelookups"/>, but this is useful only for the <quote>*@</quote> type of
12900 default. For example, with this lookup:
12901 </para>
12902 <literallayout class="monospaced">
12903 accept senders = lsearch*@;/some/file
12904 </literallayout>
12905 <para>
12906 the file could contains lines like this:
12907 </para>
12908 <literallayout class="monospaced">
12909 user1@domain1.example
12910 *@domain2.example
12911 </literallayout>
12912 <para>
12913 and for the sender address <emphasis>nimrod@jaeger.example</emphasis>, the sequence of keys
12914 that are tried is:
12915 </para>
12916 <literallayout class="monospaced">
12917 nimrod@jaeger.example
12918 *@jaeger.example
12919 *
12920 </literallayout>
12921 <para>
12922 <emphasis role="bold">Warning 1</emphasis>: Do not include a line keyed by <quote>*</quote> in the file, because that
12923 would mean that every address matches, thus rendering the test useless.
12924 </para>
12925 <para>
12926 <emphasis role="bold">Warning 2</emphasis>: Do not confuse these two kinds of item:
12927 </para>
12928 <literallayout class="monospaced">
12929 deny recipients = dbm*@;/some/file
12930 deny recipients = *@dbm;/some/file
12931 </literallayout>
12932 <para>
12933 The first does a whole address lookup, with defaulting, as just described,
12934 because it starts with a lookup type. The second matches the local part and
12935 domain independently, as described in a bullet point below.
12936 </para>
12937 </listitem>
12938 </itemizedlist>
12939 <para>
12940 The following kinds of address list pattern can match only non-empty addresses.
12941 If the subject address is empty, a match against any of these pattern types
12942 always fails.
12943 </para>
12944 <itemizedlist>
12945 <listitem>
12946 <para>
12947 <indexterm role="concept">
12948 <primary>@@ with single-key lookup</primary>
12949 </indexterm>
12950 <indexterm role="concept">
12951 <primary>address list</primary>
12952 <secondary>@@ lookup type</secondary>
12953 </indexterm>
12954 <indexterm role="concept">
12955 <primary>address list</primary>
12956 <secondary>split local part and domain</secondary>
12957 </indexterm>
12958 If a pattern starts with <quote>@@</quote> followed by a single-key lookup item
12959 (for example, <literal>@@lsearch;/some/file</literal>), the address that is being checked is
12960 split into a local part and a domain. The domain is looked up in the file. If
12961 it is not found, there is no match. If it is found, the data that is looked up
12962 from the file is treated as a colon-separated list of local part patterns, each
12963 of which is matched against the subject local part in turn.
12964 </para>
12965 <para>
12966 <indexterm role="concept">
12967 <primary>asterisk</primary>
12968 <secondary>in address list</secondary>
12969 </indexterm>
12970 The lookup may be a partial one, and/or one involving a search for a default
12971 keyed by <quote>*</quote> (see section <xref linkend="SECTdefaultvaluelookups"/>). The local part
12972 patterns that are looked up can be regular expressions or begin with <quote>*</quote>, or
12973 even be further lookups. They may also be independently negated. For example,
12974 with
12975 </para>
12976 <literallayout class="monospaced">
12977 deny senders = @@dbm;/etc/reject-by-domain
12978 </literallayout>
12979 <para>
12980 the data from which the DBM file is built could contain lines like
12981 </para>
12982 <literallayout class="monospaced">
12983 baddomain.com:  !postmaster : *
12984 </literallayout>
12985 <para>
12986 to reject all senders except <option>postmaster</option> from that domain.
12987 </para>
12988 <para>
12989 <indexterm role="concept">
12990 <primary>local part</primary>
12991 <secondary>starting with !</secondary>
12992 </indexterm>
12993 If a local part that actually begins with an exclamation mark is required, it
12994 has to be specified using a regular expression. In <command>lsearch</command> files, an entry
12995 may be split over several lines by indenting the second and subsequent lines,
12996 but the separating colon must still be included at line breaks. White space
12997 surrounding the colons is ignored. For example:
12998 </para>
12999 <literallayout class="monospaced">
13000 aol.com:  spammer1 : spammer2 : ^[0-9]+$ :
13001   spammer3 : spammer4
13002 </literallayout>
13003 <para>
13004 As in all colon-separated lists in Exim, a colon can be included in an item by
13005 doubling.
13006 </para>
13007 <para>
13008 If the last item in the list starts with a right angle-bracket, the remainder
13009 of the item is taken as a new key to look up in order to obtain a continuation
13010 list of local parts. The new key can be any sequence of characters. Thus one
13011 might have entries like
13012 </para>
13013 <literallayout class="monospaced">
13014 aol.com: spammer1 : spammer 2 : &gt;*
13015 xyz.com: spammer3 : &gt;*
13016 *:       ^\d{8}$
13017 </literallayout>
13018 <para>
13019 in a file that was searched with <option>@@dbm*</option>, to specify a match for 8-digit
13020 local parts for all domains, in addition to the specific local parts listed for
13021 each domain. Of course, using this feature costs another lookup each time a
13022 chain is followed, but the effort needed to maintain the data is reduced.
13023 </para>
13024 <para>
13025 <indexterm role="concept">
13026 <primary>loop</primary>
13027 <secondary>in lookups</secondary>
13028 </indexterm>
13029 It is possible to construct loops using this facility, and in order to catch
13030 them, the chains may be no more than fifty items long.
13031 </para>
13032 </listitem>
13033 <listitem>
13034 <para>
13035 The @@&lt;<emphasis>lookup</emphasis>&gt; style of item can also be used with a query-style
13036 lookup, but in this case, the chaining facility is not available. The lookup
13037 can only return a single list of local parts.
13038 </para>
13039 </listitem>
13040 </itemizedlist>
13041 <para>
13042 <emphasis role="bold">Warning</emphasis>: There is an important difference between the address list items
13043 in these two examples:
13044 </para>
13045 <literallayout class="monospaced">
13046 senders = +my_list
13047 senders = *@+my_list
13048 </literallayout>
13049 <para>
13050 In the first one, <literal>my_list</literal> is a named address list, whereas in the second
13051 example it is a named domain list.
13052 </para>
13053 </section>
13054 <section id="SECTcasletadd">
13055 <title>Case of letters in address lists</title>
13056 <para>
13057 <indexterm role="concept">
13058 <primary>case of local parts</primary>
13059 </indexterm>
13060 <indexterm role="concept">
13061 <primary>address list</primary>
13062 <secondary>case forcing</secondary>
13063 </indexterm>
13064 <indexterm role="concept">
13065 <primary>case forcing in address lists</primary>
13066 </indexterm>
13067 Domains in email addresses are always handled caselessly, but for local parts
13068 case may be significant on some systems (see <option>caseful_local_part</option> for how
13069 Exim deals with this when routing addresses). However, RFC 2505 (<emphasis>Anti-Spam
13070 Recommendations for SMTP MTAs</emphasis>) suggests that matching of addresses to
13071 blocking lists should be done in a case-independent manner. Since most address
13072 lists in Exim are used for this kind of control, Exim attempts to do this by
13073 default.
13074 </para>
13075 <para>
13076 The domain portion of an address is always lowercased before matching it to an
13077 address list. The local part is lowercased by default, and any string
13078 comparisons that take place are done caselessly. This means that the data in
13079 the address list itself, in files included as plain file names, and in any file
13080 that is looked up using the <quote>@@</quote> mechanism, can be in any case. However, the
13081 keys in files that are looked up by a search type other than <command>lsearch</command> (which
13082 works caselessly) must be in lower case, because these lookups are not
13083 case-independent.
13084 </para>
13085 <para>
13086 <indexterm role="concept">
13087 <primary><literal>+caseful</literal></primary>
13088 </indexterm>
13089 To allow for the possibility of caseful address list matching, if an item in
13090 an address list is the string <quote>+caseful</quote>, the original case of the local
13091 part is restored for any comparisons that follow, and string comparisons are no
13092 longer case-independent. This does not affect the domain, which remains in
13093 lower case. However, although independent matches on the domain alone are still
13094 performed caselessly, regular expressions that match against an entire address
13095 become case-sensitive after <quote>+caseful</quote> has been seen.
13096 </para>
13097 </section>
13098 <section id="SECTlocparlis">
13099 <title>Local part lists</title>
13100 <para>
13101 <indexterm role="concept">
13102 <primary>list</primary>
13103 <secondary>local part list</secondary>
13104 </indexterm>
13105 <indexterm role="concept">
13106 <primary>local part</primary>
13107 <secondary>list</secondary>
13108 </indexterm>
13109 Case-sensitivity in local part lists is handled in the same way as for address
13110 lists, as just described. The <quote>+caseful</quote> item can be used if required. In a
13111 setting of the <option>local_parts</option> option in a router with <option>caseful_local_part</option>
13112 set false, the subject is lowercased and the matching is initially
13113 case-insensitive. In this case, <quote>+caseful</quote> will restore case-sensitive
13114 matching in the local part list, but not elsewhere in the router. If
13115 <option>caseful_local_part</option> is set true in a router, matching in the <option>local_parts</option>
13116 option is case-sensitive from the start.
13117 </para>
13118 <para>
13119 If a local part list is indirected to a file (see section <xref linkend="SECTfilnamlis"/>),
13120 comments are handled in the same way as address lists &ndash; they are recognized
13121 only if the # is preceded by white space or the start of the line.
13122 Otherwise, local part lists are matched in the same way as domain lists, except
13123 that the special items that refer to the local host (<literal>@</literal>, <literal>@[]</literal>,
13124 <literal>@mx_any</literal>, <literal>@mx_primary</literal>, and <literal>@mx_secondary</literal>) are not recognized.
13125 Refer to section <xref linkend="SECTdomainlist"/> for details of the other available item
13126 types.
13127 <indexterm role="concept" startref="IIDdohoadli" class="endofrange"/>
13128 </para>
13129 </section>
13130 </chapter>
13131
13132 <chapter id="CHAPexpand">
13133 <title>String expansions</title>
13134 <para>
13135 <indexterm role="concept" id="IIDstrexp" class="startofrange">
13136 <primary>expansion</primary>
13137 <secondary>of strings</secondary>
13138 </indexterm>
13139 Many strings in Exim&#x2019;s run time configuration are expanded before use. Some of
13140 them are expanded every time they are used; others are expanded only once.
13141 </para>
13142 <para>
13143 When a string is being expanded it is copied verbatim from left to right except
13144 when a dollar or backslash character is encountered. A dollar specifies the
13145 start of a portion of the string that is interpreted and replaced as described
13146 below in section <xref linkend="SECTexpansionitems"/> onwards. Backslash is used as an
13147 escape character, as described in the following section.
13148 </para>
13149 <para>
13150 Whether a string is expanded depends upon the context.  Usually this is solely
13151 dependent upon the option for which a value is sought; in this documentation,
13152 options for which string expansion is performed are marked with &dagger; after
13153 the data type.  ACL rules always expand strings.  A couple of expansion
13154 conditions do not expand some of the brace-delimited branches, for security
13155 reasons.
13156 </para>
13157 <section id="SECTlittext">
13158 <title>Literal text in expanded strings</title>
13159 <para>
13160 <indexterm role="concept">
13161 <primary>expansion</primary>
13162 <secondary>including literal text</secondary>
13163 </indexterm>
13164 An uninterpreted dollar can be included in an expanded string by putting a
13165 backslash in front of it. A backslash can be used to prevent any special
13166 character being treated specially in an expansion, including backslash itself.
13167 If the string appears in quotes in the configuration file, two backslashes are
13168 required because the quotes themselves cause interpretation of backslashes when
13169 the string is read in (see section <xref linkend="SECTstrings"/>).
13170 </para>
13171 <para>
13172 <indexterm role="concept">
13173 <primary>expansion</primary>
13174 <secondary>non-expandable substrings</secondary>
13175 </indexterm>
13176 A portion of the string can specified as non-expandable by placing it between
13177 two occurrences of <literal>\N</literal>. This is particularly useful for protecting regular
13178 expressions, which often contain backslashes and dollar signs. For example:
13179 </para>
13180 <literallayout class="monospaced">
13181 deny senders = \N^\d{8}[a-z]@some\.site\.example$\N
13182 </literallayout>
13183 <para>
13184 On encountering the first <literal>\N</literal>, the expander copies subsequent characters
13185 without interpretation until it reaches the next <literal>\N</literal> or the end of the
13186 string.
13187 </para>
13188 </section>
13189 <section id="SECID82">
13190 <title>Character escape sequences in expanded strings</title>
13191 <para>
13192 <indexterm role="concept">
13193 <primary>expansion</primary>
13194 <secondary>escape sequences</secondary>
13195 </indexterm>
13196 A backslash followed by one of the letters <quote>n</quote>, <quote>r</quote>, or <quote>t</quote> in an
13197 expanded string is recognized as an escape sequence for the character newline,
13198 carriage return, or tab, respectively. A backslash followed by up to three
13199 octal digits is recognized as an octal encoding for a single character, and a
13200 backslash followed by <quote>x</quote> and up to two hexadecimal digits is a hexadecimal
13201 encoding.
13202 </para>
13203 <para>
13204 These escape sequences are also recognized in quoted strings when they are read
13205 in. Their interpretation in expansions as well is useful for unquoted strings,
13206 and for other cases such as looked-up strings that are then expanded.
13207 </para>
13208 </section>
13209 <section id="SECID83">
13210 <title>Testing string expansions</title>
13211 <para>
13212 <indexterm role="concept">
13213 <primary>expansion</primary>
13214 <secondary>testing</secondary>
13215 </indexterm>
13216 <indexterm role="concept">
13217 <primary>testing</primary>
13218 <secondary>string expansion</secondary>
13219 </indexterm>
13220 <indexterm role="option">
13221 <primary><option>-be</option></primary>
13222 </indexterm>
13223 Many expansions can be tested by calling Exim with the <option>-be</option> option. This
13224 takes the command arguments, or lines from the standard input if there are no
13225 arguments, runs them through the string expansion code, and writes the results
13226 to the standard output. Variables based on configuration values are set up, but
13227 since no message is being processed, variables such as <varname>$local_part</varname> have no
13228 value. Nevertheless the <option>-be</option> option can be useful for checking out file and
13229 database lookups, and the use of expansion operators such as <option>sg</option>, <option>substr</option>
13230 and <option>nhash</option>.
13231 </para>
13232 <para>
13233 Exim gives up its root privilege when it is called with the <option>-be</option> option, and
13234 instead runs under the uid and gid it was called with, to prevent users from
13235 using <option>-be</option> for reading files to which they do not have access.
13236 </para>
13237 <para>
13238 <indexterm role="option">
13239 <primary><option>-bem</option></primary>
13240 </indexterm>
13241 If you want to test expansions that include variables whose values are taken
13242 from a message, there are two other options that can be used. The <option>-bem</option>
13243 option is like <option>-be</option> except that it is followed by a file name. The file is
13244 read as a message before doing the test expansions. For example:
13245 </para>
13246 <literallayout class="monospaced">
13247 exim -bem /tmp/test.message '$h_subject:'
13248 </literallayout>
13249 <para>
13250 The <option>-Mset</option> option is used in conjunction with <option>-be</option> and is followed by an
13251 Exim message identifier. For example:
13252 </para>
13253 <literallayout class="monospaced">
13254 exim -be -Mset 1GrA8W-0004WS-LQ '$recipients'
13255 </literallayout>
13256 <para>
13257 This loads the message from Exim&#x2019;s spool before doing the test expansions, and
13258 is therefore restricted to admin users.
13259 </para>
13260 </section>
13261 <section id="SECTforexpfai">
13262 <title>Forced expansion failure</title>
13263 <para>
13264 <indexterm role="concept">
13265 <primary>expansion</primary>
13266 <secondary>forced failure</secondary>
13267 </indexterm>
13268 A number of expansions that are described in the following section have
13269 alternative <quote>true</quote> and <quote>false</quote> substrings, enclosed in brace characters
13270 (which are sometimes called <quote>curly brackets</quote>). Which of the two strings is
13271 used depends on some condition that is evaluated as part of the expansion. If,
13272 instead of a <quote>false</quote> substring, the word <quote>fail</quote> is used (not in braces),
13273 the entire string expansion fails in a way that can be detected by the code
13274 that requested the expansion. This is called <quote>forced expansion failure</quote>, and
13275 its consequences depend on the circumstances. In some cases it is no different
13276 from any other expansion failure, but in others a different action may be
13277 taken. Such variations are mentioned in the documentation of the option that is
13278 being expanded.
13279 </para>
13280 </section>
13281 <section id="SECTexpansionitems">
13282 <title>Expansion items</title>
13283 <para>
13284 The following items are recognized in expanded strings. White space may be used
13285 between sub-items that are keywords or substrings enclosed in braces inside an
13286 outer set of braces, to improve readability. <emphasis role="bold">Warning</emphasis>: Within braces,
13287 white space is significant.
13288 </para>
13289 <variablelist>
13290 <varlistentry>
13291 <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>
13292 <listitem>
13293 <para>
13294 <indexterm role="concept">
13295 <primary>expansion</primary>
13296 <secondary>variables</secondary>
13297 </indexterm>
13298 Substitute the contents of the named variable, for example:
13299 </para>
13300 <literallayout class="monospaced">
13301 $local_part
13302 ${domain}
13303 </literallayout>
13304 <para>
13305 The second form can be used to separate the name from subsequent alphanumeric
13306 characters. This form (using braces) is available only for variables; it does
13307 <emphasis>not</emphasis> apply to message headers. The names of the variables are given in
13308 section <xref linkend="SECTexpvar"/> below. If the name of a non-existent variable is
13309 given, the expansion fails.
13310 </para>
13311 </listitem></varlistentry>
13312 <varlistentry>
13313 <term><emphasis role="bold">${</emphasis>&lt;<emphasis>op</emphasis>&gt;<emphasis role="bold">:</emphasis>&lt;<emphasis>string</emphasis>&gt;<emphasis role="bold">}</emphasis></term>
13314 <listitem>
13315 <para>
13316 <indexterm role="concept">
13317 <primary>expansion</primary>
13318 <secondary>operators</secondary>
13319 </indexterm>
13320 The string is first itself expanded, and then the operation specified by
13321 &lt;<emphasis>op</emphasis>&gt; is applied to it. For example:
13322 </para>
13323 <literallayout class="monospaced">
13324 ${lc:$local_part}
13325 </literallayout>
13326 <para>
13327 The string starts with the first character after the colon, which may be
13328 leading white space. A list of operators is given in section <xref linkend="SECTexpop"/>
13329 below. The operator notation is used for simple expansion items that have just
13330 one argument, because it reduces the number of braces and therefore makes the
13331 string easier to understand.
13332 </para>
13333 </listitem></varlistentry>
13334 <varlistentry>
13335 <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>
13336 <listitem>
13337 <para>
13338 This item inserts <quote>basic</quote> header lines. It is described with the <option>header</option>
13339 expansion item below.
13340 </para>
13341 </listitem></varlistentry>
13342 <varlistentry>
13343 <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>
13344 <listitem>
13345 <para>
13346 <indexterm role="concept">
13347 <primary>expansion</primary>
13348 <secondary>calling an acl</secondary>
13349 </indexterm>
13350 <indexterm role="concept">
13351 <primary><option>acl</option></primary>
13352 <secondary>call from expansion</secondary>
13353 </indexterm>
13354 The name and zero to nine argument strings are first expanded separately.  The expanded
13355 arguments are assigned to the variables <varname>$acl_arg1</varname> to <varname>$acl_arg9</varname> in order.
13356 Any unused are made empty.  The variable <varname>$acl_narg</varname> is set to the number of
13357 arguments.  The named ACL (see chapter <xref linkend="CHAPACL"/>) is called
13358 and may use the variables; if another acl expansion is used the values
13359 are restored after it returns.  If the ACL sets
13360 a value using a "message =" modifier and returns accept or deny, the value becomes
13361 the result of the expansion.
13362 If no message is set and the ACL returns accept or deny
13363 the expansion result is an empty string.
13364 If the ACL returns defer the result is a forced-fail.  Otherwise the expansion fails.
13365 </para>
13366 </listitem></varlistentry>
13367 <varlistentry>
13368 <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>
13369 <listitem>
13370 <para>
13371 <indexterm role="concept">
13372 <primary>expansion</primary>
13373 <secondary>extracting cerificate fields</secondary>
13374 </indexterm>
13375 <indexterm role="concept">
13376 <primary><option>certextract</option></primary>
13377 <secondary>certificate fields</secondary>
13378 </indexterm>
13379 <indexterm role="concept">
13380 <primary>certificate</primary>
13381 <secondary>extracting fields</secondary>
13382 </indexterm>
13383 The &lt;<emphasis>certificate</emphasis>&gt; must be a variable of type certificate.
13384 The field name is expanded and used to retrieve the relevant field from
13385 the certificate.  Supported fields are:
13386 </para>
13387 <literallayout>
13388 <literal>version        </literal>
13389 <literal>serial_number  </literal>
13390 <literal>subject        </literal> RFC4514 DN
13391 <literal>issuer         </literal> RFC4514 DN
13392 <literal>notbefore      </literal> time
13393 <literal>notafter       </literal> time
13394 <literal>sig_algorithm  </literal>
13395 <literal>signature      </literal>
13396 <literal>subj_altname   </literal> tagged list
13397 <literal>ocsp_uri       </literal> list
13398 <literal>crl_uri        </literal> list
13399 </literallayout>
13400 <para>
13401 If the field is found,
13402 &lt;<emphasis>string2</emphasis>&gt; is expanded, and replaces the whole item;
13403 otherwise &lt;<emphasis>string3</emphasis>&gt; is used. During the expansion of &lt;<emphasis>string2</emphasis>&gt; the
13404 variable <varname>$value</varname> contains the value that has been extracted. Afterwards, it
13405 is restored to any previous value it might have had.
13406 </para>
13407 <para>
13408 If {&lt;<emphasis>string3</emphasis>&gt;} is omitted, the item is replaced by an empty string if the
13409 key is not found. If {&lt;<emphasis>string2</emphasis>&gt;} is also omitted, the value that was
13410 extracted is used.
13411 </para>
13412 <para>
13413 Some field names take optional modifiers, appended and separated by commas.
13414 </para>
13415 <para>
13416 The field selectors marked as "RFC4514" above
13417 output a Distinguished Name string which is
13418 not quite
13419 parseable by Exim as a comma-separated tagged list
13420 (the exceptions being elements containing commas).
13421 RDN elements of a single type may be selected by
13422 a modifier of the type label; if so the expansion
13423 result is a list (newline-separated by default).
13424 The separator may be changed by another modifier of
13425 a right angle-bracket followed immediately by the new separator.
13426 Recognised RDN type labels include "CN", "O", "OU" and "DC".
13427 </para>
13428 <para>
13429 The field selectors marked as "time" above
13430 take an optional modifier of "int"
13431 for which the result is the number of seconds since epoch.
13432 Otherwise the result is a human-readable string
13433 in the timezone selected by the main "timezone" option.
13434 </para>
13435 <para>
13436 The field selectors marked as "list" above return a list,
13437 newline-separated by default,
13438 (embedded separator characters in elements are doubled).
13439 The separator may be changed by a modifier of
13440 a right angle-bracket followed immediately by the new separator.
13441 </para>
13442 <para>
13443 The field selectors marked as "tagged" above
13444 prefix each list element with a type string and an equals sign.
13445 Elements of only one type may be selected by a modifier
13446 which is one of "dns", "uri" or "mail";
13447 if so the element tags are omitted.
13448 </para>
13449 <para>
13450 If not otherwise noted field values are presented in human-readable form.
13451 </para>
13452 </listitem></varlistentry>
13453 <varlistentry>
13454 <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>
13455 <listitem>
13456 <para>
13457 <indexterm role="concept">
13458 <primary><option>dlfunc</option></primary>
13459 </indexterm>
13460 This expansion dynamically loads and then calls a locally-written C function.
13461 This functionality is available only if Exim is compiled with
13462 </para>
13463 <literallayout class="monospaced">
13464 EXPAND_DLFUNC=yes
13465 </literallayout>
13466 <para>
13467 set in <filename>Local/Makefile</filename>. Once loaded, Exim remembers the dynamically loaded
13468 object so that it doesn&#x2019;t reload the same object file in the same Exim process
13469 (but of course Exim does start new processes frequently).
13470 </para>
13471 <para>
13472 There may be from zero to eight arguments to the function. When compiling
13473 a local function that is to be called in this way, <filename>local_scan.h</filename> should be
13474 included. The Exim variables and functions that are defined by that API
13475 are also available for dynamically loaded functions. The function itself
13476 must have the following type:
13477 </para>
13478 <literallayout class="monospaced">
13479 int dlfunction(uschar **yield, int argc, uschar *argv[])
13480 </literallayout>
13481 <para>
13482 Where <literal>uschar</literal> is a typedef for <literal>unsigned char</literal> in <filename>local_scan.h</filename>. The
13483 function should return one of the following values:
13484 </para>
13485 <para>
13486 <literal>OK</literal>: Success. The string that is placed in the variable <emphasis>yield</emphasis> is put
13487 into the expanded string that is being built.
13488 </para>
13489 <para>
13490 <literal>FAIL</literal>: A non-forced expansion failure occurs, with the error message taken
13491 from <emphasis>yield</emphasis>, if it is set.
13492 </para>
13493 <para>
13494 <literal>FAIL_FORCED</literal>: A forced expansion failure occurs, with the error message
13495 taken from <emphasis>yield</emphasis> if it is set.
13496 </para>
13497 <para>
13498 <literal>ERROR</literal>: Same as <literal>FAIL</literal>, except that a panic log entry is written.
13499 </para>
13500 <para>
13501 When compiling a function that is to be used in this way with gcc,
13502 you need to add <option>-shared</option> to the gcc command. Also, in the Exim build-time
13503 configuration, you must add <option>-export-dynamic</option> to EXTRALIBS.
13504 </para>
13505 </listitem></varlistentry>
13506 <varlistentry revisionflag="changed">
13507 <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>
13508 <listitem>
13509 <para revisionflag="changed">
13510 <indexterm role="concept">
13511 <primary>expansion</primary>
13512 <secondary>extracting value from environment</secondary>
13513 </indexterm>
13514 <indexterm role="concept">
13515 <primary>environment</primary>
13516 <secondary>value from</secondary>
13517 </indexterm>
13518 The key is first expanded separately, and leading and trailing white space
13519 removed.
13520 This is then searched for as a name in the environment.
13521 If a variable is found then its value is placed in <varname>$value</varname>
13522 and &lt;<emphasis>string1</emphasis>&gt; is expanded, otherwise &lt;<emphasis>string2</emphasis>&gt; is expanded.
13523 </para>
13524 <para revisionflag="changed">
13525 Instead of {&lt;<emphasis>string2</emphasis>&gt;} the word <quote>fail</quote> (not in curly brackets) can
13526 appear, for example:
13527 </para>
13528 <literallayout class="monospaced" revisionflag="changed">
13529 ${env{USER}{$value} fail }
13530 </literallayout>
13531 <para revisionflag="changed">
13532 This forces an expansion failure (see section <xref linkend="SECTforexpfai"/>);
13533 {&lt;<emphasis>string1</emphasis>&gt;} must be present for <quote>fail</quote> to be recognized.
13534 </para>
13535 <para revisionflag="changed">
13536 If {&lt;<emphasis>string2</emphasis>&gt;} is omitted an empty string is substituted on
13537 search failure.
13538 If {&lt;<emphasis>string1</emphasis>&gt;} is omitted the search result is substituted on
13539 search success.
13540 </para>
13541 </listitem></varlistentry>
13542 <varlistentry>
13543 <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>
13544 <listitem>
13545 <para>
13546 <indexterm role="concept">
13547 <primary>expansion</primary>
13548 <secondary>extracting substrings by key</secondary>
13549 </indexterm>
13550 <indexterm role="concept">
13551 <primary><option>extract</option></primary>
13552 <secondary>substrings by key</secondary>
13553 </indexterm>
13554 The key and &lt;<emphasis>string1</emphasis>&gt; are first expanded separately. Leading and trailing
13555 white space is removed from the key (but not from any of the strings). The key
13556 must not consist entirely of digits. The expanded &lt;<emphasis>string1</emphasis>&gt; must be of the
13557 form:
13558 </para>
13559 <literallayout>
13560 &lt;<emphasis>key1</emphasis>&gt; = &lt;<emphasis>value1</emphasis>&gt;  &lt;<emphasis>key2</emphasis>&gt; = &lt;<emphasis>value2</emphasis>&gt; ...
13561 </literallayout>
13562 <para>
13563 <indexterm role="variable">
13564 <primary><varname>$value</varname></primary>
13565 </indexterm>
13566 where the equals signs and spaces (but not both) are optional. If any of the
13567 values contain white space, they must be enclosed in double quotes, and any
13568 values that are enclosed in double quotes are subject to escape processing as
13569 described in section <xref linkend="SECTstrings"/>. The expanded &lt;<emphasis>string1</emphasis>&gt; is searched
13570 for the value that corresponds to the key. The search is case-insensitive. If
13571 the key is found, &lt;<emphasis>string2</emphasis>&gt; is expanded, and replaces the whole item;
13572 otherwise &lt;<emphasis>string3</emphasis>&gt; is used. During the expansion of &lt;<emphasis>string2</emphasis>&gt; the
13573 variable <varname>$value</varname> contains the value that has been extracted. Afterwards, it
13574 is restored to any previous value it might have had.
13575 </para>
13576 <para>
13577 If {&lt;<emphasis>string3</emphasis>&gt;} is omitted, the item is replaced by an empty string if the
13578 key is not found. If {&lt;<emphasis>string2</emphasis>&gt;} is also omitted, the value that was
13579 extracted is used. Thus, for example, these two expansions are identical, and
13580 yield <quote>2001</quote>:
13581 </para>
13582 <literallayout class="monospaced">
13583 ${extract{gid}{uid=1984 gid=2001}}
13584 ${extract{gid}{uid=1984 gid=2001}{$value}}
13585 </literallayout>
13586 <para>
13587 Instead of {&lt;<emphasis>string3</emphasis>&gt;} the word <quote>fail</quote> (not in curly brackets) can
13588 appear, for example:
13589 </para>
13590 <literallayout class="monospaced">
13591 ${extract{Z}{A=... B=...}{$value} fail }
13592 </literallayout>
13593 <para>
13594 This forces an expansion failure (see section <xref linkend="SECTforexpfai"/>);
13595 {&lt;<emphasis>string2</emphasis>&gt;} must be present for <quote>fail</quote> to be recognized.
13596 </para>
13597 </listitem></varlistentry>
13598 <varlistentry>
13599 <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>
13600 <listitem>
13601 <para>
13602 <indexterm role="concept">
13603 <primary>expansion</primary>
13604 <secondary>extracting substrings by number</secondary>
13605 </indexterm>
13606 <indexterm role="concept">
13607 <primary><option>extract</option></primary>
13608 <secondary>substrings by number</secondary>
13609 </indexterm>
13610 The &lt;<emphasis>number</emphasis>&gt; argument must consist entirely of decimal digits,
13611 apart from leading and trailing white space, which is ignored.
13612 This is what distinguishes this form of <option>extract</option> from the previous kind. It
13613 behaves in the same way, except that, instead of extracting a named field, it
13614 extracts from &lt;<emphasis>string1</emphasis>&gt; the field whose number is given as the first
13615 argument. You can use <varname>$value</varname> in &lt;<emphasis>string2</emphasis>&gt; or <literal>fail</literal> instead of
13616 &lt;<emphasis>string3</emphasis>&gt; as before.
13617 </para>
13618 <para>
13619 The fields in the string are separated by any one of the characters in the
13620 separator string. These may include space or tab characters.
13621 The first field is numbered one. If the number is negative, the fields are
13622 counted from the end of the string, with the rightmost one numbered -1. If the
13623 number given is zero, the entire string is returned. If the modulus of the
13624 number is greater than the number of fields in the string, the result is the
13625 expansion of &lt;<emphasis>string3</emphasis>&gt;, or the empty string if &lt;<emphasis>string3</emphasis>&gt; is not
13626 provided. For example:
13627 </para>
13628 <literallayout class="monospaced">
13629 ${extract{2}{:}{x:42:99:&amp; Mailer::/bin/bash}}
13630 </literallayout>
13631 <para>
13632 yields <quote>42</quote>, and
13633 </para>
13634 <literallayout class="monospaced">
13635 ${extract{-4}{:}{x:42:99:&amp; Mailer::/bin/bash}}
13636 </literallayout>
13637 <para>
13638 yields <quote>99</quote>. Two successive separators mean that the field between them is
13639 empty (for example, the fifth field above).
13640 </para>
13641 </listitem></varlistentry>
13642 <varlistentry>
13643 <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>
13644 <listitem>
13645 <para>
13646 <indexterm role="concept">
13647 <primary>list</primary>
13648 <secondary>selecting by condition</secondary>
13649 </indexterm>
13650 <indexterm role="concept">
13651 <primary>expansion</primary>
13652 <secondary>selecting from list by condition</secondary>
13653 </indexterm>
13654 <indexterm role="variable">
13655 <primary><varname>$item</varname></primary>
13656 </indexterm>
13657 After expansion, &lt;<emphasis>string</emphasis>&gt; is interpreted as a list, colon-separated by
13658 default, but the separator can be changed in the usual way. For each item
13659 in this list, its value is place in <varname>$item</varname>, and then the condition is
13660 evaluated. If the condition is true, <varname>$item</varname> is added to the output as an
13661 item in a new list; if the condition is false, the item is discarded. The
13662 separator used for the output list is the same as the one used for the
13663 input, but a separator setting is not included in the output. For example:
13664 </para>
13665 <literallayout class="monospaced">
13666 ${filter{a:b:c}{!eq{$item}{b}}
13667 </literallayout>
13668 <para>
13669 yields <literal>a:c</literal>. At the end of the expansion, the value of <varname>$item</varname> is restored
13670 to what it was before. See also the <emphasis role="bold">map</emphasis> and <emphasis role="bold">reduce</emphasis> expansion items.
13671 </para>
13672 </listitem></varlistentry>
13673 <varlistentry>
13674 <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>
13675 <listitem>
13676 <para>
13677 <indexterm role="concept">
13678 <primary>hash function</primary>
13679 <secondary>textual</secondary>
13680 </indexterm>
13681 <indexterm role="concept">
13682 <primary>expansion</primary>
13683 <secondary>textual hash</secondary>
13684 </indexterm>
13685 This is a textual hashing function, and was the first to be implemented in
13686 early versions of Exim. In current releases, there are other hashing functions
13687 (numeric, MD5, and SHA-1), which are described below.
13688 </para>
13689 <para>
13690 The first two strings, after expansion, must be numbers. Call them &lt;<emphasis>m</emphasis>&gt; and
13691 &lt;<emphasis>n</emphasis>&gt;. If you are using fixed values for these numbers, that is, if
13692 &lt;<emphasis>string1</emphasis>&gt; and &lt;<emphasis>string2</emphasis>&gt; do not change when they are expanded, you can
13693 use the simpler operator notation that avoids some of the braces:
13694 </para>
13695 <literallayout class="monospaced">
13696 ${hash_&lt;n&gt;_&lt;m&gt;:&lt;string&gt;}
13697 </literallayout>
13698 <para>
13699 The second number is optional (in both notations). If &lt;<emphasis>n</emphasis>&gt; is greater than
13700 or equal to the length of the string, the expansion item returns the string.
13701 Otherwise it computes a new string of length &lt;<emphasis>n</emphasis>&gt; by applying a hashing
13702 function to the string. The new string consists of characters taken from the
13703 first &lt;<emphasis>m</emphasis>&gt; characters of the string
13704 </para>
13705 <literallayout class="monospaced">
13706 abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQWRSTUVWXYZ0123456789
13707 </literallayout>
13708 <para>
13709 If &lt;<emphasis>m</emphasis>&gt; is not present the value 26 is used, so that only lower case
13710 letters appear. For example:
13711 </para>
13712 <literallayout>
13713 <literal>$hash{3}{monty}}           </literal>   yields  <literal>jmg</literal>
13714 <literal>$hash{5}{monty}}           </literal>   yields  <literal>monty</literal>
13715 <literal>$hash{4}{62}{monty python}}</literal>   yields  <literal>fbWx</literal>
13716 </literallayout>
13717 </listitem></varlistentry>
13718 <varlistentry>
13719 <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>
13720 <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>
13721 <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>
13722 <listitem>
13723 <para>
13724 <indexterm role="concept">
13725 <primary>expansion</primary>
13726 <secondary>header insertion</secondary>
13727 </indexterm>
13728 <indexterm role="variable">
13729 <primary><varname>$header_</varname></primary>
13730 </indexterm>
13731 <indexterm role="variable">
13732 <primary><varname>$bheader_</varname></primary>
13733 </indexterm>
13734 <indexterm role="variable">
13735 <primary><varname>$rheader_</varname></primary>
13736 </indexterm>
13737 <indexterm role="concept">
13738 <primary>header lines</primary>
13739 <secondary>in expansion strings</secondary>
13740 </indexterm>
13741 <indexterm role="concept">
13742 <primary>header lines</primary>
13743 <secondary>character sets</secondary>
13744 </indexterm>
13745 <indexterm role="concept">
13746 <primary>header lines</primary>
13747 <secondary>decoding</secondary>
13748 </indexterm>
13749 Substitute the contents of the named message header line, for example
13750 </para>
13751 <literallayout class="monospaced">
13752 $header_reply-to:
13753 </literallayout>
13754 <para>
13755 The newline that terminates a header line is not included in the expansion, but
13756 internal newlines (caused by splitting the header line over several physical
13757 lines) may be present.
13758 </para>
13759 <para>
13760 The difference between <option>rheader</option>, <option>bheader</option>, and <option>header</option> is in the way
13761 the data in the header line is interpreted.
13762 </para>
13763 <itemizedlist>
13764 <listitem>
13765 <para>
13766 <indexterm role="concept">
13767 <primary>white space</primary>
13768 <secondary>in header lines</secondary>
13769 </indexterm>
13770 <option>rheader</option> gives the original <quote>raw</quote> content of the header line, with no
13771 processing at all, and without the removal of leading and trailing white space.
13772 </para>
13773 </listitem>
13774 <listitem>
13775 <para>
13776 <indexterm role="concept">
13777 <primary>base64 encoding</primary>
13778 <secondary>in header lines</secondary>
13779 </indexterm>
13780 <option>bheader</option> removes leading and trailing white space, and then decodes base64
13781 or quoted-printable MIME <quote>words</quote> within the header text, but does no
13782 character set translation. If decoding of what looks superficially like a MIME
13783 <quote>word</quote> fails, the raw string is returned. If decoding
13784 <indexterm role="concept">
13785 <primary>binary zero</primary>
13786 <secondary>in header line</secondary>
13787 </indexterm>
13788 produces a binary zero character, it is replaced by a question mark &ndash; this is
13789 what Exim does for binary zeros that are actually received in header lines.
13790 </para>
13791 </listitem>
13792 <listitem>
13793 <para>
13794 <option>header</option> tries to translate the string as decoded by <option>bheader</option> to a
13795 standard character set. This is an attempt to produce the same string as would
13796 be displayed on a user&#x2019;s MUA. If translation fails, the <option>bheader</option> string is
13797 returned. Translation is attempted only on operating systems that support the
13798 <function>iconv()</function> function. This is indicated by the compile-time macro HAVE_ICONV in
13799 a system Makefile or in <filename>Local/Makefile</filename>.
13800 </para>
13801 </listitem>
13802 </itemizedlist>
13803 <para>
13804 In a filter file, the target character set for <option>header</option> can be specified by a
13805 command of the following form:
13806 </para>
13807 <literallayout class="monospaced">
13808 headers charset "UTF-8"
13809 </literallayout>
13810 <para>
13811 This command affects all references to <varname>$h_</varname> (or <varname>$header_</varname>) expansions in
13812 subsequently obeyed filter commands. In the absence of this command, the target
13813 character set in a filter is taken from the setting of the <option>headers_charset</option>
13814 option in the runtime configuration. The value of this option defaults to the
13815 value of HEADERS_CHARSET in <filename>Local/Makefile</filename>. The ultimate default is
13816 ISO-8859-1.
13817 </para>
13818 <para>
13819 Header names follow the syntax of RFC 2822, which states that they may contain
13820 any printing characters except space and colon. Consequently, curly brackets
13821 <emphasis>do not</emphasis> terminate header names, and should not be used to enclose them as
13822 if they were variables. Attempting to do so causes a syntax error.
13823 </para>
13824 <para>
13825 Only header lines that are common to all copies of a message are visible to
13826 this mechanism. These are the original header lines that are received with the
13827 message, and any that are added by an ACL statement or by a system
13828 filter. Header lines that are added to a particular copy of a message by a
13829 router or transport are not accessible.
13830 </para>
13831 <para>
13832 For incoming SMTP messages, no header lines are visible in ACLs that are obeyed
13833 before the DATA ACL, because the header structure is not set up until the
13834 message is received. Header lines that are added in a RCPT ACL (for example)
13835 are saved until the message&#x2019;s incoming header lines are available, at which
13836 point they are added. When a DATA ACL is running, however, header lines added
13837 by earlier ACLs are visible.
13838 </para>
13839 <para>
13840 Upper case and lower case letters are synonymous in header names. If the
13841 following character is white space, the terminating colon may be omitted, but
13842 this is not recommended, because you may then forget it when it is needed. When
13843 white space terminates the header name, it is included in the expanded string.
13844 If the message does not contain the given header, the expansion item is
13845 replaced by an empty string. (See the <option>def</option> condition in section
13846 <xref linkend="SECTexpcond"/> for a means of testing for the existence of a header.)
13847 </para>
13848 <para>
13849 If there is more than one header with the same name, they are all concatenated
13850 to form the substitution string, up to a maximum length of 64K. Unless
13851 <option>rheader</option> is being used, leading and trailing white space is removed from
13852 each header before concatenation, and a completely empty header is ignored. A
13853 newline character is then inserted between non-empty headers, but there is no
13854 newline at the very end. For the <option>header</option> and <option>bheader</option> expansion, for
13855 those headers that contain lists of addresses, a comma is also inserted at the
13856 junctions between headers. This does not happen for the <option>rheader</option> expansion.
13857 </para>
13858 </listitem></varlistentry>
13859 <varlistentry>
13860 <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>
13861 <listitem>
13862 <para>
13863 <indexterm role="concept">
13864 <primary>expansion</primary>
13865 <secondary>hmac hashing</secondary>
13866 </indexterm>
13867 <indexterm role="concept">
13868 <primary><option>hmac</option></primary>
13869 </indexterm>
13870 This function uses cryptographic hashing (either MD5 or SHA-1) to convert a
13871 shared secret and some text into a message authentication code, as specified in
13872 RFC 2104. This differs from <literal>${md5:secret_text...}</literal> or
13873 <literal>${sha1:secret_text...}</literal> in that the hmac step adds a signature to the
13874 cryptographic hash, allowing for authentication that is not possible with MD5
13875 or SHA-1 alone. The hash name must expand to either <literal>md5</literal> or <literal>sha1</literal> at
13876 present. For example:
13877 </para>
13878 <literallayout class="monospaced">
13879 ${hmac{md5}{somesecret}{$primary_hostname $tod_log}}
13880 </literallayout>
13881 <para>
13882 For the hostname <emphasis>mail.example.com</emphasis> and time 2002-10-17 11:30:59, this
13883 produces:
13884 </para>
13885 <literallayout class="monospaced">
13886 dd97e3ba5d1a61b5006108f8c8252953
13887 </literallayout>
13888 <para>
13889 As an example of how this might be used, you might put in the main part of
13890 an Exim configuration:
13891 </para>
13892 <literallayout class="monospaced">
13893 SPAMSCAN_SECRET=cohgheeLei2thahw
13894 </literallayout>
13895 <para>
13896 In a router or a transport you could then have:
13897 </para>
13898 <literallayout class="monospaced">
13899 headers_add = \
13900   X-Spam-Scanned: ${primary_hostname} ${message_exim_id} \
13901   ${hmac{md5}{SPAMSCAN_SECRET}\
13902   {${primary_hostname},${message_exim_id},$h_message-id:}}
13903 </literallayout>
13904 <para>
13905 Then given a message, you can check where it was scanned by looking at the
13906 <emphasis>X-Spam-Scanned:</emphasis> header line. If you know the secret, you can check that
13907 this header line is authentic by recomputing the authentication code from the
13908 host name, message ID and the <emphasis>Message-id:</emphasis> header line. This can be done
13909 using Exim&#x2019;s <option>-be</option> option, or by other means, for example by using the
13910 <emphasis>hmac_md5_hex()</emphasis> function in Perl.
13911 </para>
13912 </listitem></varlistentry>
13913 <varlistentry>
13914 <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>
13915 <listitem>
13916 <para>
13917 <indexterm role="concept">
13918 <primary>expansion</primary>
13919 <secondary>conditional</secondary>
13920 </indexterm>
13921 <indexterm role="concept">
13922 <primary><option>if</option>, expansion item</primary>
13923 </indexterm>
13924 If &lt;<emphasis>condition</emphasis>&gt; is true, &lt;<emphasis>string1</emphasis>&gt; is expanded and replaces the whole
13925 item; otherwise &lt;<emphasis>string2</emphasis>&gt; is used. The available conditions are described
13926 in section <xref linkend="SECTexpcond"/> below. For example:
13927 </para>
13928 <literallayout class="monospaced">
13929 ${if eq {$local_part}{postmaster} {yes}{no} }
13930 </literallayout>
13931 <para>
13932 The second string need not be present; if it is not and the condition is not
13933 true, the item is replaced with nothing. Alternatively, the word <quote>fail</quote> may
13934 be present instead of the second string (without any curly brackets). In this
13935 case, the expansion is forced to fail if the condition is not true (see section
13936 <xref linkend="SECTforexpfai"/>).
13937 </para>
13938 <para>
13939 If both strings are omitted, the result is the string <literal>true</literal> if the condition
13940 is true, and the empty string if the condition is false. This makes it less
13941 cumbersome to write custom ACL and router conditions. For example, instead of
13942 </para>
13943 <literallayout class="monospaced">
13944 condition = ${if &gt;{$acl_m4}{3}{true}{false}}
13945 </literallayout>
13946 <para>
13947 you can use
13948 </para>
13949 <literallayout class="monospaced">
13950 condition = ${if &gt;{$acl_m4}{3}}
13951 </literallayout>
13952 </listitem></varlistentry>
13953 <varlistentry>
13954 <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>
13955 <listitem>
13956 <para>
13957 <indexterm role="concept">
13958 <primary>expansion</primary>
13959 <secondary>string truncation</secondary>
13960 </indexterm>
13961 <indexterm role="concept">
13962 <primary><option>length</option> expansion item</primary>
13963 </indexterm>
13964 The <option>length</option> item is used to extract the initial portion of a string. Both
13965 strings are expanded, and the first one must yield a number, &lt;<emphasis>n</emphasis>&gt;, say. If
13966 you are using a fixed value for the number, that is, if &lt;<emphasis>string1</emphasis>&gt; does not
13967 change when expanded, you can use the simpler operator notation that avoids
13968 some of the braces:
13969 </para>
13970 <literallayout class="monospaced">
13971 ${length_&lt;n&gt;:&lt;string&gt;}
13972 </literallayout>
13973 <para>
13974 The result of this item is either the first &lt;<emphasis>n</emphasis>&gt; characters or the whole
13975 of &lt;<emphasis>string2</emphasis>&gt;, whichever is the shorter. Do not confuse <option>length</option> with
13976 <option>strlen</option>, which gives the length of a string.
13977 </para>
13978 </listitem></varlistentry>
13979 <varlistentry>
13980 <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>
13981 <listitem>
13982 <para>
13983 <indexterm role="concept">
13984 <primary>expansion</primary>
13985 <secondary>extracting list elements by number</secondary>
13986 </indexterm>
13987 <indexterm role="concept">
13988 <primary><option>listextract</option></primary>
13989 <secondary>extract list elements by number</secondary>
13990 </indexterm>
13991 <indexterm role="concept">
13992 <primary>list</primary>
13993 <secondary>extracting elements by number</secondary>
13994 </indexterm>
13995 The &lt;<emphasis>number</emphasis>&gt; argument must consist entirely of decimal digits,
13996 apart from an optional leading minus,
13997 and leading and trailing white space (which is ignored).
13998 </para>
13999 <para>
14000 After expansion, &lt;<emphasis>string1</emphasis>&gt; is interpreted as a list, colon-separated by
14001 default, but the separator can be changed in the usual way.
14002 </para>
14003 <para>
14004 The first field of the list is numbered one.
14005 If the number is negative, the fields are
14006 counted from the end of the list, with the rightmost one numbered -1.
14007 The numbered element of the list is extracted and placed in <varname>$value</varname>,
14008 then &lt;<emphasis>string2</emphasis>&gt; is expanded as the result.
14009 </para>
14010 <para>
14011 If the modulus of the
14012 number is zero or greater than the number of fields in the string,
14013 the result is the expansion of &lt;<emphasis>string3</emphasis>&gt;.
14014 </para>
14015 <para>
14016 For example:
14017 </para>
14018 <literallayout class="monospaced">
14019 ${listextract{2}{x:42:99}}
14020 </literallayout>
14021 <para>
14022 yields <quote>42</quote>, and
14023 </para>
14024 <literallayout class="monospaced">
14025 ${listextract{-3}{&lt;, x,42,99,&amp; Mailer,,/bin/bash}{result: $value}}
14026 </literallayout>
14027 <para>
14028 yields <quote>result: 99</quote>.
14029 </para>
14030 <para>
14031 If {&lt;<emphasis>string3</emphasis>&gt;} is omitted, an empty string is used for string3.
14032 If {&lt;<emphasis>string2</emphasis>&gt;} is also omitted, the value that was
14033 extracted is used.
14034 You can use <literal>fail</literal> instead of {&lt;<emphasis>string3</emphasis>&gt;} as in a string extract.
14035 </para>
14036 </listitem></varlistentry>
14037 <varlistentry>
14038 <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>
14039 <listitem>
14040 <para>
14041 This is the first of one of two different types of lookup item, which are both
14042 described in the next item.
14043 </para>
14044 </listitem></varlistentry>
14045 <varlistentry>
14046 <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>
14047 <listitem>
14048 <para>
14049 <indexterm role="concept">
14050 <primary>expansion</primary>
14051 <secondary>lookup in</secondary>
14052 </indexterm>
14053 <indexterm role="concept">
14054 <primary>file</primary>
14055 <secondary>lookups</secondary>
14056 </indexterm>
14057 <indexterm role="concept">
14058 <primary>lookup</primary>
14059 <secondary>in expanded string</secondary>
14060 </indexterm>
14061 The two forms of lookup item specify data lookups in files and databases, as
14062 discussed in chapter <xref linkend="CHAPfdlookup"/>. The first form is used for single-key
14063 lookups, and the second is used for query-style lookups. The &lt;<emphasis>key</emphasis>&gt;,
14064 &lt;<emphasis>file</emphasis>&gt;, and &lt;<emphasis>query</emphasis>&gt; strings are expanded before use.
14065 </para>
14066 <para>
14067 If there is any white space in a lookup item which is part of a filter command,
14068 a retry or rewrite rule, a routing rule for the <command>manualroute</command> router, or any
14069 other place where white space is significant, the lookup item must be enclosed
14070 in double quotes. The use of data lookups in users&#x2019; filter files may be locked
14071 out by the system administrator.
14072 </para>
14073 <para>
14074 <indexterm role="variable">
14075 <primary><varname>$value</varname></primary>
14076 </indexterm>
14077 If the lookup succeeds, &lt;<emphasis>string1</emphasis>&gt; is expanded and replaces the entire item.
14078 During its expansion, the variable <varname>$value</varname> contains the data returned by the
14079 lookup. Afterwards it reverts to the value it had previously (at the outer
14080 level it is empty). If the lookup fails, &lt;<emphasis>string2</emphasis>&gt; is expanded and replaces
14081 the entire item. If {&lt;<emphasis>string2</emphasis>&gt;} is omitted, the replacement is the empty
14082 string on failure. If &lt;<emphasis>string2</emphasis>&gt; is provided, it can itself be a nested
14083 lookup, thus providing a mechanism for looking up a default value when the
14084 original lookup fails.
14085 </para>
14086 <para>
14087 If a nested lookup is used as part of &lt;<emphasis>string1</emphasis>&gt;, <varname>$value</varname> contains the
14088 data for the outer lookup while the parameters of the second lookup are
14089 expanded, and also while &lt;<emphasis>string2</emphasis>&gt; of the second lookup is expanded, should
14090 the second lookup fail. Instead of {&lt;<emphasis>string2</emphasis>&gt;} the word <quote>fail</quote> can
14091 appear, and in this case, if the lookup fails, the entire expansion is forced
14092 to fail (see section <xref linkend="SECTforexpfai"/>). If both {&lt;<emphasis>string1</emphasis>&gt;} and
14093 {&lt;<emphasis>string2</emphasis>&gt;} are omitted, the result is the looked up value in the case of a
14094 successful lookup, and nothing in the case of failure.
14095 </para>
14096 <para>
14097 For single-key lookups, the string <quote>partial</quote> is permitted to precede the
14098 search type in order to do partial matching, and * or *@ may follow a search
14099 type to request default lookups if the key does not match (see sections
14100 <xref linkend="SECTdefaultvaluelookups"/> and <xref linkend="SECTpartiallookup"/> for details).
14101 </para>
14102 <para>
14103 <indexterm role="concept">
14104 <primary>numerical variables (<varname>$1</varname> <varname>$2</varname> etc)</primary>
14105 <secondary>in lookup expansion</secondary>
14106 </indexterm>
14107 If a partial search is used, the variables <varname>$1</varname> and <varname>$2</varname> contain the wild
14108 and non-wild parts of the key during the expansion of the replacement text.
14109 They return to their previous values at the end of the lookup item.
14110 </para>
14111 <para>
14112 This example looks up the postmaster alias in the conventional alias file:
14113 </para>
14114 <literallayout class="monospaced">
14115 ${lookup {postmaster} lsearch {/etc/aliases} {$value}}
14116 </literallayout>
14117 <para>
14118 This example uses NIS+ to look up the full name of the user corresponding to
14119 the local part of an address, forcing the expansion to fail if it is not found:
14120 </para>
14121 <literallayout class="monospaced">
14122 ${lookup nisplus {[name=$local_part],passwd.org_dir:gcos} \
14123   {$value}fail}
14124 </literallayout>
14125 </listitem></varlistentry>
14126 <varlistentry>
14127 <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>
14128 <listitem>
14129 <para>
14130 <indexterm role="concept">
14131 <primary>expansion</primary>
14132 <secondary>list creation</secondary>
14133 </indexterm>
14134 <indexterm role="variable">
14135 <primary><varname>$item</varname></primary>
14136 </indexterm>
14137 After expansion, &lt;<emphasis>string1</emphasis>&gt; is interpreted as a list, colon-separated by
14138 default, but the separator can be changed in the usual way. For each item
14139 in this list, its value is place in <varname>$item</varname>, and then &lt;<emphasis>string2</emphasis>&gt; is
14140 expanded and added to the output as an item in a new list. The separator used
14141 for the output list is the same as the one used for the input, but a separator
14142 setting is not included in the output. For example:
14143 </para>
14144 <literallayout class="monospaced">
14145 ${map{a:b:c}{[$item]}} ${map{&lt;- x-y-z}{($item)}}
14146 </literallayout>
14147 <para>
14148 expands to <literal>[a]:[b]:[c] (x)-(y)-(z)</literal>. At the end of the expansion, the
14149 value of <varname>$item</varname> is restored to what it was before. See also the <emphasis role="bold">filter</emphasis>
14150 and <emphasis role="bold">reduce</emphasis> expansion items.
14151 </para>
14152 </listitem></varlistentry>
14153 <varlistentry>
14154 <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>
14155 <listitem>
14156 <para>
14157 <indexterm role="concept">
14158 <primary>expansion</primary>
14159 <secondary>numeric hash</secondary>
14160 </indexterm>
14161 <indexterm role="concept">
14162 <primary>hash function</primary>
14163 <secondary>numeric</secondary>
14164 </indexterm>
14165 The three strings are expanded; the first two must yield numbers. Call them
14166 &lt;<emphasis>n</emphasis>&gt; and &lt;<emphasis>m</emphasis>&gt;. If you are using fixed values for these numbers, that is,
14167 if &lt;<emphasis>string1</emphasis>&gt; and &lt;<emphasis>string2</emphasis>&gt; do not change when they are expanded, you
14168 can use the simpler operator notation that avoids some of the braces:
14169 </para>
14170 <literallayout class="monospaced">
14171 ${nhash_&lt;n&gt;_&lt;m&gt;:&lt;string&gt;}
14172 </literallayout>
14173 <para>
14174 The second number is optional (in both notations). If there is only one number,
14175 the result is a number in the range 0&ndash;&lt;<emphasis>n</emphasis>&gt;-1. Otherwise, the string is
14176 processed by a div/mod hash function that returns two numbers, separated by a
14177 slash, in the ranges 0 to &lt;<emphasis>n</emphasis>&gt;-1 and 0 to &lt;<emphasis>m</emphasis>&gt;-1, respectively. For
14178 example,
14179 </para>
14180 <literallayout class="monospaced">
14181 ${nhash{8}{64}{supercalifragilisticexpialidocious}}
14182 </literallayout>
14183 <para>
14184 returns the string <quote>6/33</quote>.
14185 </para>
14186 </listitem></varlistentry>
14187 <varlistentry>
14188 <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>
14189 <listitem>
14190 <para>
14191 <indexterm role="concept">
14192 <primary>Perl</primary>
14193 <secondary>use in expanded string</secondary>
14194 </indexterm>
14195 <indexterm role="concept">
14196 <primary>expansion</primary>
14197 <secondary>calling Perl from</secondary>
14198 </indexterm>
14199 This item is available only if Exim has been built to include an embedded Perl
14200 interpreter. The subroutine name and the arguments are first separately
14201 expanded, and then the Perl subroutine is called with those arguments. No
14202 additional arguments need be given; the maximum number permitted, including the
14203 name of the subroutine, is nine.
14204 </para>
14205 <para>
14206 The return value of the subroutine is inserted into the expanded string, unless
14207 the return value is <option>undef</option>. In that case, the expansion fails in the same
14208 way as an explicit <quote>fail</quote> on a lookup item. The return value is a scalar.
14209 Whatever you return is evaluated in a scalar context. For example, if you
14210 return the name of a Perl vector, the return value is the size of the vector,
14211 not its contents.
14212 </para>
14213 <para>
14214 If the subroutine exits by calling Perl&#x2019;s <option>die</option> function, the expansion fails
14215 with the error message that was passed to <option>die</option>. More details of the embedded
14216 Perl facility are given in chapter <xref linkend="CHAPperl"/>.
14217 </para>
14218 <para>
14219 The <command>redirect</command> router has an option called <option>forbid_filter_perl</option> which locks
14220 out the use of this expansion item in filter files.
14221 </para>
14222 </listitem></varlistentry>
14223 <varlistentry>
14224 <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>
14225 <listitem>
14226 <para>
14227 <indexterm role="concept">
14228 <primary><option>prvs</option> expansion item</primary>
14229 </indexterm>
14230 The first argument is a complete email address and the second is secret
14231 keystring. The third argument, specifying a key number, is optional. If absent,
14232 it defaults to 0. The result of the expansion is a prvs-signed email address,
14233 to be typically used with the <option>return_path</option> option on an <command>smtp</command> transport
14234 as part of a bounce address tag validation (BATV) scheme. For more discussion
14235 and an example, see section <xref linkend="SECTverifyPRVS"/>.
14236 </para>
14237 </listitem></varlistentry>
14238 <varlistentry>
14239 <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>
14240 <listitem>
14241 <para>
14242 <indexterm role="concept">
14243 <primary><option>prvscheck</option> expansion item</primary>
14244 </indexterm>
14245 This expansion item is the complement of the <option>prvs</option> item. It is used for
14246 checking prvs-signed addresses. If the expansion of the first argument does not
14247 yield a syntactically valid prvs-signed address, the whole item expands to the
14248 empty string. When the first argument does expand to a syntactically valid
14249 prvs-signed address, the second argument is expanded, with the prvs-decoded
14250 version of the address and the key number extracted from the address in the
14251 variables <varname>$prvscheck_address</varname> and <varname>$prvscheck_keynum</varname>, respectively.
14252 </para>
14253 <para>
14254 These two variables can be used in the expansion of the second argument to
14255 retrieve the secret. The validity of the prvs-signed address is then checked
14256 against the secret. The result is stored in the variable <varname>$prvscheck_result</varname>,
14257 which is empty for failure or <quote>1</quote> for success.
14258 </para>
14259 <para>
14260 The third argument is optional; if it is missing, it defaults to an empty
14261 string. This argument is now expanded. If the result is an empty string, the
14262 result of the expansion is the decoded version of the address. This is the case
14263 whether or not the signature was valid. Otherwise, the result of the expansion
14264 is the expansion of the third argument.
14265 </para>
14266 <para>
14267 All three variables can be used in the expansion of the third argument.
14268 However, once the expansion is complete, only <varname>$prvscheck_result</varname> remains set.
14269 For more discussion and an example, see section <xref linkend="SECTverifyPRVS"/>.
14270 </para>
14271 </listitem></varlistentry>
14272 <varlistentry>
14273 <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>
14274 <listitem>
14275 <para>
14276 <indexterm role="concept">
14277 <primary>expansion</primary>
14278 <secondary>inserting an entire file</secondary>
14279 </indexterm>
14280 <indexterm role="concept">
14281 <primary>file</primary>
14282 <secondary>inserting into expansion</secondary>
14283 </indexterm>
14284 <indexterm role="concept">
14285 <primary><option>readfile</option> expansion item</primary>
14286 </indexterm>
14287 The file name and end-of-line string are first expanded separately. The file is
14288 then read, and its contents replace the entire item. All newline characters in
14289 the file are replaced by the end-of-line string if it is present. Otherwise,
14290 newlines are left in the string.
14291 String expansion is not applied to the contents of the file. If you want this,
14292 you must wrap the item in an <option>expand</option> operator. If the file cannot be read,
14293 the string expansion fails.
14294 </para>
14295 <para>
14296 The <command>redirect</command> router has an option called <option>forbid_filter_readfile</option> which
14297 locks out the use of this expansion item in filter files.
14298 </para>
14299 </listitem></varlistentry>
14300 <varlistentry>
14301 <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>
14302 <listitem>
14303 <para>
14304 <indexterm role="concept">
14305 <primary>expansion</primary>
14306 <secondary>inserting from a socket</secondary>
14307 </indexterm>
14308 <indexterm role="concept">
14309 <primary>socket, use of in expansion</primary>
14310 </indexterm>
14311 <indexterm role="concept">
14312 <primary><option>readsocket</option> expansion item</primary>
14313 </indexterm>
14314 This item inserts data from a Unix domain or TCP socket into the expanded
14315 string. The minimal way of using it uses just two arguments, as in these
14316 examples:
14317 </para>
14318 <literallayout class="monospaced">
14319 ${readsocket{/socket/name}{request string}}
14320 ${readsocket{inet:some.host:1234}{request string}}
14321 </literallayout>
14322 <para>
14323 For a Unix domain socket, the first substring must be the path to the socket.
14324 For an Internet socket, the first substring must contain <literal>inet:</literal> followed by
14325 a host name or IP address, followed by a colon and a port, which can be a
14326 number or the name of a TCP port in <filename>/etc/services</filename>. An IP address may
14327 optionally be enclosed in square brackets. This is best for IPv6 addresses. For
14328 example:
14329 </para>
14330 <literallayout class="monospaced">
14331 ${readsocket{inet:[::1]:1234}{request string}}
14332 </literallayout>
14333 <para>
14334 Only a single host name may be given, but if looking it up yields more than
14335 one IP address, they are each tried in turn until a connection is made. For
14336 both kinds of socket, Exim makes a connection, writes the request string
14337 (unless it is an empty string) and reads from the socket until an end-of-file
14338 is read. A timeout of 5 seconds is applied. Additional, optional arguments
14339 extend what can be done. Firstly, you can vary the timeout. For example:
14340 </para>
14341 <literallayout class="monospaced">
14342 ${readsocket{/socket/name}{request string}{3s}}
14343 </literallayout>
14344 <para>
14345 A fourth argument allows you to change any newlines that are in the data
14346 that is read, in the same way as for <option>readfile</option> (see above). This example
14347 turns them into spaces:
14348 </para>
14349 <literallayout class="monospaced">
14350 ${readsocket{inet:127.0.0.1:3294}{request string}{3s}{ }}
14351 </literallayout>
14352 <para>
14353 As with all expansions, the substrings are expanded before the processing
14354 happens. Errors in these sub-expansions cause the expansion to fail. In
14355 addition, the following errors can occur:
14356 </para>
14357 <itemizedlist>
14358 <listitem>
14359 <para>
14360 Failure to create a socket file descriptor;
14361 </para>
14362 </listitem>
14363 <listitem>
14364 <para>
14365 Failure to connect the socket;
14366 </para>
14367 </listitem>
14368 <listitem>
14369 <para>
14370 Failure to write the request string;
14371 </para>
14372 </listitem>
14373 <listitem>
14374 <para>
14375 Timeout on reading from the socket.
14376 </para>
14377 </listitem>
14378 </itemizedlist>
14379 <para>
14380 By default, any of these errors causes the expansion to fail. However, if
14381 you supply a fifth substring, it is expanded and used when any of the above
14382 errors occurs. For example:
14383 </para>
14384 <literallayout class="monospaced">
14385 ${readsocket{/socket/name}{request string}{3s}{\n}\
14386   {socket failure}}
14387 </literallayout>
14388 <para>
14389 You can test for the existence of a Unix domain socket by wrapping this
14390 expansion in <literal>${if exists</literal>, but there is a race condition between that test
14391 and the actual opening of the socket, so it is safer to use the fifth argument
14392 if you want to be absolutely sure of avoiding an expansion error for a
14393 non-existent Unix domain socket, or a failure to connect to an Internet socket.
14394 </para>
14395 <para>
14396 The <command>redirect</command> router has an option called <option>forbid_filter_readsocket</option> which
14397 locks out the use of this expansion item in filter files.
14398 </para>
14399 </listitem></varlistentry>
14400 <varlistentry>
14401 <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>
14402 <listitem>
14403 <para>
14404 <indexterm role="concept">
14405 <primary>expansion</primary>
14406 <secondary>reducing a list to a scalar</secondary>
14407 </indexterm>
14408 <indexterm role="concept">
14409 <primary>list</primary>
14410 <secondary>reducing to a scalar</secondary>
14411 </indexterm>
14412 <indexterm role="variable">
14413 <primary><varname>$value</varname></primary>
14414 </indexterm>
14415 <indexterm role="variable">
14416 <primary><varname>$item</varname></primary>
14417 </indexterm>
14418 This operation reduces a list to a single, scalar string. After expansion,
14419 &lt;<emphasis>string1</emphasis>&gt; is interpreted as a list, colon-separated by default, but the
14420 separator can be changed in the usual way. Then &lt;<emphasis>string2</emphasis>&gt; is expanded and
14421 assigned to the <varname>$value</varname> variable. After this, each item in the &lt;<emphasis>string1</emphasis>&gt;
14422 list is assigned to <varname>$item</varname> in turn, and &lt;<emphasis>string3</emphasis>&gt; is expanded for each of
14423 them. The result of that expansion is assigned to <varname>$value</varname> before the next
14424 iteration. When the end of the list is reached, the final value of <varname>$value</varname> is
14425 added to the expansion output. The <emphasis role="bold">reduce</emphasis> expansion item can be used in a
14426 number of ways. For example, to add up a list of numbers:
14427 </para>
14428 <literallayout class="monospaced">
14429 ${reduce {&lt;, 1,2,3}{0}{${eval:$value+$item}}}
14430 </literallayout>
14431 <para>
14432 The result of that expansion would be <literal>6</literal>. The maximum of a list of numbers
14433 can be found:
14434 </para>
14435 <literallayout class="monospaced">
14436 ${reduce {3:0:9:4:6}{0}{${if &gt;{$item}{$value}{$item}{$value}}}}
14437 </literallayout>
14438 <para>
14439 At the end of a <emphasis role="bold">reduce</emphasis> expansion, the values of <varname>$item</varname> and <varname>$value</varname> are
14440 restored to what they were before. See also the <emphasis role="bold">filter</emphasis> and <emphasis role="bold">map</emphasis>
14441 expansion items.
14442 </para>
14443 </listitem></varlistentry>
14444 <varlistentry>
14445 <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>
14446 <listitem>
14447 <para>
14448 This item inserts <quote>raw</quote> header lines. It is described with the <option>header</option>
14449 expansion item above.
14450 </para>
14451 </listitem></varlistentry>
14452 <varlistentry>
14453 <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>
14454 <listitem>
14455 <para>
14456 <indexterm role="concept">
14457 <primary>expansion</primary>
14458 <secondary>running a command</secondary>
14459 </indexterm>
14460 <indexterm role="concept">
14461 <primary><option>run</option> expansion item</primary>
14462 </indexterm>
14463 The command and its arguments are first expanded as one string. The string is
14464 split apart into individual arguments by spaces, and then the command is run
14465 in a separate process, but under the same uid and gid.  As in other command
14466 executions from Exim, a shell is not used by default. If the command requires
14467 a shell, you must explicitly code it.
14468 </para>
14469 <para>
14470 Since the arguments are split by spaces, when there is a variable expansion
14471 which has an empty result, it will cause the situation that the argument will
14472 simply be omitted when the program is actually executed by Exim. If the
14473 script/program requires a specific number of arguments and the expanded
14474 variable could possibly result in this empty expansion, the variable must be
14475 quoted. This is more difficult if the expanded variable itself could result
14476 in a string containing quotes, because it would interfere with the quotes
14477 around the command arguments. A possible guard against this is to wrap the
14478 variable in the <option>sg</option> operator to change any quote marks to some other
14479 character.
14480 </para>
14481 <para>
14482 The standard input for the command exists, but is empty. The standard output
14483 and standard error are set to the same file descriptor.
14484 <indexterm role="concept">
14485 <primary>return code</primary>
14486 <secondary>from <option>run</option> expansion</secondary>
14487 </indexterm>
14488 <indexterm role="variable">
14489 <primary><varname>$value</varname></primary>
14490 </indexterm>
14491 If the command succeeds (gives a zero return code) &lt;<emphasis>string1</emphasis>&gt; is expanded
14492 and replaces the entire item; during this expansion, the standard output/error
14493 from the command is in the variable <varname>$value</varname>. If the command fails,
14494 &lt;<emphasis>string2</emphasis>&gt;, if present, is expanded and used. Once again, during the
14495 expansion, the standard output/error from the command is in the variable
14496 <varname>$value</varname>.
14497 </para>
14498 <para>
14499 If &lt;<emphasis>string2</emphasis>&gt; is absent, the result is empty. Alternatively, &lt;<emphasis>string2</emphasis>&gt;
14500 can be the word <quote>fail</quote> (not in braces) to force expansion failure if the
14501 command does not succeed. If both strings are omitted, the result is contents
14502 of the standard output/error on success, and nothing on failure.
14503 </para>
14504 <para>
14505 <indexterm role="variable">
14506 <primary><varname>$run_in_acl</varname></primary>
14507 </indexterm>
14508 The standard output/error of the command is put in the variable <varname>$value</varname>.
14509 In this ACL example, the output of a command is logged for the admin to
14510 troubleshoot:
14511 </para>
14512 <literallayout class="monospaced">
14513 warn  condition    = ${run{/usr/bin/id}{yes}{no}}
14514       log_message  = Output of id: $value
14515 </literallayout>
14516 <para>
14517 If the command requires shell idioms, such as the &gt; redirect operator, the
14518 shell must be invoked directly, such as with:
14519 </para>
14520 <literallayout class="monospaced">
14521 ${run{/bin/bash -c "/usr/bin/id &gt;/tmp/id"}{yes}{yes}}
14522 </literallayout>
14523 <para>
14524 <indexterm role="variable">
14525 <primary><varname>$runrc</varname></primary>
14526 </indexterm>
14527 The return code from the command is put in the variable <varname>$runrc</varname>, and this
14528 remains set afterwards, so in a filter file you can do things like this:
14529 </para>
14530 <literallayout class="monospaced">
14531 if "${run{x y z}{}}$runrc" is 1 then ...
14532   elif $runrc is 2 then ...
14533   ...
14534 endif
14535 </literallayout>
14536 <para>
14537 If execution of the command fails (for example, the command does not exist),
14538 the return code is 127 &ndash; the same code that shells use for non-existent
14539 commands.
14540 </para>
14541 <para>
14542 <emphasis role="bold">Warning</emphasis>: In a router or transport, you cannot assume the order in which
14543 option values are expanded, except for those preconditions whose order of
14544 testing is documented. Therefore, you cannot reliably expect to set <varname>$runrc</varname>
14545 by the expansion of one option, and use it in another.
14546 </para>
14547 <para>
14548 The <command>redirect</command> router has an option called <option>forbid_filter_run</option> which locks
14549 out the use of this expansion item in filter files.
14550 </para>
14551 </listitem></varlistentry>
14552 <varlistentry>
14553 <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>
14554 <listitem>
14555 <para>
14556 <indexterm role="concept">
14557 <primary>expansion</primary>
14558 <secondary>string substitution</secondary>
14559 </indexterm>
14560 <indexterm role="concept">
14561 <primary><option>sg</option> expansion item</primary>
14562 </indexterm>
14563 This item works like Perl&#x2019;s substitution operator (s) with the global (/g)
14564 option; hence its name. However, unlike the Perl equivalent, Exim does not
14565 modify the subject string; instead it returns the modified string for insertion
14566 into the overall expansion. The item takes three arguments: the subject string,
14567 a regular expression, and a substitution string. For example:
14568 </para>
14569 <literallayout class="monospaced">
14570 ${sg{abcdefabcdef}{abc}{xyz}}
14571 </literallayout>
14572 <para>
14573 yields <quote>xyzdefxyzdef</quote>. Because all three arguments are expanded before use,
14574 if any $ or \ characters are required in the regular expression or in the
14575 substitution string, they have to be escaped. For example:
14576 </para>
14577 <literallayout class="monospaced">
14578 ${sg{abcdef}{^(...)(...)\$}{\$2\$1}}
14579 </literallayout>
14580 <para>
14581 yields <quote>defabc</quote>, and
14582 </para>
14583 <literallayout class="monospaced">
14584 ${sg{1=A 4=D 3=C}{\N(\d+)=\N}{K\$1=}}
14585 </literallayout>
14586 <para>
14587 yields <quote>K1=A K4=D K3=C</quote>. Note the use of <literal>\N</literal> to protect the contents of
14588 the regular expression from string expansion.
14589 </para>
14590 </listitem></varlistentry>
14591 <varlistentry>
14592 <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>
14593 <listitem>
14594 <para>
14595 <indexterm role="concept">
14596 <primary>sorting</primary>
14597 <secondary>a list</secondary>
14598 </indexterm>
14599 <indexterm role="concept">
14600 <primary>list</primary>
14601 <secondary>sorting</secondary>
14602 </indexterm>
14603 <indexterm role="concept">
14604 <primary>expansion</primary>
14605 <secondary>list sorting</secondary>
14606 </indexterm>
14607 After expansion, &lt;<emphasis>string</emphasis>&gt; is interpreted as a list, colon-separated by
14608 default, but the separator can be changed in the usual way.
14609 The &lt;<emphasis>comparator</emphasis>&gt; argument is interpreted as the operator
14610 of a two-argument expansion condition.
14611 The numeric operators plus ge, gt, le, lt (and ~i variants) are supported.
14612 The comparison should return true when applied to two values
14613 if the first value should sort before the second value.
14614 The &lt;<emphasis>extractor</emphasis>&gt; expansion is applied repeatedly to elements of the list,
14615 the element being placed in <varname>$item</varname>,
14616 to give values for comparison.
14617 </para>
14618 <para>
14619 The item result is a sorted list,
14620 with the original list separator,
14621 of the list elements (in full) of the original.
14622 </para>
14623 <para>
14624 Examples:
14625 </para>
14626 <literallayout class="monospaced">
14627 ${sort{3:2:1:4}{&lt;}{$item}}
14628 </literallayout>
14629 <para>
14630 sorts a list of numbers, and
14631 </para>
14632 <literallayout class="monospaced">
14633 ${sort {${lookup dnsdb{&gt;:,,mx=example.com}}} {&lt;} {${listextract{1}{&lt;,$item}}}}
14634 </literallayout>
14635 <para>
14636 will sort an MX lookup into priority order.
14637 </para>
14638 </listitem></varlistentry>
14639 <varlistentry>
14640 <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>
14641 <listitem>
14642 <para>
14643 <indexterm role="concept">
14644 <primary><option>substr</option> expansion item</primary>
14645 </indexterm>
14646 <indexterm role="concept">
14647 <primary>substring extraction</primary>
14648 </indexterm>
14649 <indexterm role="concept">
14650 <primary>expansion</primary>
14651 <secondary>substring extraction</secondary>
14652 </indexterm>
14653 The three strings are expanded; the first two must yield numbers. Call them
14654 &lt;<emphasis>n</emphasis>&gt; and &lt;<emphasis>m</emphasis>&gt;. If you are using fixed values for these numbers, that is,
14655 if &lt;<emphasis>string1</emphasis>&gt; and &lt;<emphasis>string2</emphasis>&gt; do not change when they are expanded, you
14656 can use the simpler operator notation that avoids some of the braces:
14657 </para>
14658 <literallayout class="monospaced">
14659 ${substr_&lt;n&gt;_&lt;m&gt;:&lt;string&gt;}
14660 </literallayout>
14661 <para>
14662 The second number is optional (in both notations).
14663 If it is absent in the simpler format, the preceding underscore must also be
14664 omitted.
14665 </para>
14666 <para>
14667 The <option>substr</option> item can be used to extract more general substrings than
14668 <option>length</option>. The first number, &lt;<emphasis>n</emphasis>&gt;, is a starting offset, and &lt;<emphasis>m</emphasis>&gt; is the
14669 length required. For example
14670 </para>
14671 <literallayout class="monospaced">
14672 ${substr{3}{2}{$local_part}}
14673 </literallayout>
14674 <para>
14675 If the starting offset is greater than the string length the result is the
14676 null string; if the length plus starting offset is greater than the string
14677 length, the result is the right-hand part of the string, starting from the
14678 given offset. The first character in the string has offset zero.
14679 </para>
14680 <para>
14681 The <option>substr</option> expansion item can take negative offset values to count
14682 from the right-hand end of its operand. The last character is offset -1, the
14683 second-last is offset -2, and so on. Thus, for example,
14684 </para>
14685 <literallayout class="monospaced">
14686 ${substr{-5}{2}{1234567}}
14687 </literallayout>
14688 <para>
14689 yields <quote>34</quote>. If the absolute value of a negative offset is greater than the
14690 length of the string, the substring starts at the beginning of the string, and
14691 the length is reduced by the amount of overshoot. Thus, for example,
14692 </para>
14693 <literallayout class="monospaced">
14694 ${substr{-5}{2}{12}}
14695 </literallayout>
14696 <para>
14697 yields an empty string, but
14698 </para>
14699 <literallayout class="monospaced">
14700 ${substr{-3}{2}{12}}
14701 </literallayout>
14702 <para>
14703 yields <quote>1</quote>.
14704 </para>
14705 <para>
14706 When the second number is omitted from <option>substr</option>, the remainder of the string
14707 is taken if the offset is positive. If it is negative, all characters in the
14708 string preceding the offset point are taken. For example, an offset of -1 and
14709 no length, as in these semantically identical examples:
14710 </para>
14711 <literallayout class="monospaced">
14712 ${substr_-1:abcde}
14713 ${substr{-1}{abcde}}
14714 </literallayout>
14715 <para>
14716 yields all but the last character of the string, that is, <quote>abcd</quote>.
14717 </para>
14718 </listitem></varlistentry>
14719 <varlistentry>
14720 <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>
14721 <listitem>
14722 <para>
14723 <indexterm role="concept">
14724 <primary>expansion</primary>
14725 <secondary>character translation</secondary>
14726 </indexterm>
14727 <indexterm role="concept">
14728 <primary><option>tr</option> expansion item</primary>
14729 </indexterm>
14730 This item does single-character translation on its subject string. The second
14731 argument is a list of characters to be translated in the subject string. Each
14732 matching character is replaced by the corresponding character from the
14733 replacement list. For example
14734 </para>
14735 <literallayout class="monospaced">
14736 ${tr{abcdea}{ac}{13}}
14737 </literallayout>
14738 <para>
14739 yields <literal>1b3de1</literal>. If there are duplicates in the second character string, the
14740 last occurrence is used. If the third string is shorter than the second, its
14741 last character is replicated. However, if it is empty, no translation takes
14742 place.
14743 </para>
14744 </listitem></varlistentry>
14745 </variablelist>
14746 </section>
14747 <section id="SECTexpop">
14748 <title>Expansion operators</title>
14749 <para>
14750 <indexterm role="concept">
14751 <primary>expansion</primary>
14752 <secondary>operators</secondary>
14753 </indexterm>
14754 For expansion items that perform transformations on a single argument string,
14755 the <quote>operator</quote> notation is used because it is simpler and uses fewer braces.
14756 The substring is first expanded before the operation is applied to it. The
14757 following operations can be performed:
14758 </para>
14759 <variablelist>
14760 <varlistentry>
14761 <term><emphasis role="bold">${address:</emphasis>&lt;<emphasis>string</emphasis>&gt;<emphasis role="bold">}</emphasis></term>
14762 <listitem>
14763 <para>
14764 <indexterm role="concept">
14765 <primary>expansion</primary>
14766 <secondary>RFC 2822 address handling</secondary>
14767 </indexterm>
14768 <indexterm role="concept">
14769 <primary><option>address</option> expansion item</primary>
14770 </indexterm>
14771 The string is interpreted as an RFC 2822 address, as it might appear in a
14772 header line, and the effective address is extracted from it. If the string does
14773 not parse successfully, the result is empty.
14774 </para>
14775 </listitem></varlistentry>
14776 <varlistentry>
14777 <term><emphasis role="bold">${addresses:</emphasis>&lt;<emphasis>string</emphasis>&gt;<emphasis role="bold">}</emphasis></term>
14778 <listitem>
14779 <para>
14780 <indexterm role="concept">
14781 <primary>expansion</primary>
14782 <secondary>RFC 2822 address handling</secondary>
14783 </indexterm>
14784 <indexterm role="concept">
14785 <primary><option>addresses</option> expansion item</primary>
14786 </indexterm>
14787 The string (after expansion) is interpreted as a list of addresses in RFC
14788 2822 format, such as can be found in a <emphasis>To:</emphasis> or <emphasis>Cc:</emphasis> header line. The
14789 operative address (<emphasis>local-part@domain</emphasis>) is extracted from each item, and the
14790 result of the expansion is a colon-separated list, with appropriate
14791 doubling of colons should any happen to be present in the email addresses.
14792 Syntactically invalid RFC2822 address items are omitted from the output.
14793 </para>
14794 <para>
14795 It is possible to specify a character other than colon for the output
14796 separator by starting the string with &gt; followed by the new separator
14797 character. For example:
14798 </para>
14799 <literallayout class="monospaced">
14800 ${addresses:&gt;&amp; Chief &lt;ceo@up.stairs&gt;, sec@base.ment (dogsbody)}
14801 </literallayout>
14802 <para>
14803 expands to <literal>ceo@up.stairs&amp;sec@base.ment</literal>. Compare the <emphasis role="bold">address</emphasis> (singular)
14804 expansion item, which extracts the working address from a single RFC2822
14805 address. See the <emphasis role="bold">filter</emphasis>, <emphasis role="bold">map</emphasis>, and <emphasis role="bold">reduce</emphasis> items for ways of
14806 processing lists.
14807 </para>
14808 <para>
14809 To clarify "list of addresses in RFC 2822 format" mentioned above, Exim follows
14810 a strict interpretation of header line formatting.  Exim parses the bare,
14811 unquoted portion of an email address and if it finds a comma, treats it as an
14812 email address separator. For the example header line:
14813 </para>
14814 <literallayout class="monospaced">
14815 From: =?iso-8859-2?Q?Last=2C_First?= &lt;user@example.com&gt;
14816 </literallayout>
14817 <para>
14818 The first example below demonstrates that Q-encoded email addresses are parsed
14819 properly if it is given the raw header (in this example, <literal>$rheader_from:</literal>).
14820 It does not see the comma because it&#x2019;s still encoded as "=2C".  The second
14821 example below is passed the contents of <literal>$header_from:</literal>, meaning it gets
14822 de-mimed. Exim sees the decoded "," so it treats it as <emphasis role="bold">two</emphasis> email addresses.
14823 The third example shows that the presence of a comma is skipped when it is
14824 quoted.
14825 </para>
14826 <literallayout class="monospaced">
14827 # exim -be '${addresses:From: \
14828 =?iso-8859-2?Q?Last=2C_First?= &lt;user@example.com&gt;}'
14829 user@example.com
14830 # exim -be '${addresses:From: Last, First &lt;user@example.com&gt;}'
14831 Last:user@example.com
14832 # exim -be '${addresses:From: "Last, First" &lt;user@example.com&gt;}'
14833 user@example.com
14834 </literallayout>
14835 </listitem></varlistentry>
14836 <varlistentry>
14837 <term><emphasis role="bold">${base62:</emphasis>&lt;<emphasis>digits</emphasis>&gt;<emphasis role="bold">}</emphasis></term>
14838 <listitem>
14839 <para>
14840 <indexterm role="concept">
14841 <primary><option>base62</option> expansion item</primary>
14842 </indexterm>
14843 <indexterm role="concept">
14844 <primary>expansion</primary>
14845 <secondary>conversion to base 62</secondary>
14846 </indexterm>
14847 The string must consist entirely of decimal digits. The number is converted to
14848 base 62 and output as a string of six characters, including leading zeros. In
14849 the few operating environments where Exim uses base 36 instead of base 62 for
14850 its message identifiers (because those systems do not have case-sensitive file
14851 names), base 36 is used by this operator, despite its name. <emphasis role="bold">Note</emphasis>: Just to
14852 be absolutely clear: this is <emphasis>not</emphasis> base64 encoding.
14853 </para>
14854 </listitem></varlistentry>
14855 <varlistentry>
14856 <term><emphasis role="bold">${base62d:</emphasis>&lt;<emphasis>base-62&nbsp;digits</emphasis>&gt;<emphasis role="bold">}</emphasis></term>
14857 <listitem>
14858 <para>
14859 <indexterm role="concept">
14860 <primary><option>base62d</option> expansion item</primary>
14861 </indexterm>
14862 <indexterm role="concept">
14863 <primary>expansion</primary>
14864 <secondary>conversion to base 62</secondary>
14865 </indexterm>
14866 The string must consist entirely of base-62 digits, or, in operating
14867 environments where Exim uses base 36 instead of base 62 for its message
14868 identifiers, base-36 digits. The number is converted to decimal and output as a
14869 string.
14870 </para>
14871 </listitem></varlistentry>
14872 <varlistentry>
14873 <term><emphasis role="bold">${domain:</emphasis>&lt;<emphasis>string</emphasis>&gt;<emphasis role="bold">}</emphasis></term>
14874 <listitem>
14875 <para>
14876 <indexterm role="concept">
14877 <primary>domain</primary>
14878 <secondary>extraction</secondary>
14879 </indexterm>
14880 <indexterm role="concept">
14881 <primary>expansion</primary>
14882 <secondary>domain extraction</secondary>
14883 </indexterm>
14884 The string is interpreted as an RFC 2822 address and the domain is extracted
14885 from it. If the string does not parse successfully, the result is empty.
14886 </para>
14887 </listitem></varlistentry>
14888 <varlistentry>
14889 <term><emphasis role="bold">${escape:</emphasis>&lt;<emphasis>string</emphasis>&gt;<emphasis role="bold">}</emphasis></term>
14890 <listitem>
14891 <para>
14892 <indexterm role="concept">
14893 <primary>expansion</primary>
14894 <secondary>escaping non-printing characters</secondary>
14895 </indexterm>
14896 <indexterm role="concept">
14897 <primary><option>escape</option> expansion item</primary>
14898 </indexterm>
14899 If the string contains any non-printing characters, they are converted to
14900 escape sequences starting with a backslash. Whether characters with the most
14901 significant bit set (so-called <quote>8-bit characters</quote>) count as printing or not
14902 is controlled by the <option>print_topbitchars</option> option.
14903 </para>
14904 </listitem></varlistentry>
14905 <varlistentry>
14906 <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>
14907 <listitem>
14908 <para>
14909 <indexterm role="concept">
14910 <primary>expansion</primary>
14911 <secondary>expression evaluation</secondary>
14912 </indexterm>
14913 <indexterm role="concept">
14914 <primary>expansion</primary>
14915 <secondary>arithmetic expression</secondary>
14916 </indexterm>
14917 <indexterm role="concept">
14918 <primary><option>eval</option> expansion item</primary>
14919 </indexterm>
14920 These items supports simple arithmetic and bitwise logical operations in
14921 expansion strings. The string (after expansion) must be a conventional
14922 arithmetic expression, but it is limited to basic arithmetic operators, bitwise
14923 logical operators, and parentheses. All operations are carried out using
14924 integer arithmetic. The operator priorities are as follows (the same as in the
14925 C programming language):
14926 </para>
14927 <informaltable frame="none">
14928 <tgroup cols="2" colsep="0" rowsep="0">
14929 <colspec colwidth="70pt" align="left"/>
14930 <colspec colwidth="300pt" align="left"/>
14931 <tbody>
14932 <row>
14933 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<emphasis>highest:</emphasis></entry>
14934 <entry>not (~), negate (-)</entry>
14935 </row>
14936 <row>
14937 <entry>&nbsp;&nbsp;&nbsp;&nbsp;</entry>
14938 <entry>multiply (*), divide (/), remainder (%)</entry>
14939 </row>
14940 <row>
14941 <entry>&nbsp;&nbsp;&nbsp;&nbsp;</entry>
14942 <entry>plus (+), minus (-)</entry>
14943 </row>
14944 <row>
14945 <entry>&nbsp;&nbsp;&nbsp;&nbsp;</entry>
14946 <entry>shift-left (&lt;&lt;), shift-right (&gt;&gt;)</entry>
14947 </row>
14948 <row>
14949 <entry>&nbsp;&nbsp;&nbsp;&nbsp;</entry>
14950 <entry>and (&amp;)</entry>
14951 </row>
14952 <row>
14953 <entry>&nbsp;&nbsp;&nbsp;&nbsp;</entry>
14954 <entry>xor (^)</entry>
14955 </row>
14956 <row>
14957 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<emphasis>lowest:</emphasis></entry>
14958 <entry>or (|)</entry>
14959 </row>
14960 </tbody>
14961 </tgroup>
14962 </informaltable>
14963 <para>
14964 Binary operators with the same priority are evaluated from left to right. White
14965 space is permitted before or after operators.
14966 </para>
14967 <para>
14968 For <option>eval</option>, numbers may be decimal, octal (starting with <quote>0</quote>) or
14969 hexadecimal (starting with <quote>0x</quote>). For <option>eval10</option>, all numbers are taken as
14970 decimal, even if they start with a leading zero; hexadecimal numbers are not
14971 permitted. This can be useful when processing numbers extracted from dates or
14972 times, which often do have leading zeros.
14973 </para>
14974 <para>
14975 A number may be followed by <quote>K</quote>, <quote>M</quote> or <quote>G</quote> to multiply it by 1024, 1024*1024
14976 or 1024*1024*1024,
14977 respectively. Negative numbers are supported. The result of the computation is
14978 a decimal representation of the answer (without <quote>K</quote>, <quote>M</quote> or <quote>G</quote>). For example:
14979 </para>
14980 <literallayout>
14981 <literal>${eval:1+1}            </literal>  yields 2
14982 <literal>${eval:1+2*3}          </literal>  yields 7
14983 <literal>${eval:(1+2)*3}        </literal>  yields 9
14984 <literal>${eval:2+42%5}         </literal>  yields 4
14985 <literal>${eval:0xc&amp;5}          </literal>  yields 4
14986 <literal>${eval:0xc|5}          </literal>  yields 13
14987 <literal>${eval:0xc^5}          </literal>  yields 9
14988 <literal>${eval:0xc&gt;&gt;1}         </literal>  yields 6
14989 <literal>${eval:0xc&lt;&lt;1}         </literal>  yields 24
14990 <literal>${eval:~255&amp;0x1234}    </literal>  yields 4608
14991 <literal>${eval:-(~255&amp;0x1234)} </literal>  yields -4608
14992 </literallayout>
14993 <para>
14994 As a more realistic example, in an ACL you might have
14995 </para>
14996 <literallayout class="monospaced">
14997 deny   message = Too many bad recipients
14998        condition =                    \
14999          ${if and {                   \
15000            {&gt;{$rcpt_count}{10}}       \
15001            {                          \
15002            &lt;                          \
15003              {$recipients_count}      \
15004              {${eval:$rcpt_count/2}}  \
15005            }                          \
15006          }{yes}{no}}
15007 </literallayout>
15008 <para>
15009 The condition is true if there have been more than 10 RCPT commands and
15010 fewer than half of them have resulted in a valid recipient.
15011 </para>
15012 </listitem></varlistentry>
15013 <varlistentry>
15014 <term><emphasis role="bold">${expand:</emphasis>&lt;<emphasis>string</emphasis>&gt;<emphasis role="bold">}</emphasis></term>
15015 <listitem>
15016 <para>
15017 <indexterm role="concept">
15018 <primary>expansion</primary>
15019 <secondary>re-expansion of substring</secondary>
15020 </indexterm>
15021 The <option>expand</option> operator causes a string to be expanded for a second time. For
15022 example,
15023 </para>
15024 <literallayout class="monospaced">
15025 ${expand:${lookup{$domain}dbm{/some/file}{$value}}}
15026 </literallayout>
15027 <para>
15028 first looks up a string in a file while expanding the operand for <option>expand</option>,
15029 and then re-expands what it has found.
15030 </para>
15031 </listitem></varlistentry>
15032 <varlistentry>
15033 <term><emphasis role="bold">${from_utf8:</emphasis>&lt;<emphasis>string</emphasis>&gt;<emphasis role="bold">}</emphasis></term>
15034 <listitem>
15035 <para>
15036 <indexterm role="concept">
15037 <primary>Unicode</primary>
15038 </indexterm>
15039 <indexterm role="concept">
15040 <primary>UTF-8</primary>
15041 <secondary>conversion from</secondary>
15042 </indexterm>
15043 <indexterm role="concept">
15044 <primary>expansion</primary>
15045 <secondary>UTF-8 conversion</secondary>
15046 </indexterm>
15047 <indexterm role="concept">
15048 <primary><option>from_utf8</option> expansion item</primary>
15049 </indexterm>
15050 The world is slowly moving towards Unicode, although there are no standards for
15051 email yet. However, other applications (including some databases) are starting
15052 to store data in Unicode, using UTF-8 encoding. This operator converts from a
15053 UTF-8 string to an ISO-8859-1 string. UTF-8 code values greater than 255 are
15054 converted to underscores. The input must be a valid UTF-8 string. If it is not,
15055 the result is an undefined sequence of bytes.
15056 </para>
15057 <para>
15058 Unicode code points with values less than 256 are compatible with ASCII and
15059 ISO-8859-1 (also known as Latin-1).
15060 For example, character 169 is the copyright symbol in both cases, though the
15061 way it is encoded is different. In UTF-8, more than one byte is needed for
15062 characters with code values greater than 127, whereas ISO-8859-1 is a
15063 single-byte encoding (but thereby limited to 256 characters). This makes
15064 translation from UTF-8 to ISO-8859-1 straightforward.
15065 </para>
15066 </listitem></varlistentry>
15067 <varlistentry>
15068 <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>
15069 <listitem>
15070 <para>
15071 <indexterm role="concept">
15072 <primary>hash function</primary>
15073 <secondary>textual</secondary>
15074 </indexterm>
15075 <indexterm role="concept">
15076 <primary>expansion</primary>
15077 <secondary>textual hash</secondary>
15078 </indexterm>
15079 The <option>hash</option> operator is a simpler interface to the hashing function that can
15080 be used when the two parameters are fixed numbers (as opposed to strings that
15081 change when expanded). The effect is the same as
15082 </para>
15083 <literallayout class="monospaced">
15084 ${hash{&lt;n&gt;}{&lt;m&gt;}{&lt;string&gt;}}
15085 </literallayout>
15086 <para>
15087 See the description of the general <option>hash</option> item above for details. The
15088 abbreviation <option>h</option> can be used when <option>hash</option> is used as an operator.
15089 </para>
15090 </listitem></varlistentry>
15091 <varlistentry>
15092 <term><emphasis role="bold">${hex2b64:</emphasis>&lt;<emphasis>hexstring</emphasis>&gt;<emphasis role="bold">}</emphasis></term>
15093 <listitem>
15094 <para>
15095 <indexterm role="concept">
15096 <primary>base64 encoding</primary>
15097 <secondary>conversion from hex</secondary>
15098 </indexterm>
15099 <indexterm role="concept">
15100 <primary>expansion</primary>
15101 <secondary>hex to base64</secondary>
15102 </indexterm>
15103 <indexterm role="concept">
15104 <primary><option>hex2b64</option> expansion item</primary>
15105 </indexterm>
15106 This operator converts a hex string into one that is base64 encoded. This can
15107 be useful for processing the output of the MD5 and SHA-1 hashing functions.
15108 </para>
15109 </listitem></varlistentry>
15110 <varlistentry>
15111 <term><emphasis role="bold">${hexquote:</emphasis>&lt;<emphasis>string</emphasis>&gt;<emphasis role="bold">}</emphasis></term>
15112 <listitem>
15113 <para>
15114 <indexterm role="concept">
15115 <primary>quoting</primary>
15116 <secondary>hex-encoded unprintable characters</secondary>
15117 </indexterm>
15118 <indexterm role="concept">
15119 <primary><option>hexquote</option> expansion item</primary>
15120 </indexterm>
15121 This operator converts non-printable characters in a string into a hex
15122 escape form. Byte values between 33 (!) and 126 (~) inclusive are left
15123 as is, and other byte values are converted to <literal>\xNN</literal>, for example a
15124 byte value 127 is converted to <literal>\x7f</literal>.
15125 </para>
15126 </listitem></varlistentry>
15127 <varlistentry>
15128 <term><emphasis role="bold">${lc:</emphasis>&lt;<emphasis>string</emphasis>&gt;<emphasis role="bold">}</emphasis></term>
15129 <listitem>
15130 <para>
15131 <indexterm role="concept">
15132 <primary>case forcing in strings</primary>
15133 </indexterm>
15134 <indexterm role="concept">
15135 <primary>string</primary>
15136 <secondary>case forcing</secondary>
15137 </indexterm>
15138 <indexterm role="concept">
15139 <primary>lower casing</primary>
15140 </indexterm>
15141 <indexterm role="concept">
15142 <primary>expansion</primary>
15143 <secondary>case forcing</secondary>
15144 </indexterm>
15145 <indexterm role="concept">
15146 <primary><option>lc</option> expansion item</primary>
15147 </indexterm>
15148 This forces the letters in the string into lower-case, for example:
15149 </para>
15150 <literallayout class="monospaced">
15151 ${lc:$local_part}
15152 </literallayout>
15153 </listitem></varlistentry>
15154 <varlistentry>
15155 <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>
15156 <listitem>
15157 <para>
15158 <indexterm role="concept">
15159 <primary>expansion</primary>
15160 <secondary>string truncation</secondary>
15161 </indexterm>
15162 <indexterm role="concept">
15163 <primary><option>length</option> expansion item</primary>
15164 </indexterm>
15165 The <option>length</option> operator is a simpler interface to the <option>length</option> function that
15166 can be used when the parameter is a fixed number (as opposed to a string that
15167 changes when expanded). The effect is the same as
15168 </para>
15169 <literallayout class="monospaced">
15170 ${length{&lt;number&gt;}{&lt;string&gt;}}
15171 </literallayout>
15172 <para>
15173 See the description of the general <option>length</option> item above for details. Note that
15174 <option>length</option> is not the same as <option>strlen</option>. The abbreviation <option>l</option> can be used
15175 when <option>length</option> is used as an operator.
15176 </para>
15177 </listitem></varlistentry>
15178 <varlistentry>
15179 <term><emphasis role="bold">${listcount:</emphasis>&lt;<emphasis>string</emphasis>&gt;<emphasis role="bold">}</emphasis></term>
15180 <listitem>
15181 <para>
15182 <indexterm role="concept">
15183 <primary>expansion</primary>
15184 <secondary>list item count</secondary>
15185 </indexterm>
15186 <indexterm role="concept">
15187 <primary>list</primary>
15188 <secondary>item count</secondary>
15189 </indexterm>
15190 <indexterm role="concept">
15191 <primary>list</primary>
15192 <secondary>count of items</secondary>
15193 </indexterm>
15194 <indexterm role="concept">
15195 <primary><option>listcount</option> expansion item</primary>
15196 </indexterm>
15197 The string is interpreted as a list and the number of items is returned.
15198 </para>
15199 </listitem></varlistentry>
15200 <varlistentry>
15201 <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>
15202 <listitem>
15203 <para>
15204 <indexterm role="concept">
15205 <primary>expansion</primary>
15206 <secondary>named list</secondary>
15207 </indexterm>
15208 <indexterm role="concept">
15209 <primary><option>listnamed</option> expansion item</primary>
15210 </indexterm>
15211 The name is interpreted as a named list and the content of the list is returned,
15212 expanding any referenced lists, re-quoting as needed for colon-separation.
15213 If the optional type is given it must be one of "a", "d", "h" or "l"
15214 and selects address-, domain-, host- or localpart- lists to search among respectively.
15215 Otherwise all types are searched in an undefined order and the first
15216 matching list is returned.
15217 </para>
15218 </listitem></varlistentry>
15219 <varlistentry>
15220 <term><emphasis role="bold">${local_part:</emphasis>&lt;<emphasis>string</emphasis>&gt;<emphasis role="bold">}</emphasis></term>
15221 <listitem>
15222 <para>
15223 <indexterm role="concept">
15224 <primary>expansion</primary>
15225 <secondary>local part extraction</secondary>
15226 </indexterm>
15227 <indexterm role="concept">
15228 <primary><option>local_part</option> expansion item</primary>
15229 </indexterm>
15230 The string is interpreted as an RFC 2822 address and the local part is
15231 extracted from it. If the string does not parse successfully, the result is
15232 empty.
15233 </para>
15234 </listitem></varlistentry>
15235 <varlistentry>
15236 <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>
15237 <listitem>
15238 <para>
15239 <indexterm role="concept">
15240 <primary>masked IP address</primary>
15241 </indexterm>
15242 <indexterm role="concept">
15243 <primary>IP address</primary>
15244 <secondary>masking</secondary>
15245 </indexterm>
15246 <indexterm role="concept">
15247 <primary>CIDR notation</primary>
15248 </indexterm>
15249 <indexterm role="concept">
15250 <primary>expansion</primary>
15251 <secondary>IP address masking</secondary>
15252 </indexterm>
15253 <indexterm role="concept">
15254 <primary><option>mask</option> expansion item</primary>
15255 </indexterm>
15256 If the form of the string to be operated on is not an IP address followed by a
15257 slash and an integer (that is, a network address in CIDR notation), the
15258 expansion fails. Otherwise, this operator converts the IP address to binary,
15259 masks off the least significant bits according to the bit count, and converts
15260 the result back to text, with mask appended. For example,
15261 </para>
15262 <literallayout class="monospaced">
15263 ${mask:10.111.131.206/28}
15264 </literallayout>
15265 <para>
15266 returns the string <quote>10.111.131.192/28</quote>. Since this operation is expected to
15267 be mostly used for looking up masked addresses in files, the result for an IPv6
15268 address uses dots to separate components instead of colons, because colon
15269 terminates a key string in lsearch files. So, for example,
15270 </para>
15271 <literallayout class="monospaced">
15272 ${mask:3ffe:ffff:836f:0a00:000a:0800:200a:c031/99}
15273 </literallayout>
15274 <para>
15275 returns the string
15276 </para>
15277 <literallayout class="monospaced">
15278 3ffe.ffff.836f.0a00.000a.0800.2000.0000/99
15279 </literallayout>
15280 <para>
15281 Letters in IPv6 addresses are always output in lower case.
15282 </para>
15283 </listitem></varlistentry>
15284 <varlistentry>
15285 <term><emphasis role="bold">${md5:</emphasis>&lt;<emphasis>string</emphasis>&gt;<emphasis role="bold">}</emphasis></term>
15286 <listitem>
15287 <para>
15288 <indexterm role="concept">
15289 <primary>MD5 hash</primary>
15290 </indexterm>
15291 <indexterm role="concept">
15292 <primary>expansion</primary>
15293 <secondary>MD5 hash</secondary>
15294 </indexterm>
15295 <indexterm role="concept">
15296 <primary>certificate fingerprint</primary>
15297 </indexterm>
15298 <indexterm role="concept">
15299 <primary><option>md5</option> expansion item</primary>
15300 </indexterm>
15301 The <option>md5</option> operator computes the MD5 hash value of the string, and returns it
15302 as a 32-digit hexadecimal number, in which any letters are in lower case.
15303 </para>
15304 </listitem></varlistentry>
15305 <varlistentry>
15306 <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>
15307 <listitem>
15308 <para>
15309 <indexterm role="concept">
15310 <primary>expansion</primary>
15311 <secondary>numeric hash</secondary>
15312 </indexterm>
15313 <indexterm role="concept">
15314 <primary>hash function</primary>
15315 <secondary>numeric</secondary>
15316 </indexterm>
15317 The <option>nhash</option> operator is a simpler interface to the numeric hashing function
15318 that can be used when the two parameters are fixed numbers (as opposed to
15319 strings that change when expanded). The effect is the same as
15320 </para>
15321 <literallayout class="monospaced">
15322 ${nhash{&lt;n&gt;}{&lt;m&gt;}{&lt;string&gt;}}
15323 </literallayout>
15324 <para>
15325 See the description of the general <option>nhash</option> item above for details.
15326 </para>
15327 </listitem></varlistentry>
15328 <varlistentry>
15329 <term><emphasis role="bold">${quote:</emphasis>&lt;<emphasis>string</emphasis>&gt;<emphasis role="bold">}</emphasis></term>
15330 <listitem>
15331 <para>
15332 <indexterm role="concept">
15333 <primary>quoting</primary>
15334 <secondary>in string expansions</secondary>
15335 </indexterm>
15336 <indexterm role="concept">
15337 <primary>expansion</primary>
15338 <secondary>quoting</secondary>
15339 </indexterm>
15340 <indexterm role="concept">
15341 <primary><option>quote</option> expansion item</primary>
15342 </indexterm>
15343 The <option>quote</option> operator puts its argument into double quotes if it
15344 is an empty string or
15345 contains anything other than letters, digits, underscores, dots, and hyphens.
15346 Any occurrences of double quotes and backslashes are escaped with a backslash.
15347 Newlines and carriage returns are converted to <literal>\n</literal> and <literal>\r</literal>,
15348 respectively For example,
15349 </para>
15350 <literallayout class="monospaced">
15351 ${quote:ab"*"cd}
15352 </literallayout>
15353 <para>
15354 becomes
15355 </para>
15356 <literallayout class="monospaced">
15357 "ab\"*\"cd"
15358 </literallayout>
15359 <para>
15360 The place where this is useful is when the argument is a substitution from a
15361 variable or a message header.
15362 </para>
15363 </listitem></varlistentry>
15364 <varlistentry>
15365 <term><emphasis role="bold">${quote_local_part:</emphasis>&lt;<emphasis>string</emphasis>&gt;<emphasis role="bold">}</emphasis></term>
15366 <listitem>
15367 <para>
15368 <indexterm role="concept">
15369 <primary><option>quote_local_part</option> expansion item</primary>
15370 </indexterm>
15371 This operator is like <option>quote</option>, except that it quotes the string only if
15372 required to do so by the rules of RFC 2822 for quoting local parts. For
15373 example, a plus sign would not cause quoting (but it would for <option>quote</option>).
15374 If you are creating a new email address from the contents of <varname>$local_part</varname>
15375 (or any other unknown data), you should always use this operator.
15376 </para>
15377 </listitem></varlistentry>
15378 <varlistentry>
15379 <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>
15380 <listitem>
15381 <para>
15382 <indexterm role="concept">
15383 <primary>quoting</primary>
15384 <secondary>lookup-specific</secondary>
15385 </indexterm>
15386 This operator applies lookup-specific quoting rules to the string. Each
15387 query-style lookup type has its own quoting rules which are described with
15388 the lookups in chapter <xref linkend="CHAPfdlookup"/>. For example,
15389 </para>
15390 <literallayout class="monospaced">
15391 ${quote_ldap:two * two}
15392 </literallayout>
15393 <para>
15394 returns
15395 </para>
15396 <literallayout class="monospaced">
15397 two%20%5C2A%20two
15398 </literallayout>
15399 <para>
15400 For single-key lookup types, no quoting is ever necessary and this operator
15401 yields an unchanged string.
15402 </para>
15403 </listitem></varlistentry>
15404 <varlistentry>
15405 <term><emphasis role="bold">${randint:</emphasis>&lt;<emphasis>n</emphasis>&gt;<emphasis role="bold">}</emphasis></term>
15406 <listitem>
15407 <para>
15408 <indexterm role="concept">
15409 <primary>random number</primary>
15410 </indexterm>
15411 This operator returns a somewhat random number which is less than the
15412 supplied number and is at least 0.  The quality of this randomness depends
15413 on how Exim was built; the values are not suitable for keying material.
15414 If Exim is linked against OpenSSL then RAND_pseudo_bytes() is used.
15415 If Exim is linked against GnuTLS then gnutls_rnd(GNUTLS_RND_NONCE) is used,
15416 for versions of GnuTLS with that function.
15417 Otherwise, the implementation may be arc4random(), random() seeded by
15418 srandomdev() or srandom(), or a custom implementation even weaker than
15419 random().
15420 </para>
15421 </listitem></varlistentry>
15422 <varlistentry>
15423 <term><emphasis role="bold">${reverse_ip:</emphasis>&lt;<emphasis>ipaddr</emphasis>&gt;<emphasis role="bold">}</emphasis></term>
15424 <listitem>
15425 <para>
15426 <indexterm role="concept">
15427 <primary>expansion</primary>
15428 <secondary>IP address</secondary>
15429 </indexterm>
15430 This operator reverses an IP address; for IPv4 addresses, the result is in
15431 dotted-quad decimal form, while for IPv6 addresses the result is in
15432 dotted-nibble hexadecimal form.  In both cases, this is the "natural" form
15433 for DNS.  For example,
15434 </para>
15435 <literallayout class="monospaced">
15436 ${reverse_ip:192.0.2.4}
15437 ${reverse_ip:2001:0db8:c42:9:1:abcd:192.0.2.127}
15438 </literallayout>
15439 <para>
15440 returns
15441 </para>
15442 <literallayout class="monospaced">
15443 4.2.0.192
15444 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
15445 </literallayout>
15446 </listitem></varlistentry>
15447 <varlistentry>
15448 <term><emphasis role="bold">${rfc2047:</emphasis>&lt;<emphasis>string</emphasis>&gt;<emphasis role="bold">}</emphasis></term>
15449 <listitem>
15450 <para>
15451 <indexterm role="concept">
15452 <primary>expansion</primary>
15453 <secondary>RFC 2047</secondary>
15454 </indexterm>
15455 <indexterm role="concept">
15456 <primary>RFC 2047</primary>
15457 <secondary>expansion operator</secondary>
15458 </indexterm>
15459 <indexterm role="concept">
15460 <primary><option>rfc2047</option> expansion item</primary>
15461 </indexterm>
15462 This operator encodes text according to the rules of RFC 2047. This is an
15463 encoding that is used in header lines to encode non-ASCII characters. It is
15464 assumed that the input string is in the encoding specified by the
15465 <option>headers_charset</option> option, which defaults to ISO-8859-1. If the string
15466 contains only characters in the range 33&ndash;126, and no instances of the
15467 characters
15468 </para>
15469 <literallayout class="monospaced">
15470 ? = ( ) &lt; &gt; @ , ; : \ " . [ ] _
15471 </literallayout>
15472 <para>
15473 it is not modified. Otherwise, the result is the RFC 2047 encoding of the
15474 string, using as many <quote>encoded words</quote> as necessary to encode all the
15475 characters.
15476 </para>
15477 </listitem></varlistentry>
15478 <varlistentry>
15479 <term><emphasis role="bold">${rfc2047d:</emphasis>&lt;<emphasis>string</emphasis>&gt;<emphasis role="bold">}</emphasis></term>
15480 <listitem>
15481 <para>
15482 <indexterm role="concept">
15483 <primary>expansion</primary>
15484 <secondary>RFC 2047</secondary>
15485 </indexterm>
15486 <indexterm role="concept">
15487 <primary>RFC 2047</primary>
15488 <secondary>decoding</secondary>
15489 </indexterm>
15490 <indexterm role="concept">
15491 <primary><option>rfc2047d</option> expansion item</primary>
15492 </indexterm>
15493 This operator decodes strings that are encoded as per RFC 2047. Binary zero
15494 bytes are replaced by question marks. Characters are converted into the
15495 character set defined by <option>headers_charset</option>. Overlong RFC 2047 <quote>words</quote> are
15496 not recognized unless <option>check_rfc2047_length</option> is set false.
15497 </para>
15498 <para>
15499 <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
15500 access a header line, RFC 2047 decoding is done automatically. You do not need
15501 to use this operator as well.
15502 </para>
15503 </listitem></varlistentry>
15504 <varlistentry>
15505 <term><emphasis role="bold">${rxquote:</emphasis>&lt;<emphasis>string</emphasis>&gt;<emphasis role="bold">}</emphasis></term>
15506 <listitem>
15507 <para>
15508 <indexterm role="concept">
15509 <primary>quoting</primary>
15510 <secondary>in regular expressions</secondary>
15511 </indexterm>
15512 <indexterm role="concept">
15513 <primary>regular expressions</primary>
15514 <secondary>quoting</secondary>
15515 </indexterm>
15516 <indexterm role="concept">
15517 <primary><option>rxquote</option> expansion item</primary>
15518 </indexterm>
15519 The <option>rxquote</option> operator inserts a backslash before any non-alphanumeric
15520 characters in its argument. This is useful when substituting the values of
15521 variables or headers inside regular expressions.
15522 </para>
15523 </listitem></varlistentry>
15524 <varlistentry>
15525 <term><emphasis role="bold">${sha1:</emphasis>&lt;<emphasis>string</emphasis>&gt;<emphasis role="bold">}</emphasis></term>
15526 <listitem>
15527 <para>
15528 <indexterm role="concept">
15529 <primary>SHA-1 hash</primary>
15530 </indexterm>
15531 <indexterm role="concept">
15532 <primary>expansion</primary>
15533 <secondary>SHA-1 hashing</secondary>
15534 </indexterm>
15535 <indexterm role="concept">
15536 <primary>certificate fingerprint</primary>
15537 </indexterm>
15538 <indexterm role="concept">
15539 <primary><option>sha2</option> expansion item</primary>
15540 </indexterm>
15541 The <option>sha1</option> operator computes the SHA-1 hash value of the string, and returns
15542 it as a 40-digit hexadecimal number, in which any letters are in upper case.
15543 </para>
15544 </listitem></varlistentry>
15545 <varlistentry>
15546 <term><emphasis role="bold">${sha256:</emphasis>&lt;<emphasis>certificate</emphasis>&gt;<emphasis role="bold">}</emphasis></term>
15547 <listitem>
15548 <para>
15549 <indexterm role="concept">
15550 <primary>SHA-256 hash</primary>
15551 </indexterm>
15552 <indexterm role="concept">
15553 <primary>certificate fingerprint</primary>
15554 </indexterm>
15555 <indexterm role="concept">
15556 <primary>expansion</primary>
15557 <secondary>SHA-256 hashing</secondary>
15558 </indexterm>
15559 <indexterm role="concept">
15560 <primary><option>sha256</option> expansion item</primary>
15561 </indexterm>
15562 The <option>sha256</option> operator computes the SHA-256 hash fingerprint of the
15563 certificate,
15564 and returns
15565 it as a 64-digit hexadecimal number, in which any letters are in upper case.
15566 Only arguments which are a single variable of certificate type are supported.
15567 </para>
15568 </listitem></varlistentry>
15569 <varlistentry>
15570 <term><emphasis role="bold">${stat:</emphasis>&lt;<emphasis>string</emphasis>&gt;<emphasis role="bold">}</emphasis></term>
15571 <listitem>
15572 <para>
15573 <indexterm role="concept">
15574 <primary>expansion</primary>
15575 <secondary>statting a file</secondary>
15576 </indexterm>
15577 <indexterm role="concept">
15578 <primary>file</primary>
15579 <secondary>extracting characteristics</secondary>
15580 </indexterm>
15581 <indexterm role="concept">
15582 <primary><option>stat</option> expansion item</primary>
15583 </indexterm>
15584 The string, after expansion, must be a file path. A call to the <function>stat()</function>
15585 function is made for this path. If <function>stat()</function> fails, an error occurs and the
15586 expansion fails. If it succeeds, the data from the stat replaces the item, as a
15587 series of &lt;<emphasis>name</emphasis>&gt;=&lt;<emphasis>value</emphasis>&gt; pairs, where the values are all numerical,
15588 except for the value of <quote>smode</quote>. The names are: <quote>mode</quote> (giving the mode as
15589 a 4-digit octal number), <quote>smode</quote> (giving the mode in symbolic format as a
15590 10-character string, as for the <emphasis>ls</emphasis> command), <quote>inode</quote>, <quote>device</quote>,
15591 <quote>links</quote>, <quote>uid</quote>, <quote>gid</quote>, <quote>size</quote>, <quote>atime</quote>, <quote>mtime</quote>, and <quote>ctime</quote>. You
15592 can extract individual fields using the <option>extract</option> expansion item.
15593 </para>
15594 <para>
15595 The use of the <option>stat</option> expansion in users&#x2019; filter files can be locked out by
15596 the system administrator. <emphasis role="bold">Warning</emphasis>: The file size may be incorrect on 32-bit
15597 systems for files larger than 2GB.
15598 </para>
15599 </listitem></varlistentry>
15600 <varlistentry>
15601 <term><emphasis role="bold">${str2b64:</emphasis>&lt;<emphasis>string</emphasis>&gt;<emphasis role="bold">}</emphasis></term>
15602 <listitem>
15603 <para>
15604 <indexterm role="concept">
15605 <primary>expansion</primary>
15606 <secondary>base64 encoding</secondary>
15607 </indexterm>
15608 <indexterm role="concept">
15609 <primary>base64 encoding</primary>
15610 <secondary>in string expansion</secondary>
15611 </indexterm>
15612 <indexterm role="concept">
15613 <primary><option>str2b64</option> expansion item</primary>
15614 </indexterm>
15615 This operator converts a string into one that is base64 encoded.
15616 </para>
15617 </listitem></varlistentry>
15618 <varlistentry>
15619 <term><emphasis role="bold">${strlen:</emphasis>&lt;<emphasis>string</emphasis>&gt;<emphasis role="bold">}</emphasis></term>
15620 <listitem>
15621 <para>
15622 <indexterm role="concept">
15623 <primary>expansion</primary>
15624 <secondary>string length</secondary>
15625 </indexterm>
15626 <indexterm role="concept">
15627 <primary>string</primary>
15628 <secondary>length in expansion</secondary>
15629 </indexterm>
15630 <indexterm role="concept">
15631 <primary><option>strlen</option> expansion item</primary>
15632 </indexterm>
15633 The item is replace by the length of the expanded string, expressed as a
15634 decimal number. <emphasis role="bold">Note</emphasis>: Do not confuse <option>strlen</option> with <option>length</option>.
15635 </para>
15636 </listitem></varlistentry>
15637 <varlistentry>
15638 <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>
15639 <listitem>
15640 <para>
15641 <indexterm role="concept">
15642 <primary><option>substr</option> expansion item</primary>
15643 </indexterm>
15644 <indexterm role="concept">
15645 <primary>substring extraction</primary>
15646 </indexterm>
15647 <indexterm role="concept">
15648 <primary>expansion</primary>
15649 <secondary>substring expansion</secondary>
15650 </indexterm>
15651 The <option>substr</option> operator is a simpler interface to the <option>substr</option> function that
15652 can be used when the two parameters are fixed numbers (as opposed to strings
15653 that change when expanded). The effect is the same as
15654 </para>
15655 <literallayout class="monospaced">
15656 ${substr{&lt;start&gt;}{&lt;length&gt;}{&lt;string&gt;}}
15657 </literallayout>
15658 <para>
15659 See the description of the general <option>substr</option> item above for details. The
15660 abbreviation <option>s</option> can be used when <option>substr</option> is used as an operator.
15661 </para>
15662 </listitem></varlistentry>
15663 <varlistentry>
15664 <term><emphasis role="bold">${time_eval:</emphasis>&lt;<emphasis>string</emphasis>&gt;<emphasis role="bold">}</emphasis></term>
15665 <listitem>
15666 <para>
15667 <indexterm role="concept">
15668 <primary><option>time_eval</option> expansion item</primary>
15669 </indexterm>
15670 <indexterm role="concept">
15671 <primary>time interval</primary>
15672 <secondary>decoding</secondary>
15673 </indexterm>
15674 This item converts an Exim time interval such as <literal>2d4h5m</literal> into a number of
15675 seconds.
15676 </para>
15677 </listitem></varlistentry>
15678 <varlistentry>
15679 <term><emphasis role="bold">${time_interval:</emphasis>&lt;<emphasis>string</emphasis>&gt;<emphasis role="bold">}</emphasis></term>
15680 <listitem>
15681 <para>
15682 <indexterm role="concept">
15683 <primary><option>time_interval</option> expansion item</primary>
15684 </indexterm>
15685 <indexterm role="concept">
15686 <primary>time interval</primary>
15687 <secondary>formatting</secondary>
15688 </indexterm>
15689 The argument (after sub-expansion) must be a sequence of decimal digits that
15690 represents an interval of time as a number of seconds. It is converted into a
15691 number of larger units and output in Exim&#x2019;s normal time format, for example,
15692 <literal>1w3d4h2m6s</literal>.
15693 </para>
15694 </listitem></varlistentry>
15695 <varlistentry>
15696 <term><emphasis role="bold">${uc:</emphasis>&lt;<emphasis>string</emphasis>&gt;<emphasis role="bold">}</emphasis></term>
15697 <listitem>
15698 <para>
15699 <indexterm role="concept">
15700 <primary>case forcing in strings</primary>
15701 </indexterm>
15702 <indexterm role="concept">
15703 <primary>string</primary>
15704 <secondary>case forcing</secondary>
15705 </indexterm>
15706 <indexterm role="concept">
15707 <primary>upper casing</primary>
15708 </indexterm>
15709 <indexterm role="concept">
15710 <primary>expansion</primary>
15711 <secondary>case forcing</secondary>
15712 </indexterm>
15713 <indexterm role="concept">
15714 <primary><option>uc</option> expansion item</primary>
15715 </indexterm>
15716 This forces the letters in the string into upper-case.
15717 </para>
15718 </listitem></varlistentry>
15719 <varlistentry>
15720 <term><emphasis role="bold">${utf8clean:</emphasis>&lt;<emphasis>string</emphasis>&gt;<emphasis role="bold">}</emphasis></term>
15721 <listitem>
15722 <para>
15723 <indexterm role="concept">
15724 <primary>correction of invalid utf-8 sequences in strings</primary>
15725 </indexterm>
15726 <indexterm role="concept">
15727 <primary>utf-8</primary>
15728 <secondary>utf-8 sequences</secondary>
15729 </indexterm>
15730 <indexterm role="concept">
15731 <primary>incorrect utf-8</primary>
15732 </indexterm>
15733 <indexterm role="concept">
15734 <primary>expansion</primary>
15735 <secondary>utf-8 forcing</secondary>
15736 </indexterm>
15737 <indexterm role="concept">
15738 <primary><option>utf8clean</option> expansion item</primary>
15739 </indexterm>
15740 This replaces any invalid utf-8 sequence in the string by the character <literal>?</literal>.
15741 </para>
15742 </listitem></varlistentry>
15743 </variablelist>
15744 </section>
15745 <section id="SECTexpcond">
15746 <title>Expansion conditions</title>
15747 <para>
15748 <indexterm role="concept" id="IIDexpcond" class="startofrange">
15749 <primary>expansion</primary>
15750 <secondary>conditions</secondary>
15751 </indexterm>
15752 The following conditions are available for testing by the <option>${if</option> construct
15753 while expanding strings:
15754 </para>
15755 <variablelist>
15756 <varlistentry>
15757 <term><emphasis role="bold">!</emphasis>&lt;<emphasis>condition</emphasis>&gt;</term>
15758 <listitem>
15759 <para>
15760 <indexterm role="concept">
15761 <primary>expansion</primary>
15762 <secondary>negating a condition</secondary>
15763 </indexterm>
15764 <indexterm role="concept">
15765 <primary>negation</primary>
15766 <secondary>in expansion condition</secondary>
15767 </indexterm>
15768 Preceding any condition with an exclamation mark negates the result of the
15769 condition.
15770 </para>
15771 </listitem></varlistentry>
15772 <varlistentry>
15773 <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>
15774 <listitem>
15775 <para>
15776 <indexterm role="concept">
15777 <primary>numeric comparison</primary>
15778 </indexterm>
15779 <indexterm role="concept">
15780 <primary>expansion</primary>
15781 <secondary>numeric comparison</secondary>
15782 </indexterm>
15783 There are a number of symbolic operators for doing numeric comparisons. They
15784 are:
15785 </para>
15786 <literallayout>
15787 <literal>=   </literal>   equal
15788 <literal>==  </literal>   equal
15789 <literal>&gt;   </literal>   greater
15790 <literal>&gt;=  </literal>   greater or equal
15791 <literal>&lt;   </literal>   less
15792 <literal>&lt;=  </literal>   less or equal
15793 </literallayout>
15794 <para>
15795 For example:
15796 </para>
15797 <literallayout class="monospaced">
15798 ${if &gt;{$message_size}{10M} ...
15799 </literallayout>
15800 <para>
15801 Note that the general negation operator provides for inequality testing. The
15802 two strings must take the form of optionally signed decimal integers,
15803 optionally followed by one of the letters <quote>K</quote>, <quote>M</quote> or <quote>G</quote> (in either upper or
15804 lower case), signifying multiplication by 1024, 1024*1024 or 1024*1024*1024, respectively.
15805 As a special case, the numerical value of an empty string is taken as
15806 zero.
15807 </para>
15808 <para>
15809 In all cases, a relative comparator OP is testing if &lt;<emphasis>string1</emphasis>&gt; OP
15810 &lt;<emphasis>string2</emphasis>&gt;; the above example is checking if <varname>$message_size</varname> is larger than
15811 10M, not if 10M is larger than <varname>$message_size</varname>.
15812 </para>
15813 </listitem></varlistentry>
15814 <varlistentry>
15815 <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>
15816 <listitem>
15817 <para>
15818 <indexterm role="concept">
15819 <primary>expansion</primary>
15820 <secondary>calling an acl</secondary>
15821 </indexterm>
15822 <indexterm role="concept">
15823 <primary><option>acl</option></primary>
15824 <secondary>expansion condition</secondary>
15825 </indexterm>
15826 The name and zero to nine argument strings are first expanded separately.  The expanded
15827 arguments are assigned to the variables <varname>$acl_arg1</varname> to <varname>$acl_arg9</varname> in order.
15828 Any unused are made empty.  The variable <varname>$acl_narg</varname> is set to the number of
15829 arguments.  The named ACL (see chapter <xref linkend="CHAPACL"/>) is called
15830 and may use the variables; if another acl expansion is used the values
15831 are restored after it returns.  If the ACL sets
15832 a value using a "message =" modifier the variable $value becomes
15833 the result of the expansion, otherwise it is empty.
15834 If the ACL returns accept the condition is true; if deny, false.
15835 If the ACL returns defer the result is a forced-fail.
15836 </para>
15837 </listitem></varlistentry>
15838 <varlistentry>
15839 <term><emphasis role="bold">bool&nbsp;{</emphasis>&lt;<emphasis>string</emphasis>&gt;<emphasis role="bold">}</emphasis></term>
15840 <listitem>
15841 <para>
15842 <indexterm role="concept">
15843 <primary>expansion</primary>
15844 <secondary>boolean parsing</secondary>
15845 </indexterm>
15846 <indexterm role="concept">
15847 <primary><option>bool</option> expansion condition</primary>
15848 </indexterm>
15849 This condition turns a string holding a true or false representation into
15850 a boolean state.  It parses <quote>true</quote>, <quote>false</quote>, <quote>yes</quote> and <quote>no</quote>
15851 (case-insensitively); also integer numbers map to true if non-zero,
15852 false if zero.
15853 An empty string is treated as false.
15854 Leading and trailing whitespace is ignored;
15855 thus a string consisting only of whitespace is false.
15856 All other string values will result in expansion failure.
15857 </para>
15858 <para>
15859 When combined with ACL variables, this expansion condition will let you
15860 make decisions in one place and act on those decisions in another place.
15861 For example:
15862 </para>
15863 <literallayout class="monospaced">
15864 ${if bool{$acl_m_privileged_sender} ...
15865 </literallayout>
15866 </listitem></varlistentry>
15867 <varlistentry>
15868 <term><emphasis role="bold">bool_lax&nbsp;{</emphasis>&lt;<emphasis>string</emphasis>&gt;<emphasis role="bold">}</emphasis></term>
15869 <listitem>
15870 <para>
15871 <indexterm role="concept">
15872 <primary>expansion</primary>
15873 <secondary>boolean parsing</secondary>
15874 </indexterm>
15875 <indexterm role="concept">
15876 <primary><option>bool_lax</option> expansion condition</primary>
15877 </indexterm>
15878 Like <option>bool</option>, this condition turns a string into a boolean state.  But
15879 where <option>bool</option> accepts a strict set of strings, <option>bool_lax</option> uses the same
15880 loose definition that the Router <option>condition</option> option uses.  The empty string
15881 and the values <quote>false</quote>, <quote>no</quote> and <quote>0</quote> map to false, all others map to
15882 true.  Leading and trailing whitespace is ignored.
15883 </para>
15884 <para>
15885 Note that where <quote>bool{00}</quote> is false, <quote>bool_lax{00}</quote> is true.
15886 </para>
15887 </listitem></varlistentry>
15888 <varlistentry>
15889 <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>
15890 <listitem>
15891 <para>
15892 <indexterm role="concept">
15893 <primary>expansion</primary>
15894 <secondary>encrypted comparison</secondary>
15895 </indexterm>
15896 <indexterm role="concept">
15897 <primary>encrypted strings, comparing</primary>
15898 </indexterm>
15899 <indexterm role="concept">
15900 <primary><option>crypteq</option> expansion condition</primary>
15901 </indexterm>
15902 This condition is included in the Exim binary if it is built to support any
15903 authentication mechanisms (see chapter <xref linkend="CHAPSMTPAUTH"/>). Otherwise, it is
15904 necessary to define SUPPORT_CRYPTEQ in <filename>Local/Makefile</filename> to get <option>crypteq</option>
15905 included in the binary.
15906 </para>
15907 <para>
15908 The <option>crypteq</option> condition has two arguments. The first is encrypted and
15909 compared against the second, which is already encrypted. The second string may
15910 be in the LDAP form for storing encrypted strings, which starts with the
15911 encryption type in curly brackets, followed by the data. If the second string
15912 does not begin with <quote>{</quote> it is assumed to be encrypted with <function>crypt()</function> or
15913 <function>crypt16()</function> (see below), since such strings cannot begin with <quote>{</quote>.
15914 Typically this will be a field from a password file. An example of an encrypted
15915 string in LDAP form is:
15916 </para>
15917 <literallayout class="monospaced">
15918 {md5}CY9rzUYh03PK3k6DJie09g==
15919 </literallayout>
15920 <para>
15921 If such a string appears directly in an expansion, the curly brackets have to
15922 be quoted, because they are part of the expansion syntax. For example:
15923 </para>
15924 <literallayout class="monospaced">
15925 ${if crypteq {test}{\{md5\}CY9rzUYh03PK3k6DJie09g==}{yes}{no}}
15926 </literallayout>
15927 <para>
15928 The following encryption types (whose names are matched case-independently) are
15929 supported:
15930 </para>
15931 <itemizedlist>
15932 <listitem>
15933 <para>
15934 <indexterm role="concept">
15935 <primary>MD5 hash</primary>
15936 </indexterm>
15937 <indexterm role="concept">
15938 <primary>base64 encoding</primary>
15939 <secondary>in encrypted password</secondary>
15940 </indexterm>
15941 <option>{md5}</option> computes the MD5 digest of the first string, and expresses this as
15942 printable characters to compare with the remainder of the second string. If the
15943 length of the comparison string is 24, Exim assumes that it is base64 encoded
15944 (as in the above example). If the length is 32, Exim assumes that it is a
15945 hexadecimal encoding of the MD5 digest. If the length not 24 or 32, the
15946 comparison fails.
15947 </para>
15948 </listitem>
15949 <listitem>
15950 <para>
15951 <indexterm role="concept">
15952 <primary>SHA-1 hash</primary>
15953 </indexterm>
15954 <option>{sha1}</option> computes the SHA-1 digest of the first string, and expresses this as
15955 printable characters to compare with the remainder of the second string. If the
15956 length of the comparison string is 28, Exim assumes that it is base64 encoded.
15957 If the length is 40, Exim assumes that it is a hexadecimal encoding of the
15958 SHA-1 digest. If the length is not 28 or 40, the comparison fails.
15959 </para>
15960 </listitem>
15961 <listitem>
15962 <para>
15963 <indexterm role="concept">
15964 <primary><function>crypt()</function></primary>
15965 </indexterm>
15966 <option>{crypt}</option> calls the <function>crypt()</function> function, which traditionally used to use
15967 only the first eight characters of the password. However, in modern operating
15968 systems this is no longer true, and in many cases the entire password is used,
15969 whatever its length.
15970 </para>
15971 </listitem>
15972 <listitem>
15973 <para>
15974 <indexterm role="concept">
15975 <primary><function>crypt16()</function></primary>
15976 </indexterm>
15977 <option>{crypt16}</option> calls the <function>crypt16()</function> function, which was originally created to
15978 use up to 16 characters of the password in some operating systems. Again, in
15979 modern operating systems, more characters may be used.
15980 </para>
15981 </listitem>
15982 </itemizedlist>
15983 <para>
15984 Exim has its own version of <function>crypt16()</function>, which is just a double call to
15985 <function>crypt()</function>. For operating systems that have their own version, setting
15986 HAVE_CRYPT16 in <filename>Local/Makefile</filename> when building Exim causes it to use the
15987 operating system version instead of its own. This option is set by default in
15988 the OS-dependent <filename>Makefile</filename> for those operating systems that are known to
15989 support <function>crypt16()</function>.
15990 </para>
15991 <para>
15992 Some years after Exim&#x2019;s <function>crypt16()</function> was implemented, a user discovered that
15993 it was not using the same algorithm as some operating systems&#x2019; versions. It
15994 turns out that as well as <function>crypt16()</function> there is a function called
15995 <function>bigcrypt()</function> in some operating systems. This may or may not use the same
15996 algorithm, and both of them may be different to Exim&#x2019;s built-in <function>crypt16()</function>.
15997 </para>
15998 <para>
15999 However, since there is now a move away from the traditional <function>crypt()</function>
16000 functions towards using SHA1 and other algorithms, tidying up this area of
16001 Exim is seen as very low priority.
16002 </para>
16003 <para>
16004 If you do not put a encryption type (in curly brackets) in a <option>crypteq</option>
16005 comparison, the default is usually either <literal>{crypt}</literal> or <literal>{crypt16}</literal>, as
16006 determined by the setting of DEFAULT_CRYPT in <filename>Local/Makefile</filename>. The default
16007 default is <literal>{crypt}</literal>. Whatever the default, you can always use either
16008 function by specifying it explicitly in curly brackets.
16009 </para>
16010 </listitem></varlistentry>
16011 <varlistentry>
16012 <term><emphasis role="bold">def:</emphasis>&lt;<emphasis>variable&nbsp;name</emphasis>&gt;</term>
16013 <listitem>
16014 <para>
16015 <indexterm role="concept">
16016 <primary>expansion</primary>
16017 <secondary>checking for empty variable</secondary>
16018 </indexterm>
16019 <indexterm role="concept">
16020 <primary><option>def</option> expansion condition</primary>
16021 </indexterm>
16022 The <option>def</option> condition must be followed by the name of one of the expansion
16023 variables defined in section <xref linkend="SECTexpvar"/>. The condition is true if the
16024 variable does not contain the empty string. For example:
16025 </para>
16026 <literallayout class="monospaced">
16027 ${if def:sender_ident {from $sender_ident}}
16028 </literallayout>
16029 <para>
16030 Note that the variable name is given without a leading <option>$</option> character. If the
16031 variable does not exist, the expansion fails.
16032 </para>
16033 </listitem></varlistentry>
16034 <varlistentry>
16035 <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>
16036 <listitem>
16037 <para>
16038 <indexterm role="concept">
16039 <primary>expansion</primary>
16040 <secondary>checking header line existence</secondary>
16041 </indexterm>
16042 This condition is true if a message is being processed and the named header
16043 exists in the message. For example,
16044 </para>
16045 <literallayout class="monospaced">
16046 ${if def:header_reply-to:{$h_reply-to:}{$h_from:}}
16047 </literallayout>
16048 <para>
16049 <emphasis role="bold">Note</emphasis>: No <option>$</option> appears before <option>header_</option> or <option>h_</option> in the condition, and
16050 the header name must be terminated by a colon if white space does not follow.
16051 </para>
16052 </listitem></varlistentry>
16053 <varlistentry>
16054 <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>
16055 <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>
16056 <listitem>
16057 <para>
16058 <indexterm role="concept">
16059 <primary>string</primary>
16060 <secondary>comparison</secondary>
16061 </indexterm>
16062 <indexterm role="concept">
16063 <primary>expansion</primary>
16064 <secondary>string comparison</secondary>
16065 </indexterm>
16066 <indexterm role="concept">
16067 <primary><option>eq</option> expansion condition</primary>
16068 </indexterm>
16069 <indexterm role="concept">
16070 <primary><option>eqi</option> expansion condition</primary>
16071 </indexterm>
16072 The two substrings are first expanded. The condition is true if the two
16073 resulting strings are identical. For <option>eq</option> the comparison includes the case of
16074 letters, whereas for <option>eqi</option> the comparison is case-independent.
16075 </para>
16076 </listitem></varlistentry>
16077 <varlistentry>
16078 <term><emphasis role="bold">exists&nbsp;{</emphasis>&lt;<emphasis>file&nbsp;name</emphasis>&gt;<emphasis role="bold">}</emphasis></term>
16079 <listitem>
16080 <para>
16081 <indexterm role="concept">
16082 <primary>expansion</primary>
16083 <secondary>file existence test</secondary>
16084 </indexterm>
16085 <indexterm role="concept">
16086 <primary>file</primary>
16087 <secondary>existence test</secondary>
16088 </indexterm>
16089 <indexterm role="concept">
16090 <primary><option>exists</option>, expansion condition</primary>
16091 </indexterm>
16092 The substring is first expanded and then interpreted as an absolute path. The
16093 condition is true if the named file (or directory) exists. The existence test
16094 is done by calling the <function>stat()</function> function. The use of the <option>exists</option> test in
16095 users&#x2019; filter files may be locked out by the system administrator.
16096 </para>
16097 </listitem></varlistentry>
16098 <varlistentry>
16099 <term><emphasis role="bold">first_delivery</emphasis></term>
16100 <listitem>
16101 <para>
16102 <indexterm role="concept">
16103 <primary>delivery</primary>
16104 <secondary>first</secondary>
16105 </indexterm>
16106 <indexterm role="concept">
16107 <primary>first delivery</primary>
16108 </indexterm>
16109 <indexterm role="concept">
16110 <primary>expansion</primary>
16111 <secondary>first delivery test</secondary>
16112 </indexterm>
16113 <indexterm role="concept">
16114 <primary><option>first_delivery</option> expansion condition</primary>
16115 </indexterm>
16116 This condition, which has no data, is true during a message&#x2019;s first delivery
16117 attempt. It is false during any subsequent delivery attempts.
16118 </para>
16119 </listitem></varlistentry>
16120 <varlistentry>
16121 <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>
16122 <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>
16123 <listitem>
16124 <para>
16125 <indexterm role="concept">
16126 <primary>list</primary>
16127 <secondary>iterative conditions</secondary>
16128 </indexterm>
16129 <indexterm role="concept">
16130 <primary>expansion</primary>
16131 <secondary><emphasis role="bold">forall</emphasis> condition</secondary>
16132 </indexterm>
16133 <indexterm role="concept">
16134 <primary>expansion</primary>
16135 <secondary><emphasis role="bold">forany</emphasis> condition</secondary>
16136 </indexterm>
16137 <indexterm role="variable">
16138 <primary><varname>$item</varname></primary>
16139 </indexterm>
16140 These conditions iterate over a list. The first argument is expanded to form
16141 the list. By default, the list separator is a colon, but it can be changed by
16142 the normal method. The second argument is interpreted as a condition that is to
16143 be applied to each item in the list in turn. During the interpretation of the
16144 condition, the current list item is placed in a variable called <varname>$item</varname>.
16145 </para>
16146 <itemizedlist>
16147 <listitem>
16148 <para>
16149 For <emphasis role="bold">forany</emphasis>, interpretation stops if the condition is true for any item, and
16150 the result of the whole condition is true. If the condition is false for all
16151 items in the list, the overall condition is false.
16152 </para>
16153 </listitem>
16154 <listitem>
16155 <para>
16156 For <emphasis role="bold">forall</emphasis>, interpretation stops if the condition is false for any item,
16157 and the result of the whole condition is false. If the condition is true for
16158 all items in the list, the overall condition is true.
16159 </para>
16160 </listitem>
16161 </itemizedlist>
16162 <para>
16163 Note that negation of <emphasis role="bold">forany</emphasis> means that the condition must be false for all
16164 items for the overall condition to succeed, and negation of <emphasis role="bold">forall</emphasis> means
16165 that the condition must be false for at least one item. In this example, the
16166 list separator is changed to a comma:
16167 </para>
16168 <literallayout class="monospaced">
16169 ${if forany{&lt;, $recipients}{match{$item}{^user3@}}{yes}{no}}
16170 </literallayout>
16171 <para>
16172 The value of <varname>$item</varname> is saved and restored while <emphasis role="bold">forany</emphasis> or <emphasis role="bold">forall</emphasis> is
16173 being processed, to enable these expansion items to be nested.
16174 </para>
16175 <para>
16176 To scan a named list, expand it with the <emphasis role="bold">listnamed</emphasis> operator.
16177 </para>
16178 </listitem></varlistentry>
16179 <varlistentry>
16180 <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>
16181 <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>
16182 <listitem>
16183 <para>
16184 <indexterm role="concept">
16185 <primary>string</primary>
16186 <secondary>comparison</secondary>
16187 </indexterm>
16188 <indexterm role="concept">
16189 <primary>expansion</primary>
16190 <secondary>string comparison</secondary>
16191 </indexterm>
16192 <indexterm role="concept">
16193 <primary><option>ge</option> expansion condition</primary>
16194 </indexterm>
16195 <indexterm role="concept">
16196 <primary><option>gei</option> expansion condition</primary>
16197 </indexterm>
16198 The two substrings are first expanded. The condition is true if the first
16199 string is lexically greater than or equal to the second string. For <option>ge</option> the
16200 comparison includes the case of letters, whereas for <option>gei</option> the comparison is
16201 case-independent.
16202 </para>
16203 </listitem></varlistentry>
16204 <varlistentry>
16205 <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>
16206 <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>
16207 <listitem>
16208 <para>
16209 <indexterm role="concept">
16210 <primary>string</primary>
16211 <secondary>comparison</secondary>
16212 </indexterm>
16213 <indexterm role="concept">
16214 <primary>expansion</primary>
16215 <secondary>string comparison</secondary>
16216 </indexterm>
16217 <indexterm role="concept">
16218 <primary><option>gt</option> expansion condition</primary>
16219 </indexterm>
16220 <indexterm role="concept">
16221 <primary><option>gti</option> expansion condition</primary>
16222 </indexterm>
16223 The two substrings are first expanded. The condition is true if the first
16224 string is lexically greater than the second string. For <option>gt</option> the comparison
16225 includes the case of letters, whereas for <option>gti</option> the comparison is
16226 case-independent.
16227 </para>
16228 </listitem></varlistentry>
16229 <varlistentry>
16230 <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>
16231 <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>
16232 <listitem>
16233 <para>
16234 <indexterm role="concept">
16235 <primary>string</primary>
16236 <secondary>comparison</secondary>
16237 </indexterm>
16238 <indexterm role="concept">
16239 <primary>list</primary>
16240 <secondary>iterative conditions</secondary>
16241 </indexterm>
16242 Both strings are expanded; the second string is treated as a list of simple
16243 strings; if the first string is a member of the second, then the condition
16244 is true.
16245 </para>
16246 <para>
16247 These are simpler to use versions of the more powerful <emphasis role="bold">forany</emphasis> condition.
16248 Examples, and the <emphasis role="bold">forany</emphasis> equivalents:
16249 </para>
16250 <literallayout class="monospaced">
16251 ${if inlist{needle}{foo:needle:bar}}
16252   ${if forany{foo:needle:bar}{eq{$item}{needle}}}
16253 ${if inlisti{Needle}{fOo:NeeDLE:bAr}}
16254   ${if forany{fOo:NeeDLE:bAr}{eqi{$item}{Needle}}}
16255 </literallayout>
16256 </listitem></varlistentry>
16257 <varlistentry>
16258 <term><emphasis role="bold">isip&nbsp;{</emphasis>&lt;<emphasis>string</emphasis>&gt;<emphasis role="bold">}</emphasis></term>
16259 <term><emphasis role="bold">isip4&nbsp;{</emphasis>&lt;<emphasis>string</emphasis>&gt;<emphasis role="bold">}</emphasis></term>
16260 <term><emphasis role="bold">isip6&nbsp;{</emphasis>&lt;<emphasis>string</emphasis>&gt;<emphasis role="bold">}</emphasis></term>
16261 <listitem>
16262 <para>
16263 <indexterm role="concept">
16264 <primary>IP address</primary>
16265 <secondary>testing string format</secondary>
16266 </indexterm>
16267 <indexterm role="concept">
16268 <primary>string</primary>
16269 <secondary>testing for IP address</secondary>
16270 </indexterm>
16271 <indexterm role="concept">
16272 <primary><option>isip</option> expansion condition</primary>
16273 </indexterm>
16274 <indexterm role="concept">
16275 <primary><option>isip4</option> expansion condition</primary>
16276 </indexterm>
16277 <indexterm role="concept">
16278 <primary><option>isip6</option> expansion condition</primary>
16279 </indexterm>
16280 The substring is first expanded, and then tested to see if it has the form of
16281 an IP address. Both IPv4 and IPv6 addresses are valid for <option>isip</option>, whereas
16282 <option>isip4</option> and <option>isip6</option> test specifically for IPv4 or IPv6 addresses.
16283 </para>
16284 <para>
16285 For an IPv4 address, the test is for four dot-separated components, each of
16286 which consists of from one to three digits. For an IPv6 address, up to eight
16287 colon-separated components are permitted, each containing from one to four
16288 hexadecimal digits. There may be fewer than eight components if an empty
16289 component (adjacent colons) is present. Only one empty component is permitted.
16290 </para>
16291 <para>
16292 <emphasis role="bold">Note</emphasis>: The checks are just on the form of the address; actual numerical
16293 values are not considered. Thus, for example, 999.999.999.999 passes the IPv4
16294 check. The main use of these tests is to distinguish between IP addresses and
16295 host names, or between IPv4 and IPv6 addresses. For example, you could use
16296 </para>
16297 <literallayout class="monospaced">
16298 ${if isip4{$sender_host_address}...
16299 </literallayout>
16300 <para>
16301 to test which IP version an incoming SMTP connection is using.
16302 </para>
16303 </listitem></varlistentry>
16304 <varlistentry>
16305 <term><emphasis role="bold">ldapauth&nbsp;{</emphasis>&lt;<emphasis>ldap&nbsp;query</emphasis>&gt;<emphasis role="bold">}</emphasis></term>
16306 <listitem>
16307 <para>
16308 <indexterm role="concept">
16309 <primary>LDAP</primary>
16310 <secondary>use for authentication</secondary>
16311 </indexterm>
16312 <indexterm role="concept">
16313 <primary>expansion</primary>
16314 <secondary>LDAP authentication test</secondary>
16315 </indexterm>
16316 <indexterm role="concept">
16317 <primary><option>ldapauth</option> expansion condition</primary>
16318 </indexterm>
16319 This condition supports user authentication using LDAP. See section
16320 <xref linkend="SECTldap"/> for details of how to use LDAP in lookups and the syntax of
16321 queries. For this use, the query must contain a user name and password. The
16322 query itself is not used, and can be empty. The condition is true if the
16323 password is not empty, and the user name and password are accepted by the LDAP
16324 server. An empty password is rejected without calling LDAP because LDAP binds
16325 with an empty password are considered anonymous regardless of the username, and
16326 will succeed in most configurations. See chapter <xref linkend="CHAPSMTPAUTH"/> for details
16327 of SMTP authentication, and chapter <xref linkend="CHAPplaintext"/> for an example of how
16328 this can be used.
16329 </para>
16330 </listitem></varlistentry>
16331 <varlistentry>
16332 <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>
16333 <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>
16334 <listitem>
16335 <para>
16336 <indexterm role="concept">
16337 <primary>string</primary>
16338 <secondary>comparison</secondary>
16339 </indexterm>
16340 <indexterm role="concept">
16341 <primary>expansion</primary>
16342 <secondary>string comparison</secondary>
16343 </indexterm>
16344 <indexterm role="concept">
16345 <primary><option>le</option> expansion condition</primary>
16346 </indexterm>
16347 <indexterm role="concept">
16348 <primary><option>lei</option> expansion condition</primary>
16349 </indexterm>
16350 The two substrings are first expanded. The condition is true if the first
16351 string is lexically less than or equal to the second string. For <option>le</option> the
16352 comparison includes the case of letters, whereas for <option>lei</option> the comparison is
16353 case-independent.
16354 </para>
16355 </listitem></varlistentry>
16356 <varlistentry>
16357 <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>
16358 <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>
16359 <listitem>
16360 <para>
16361 <indexterm role="concept">
16362 <primary>string</primary>
16363 <secondary>comparison</secondary>
16364 </indexterm>
16365 <indexterm role="concept">
16366 <primary>expansion</primary>
16367 <secondary>string comparison</secondary>
16368 </indexterm>
16369 <indexterm role="concept">
16370 <primary><option>lt</option> expansion condition</primary>
16371 </indexterm>
16372 <indexterm role="concept">
16373 <primary><option>lti</option> expansion condition</primary>
16374 </indexterm>
16375 The two substrings are first expanded. The condition is true if the first
16376 string is lexically less than the second string. For <option>lt</option> the comparison
16377 includes the case of letters, whereas for <option>lti</option> the comparison is
16378 case-independent.
16379 </para>
16380 </listitem></varlistentry>
16381 <varlistentry>
16382 <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>
16383 <listitem>
16384 <para>
16385 <indexterm role="concept">
16386 <primary>expansion</primary>
16387 <secondary>regular expression comparison</secondary>
16388 </indexterm>
16389 <indexterm role="concept">
16390 <primary>regular expressions</primary>
16391 <secondary>match in expanded string</secondary>
16392 </indexterm>
16393 <indexterm role="concept">
16394 <primary><option>match</option> expansion condition</primary>
16395 </indexterm>
16396 The two substrings are first expanded. The second is then treated as a regular
16397 expression and applied to the first. Because of the pre-expansion, if the
16398 regular expression contains dollar, or backslash characters, they must be
16399 escaped. Care must also be taken if the regular expression contains braces
16400 (curly brackets). A closing brace must be escaped so that it is not taken as a
16401 premature termination of &lt;<emphasis>string2</emphasis>&gt;. The easiest approach is to use the
16402 <literal>\N</literal> feature to disable expansion of the regular expression.
16403 For example,
16404 </para>
16405 <literallayout class="monospaced">
16406 ${if match {$local_part}{\N^\d{3}\N} ...
16407 </literallayout>
16408 <para>
16409 If the whole expansion string is in double quotes, further escaping of
16410 backslashes is also required.
16411 </para>
16412 <para>
16413 The condition is true if the regular expression match succeeds.
16414 The regular expression is not required to begin with a circumflex
16415 metacharacter, but if there is no circumflex, the expression is not anchored,
16416 and it may match anywhere in the subject, not just at the start. If you want
16417 the pattern to match at the end of the subject, you must include the <literal>$</literal>
16418 metacharacter at an appropriate point.
16419 </para>
16420 <para>
16421 <indexterm role="concept">
16422 <primary>numerical variables (<varname>$1</varname> <varname>$2</varname> etc)</primary>
16423 <secondary>in <option>if</option> expansion</secondary>
16424 </indexterm>
16425 At the start of an <option>if</option> expansion the values of the numeric variable
16426 substitutions <varname>$1</varname> etc. are remembered. Obeying a <option>match</option> condition that
16427 succeeds causes them to be reset to the substrings of that condition and they
16428 will have these values during the expansion of the success string. At the end
16429 of the <option>if</option> expansion, the previous values are restored. After testing a
16430 combination of conditions using <option>or</option>, the subsequent values of the numeric
16431 variables are those of the condition that succeeded.
16432 </para>
16433 </listitem></varlistentry>
16434 <varlistentry>
16435 <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>
16436 <listitem>
16437 <para>
16438 <indexterm role="concept">
16439 <primary><option>match_address</option> expansion condition</primary>
16440 </indexterm>
16441 See <emphasis role="bold">match_local_part</emphasis>.
16442 </para>
16443 </listitem></varlistentry>
16444 <varlistentry>
16445 <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>
16446 <listitem>
16447 <para>
16448 <indexterm role="concept">
16449 <primary><option>match_domain</option> expansion condition</primary>
16450 </indexterm>
16451 See <emphasis role="bold">match_local_part</emphasis>.
16452 </para>
16453 </listitem></varlistentry>
16454 <varlistentry>
16455 <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>
16456 <listitem>
16457 <para>
16458 <indexterm role="concept">
16459 <primary><option>match_ip</option> expansion condition</primary>
16460 </indexterm>
16461 This condition matches an IP address to a list of IP address patterns. It must
16462 be followed by two argument strings. The first (after expansion) must be an IP
16463 address or an empty string. The second (not expanded) is a restricted host
16464 list that can match only an IP address, not a host name. For example:
16465 </para>
16466 <literallayout class="monospaced">
16467 ${if match_ip{$sender_host_address}{1.2.3.4:5.6.7.8}{...}{...}}
16468 </literallayout>
16469 <para>
16470 The specific types of host list item that are permitted in the list are:
16471 </para>
16472 <itemizedlist>
16473 <listitem>
16474 <para>
16475 An IP address, optionally with a CIDR mask.
16476 </para>
16477 </listitem>
16478 <listitem>
16479 <para>
16480 A single asterisk, which matches any IP address.
16481 </para>
16482 </listitem>
16483 <listitem>
16484 <para>
16485 An empty item, which matches only if the IP address is empty. This could be
16486 useful for testing for a locally submitted message or one from specific hosts
16487 in a single test such as
16488 </para>
16489 <literallayout class="monospaced">
16490   ${if match_ip{$sender_host_address}{:4.3.2.1:...}{...}{...}}
16491 </literallayout>
16492 <para>
16493 where the first item in the list is the empty string.
16494 </para>
16495 </listitem>
16496 <listitem>
16497 <para>
16498 The item @[] matches any of the local host&#x2019;s interface addresses.
16499 </para>
16500 </listitem>
16501 <listitem>
16502 <para>
16503 Single-key lookups are assumed to be like <quote>net-</quote> style lookups in host lists,
16504 even if <literal>net-</literal> is not specified. There is never any attempt to turn the IP
16505 address into a host name. The most common type of linear search for
16506 <emphasis role="bold">match_ip</emphasis> is likely to be <emphasis role="bold">iplsearch</emphasis>, in which the file can contain CIDR
16507 masks. For example:
16508 </para>
16509 <literallayout class="monospaced">
16510   ${if match_ip{$sender_host_address}{iplsearch;/some/file}...
16511 </literallayout>
16512 <para>
16513 It is of course possible to use other kinds of lookup, and in such a case, you
16514 do need to specify the <literal>net-</literal> prefix if you want to specify a specific
16515 address mask, for example:
16516 </para>
16517 <literallayout class="monospaced">
16518   ${if match_ip{$sender_host_address}{net24-dbm;/some/file}...
16519 </literallayout>
16520 <para>
16521 However, unless you are combining a <option>match_ip</option> condition with others, it is
16522 just as easy to use the fact that a lookup is itself a condition, and write:
16523 </para>
16524 <literallayout class="monospaced">
16525   ${lookup{${mask:$sender_host_address/24}}dbm{/a/file}...
16526 </literallayout>
16527 </listitem>
16528 </itemizedlist>
16529 <para>
16530 Note that &lt;<emphasis>string2</emphasis>&gt; is not itself subject to string expansion, unless
16531 Exim was built with the EXPAND_LISTMATCH_RHS option.
16532 </para>
16533 <para>
16534 Consult section <xref linkend="SECThoslispatip"/> for further details of these patterns.
16535 </para>
16536 </listitem></varlistentry>
16537 <varlistentry>
16538 <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>
16539 <listitem>
16540 <para>
16541 <indexterm role="concept">
16542 <primary>domain list</primary>
16543 <secondary>in expansion condition</secondary>
16544 </indexterm>
16545 <indexterm role="concept">
16546 <primary>address list</primary>
16547 <secondary>in expansion condition</secondary>
16548 </indexterm>
16549 <indexterm role="concept">
16550 <primary>local part</primary>
16551 <secondary>list, in expansion condition</secondary>
16552 </indexterm>
16553 <indexterm role="concept">
16554 <primary><option>match_local_part</option> expansion condition</primary>
16555 </indexterm>
16556 This condition, together with <option>match_address</option> and <option>match_domain</option>, make it
16557 possible to test domain, address, and local part lists within expansions. Each
16558 condition requires two arguments: an item and a list to match. A trivial
16559 example is:
16560 </para>
16561 <literallayout class="monospaced">
16562 ${if match_domain{a.b.c}{x.y.z:a.b.c:p.q.r}{yes}{no}}
16563 </literallayout>
16564 <para>
16565 In each case, the second argument may contain any of the allowable items for a
16566 list of the appropriate type. Also, because the second argument (after
16567 expansion) is a standard form of list, it is possible to refer to a named list.
16568 Thus, you can use conditions like this:
16569 </para>
16570 <literallayout class="monospaced">
16571 ${if match_domain{$domain}{+local_domains}{...
16572 </literallayout>
16573 <para>
16574 <indexterm role="concept">
16575 <primary><literal>+caseful</literal></primary>
16576 </indexterm>
16577 For address lists, the matching starts off caselessly, but the <literal>+caseful</literal>
16578 item can be used, as in all address lists, to cause subsequent items to
16579 have their local parts matched casefully. Domains are always matched
16580 caselessly.
16581 </para>
16582 <para>
16583 Note that &lt;<emphasis>string2</emphasis>&gt; is not itself subject to string expansion, unless
16584 Exim was built with the EXPAND_LISTMATCH_RHS option.
16585 </para>
16586 <para>
16587 <emphasis role="bold">Note</emphasis>: Host lists are <emphasis>not</emphasis> supported in this way. This is because
16588 hosts have two identities: a name and an IP address, and it is not clear
16589 how to specify cleanly how such a test would work. However, IP addresses can be
16590 matched using <option>match_ip</option>.
16591 </para>
16592 </listitem></varlistentry>
16593 <varlistentry>
16594 <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>
16595 <listitem>
16596 <para>
16597 <indexterm role="concept">
16598 <primary>PAM authentication</primary>
16599 </indexterm>
16600 <indexterm role="concept">
16601 <primary>AUTH</primary>
16602 <secondary>with PAM</secondary>
16603 </indexterm>
16604 <indexterm role="concept">
16605 <primary>Solaris</primary>
16606 <secondary>PAM support</secondary>
16607 </indexterm>
16608 <indexterm role="concept">
16609 <primary>expansion</primary>
16610 <secondary>PAM authentication test</secondary>
16611 </indexterm>
16612 <indexterm role="concept">
16613 <primary><option>pam</option> expansion condition</primary>
16614 </indexterm>
16615 <emphasis>Pluggable Authentication Modules</emphasis>
16616 (<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
16617 available in the latest releases of Solaris and in some GNU/Linux
16618 distributions. The Exim support, which is intended for use in conjunction with
16619 the SMTP AUTH command, is available only if Exim is compiled with
16620 </para>
16621 <literallayout class="monospaced">
16622 SUPPORT_PAM=yes
16623 </literallayout>
16624 <para>
16625 in <filename>Local/Makefile</filename>. You probably need to add <option>-lpam</option> to EXTRALIBS, and
16626 in some releases of GNU/Linux <option>-ldl</option> is also needed.
16627 </para>
16628 <para>
16629 The argument string is first expanded, and the result must be a
16630 colon-separated list of strings. Leading and trailing white space is ignored.
16631 The PAM module is initialized with the service name <quote>exim</quote> and the user name
16632 taken from the first item in the colon-separated data string (&lt;<emphasis>string1</emphasis>&gt;).
16633 The remaining items in the data string are passed over in response to requests
16634 from the authentication function. In the simple case there will only be one
16635 request, for a password, so the data consists of just two strings.
16636 </para>
16637 <para>
16638 There can be problems if any of the strings are permitted to contain colon
16639 characters. In the usual way, these have to be doubled to avoid being taken as
16640 separators. If the data is being inserted from a variable, the <option>sg</option> expansion
16641 item can be used to double any existing colons. For example, the configuration
16642 of a LOGIN authenticator might contain this setting:
16643 </para>
16644 <literallayout class="monospaced">
16645 server_condition = ${if pam{$auth1:${sg{$auth2}{:}{::}}}}
16646 </literallayout>
16647 <para>
16648 For a PLAIN authenticator you could use:
16649 </para>
16650 <literallayout class="monospaced">
16651 server_condition = ${if pam{$auth2:${sg{$auth3}{:}{::}}}}
16652 </literallayout>
16653 <para>
16654 In some operating systems, PAM authentication can be done only from a process
16655 running as root. Since Exim is running as the Exim user when receiving
16656 messages, this means that PAM cannot be used directly in those systems.
16657 A patched version of the <emphasis>pam_unix</emphasis> module that comes with the
16658 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>.
16659 The patched module allows one special uid/gid combination, in addition to root,
16660 to authenticate. If you build the patched module to allow the Exim user and
16661 group, PAM can then be used from an Exim authenticator.
16662 </para>
16663 </listitem></varlistentry>
16664 <varlistentry>
16665 <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>
16666 <listitem>
16667 <para>
16668 <indexterm role="concept">
16669 <primary><emphasis>pwcheck</emphasis> daemon</primary>
16670 </indexterm>
16671 <indexterm role="concept">
16672 <primary>Cyrus</primary>
16673 </indexterm>
16674 <indexterm role="concept">
16675 <primary>expansion</primary>
16676 <secondary><emphasis>pwcheck</emphasis> authentication test</secondary>
16677 </indexterm>
16678 <indexterm role="concept">
16679 <primary><option>pwcheck</option> expansion condition</primary>
16680 </indexterm>
16681 This condition supports user authentication using the Cyrus <emphasis>pwcheck</emphasis> daemon.
16682 This is one way of making it possible for passwords to be checked by a process
16683 that is not running as root. <emphasis role="bold">Note</emphasis>: The use of <emphasis>pwcheck</emphasis> is now
16684 deprecated. Its replacement is <emphasis>saslauthd</emphasis> (see below).
16685 </para>
16686 <para>
16687 The pwcheck support is not included in Exim by default. You need to specify
16688 the location of the pwcheck daemon&#x2019;s socket in <filename>Local/Makefile</filename> before
16689 building Exim. For example:
16690 </para>
16691 <literallayout class="monospaced">
16692 CYRUS_PWCHECK_SOCKET=/var/pwcheck/pwcheck
16693 </literallayout>
16694 <para>
16695 You do not need to install the full Cyrus software suite in order to use
16696 the pwcheck daemon. You can compile and install just the daemon alone
16697 from the Cyrus SASL library. Ensure that <emphasis>exim</emphasis> is the only user that has
16698 access to the <filename>/var/pwcheck</filename> directory.
16699 </para>
16700 <para>
16701 The <option>pwcheck</option> condition takes one argument, which must be the user name and
16702 password, separated by a colon. For example, in a LOGIN authenticator
16703 configuration, you might have this:
16704 </para>
16705 <literallayout class="monospaced">
16706 server_condition = ${if pwcheck{$auth1:$auth2}}
16707 </literallayout>
16708 <para>
16709 Again, for a PLAIN authenticator configuration, this would be:
16710 </para>
16711 <literallayout class="monospaced">
16712 server_condition = ${if pwcheck{$auth2:$auth3}}
16713 </literallayout>
16714 </listitem></varlistentry>
16715 <varlistentry>
16716 <term><emphasis role="bold">queue_running</emphasis></term>
16717 <listitem>
16718 <para>
16719 <indexterm role="concept">
16720 <primary>queue runner</primary>
16721 <secondary>detecting when delivering from</secondary>
16722 </indexterm>
16723 <indexterm role="concept">
16724 <primary>expansion</primary>
16725 <secondary>queue runner test</secondary>
16726 </indexterm>
16727 <indexterm role="concept">
16728 <primary><option>queue_running</option> expansion condition</primary>
16729 </indexterm>
16730 This condition, which has no data, is true during delivery attempts that are
16731 initiated by queue runner processes, and false otherwise.
16732 </para>
16733 </listitem></varlistentry>
16734 <varlistentry>
16735 <term><emphasis role="bold">radius&nbsp;{</emphasis>&lt;<emphasis>authentication&nbsp;string</emphasis>&gt;<emphasis role="bold">}</emphasis></term>
16736 <listitem>
16737 <para>
16738 <indexterm role="concept">
16739 <primary>Radius</primary>
16740 </indexterm>
16741 <indexterm role="concept">
16742 <primary>expansion</primary>
16743 <secondary>Radius authentication</secondary>
16744 </indexterm>
16745 <indexterm role="concept">
16746 <primary><option>radius</option> expansion condition</primary>
16747 </indexterm>
16748 Radius authentication (RFC 2865) is supported in a similar way to PAM. You must
16749 set RADIUS_CONFIG_FILE in <filename>Local/Makefile</filename> to specify the location of
16750 the Radius client configuration file in order to build Exim with Radius
16751 support.
16752 </para>
16753 <para>
16754 With just that one setting, Exim expects to be linked with the <option>radiusclient</option>
16755 library, using the original API. If you are using release 0.4.0 or later of
16756 this library, you need to set
16757 </para>
16758 <literallayout class="monospaced">
16759 RADIUS_LIB_TYPE=RADIUSCLIENTNEW
16760 </literallayout>
16761 <para>
16762 in <filename>Local/Makefile</filename> when building Exim. You can also link Exim with the
16763 <option>libradius</option> library that comes with FreeBSD. To do this, set
16764 </para>
16765 <literallayout class="monospaced">
16766 RADIUS_LIB_TYPE=RADLIB
16767 </literallayout>
16768 <para>
16769 in <filename>Local/Makefile</filename>, in addition to setting RADIUS_CONFIGURE_FILE.
16770 You may also have to supply a suitable setting in EXTRALIBS so that the
16771 Radius library can be found when Exim is linked.
16772 </para>
16773 <para>
16774 The string specified by RADIUS_CONFIG_FILE is expanded and passed to the
16775 Radius client library, which calls the Radius server. The condition is true if
16776 the authentication is successful. For example:
16777 </para>
16778 <literallayout class="monospaced">
16779 server_condition = ${if radius{&lt;arguments&gt;}}
16780 </literallayout>
16781 </listitem></varlistentry>
16782 <varlistentry>
16783 <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>
16784 <listitem>
16785 <para>
16786 <indexterm role="concept">
16787 <primary><emphasis>saslauthd</emphasis> daemon</primary>
16788 </indexterm>
16789 <indexterm role="concept">
16790 <primary>Cyrus</primary>
16791 </indexterm>
16792 <indexterm role="concept">
16793 <primary>expansion</primary>
16794 <secondary><emphasis>saslauthd</emphasis> authentication test</secondary>
16795 </indexterm>
16796 <indexterm role="concept">
16797 <primary><option>saslauthd</option> expansion condition</primary>
16798 </indexterm>
16799 This condition supports user authentication using the Cyrus <emphasis>saslauthd</emphasis>
16800 daemon. This replaces the older <emphasis>pwcheck</emphasis> daemon, which is now deprecated.
16801 Using this daemon is one way of making it possible for passwords to be checked
16802 by a process that is not running as root.
16803 </para>
16804 <para>
16805 The saslauthd support is not included in Exim by default. You need to specify
16806 the location of the saslauthd daemon&#x2019;s socket in <filename>Local/Makefile</filename> before
16807 building Exim. For example:
16808 </para>
16809 <literallayout class="monospaced">
16810 CYRUS_SASLAUTHD_SOCKET=/var/state/saslauthd/mux
16811 </literallayout>
16812 <para>
16813 You do not need to install the full Cyrus software suite in order to use
16814 the saslauthd daemon. You can compile and install just the daemon alone
16815 from the Cyrus SASL library.
16816 </para>
16817 <para>
16818 Up to four arguments can be supplied to the <option>saslauthd</option> condition, but only
16819 two are mandatory. For example:
16820 </para>
16821 <literallayout class="monospaced">
16822 server_condition = ${if saslauthd{{$auth1}{$auth2}}}
16823 </literallayout>
16824 <para>
16825 The service and the realm are optional (which is why the arguments are enclosed
16826 in their own set of braces). For details of the meaning of the service and
16827 realm, and how to run the daemon, consult the Cyrus documentation.
16828 </para>
16829 </listitem></varlistentry>
16830 </variablelist>
16831 </section>
16832 <section id="SECID84">
16833 <title>Combining expansion conditions</title>
16834 <para>
16835 <indexterm role="concept">
16836 <primary>expansion</primary>
16837 <secondary>combining conditions</secondary>
16838 </indexterm>
16839 Several conditions can be tested at once by combining them using the <option>and</option>
16840 and <option>or</option> combination conditions. Note that <option>and</option> and <option>or</option> are complete
16841 conditions on their own, and precede their lists of sub-conditions. Each
16842 sub-condition must be enclosed in braces within the overall braces that contain
16843 the list. No repetition of <option>if</option> is used.
16844 </para>
16845 <variablelist>
16846 <varlistentry>
16847 <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>
16848 <listitem>
16849 <para>
16850 <indexterm role="concept">
16851 <primary><quote>or</quote> expansion condition</primary>
16852 </indexterm>
16853 <indexterm role="concept">
16854 <primary>expansion</primary>
16855 <secondary><quote>or</quote> of conditions</secondary>
16856 </indexterm>
16857 The sub-conditions are evaluated from left to right. The condition is true if
16858 any one of the sub-conditions is true.
16859 For example,
16860 </para>
16861 <literallayout class="monospaced">
16862 ${if or {{eq{$local_part}{spqr}}{eq{$domain}{testing.com}}}...
16863 </literallayout>
16864 <para>
16865 When a true sub-condition is found, the following ones are parsed but not
16866 evaluated. If there are several <quote>match</quote> sub-conditions the values of the
16867 numeric variables afterwards are taken from the first one that succeeds.
16868 </para>
16869 </listitem></varlistentry>
16870 <varlistentry>
16871 <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>
16872 <listitem>
16873 <para>
16874 <indexterm role="concept">
16875 <primary><quote>and</quote> expansion condition</primary>
16876 </indexterm>
16877 <indexterm role="concept">
16878 <primary>expansion</primary>
16879 <secondary><quote>and</quote> of conditions</secondary>
16880 </indexterm>
16881 The sub-conditions are evaluated from left to right. The condition is true if
16882 all of the sub-conditions are true. If there are several <quote>match</quote>
16883 sub-conditions, the values of the numeric variables afterwards are taken from
16884 the last one. When a false sub-condition is found, the following ones are
16885 parsed but not evaluated.
16886 </para>
16887 </listitem></varlistentry>
16888 </variablelist>
16889 <para>
16890 <indexterm role="concept" startref="IIDexpcond" class="endofrange"/>
16891 </para>
16892 </section>
16893 <section id="SECTexpvar">
16894 <title>Expansion variables</title>
16895 <para>
16896 <indexterm role="concept">
16897 <primary>expansion</primary>
16898 <secondary>variables, list of</secondary>
16899 </indexterm>
16900 This section contains an alphabetical list of all the expansion variables. Some
16901 of them are available only when Exim is compiled with specific options such as
16902 support for TLS or the content scanning extension.
16903 </para>
16904 <variablelist>
16905 <varlistentry>
16906 <term><varname>$0</varname>, <varname>$1</varname>, etc</term>
16907 <listitem>
16908 <para>
16909 <indexterm role="concept">
16910 <primary>numerical variables (<varname>$1</varname> <varname>$2</varname> etc)</primary>
16911 </indexterm>
16912 When a <option>match</option> expansion condition succeeds, these variables contain the
16913 captured substrings identified by the regular expression during subsequent
16914 processing of the success string of the containing <option>if</option> expansion item.
16915 However, they do not retain their values afterwards; in fact, their previous
16916 values are restored at the end of processing an <option>if</option> item. The numerical
16917 variables may also be set externally by some other matching process which
16918 precedes the expansion of the string. For example, the commands available in
16919 Exim filter files include an <option>if</option> command with its own regular expression
16920 matching condition.
16921 </para>
16922 </listitem></varlistentry>
16923 <varlistentry>
16924 <term><varname>$acl_arg1</varname>, <varname>$acl_arg2</varname>, etc</term>
16925 <listitem>
16926 <para>
16927 Within an acl condition, expansion condition or expansion item
16928 any arguments are copied to these variables,
16929 any unused variables being made empty.
16930 </para>
16931 </listitem></varlistentry>
16932 <varlistentry>
16933 <term><varname>$acl_c...</varname></term>
16934 <listitem>
16935 <para>
16936 Values can be placed in these variables by the <option>set</option> modifier in an ACL. They
16937 can be given any name that starts with <varname>$acl_c</varname> and is at least six characters
16938 long, but the sixth character must be either a digit or an underscore. For
16939 example: <varname>$acl_c5</varname>, <varname>$acl_c_mycount</varname>. The values of the <varname>$acl_c...</varname>
16940 variables persist throughout the lifetime of an SMTP connection. They can be
16941 used to pass information between ACLs and between different invocations of the
16942 same ACL. When a message is received, the values of these variables are saved
16943 with the message, and can be accessed by filters, routers, and transports
16944 during subsequent delivery.
16945 </para>
16946 </listitem></varlistentry>
16947 <varlistentry>
16948 <term><varname>$acl_m...</varname></term>
16949 <listitem>
16950 <para>
16951 These variables are like the <varname>$acl_c...</varname> variables, except that their values
16952 are reset after a message has been received. Thus, if several messages are
16953 received in one SMTP connection, <varname>$acl_m...</varname> values are not passed on from one
16954 message to the next, as <varname>$acl_c...</varname> values are. The <varname>$acl_m...</varname> variables are
16955 also reset by MAIL, RSET, EHLO, HELO, and after starting a TLS session. When a
16956 message is received, the values of these variables are saved with the message,
16957 and can be accessed by filters, routers, and transports during subsequent
16958 delivery.
16959 </para>
16960 </listitem></varlistentry>
16961 <varlistentry>
16962 <term><varname>$acl_narg</varname></term>
16963 <listitem>
16964 <para>
16965 Within an acl condition, expansion condition or expansion item
16966 this variable has the number of arguments.
16967 </para>
16968 </listitem></varlistentry>
16969 <varlistentry>
16970 <term><varname>$acl_verify_message</varname></term>
16971 <listitem>
16972 <para>
16973 <indexterm role="variable">
16974 <primary><varname>$acl_verify_message</varname></primary>
16975 </indexterm>
16976 After an address verification has failed, this variable contains the failure
16977 message. It retains its value for use in subsequent modifiers. The message can
16978 be preserved by coding like this:
16979 </para>
16980 <literallayout class="monospaced">
16981 warn !verify = sender
16982      set acl_m0 = $acl_verify_message
16983 </literallayout>
16984 <para>
16985 You can use <varname>$acl_verify_message</varname> during the expansion of the <option>message</option> or
16986 <option>log_message</option> modifiers, to include information about the verification
16987 failure.
16988 </para>
16989 </listitem></varlistentry>
16990 <varlistentry>
16991 <term><varname>$address_data</varname></term>
16992 <listitem>
16993 <para>
16994 <indexterm role="variable">
16995 <primary><varname>$address_data</varname></primary>
16996 </indexterm>
16997 This variable is set by means of the <option>address_data</option> option in routers. The
16998 value then remains with the address while it is processed by subsequent routers
16999 and eventually a transport. If the transport is handling multiple addresses,
17000 the value from the first address is used. See chapter <xref linkend="CHAProutergeneric"/>
17001 for more details. <emphasis role="bold">Note</emphasis>: The contents of <varname>$address_data</varname> are visible in
17002 user filter files.
17003 </para>
17004 <para>
17005 If <varname>$address_data</varname> is set when the routers are called from an ACL to verify
17006 a recipient address, the final value is still in the variable for subsequent
17007 conditions and modifiers of the ACL statement. If routing the address caused it
17008 to be redirected to just one address, the child address is also routed as part
17009 of the verification, and in this case the final value of <varname>$address_data</varname> is
17010 from the child&#x2019;s routing.
17011 </para>
17012 <para>
17013 If <varname>$address_data</varname> is set when the routers are called from an ACL to verify a
17014 sender address, the final value is also preserved, but this time in
17015 <varname>$sender_address_data</varname>, to distinguish it from data from a recipient
17016 address.
17017 </para>
17018 <para>
17019 In both cases (recipient and sender verification), the value does not persist
17020 after the end of the current ACL statement. If you want to preserve
17021 these values for longer, you can save them in ACL variables.
17022 </para>
17023 </listitem></varlistentry>
17024 <varlistentry>
17025 <term><varname>$address_file</varname></term>
17026 <listitem>
17027 <para>
17028 <indexterm role="variable">
17029 <primary><varname>$address_file</varname></primary>
17030 </indexterm>
17031 When, as a result of aliasing, forwarding, or filtering, a message is directed
17032 to a specific file, this variable holds the name of the file when the transport
17033 is running. At other times, the variable is empty. For example, using the
17034 default configuration, if user <option>r2d2</option> has a <filename>.forward</filename> file containing
17035 </para>
17036 <literallayout class="monospaced">
17037 /home/r2d2/savemail
17038 </literallayout>
17039 <para>
17040 then when the <command>address_file</command> transport is running, <varname>$address_file</varname>
17041 contains the text string <literal>/home/r2d2/savemail</literal>.
17042 <indexterm role="concept">
17043 <primary>Sieve filter</primary>
17044 <secondary>value of <varname>$address_file</varname></secondary>
17045 </indexterm>
17046 For Sieve filters, the value may be <quote>inbox</quote> or a relative folder name. It is
17047 then up to the transport configuration to generate an appropriate absolute path
17048 to the relevant file.
17049 </para>
17050 </listitem></varlistentry>
17051 <varlistentry>
17052 <term><varname>$address_pipe</varname></term>
17053 <listitem>
17054 <para>
17055 <indexterm role="variable">
17056 <primary><varname>$address_pipe</varname></primary>
17057 </indexterm>
17058 When, as a result of aliasing or forwarding, a message is directed to a pipe,
17059 this variable holds the pipe command when the transport is running.
17060 </para>
17061 </listitem></varlistentry>
17062 <varlistentry>
17063 <term><varname>$auth1</varname> &ndash; <varname>$auth3</varname></term>
17064 <listitem>
17065 <para>
17066 <indexterm role="variable">
17067 <primary><varname>$auth1</varname>, <varname>$auth2</varname>, etc</primary>
17068 </indexterm>
17069 These variables are used in SMTP authenticators (see chapters
17070 <xref linkend="CHAPplaintext"/>&ndash;<xref linkend="CHAPspa"/>). Elsewhere, they are empty.
17071 </para>
17072 </listitem></varlistentry>
17073 <varlistentry>
17074 <term><varname>$authenticated_id</varname></term>
17075 <listitem>
17076 <para>
17077 <indexterm role="concept">
17078 <primary>authentication</primary>
17079 <secondary>id</secondary>
17080 </indexterm>
17081 <indexterm role="variable">
17082 <primary><varname>$authenticated_id</varname></primary>
17083 </indexterm>
17084 When a server successfully authenticates a client it may be configured to
17085 preserve some of the authentication information in the variable
17086 <varname>$authenticated_id</varname> (see chapter <xref linkend="CHAPSMTPAUTH"/>). For example, a
17087 user/password authenticator configuration might preserve the user name for use
17088 in the routers. Note that this is not the same information that is saved in
17089 <varname>$sender_host_authenticated</varname>.
17090 When a message is submitted locally (that is, not over a TCP connection)
17091 the value of <varname>$authenticated_id</varname> is normally the login name of the calling
17092 process. However, a trusted user can override this by means of the <option>-oMai</option>
17093 command line option.
17094 </para>
17095 </listitem></varlistentry>
17096 <varlistentry>
17097 <term><varname>$authenticated_fail_id</varname></term>
17098 <listitem>
17099 <para>
17100 <indexterm role="concept">
17101 <primary>authentication</primary>
17102 <secondary>fail</secondary>
17103 </indexterm>
17104 <indexterm role="variable">
17105 <primary><varname>$authenticated_fail_id</varname></primary>
17106 </indexterm>
17107 When an authentication attempt fails, the variable <varname>$authenticated_fail_id</varname>
17108 will contain the failed authentication id. If more than one authentication
17109 id is attempted, it will contain only the last one. The variable is
17110 available for processing in the ACL&#x2019;s, generally the quit or notquit ACL.
17111 A message to a local recipient could still be accepted without requiring
17112 authentication, which means this variable could also be visible in all of
17113 the ACL&#x2019;s as well.
17114 </para>
17115 </listitem></varlistentry>
17116 <varlistentry>
17117 <term><varname>$authenticated_sender</varname></term>
17118 <listitem>
17119 <para>
17120 <indexterm role="concept">
17121 <primary>sender</primary>
17122 <secondary>authenticated</secondary>
17123 </indexterm>
17124 <indexterm role="concept">
17125 <primary>authentication</primary>
17126 <secondary>sender</secondary>
17127 </indexterm>
17128 <indexterm role="concept">
17129 <primary>AUTH</primary>
17130 <secondary>on MAIL command</secondary>
17131 </indexterm>
17132 <indexterm role="variable">
17133 <primary><varname>$authenticated_sender</varname></primary>
17134 </indexterm>
17135 When acting as a server, Exim takes note of the AUTH= parameter on an incoming
17136 SMTP MAIL command if it believes the sender is sufficiently trusted, as
17137 described in section <xref linkend="SECTauthparamail"/>. Unless the data is the string
17138 <quote>&lt;&gt;</quote>, it is set as the authenticated sender of the message, and the value is
17139 available during delivery in the <varname>$authenticated_sender</varname> variable. If the
17140 sender is not trusted, Exim accepts the syntax of AUTH=, but ignores the data.
17141 </para>
17142 <para>
17143 <indexterm role="variable">
17144 <primary><varname>$qualify_domain</varname></primary>
17145 </indexterm>
17146 When a message is submitted locally (that is, not over a TCP connection), the
17147 value of <varname>$authenticated_sender</varname> is an address constructed from the login
17148 name of the calling process and <varname>$qualify_domain</varname>, except that a trusted user
17149 can override this by means of the <option>-oMas</option> command line option.
17150 </para>
17151 </listitem></varlistentry>
17152 <varlistentry>
17153 <term><varname>$authentication_failed</varname></term>
17154 <listitem>
17155 <para>
17156 <indexterm role="concept">
17157 <primary>authentication</primary>
17158 <secondary>failure</secondary>
17159 </indexterm>
17160 <indexterm role="variable">
17161 <primary><varname>$authentication_failed</varname></primary>
17162 </indexterm>
17163 This variable is set to <quote>1</quote> in an Exim server if a client issues an AUTH
17164 command that does not succeed. Otherwise it is set to <quote>0</quote>. This makes it
17165 possible to distinguish between <quote>did not try to authenticate</quote>
17166 (<varname>$sender_host_authenticated</varname> is empty and <varname>$authentication_failed</varname> is set to
17167 <quote>0</quote>) and <quote>tried to authenticate but failed</quote> (<varname>$sender_host_authenticated</varname>
17168 is empty and <varname>$authentication_failed</varname> is set to <quote>1</quote>). Failure includes any
17169 negative response to an AUTH command, including (for example) an attempt to use
17170 an undefined mechanism.
17171 </para>
17172 </listitem></varlistentry>
17173 <varlistentry>
17174 <term><varname>$av_failed</varname></term>
17175 <listitem>
17176 <para>
17177 <indexterm role="concept">
17178 <primary>content scanning</primary>
17179 <secondary>AV scanner failure</secondary>
17180 </indexterm>
17181 This variable is available when Exim is compiled with the content-scanning
17182 extension. It is set to <quote>0</quote> by default, but will be set to <quote>1</quote> if any
17183 problem occurs with the virus scanner (specified by <option>av_scanner</option>) during
17184 the ACL malware condition.
17185 </para>
17186 </listitem></varlistentry>
17187 <varlistentry>
17188 <term><varname>$body_linecount</varname></term>
17189 <listitem>
17190 <para>
17191 <indexterm role="concept">
17192 <primary>message body</primary>
17193 <secondary>line count</secondary>
17194 </indexterm>
17195 <indexterm role="concept">
17196 <primary>body of message</primary>
17197 <secondary>line count</secondary>
17198 </indexterm>
17199 <indexterm role="variable">
17200 <primary><varname>$body_linecount</varname></primary>
17201 </indexterm>
17202 When a message is being received or delivered, this variable contains the
17203 number of lines in the message&#x2019;s body. See also <varname>$message_linecount</varname>.
17204 </para>
17205 </listitem></varlistentry>
17206 <varlistentry>
17207 <term><varname>$body_zerocount</varname></term>
17208 <listitem>
17209 <para>
17210 <indexterm role="concept">
17211 <primary>message body</primary>
17212 <secondary>binary zero count</secondary>
17213 </indexterm>
17214 <indexterm role="concept">
17215 <primary>body of message</primary>
17216 <secondary>binary zero count</secondary>
17217 </indexterm>
17218 <indexterm role="concept">
17219 <primary>binary zero</primary>
17220 <secondary>in message body</secondary>
17221 </indexterm>
17222 <indexterm role="variable">
17223 <primary><varname>$body_zerocount</varname></primary>
17224 </indexterm>
17225 When a message is being received or delivered, this variable contains the
17226 number of binary zero bytes (ASCII NULs) in the message&#x2019;s body.
17227 </para>
17228 </listitem></varlistentry>
17229 <varlistentry>
17230 <term><varname>$bounce_recipient</varname></term>
17231 <listitem>
17232 <para>
17233 <indexterm role="variable">
17234 <primary><varname>$bounce_recipient</varname></primary>
17235 </indexterm>
17236 This is set to the recipient address of a bounce message while Exim is creating
17237 it. It is useful if a customized bounce message text file is in use (see
17238 chapter <xref linkend="CHAPemsgcust"/>).
17239 </para>
17240 </listitem></varlistentry>
17241 <varlistentry>
17242 <term><varname>$bounce_return_size_limit</varname></term>
17243 <listitem>
17244 <para>
17245 <indexterm role="variable">
17246 <primary><varname>$bounce_return_size_limit</varname></primary>
17247 </indexterm>
17248 This contains the value set in the <option>bounce_return_size_limit</option> option, rounded
17249 up to a multiple of 1000. It is useful when a customized error message text
17250 file is in use (see chapter <xref linkend="CHAPemsgcust"/>).
17251 </para>
17252 </listitem></varlistentry>
17253 <varlistentry>
17254 <term><varname>$caller_gid</varname></term>
17255 <listitem>
17256 <para>
17257 <indexterm role="concept">
17258 <primary>gid (group id)</primary>
17259 <secondary>caller</secondary>
17260 </indexterm>
17261 <indexterm role="variable">
17262 <primary><varname>$caller_gid</varname></primary>
17263 </indexterm>
17264 The real group id under which the process that called Exim was running. This is
17265 not the same as the group id of the originator of a message (see
17266 <varname>$originator_gid</varname>). If Exim re-execs itself, this variable in the new
17267 incarnation normally contains the Exim gid.
17268 </para>
17269 </listitem></varlistentry>
17270 <varlistentry>
17271 <term><varname>$caller_uid</varname></term>
17272 <listitem>
17273 <para>
17274 <indexterm role="concept">
17275 <primary>uid (user id)</primary>
17276 <secondary>caller</secondary>
17277 </indexterm>
17278 <indexterm role="variable">
17279 <primary><varname>$caller_uid</varname></primary>
17280 </indexterm>
17281 The real user id under which the process that called Exim was running. This is
17282 not the same as the user id of the originator of a message (see
17283 <varname>$originator_uid</varname>). If Exim re-execs itself, this variable in the new
17284 incarnation normally contains the Exim uid.
17285 </para>
17286 </listitem></varlistentry>
17287 <varlistentry>
17288 <term><varname>$compile_date</varname></term>
17289 <listitem>
17290 <para>
17291 <indexterm role="variable">
17292 <primary><varname>$compile_date</varname></primary>
17293 </indexterm>
17294 The date on which the Exim binary was compiled.
17295 </para>
17296 </listitem></varlistentry>
17297 <varlistentry>
17298 <term><varname>$compile_number</varname></term>
17299 <listitem>
17300 <para>
17301 <indexterm role="variable">
17302 <primary><varname>$compile_number</varname></primary>
17303 </indexterm>
17304 The building process for Exim keeps a count of the number
17305 of times it has been compiled. This serves to distinguish different
17306 compilations of the same version of the program.
17307 </para>
17308 </listitem></varlistentry>
17309 <varlistentry revisionflag="changed">
17310 <term><varname>$config_dir</varname></term>
17311 <listitem>
17312 <para revisionflag="changed">
17313 <indexterm role="variable">
17314 <primary><varname>$config_dir</varname></primary>
17315 </indexterm>
17316 The directory name of the main configuration file. That is, the content of
17317 <varname>$config_file</varname> with the last component stripped. The value does not
17318 contain the trailing slash. If <varname>$config_file</varname> does not contain a slash,
17319 <varname>$config_dir</varname> is ".".
17320 </para>
17321 </listitem></varlistentry>
17322 <varlistentry revisionflag="changed">
17323 <term><varname>$config_file</varname></term>
17324 <listitem>
17325 <para revisionflag="changed">
17326 <indexterm role="variable">
17327 <primary><varname>$config_file</varname></primary>
17328 </indexterm>
17329 The name of the main configuration file Exim is using.
17330 </para>
17331 </listitem></varlistentry>
17332 <varlistentry>
17333 <term><varname>$demime_errorlevel</varname></term>
17334 <listitem>
17335 <para>
17336 <indexterm role="variable">
17337 <primary><varname>$demime_errorlevel</varname></primary>
17338 </indexterm>
17339 This variable is available when Exim is compiled with
17340 the content-scanning extension and the obsolete <option>demime</option> condition. For
17341 details, see section <xref linkend="SECTdemimecond"/>.
17342 </para>
17343 </listitem></varlistentry>
17344 <varlistentry>
17345 <term><varname>$demime_reason</varname></term>
17346 <listitem>
17347 <para>
17348 <indexterm role="variable">
17349 <primary><varname>$demime_reason</varname></primary>
17350 </indexterm>
17351 This variable is available when Exim is compiled with the
17352 content-scanning extension and the obsolete <option>demime</option> condition. For details,
17353 see section <xref linkend="SECTdemimecond"/>.
17354 </para>
17355 </listitem></varlistentry>
17356 <varlistentry revisionflag="changed">
17357 <term><varname>$dkim_cur_signer</varname></term>
17358 <term><varname>$dkim_verify_status</varname></term>
17359 <term><varname>$dkim_verify_reason</varname></term>
17360 <term><varname>$dkim_domain</varname></term>
17361 <term><varname>$dkim_identity</varname></term>
17362 <term><varname>$dkim_selector</varname></term>
17363 <term><varname>$dkim_algo</varname></term>
17364 <term><varname>$dkim_canon_body</varname></term>
17365 <term><varname>$dkim_canon_headers</varname></term>
17366 <term><varname>$dkim_copiedheaders</varname></term>
17367 <term><varname>$dkim_bodylength</varname></term>
17368 <term><varname>$dkim_created</varname></term>
17369 <term><varname>$dkim_expires</varname></term>
17370 <term><varname>$dkim_headernames</varname></term>
17371 <term><varname>$dkim_key_testing</varname></term>
17372 <term><varname>$dkim_key_nosubdomains</varname></term>
17373 <term><varname>$dkim_key_srvtype</varname></term>
17374 <term><varname>$dkim_key_granularity</varname></term>
17375 <term><varname>$dkim_key_notes</varname></term>
17376 <listitem>
17377 <para revisionflag="changed">
17378 These variables are only available within the DKIM ACL.
17379 For details see chapter <xref linkend="CHAPdkim"/>.
17380 </para>
17381 </listitem></varlistentry>
17382 <varlistentry revisionflag="changed">
17383 <term><varname>$dkim_signers</varname></term>
17384 <listitem>
17385 <para revisionflag="changed">
17386 <indexterm role="variable">
17387 <primary><varname>$dkim_signers</varname></primary>
17388 </indexterm>
17389 When a message has been received this variable contains
17390 a colon-separated list of signer domains and identities for the message.
17391 For details see chapter <xref linkend="CHAPdkim"/>.
17392 </para>
17393 </listitem></varlistentry>
17394 <varlistentry>
17395 <term><varname>$dnslist_domain</varname></term>
17396 <term><varname>$dnslist_matched</varname></term>
17397 <term><varname>$dnslist_text</varname></term>
17398 <term><varname>$dnslist_value</varname></term>
17399 <listitem>
17400 <para>
17401 <indexterm role="variable">
17402 <primary><varname>$dnslist_domain</varname></primary>
17403 </indexterm>
17404 <indexterm role="variable">
17405 <primary><varname>$dnslist_matched</varname></primary>
17406 </indexterm>
17407 <indexterm role="variable">
17408 <primary><varname>$dnslist_text</varname></primary>
17409 </indexterm>
17410 <indexterm role="variable">
17411 <primary><varname>$dnslist_value</varname></primary>
17412 </indexterm>
17413 <indexterm role="concept">
17414 <primary>black list (DNS)</primary>
17415 </indexterm>
17416 When a DNS (black) list lookup succeeds, these variables are set to contain
17417 the following data from the lookup: the list&#x2019;s domain name, the key that was
17418 looked up, the contents of any associated TXT record, and the value from the
17419 main A record. See section <xref linkend="SECID204"/> for more details.
17420 </para>
17421 </listitem></varlistentry>
17422 <varlistentry>
17423 <term><varname>$domain</varname></term>
17424 <listitem>
17425 <para>
17426 <indexterm role="variable">
17427 <primary><varname>$domain</varname></primary>
17428 </indexterm>
17429 When an address is being routed, or delivered on its own, this variable
17430 contains the domain. Uppercase letters in the domain are converted into lower
17431 case for <varname>$domain</varname>.
17432 </para>
17433 <para>
17434 Global address rewriting happens when a message is received, so the value of
17435 <varname>$domain</varname> during routing and delivery is the value after rewriting. <varname>$domain</varname>
17436 is set during user filtering, but not during system filtering, because a
17437 message may have many recipients and the system filter is called just once.
17438 </para>
17439 <para>
17440 When more than one address is being delivered at once (for example, several
17441 RCPT commands in one SMTP delivery), <varname>$domain</varname> is set only if they all
17442 have the same domain. Transports can be restricted to handling only one domain
17443 at a time if the value of <varname>$domain</varname> is required at transport time &ndash; this is
17444 the default for local transports. For further details of the environment in
17445 which local transports are run, see chapter <xref linkend="CHAPenvironment"/>.
17446 </para>
17447 <para>
17448 <indexterm role="option">
17449 <primary><option>delay_warning_condition</option></primary>
17450 </indexterm>
17451 At the end of a delivery, if all deferred addresses have the same domain, it is
17452 set in <varname>$domain</varname> during the expansion of <option>delay_warning_condition</option>.
17453 </para>
17454 <para>
17455 The <varname>$domain</varname> variable is also used in some other circumstances:
17456 </para>
17457 <itemizedlist>
17458 <listitem>
17459 <para>
17460 When an ACL is running for a RCPT command, <varname>$domain</varname> contains the domain of
17461 the recipient address. The domain of the <emphasis>sender</emphasis> address is in
17462 <varname>$sender_address_domain</varname> at both MAIL time and at RCPT time. <varname>$domain</varname> is not
17463 normally set during the running of the MAIL ACL. However, if the sender address
17464 is verified with a callout during the MAIL ACL, the sender domain is placed in
17465 <varname>$domain</varname> during the expansions of <option>hosts</option>, <option>interface</option>, and <option>port</option> in
17466 the <command>smtp</command> transport.
17467 </para>
17468 </listitem>
17469 <listitem>
17470 <para>
17471 When a rewrite item is being processed (see chapter <xref linkend="CHAPrewrite"/>),
17472 <varname>$domain</varname> contains the domain portion of the address that is being rewritten;
17473 it can be used in the expansion of the replacement address, for example, to
17474 rewrite domains by file lookup.
17475 </para>
17476 </listitem>
17477 <listitem>
17478 <para>
17479 With one important exception, whenever a domain list is being scanned,
17480 <varname>$domain</varname> contains the subject domain. <emphasis role="bold">Exception</emphasis>: When a domain list in
17481 a <option>sender_domains</option> condition in an ACL is being processed, the subject domain
17482 is in <varname>$sender_address_domain</varname> and not in <varname>$domain</varname>. It works this way so
17483 that, in a RCPT ACL, the sender domain list can be dependent on the
17484 recipient domain (which is what is in <varname>$domain</varname> at this time).
17485 </para>
17486 </listitem>
17487 <listitem>
17488 <para>
17489 <indexterm role="concept">
17490 <primary>ETRN</primary>
17491 <secondary>value of <varname>$domain</varname></secondary>
17492 </indexterm>
17493 <indexterm role="option">
17494 <primary><option>smtp_etrn_command</option></primary>
17495 </indexterm>
17496 When the <option>smtp_etrn_command</option> option is being expanded, <varname>$domain</varname> contains
17497 the complete argument of the ETRN command (see section <xref linkend="SECTETRN"/>).
17498 </para>
17499 </listitem>
17500 </itemizedlist>
17501 </listitem></varlistentry>
17502 <varlistentry>
17503 <term><varname>$domain_data</varname></term>
17504 <listitem>
17505 <para>
17506 <indexterm role="variable">
17507 <primary><varname>$domain_data</varname></primary>
17508 </indexterm>
17509 When the <option>domains</option> option on a router matches a domain by
17510 means of a lookup, the data read by the lookup is available during the running
17511 of the router as <varname>$domain_data</varname>. In addition, if the driver routes the
17512 address to a transport, the value is available in that transport. If the
17513 transport is handling multiple addresses, the value from the first address is
17514 used.
17515 </para>
17516 <para>
17517 <varname>$domain_data</varname> is also set when the <option>domains</option> condition in an ACL matches a
17518 domain by means of a lookup. The data read by the lookup is available during
17519 the rest of the ACL statement. In all other situations, this variable expands
17520 to nothing.
17521 </para>
17522 </listitem></varlistentry>
17523 <varlistentry>
17524 <term><varname>$exim_gid</varname></term>
17525 <listitem>
17526 <para>
17527 <indexterm role="variable">
17528 <primary><varname>$exim_gid</varname></primary>
17529 </indexterm>
17530 This variable contains the numerical value of the Exim group id.
17531 </para>
17532 </listitem></varlistentry>
17533 <varlistentry>
17534 <term><varname>$exim_path</varname></term>
17535 <listitem>
17536 <para>
17537 <indexterm role="variable">
17538 <primary><varname>$exim_path</varname></primary>
17539 </indexterm>
17540 This variable contains the path to the Exim binary.
17541 </para>
17542 </listitem></varlistentry>
17543 <varlistentry>
17544 <term><varname>$exim_uid</varname></term>
17545 <listitem>
17546 <para>
17547 <indexterm role="variable">
17548 <primary><varname>$exim_uid</varname></primary>
17549 </indexterm>
17550 This variable contains the numerical value of the Exim user id.
17551 </para>
17552 </listitem></varlistentry>
17553 <varlistentry revisionflag="changed">
17554 <term><varname>$exim_version</varname></term>
17555 <listitem>
17556 <para revisionflag="changed">
17557 <indexterm role="variable">
17558 <primary><varname>$exim_version</varname></primary>
17559 </indexterm>
17560 This variable contains the version string of the Exim build.
17561 The first character is a major version number, currently 4.
17562 Then after a dot, the next group of digits is a minor version number.
17563 There may be other characters following the minor version.
17564 </para>
17565 </listitem></varlistentry>
17566 <varlistentry>
17567 <term><varname>$found_extension</varname></term>
17568 <listitem>
17569 <para>
17570 <indexterm role="variable">
17571 <primary><varname>$found_extension</varname></primary>
17572 </indexterm>
17573 This variable is available when Exim is compiled with the
17574 content-scanning extension and the obsolete <option>demime</option> condition. For details,
17575 see section <xref linkend="SECTdemimecond"/>.
17576 </para>
17577 </listitem></varlistentry>
17578 <varlistentry>
17579 <term><varname>$header_</varname>&lt;<emphasis>name</emphasis>&gt;</term>
17580 <listitem>
17581 <para>
17582 This is not strictly an expansion variable. It is expansion syntax for
17583 inserting the message header line with the given name. Note that the name must
17584 be terminated by colon or white space, because it may contain a wide variety of
17585 characters. Note also that braces must <emphasis>not</emphasis> be used.
17586 </para>
17587 </listitem></varlistentry>
17588 <varlistentry>
17589 <term><varname>$headers_added</varname></term>
17590 <listitem>
17591 <para>
17592 <indexterm role="variable">
17593 <primary><varname>$headers_added</varname></primary>
17594 </indexterm>
17595 Within an ACL this variable contains the headers added so far by
17596 the ACL modifier add_header (section <xref linkend="SECTaddheadacl"/>).
17597 The headers are a newline-separated list.
17598 </para>
17599 </listitem></varlistentry>
17600 <varlistentry>
17601 <term><varname>$home</varname></term>
17602 <listitem>
17603 <para>
17604 <indexterm role="variable">
17605 <primary><varname>$home</varname></primary>
17606 </indexterm>
17607 When the <option>check_local_user</option> option is set for a router, the user&#x2019;s home
17608 directory is placed in <varname>$home</varname> when the check succeeds. In particular, this
17609 means it is set during the running of users&#x2019; filter files. A router may also
17610 explicitly set a home directory for use by a transport; this can be overridden
17611 by a setting on the transport itself.
17612 </para>
17613 <para>
17614 When running a filter test via the <option>-bf</option> option, <varname>$home</varname> is set to the value
17615 of the environment variable HOME.
17616 </para>
17617 </listitem></varlistentry>
17618 <varlistentry>
17619 <term><varname>$host</varname></term>
17620 <listitem>
17621 <para>
17622 <indexterm role="variable">
17623 <primary><varname>$host</varname></primary>
17624 </indexterm>
17625 If a router assigns an address to a transport (any transport), and passes a
17626 list of hosts with the address, the value of <varname>$host</varname> when the transport starts
17627 to run is the name of the first host on the list. Note that this applies both
17628 to local and remote transports.
17629 </para>
17630 <para>
17631 <indexterm role="concept">
17632 <primary>transport</primary>
17633 <secondary>filter</secondary>
17634 </indexterm>
17635 <indexterm role="concept">
17636 <primary>filter</primary>
17637 <secondary>transport filter</secondary>
17638 </indexterm>
17639 For the <command>smtp</command> transport, if there is more than one host, the value of
17640 <varname>$host</varname> changes as the transport works its way through the list. In
17641 particular, when the <command>smtp</command> transport is expanding its options for encryption
17642 using TLS, or for specifying a transport filter (see chapter
17643 <xref linkend="CHAPtransportgeneric"/>), <varname>$host</varname> contains the name of the host to which it
17644 is connected.
17645 </para>
17646 <para>
17647 When used in the client part of an authenticator configuration (see chapter
17648 <xref linkend="CHAPSMTPAUTH"/>), <varname>$host</varname> contains the name of the server to which the
17649 client is connected.
17650 </para>
17651 </listitem></varlistentry>
17652 <varlistentry>
17653 <term><varname>$host_address</varname></term>
17654 <listitem>
17655 <para>
17656 <indexterm role="variable">
17657 <primary><varname>$host_address</varname></primary>
17658 </indexterm>
17659 This variable is set to the remote host&#x2019;s IP address whenever <varname>$host</varname> is set
17660 for a remote connection. It is also set to the IP address that is being checked
17661 when the <option>ignore_target_hosts</option> option is being processed.
17662 </para>
17663 </listitem></varlistentry>
17664 <varlistentry>
17665 <term><varname>$host_data</varname></term>
17666 <listitem>
17667 <para>
17668 <indexterm role="variable">
17669 <primary><varname>$host_data</varname></primary>
17670 </indexterm>
17671 If a <option>hosts</option> condition in an ACL is satisfied by means of a lookup, the
17672 result of the lookup is made available in the <varname>$host_data</varname> variable. This
17673 allows you, for example, to do things like this:
17674 </para>
17675 <literallayout class="monospaced">
17676 deny  hosts = net-lsearch;/some/file
17677 message = $host_data
17678 </literallayout>
17679 </listitem></varlistentry>
17680 <varlistentry>
17681 <term><varname>$host_lookup_deferred</varname></term>
17682 <listitem>
17683 <para>
17684 <indexterm role="concept">
17685 <primary>host name</primary>
17686 <secondary>lookup, failure of</secondary>
17687 </indexterm>
17688 <indexterm role="variable">
17689 <primary><varname>$host_lookup_deferred</varname></primary>
17690 </indexterm>
17691 This variable normally contains <quote>0</quote>, as does <varname>$host_lookup_failed</varname>. When a
17692 message comes from a remote host and there is an attempt to look up the host&#x2019;s
17693 name from its IP address, and the attempt is not successful, one of these
17694 variables is set to <quote>1</quote>.
17695 </para>
17696 <itemizedlist>
17697 <listitem>
17698 <para>
17699 If the lookup receives a definite negative response (for example, a DNS lookup
17700 succeeded, but no records were found), <varname>$host_lookup_failed</varname> is set to <quote>1</quote>.
17701 </para>
17702 </listitem>
17703 <listitem>
17704 <para>
17705 If there is any kind of problem during the lookup, such that Exim cannot
17706 tell whether or not the host name is defined (for example, a timeout for a DNS
17707 lookup), <varname>$host_lookup_deferred</varname> is set to <quote>1</quote>.
17708 </para>
17709 </listitem>
17710 </itemizedlist>
17711 <para>
17712 Looking up a host&#x2019;s name from its IP address consists of more than just a
17713 single reverse lookup. Exim checks that a forward lookup of at least one of the
17714 names it receives from a reverse lookup yields the original IP address. If this
17715 is not the case, Exim does not accept the looked up name(s), and
17716 <varname>$host_lookup_failed</varname> is set to <quote>1</quote>. Thus, being able to find a name from an
17717 IP address (for example, the existence of a PTR record in the DNS) is not
17718 sufficient on its own for the success of a host name lookup. If the reverse
17719 lookup succeeds, but there is a lookup problem such as a timeout when checking
17720 the result, the name is not accepted, and <varname>$host_lookup_deferred</varname> is set to
17721 <quote>1</quote>. See also <varname>$sender_host_name</varname>.
17722 </para>
17723 </listitem></varlistentry>
17724 <varlistentry>
17725 <term><varname>$host_lookup_failed</varname></term>
17726 <listitem>
17727 <para>
17728 <indexterm role="variable">
17729 <primary><varname>$host_lookup_failed</varname></primary>
17730 </indexterm>
17731 See <varname>$host_lookup_deferred</varname>.
17732 </para>
17733 </listitem></varlistentry>
17734 <varlistentry>
17735 <term><varname>$host_port</varname></term>
17736 <listitem>
17737 <para>
17738 <indexterm role="variable">
17739 <primary><varname>$host_port</varname></primary>
17740 </indexterm>
17741 This variable is set to the remote host&#x2019;s TCP port whenever <varname>$host</varname> is set
17742 for an outbound connection.
17743 </para>
17744 </listitem></varlistentry>
17745 <varlistentry>
17746 <term><varname>$inode</varname></term>
17747 <listitem>
17748 <para>
17749 <indexterm role="variable">
17750 <primary><varname>$inode</varname></primary>
17751 </indexterm>
17752 The only time this variable is set is while expanding the <option>directory_file</option>
17753 option in the <command>appendfile</command> transport. The variable contains the inode number
17754 of the temporary file which is about to be renamed. It can be used to construct
17755 a unique name for the file.
17756 </para>
17757 </listitem></varlistentry>
17758 <varlistentry>
17759 <term><varname>$interface_address</varname></term>
17760 <listitem>
17761 <para>
17762 <indexterm role="variable">
17763 <primary><varname>$interface_address</varname></primary>
17764 </indexterm>
17765 This is an obsolete name for <varname>$received_ip_address</varname>.
17766 </para>
17767 </listitem></varlistentry>
17768 <varlistentry>
17769 <term><varname>$interface_port</varname></term>
17770 <listitem>
17771 <para>
17772 <indexterm role="variable">
17773 <primary><varname>$interface_port</varname></primary>
17774 </indexterm>
17775 This is an obsolete name for <varname>$received_port</varname>.
17776 </para>
17777 </listitem></varlistentry>
17778 <varlistentry>
17779 <term><varname>$item</varname></term>
17780 <listitem>
17781 <para>
17782 <indexterm role="variable">
17783 <primary><varname>$item</varname></primary>
17784 </indexterm>
17785 This variable is used during the expansion of <emphasis role="bold">forall</emphasis> and <emphasis role="bold">forany</emphasis>
17786 conditions (see section <xref linkend="SECTexpcond"/>), and <emphasis role="bold">filter</emphasis>, <emphasis role="bold">map</emphasis>, and
17787 <emphasis role="bold">reduce</emphasis> items (see section <xref linkend="SECTexpcond"/>). In other circumstances, it is
17788 empty.
17789 </para>
17790 </listitem></varlistentry>
17791 <varlistentry>
17792 <term><varname>$ldap_dn</varname></term>
17793 <listitem>
17794 <para>
17795 <indexterm role="variable">
17796 <primary><varname>$ldap_dn</varname></primary>
17797 </indexterm>
17798 This variable, which is available only when Exim is compiled with LDAP support,
17799 contains the DN from the last entry in the most recently successful LDAP
17800 lookup.
17801 </para>
17802 </listitem></varlistentry>
17803 <varlistentry>
17804 <term><varname>$load_average</varname></term>
17805 <listitem>
17806 <para>
17807 <indexterm role="variable">
17808 <primary><varname>$load_average</varname></primary>
17809 </indexterm>
17810 This variable contains the system load average, multiplied by 1000 so that it
17811 is an integer. For example, if the load average is 0.21, the value of the
17812 variable is 210. The value is recomputed every time the variable is referenced.
17813 </para>
17814 </listitem></varlistentry>
17815 <varlistentry>
17816 <term><varname>$local_part</varname></term>
17817 <listitem>
17818 <para>
17819 <indexterm role="variable">
17820 <primary><varname>$local_part</varname></primary>
17821 </indexterm>
17822 When an address is being routed, or delivered on its own, this
17823 variable contains the local part. When a number of addresses are being
17824 delivered together (for example, multiple RCPT commands in an SMTP
17825 session), <varname>$local_part</varname> is not set.
17826 </para>
17827 <para>
17828 Global address rewriting happens when a message is received, so the value of
17829 <varname>$local_part</varname> during routing and delivery is the value after rewriting.
17830 <varname>$local_part</varname> is set during user filtering, but not during system filtering,
17831 because a message may have many recipients and the system filter is called just
17832 once.
17833 </para>
17834 <para>
17835 <indexterm role="variable">
17836 <primary><varname>$local_part_prefix</varname></primary>
17837 </indexterm>
17838 <indexterm role="variable">
17839 <primary><varname>$local_part_suffix</varname></primary>
17840 </indexterm>
17841 If a local part prefix or suffix has been recognized, it is not included in the
17842 value of <varname>$local_part</varname> during routing and subsequent delivery. The values of
17843 any prefix or suffix are in <varname>$local_part_prefix</varname> and
17844 <varname>$local_part_suffix</varname>, respectively.
17845 </para>
17846 <para>
17847 When a message is being delivered to a file, pipe, or autoreply transport as a
17848 result of aliasing or forwarding, <varname>$local_part</varname> is set to the local part of
17849 the parent address, not to the file name or command (see <varname>$address_file</varname> and
17850 <varname>$address_pipe</varname>).
17851 </para>
17852 <para>
17853 When an ACL is running for a RCPT command, <varname>$local_part</varname> contains the
17854 local part of the recipient address.
17855 </para>
17856 <para>
17857 When a rewrite item is being processed (see chapter <xref linkend="CHAPrewrite"/>),
17858 <varname>$local_part</varname> contains the local part of the address that is being rewritten;
17859 it can be used in the expansion of the replacement address, for example.
17860 </para>
17861 <para>
17862 In all cases, all quoting is removed from the local part. For example, for both
17863 the addresses
17864 </para>
17865 <literallayout class="monospaced">
17866 "abc:xyz"@test.example
17867 abc\:xyz@test.example
17868 </literallayout>
17869 <para>
17870 the value of <varname>$local_part</varname> is
17871 </para>
17872 <literallayout class="monospaced">
17873 abc:xyz
17874 </literallayout>
17875 <para>
17876 If you use <varname>$local_part</varname> to create another address, you should always wrap it
17877 inside a quoting operator. For example, in a <command>redirect</command> router you could
17878 have:
17879 </para>
17880 <literallayout class="monospaced">
17881 data = ${quote_local_part:$local_part}@new.domain.example
17882 </literallayout>
17883 <para>
17884 <emphasis role="bold">Note</emphasis>: The value of <varname>$local_part</varname> is normally lower cased. If you want
17885 to process local parts in a case-dependent manner in a router, you can set the
17886 <option>caseful_local_part</option> option (see chapter <xref linkend="CHAProutergeneric"/>).
17887 </para>
17888 </listitem></varlistentry>
17889 <varlistentry>
17890 <term><varname>$local_part_data</varname></term>
17891 <listitem>
17892 <para>
17893 <indexterm role="variable">
17894 <primary><varname>$local_part_data</varname></primary>
17895 </indexterm>
17896 When the <option>local_parts</option> option on a router matches a local part by means of a
17897 lookup, the data read by the lookup is available during the running of the
17898 router as <varname>$local_part_data</varname>. In addition, if the driver routes the address
17899 to a transport, the value is available in that transport. If the transport is
17900 handling multiple addresses, the value from the first address is used.
17901 </para>
17902 <para>
17903 <varname>$local_part_data</varname> is also set when the <option>local_parts</option> condition in an ACL
17904 matches a local part by means of a lookup. The data read by the lookup is
17905 available during the rest of the ACL statement. In all other situations, this
17906 variable expands to nothing.
17907 </para>
17908 </listitem></varlistentry>
17909 <varlistentry>
17910 <term><varname>$local_part_prefix</varname></term>
17911 <listitem>
17912 <para>
17913 <indexterm role="variable">
17914 <primary><varname>$local_part_prefix</varname></primary>
17915 </indexterm>
17916 When an address is being routed or delivered, and a
17917 specific prefix for the local part was recognized, it is available in this
17918 variable, having been removed from <varname>$local_part</varname>.
17919 </para>
17920 </listitem></varlistentry>
17921 <varlistentry>
17922 <term><varname>$local_part_suffix</varname></term>
17923 <listitem>
17924 <para>
17925 <indexterm role="variable">
17926 <primary><varname>$local_part_suffix</varname></primary>
17927 </indexterm>
17928 When an address is being routed or delivered, and a
17929 specific suffix for the local part was recognized, it is available in this
17930 variable, having been removed from <varname>$local_part</varname>.
17931 </para>
17932 </listitem></varlistentry>
17933 <varlistentry>
17934 <term><varname>$local_scan_data</varname></term>
17935 <listitem>
17936 <para>
17937 <indexterm role="variable">
17938 <primary><varname>$local_scan_data</varname></primary>
17939 </indexterm>
17940 This variable contains the text returned by the <function>local_scan()</function> function when
17941 a message is received. See chapter <xref linkend="CHAPlocalscan"/> for more details.
17942 </para>
17943 </listitem></varlistentry>
17944 <varlistentry>
17945 <term><varname>$local_user_gid</varname></term>
17946 <listitem>
17947 <para>
17948 <indexterm role="variable">
17949 <primary><varname>$local_user_gid</varname></primary>
17950 </indexterm>
17951 See <varname>$local_user_uid</varname>.
17952 </para>
17953 </listitem></varlistentry>
17954 <varlistentry>
17955 <term><varname>$local_user_uid</varname></term>
17956 <listitem>
17957 <para>
17958 <indexterm role="variable">
17959 <primary><varname>$local_user_uid</varname></primary>
17960 </indexterm>
17961 This variable and <varname>$local_user_gid</varname> are set to the uid and gid after the
17962 <option>check_local_user</option> router precondition succeeds. This means that their values
17963 are available for the remaining preconditions (<option>senders</option>, <option>require_files</option>,
17964 and <option>condition</option>), for the <option>address_data</option> expansion, and for any
17965 router-specific expansions. At all other times, the values in these variables
17966 are <literal>(uid_t)(-1)</literal> and <literal>(gid_t)(-1)</literal>, respectively.
17967 </para>
17968 </listitem></varlistentry>
17969 <varlistentry>
17970 <term><varname>$localhost_number</varname></term>
17971 <listitem>
17972 <para>
17973 <indexterm role="variable">
17974 <primary><varname>$localhost_number</varname></primary>
17975 </indexterm>
17976 This contains the expanded value of the
17977 <option>localhost_number</option> option. The expansion happens after the main options have
17978 been read.
17979 </para>
17980 </listitem></varlistentry>
17981 <varlistentry>
17982 <term><varname>$log_inodes</varname></term>
17983 <listitem>
17984 <para>
17985 <indexterm role="variable">
17986 <primary><varname>$log_inodes</varname></primary>
17987 </indexterm>
17988 The number of free inodes in the disk partition where Exim&#x2019;s
17989 log files are being written. The value is recalculated whenever the variable is
17990 referenced. If the relevant file system does not have the concept of inodes,
17991 the value of is -1. See also the <option>check_log_inodes</option> option.
17992 </para>
17993 </listitem></varlistentry>
17994 <varlistentry>
17995 <term><varname>$log_space</varname></term>
17996 <listitem>
17997 <para>
17998 <indexterm role="variable">
17999 <primary><varname>$log_space</varname></primary>
18000 </indexterm>
18001 The amount of free space (as a number of kilobytes) in the disk
18002 partition where Exim&#x2019;s log files are being written. The value is recalculated
18003 whenever the variable is referenced. If the operating system does not have the
18004 ability to find the amount of free space (only true for experimental systems),
18005 the space value is -1. See also the <option>check_log_space</option> option.
18006 </para>
18007 </listitem></varlistentry>
18008 <varlistentry>
18009 <term><varname>$lookup_dnssec_authenticated</varname></term>
18010 <listitem>
18011 <para>
18012 <indexterm role="variable">
18013 <primary><varname>$lookup_dnssec_authenticated</varname></primary>
18014 </indexterm>
18015 This variable is set after a DNS lookup done by
18016 a dnsdb lookup expansion, dnslookup router or smtp transport.
18017 <indexterm role="concept">
18018 <primary>DNS</primary>
18019 <secondary>DNSSEC</secondary>
18020 </indexterm>
18021 It will be empty if <command>DNSSEC</command> was not requested,
18022 <quote>no</quote> if the result was not labelled as authenticated data
18023 and <quote>yes</quote> if it was.
18024 </para>
18025 <para revisionflag="changed">
18026 Results that are labelled as authoritative answer that match
18027 the <option>dns_trust_aa</option> configuration variable count also
18028 as authenticated data.
18029 </para>
18030 </listitem></varlistentry>
18031 <varlistentry>
18032 <term><varname>$mailstore_basename</varname></term>
18033 <listitem>
18034 <para>
18035 <indexterm role="variable">
18036 <primary><varname>$mailstore_basename</varname></primary>
18037 </indexterm>
18038 This variable is set only when doing deliveries in <quote>mailstore</quote> format in the
18039 <command>appendfile</command> transport. During the expansion of the <option>mailstore_prefix</option>,
18040 <option>mailstore_suffix</option>, <option>message_prefix</option>, and <option>message_suffix</option> options, it
18041 contains the basename of the files that are being written, that is, the name
18042 without the <quote>.tmp</quote>, <quote>.env</quote>, or <quote>.msg</quote> suffix. At all other times, this
18043 variable is empty.
18044 </para>
18045 </listitem></varlistentry>
18046 <varlistentry>
18047 <term><varname>$malware_name</varname></term>
18048 <listitem>
18049 <para>
18050 <indexterm role="variable">
18051 <primary><varname>$malware_name</varname></primary>
18052 </indexterm>
18053 This variable is available when Exim is compiled with the
18054 content-scanning extension. It is set to the name of the virus that was found
18055 when the ACL <option>malware</option> condition is true (see section <xref linkend="SECTscanvirus"/>).
18056 </para>
18057 </listitem></varlistentry>
18058 <varlistentry>
18059 <term><varname>$max_received_linelength</varname></term>
18060 <listitem>
18061 <para>
18062 <indexterm role="variable">
18063 <primary><varname>$max_received_linelength</varname></primary>
18064 </indexterm>
18065 <indexterm role="concept">
18066 <primary>maximum</primary>
18067 <secondary>line length</secondary>
18068 </indexterm>
18069 <indexterm role="concept">
18070 <primary>line length</primary>
18071 <secondary>maximum</secondary>
18072 </indexterm>
18073 This variable contains the number of bytes in the longest line that was
18074 received as part of the message, not counting the line termination
18075 character(s).
18076 </para>
18077 </listitem></varlistentry>
18078 <varlistentry>
18079 <term><varname>$message_age</varname></term>
18080 <listitem>
18081 <para>
18082 <indexterm role="concept">
18083 <primary>message</primary>
18084 <secondary>age of</secondary>
18085 </indexterm>
18086 <indexterm role="variable">
18087 <primary><varname>$message_age</varname></primary>
18088 </indexterm>
18089 This variable is set at the start of a delivery attempt to contain the number
18090 of seconds since the message was received. It does not change during a single
18091 delivery attempt.
18092 </para>
18093 </listitem></varlistentry>
18094 <varlistentry>
18095 <term><varname>$message_body</varname></term>
18096 <listitem>
18097 <para>
18098 <indexterm role="concept">
18099 <primary>body of message</primary>
18100 <secondary>expansion variable</secondary>
18101 </indexterm>
18102 <indexterm role="concept">
18103 <primary>message body</primary>
18104 <secondary>in expansion</secondary>
18105 </indexterm>
18106 <indexterm role="concept">
18107 <primary>binary zero</primary>
18108 <secondary>in message body</secondary>
18109 </indexterm>
18110 <indexterm role="variable">
18111 <primary><varname>$message_body</varname></primary>
18112 </indexterm>
18113 <indexterm role="option">
18114 <primary><option>message_body_visible</option></primary>
18115 </indexterm>
18116 This variable contains the initial portion of a message&#x2019;s body while it is
18117 being delivered, and is intended mainly for use in filter files. The maximum
18118 number of characters of the body that are put into the variable is set by the
18119 <option>message_body_visible</option> configuration option; the default is 500.
18120 </para>
18121 <para>
18122 <indexterm role="option">
18123 <primary><option>message_body_newlines</option></primary>
18124 </indexterm>
18125 By default, newlines are converted into spaces in <varname>$message_body</varname>, to make it
18126 easier to search for phrases that might be split over a line break. However,
18127 this can be disabled by setting <option>message_body_newlines</option> to be true. Binary
18128 zeros are always converted into spaces.
18129 </para>
18130 </listitem></varlistentry>
18131 <varlistentry>
18132 <term><varname>$message_body_end</varname></term>
18133 <listitem>
18134 <para>
18135 <indexterm role="concept">
18136 <primary>body of message</primary>
18137 <secondary>expansion variable</secondary>
18138 </indexterm>
18139 <indexterm role="concept">
18140 <primary>message body</primary>
18141 <secondary>in expansion</secondary>
18142 </indexterm>
18143 <indexterm role="variable">
18144 <primary><varname>$message_body_end</varname></primary>
18145 </indexterm>
18146 This variable contains the final portion of a message&#x2019;s
18147 body while it is being delivered. The format and maximum size are as for
18148 <varname>$message_body</varname>.
18149 </para>
18150 </listitem></varlistentry>
18151 <varlistentry>
18152 <term><varname>$message_body_size</varname></term>
18153 <listitem>
18154 <para>
18155 <indexterm role="concept">
18156 <primary>body of message</primary>
18157 <secondary>size</secondary>
18158 </indexterm>
18159 <indexterm role="concept">
18160 <primary>message body</primary>
18161 <secondary>size</secondary>
18162 </indexterm>
18163 <indexterm role="variable">
18164 <primary><varname>$message_body_size</varname></primary>
18165 </indexterm>
18166 When a message is being delivered, this variable contains the size of the body
18167 in bytes. The count starts from the character after the blank line that
18168 separates the body from the header. Newlines are included in the count. See
18169 also <varname>$message_size</varname>, <varname>$body_linecount</varname>, and <varname>$body_zerocount</varname>.
18170 </para>
18171 </listitem></varlistentry>
18172 <varlistentry>
18173 <term><varname>$message_exim_id</varname></term>
18174 <listitem>
18175 <para>
18176 <indexterm role="variable">
18177 <primary><varname>$message_exim_id</varname></primary>
18178 </indexterm>
18179 When a message is being received or delivered, this variable contains the
18180 unique message id that is generated and used by Exim to identify the message.
18181 An id is not created for a message until after its header has been successfully
18182 received. <emphasis role="bold">Note</emphasis>: This is <emphasis>not</emphasis> the contents of the <emphasis>Message-ID:</emphasis> header
18183 line; it is the local id that Exim assigns to the message, for example:
18184 <literal>1BXTIK-0001yO-VA</literal>.
18185 </para>
18186 </listitem></varlistentry>
18187 <varlistentry>
18188 <term><varname>$message_headers</varname></term>
18189 <listitem>
18190 <para>
18191 <indexterm role="variable">
18192 <primary><varname>$message_headers</varname></primary>
18193 </indexterm>
18194 This variable contains a concatenation of all the header lines when a message
18195 is being processed, except for lines added by routers or transports. The header
18196 lines are separated by newline characters. Their contents are decoded in the
18197 same way as a header line that is inserted by <option>bheader</option>.
18198 </para>
18199 </listitem></varlistentry>
18200 <varlistentry>
18201 <term><varname>$message_headers_raw</varname></term>
18202 <listitem>
18203 <para>
18204 <indexterm role="variable">
18205 <primary><varname>$message_headers_raw</varname></primary>
18206 </indexterm>
18207 This variable is like <varname>$message_headers</varname> except that no processing of the
18208 contents of header lines is done.
18209 </para>
18210 </listitem></varlistentry>
18211 <varlistentry>
18212 <term><varname>$message_id</varname></term>
18213 <listitem>
18214 <para>
18215 This is an old name for <varname>$message_exim_id</varname>. It is now deprecated.
18216 </para>
18217 </listitem></varlistentry>
18218 <varlistentry>
18219 <term><varname>$message_linecount</varname></term>
18220 <listitem>
18221 <para>
18222 <indexterm role="variable">
18223 <primary><varname>$message_linecount</varname></primary>
18224 </indexterm>
18225 This variable contains the total number of lines in the header and body of the
18226 message. Compare <varname>$body_linecount</varname>, which is the count for the body only.
18227 During the DATA and content-scanning ACLs, <varname>$message_linecount</varname> contains the
18228 number of lines received. Before delivery happens (that is, before filters,
18229 routers, and transports run) the count is increased to include the
18230 <emphasis>Received:</emphasis> header line that Exim standardly adds, and also any other header
18231 lines that are added by ACLs. The blank line that separates the message header
18232 from the body is not counted.
18233 </para>
18234 <para>
18235 As with the special case of <varname>$message_size</varname>, during the expansion of the
18236 appendfile transport&#x2019;s maildir_tag option in maildir format, the value of
18237 <varname>$message_linecount</varname> is the precise size of the number of newlines in the
18238 file that has been written (minus one for the blank line between the
18239 header and the body).
18240 </para>
18241 <para>
18242 Here is an example of the use of this variable in a DATA ACL:
18243 </para>
18244 <literallayout class="monospaced">
18245 deny message   = Too many lines in message header
18246      condition = \
18247       ${if &lt;{250}{${eval:$message_linecount - $body_linecount}}}
18248 </literallayout>
18249 <para>
18250 In the MAIL and RCPT ACLs, the value is zero because at that stage the
18251 message has not yet been received.
18252 </para>
18253 </listitem></varlistentry>
18254 <varlistentry>
18255 <term><varname>$message_size</varname></term>
18256 <listitem>
18257 <para>
18258 <indexterm role="concept">
18259 <primary>size</primary>
18260 <secondary>of message</secondary>
18261 </indexterm>
18262 <indexterm role="concept">
18263 <primary>message</primary>
18264 <secondary>size</secondary>
18265 </indexterm>
18266 <indexterm role="variable">
18267 <primary><varname>$message_size</varname></primary>
18268 </indexterm>
18269 When a message is being processed, this variable contains its size in bytes. In
18270 most cases, the size includes those headers that were received with the
18271 message, but not those (such as <emphasis>Envelope-to:</emphasis>) that are added to individual
18272 deliveries as they are written. However, there is one special case: during the
18273 expansion of the <option>maildir_tag</option> option in the <command>appendfile</command> transport while
18274 doing a delivery in maildir format, the value of <varname>$message_size</varname> is the
18275 precise size of the file that has been written. See also
18276 <varname>$message_body_size</varname>, <varname>$body_linecount</varname>, and <varname>$body_zerocount</varname>.
18277 </para>
18278 <para>
18279 <indexterm role="concept">
18280 <primary>RCPT</primary>
18281 <secondary>value of <varname>$message_size</varname></secondary>
18282 </indexterm>
18283 While running a per message ACL (mail/rcpt/predata), <varname>$message_size</varname>
18284 contains the size supplied on the MAIL command, or -1 if no size was given. The
18285 value may not, of course, be truthful.
18286 </para>
18287 </listitem></varlistentry>
18288 <varlistentry>
18289 <term><varname>$mime_</varname><emphasis>xxx</emphasis></term>
18290 <listitem>
18291 <para>
18292 A number of variables whose names start with <varname>$mime</varname> are
18293 available when Exim is compiled with the content-scanning extension. For
18294 details, see section <xref linkend="SECTscanmimepart"/>.
18295 </para>
18296 </listitem></varlistentry>
18297 <varlistentry>
18298 <term><varname>$n0</varname> &ndash; <varname>$n9</varname></term>
18299 <listitem>
18300 <para>
18301 These variables are counters that can be incremented by means
18302 of the <option>add</option> command in filter files.
18303 </para>
18304 </listitem></varlistentry>
18305 <varlistentry>
18306 <term><varname>$original_domain</varname></term>
18307 <listitem>
18308 <para>
18309 <indexterm role="variable">
18310 <primary><varname>$domain</varname></primary>
18311 </indexterm>
18312 <indexterm role="variable">
18313 <primary><varname>$original_domain</varname></primary>
18314 </indexterm>
18315 When a top-level address is being processed for delivery, this contains the
18316 same value as <varname>$domain</varname>. However, if a <quote>child</quote> address (for example,
18317 generated by an alias, forward, or filter file) is being processed, this
18318 variable contains the domain of the original address (lower cased). This
18319 differs from <varname>$parent_domain</varname> only when there is more than one level of
18320 aliasing or forwarding. When more than one address is being delivered in a
18321 single transport run, <varname>$original_domain</varname> is not set.
18322 </para>
18323 <para>
18324 If a new address is created by means of a <option>deliver</option> command in a system
18325 filter, it is set up with an artificial <quote>parent</quote> address. This has the local
18326 part <emphasis>system-filter</emphasis> and the default qualify domain.
18327 </para>
18328 </listitem></varlistentry>
18329 <varlistentry>
18330 <term><varname>$original_local_part</varname></term>
18331 <listitem>
18332 <para>
18333 <indexterm role="variable">
18334 <primary><varname>$local_part</varname></primary>
18335 </indexterm>
18336 <indexterm role="variable">
18337 <primary><varname>$original_local_part</varname></primary>
18338 </indexterm>
18339 When a top-level address is being processed for delivery, this contains the
18340 same value as <varname>$local_part</varname>, unless a prefix or suffix was removed from the
18341 local part, because <varname>$original_local_part</varname> always contains the full local
18342 part. When a <quote>child</quote> address (for example, generated by an alias, forward, or
18343 filter file) is being processed, this variable contains the full local part of
18344 the original address.
18345 </para>
18346 <para>
18347 If the router that did the redirection processed the local part
18348 case-insensitively, the value in <varname>$original_local_part</varname> is in lower case.
18349 This variable differs from <varname>$parent_local_part</varname> only when there is more than
18350 one level of aliasing or forwarding. When more than one address is being
18351 delivered in a single transport run, <varname>$original_local_part</varname> is not set.
18352 </para>
18353 <para>
18354 If a new address is created by means of a <option>deliver</option> command in a system
18355 filter, it is set up with an artificial <quote>parent</quote> address. This has the local
18356 part <emphasis>system-filter</emphasis> and the default qualify domain.
18357 </para>
18358 </listitem></varlistentry>
18359 <varlistentry>
18360 <term><varname>$originator_gid</varname></term>
18361 <listitem>
18362 <para>
18363 <indexterm role="concept">
18364 <primary>gid (group id)</primary>
18365 <secondary>of originating user</secondary>
18366 </indexterm>
18367 <indexterm role="concept">
18368 <primary>sender</primary>
18369 <secondary>gid</secondary>
18370 </indexterm>
18371 <indexterm role="variable">
18372 <primary><varname>$caller_gid</varname></primary>
18373 </indexterm>
18374 <indexterm role="variable">
18375 <primary><varname>$originator_gid</varname></primary>
18376 </indexterm>
18377 This variable contains the value of <varname>$caller_gid</varname> that was set when the
18378 message was received. For messages received via the command line, this is the
18379 gid of the sending user. For messages received by SMTP over TCP/IP, this is
18380 normally the gid of the Exim user.
18381 </para>
18382 </listitem></varlistentry>
18383 <varlistentry>
18384 <term><varname>$originator_uid</varname></term>
18385 <listitem>
18386 <para>
18387 <indexterm role="concept">
18388 <primary>uid (user id)</primary>
18389 <secondary>of originating user</secondary>
18390 </indexterm>
18391 <indexterm role="concept">
18392 <primary>sender</primary>
18393 <secondary>uid</secondary>
18394 </indexterm>
18395 <indexterm role="variable">
18396 <primary><varname>$caller_uid</varname></primary>
18397 </indexterm>
18398 <indexterm role="variable">
18399 <primary><varname>$originaltor_uid</varname></primary>
18400 </indexterm>
18401 The value of <varname>$caller_uid</varname> that was set when the message was received. For
18402 messages received via the command line, this is the uid of the sending user.
18403 For messages received by SMTP over TCP/IP, this is normally the uid of the Exim
18404 user.
18405 </para>
18406 </listitem></varlistentry>
18407 <varlistentry>
18408 <term><varname>$parent_domain</varname></term>
18409 <listitem>
18410 <para>
18411 <indexterm role="variable">
18412 <primary><varname>$parent_domain</varname></primary>
18413 </indexterm>
18414 This variable is similar to <varname>$original_domain</varname> (see
18415 above), except that it refers to the immediately preceding parent address.
18416 </para>
18417 </listitem></varlistentry>
18418 <varlistentry>
18419 <term><varname>$parent_local_part</varname></term>
18420 <listitem>
18421 <para>
18422 <indexterm role="variable">
18423 <primary><varname>$parent_local_part</varname></primary>
18424 </indexterm>
18425 This variable is similar to <varname>$original_local_part</varname>
18426 (see above), except that it refers to the immediately preceding parent address.
18427 </para>
18428 </listitem></varlistentry>
18429 <varlistentry>
18430 <term><varname>$pid</varname></term>
18431 <listitem>
18432 <para>
18433 <indexterm role="concept">
18434 <primary>pid (process id)</primary>
18435 <secondary>of current process</secondary>
18436 </indexterm>
18437 <indexterm role="variable">
18438 <primary><varname>$pid</varname></primary>
18439 </indexterm>
18440 This variable contains the current process id.
18441 </para>
18442 </listitem></varlistentry>
18443 <varlistentry>
18444 <term><varname>$pipe_addresses</varname></term>
18445 <listitem>
18446 <para>
18447 <indexterm role="concept">
18448 <primary>filter</primary>
18449 <secondary>transport filter</secondary>
18450 </indexterm>
18451 <indexterm role="concept">
18452 <primary>transport</primary>
18453 <secondary>filter</secondary>
18454 </indexterm>
18455 <indexterm role="variable">
18456 <primary><varname>$pipe_addresses</varname></primary>
18457 </indexterm>
18458 This is not an expansion variable, but is mentioned here because the string
18459 <literal>$pipe_addresses</literal> is handled specially in the command specification for the
18460 <command>pipe</command> transport (chapter <xref linkend="CHAPpipetransport"/>) and in transport filters
18461 (described under <option>transport_filter</option> in chapter <xref linkend="CHAPtransportgeneric"/>).
18462 It cannot be used in general expansion strings, and provokes an <quote>unknown
18463 variable</quote> error if encountered.
18464 </para>
18465 </listitem></varlistentry>
18466 <varlistentry>
18467 <term><varname>$primary_hostname</varname></term>
18468 <listitem>
18469 <para>
18470 <indexterm role="variable">
18471 <primary><varname>$primary_hostname</varname></primary>
18472 </indexterm>
18473 This variable contains the value set by <option>primary_hostname</option> in the
18474 configuration file, or read by the <function>uname()</function> function. If <function>uname()</function> returns
18475 a single-component name, Exim calls <function>gethostbyname()</function> (or
18476 <function>getipnodebyname()</function> where available) in an attempt to acquire a fully
18477 qualified host name. See also <varname>$smtp_active_hostname</varname>.
18478 </para>
18479 </listitem></varlistentry>
18480 <varlistentry>
18481 <term><varname>$prvscheck_address</varname></term>
18482 <listitem>
18483 <para>
18484 This variable is used in conjunction with the <option>prvscheck</option> expansion item,
18485 which is described in sections <xref linkend="SECTexpansionitems"/> and
18486 <xref linkend="SECTverifyPRVS"/>.
18487 </para>
18488 </listitem></varlistentry>
18489 <varlistentry>
18490 <term><varname>$prvscheck_keynum</varname></term>
18491 <listitem>
18492 <para>
18493 This variable is used in conjunction with the <option>prvscheck</option> expansion item,
18494 which is described in sections <xref linkend="SECTexpansionitems"/> and
18495 <xref linkend="SECTverifyPRVS"/>.
18496 </para>
18497 </listitem></varlistentry>
18498 <varlistentry>
18499 <term><varname>$prvscheck_result</varname></term>
18500 <listitem>
18501 <para>
18502 This variable is used in conjunction with the <option>prvscheck</option> expansion item,
18503 which is described in sections <xref linkend="SECTexpansionitems"/> and
18504 <xref linkend="SECTverifyPRVS"/>.
18505 </para>
18506 </listitem></varlistentry>
18507 <varlistentry>
18508 <term><varname>$qualify_domain</varname></term>
18509 <listitem>
18510 <para>
18511 <indexterm role="variable">
18512 <primary><varname>$qualify_domain</varname></primary>
18513 </indexterm>
18514 The value set for the <option>qualify_domain</option> option in the configuration file.
18515 </para>
18516 </listitem></varlistentry>
18517 <varlistentry>
18518 <term><varname>$qualify_recipient</varname></term>
18519 <listitem>
18520 <para>
18521 <indexterm role="variable">
18522 <primary><varname>$qualify_recipient</varname></primary>
18523 </indexterm>
18524 The value set for the <option>qualify_recipient</option> option in the configuration file,
18525 or if not set, the value of <varname>$qualify_domain</varname>.
18526 </para>
18527 </listitem></varlistentry>
18528 <varlistentry>
18529 <term><varname>$rcpt_count</varname></term>
18530 <listitem>
18531 <para>
18532 <indexterm role="variable">
18533 <primary><varname>$rcpt_count</varname></primary>
18534 </indexterm>
18535 When a message is being received by SMTP, this variable contains the number of
18536 RCPT commands received for the current message. If this variable is used in a
18537 RCPT ACL, its value includes the current command.
18538 </para>
18539 </listitem></varlistentry>
18540 <varlistentry>
18541 <term><varname>$rcpt_defer_count</varname></term>
18542 <listitem>
18543 <para>
18544 <indexterm role="variable">
18545 <primary><varname>$rcpt_defer_count</varname></primary>
18546 </indexterm>
18547 <indexterm role="concept">
18548 <primary>4<emphasis>xx</emphasis> responses</primary>
18549 <secondary>count of</secondary>
18550 </indexterm>
18551 When a message is being received by SMTP, this variable contains the number of
18552 RCPT commands in the current message that have previously been rejected with a
18553 temporary (4<emphasis>xx</emphasis>) response.
18554 </para>
18555 </listitem></varlistentry>
18556 <varlistentry>
18557 <term><varname>$rcpt_fail_count</varname></term>
18558 <listitem>
18559 <para>
18560 <indexterm role="variable">
18561 <primary><varname>$rcpt_fail_count</varname></primary>
18562 </indexterm>
18563 When a message is being received by SMTP, this variable contains the number of
18564 RCPT commands in the current message that have previously been rejected with a
18565 permanent (5<emphasis>xx</emphasis>) response.
18566 </para>
18567 </listitem></varlistentry>
18568 <varlistentry>
18569 <term><varname>$received_count</varname></term>
18570 <listitem>
18571 <para>
18572 <indexterm role="variable">
18573 <primary><varname>$received_count</varname></primary>
18574 </indexterm>
18575 This variable contains the number of <emphasis>Received:</emphasis> header lines in the message,
18576 including the one added by Exim (so its value is always greater than zero). It
18577 is available in the DATA ACL, the non-SMTP ACL, and while routing and
18578 delivering.
18579 </para>
18580 </listitem></varlistentry>
18581 <varlistentry>
18582 <term><varname>$received_for</varname></term>
18583 <listitem>
18584 <para>
18585 <indexterm role="variable">
18586 <primary><varname>$received_for</varname></primary>
18587 </indexterm>
18588 If there is only a single recipient address in an incoming message, this
18589 variable contains that address when the <emphasis>Received:</emphasis> header line is being
18590 built. The value is copied after recipient rewriting has happened, but before
18591 the <function>local_scan()</function> function is run.
18592 </para>
18593 </listitem></varlistentry>
18594 <varlistentry>
18595 <term><varname>$received_ip_address</varname></term>
18596 <listitem>
18597 <para>
18598 <indexterm role="variable">
18599 <primary><varname>$received_ip_address</varname></primary>
18600 </indexterm>
18601 As soon as an Exim server starts processing an incoming TCP/IP connection, this
18602 variable is set to the address of the local IP interface, and <varname>$received_port</varname>
18603 is set to the local port number. (The remote IP address and port are in
18604 <varname>$sender_host_address</varname> and <varname>$sender_host_port</varname>.) When testing with <option>-bh</option>,
18605 the port value is -1 unless it has been set using the <option>-oMi</option> command line
18606 option.
18607 </para>
18608 <para>
18609 As well as being useful in ACLs (including the <quote>connect</quote> ACL), these variable
18610 could be used, for example, to make the file name for a TLS certificate depend
18611 on which interface and/or port is being used for the incoming connection. The
18612 values of <varname>$received_ip_address</varname> and <varname>$received_port</varname> are saved with any
18613 messages that are received, thus making these variables available at delivery
18614 time.
18615 For outbound connections see <varname>$sending_ip_address</varname>.
18616 </para>
18617 </listitem></varlistentry>
18618 <varlistentry>
18619 <term><varname>$received_port</varname></term>
18620 <listitem>
18621 <para>
18622 <indexterm role="variable">
18623 <primary><varname>$received_port</varname></primary>
18624 </indexterm>
18625 See <varname>$received_ip_address</varname>.
18626 </para>
18627 </listitem></varlistentry>
18628 <varlistentry>
18629 <term><varname>$received_protocol</varname></term>
18630 <listitem>
18631 <para>
18632 <indexterm role="variable">
18633 <primary><varname>$received_protocol</varname></primary>
18634 </indexterm>
18635 When a message is being processed, this variable contains the name of the
18636 protocol by which it was received. Most of the names used by Exim are defined
18637 by RFCs 821, 2821, and 3848. They start with <quote>smtp</quote> (the client used HELO) or
18638 <quote>esmtp</quote> (the client used EHLO). This can be followed by <quote>s</quote> for secure
18639 (encrypted) and/or <quote>a</quote> for authenticated. Thus, for example, if the protocol
18640 is set to <quote>esmtpsa</quote>, the message was received over an encrypted SMTP
18641 connection and the client was successfully authenticated.
18642 </para>
18643 <para>
18644 Exim uses the protocol name <quote>smtps</quote> for the case when encryption is
18645 automatically set up on connection without the use of STARTTLS (see
18646 <option>tls_on_connect_ports</option>), and the client uses HELO to initiate the
18647 encrypted SMTP session. The name <quote>smtps</quote> is also used for the rare situation
18648 where the client initially uses EHLO, sets up an encrypted connection using
18649 STARTTLS, and then uses HELO afterwards.
18650 </para>
18651 <para>
18652 The <option>-oMr</option> option provides a way of specifying a custom protocol name for
18653 messages that are injected locally by trusted callers. This is commonly used to
18654 identify messages that are being re-injected after some kind of scanning.
18655 </para>
18656 </listitem></varlistentry>
18657 <varlistentry>
18658 <term><varname>$received_time</varname></term>
18659 <listitem>
18660 <para>
18661 <indexterm role="variable">
18662 <primary><varname>$received_time</varname></primary>
18663 </indexterm>
18664 This variable contains the date and time when the current message was received,
18665 as a number of seconds since the start of the Unix epoch.
18666 </para>
18667 </listitem></varlistentry>
18668 <varlistentry>
18669 <term><varname>$recipient_data</varname></term>
18670 <listitem>
18671 <para>
18672 <indexterm role="variable">
18673 <primary><varname>$recipient_data</varname></primary>
18674 </indexterm>
18675 This variable is set after an indexing lookup success in an ACL <option>recipients</option>
18676 condition. It contains the data from the lookup, and the value remains set
18677 until the next <option>recipients</option> test. Thus, you can do things like this:
18678 </para>
18679 <literallayout>
18680 <literal>require recipients  = cdb*@;/some/file</literal>
18681 <literal>deny    </literal><emphasis>some further test involving</emphasis> <literal>$recipient_data</literal>
18682 </literallayout>
18683 <para>
18684 <emphasis role="bold">Warning</emphasis>: This variable is set only when a lookup is used as an indexing
18685 method in the address list, using the semicolon syntax as in the example above.
18686 The variable is not set for a lookup that is used as part of the string
18687 expansion that all such lists undergo before being interpreted.
18688 </para>
18689 </listitem></varlistentry>
18690 <varlistentry>
18691 <term><varname>$recipient_verify_failure</varname></term>
18692 <listitem>
18693 <para>
18694 <indexterm role="variable">
18695 <primary><varname>$recipient_verify_failure</varname></primary>
18696 </indexterm>
18697 In an ACL, when a recipient verification fails, this variable contains
18698 information about the failure. It is set to one of the following words:
18699 </para>
18700 <itemizedlist>
18701 <listitem>
18702 <para>
18703 <quote>qualify</quote>: The address was unqualified (no domain), and the message
18704 was neither local nor came from an exempted host.
18705 </para>
18706 </listitem>
18707 <listitem>
18708 <para>
18709 <quote>route</quote>: Routing failed.
18710 </para>
18711 </listitem>
18712 <listitem>
18713 <para>
18714 <quote>mail</quote>: Routing succeeded, and a callout was attempted; rejection occurred at
18715 or before the MAIL command (that is, on initial connection, HELO, or
18716 MAIL).
18717 </para>
18718 </listitem>
18719 <listitem>
18720 <para>
18721 <quote>recipient</quote>: The RCPT command in a callout was rejected.
18722 </para>
18723 </listitem>
18724 <listitem>
18725 <para>
18726 <quote>postmaster</quote>: The postmaster check in a callout was rejected.
18727 </para>
18728 </listitem>
18729 </itemizedlist>
18730 <para>
18731 The main use of this variable is expected to be to distinguish between
18732 rejections of MAIL and rejections of RCPT.
18733 </para>
18734 </listitem></varlistentry>
18735 <varlistentry>
18736 <term><varname>$recipients</varname></term>
18737 <listitem>
18738 <para>
18739 <indexterm role="variable">
18740 <primary><varname>$recipients</varname></primary>
18741 </indexterm>
18742 This variable contains a list of envelope recipients for a message. A comma and
18743 a space separate the addresses in the replacement text. However, the variable
18744 is not generally available, to prevent exposure of Bcc recipients in
18745 unprivileged users&#x2019; filter files. You can use <varname>$recipients</varname> only in these
18746 cases:
18747 </para>
18748 <orderedlist numeration="arabic">
18749 <listitem>
18750 <para>
18751 In a system filter file.
18752 </para>
18753 </listitem>
18754 <listitem>
18755 <para>
18756 In the ACLs associated with the DATA command and with non-SMTP messages, that
18757 is, the ACLs defined by <option>acl_smtp_predata</option>, <option>acl_smtp_data</option>,
18758 <option>acl_smtp_mime</option>, <option>acl_not_smtp_start</option>, <option>acl_not_smtp</option>, and
18759 <option>acl_not_smtp_mime</option>.
18760 </para>
18761 </listitem>
18762 <listitem>
18763 <para>
18764 From within a <function>local_scan()</function> function.
18765 </para>
18766 </listitem>
18767 </orderedlist>
18768 </listitem></varlistentry>
18769 <varlistentry>
18770 <term><varname>$recipients_count</varname></term>
18771 <listitem>
18772 <para>
18773 <indexterm role="variable">
18774 <primary><varname>$recipients_count</varname></primary>
18775 </indexterm>
18776 When a message is being processed, this variable contains the number of
18777 envelope recipients that came with the message. Duplicates are not excluded
18778 from the count. While a message is being received over SMTP, the number
18779 increases for each accepted recipient. It can be referenced in an ACL.
18780 </para>
18781 </listitem></varlistentry>
18782 <varlistentry>
18783 <term><varname>$regex_match_string</varname></term>
18784 <listitem>
18785 <para>
18786 <indexterm role="variable">
18787 <primary><varname>$regex_match_string</varname></primary>
18788 </indexterm>
18789 This variable is set to contain the matching regular expression after a
18790 <option>regex</option> ACL condition has matched (see section <xref linkend="SECTscanregex"/>).
18791 </para>
18792 </listitem></varlistentry>
18793 <varlistentry>
18794 <term><varname>$reply_address</varname></term>
18795 <listitem>
18796 <para>
18797 <indexterm role="variable">
18798 <primary><varname>$reply_address</varname></primary>
18799 </indexterm>
18800 When a message is being processed, this variable contains the contents of the
18801 <emphasis>Reply-To:</emphasis> header line if one exists and it is not empty, or otherwise the
18802 contents of the <emphasis>From:</emphasis> header line. Apart from the removal of leading
18803 white space, the value is not processed in any way. In particular, no RFC 2047
18804 decoding or character code translation takes place.
18805 </para>
18806 </listitem></varlistentry>
18807 <varlistentry>
18808 <term><varname>$return_path</varname></term>
18809 <listitem>
18810 <para>
18811 <indexterm role="variable">
18812 <primary><varname>$return_path</varname></primary>
18813 </indexterm>
18814 When a message is being delivered, this variable contains the return path &ndash;
18815 the sender field that will be sent as part of the envelope. It is not enclosed
18816 in &lt;&gt; characters. At the start of routing an address, <varname>$return_path</varname> has the
18817 same value as <varname>$sender_address</varname>, but if, for example, an incoming message to a
18818 mailing list has been expanded by a router which specifies a different address
18819 for bounce messages, <varname>$return_path</varname> subsequently contains the new bounce
18820 address, whereas <varname>$sender_address</varname> always contains the original sender address
18821 that was received with the message. In other words, <varname>$sender_address</varname> contains
18822 the incoming envelope sender, and <varname>$return_path</varname> contains the outgoing
18823 envelope sender.
18824 </para>
18825 </listitem></varlistentry>
18826 <varlistentry>
18827 <term><varname>$return_size_limit</varname></term>
18828 <listitem>
18829 <para>
18830 <indexterm role="variable">
18831 <primary><varname>$return_size_limit</varname></primary>
18832 </indexterm>
18833 This is an obsolete name for <varname>$bounce_return_size_limit</varname>.
18834 </para>
18835 </listitem></varlistentry>
18836 <varlistentry>
18837 <term><varname>$router_name</varname></term>
18838 <listitem>
18839 <para>
18840 <indexterm role="concept">
18841 <primary>router</primary>
18842 <secondary>name</secondary>
18843 </indexterm>
18844 <indexterm role="concept">
18845 <primary>name</primary>
18846 <secondary>of router</secondary>
18847 </indexterm>
18848 <indexterm role="variable">
18849 <primary><varname>$router_name</varname></primary>
18850 </indexterm>
18851 During the running of a router this variable contains its name.
18852 </para>
18853 </listitem></varlistentry>
18854 <varlistentry>
18855 <term><varname>$runrc</varname></term>
18856 <listitem>
18857 <para>
18858 <indexterm role="concept">
18859 <primary>return code</primary>
18860 <secondary>from <option>run</option> expansion</secondary>
18861 </indexterm>
18862 <indexterm role="variable">
18863 <primary><varname>$runrc</varname></primary>
18864 </indexterm>
18865 This variable contains the return code from a command that is run by the
18866 <option>${run...}</option> expansion item. <emphasis role="bold">Warning</emphasis>: In a router or transport, you cannot
18867 assume the order in which option values are expanded, except for those
18868 preconditions whose order of testing is documented. Therefore, you cannot
18869 reliably expect to set <varname>$runrc</varname> by the expansion of one option, and use it in
18870 another.
18871 </para>
18872 </listitem></varlistentry>
18873 <varlistentry>
18874 <term><varname>$self_hostname</varname></term>
18875 <listitem>
18876 <para>
18877 <indexterm role="option">
18878 <primary><option>self</option></primary>
18879 <secondary>value of host name</secondary>
18880 </indexterm>
18881 <indexterm role="variable">
18882 <primary><varname>$self_hostname</varname></primary>
18883 </indexterm>
18884 When an address is routed to a supposedly remote host that turns out to be the
18885 local host, what happens is controlled by the <option>self</option> generic router option.
18886 One of its values causes the address to be passed to another router. When this
18887 happens, <varname>$self_hostname</varname> is set to the name of the local host that the
18888 original router encountered. In other circumstances its contents are null.
18889 </para>
18890 </listitem></varlistentry>
18891 <varlistentry>
18892 <term><varname>$sender_address</varname></term>
18893 <listitem>
18894 <para>
18895 <indexterm role="variable">
18896 <primary><varname>$sender_address</varname></primary>
18897 </indexterm>
18898 When a message is being processed, this variable contains the sender&#x2019;s address
18899 that was received in the message&#x2019;s envelope. The case of letters in the address
18900 is retained, in both the local part and the domain. For bounce messages, the
18901 value of this variable is the empty string. See also <varname>$return_path</varname>.
18902 </para>
18903 </listitem></varlistentry>
18904 <varlistentry>
18905 <term><varname>$sender_address_data</varname></term>
18906 <listitem>
18907 <para>
18908 <indexterm role="variable">
18909 <primary><varname>$address_data</varname></primary>
18910 </indexterm>
18911 <indexterm role="variable">
18912 <primary><varname>$sender_address_data</varname></primary>
18913 </indexterm>
18914 If <varname>$address_data</varname> is set when the routers are called from an ACL to verify a
18915 sender address, the final value is preserved in <varname>$sender_address_data</varname>, to
18916 distinguish it from data from a recipient address. The value does not persist
18917 after the end of the current ACL statement. If you want to preserve it for
18918 longer, you can save it in an ACL variable.
18919 </para>
18920 </listitem></varlistentry>
18921 <varlistentry>
18922 <term><varname>$sender_address_domain</varname></term>
18923 <listitem>
18924 <para>
18925 <indexterm role="variable">
18926 <primary><varname>$sender_address_domain</varname></primary>
18927 </indexterm>
18928 The domain portion of <varname>$sender_address</varname>.
18929 </para>
18930 </listitem></varlistentry>
18931 <varlistentry>
18932 <term><varname>$sender_address_local_part</varname></term>
18933 <listitem>
18934 <para>
18935 <indexterm role="variable">
18936 <primary><varname>$sender_address_local_part</varname></primary>
18937 </indexterm>
18938 The local part portion of <varname>$sender_address</varname>.
18939 </para>
18940 </listitem></varlistentry>
18941 <varlistentry>
18942 <term><varname>$sender_data</varname></term>
18943 <listitem>
18944 <para>
18945 <indexterm role="variable">
18946 <primary><varname>$sender_data</varname></primary>
18947 </indexterm>
18948 This variable is set after a lookup success in an ACL <option>senders</option> condition or
18949 in a router <option>senders</option> option. It contains the data from the lookup, and the
18950 value remains set until the next <option>senders</option> test. Thus, you can do things like
18951 this:
18952 </para>
18953 <literallayout>
18954 <literal>require senders      = cdb*@;/some/file</literal>
18955 <literal>deny    </literal><emphasis>some further test involving</emphasis> <literal>$sender_data</literal>
18956 </literallayout>
18957 <para>
18958 <emphasis role="bold">Warning</emphasis>: This variable is set only when a lookup is used as an indexing
18959 method in the address list, using the semicolon syntax as in the example above.
18960 The variable is not set for a lookup that is used as part of the string
18961 expansion that all such lists undergo before being interpreted.
18962 </para>
18963 </listitem></varlistentry>
18964 <varlistentry>
18965 <term><varname>$sender_fullhost</varname></term>
18966 <listitem>
18967 <para>
18968 <indexterm role="variable">
18969 <primary><varname>$sender_fullhost</varname></primary>
18970 </indexterm>
18971 When a message is received from a remote host, this variable contains the host
18972 name and IP address in a single string. It ends with the IP address in square
18973 brackets, followed by a colon and a port number if the logging of ports is
18974 enabled. The format of the rest of the string depends on whether the host
18975 issued a HELO or EHLO SMTP command, and whether the host name was verified by
18976 looking up its IP address. (Looking up the IP address can be forced by the
18977 <option>host_lookup</option> option, independent of verification.) A plain host name at the
18978 start of the string is a verified host name; if this is not present,
18979 verification either failed or was not requested. A host name in parentheses is
18980 the argument of a HELO or EHLO command. This is omitted if it is identical to
18981 the verified host name or to the host&#x2019;s IP address in square brackets.
18982 </para>
18983 </listitem></varlistentry>
18984 <varlistentry revisionflag="changed">
18985 <term><varname>$sender_helo_dnssec</varname></term>
18986 <listitem>
18987 <para revisionflag="changed">
18988 <indexterm role="variable">
18989 <primary><varname>$sender_helo_dnssec</varname></primary>
18990 </indexterm>
18991 This boolean variable is true if a successful HELO verification was
18992 <indexterm role="concept">
18993 <primary>DNS</primary>
18994 <secondary>DNSSEC</secondary>
18995 </indexterm>
18996 done using DNS information the resolver library stated was authenticated data.
18997 </para>
18998 </listitem></varlistentry>
18999 <varlistentry>
19000 <term><varname>$sender_helo_name</varname></term>
19001 <listitem>
19002 <para>
19003 <indexterm role="variable">
19004 <primary><varname>$sender_helo_name</varname></primary>
19005 </indexterm>
19006 When a message is received from a remote host that has issued a HELO or EHLO
19007 command, the argument of that command is placed in this variable. It is also
19008 set if HELO or EHLO is used when a message is received using SMTP locally via
19009 the <option>-bs</option> or <option>-bS</option> options.
19010 </para>
19011 </listitem></varlistentry>
19012 <varlistentry>
19013 <term><varname>$sender_host_address</varname></term>
19014 <listitem>
19015 <para>
19016 <indexterm role="variable">
19017 <primary><varname>$sender_host_address</varname></primary>
19018 </indexterm>
19019 When a message is received from a remote host using SMTP,
19020 this variable contains that
19021 host&#x2019;s IP address. For locally non-SMTP submitted messages, it is empty.
19022 </para>
19023 </listitem></varlistentry>
19024 <varlistentry>
19025 <term><varname>$sender_host_authenticated</varname></term>
19026 <listitem>
19027 <para>
19028 <indexterm role="variable">
19029 <primary><varname>$sender_host_authenticated</varname></primary>
19030 </indexterm>
19031 This variable contains the name (not the public name) of the authenticator
19032 driver that successfully authenticated the client from which the message was
19033 received. It is empty if there was no successful authentication. See also
19034 <varname>$authenticated_id</varname>.
19035 </para>
19036 </listitem></varlistentry>
19037 <varlistentry>
19038 <term><varname>$sender_host_dnssec</varname></term>
19039 <listitem>
19040 <para>
19041 <indexterm role="variable">
19042 <primary><varname>$sender_host_dnssec</varname></primary>
19043 </indexterm>
19044 If an attempt to populate <varname>$sender_host_name</varname> has been made
19045 (by reference, <option>hosts_lookup</option> or
19046 otherwise) then this boolean will have been set true if, and only if, the
19047 resolver library states that both
19048 the reverse and forward DNS were authenticated data.  At all
19049 other times, this variable is false.
19050 </para>
19051 <para>
19052 <indexterm role="concept">
19053 <primary>DNS</primary>
19054 <secondary>DNSSEC</secondary>
19055 </indexterm>
19056 It is likely that you will need to coerce DNSSEC support on in the resolver
19057 library, by setting:
19058 </para>
19059 <literallayout class="monospaced">
19060 dns_dnssec_ok = 1
19061 </literallayout>
19062 <para>
19063 Exim does not perform DNSSEC validation itself, instead leaving that to a
19064 validating resolver (e.g. unbound, or bind with suitable configuration).
19065 </para>
19066 <para>
19067 If you have changed <option>host_lookup_order</option> so that <literal>bydns</literal> is not the first
19068 mechanism in the list, then this variable will be false.
19069 </para>
19070 </listitem></varlistentry>
19071 <varlistentry>
19072 <term><varname>$sender_host_name</varname></term>
19073 <listitem>
19074 <para>
19075 <indexterm role="variable">
19076 <primary><varname>$sender_host_name</varname></primary>
19077 </indexterm>
19078 When a message is received from a remote host, this variable contains the
19079 host&#x2019;s name as obtained by looking up its IP address. For messages received by
19080 other means, this variable is empty.
19081 </para>
19082 <para>
19083 <indexterm role="variable">
19084 <primary><varname>$host_lookup_failed</varname></primary>
19085 </indexterm>
19086 If the host name has not previously been looked up, a reference to
19087 <varname>$sender_host_name</varname> triggers a lookup (for messages from remote hosts).
19088 A looked up name is accepted only if it leads back to the original IP address
19089 via a forward lookup. If either the reverse or the forward lookup fails to find
19090 any data, or if the forward lookup does not yield the original IP address,
19091 <varname>$sender_host_name</varname> remains empty, and <varname>$host_lookup_failed</varname> is set to <quote>1</quote>.
19092 </para>
19093 <para>
19094 <indexterm role="variable">
19095 <primary><varname>$host_lookup_deferred</varname></primary>
19096 </indexterm>
19097 However, if either of the lookups cannot be completed (for example, there is a
19098 DNS timeout), <varname>$host_lookup_deferred</varname> is set to <quote>1</quote>, and
19099 <varname>$host_lookup_failed</varname> remains set to <quote>0</quote>.
19100 </para>
19101 <para>
19102 Once <varname>$host_lookup_failed</varname> is set to <quote>1</quote>, Exim does not try to look up the
19103 host name again if there is a subsequent reference to <varname>$sender_host_name</varname>
19104 in the same Exim process, but it does try again if <varname>$host_lookup_deferred</varname>
19105 is set to <quote>1</quote>.
19106 </para>
19107 <para>
19108 Exim does not automatically look up every calling host&#x2019;s name. If you want
19109 maximum efficiency, you should arrange your configuration so that it avoids
19110 these lookups altogether. The lookup happens only if one or more of the
19111 following are true:
19112 </para>
19113 <itemizedlist>
19114 <listitem>
19115 <para>
19116 A string containing <varname>$sender_host_name</varname> is expanded.
19117 </para>
19118 </listitem>
19119 <listitem>
19120 <para>
19121 The calling host matches the list in <option>host_lookup</option>. In the default
19122 configuration, this option is set to *, so it must be changed if lookups are
19123 to be avoided. (In the code, the default for <option>host_lookup</option> is unset.)
19124 </para>
19125 </listitem>
19126 <listitem>
19127 <para>
19128 Exim needs the host name in order to test an item in a host list. The items
19129 that require this are described in sections <xref linkend="SECThoslispatnam"/> and
19130 <xref linkend="SECThoslispatnamsk"/>.
19131 </para>
19132 </listitem>
19133 <listitem>
19134 <para>
19135 The calling host matches <option>helo_try_verify_hosts</option> or <option>helo_verify_hosts</option>.
19136 In this case, the host name is required to compare with the name quoted in any
19137 EHLO or HELO commands that the client issues.
19138 </para>
19139 </listitem>
19140 <listitem>
19141 <para>
19142 The remote host issues a EHLO or HELO command that quotes one of the
19143 domains in <option>helo_lookup_domains</option>. The default value of this option is
19144 </para>
19145 <literallayout class="monospaced">
19146   helo_lookup_domains = @ : @[]
19147 </literallayout>
19148 <para>
19149 which causes a lookup if a remote host (incorrectly) gives the server&#x2019;s name or
19150 IP address in an EHLO or HELO command.
19151 </para>
19152 </listitem>
19153 </itemizedlist>
19154 </listitem></varlistentry>
19155 <varlistentry>
19156 <term><varname>$sender_host_port</varname></term>
19157 <listitem>
19158 <para>
19159 <indexterm role="variable">
19160 <primary><varname>$sender_host_port</varname></primary>
19161 </indexterm>
19162 When a message is received from a remote host, this variable contains the port
19163 number that was used on the remote host.
19164 </para>
19165 </listitem></varlistentry>
19166 <varlistentry>
19167 <term><varname>$sender_ident</varname></term>
19168 <listitem>
19169 <para>
19170 <indexterm role="variable">
19171 <primary><varname>$sender_ident</varname></primary>
19172 </indexterm>
19173 When a message is received from a remote host, this variable contains the
19174 identification received in response to an RFC 1413 request. When a message has
19175 been received locally, this variable contains the login name of the user that
19176 called Exim.
19177 </para>
19178 </listitem></varlistentry>
19179 <varlistentry>
19180 <term><varname>$sender_rate_</varname><emphasis>xxx</emphasis></term>
19181 <listitem>
19182 <para>
19183 A number of variables whose names begin <varname>$sender_rate_</varname> are set as part of the
19184 <option>ratelimit</option> ACL condition. Details are given in section
19185 <xref linkend="SECTratelimiting"/>.
19186 </para>
19187 </listitem></varlistentry>
19188 <varlistentry>
19189 <term><varname>$sender_rcvhost</varname></term>
19190 <listitem>
19191 <para>
19192 <indexterm role="concept">
19193 <primary>DNS</primary>
19194 <secondary>reverse lookup</secondary>
19195 </indexterm>
19196 <indexterm role="concept">
19197 <primary>reverse DNS lookup</primary>
19198 </indexterm>
19199 <indexterm role="variable">
19200 <primary><varname>$sender_rcvhost</varname></primary>
19201 </indexterm>
19202 This is provided specifically for use in <emphasis>Received:</emphasis> headers. It starts with
19203 either the verified host name (as obtained from a reverse DNS lookup) or, if
19204 there is no verified host name, the IP address in square brackets. After that
19205 there may be text in parentheses. When the first item is a verified host name,
19206 the first thing in the parentheses is the IP address in square brackets,
19207 followed by a colon and a port number if port logging is enabled. When the
19208 first item is an IP address, the port is recorded as <quote>port=<emphasis>xxxx</emphasis></quote> inside
19209 the parentheses.
19210 </para>
19211 <para>
19212 There may also be items of the form <quote>helo=<emphasis>xxxx</emphasis></quote> if HELO or EHLO
19213 was used and its argument was not identical to the real host name or IP
19214 address, and <quote>ident=<emphasis>xxxx</emphasis></quote> if an RFC 1413 ident string is available. If
19215 all three items are present in the parentheses, a newline and tab are inserted
19216 into the string, to improve the formatting of the <emphasis>Received:</emphasis> header.
19217 </para>
19218 </listitem></varlistentry>
19219 <varlistentry>
19220 <term><varname>$sender_verify_failure</varname></term>
19221 <listitem>
19222 <para>
19223 <indexterm role="variable">
19224 <primary><varname>$sender_verify_failure</varname></primary>
19225 </indexterm>
19226 In an ACL, when a sender verification fails, this variable contains information
19227 about the failure. The details are the same as for
19228 <varname>$recipient_verify_failure</varname>.
19229 </para>
19230 </listitem></varlistentry>
19231 <varlistentry>
19232 <term><varname>$sending_ip_address</varname></term>
19233 <listitem>
19234 <para>
19235 <indexterm role="variable">
19236 <primary><varname>$sending_ip_address</varname></primary>
19237 </indexterm>
19238 This variable is set whenever an outgoing SMTP connection to another host has
19239 been set up. It contains the IP address of the local interface that is being
19240 used. This is useful if a host that has more than one IP address wants to take
19241 on different personalities depending on which one is being used. For incoming
19242 connections, see <varname>$received_ip_address</varname>.
19243 </para>
19244 </listitem></varlistentry>
19245 <varlistentry>
19246 <term><varname>$sending_port</varname></term>
19247 <listitem>
19248 <para>
19249 <indexterm role="variable">
19250 <primary><varname>$sending_port</varname></primary>
19251 </indexterm>
19252 This variable is set whenever an outgoing SMTP connection to another host has
19253 been set up. It contains the local port that is being used. For incoming
19254 connections, see <varname>$received_port</varname>.
19255 </para>
19256 </listitem></varlistentry>
19257 <varlistentry>
19258 <term><varname>$smtp_active_hostname</varname></term>
19259 <listitem>
19260 <para>
19261 <indexterm role="variable">
19262 <primary><varname>$smtp_active_hostname</varname></primary>
19263 </indexterm>
19264 During an incoming SMTP session, this variable contains the value of the active
19265 host name, as specified by the <option>smtp_active_hostname</option> option. The value of
19266 <varname>$smtp_active_hostname</varname> is saved with any message that is received, so its
19267 value can be consulted during routing and delivery.
19268 </para>
19269 </listitem></varlistentry>
19270 <varlistentry>
19271 <term><varname>$smtp_command</varname></term>
19272 <listitem>
19273 <para>
19274 <indexterm role="variable">
19275 <primary><varname>$smtp_command</varname></primary>
19276 </indexterm>
19277 During the processing of an incoming SMTP command, this variable contains the
19278 entire command. This makes it possible to distinguish between HELO and EHLO in
19279 the HELO ACL, and also to distinguish between commands such as these:
19280 </para>
19281 <literallayout class="monospaced">
19282 MAIL FROM:&lt;&gt;
19283 MAIL FROM: &lt;&gt;
19284 </literallayout>
19285 <para>
19286 For a MAIL command, extra parameters such as SIZE can be inspected. For a RCPT
19287 command, the address in <varname>$smtp_command</varname> is the original address before any
19288 rewriting, whereas the values in <varname>$local_part</varname> and <varname>$domain</varname> are taken from
19289 the address after SMTP-time rewriting.
19290 </para>
19291 </listitem></varlistentry>
19292 <varlistentry>
19293 <term><varname>$smtp_command_argument</varname></term>
19294 <listitem>
19295 <para>
19296 <indexterm role="concept">
19297 <primary>SMTP</primary>
19298 <secondary>command, argument for</secondary>
19299 </indexterm>
19300 <indexterm role="variable">
19301 <primary><varname>$smtp_command_argument</varname></primary>
19302 </indexterm>
19303 While an ACL is running to check an SMTP command, this variable contains the
19304 argument, that is, the text that follows the command name, with leading white
19305 space removed. Following the introduction of <varname>$smtp_command</varname>, this variable is
19306 somewhat redundant, but is retained for backwards compatibility.
19307 </para>
19308 </listitem></varlistentry>
19309 <varlistentry>
19310 <term><varname>$smtp_count_at_connection_start</varname></term>
19311 <listitem>
19312 <para>
19313 <indexterm role="variable">
19314 <primary><varname>$smtp_count_at_connection_start</varname></primary>
19315 </indexterm>
19316 This variable is set greater than zero only in processes spawned by the Exim
19317 daemon for handling incoming SMTP connections. The name is deliberately long,
19318 in order to emphasize what the contents are. When the daemon accepts a new
19319 connection, it increments this variable. A copy of the variable is passed to
19320 the child process that handles the connection, but its value is fixed, and
19321 never changes. It is only an approximation of how many incoming connections
19322 there actually are, because many other connections may come and go while a
19323 single connection is being processed. When a child process terminates, the
19324 daemon decrements its copy of the variable.
19325 </para>
19326 </listitem></varlistentry>
19327 <varlistentry>
19328 <term><varname>$sn0</varname> &ndash; <varname>$sn9</varname></term>
19329 <listitem>
19330 <para>
19331 These variables are copies of the values of the <varname>$n0</varname> &ndash; <varname>$n9</varname> accumulators
19332 that were current at the end of the system filter file. This allows a system
19333 filter file to set values that can be tested in users&#x2019; filter files. For
19334 example, a system filter could set a value indicating how likely it is that a
19335 message is junk mail.
19336 </para>
19337 </listitem></varlistentry>
19338 <varlistentry>
19339 <term><varname>$spam_</varname><emphasis>xxx</emphasis></term>
19340 <listitem>
19341 <para>
19342 A number of variables whose names start with <varname>$spam</varname> are available when Exim
19343 is compiled with the content-scanning extension. For details, see section
19344 <xref linkend="SECTscanspamass"/>.
19345 </para>
19346 </listitem></varlistentry>
19347 <varlistentry>
19348 <term><varname>$spool_directory</varname></term>
19349 <listitem>
19350 <para>
19351 <indexterm role="variable">
19352 <primary><varname>$spool_directory</varname></primary>
19353 </indexterm>
19354 The name of Exim&#x2019;s spool directory.
19355 </para>
19356 </listitem></varlistentry>
19357 <varlistentry>
19358 <term><varname>$spool_inodes</varname></term>
19359 <listitem>
19360 <para>
19361 <indexterm role="variable">
19362 <primary><varname>$spool_inodes</varname></primary>
19363 </indexterm>
19364 The number of free inodes in the disk partition where Exim&#x2019;s spool files are
19365 being written. The value is recalculated whenever the variable is referenced.
19366 If the relevant file system does not have the concept of inodes, the value of
19367 is -1. See also the <option>check_spool_inodes</option> option.
19368 </para>
19369 </listitem></varlistentry>
19370 <varlistentry>
19371 <term><varname>$spool_space</varname></term>
19372 <listitem>
19373 <para>
19374 <indexterm role="variable">
19375 <primary><varname>$spool_space</varname></primary>
19376 </indexterm>
19377 The amount of free space (as a number of kilobytes) in the disk partition where
19378 Exim&#x2019;s spool files are being written. The value is recalculated whenever the
19379 variable is referenced. If the operating system does not have the ability to
19380 find the amount of free space (only true for experimental systems), the space
19381 value is -1. For example, to check in an ACL that there is at least 50
19382 megabytes free on the spool, you could write:
19383 </para>
19384 <literallayout class="monospaced">
19385 condition = ${if &gt; {$spool_space}{50000}}
19386 </literallayout>
19387 <para>
19388 See also the <option>check_spool_space</option> option.
19389 </para>
19390 </listitem></varlistentry>
19391 <varlistentry>
19392 <term><varname>$thisaddress</varname></term>
19393 <listitem>
19394 <para>
19395 <indexterm role="variable">
19396 <primary><varname>$thisaddress</varname></primary>
19397 </indexterm>
19398 This variable is set only during the processing of the <option>foranyaddress</option>
19399 command in a filter file. Its use is explained in the description of that
19400 command, which can be found in the separate document entitled <emphasis>Exim&#x2019;s
19401 interfaces to mail filtering</emphasis>.
19402 </para>
19403 </listitem></varlistentry>
19404 <varlistentry>
19405 <term><varname>$tls_in_bits</varname></term>
19406 <listitem>
19407 <para>
19408 <indexterm role="variable">
19409 <primary><varname>$tls_in_bits</varname></primary>
19410 </indexterm>
19411 Contains an approximation of the TLS cipher&#x2019;s bit-strength
19412 on the inbound connection; the meaning of
19413 this depends upon the TLS implementation used.
19414 If TLS has not been negotiated, the value will be 0.
19415 The value of this is automatically fed into the Cyrus SASL authenticator
19416 when acting as a server, to specify the "external SSF" (a SASL term).
19417 </para>
19418 <para>
19419 The deprecated <varname>$tls_bits</varname> variable refers to the inbound side
19420 except when used in the context of an outbound SMTP delivery, when it refers to
19421 the outbound.
19422 </para>
19423 </listitem></varlistentry>
19424 <varlistentry>
19425 <term><varname>$tls_out_bits</varname></term>
19426 <listitem>
19427 <para>
19428 <indexterm role="variable">
19429 <primary><varname>$tls_out_bits</varname></primary>
19430 </indexterm>
19431 Contains an approximation of the TLS cipher&#x2019;s bit-strength
19432 on an outbound SMTP connection; the meaning of
19433 this depends upon the TLS implementation used.
19434 If TLS has not been negotiated, the value will be 0.
19435 </para>
19436 </listitem></varlistentry>
19437 <varlistentry>
19438 <term><varname>$tls_in_ourcert</varname></term>
19439 <listitem>
19440 <para>
19441 <indexterm role="variable">
19442 <primary><varname>$tls_in_ourcert</varname></primary>
19443 </indexterm>
19444 This variable refers to the certificate presented to the peer of an
19445 inbound connection when the message was received.
19446 It is only useful as the argument of a
19447 <option>certextract</option> expansion item, <option>md5</option>, <option>sha1</option> or <option>sha256</option> operator,
19448 or a <option>def</option> condition.
19449 </para>
19450 </listitem></varlistentry>
19451 <varlistentry>
19452 <term><varname>$tls_in_peercert</varname></term>
19453 <listitem>
19454 <para>
19455 <indexterm role="variable">
19456 <primary><varname>$tls_in_peercert</varname></primary>
19457 </indexterm>
19458 This variable refers to the certificate presented by the peer of an
19459 inbound connection when the message was received.
19460 It is only useful as the argument of a
19461 <option>certextract</option> expansion item, <option>md5</option>, <option>sha1</option> or <option>sha256</option> operator,
19462 or a <option>def</option> condition.
19463 </para>
19464 <para revisionflag="changed">
19465 If certificate verification fails it may refer to a failing chain element
19466 which is not the leaf.
19467 </para>
19468 </listitem></varlistentry>
19469 <varlistentry>
19470 <term><varname>$tls_out_ourcert</varname></term>
19471 <listitem>
19472 <para>
19473 <indexterm role="variable">
19474 <primary><varname>$tls_out_ourcert</varname></primary>
19475 </indexterm>
19476 This variable refers to the certificate presented to the peer of an
19477 outbound connection.  It is only useful as the argument of a
19478 <option>certextract</option> expansion item, <option>md5</option>, <option>sha1</option> or <option>sha256</option> operator,
19479 or a <option>def</option> condition.
19480 </para>
19481 </listitem></varlistentry>
19482 <varlistentry>
19483 <term><varname>$tls_out_peercert</varname></term>
19484 <listitem>
19485 <para>
19486 <indexterm role="variable">
19487 <primary><varname>$tls_out_peercert</varname></primary>
19488 </indexterm>
19489 This variable refers to the certificate presented by the peer of an
19490 outbound connection.  It is only useful as the argument of a
19491 <option>certextract</option> expansion item, <option>md5</option>, <option>sha1</option> or <option>sha256</option> operator,
19492 or a <option>def</option> condition.
19493 </para>
19494 <para revisionflag="changed">
19495 If certificate verification fails it may refer to a failing chain element
19496 which is not the leaf.
19497 </para>
19498 </listitem></varlistentry>
19499 <varlistentry>
19500 <term><varname>$tls_in_certificate_verified</varname></term>
19501 <listitem>
19502 <para>
19503 <indexterm role="variable">
19504 <primary><varname>$tls_in_certificate_verified</varname></primary>
19505 </indexterm>
19506 This variable is set to <quote>1</quote> if a TLS certificate was verified when the
19507 message was received, and <quote>0</quote> otherwise.
19508 </para>
19509 <para>
19510 The deprecated <varname>$tls_certificate_verified</varname> variable refers to the inbound side
19511 except when used in the context of an outbound SMTP delivery, when it refers to
19512 the outbound.
19513 </para>
19514 </listitem></varlistentry>
19515 <varlistentry>
19516 <term><varname>$tls_out_certificate_verified</varname></term>
19517 <listitem>
19518 <para>
19519 <indexterm role="variable">
19520 <primary><varname>$tls_out_certificate_verified</varname></primary>
19521 </indexterm>
19522 This variable is set to <quote>1</quote> if a TLS certificate was verified when an
19523 outbound SMTP connection was made,
19524 and <quote>0</quote> otherwise.
19525 </para>
19526 </listitem></varlistentry>
19527 <varlistentry>
19528 <term><varname>$tls_in_cipher</varname></term>
19529 <listitem>
19530 <para>
19531 <indexterm role="variable">
19532 <primary><varname>$tls_in_cipher</varname></primary>
19533 </indexterm>
19534 <indexterm role="variable">
19535 <primary><varname>$tls_cipher</varname></primary>
19536 </indexterm>
19537 When a message is received from a remote host over an encrypted SMTP
19538 connection, this variable is set to the cipher suite that was negotiated, for
19539 example DES-CBC3-SHA. In other circumstances, in particular, for message
19540 received over unencrypted connections, the variable is empty. Testing
19541 <varname>$tls_cipher</varname> for emptiness is one way of distinguishing between encrypted and
19542 non-encrypted connections during ACL processing.
19543 </para>
19544 <para>
19545 The deprecated <varname>$tls_cipher</varname> variable is the same as <varname>$tls_in_cipher</varname> during message reception,
19546 but in the context of an outward SMTP delivery taking place via the <command>smtp</command> transport
19547 becomes the same as <varname>$tls_out_cipher</varname>.
19548 </para>
19549 </listitem></varlistentry>
19550 <varlistentry>
19551 <term><varname>$tls_out_cipher</varname></term>
19552 <listitem>
19553 <para>
19554 <indexterm role="variable">
19555 <primary><varname>$tls_out_cipher</varname></primary>
19556 </indexterm>
19557 This variable is
19558 cleared before any outgoing SMTP connection is made,
19559 and then set to the outgoing cipher suite if one is negotiated. See chapter
19560 <xref linkend="CHAPTLS"/> for details of TLS support and chapter <xref linkend="CHAPsmtptrans"/> for
19561 details of the <command>smtp</command> transport.
19562 </para>
19563 </listitem></varlistentry>
19564 <varlistentry>
19565 <term><varname>$tls_in_ocsp</varname></term>
19566 <listitem>
19567 <para>
19568 <indexterm role="variable">
19569 <primary><varname>$tls_in_ocsp</varname></primary>
19570 </indexterm>
19571 When a message is received from a remote client connection
19572 the result of any OCSP request from the client is encoded in this variable:
19573 </para>
19574 <literallayout class="monospaced">
19575 0 OCSP proof was not requested (default value)
19576 1 No response to request
19577 2 Response not verified
19578 3 Verification failed
19579 4 Verification succeeded
19580 </literallayout>
19581 </listitem></varlistentry>
19582 <varlistentry>
19583 <term><varname>$tls_out_ocsp</varname></term>
19584 <listitem>
19585 <para>
19586 <indexterm role="variable">
19587 <primary><varname>$tls_out_ocsp</varname></primary>
19588 </indexterm>
19589 When a message is sent to a remote host connection
19590 the result of any OCSP request made is encoded in this variable.
19591 See <varname>$tls_in_ocsp</varname> for values.
19592 </para>
19593 </listitem></varlistentry>
19594 <varlistentry>
19595 <term><varname>$tls_in_peerdn</varname></term>
19596 <listitem>
19597 <para>
19598 <indexterm role="variable">
19599 <primary><varname>$tls_in_peerdn</varname></primary>
19600 </indexterm>
19601 <indexterm role="variable">
19602 <primary><varname>$tls_peerdn</varname></primary>
19603 </indexterm>
19604 When a message is received from a remote host over an encrypted SMTP
19605 connection, and Exim is configured to request a certificate from the client,
19606 the value of the Distinguished Name of the certificate is made available in the
19607 <varname>$tls_in_peerdn</varname> during subsequent processing.
19608 </para>
19609 <para revisionflag="changed">
19610 If certificate verification fails it may refer to a failing chain element
19611 which is not the leaf.
19612 </para>
19613 <para>
19614 The deprecated <varname>$tls_peerdn</varname> variable refers to the inbound side
19615 except when used in the context of an outbound SMTP delivery, when it refers to
19616 the outbound.
19617 </para>
19618 </listitem></varlistentry>
19619 <varlistentry>
19620 <term><varname>$tls_out_peerdn</varname></term>
19621 <listitem>
19622 <para>
19623 <indexterm role="variable">
19624 <primary><varname>$tls_out_peerdn</varname></primary>
19625 </indexterm>
19626 When a message is being delivered to a remote host over an encrypted SMTP
19627 connection, and Exim is configured to request a certificate from the server,
19628 the value of the Distinguished Name of the certificate is made available in the
19629 <varname>$tls_out_peerdn</varname> during subsequent processing.
19630 </para>
19631 <para revisionflag="changed">
19632 If certificate verification fails it may refer to a failing chain element
19633 which is not the leaf.
19634 </para>
19635 </listitem></varlistentry>
19636 <varlistentry>
19637 <term><varname>$tls_in_sni</varname></term>
19638 <listitem>
19639 <para>
19640 <indexterm role="variable">
19641 <primary><varname>$tls_in_sni</varname></primary>
19642 </indexterm>
19643 <indexterm role="variable">
19644 <primary><varname>$tls_sni</varname></primary>
19645 </indexterm>
19646 <indexterm role="concept">
19647 <primary>TLS</primary>
19648 <secondary>Server Name Indication</secondary>
19649 </indexterm>
19650 When a TLS session is being established, if the client sends the Server
19651 Name Indication extension, the value will be placed in this variable.
19652 If the variable appears in <option>tls_certificate</option> then this option and
19653 some others, described in <xref linkend="SECTtlssni"/>,
19654 will be re-expanded early in the TLS session, to permit
19655 a different certificate to be presented (and optionally a different key to be
19656 used) to the client, based upon the value of the SNI extension.
19657 </para>
19658 <para>
19659 The deprecated <varname>$tls_sni</varname> variable refers to the inbound side
19660 except when used in the context of an outbound SMTP delivery, when it refers to
19661 the outbound.
19662 </para>
19663 </listitem></varlistentry>
19664 <varlistentry>
19665 <term><varname>$tls_out_sni</varname></term>
19666 <listitem>
19667 <para>
19668 <indexterm role="variable">
19669 <primary><varname>$tls_out_sni</varname></primary>
19670 </indexterm>
19671 <indexterm role="concept">
19672 <primary>TLS</primary>
19673 <secondary>Server Name Indication</secondary>
19674 </indexterm>
19675 During outbound
19676 SMTP deliveries, this variable reflects the value of the <option>tls_sni</option> option on
19677 the transport.
19678 </para>
19679 </listitem></varlistentry>
19680 <varlistentry>
19681 <term><varname>$tod_bsdinbox</varname></term>
19682 <listitem>
19683 <para>
19684 <indexterm role="variable">
19685 <primary><varname>$tod_bsdinbox</varname></primary>
19686 </indexterm>
19687 The time of day and the date, in the format required for BSD-style mailbox
19688 files, for example: Thu Oct 17 17:14:09 1995.
19689 </para>
19690 </listitem></varlistentry>
19691 <varlistentry>
19692 <term><varname>$tod_epoch</varname></term>
19693 <listitem>
19694 <para>
19695 <indexterm role="variable">
19696 <primary><varname>$tod_epoch</varname></primary>
19697 </indexterm>
19698 The time and date as a number of seconds since the start of the Unix epoch.
19699 </para>
19700 </listitem></varlistentry>
19701 <varlistentry>
19702 <term><varname>$tod_epoch_l</varname></term>
19703 <listitem>
19704 <para>
19705 <indexterm role="variable">
19706 <primary><varname>$tod_epoch_l</varname></primary>
19707 </indexterm>
19708 The time and date as a number of microseconds since the start of the Unix epoch.
19709 </para>
19710 </listitem></varlistentry>
19711 <varlistentry>
19712 <term><varname>$tod_full</varname></term>
19713 <listitem>
19714 <para>
19715 <indexterm role="variable">
19716 <primary><varname>$tod_full</varname></primary>
19717 </indexterm>
19718 A full version of the time and date, for example: Wed, 16 Oct 1995 09:51:40
19719 +0100. The timezone is always given as a numerical offset from UTC, with
19720 positive values used for timezones that are ahead (east) of UTC, and negative
19721 values for those that are behind (west).
19722 </para>
19723 </listitem></varlistentry>
19724 <varlistentry>
19725 <term><varname>$tod_log</varname></term>
19726 <listitem>
19727 <para>
19728 <indexterm role="variable">
19729 <primary><varname>$tod_log</varname></primary>
19730 </indexterm>
19731 The time and date in the format used for writing Exim&#x2019;s log files, for example:
19732 1995-10-12 15:32:29, but without a timezone.
19733 </para>
19734 </listitem></varlistentry>
19735 <varlistentry>
19736 <term><varname>$tod_logfile</varname></term>
19737 <listitem>
19738 <para>
19739 <indexterm role="variable">
19740 <primary><varname>$tod_logfile</varname></primary>
19741 </indexterm>
19742 This variable contains the date in the format yyyymmdd. This is the format that
19743 is used for datestamping log files when <option>log_file_path</option> contains the <literal>%D</literal>
19744 flag.
19745 </para>
19746 </listitem></varlistentry>
19747 <varlistentry>
19748 <term><varname>$tod_zone</varname></term>
19749 <listitem>
19750 <para>
19751 <indexterm role="variable">
19752 <primary><varname>$tod_zone</varname></primary>
19753 </indexterm>
19754 This variable contains the numerical value of the local timezone, for example:
19755 -0500.
19756 </para>
19757 </listitem></varlistentry>
19758 <varlistentry>
19759 <term><varname>$tod_zulu</varname></term>
19760 <listitem>
19761 <para>
19762 <indexterm role="variable">
19763 <primary><varname>$tod_zulu</varname></primary>
19764 </indexterm>
19765 This variable contains the UTC date and time in <quote>Zulu</quote> format, as specified
19766 by ISO 8601, for example: 20030221154023Z.
19767 </para>
19768 </listitem></varlistentry>
19769 <varlistentry>
19770 <term><varname>$transport_name</varname></term>
19771 <listitem>
19772 <para>
19773 <indexterm role="concept">
19774 <primary>transport</primary>
19775 <secondary>name</secondary>
19776 </indexterm>
19777 <indexterm role="concept">
19778 <primary>name</primary>
19779 <secondary>of transport</secondary>
19780 </indexterm>
19781 <indexterm role="variable">
19782 <primary><varname>$transport_name</varname></primary>
19783 </indexterm>
19784 During the running of a transport, this variable contains its name.
19785 </para>
19786 </listitem></varlistentry>
19787 <varlistentry>
19788 <term><varname>$value</varname></term>
19789 <listitem>
19790 <para>
19791 <indexterm role="variable">
19792 <primary><varname>$value</varname></primary>
19793 </indexterm>
19794 This variable contains the result of an expansion lookup, extraction operation,
19795 or external command, as described above. It is also used during a
19796 <emphasis role="bold">reduce</emphasis> expansion.
19797 </para>
19798 </listitem></varlistentry>
19799 <varlistentry>
19800 <term><varname>$verify_mode</varname></term>
19801 <listitem>
19802 <para>
19803 <indexterm role="variable">
19804 <primary><varname>$verify_mode</varname></primary>
19805 </indexterm>
19806 While a router or transport is being run in verify mode
19807 or for cutthrough delivery,
19808 contains "S" for sender-verification or "R" for recipient-verification.
19809 Otherwise, empty.
19810 </para>
19811 </listitem></varlistentry>
19812 <varlistentry>
19813 <term><varname>$version_number</varname></term>
19814 <listitem>
19815 <para>
19816 <indexterm role="variable">
19817 <primary><varname>$version_number</varname></primary>
19818 </indexterm>
19819 The version number of Exim.
19820 </para>
19821 </listitem></varlistentry>
19822 <varlistentry>
19823 <term><varname>$warn_message_delay</varname></term>
19824 <listitem>
19825 <para>
19826 <indexterm role="variable">
19827 <primary><varname>$warn_message_delay</varname></primary>
19828 </indexterm>
19829 This variable is set only during the creation of a message warning about a
19830 delivery delay. Details of its use are explained in section <xref linkend="SECTcustwarn"/>.
19831 </para>
19832 </listitem></varlistentry>
19833 <varlistentry>
19834 <term><varname>$warn_message_recipients</varname></term>
19835 <listitem>
19836 <para>
19837 <indexterm role="variable">
19838 <primary><varname>$warn_message_recipients</varname></primary>
19839 </indexterm>
19840 This variable is set only during the creation of a message warning about a
19841 delivery delay. Details of its use are explained in section <xref linkend="SECTcustwarn"/>.
19842 </para>
19843 </listitem></varlistentry>
19844 </variablelist>
19845 <para>
19846 <indexterm role="concept" startref="IIDstrexp" class="endofrange"/>
19847 </para>
19848 </section>
19849 </chapter>
19850
19851 <chapter id="CHAPperl">
19852 <title>Embedded Perl</title>
19853 <para>
19854 <indexterm role="concept" id="IIDperl" class="startofrange">
19855 <primary>Perl</primary>
19856 <secondary>calling from Exim</secondary>
19857 </indexterm>
19858 Exim can be built to include an embedded Perl interpreter. When this is done,
19859 Perl subroutines can be called as part of the string expansion process. To make
19860 use of the Perl support, you need version 5.004 or later of Perl installed on
19861 your system. To include the embedded interpreter in the Exim binary, include
19862 the line
19863 </para>
19864 <literallayout class="monospaced">
19865 EXIM_PERL = perl.o
19866 </literallayout>
19867 <para>
19868 in your <filename>Local/Makefile</filename> and then build Exim in the normal way.
19869 </para>
19870 <section id="SECID85">
19871 <title>Setting up so Perl can be used</title>
19872 <para>
19873 <indexterm role="option">
19874 <primary><option>perl_startup</option></primary>
19875 </indexterm>
19876 Access to Perl subroutines is via a global configuration option called
19877 <option>perl_startup</option> and an expansion string operator <option>${perl ...}</option>. If there is
19878 no <option>perl_startup</option> option in the Exim configuration file then no Perl
19879 interpreter is started and there is almost no overhead for Exim (since none of
19880 the Perl library will be paged in unless used). If there is a <option>perl_startup</option>
19881 option then the associated value is taken to be Perl code which is executed in
19882 a newly created Perl interpreter.
19883 </para>
19884 <para>
19885 The value of <option>perl_startup</option> is not expanded in the Exim sense, so you do not
19886 need backslashes before any characters to escape special meanings. The option
19887 should usually be something like
19888 </para>
19889 <literallayout class="monospaced">
19890 perl_startup = do '/etc/exim.pl'
19891 </literallayout>
19892 <para>
19893 where <filename>/etc/exim.pl</filename> is Perl code which defines any subroutines you want to
19894 use from Exim. Exim can be configured either to start up a Perl interpreter as
19895 soon as it is entered, or to wait until the first time it is needed. Starting
19896 the interpreter at the beginning ensures that it is done while Exim still has
19897 its setuid privilege, but can impose an unnecessary overhead if Perl is not in
19898 fact used in a particular run. Also, note that this does not mean that Exim is
19899 necessarily running as root when Perl is called at a later time. By default,
19900 the interpreter is started only when it is needed, but this can be changed in
19901 two ways:
19902 </para>
19903 <itemizedlist>
19904 <listitem>
19905 <para>
19906 <indexterm role="option">
19907 <primary><option>perl_at_start</option></primary>
19908 </indexterm>
19909 Setting <option>perl_at_start</option> (a boolean option) in the configuration requests
19910 a startup when Exim is entered.
19911 </para>
19912 </listitem>
19913 <listitem>
19914 <para>
19915 The command line option <option>-ps</option> also requests a startup when Exim is entered,
19916 overriding the setting of <option>perl_at_start</option>.
19917 </para>
19918 </listitem>
19919 </itemizedlist>
19920 <para>
19921 There is also a command line option <option>-pd</option> (for delay) which suppresses the
19922 initial startup, even if <option>perl_at_start</option> is set.
19923 </para>
19924 </section>
19925 <section id="SECID86">
19926 <title>Calling Perl subroutines</title>
19927 <para>
19928 When the configuration file includes a <option>perl_startup</option> option you can make use
19929 of the string expansion item to call the Perl subroutines that are defined
19930 by the <option>perl_startup</option> code. The operator is used in any of the following
19931 forms:
19932 </para>
19933 <literallayout class="monospaced">
19934 ${perl{foo}}
19935 ${perl{foo}{argument}}
19936 ${perl{foo}{argument1}{argument2} ... }
19937 </literallayout>
19938 <para>
19939 which calls the subroutine <option>foo</option> with the given arguments. A maximum of eight
19940 arguments may be passed. Passing more than this results in an expansion failure
19941 with an error message of the form
19942 </para>
19943 <literallayout class="monospaced">
19944 Too many arguments passed to Perl subroutine "foo" (max is 8)
19945 </literallayout>
19946 <para>
19947 The return value of the Perl subroutine is evaluated in a scalar context before
19948 it is passed back to Exim to be inserted into the expanded string. If the
19949 return value is <emphasis>undef</emphasis>, the expansion is forced to fail in the same way as
19950 an explicit <quote>fail</quote> on an <option>if</option> or <option>lookup</option> item. If the subroutine aborts
19951 by obeying Perl&#x2019;s <option>die</option> function, the expansion fails with the error message
19952 that was passed to <option>die</option>.
19953 </para>
19954 </section>
19955 <section id="SECID87">
19956 <title>Calling Exim functions from Perl</title>
19957 <para>
19958 Within any Perl code called from Exim, the function <emphasis>Exim::expand_string()</emphasis>
19959 is available to call back into Exim&#x2019;s string expansion function. For example,
19960 the Perl code
19961 </para>
19962 <literallayout class="monospaced">
19963 my $lp = Exim::expand_string('$local_part');
19964 </literallayout>
19965 <para>
19966 makes the current Exim <varname>$local_part</varname> available in the Perl variable <varname>$lp</varname>.
19967 Note those are single quotes and not double quotes to protect against
19968 <varname>$local_part</varname> being interpolated as a Perl variable.
19969 </para>
19970 <para>
19971 If the string expansion is forced to fail by a <quote>fail</quote> item, the result of
19972 <emphasis>Exim::expand_string()</emphasis> is <option>undef</option>. If there is a syntax error in the
19973 expansion string, the Perl call from the original expansion string fails with
19974 an appropriate error message, in the same way as if <option>die</option> were used.
19975 </para>
19976 <para>
19977 <indexterm role="concept">
19978 <primary>debugging</primary>
19979 <secondary>from embedded Perl</secondary>
19980 </indexterm>
19981 <indexterm role="concept">
19982 <primary>log</primary>
19983 <secondary>writing from embedded Perl</secondary>
19984 </indexterm>
19985 Two other Exim functions are available for use from within Perl code.
19986 <emphasis>Exim::debug_write()</emphasis> writes a string to the standard error stream if Exim&#x2019;s
19987 debugging is enabled. If you want a newline at the end, you must supply it.
19988 <emphasis>Exim::log_write()</emphasis> writes a string to Exim&#x2019;s main log, adding a leading
19989 timestamp. In this case, you should not supply a terminating newline.
19990 </para>
19991 </section>
19992 <section id="SECID88">
19993 <title>Use of standard output and error by Perl</title>
19994 <para>
19995 <indexterm role="concept">
19996 <primary>Perl</primary>
19997 <secondary>standard output and error</secondary>
19998 </indexterm>
19999 You should not write to the standard error or output streams from within your
20000 Perl code, as it is not defined how these are set up. In versions of Exim
20001 before 4.50, it is possible for the standard output or error to refer to the
20002 SMTP connection during message reception via the daemon. Writing to this stream
20003 is certain to cause chaos. From Exim 4.50 onwards, the standard output and
20004 error streams are connected to <filename>/dev/null</filename> in the daemon. The chaos is
20005 avoided, but the output is lost.
20006 </para>
20007 <para>
20008 <indexterm role="concept">
20009 <primary>Perl</primary>
20010 <secondary>use of <option>warn</option></secondary>
20011 </indexterm>
20012 The Perl <option>warn</option> statement writes to the standard error stream by default.
20013 Calls to <option>warn</option> may be embedded in Perl modules that you use, but over which
20014 you have no control. When Exim starts up the Perl interpreter, it arranges for
20015 output from the <option>warn</option> statement to be written to the Exim main log. You can
20016 change this by including appropriate Perl magic somewhere in your Perl code.
20017 For example, to discard <option>warn</option> output completely, you need this:
20018 </para>
20019 <literallayout class="monospaced">
20020 $SIG{__WARN__} = sub { };
20021 </literallayout>
20022 <para>
20023 Whenever a <option>warn</option> is obeyed, the anonymous subroutine is called. In this
20024 example, the code for the subroutine is empty, so it does nothing, but you can
20025 include any Perl code that you like. The text of the <option>warn</option> message is passed
20026 as the first subroutine argument.
20027 <indexterm role="concept" startref="IIDperl" class="endofrange"/>
20028 </para>
20029 </section>
20030 </chapter>
20031
20032 <chapter id="CHAPinterfaces">
20033 <title>Starting the daemon and the use of network interfaces</title>
20034 <titleabbrev>Starting the daemon</titleabbrev>
20035 <para>
20036 <indexterm role="concept">
20037 <primary>daemon</primary>
20038 <secondary>starting</secondary>
20039 </indexterm>
20040 <indexterm role="concept">
20041 <primary>interface</primary>
20042 <secondary>listening</secondary>
20043 </indexterm>
20044 <indexterm role="concept">
20045 <primary>network interface</primary>
20046 </indexterm>
20047 <indexterm role="concept">
20048 <primary>interface</primary>
20049 <secondary>network</secondary>
20050 </indexterm>
20051 <indexterm role="concept">
20052 <primary>IP address</primary>
20053 <secondary>for listening</secondary>
20054 </indexterm>
20055 <indexterm role="concept">
20056 <primary>daemon</primary>
20057 <secondary>listening IP addresses</secondary>
20058 </indexterm>
20059 <indexterm role="concept">
20060 <primary>TCP/IP</primary>
20061 <secondary>setting listening interfaces</secondary>
20062 </indexterm>
20063 <indexterm role="concept">
20064 <primary>TCP/IP</primary>
20065 <secondary>setting listening ports</secondary>
20066 </indexterm>
20067 A host that is connected to a TCP/IP network may have one or more physical
20068 hardware network interfaces. Each of these interfaces may be configured as one
20069 or more <quote>logical</quote> interfaces, which are the entities that a program actually
20070 works with. Each of these logical interfaces is associated with an IP address.
20071 In addition, TCP/IP software supports <quote>loopback</quote> interfaces (127.0.0.1 in
20072 IPv4 and ::1 in IPv6), which do not use any physical hardware. Exim requires
20073 knowledge about the host&#x2019;s interfaces for use in three different circumstances:
20074 </para>
20075 <orderedlist numeration="arabic">
20076 <listitem>
20077 <para>
20078 When a listening daemon is started, Exim needs to know which interfaces
20079 and ports to listen on.
20080 </para>
20081 </listitem>
20082 <listitem>
20083 <para>
20084 When Exim is routing an address, it needs to know which IP addresses
20085 are associated with local interfaces. This is required for the correct
20086 processing of MX lists by removing the local host and others with the
20087 same or higher priority values. Also, Exim needs to detect cases
20088 when an address is routed to an IP address that in fact belongs to the
20089 local host. Unless the <option>self</option> router option or the <option>allow_localhost</option>
20090 option of the smtp transport is set (as appropriate), this is treated
20091 as an error situation.
20092 </para>
20093 </listitem>
20094 <listitem>
20095 <para>
20096 When Exim connects to a remote host, it may need to know which interface to use
20097 for the outgoing connection.
20098 </para>
20099 </listitem>
20100 </orderedlist>
20101 <para>
20102 Exim&#x2019;s default behaviour is likely to be appropriate in the vast majority
20103 of cases. If your host has only one interface, and you want all its IP
20104 addresses to be treated in the same way, and you are using only the
20105 standard SMTP port, you should not need to take any special action. The
20106 rest of this chapter does not apply to you.
20107 </para>
20108 <para>
20109 In a more complicated situation you may want to listen only on certain
20110 interfaces, or on different ports, and for this reason there are a number of
20111 options that can be used to influence Exim&#x2019;s behaviour. The rest of this
20112 chapter describes how they operate.
20113 </para>
20114 <para>
20115 When a message is received over TCP/IP, the interface and port that were
20116 actually used are set in <varname>$received_ip_address</varname> and <varname>$received_port</varname>.
20117 </para>
20118 <section id="SECID89">
20119 <title>Starting a listening daemon</title>
20120 <para>
20121 When a listening daemon is started (by means of the <option>-bd</option> command line
20122 option), the interfaces and ports on which it listens are controlled by the
20123 following options:
20124 </para>
20125 <itemizedlist>
20126 <listitem>
20127 <para>
20128 <option>daemon_smtp_ports</option> contains a list of default ports
20129 or service names.
20130 (For backward compatibility, this option can also be specified in the singular.)
20131 </para>
20132 </listitem>
20133 <listitem>
20134 <para>
20135 <option>local_interfaces</option> contains list of interface IP addresses on which to
20136 listen. Each item may optionally also specify a port.
20137 </para>
20138 </listitem>
20139 </itemizedlist>
20140 <para>
20141 The default list separator in both cases is a colon, but this can be changed as
20142 described in section <xref linkend="SECTlistconstruct"/>. When IPv6 addresses are involved,
20143 it is usually best to change the separator to avoid having to double all the
20144 colons. For example:
20145 </para>
20146 <literallayout class="monospaced">
20147 local_interfaces = &lt;; 127.0.0.1 ; \
20148                       192.168.23.65 ; \
20149                       ::1 ; \
20150                       3ffe:ffff:836f::fe86:a061
20151 </literallayout>
20152 <para>
20153 There are two different formats for specifying a port along with an IP address
20154 in <option>local_interfaces</option>:
20155 </para>
20156 <orderedlist numeration="arabic">
20157 <listitem>
20158 <para>
20159 The port is added onto the address with a dot separator. For example, to listen
20160 on port 1234 on two different IP addresses:
20161 </para>
20162 <literallayout class="monospaced">
20163 local_interfaces = &lt;; 192.168.23.65.1234 ; \
20164                       3ffe:ffff:836f::fe86:a061.1234
20165 </literallayout>
20166 </listitem>
20167 <listitem>
20168 <para>
20169 The IP address is enclosed in square brackets, and the port is added
20170 with a colon separator, for example:
20171 </para>
20172 <literallayout class="monospaced">
20173 local_interfaces = &lt;; [192.168.23.65]:1234 ; \
20174                       [3ffe:ffff:836f::fe86:a061]:1234
20175 </literallayout>
20176 </listitem>
20177 </orderedlist>
20178 <para>
20179 When a port is not specified, the value of <option>daemon_smtp_ports</option> is used. The
20180 default setting contains just one port:
20181 </para>
20182 <literallayout class="monospaced">
20183 daemon_smtp_ports = smtp
20184 </literallayout>
20185 <para>
20186 If more than one port is listed, each interface that does not have its own port
20187 specified listens on all of them. Ports that are listed in
20188 <option>daemon_smtp_ports</option> can be identified either by name (defined in
20189 <filename>/etc/services</filename>) or by number. However, when ports are given with individual
20190 IP addresses in <option>local_interfaces</option>, only numbers (not names) can be used.
20191 </para>
20192 </section>
20193 <section id="SECID90">
20194 <title>Special IP listening addresses</title>
20195 <para>
20196 The addresses 0.0.0.0 and ::0 are treated specially. They are interpreted
20197 as <quote>all IPv4 interfaces</quote> and <quote>all IPv6 interfaces</quote>, respectively. In each
20198 case, Exim tells the TCP/IP stack to <quote>listen on all IPv<emphasis>x</emphasis> interfaces</quote>
20199 instead of setting up separate listening sockets for each interface. The
20200 default value of <option>local_interfaces</option> is
20201 </para>
20202 <literallayout class="monospaced">
20203 local_interfaces = 0.0.0.0
20204 </literallayout>
20205 <para>
20206 when Exim is built without IPv6 support; otherwise it is:
20207 </para>
20208 <literallayout class="monospaced">
20209 local_interfaces = &lt;; ::0 ; 0.0.0.0
20210 </literallayout>
20211 <para>
20212 Thus, by default, Exim listens on all available interfaces, on the SMTP port.
20213 </para>
20214 </section>
20215 <section id="SECID91">
20216 <title>Overriding local_interfaces and daemon_smtp_ports</title>
20217 <para>
20218 The <option>-oX</option> command line option can be used to override the values of
20219 <option>daemon_smtp_ports</option> and/or <option>local_interfaces</option> for a particular daemon
20220 instance. Another way of doing this would be to use macros and the <option>-D</option>
20221 option. However, <option>-oX</option> can be used by any admin user, whereas modification of
20222 the runtime configuration by <option>-D</option> is allowed only when the caller is root or
20223 exim.
20224 </para>
20225 <para>
20226 The value of <option>-oX</option> is a list of items. The default colon separator can be
20227 changed in the usual way if required. If there are any items that do not
20228 contain dots or colons (that is, are not IP addresses), the value of
20229 <option>daemon_smtp_ports</option> is replaced by the list of those items. If there are any
20230 items that do contain dots or colons, the value of <option>local_interfaces</option> is
20231 replaced by those items. Thus, for example,
20232 </para>
20233 <literallayout class="monospaced">
20234 -oX 1225
20235 </literallayout>
20236 <para>
20237 overrides <option>daemon_smtp_ports</option>, but leaves <option>local_interfaces</option> unchanged,
20238 whereas
20239 </para>
20240 <literallayout class="monospaced">
20241 -oX 192.168.34.5.1125
20242 </literallayout>
20243 <para>
20244 overrides <option>local_interfaces</option>, leaving <option>daemon_smtp_ports</option> unchanged.
20245 (However, since <option>local_interfaces</option> now contains no items without ports, the
20246 value of <option>daemon_smtp_ports</option> is no longer relevant in this example.)
20247 </para>
20248 </section>
20249 <section id="SECTsupobssmt">
20250 <title>Support for the obsolete SSMTP (or SMTPS) protocol</title>
20251 <para>
20252 <indexterm role="concept">
20253 <primary>ssmtp protocol</primary>
20254 </indexterm>
20255 <indexterm role="concept">
20256 <primary>smtps protocol</primary>
20257 </indexterm>
20258 <indexterm role="concept">
20259 <primary>SMTP</primary>
20260 <secondary>ssmtp protocol</secondary>
20261 </indexterm>
20262 <indexterm role="concept">
20263 <primary>SMTP</primary>
20264 <secondary>smtps protocol</secondary>
20265 </indexterm>
20266 Exim supports the obsolete SSMTP protocol (also known as SMTPS) that was used
20267 before the STARTTLS command was standardized for SMTP. Some legacy clients
20268 still use this protocol. If the <option>tls_on_connect_ports</option> option is set to a
20269 list of port numbers or service names,
20270 connections to those ports must use SSMTP. The most
20271 common use of this option is expected to be
20272 </para>
20273 <literallayout class="monospaced">
20274 tls_on_connect_ports = 465
20275 </literallayout>
20276 <para>
20277 because 465 is the usual port number used by the legacy clients. There is also
20278 a command line option <option>-tls-on-connect</option>, which forces all ports to behave in
20279 this way when a daemon is started.
20280 </para>
20281 <para>
20282 <emphasis role="bold">Warning</emphasis>: Setting <option>tls_on_connect_ports</option> does not of itself cause the
20283 daemon to listen on those ports. You must still specify them in
20284 <option>daemon_smtp_ports</option>, <option>local_interfaces</option>, or the <option>-oX</option> option. (This is
20285 because <option>tls_on_connect_ports</option> applies to <option>inetd</option> connections as well as to
20286 connections via the daemon.)
20287 </para>
20288 </section>
20289 <section id="SECID92">
20290 <title>IPv6 address scopes</title>
20291 <para>
20292 <indexterm role="concept">
20293 <primary>IPv6</primary>
20294 <secondary>address scopes</secondary>
20295 </indexterm>
20296 IPv6 addresses have <quote>scopes</quote>, and a host with multiple hardware interfaces
20297 can, in principle, have the same link-local IPv6 address on different
20298 interfaces. Thus, additional information is needed, over and above the IP
20299 address, to distinguish individual interfaces. A convention of using a
20300 percent sign followed by something (often the interface name) has been
20301 adopted in some cases, leading to addresses like this:
20302 </para>
20303 <literallayout class="monospaced">
20304 fe80::202:b3ff:fe03:45c1%eth0
20305 </literallayout>
20306 <para>
20307 To accommodate this usage, a percent sign followed by an arbitrary string is
20308 allowed at the end of an IPv6 address. By default, Exim calls <function>getaddrinfo()</function>
20309 to convert a textual IPv6 address for actual use. This function recognizes the
20310 percent convention in operating systems that support it, and it processes the
20311 address appropriately. Unfortunately, some older libraries have problems with
20312 <function>getaddrinfo()</function>. If
20313 </para>
20314 <literallayout class="monospaced">
20315 IPV6_USE_INET_PTON=yes
20316 </literallayout>
20317 <para>
20318 is set in <filename>Local/Makefile</filename> (or an OS-dependent Makefile) when Exim is built,
20319 Exim uses <emphasis>inet_pton()</emphasis> to convert a textual IPv6 address for actual use,
20320 instead of <function>getaddrinfo()</function>. (Before version 4.14, it always used this
20321 function.) Of course, this means that the additional functionality of
20322 <function>getaddrinfo()</function> &ndash; recognizing scoped addresses &ndash; is lost.
20323 </para>
20324 </section>
20325 <section id="SECID93">
20326 <title>Disabling IPv6</title>
20327 <para>
20328 <indexterm role="concept">
20329 <primary>IPv6</primary>
20330 <secondary>disabling</secondary>
20331 </indexterm>
20332 Sometimes it happens that an Exim binary that was compiled with IPv6 support is
20333 run on a host whose kernel does not support IPv6. The binary will fall back to
20334 using IPv4, but it may waste resources looking up AAAA records, and trying to
20335 connect to IPv6 addresses, causing delays to mail delivery. If you set the
20336 <indexterm role="option">
20337 <primary><option>disable_ipv6</option></primary>
20338 </indexterm>
20339 <option>disable_ipv6</option> option true, even if the Exim binary has IPv6 support, no IPv6
20340 activities take place. AAAA records are never looked up, and any IPv6 addresses
20341 that are listed in <option>local_interfaces</option>, data for the <command>manualroute</command> router,
20342 etc. are ignored. If IP literals are enabled, the <command>ipliteral</command> router declines
20343 to handle IPv6 literal addresses.
20344 </para>
20345 <para>
20346 On the other hand, when IPv6 is in use, there may be times when you want to
20347 disable it for certain hosts or domains. You can use the <option>dns_ipv4_lookup</option>
20348 option to globally suppress the lookup of AAAA records for specified domains,
20349 and you can use the <option>ignore_target_hosts</option> generic router option to ignore
20350 IPv6 addresses in an individual router.
20351 </para>
20352 </section>
20353 <section id="SECID94">
20354 <title>Examples of starting a listening daemon</title>
20355 <para>
20356 The default case in an IPv6 environment is
20357 </para>
20358 <literallayout class="monospaced">
20359 daemon_smtp_ports = smtp
20360 local_interfaces = &lt;; ::0 ; 0.0.0.0
20361 </literallayout>
20362 <para>
20363 This specifies listening on the smtp port on all IPv6 and IPv4 interfaces.
20364 Either one or two sockets may be used, depending on the characteristics of
20365 the TCP/IP stack. (This is complicated and messy; for more information,
20366 read the comments in the <filename>daemon.c</filename> source file.)
20367 </para>
20368 <para>
20369 To specify listening on ports 25 and 26 on all interfaces:
20370 </para>
20371 <literallayout class="monospaced">
20372 daemon_smtp_ports = 25 : 26
20373 </literallayout>
20374 <para>
20375 (leaving <option>local_interfaces</option> at the default setting) or, more explicitly:
20376 </para>
20377 <literallayout class="monospaced">
20378 local_interfaces = &lt;; ::0.25     ; ::0.26 \
20379                       0.0.0.0.25 ; 0.0.0.0.26
20380 </literallayout>
20381 <para>
20382 To listen on the default port on all IPv4 interfaces, and on port 26 on the
20383 IPv4 loopback address only:
20384 </para>
20385 <literallayout class="monospaced">
20386 local_interfaces = 0.0.0.0 : 127.0.0.1.26
20387 </literallayout>
20388 <para>
20389 To specify listening on the default port on specific interfaces only:
20390 </para>
20391 <literallayout class="monospaced">
20392 local_interfaces = 10.0.0.67 : 192.168.34.67
20393 </literallayout>
20394 <para>
20395 <emphasis role="bold">Warning</emphasis>: Such a setting excludes listening on the loopback interfaces.
20396 </para>
20397 </section>
20398 <section id="SECTreclocipadd">
20399 <title>Recognizing the local host</title>
20400 <para>
20401 The <option>local_interfaces</option> option is also used when Exim needs to determine
20402 whether or not an IP address refers to the local host. That is, the IP
20403 addresses of all the interfaces on which a daemon is listening are always
20404 treated as local.
20405 </para>
20406 <para>
20407 For this usage, port numbers in <option>local_interfaces</option> are ignored. If either of
20408 the items 0.0.0.0 or ::0 are encountered, Exim gets a complete list of
20409 available interfaces from the operating system, and extracts the relevant
20410 (that is, IPv4 or IPv6) addresses to use for checking.
20411 </para>
20412 <para>
20413 Some systems set up large numbers of virtual interfaces in order to provide
20414 many virtual web servers. In this situation, you may want to listen for
20415 email on only a few of the available interfaces, but nevertheless treat all
20416 interfaces as local when routing. You can do this by setting
20417 <option>extra_local_interfaces</option> to a list of IP addresses, possibly including the
20418 <quote>all</quote> wildcard values. These addresses are recognized as local, but are not
20419 used for listening. Consider this example:
20420 </para>
20421 <literallayout class="monospaced">
20422 local_interfaces = &lt;; 127.0.0.1 ; ::1 ; \
20423                       192.168.53.235 ; \
20424                       3ffe:2101:12:1:a00:20ff:fe86:a061
20425
20426 extra_local_interfaces = &lt;; ::0 ; 0.0.0.0
20427 </literallayout>
20428 <para>
20429 The daemon listens on the loopback interfaces and just one IPv4 and one IPv6
20430 address, but all available interface addresses are treated as local when
20431 Exim is routing.
20432 </para>
20433 <para>
20434 In some environments the local host name may be in an MX list, but with an IP
20435 address that is not assigned to any local interface. In other cases it may be
20436 desirable to treat other host names as if they referred to the local host. Both
20437 these cases can be handled by setting the <option>hosts_treat_as_local</option> option.
20438 This contains host names rather than IP addresses. When a host is referenced
20439 during routing, either via an MX record or directly, it is treated as the local
20440 host if its name matches <option>hosts_treat_as_local</option>, or if any of its IP
20441 addresses match <option>local_interfaces</option> or <option>extra_local_interfaces</option>.
20442 </para>
20443 </section>
20444 <section id="SECID95">
20445 <title>Delivering to a remote host</title>
20446 <para>
20447 Delivery to a remote host is handled by the smtp transport. By default, it
20448 allows the system&#x2019;s TCP/IP functions to choose which interface to use (if
20449 there is more than one) when connecting to a remote host. However, the
20450 <option>interface</option> option can be set to specify which interface is used. See the
20451 description of the smtp transport in chapter <xref linkend="CHAPsmtptrans"/> for more
20452 details.
20453 </para>
20454 </section>
20455 </chapter>
20456
20457 <chapter id="CHAPmainconfig">
20458 <title>Main configuration</title>
20459 <para>
20460 <indexterm role="concept" id="IIDconfima" class="startofrange">
20461 <primary>configuration file</primary>
20462 <secondary>main section</secondary>
20463 </indexterm>
20464 <indexterm role="concept" id="IIDmaiconf" class="startofrange">
20465 <primary>main configuration</primary>
20466 </indexterm>
20467 The first part of the run time configuration file contains three types of item:
20468 </para>
20469 <itemizedlist>
20470 <listitem>
20471 <para>
20472 Macro definitions: These lines start with an upper case letter. See section
20473 <xref linkend="SECTmacrodefs"/> for details of macro processing.
20474 </para>
20475 </listitem>
20476 <listitem>
20477 <para>
20478 Named list definitions: These lines start with one of the words <quote>domainlist</quote>,
20479 <quote>hostlist</quote>, <quote>addresslist</quote>, or <quote>localpartlist</quote>. Their use is described in
20480 section <xref linkend="SECTnamedlists"/>.
20481 </para>
20482 </listitem>
20483 <listitem>
20484 <para>
20485 Main configuration settings: Each setting occupies one line of the file
20486 (with possible continuations). If any setting is preceded by the word
20487 <quote>hide</quote>, the <option>-bP</option> command line option displays its value to admin users
20488 only. See section <xref linkend="SECTcos"/> for a description of the syntax of these option
20489 settings.
20490 </para>
20491 </listitem>
20492 </itemizedlist>
20493 <para>
20494 This chapter specifies all the main configuration options, along with their
20495 types and default values. For ease of finding a particular option, they appear
20496 in alphabetical order in section <xref linkend="SECTalomo"/> below. However, because there
20497 are now so many options, they are first listed briefly in functional groups, as
20498 an aid to finding the name of the option you are looking for. Some options are
20499 listed in more than one group.
20500 </para>
20501 <section id="SECID96">
20502 <title>Miscellaneous</title>
20503 <informaltable frame="none">
20504 <tgroup cols="2" colsep="0" rowsep="0">
20505 <colspec colwidth="196pt" align="left"/>
20506 <colspec colwidth="254pt" align="left"/>
20507 <tbody>
20508 <row>
20509 <entry><option>bi_command</option></entry>
20510 <entry>to run for <option>-bi</option> command line option</entry>
20511 </row>
20512 <row>
20513 <entry><option>disable_ipv6</option></entry>
20514 <entry>do no IPv6 processing</entry>
20515 </row>
20516 <row>
20517 <entry><option>keep_malformed</option></entry>
20518 <entry>for broken files &ndash; should not happen</entry>
20519 </row>
20520 <row>
20521 <entry><option>localhost_number</option></entry>
20522 <entry>for unique message ids in clusters</entry>
20523 </row>
20524 <row>
20525 <entry><option>message_body_newlines</option></entry>
20526 <entry>retain newlines in <varname>$message_body</varname></entry>
20527 </row>
20528 <row>
20529 <entry><option>message_body_visible</option></entry>
20530 <entry>how much to show in <varname>$message_body</varname></entry>
20531 </row>
20532 <row>
20533 <entry><option>mua_wrapper</option></entry>
20534 <entry>run in <quote>MUA wrapper</quote> mode</entry>
20535 </row>
20536 <row>
20537 <entry><option>print_topbitchars</option></entry>
20538 <entry>top-bit characters are printing</entry>
20539 </row>
20540 <row>
20541 <entry><option>timezone</option></entry>
20542 <entry>force time zone</entry>
20543 </row>
20544 </tbody>
20545 </tgroup>
20546 </informaltable>
20547 </section>
20548 <section id="SECID97">
20549 <title>Exim parameters</title>
20550 <informaltable frame="none">
20551 <tgroup cols="2" colsep="0" rowsep="0">
20552 <colspec colwidth="196pt" align="left"/>
20553 <colspec colwidth="254pt" align="left"/>
20554 <tbody>
20555 <row>
20556 <entry><option>exim_group</option></entry>
20557 <entry>override compiled-in value</entry>
20558 </row>
20559 <row>
20560 <entry><option>exim_path</option></entry>
20561 <entry>override compiled-in value</entry>
20562 </row>
20563 <row>
20564 <entry><option>exim_user</option></entry>
20565 <entry>override compiled-in value</entry>
20566 </row>
20567 <row>
20568 <entry><option>primary_hostname</option></entry>
20569 <entry>default from <function>uname()</function></entry>
20570 </row>
20571 <row>
20572 <entry><option>split_spool_directory</option></entry>
20573 <entry>use multiple directories</entry>
20574 </row>
20575 <row>
20576 <entry><option>spool_directory</option></entry>
20577 <entry>override compiled-in value</entry>
20578 </row>
20579 </tbody>
20580 </tgroup>
20581 </informaltable>
20582 </section>
20583 <section id="SECID98">
20584 <title>Privilege controls</title>
20585 <informaltable frame="none">
20586 <tgroup cols="2" colsep="0" rowsep="0">
20587 <colspec colwidth="196pt" align="left"/>
20588 <colspec colwidth="254pt" align="left"/>
20589 <tbody>
20590 <row>
20591 <entry><option>admin_groups</option></entry>
20592 <entry>groups that are Exim admin users</entry>
20593 </row>
20594 <row>
20595 <entry><option>deliver_drop_privilege</option></entry>
20596 <entry>drop root for delivery processes</entry>
20597 </row>
20598 <row>
20599 <entry><option>local_from_check</option></entry>
20600 <entry>insert <emphasis>Sender:</emphasis> if necessary</entry>
20601 </row>
20602 <row>
20603 <entry><option>local_from_prefix</option></entry>
20604 <entry>for testing <emphasis>From:</emphasis> for local sender</entry>
20605 </row>
20606 <row>
20607 <entry><option>local_from_suffix</option></entry>
20608 <entry>for testing <emphasis>From:</emphasis> for local sender</entry>
20609 </row>
20610 <row>
20611 <entry><option>local_sender_retain</option></entry>
20612 <entry>keep <emphasis>Sender:</emphasis> from untrusted user</entry>
20613 </row>
20614 <row>
20615 <entry><option>never_users</option></entry>
20616 <entry>do not run deliveries as these</entry>
20617 </row>
20618 <row>
20619 <entry><option>prod_requires_admin</option></entry>
20620 <entry>forced delivery requires admin user</entry>
20621 </row>
20622 <row>
20623 <entry><option>queue_list_requires_admin</option></entry>
20624 <entry>queue listing requires admin user</entry>
20625 </row>
20626 <row>
20627 <entry><option>trusted_groups</option></entry>
20628 <entry>groups that are trusted</entry>
20629 </row>
20630 <row>
20631 <entry><option>trusted_users</option></entry>
20632 <entry>users that are trusted</entry>
20633 </row>
20634 </tbody>
20635 </tgroup>
20636 </informaltable>
20637 </section>
20638 <section id="SECID99">
20639 <title>Logging</title>
20640 <informaltable frame="none">
20641 <tgroup cols="2" colsep="0" rowsep="0">
20642 <colspec colwidth="196pt" align="left"/>
20643 <colspec colwidth="254pt" align="left"/>
20644 <tbody>
20645 <row>
20646 <entry><option>hosts_connection_nolog</option></entry>
20647 <entry>exemption from connect logging</entry>
20648 </row>
20649 <row>
20650 <entry><option>log_file_path</option></entry>
20651 <entry>override compiled-in value</entry>
20652 </row>
20653 <row>
20654 <entry><option>log_selector</option></entry>
20655 <entry>set/unset optional logging</entry>
20656 </row>
20657 <row>
20658 <entry><option>log_timezone</option></entry>
20659 <entry>add timezone to log lines</entry>
20660 </row>
20661 <row>
20662 <entry><option>message_logs</option></entry>
20663 <entry>create per-message logs</entry>
20664 </row>
20665 <row>
20666 <entry><option>preserve_message_logs</option></entry>
20667 <entry>after message completion</entry>
20668 </row>
20669 <row>
20670 <entry><option>process_log_path</option></entry>
20671 <entry>for SIGUSR1 and <emphasis>exiwhat</emphasis></entry>
20672 </row>
20673 <row>
20674 <entry><option>slow_lookup_log</option></entry>
20675 <entry>control logging of slow DNS lookups</entry>
20676 </row>
20677 <row>
20678 <entry><option>syslog_duplication</option></entry>
20679 <entry>controls duplicate log lines on syslog</entry>
20680 </row>
20681 <row>
20682 <entry><option>syslog_facility</option></entry>
20683 <entry>set syslog <quote>facility</quote> field</entry>
20684 </row>
20685 <row>
20686 <entry><option>syslog_processname</option></entry>
20687 <entry>set syslog <quote>ident</quote> field</entry>
20688 </row>
20689 <row>
20690 <entry><option>syslog_timestamp</option></entry>
20691 <entry>timestamp syslog lines</entry>
20692 </row>
20693 <row>
20694 <entry><option>write_rejectlog</option></entry>
20695 <entry>control use of message log</entry>
20696 </row>
20697 </tbody>
20698 </tgroup>
20699 </informaltable>
20700 </section>
20701 <section id="SECID100">
20702 <title>Frozen messages</title>
20703 <informaltable frame="none">
20704 <tgroup cols="2" colsep="0" rowsep="0">
20705 <colspec colwidth="196pt" align="left"/>
20706 <colspec colwidth="254pt" align="left"/>
20707 <tbody>
20708 <row>
20709 <entry><option>auto_thaw</option></entry>
20710 <entry>sets time for retrying frozen messages</entry>
20711 </row>
20712 <row>
20713 <entry><option>freeze_tell</option></entry>
20714 <entry>send message when freezing</entry>
20715 </row>
20716 <row>
20717 <entry><option>move_frozen_messages</option></entry>
20718 <entry>to another directory</entry>
20719 </row>
20720 <row>
20721 <entry><option>timeout_frozen_after</option></entry>
20722 <entry>keep frozen messages only so long</entry>
20723 </row>
20724 </tbody>
20725 </tgroup>
20726 </informaltable>
20727 </section>
20728 <section id="SECID101">
20729 <title>Data lookups</title>
20730 <informaltable frame="none">
20731 <tgroup cols="2" colsep="0" rowsep="0">
20732 <colspec colwidth="196pt" align="left"/>
20733 <colspec colwidth="254pt" align="left"/>
20734 <tbody>
20735 <row>
20736 <entry><option>ibase_servers</option></entry>
20737 <entry>InterBase servers</entry>
20738 </row>
20739 <row>
20740 <entry><option>ldap_ca_cert_dir</option></entry>
20741 <entry>dir of CA certs to verify LDAP server&#x2019;s</entry>
20742 </row>
20743 <row>
20744 <entry><option>ldap_ca_cert_file</option></entry>
20745 <entry>file of CA certs to verify LDAP server&#x2019;s</entry>
20746 </row>
20747 <row>
20748 <entry><option>ldap_cert_file</option></entry>
20749 <entry>client cert file for LDAP</entry>
20750 </row>
20751 <row>
20752 <entry><option>ldap_cert_key</option></entry>
20753 <entry>client key file for LDAP</entry>
20754 </row>
20755 <row>
20756 <entry><option>ldap_cipher_suite</option></entry>
20757 <entry>TLS negotiation preference control</entry>
20758 </row>
20759 <row>
20760 <entry><option>ldap_default_servers</option></entry>
20761 <entry>used if no server in query</entry>
20762 </row>
20763 <row>
20764 <entry><option>ldap_require_cert</option></entry>
20765 <entry>action to take without LDAP server cert</entry>
20766 </row>
20767 <row>
20768 <entry><option>ldap_start_tls</option></entry>
20769 <entry>require TLS within LDAP</entry>
20770 </row>
20771 <row>
20772 <entry><option>ldap_version</option></entry>
20773 <entry>set protocol version</entry>
20774 </row>
20775 <row>
20776 <entry><option>lookup_open_max</option></entry>
20777 <entry>lookup files held open</entry>
20778 </row>
20779 <row>
20780 <entry><option>mysql_servers</option></entry>
20781 <entry>default MySQL servers</entry>
20782 </row>
20783 <row>
20784 <entry><option>oracle_servers</option></entry>
20785 <entry>Oracle servers</entry>
20786 </row>
20787 <row>
20788 <entry><option>pgsql_servers</option></entry>
20789 <entry>default PostgreSQL servers</entry>
20790 </row>
20791 <row>
20792 <entry><option>sqlite_lock_timeout</option></entry>
20793 <entry>as it says</entry>
20794 </row>
20795 </tbody>
20796 </tgroup>
20797 </informaltable>
20798 </section>
20799 <section id="SECID102">
20800 <title>Message ids</title>
20801 <informaltable frame="none">
20802 <tgroup cols="2" colsep="0" rowsep="0">
20803 <colspec colwidth="196pt" align="left"/>
20804 <colspec colwidth="254pt" align="left"/>
20805 <tbody>
20806 <row>
20807 <entry><option>message_id_header_domain</option></entry>
20808 <entry>used to build <emphasis>Message-ID:</emphasis> header</entry>
20809 </row>
20810 <row>
20811 <entry><option>message_id_header_text</option></entry>
20812 <entry>ditto</entry>
20813 </row>
20814 </tbody>
20815 </tgroup>
20816 </informaltable>
20817 </section>
20818 <section id="SECID103">
20819 <title>Embedded Perl Startup</title>
20820 <informaltable frame="none">
20821 <tgroup cols="2" colsep="0" rowsep="0">
20822 <colspec colwidth="196pt" align="left"/>
20823 <colspec colwidth="254pt" align="left"/>
20824 <tbody>
20825 <row>
20826 <entry><option>perl_at_start</option></entry>
20827 <entry>always start the interpreter</entry>
20828 </row>
20829 <row>
20830 <entry><option>perl_startup</option></entry>
20831 <entry>code to obey when starting Perl</entry>
20832 </row>
20833 </tbody>
20834 </tgroup>
20835 </informaltable>
20836 </section>
20837 <section id="SECID104">
20838 <title>Daemon</title>
20839 <informaltable frame="none">
20840 <tgroup cols="2" colsep="0" rowsep="0">
20841 <colspec colwidth="196pt" align="left"/>
20842 <colspec colwidth="254pt" align="left"/>
20843 <tbody>
20844 <row>
20845 <entry><option>daemon_smtp_ports</option></entry>
20846 <entry>default ports</entry>
20847 </row>
20848 <row>
20849 <entry><option>daemon_startup_retries</option></entry>
20850 <entry>number of times to retry</entry>
20851 </row>
20852 <row>
20853 <entry><option>daemon_startup_sleep</option></entry>
20854 <entry>time to sleep between tries</entry>
20855 </row>
20856 <row>
20857 <entry><option>extra_local_interfaces</option></entry>
20858 <entry>not necessarily listened on</entry>
20859 </row>
20860 <row>
20861 <entry><option>local_interfaces</option></entry>
20862 <entry>on which to listen, with optional ports</entry>
20863 </row>
20864 <row>
20865 <entry><option>pid_file_path</option></entry>
20866 <entry>override compiled-in value</entry>
20867 </row>
20868 <row>
20869 <entry><option>queue_run_max</option></entry>
20870 <entry>maximum simultaneous queue runners</entry>
20871 </row>
20872 </tbody>
20873 </tgroup>
20874 </informaltable>
20875 </section>
20876 <section id="SECID105">
20877 <title>Resource control</title>
20878 <informaltable frame="none">
20879 <tgroup cols="2" colsep="0" rowsep="0">
20880 <colspec colwidth="196pt" align="left"/>
20881 <colspec colwidth="254pt" align="left"/>
20882 <tbody>
20883 <row>
20884 <entry><option>check_log_inodes</option></entry>
20885 <entry>before accepting a message</entry>
20886 </row>
20887 <row>
20888 <entry><option>check_log_space</option></entry>
20889 <entry>before accepting a message</entry>
20890 </row>
20891 <row>
20892 <entry><option>check_spool_inodes</option></entry>
20893 <entry>before accepting a message</entry>
20894 </row>
20895 <row>
20896 <entry><option>check_spool_space</option></entry>
20897 <entry>before accepting a message</entry>
20898 </row>
20899 <row>
20900 <entry><option>deliver_queue_load_max</option></entry>
20901 <entry>no queue deliveries if load high</entry>
20902 </row>
20903 <row>
20904 <entry><option>queue_only_load</option></entry>
20905 <entry>queue incoming if load high</entry>
20906 </row>
20907 <row>
20908 <entry><option>queue_only_load_latch</option></entry>
20909 <entry>don&#x2019;t re-evaluate load for each message</entry>
20910 </row>
20911 <row>
20912 <entry><option>queue_run_max</option></entry>
20913 <entry>maximum simultaneous queue runners</entry>
20914 </row>
20915 <row>
20916 <entry><option>remote_max_parallel</option></entry>
20917 <entry>parallel SMTP delivery per message</entry>
20918 </row>
20919 <row>
20920 <entry><option>smtp_accept_max</option></entry>
20921 <entry>simultaneous incoming connections</entry>
20922 </row>
20923 <row>
20924 <entry><option>smtp_accept_max_nonmail</option></entry>
20925 <entry>non-mail commands</entry>
20926 </row>
20927 <row>
20928 <entry><option>smtp_accept_max_nonmail_hosts</option></entry>
20929 <entry>hosts to which the limit applies</entry>
20930 </row>
20931 <row>
20932 <entry><option>smtp_accept_max_per_connection</option></entry>
20933 <entry>messages per connection</entry>
20934 </row>
20935 <row>
20936 <entry><option>smtp_accept_max_per_host</option></entry>
20937 <entry>connections from one host</entry>
20938 </row>
20939 <row>
20940 <entry><option>smtp_accept_queue</option></entry>
20941 <entry>queue mail if more connections</entry>
20942 </row>
20943 <row>
20944 <entry><option>smtp_accept_queue_per_connection</option></entry>
20945 <entry>queue if more messages per connection</entry>
20946 </row>
20947 <row>
20948 <entry><option>smtp_accept_reserve</option></entry>
20949 <entry>only reserve hosts if more connections</entry>
20950 </row>
20951 <row>
20952 <entry><option>smtp_check_spool_space</option></entry>
20953 <entry>from SIZE on MAIL command</entry>
20954 </row>
20955 <row>
20956 <entry><option>smtp_connect_backlog</option></entry>
20957 <entry>passed to TCP/IP stack</entry>
20958 </row>
20959 <row>
20960 <entry><option>smtp_load_reserve</option></entry>
20961 <entry>SMTP from reserved hosts if load high</entry>
20962 </row>
20963 <row>
20964 <entry><option>smtp_reserve_hosts</option></entry>
20965 <entry>these are the reserve hosts</entry>
20966 </row>
20967 </tbody>
20968 </tgroup>
20969 </informaltable>
20970 </section>
20971 <section id="SECID106">
20972 <title>Policy controls</title>
20973 <informaltable frame="none">
20974 <tgroup cols="2" colsep="0" rowsep="0">
20975 <colspec colwidth="196pt" align="left"/>
20976 <colspec colwidth="254pt" align="left"/>
20977 <tbody>
20978 <row>
20979 <entry><option>acl_not_smtp</option></entry>
20980 <entry>ACL for non-SMTP messages</entry>
20981 </row>
20982 <row>
20983 <entry><option>acl_not_smtp_mime</option></entry>
20984 <entry>ACL for non-SMTP MIME parts</entry>
20985 </row>
20986 <row>
20987 <entry><option>acl_not_smtp_start</option></entry>
20988 <entry>ACL for start of non-SMTP message</entry>
20989 </row>
20990 <row>
20991 <entry><option>acl_smtp_auth</option></entry>
20992 <entry>ACL for AUTH</entry>
20993 </row>
20994 <row>
20995 <entry><option>acl_smtp_connect</option></entry>
20996 <entry>ACL for connection</entry>
20997 </row>
20998 <row>
20999 <entry><option>acl_smtp_data</option></entry>
21000 <entry>ACL for DATA</entry>
21001 </row>
21002 <row>
21003 <entry><option>acl_smtp_data_prdr</option></entry>
21004 <entry>ACL for DATA, per-recipient</entry>
21005 </row>
21006 <row>
21007 <entry><option>acl_smtp_dkim</option></entry>
21008 <entry>ACL for DKIM verification</entry>
21009 </row>
21010 <row>
21011 <entry><option>acl_smtp_etrn</option></entry>
21012 <entry>ACL for ETRN</entry>
21013 </row>
21014 <row>
21015 <entry><option>acl_smtp_expn</option></entry>
21016 <entry>ACL for EXPN</entry>
21017 </row>
21018 <row>
21019 <entry><option>acl_smtp_helo</option></entry>
21020 <entry>ACL for EHLO or HELO</entry>
21021 </row>
21022 <row>
21023 <entry><option>acl_smtp_mail</option></entry>
21024 <entry>ACL for MAIL</entry>
21025 </row>
21026 <row>
21027 <entry><option>acl_smtp_mailauth</option></entry>
21028 <entry>ACL for AUTH on MAIL command</entry>
21029 </row>
21030 <row>
21031 <entry><option>acl_smtp_mime</option></entry>
21032 <entry>ACL for MIME parts</entry>
21033 </row>
21034 <row>
21035 <entry><option>acl_smtp_notquit</option></entry>
21036 <entry>ACL for non-QUIT terminations</entry>
21037 </row>
21038 <row>
21039 <entry><option>acl_smtp_predata</option></entry>
21040 <entry>ACL for start of data</entry>
21041 </row>
21042 <row>
21043 <entry><option>acl_smtp_quit</option></entry>
21044 <entry>ACL for QUIT</entry>
21045 </row>
21046 <row>
21047 <entry><option>acl_smtp_rcpt</option></entry>
21048 <entry>ACL for RCPT</entry>
21049 </row>
21050 <row>
21051 <entry><option>acl_smtp_starttls</option></entry>
21052 <entry>ACL for STARTTLS</entry>
21053 </row>
21054 <row>
21055 <entry><option>acl_smtp_vrfy</option></entry>
21056 <entry>ACL for VRFY</entry>
21057 </row>
21058 <row>
21059 <entry><option>av_scanner</option></entry>
21060 <entry>specify virus scanner</entry>
21061 </row>
21062 <row>
21063 <entry><option>check_rfc2047_length</option></entry>
21064 <entry>check length of RFC 2047 <quote>encoded words</quote></entry>
21065 </row>
21066 <row>
21067 <entry><option>dns_csa_search_limit</option></entry>
21068 <entry>control CSA parent search depth</entry>
21069 </row>
21070 <row>
21071 <entry><option>dns_csa_use_reverse</option></entry>
21072 <entry>en/disable CSA IP reverse search</entry>
21073 </row>
21074 <row>
21075 <entry><option>header_maxsize</option></entry>
21076 <entry>total size of message header</entry>
21077 </row>
21078 <row>
21079 <entry><option>header_line_maxsize</option></entry>
21080 <entry>individual header line limit</entry>
21081 </row>
21082 <row>
21083 <entry><option>helo_accept_junk_hosts</option></entry>
21084 <entry>allow syntactic junk from these hosts</entry>
21085 </row>
21086 <row>
21087 <entry><option>helo_allow_chars</option></entry>
21088 <entry>allow illegal chars in HELO names</entry>
21089 </row>
21090 <row>
21091 <entry><option>helo_lookup_domains</option></entry>
21092 <entry>lookup hostname for these HELO names</entry>
21093 </row>
21094 <row>
21095 <entry><option>helo_try_verify_hosts</option></entry>
21096 <entry>HELO soft-checked for these hosts</entry>
21097 </row>
21098 <row>
21099 <entry><option>helo_verify_hosts</option></entry>
21100 <entry>HELO hard-checked for these hosts</entry>
21101 </row>
21102 <row>
21103 <entry><option>host_lookup</option></entry>
21104 <entry>host name looked up for these hosts</entry>
21105 </row>
21106 <row>
21107 <entry><option>host_lookup_order</option></entry>
21108 <entry>order of DNS and local name lookups</entry>
21109 </row>
21110 <row>
21111 <entry><option>host_reject_connection</option></entry>
21112 <entry>reject connection from these hosts</entry>
21113 </row>
21114 <row>
21115 <entry><option>hosts_treat_as_local</option></entry>
21116 <entry>useful in some cluster configurations</entry>
21117 </row>
21118 <row>
21119 <entry><option>local_scan_timeout</option></entry>
21120 <entry>timeout for <function>local_scan()</function></entry>
21121 </row>
21122 <row>
21123 <entry><option>message_size_limit</option></entry>
21124 <entry>for all messages</entry>
21125 </row>
21126 <row>
21127 <entry><option>percent_hack_domains</option></entry>
21128 <entry>recognize %-hack for these domains</entry>
21129 </row>
21130 <row>
21131 <entry><option>spamd_address</option></entry>
21132 <entry>set interface to SpamAssassin</entry>
21133 </row>
21134 <row>
21135 <entry><option>strict_acl_vars</option></entry>
21136 <entry>object to unset ACL variables</entry>
21137 </row>
21138 </tbody>
21139 </tgroup>
21140 </informaltable>
21141 </section>
21142 <section id="SECID107">
21143 <title>Callout cache</title>
21144 <informaltable frame="none">
21145 <tgroup cols="2" colsep="0" rowsep="0">
21146 <colspec colwidth="196pt" align="left"/>
21147 <colspec colwidth="254pt" align="left"/>
21148 <tbody>
21149 <row>
21150 <entry><option>callout_domain_negative_expire</option></entry>
21151 <entry>timeout for negative domain cache item</entry>
21152 </row>
21153 <row>
21154 <entry><option>callout_domain_positive_expire</option></entry>
21155 <entry>timeout for positive domain cache item</entry>
21156 </row>
21157 <row>
21158 <entry><option>callout_negative_expire</option></entry>
21159 <entry>timeout for negative address cache item</entry>
21160 </row>
21161 <row>
21162 <entry><option>callout_positive_expire</option></entry>
21163 <entry>timeout for positive address cache item</entry>
21164 </row>
21165 <row>
21166 <entry><option>callout_random_local_part</option></entry>
21167 <entry>string to use for <quote>random</quote> testing</entry>
21168 </row>
21169 </tbody>
21170 </tgroup>
21171 </informaltable>
21172 </section>
21173 <section id="SECID108">
21174 <title>TLS</title>
21175 <informaltable frame="none">
21176 <tgroup cols="2" colsep="0" rowsep="0">
21177 <colspec colwidth="196pt" align="left"/>
21178 <colspec colwidth="254pt" align="left"/>
21179 <tbody>
21180 <row>
21181 <entry><option>gnutls_compat_mode</option></entry>
21182 <entry>use GnuTLS compatibility mode</entry>
21183 </row>
21184 <row>
21185 <entry><option>gnutls_allow_auto_pkcs11</option></entry>
21186 <entry>allow GnuTLS to autoload PKCS11 modules</entry>
21187 </row>
21188 <row>
21189 <entry><option>openssl_options</option></entry>
21190 <entry>adjust OpenSSL compatibility options</entry>
21191 </row>
21192 <row>
21193 <entry><option>tls_advertise_hosts</option></entry>
21194 <entry>advertise TLS to these hosts</entry>
21195 </row>
21196 <row>
21197 <entry><option>tls_certificate</option></entry>
21198 <entry>location of server certificate</entry>
21199 </row>
21200 <row>
21201 <entry><option>tls_crl</option></entry>
21202 <entry>certificate revocation list</entry>
21203 </row>
21204 <row>
21205 <entry><option>tls_dh_max_bits</option></entry>
21206 <entry>clamp D-H bit count suggestion</entry>
21207 </row>
21208 <row>
21209 <entry><option>tls_dhparam</option></entry>
21210 <entry>DH parameters for server</entry>
21211 </row>
21212 <row>
21213 <entry><option>tls_eccurve</option></entry>
21214 <entry>EC curve selection for server</entry>
21215 </row>
21216 <row>
21217 <entry><option>tls_ocsp_file</option></entry>
21218 <entry>location of server certificate status proof</entry>
21219 </row>
21220 <row>
21221 <entry><option>tls_on_connect_ports</option></entry>
21222 <entry>specify SSMTP (SMTPS) ports</entry>
21223 </row>
21224 <row>
21225 <entry><option>tls_privatekey</option></entry>
21226 <entry>location of server private key</entry>
21227 </row>
21228 <row>
21229 <entry><option>tls_remember_esmtp</option></entry>
21230 <entry>don&#x2019;t reset after starting TLS</entry>
21231 </row>
21232 <row>
21233 <entry><option>tls_require_ciphers</option></entry>
21234 <entry>specify acceptable ciphers</entry>
21235 </row>
21236 <row>
21237 <entry><option>tls_try_verify_hosts</option></entry>
21238 <entry>try to verify client certificate</entry>
21239 </row>
21240 <row>
21241 <entry><option>tls_verify_certificates</option></entry>
21242 <entry>expected client certificates</entry>
21243 </row>
21244 <row>
21245 <entry><option>tls_verify_hosts</option></entry>
21246 <entry>insist on client certificate verify</entry>
21247 </row>
21248 </tbody>
21249 </tgroup>
21250 </informaltable>
21251 </section>
21252 <section id="SECID109">
21253 <title>Local user handling</title>
21254 <informaltable frame="none">
21255 <tgroup cols="2" colsep="0" rowsep="0">
21256 <colspec colwidth="196pt" align="left"/>
21257 <colspec colwidth="254pt" align="left"/>
21258 <tbody>
21259 <row>
21260 <entry><option>finduser_retries</option></entry>
21261 <entry>useful in NIS environments</entry>
21262 </row>
21263 <row>
21264 <entry><option>gecos_name</option></entry>
21265 <entry>used when creating <emphasis>Sender:</emphasis></entry>
21266 </row>
21267 <row>
21268 <entry><option>gecos_pattern</option></entry>
21269 <entry>ditto</entry>
21270 </row>
21271 <row>
21272 <entry><option>max_username_length</option></entry>
21273 <entry>for systems that truncate</entry>
21274 </row>
21275 <row>
21276 <entry><option>unknown_login</option></entry>
21277 <entry>used when no login name found</entry>
21278 </row>
21279 <row>
21280 <entry><option>unknown_username</option></entry>
21281 <entry>ditto</entry>
21282 </row>
21283 <row>
21284 <entry><option>uucp_from_pattern</option></entry>
21285 <entry>for recognizing <quote>From </quote> lines</entry>
21286 </row>
21287 <row>
21288 <entry><option>uucp_from_sender</option></entry>
21289 <entry>ditto</entry>
21290 </row>
21291 </tbody>
21292 </tgroup>
21293 </informaltable>
21294 </section>
21295 <section id="SECID110">
21296 <title>All incoming messages (SMTP and non-SMTP)</title>
21297 <informaltable frame="none">
21298 <tgroup cols="2" colsep="0" rowsep="0">
21299 <colspec colwidth="196pt" align="left"/>
21300 <colspec colwidth="254pt" align="left"/>
21301 <tbody>
21302 <row>
21303 <entry><option>header_maxsize</option></entry>
21304 <entry>total size of message header</entry>
21305 </row>
21306 <row>
21307 <entry><option>header_line_maxsize</option></entry>
21308 <entry>individual header line limit</entry>
21309 </row>
21310 <row>
21311 <entry><option>message_size_limit</option></entry>
21312 <entry>applies to all messages</entry>
21313 </row>
21314 <row>
21315 <entry><option>percent_hack_domains</option></entry>
21316 <entry>recognize %-hack for these domains</entry>
21317 </row>
21318 <row>
21319 <entry><option>received_header_text</option></entry>
21320 <entry>expanded to make <emphasis>Received:</emphasis></entry>
21321 </row>
21322 <row>
21323 <entry><option>received_headers_max</option></entry>
21324 <entry>for mail loop detection</entry>
21325 </row>
21326 <row>
21327 <entry><option>recipients_max</option></entry>
21328 <entry>limit per message</entry>
21329 </row>
21330 <row>
21331 <entry><option>recipients_max_reject</option></entry>
21332 <entry>permanently reject excess recipients</entry>
21333 </row>
21334 </tbody>
21335 </tgroup>
21336 </informaltable>
21337 </section>
21338 <section id="SECID111">
21339 <title>Non-SMTP incoming messages</title>
21340 <informaltable frame="none">
21341 <tgroup cols="2" colsep="0" rowsep="0">
21342 <colspec colwidth="196pt" align="left"/>
21343 <colspec colwidth="254pt" align="left"/>
21344 <tbody>
21345 <row>
21346 <entry><option>receive_timeout</option></entry>
21347 <entry>for non-SMTP messages</entry>
21348 </row>
21349 </tbody>
21350 </tgroup>
21351 </informaltable>
21352 </section>
21353 <section id="SECID112">
21354 <title>Incoming SMTP messages</title>
21355 <para>
21356 See also the <emphasis>Policy controls</emphasis> section above.
21357 </para>
21358 <informaltable frame="none">
21359 <tgroup cols="2" colsep="0" rowsep="0">
21360 <colspec colwidth="196pt" align="left"/>
21361 <colspec colwidth="254pt" align="left"/>
21362 <tbody>
21363 <row>
21364 <entry><option>dkim_verify_signers</option></entry>
21365 <entry>DKIM domain for which DKIM ACL is run</entry>
21366 </row>
21367 <row>
21368 <entry><option>host_lookup</option></entry>
21369 <entry>host name looked up for these hosts</entry>
21370 </row>
21371 <row>
21372 <entry><option>host_lookup_order</option></entry>
21373 <entry>order of DNS and local name lookups</entry>
21374 </row>
21375 <row>
21376 <entry><option>recipient_unqualified_hosts</option></entry>
21377 <entry>may send unqualified recipients</entry>
21378 </row>
21379 <row>
21380 <entry><option>rfc1413_hosts</option></entry>
21381 <entry>make ident calls to these hosts</entry>
21382 </row>
21383 <row>
21384 <entry><option>rfc1413_query_timeout</option></entry>
21385 <entry>zero disables ident calls</entry>
21386 </row>
21387 <row>
21388 <entry><option>sender_unqualified_hosts</option></entry>
21389 <entry>may send unqualified senders</entry>
21390 </row>
21391 <row>
21392 <entry><option>smtp_accept_keepalive</option></entry>
21393 <entry>some TCP/IP magic</entry>
21394 </row>
21395 <row>
21396 <entry><option>smtp_accept_max</option></entry>
21397 <entry>simultaneous incoming connections</entry>
21398 </row>
21399 <row>
21400 <entry><option>smtp_accept_max_nonmail</option></entry>
21401 <entry>non-mail commands</entry>
21402 </row>
21403 <row>
21404 <entry><option>smtp_accept_max_nonmail_hosts</option></entry>
21405 <entry>hosts to which the limit applies</entry>
21406 </row>
21407 <row>
21408 <entry><option>smtp_accept_max_per_connection</option></entry>
21409 <entry>messages per connection</entry>
21410 </row>
21411 <row>
21412 <entry><option>smtp_accept_max_per_host</option></entry>
21413 <entry>connections from one host</entry>
21414 </row>
21415 <row>
21416 <entry><option>smtp_accept_queue</option></entry>
21417 <entry>queue mail if more connections</entry>
21418 </row>
21419 <row>
21420 <entry><option>smtp_accept_queue_per_connection</option></entry>
21421 <entry>queue if more messages per connection</entry>
21422 </row>
21423 <row>
21424 <entry><option>smtp_accept_reserve</option></entry>
21425 <entry>only reserve hosts if more connections</entry>
21426 </row>
21427 <row>
21428 <entry><option>smtp_active_hostname</option></entry>
21429 <entry>host name to use in messages</entry>
21430 </row>
21431 <row>
21432 <entry><option>smtp_banner</option></entry>
21433 <entry>text for welcome banner</entry>
21434 </row>
21435 <row>
21436 <entry><option>smtp_check_spool_space</option></entry>
21437 <entry>from SIZE on MAIL command</entry>
21438 </row>
21439 <row>
21440 <entry><option>smtp_connect_backlog</option></entry>
21441 <entry>passed to TCP/IP stack</entry>
21442 </row>
21443 <row>
21444 <entry><option>smtp_enforce_sync</option></entry>
21445 <entry>of SMTP command/responses</entry>
21446 </row>
21447 <row>
21448 <entry><option>smtp_etrn_command</option></entry>
21449 <entry>what to run for ETRN</entry>
21450 </row>
21451 <row>
21452 <entry><option>smtp_etrn_serialize</option></entry>
21453 <entry>only one at once</entry>
21454 </row>
21455 <row>
21456 <entry><option>smtp_load_reserve</option></entry>
21457 <entry>only reserve hosts if this load</entry>
21458 </row>
21459 <row>
21460 <entry><option>smtp_max_unknown_commands</option></entry>
21461 <entry>before dropping connection</entry>
21462 </row>
21463 <row>
21464 <entry><option>smtp_ratelimit_hosts</option></entry>
21465 <entry>apply ratelimiting to these hosts</entry>
21466 </row>
21467 <row>
21468 <entry><option>smtp_ratelimit_mail</option></entry>
21469 <entry>ratelimit for MAIL commands</entry>
21470 </row>
21471 <row>
21472 <entry><option>smtp_ratelimit_rcpt</option></entry>
21473 <entry>ratelimit for RCPT commands</entry>
21474 </row>
21475 <row>
21476 <entry><option>smtp_receive_timeout</option></entry>
21477 <entry>per command or data line</entry>
21478 </row>
21479 <row>
21480 <entry><option>smtp_reserve_hosts</option></entry>
21481 <entry>these are the reserve hosts</entry>
21482 </row>
21483 <row>
21484 <entry><option>smtp_return_error_details</option></entry>
21485 <entry>give detail on rejections</entry>
21486 </row>
21487 </tbody>
21488 </tgroup>
21489 </informaltable>
21490 </section>
21491 <section id="SECID113">
21492 <title>SMTP extensions</title>
21493 <informaltable frame="none">
21494 <tgroup cols="2" colsep="0" rowsep="0">
21495 <colspec colwidth="196pt" align="left"/>
21496 <colspec colwidth="254pt" align="left"/>
21497 <tbody>
21498 <row>
21499 <entry><option>accept_8bitmime</option></entry>
21500 <entry>advertise 8BITMIME</entry>
21501 </row>
21502 <row>
21503 <entry><option>auth_advertise_hosts</option></entry>
21504 <entry>advertise AUTH to these hosts</entry>
21505 </row>
21506 <row>
21507 <entry><option>dsn_advertise_hosts</option></entry>
21508 <entry>advertise DSN extensions to these hosts</entry>
21509 </row>
21510 <row>
21511 <entry><option>ignore_fromline_hosts</option></entry>
21512 <entry>allow <quote>From </quote> from these hosts</entry>
21513 </row>
21514 <row>
21515 <entry><option>ignore_fromline_local</option></entry>
21516 <entry>allow <quote>From </quote> from local SMTP</entry>
21517 </row>
21518 <row>
21519 <entry><option>pipelining_advertise_hosts</option></entry>
21520 <entry>advertise pipelining to these hosts</entry>
21521 </row>
21522 <row>
21523 <entry><option>prdr_enable</option></entry>
21524 <entry>advertise PRDR to all hosts</entry>
21525 </row>
21526 <row>
21527 <entry><option>tls_advertise_hosts</option></entry>
21528 <entry>advertise TLS to these hosts</entry>
21529 </row>
21530 </tbody>
21531 </tgroup>
21532 </informaltable>
21533 </section>
21534 <section id="SECID114">
21535 <title>Processing messages</title>
21536 <informaltable frame="none">
21537 <tgroup cols="2" colsep="0" rowsep="0">
21538 <colspec colwidth="196pt" align="left"/>
21539 <colspec colwidth="254pt" align="left"/>
21540 <tbody>
21541 <row>
21542 <entry><option>allow_domain_literals</option></entry>
21543 <entry>recognize domain literal syntax</entry>
21544 </row>
21545 <row>
21546 <entry><option>allow_mx_to_ip</option></entry>
21547 <entry>allow MX to point to IP address</entry>
21548 </row>
21549 <row>
21550 <entry><option>allow_utf8_domains</option></entry>
21551 <entry>in addresses</entry>
21552 </row>
21553 <row>
21554 <entry><option>check_rfc2047_length</option></entry>
21555 <entry>check length of RFC 2047 <quote>encoded words</quote></entry>
21556 </row>
21557 <row>
21558 <entry><option>delivery_date_remove</option></entry>
21559 <entry>from incoming messages</entry>
21560 </row>
21561 <row>
21562 <entry><option>envelope_to_remove</option></entry>
21563 <entry>from incoming messages</entry>
21564 </row>
21565 <row>
21566 <entry><option>extract_addresses_remove_arguments</option></entry>
21567 <entry>affects <option>-t</option> processing</entry>
21568 </row>
21569 <row>
21570 <entry><option>headers_charset</option></entry>
21571 <entry>default for translations</entry>
21572 </row>
21573 <row>
21574 <entry><option>qualify_domain</option></entry>
21575 <entry>default for senders</entry>
21576 </row>
21577 <row>
21578 <entry><option>qualify_recipient</option></entry>
21579 <entry>default for recipients</entry>
21580 </row>
21581 <row>
21582 <entry><option>return_path_remove</option></entry>
21583 <entry>from incoming messages</entry>
21584 </row>
21585 <row>
21586 <entry><option>strip_excess_angle_brackets</option></entry>
21587 <entry>in addresses</entry>
21588 </row>
21589 <row>
21590 <entry><option>strip_trailing_dot</option></entry>
21591 <entry>at end of addresses</entry>
21592 </row>
21593 <row>
21594 <entry><option>untrusted_set_sender</option></entry>
21595 <entry>untrusted can set envelope sender</entry>
21596 </row>
21597 </tbody>
21598 </tgroup>
21599 </informaltable>
21600 </section>
21601 <section id="SECID115">
21602 <title>System filter</title>
21603 <informaltable frame="none">
21604 <tgroup cols="2" colsep="0" rowsep="0">
21605 <colspec colwidth="196pt" align="left"/>
21606 <colspec colwidth="254pt" align="left"/>
21607 <tbody>
21608 <row>
21609 <entry><option>system_filter</option></entry>
21610 <entry>locate system filter</entry>
21611 </row>
21612 <row>
21613 <entry><option>system_filter_directory_transport</option></entry>
21614 <entry>transport for delivery to a directory</entry>
21615 </row>
21616 <row>
21617 <entry><option>system_filter_file_transport</option></entry>
21618 <entry>transport for delivery to a file</entry>
21619 </row>
21620 <row>
21621 <entry><option>system_filter_group</option></entry>
21622 <entry>group for filter running</entry>
21623 </row>
21624 <row>
21625 <entry><option>system_filter_pipe_transport</option></entry>
21626 <entry>transport for delivery to a pipe</entry>
21627 </row>
21628 <row>
21629 <entry><option>system_filter_reply_transport</option></entry>
21630 <entry>transport for autoreply delivery</entry>
21631 </row>
21632 <row>
21633 <entry><option>system_filter_user</option></entry>
21634 <entry>user for filter running</entry>
21635 </row>
21636 </tbody>
21637 </tgroup>
21638 </informaltable>
21639 </section>
21640 <section id="SECID116">
21641 <title>Routing and delivery</title>
21642 <informaltable frame="none">
21643 <tgroup cols="2" colsep="0" rowsep="0">
21644 <colspec colwidth="196pt" align="left"/>
21645 <colspec colwidth="254pt" align="left"/>
21646 <tbody>
21647 <row>
21648 <entry><option>disable_ipv6</option></entry>
21649 <entry>do no IPv6 processing</entry>
21650 </row>
21651 <row>
21652 <entry><option>dns_again_means_nonexist</option></entry>
21653 <entry>for broken domains</entry>
21654 </row>
21655 <row>
21656 <entry><option>dns_check_names_pattern</option></entry>
21657 <entry>pre-DNS syntax check</entry>
21658 </row>
21659 <row>
21660 <entry><option>dns_dnssec_ok</option></entry>
21661 <entry>parameter for resolver</entry>
21662 </row>
21663 <row>
21664 <entry><option>dns_ipv4_lookup</option></entry>
21665 <entry>only v4 lookup for these domains</entry>
21666 </row>
21667 <row>
21668 <entry><option>dns_retrans</option></entry>
21669 <entry>parameter for resolver</entry>
21670 </row>
21671 <row>
21672 <entry><option>dns_retry</option></entry>
21673 <entry>parameter for resolver</entry>
21674 </row>
21675 <row>
21676 <entry><option>dns_trust_aa</option></entry>
21677 <entry>DNS zones trusted as authentic</entry>
21678 </row>
21679 <row>
21680 <entry><option>dns_use_edns0</option></entry>
21681 <entry>parameter for resolver</entry>
21682 </row>
21683 <row>
21684 <entry><option>hold_domains</option></entry>
21685 <entry>hold delivery for these domains</entry>
21686 </row>
21687 <row>
21688 <entry><option>local_interfaces</option></entry>
21689 <entry>for routing checks</entry>
21690 </row>
21691 <row>
21692 <entry><option>queue_domains</option></entry>
21693 <entry>no immediate delivery for these</entry>
21694 </row>
21695 <row>
21696 <entry><option>queue_only</option></entry>
21697 <entry>no immediate delivery at all</entry>
21698 </row>
21699 <row>
21700 <entry><option>queue_only_file</option></entry>
21701 <entry>no immediate delivery if file exists</entry>
21702 </row>
21703 <row>
21704 <entry><option>queue_only_load</option></entry>
21705 <entry>no immediate delivery if load is high</entry>
21706 </row>
21707 <row>
21708 <entry><option>queue_only_load_latch</option></entry>
21709 <entry>don&#x2019;t re-evaluate load for each message</entry>
21710 </row>
21711 <row>
21712 <entry><option>queue_only_override</option></entry>
21713 <entry>allow command line to override</entry>
21714 </row>
21715 <row>
21716 <entry><option>queue_run_in_order</option></entry>
21717 <entry>order of arrival</entry>
21718 </row>
21719 <row>
21720 <entry><option>queue_run_max</option></entry>
21721 <entry>of simultaneous queue runners</entry>
21722 </row>
21723 <row>
21724 <entry><option>queue_smtp_domains</option></entry>
21725 <entry>no immediate SMTP delivery for these</entry>
21726 </row>
21727 <row>
21728 <entry><option>remote_max_parallel</option></entry>
21729 <entry>parallel SMTP delivery per message</entry>
21730 </row>
21731 <row>
21732 <entry><option>remote_sort_domains</option></entry>
21733 <entry>order of remote deliveries</entry>
21734 </row>
21735 <row>
21736 <entry><option>retry_data_expire</option></entry>
21737 <entry>timeout for retry data</entry>
21738 </row>
21739 <row>
21740 <entry><option>retry_interval_max</option></entry>
21741 <entry>safety net for retry rules</entry>
21742 </row>
21743 </tbody>
21744 </tgroup>
21745 </informaltable>
21746 </section>
21747 <section id="SECID117">
21748 <title>Bounce and warning messages</title>
21749 <informaltable frame="none">
21750 <tgroup cols="2" colsep="0" rowsep="0">
21751 <colspec colwidth="196pt" align="left"/>
21752 <colspec colwidth="254pt" align="left"/>
21753 <tbody>
21754 <row>
21755 <entry><option>bounce_message_file</option></entry>
21756 <entry>content of bounce</entry>
21757 </row>
21758 <row>
21759 <entry><option>bounce_message_text</option></entry>
21760 <entry>content of bounce</entry>
21761 </row>
21762 <row>
21763 <entry><option>bounce_return_body</option></entry>
21764 <entry>include body if returning message</entry>
21765 </row>
21766 <row>
21767 <entry><option>bounce_return_message</option></entry>
21768 <entry>include original message in bounce</entry>
21769 </row>
21770 <row>
21771 <entry><option>bounce_return_size_limit</option></entry>
21772 <entry>limit on returned message</entry>
21773 </row>
21774 <row>
21775 <entry><option>bounce_sender_authentication</option></entry>
21776 <entry>send authenticated sender with bounce</entry>
21777 </row>
21778 <row>
21779 <entry><option>dsn_from</option></entry>
21780 <entry>set <emphasis>From:</emphasis> contents in bounces</entry>
21781 </row>
21782 <row>
21783 <entry><option>errors_copy</option></entry>
21784 <entry>copy bounce messages</entry>
21785 </row>
21786 <row>
21787 <entry><option>errors_reply_to</option></entry>
21788 <entry><emphasis>Reply-to:</emphasis> in bounces</entry>
21789 </row>
21790 <row>
21791 <entry><option>delay_warning</option></entry>
21792 <entry>time schedule</entry>
21793 </row>
21794 <row>
21795 <entry><option>delay_warning_condition</option></entry>
21796 <entry>condition for warning messages</entry>
21797 </row>
21798 <row>
21799 <entry><option>ignore_bounce_errors_after</option></entry>
21800 <entry>discard undeliverable bounces</entry>
21801 </row>
21802 <row>
21803 <entry><option>smtp_return_error_details</option></entry>
21804 <entry>give detail on rejections</entry>
21805 </row>
21806 <row>
21807 <entry><option>warn_message_file</option></entry>
21808 <entry>content of warning message</entry>
21809 </row>
21810 </tbody>
21811 </tgroup>
21812 </informaltable>
21813 </section>
21814 <section id="SECTalomo">
21815 <title>Alphabetical list of main options</title>
21816 <para>
21817 Those options that undergo string expansion before use are marked with
21818 &dagger;.
21819 </para>
21820 <para>
21821 <indexterm role="option">
21822 <primary><option>accept_8bitmime</option></primary>
21823 </indexterm>
21824 </para>
21825 <informaltable frame="all">
21826 <tgroup cols="4" colsep="0" rowsep="0">
21827 <colspec colwidth="8*" align="left"/>
21828 <colspec colwidth="6*" align="center"/>
21829 <colspec colwidth="6*" align="center"/>
21830 <colspec colwidth="6*" align="right"/>
21831 <tbody>
21832 <row>
21833 <entry><option>accept_8bitmime</option></entry>
21834 <entry>Use: <emphasis>main</emphasis></entry>
21835 <entry>Type: <emphasis>boolean</emphasis></entry>
21836 <entry>Default: <emphasis>true</emphasis></entry>
21837 </row>
21838 </tbody>
21839 </tgroup>
21840 </informaltable>
21841 <para>
21842 <indexterm role="concept">
21843 <primary>8BITMIME</primary>
21844 </indexterm>
21845 <indexterm role="concept">
21846 <primary>8-bit characters</primary>
21847 </indexterm>
21848 <indexterm role="concept">
21849 <primary>log</primary>
21850 <secondary>selectors</secondary>
21851 </indexterm>
21852 <indexterm role="concept">
21853 <primary>log</primary>
21854 <secondary>8BITMIME</secondary>
21855 </indexterm>
21856 This option causes Exim to send 8BITMIME in its response to an SMTP
21857 EHLO command, and to accept the BODY= parameter on MAIL commands.
21858 However, though Exim is 8-bit clean, it is not a protocol converter, and it
21859 takes no steps to do anything special with messages received by this route.
21860 </para>
21861 <para>
21862 Historically Exim kept this option off by default, but the maintainers
21863 feel that in today&#x2019;s Internet, this causes more problems than it solves.
21864 It now defaults to true.
21865 A more detailed analysis of the issues is provided by Dan Bernstein:
21866 </para>
21867 <literallayout>
21868 <emphasis role="bold"><ulink url="http://cr.yp.to/smtp/8bitmime.html">http://cr.yp.to/smtp/8bitmime.html</ulink></emphasis>
21869 </literallayout>
21870 <para>
21871 To log received 8BITMIME status use
21872 </para>
21873 <literallayout class="monospaced">
21874 log_selector = +8bitmime
21875 </literallayout>
21876 <para>
21877 <indexterm role="option">
21878 <primary><option>acl_not_smtp</option></primary>
21879 </indexterm>
21880 </para>
21881 <informaltable frame="all">
21882 <tgroup cols="4" colsep="0" rowsep="0">
21883 <colspec colwidth="8*" align="left"/>
21884 <colspec colwidth="6*" align="center"/>
21885 <colspec colwidth="6*" align="center"/>
21886 <colspec colwidth="6*" align="right"/>
21887 <tbody>
21888 <row>
21889 <entry><option>acl_not_smtp</option></entry>
21890 <entry>Use: <emphasis>main</emphasis></entry>
21891 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
21892 <entry>Default: <emphasis>unset</emphasis></entry>
21893 </row>
21894 </tbody>
21895 </tgroup>
21896 </informaltable>
21897 <para>
21898 <indexterm role="concept">
21899 <primary>access control lists (ACLs)</primary>
21900 <secondary>for non-SMTP messages</secondary>
21901 </indexterm>
21902 <indexterm role="concept">
21903 <primary>non-SMTP messages</primary>
21904 <secondary>ACLs for</secondary>
21905 </indexterm>
21906 This option defines the ACL that is run when a non-SMTP message has been
21907 read and is on the point of being accepted. See chapter <xref linkend="CHAPACL"/> for
21908 further details.
21909 </para>
21910 <para>
21911 <indexterm role="option">
21912 <primary><option>acl_not_smtp_mime</option></primary>
21913 </indexterm>
21914 </para>
21915 <informaltable frame="all">
21916 <tgroup cols="4" colsep="0" rowsep="0">
21917 <colspec colwidth="8*" align="left"/>
21918 <colspec colwidth="6*" align="center"/>
21919 <colspec colwidth="6*" align="center"/>
21920 <colspec colwidth="6*" align="right"/>
21921 <tbody>
21922 <row>
21923 <entry><option>acl_not_smtp_mime</option></entry>
21924 <entry>Use: <emphasis>main</emphasis></entry>
21925 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
21926 <entry>Default: <emphasis>unset</emphasis></entry>
21927 </row>
21928 </tbody>
21929 </tgroup>
21930 </informaltable>
21931 <para>
21932 This option defines the ACL that is run for individual MIME parts of non-SMTP
21933 messages. It operates in exactly the same way as <option>acl_smtp_mime</option> operates for
21934 SMTP messages.
21935 </para>
21936 <para>
21937 <indexterm role="option">
21938 <primary><option>acl_not_smtp_start</option></primary>
21939 </indexterm>
21940 </para>
21941 <informaltable frame="all">
21942 <tgroup cols="4" colsep="0" rowsep="0">
21943 <colspec colwidth="8*" align="left"/>
21944 <colspec colwidth="6*" align="center"/>
21945 <colspec colwidth="6*" align="center"/>
21946 <colspec colwidth="6*" align="right"/>
21947 <tbody>
21948 <row>
21949 <entry><option>acl_not_smtp_start</option></entry>
21950 <entry>Use: <emphasis>main</emphasis></entry>
21951 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
21952 <entry>Default: <emphasis>unset</emphasis></entry>
21953 </row>
21954 </tbody>
21955 </tgroup>
21956 </informaltable>
21957 <para>
21958 <indexterm role="concept">
21959 <primary>access control lists (ACLs)</primary>
21960 <secondary>at start of non-SMTP message</secondary>
21961 </indexterm>
21962 <indexterm role="concept">
21963 <primary>non-SMTP messages</primary>
21964 <secondary>ACLs for</secondary>
21965 </indexterm>
21966 This option defines the ACL that is run before Exim starts reading a
21967 non-SMTP message. See chapter <xref linkend="CHAPACL"/> for further details.
21968 </para>
21969 <para>
21970 <indexterm role="option">
21971 <primary><option>acl_smtp_auth</option></primary>
21972 </indexterm>
21973 </para>
21974 <informaltable frame="all">
21975 <tgroup cols="4" colsep="0" rowsep="0">
21976 <colspec colwidth="8*" align="left"/>
21977 <colspec colwidth="6*" align="center"/>
21978 <colspec colwidth="6*" align="center"/>
21979 <colspec colwidth="6*" align="right"/>
21980 <tbody>
21981 <row>
21982 <entry><option>acl_smtp_auth</option></entry>
21983 <entry>Use: <emphasis>main</emphasis></entry>
21984 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
21985 <entry>Default: <emphasis>unset</emphasis></entry>
21986 </row>
21987 </tbody>
21988 </tgroup>
21989 </informaltable>
21990 <para>
21991 <indexterm role="concept">
21992 <primary>access control lists (ACLs)</primary>
21993 <secondary>setting up for SMTP commands</secondary>
21994 </indexterm>
21995 <indexterm role="concept">
21996 <primary>AUTH</primary>
21997 <secondary>ACL for</secondary>
21998 </indexterm>
21999 This option defines the ACL that is run when an SMTP AUTH command is
22000 received. See chapter <xref linkend="CHAPACL"/> for further details.
22001 </para>
22002 <para>
22003 <indexterm role="option">
22004 <primary><option>acl_smtp_connect</option></primary>
22005 </indexterm>
22006 </para>
22007 <informaltable frame="all">
22008 <tgroup cols="4" colsep="0" rowsep="0">
22009 <colspec colwidth="8*" align="left"/>
22010 <colspec colwidth="6*" align="center"/>
22011 <colspec colwidth="6*" align="center"/>
22012 <colspec colwidth="6*" align="right"/>
22013 <tbody>
22014 <row>
22015 <entry><option>acl_smtp_connect</option></entry>
22016 <entry>Use: <emphasis>main</emphasis></entry>
22017 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
22018 <entry>Default: <emphasis>unset</emphasis></entry>
22019 </row>
22020 </tbody>
22021 </tgroup>
22022 </informaltable>
22023 <para>
22024 <indexterm role="concept">
22025 <primary>access control lists (ACLs)</primary>
22026 <secondary>on SMTP connection</secondary>
22027 </indexterm>
22028 This option defines the ACL that is run when an SMTP connection is received.
22029 See chapter <xref linkend="CHAPACL"/> for further details.
22030 </para>
22031 <para>
22032 <indexterm role="option">
22033 <primary><option>acl_smtp_data</option></primary>
22034 </indexterm>
22035 </para>
22036 <informaltable frame="all">
22037 <tgroup cols="4" colsep="0" rowsep="0">
22038 <colspec colwidth="8*" align="left"/>
22039 <colspec colwidth="6*" align="center"/>
22040 <colspec colwidth="6*" align="center"/>
22041 <colspec colwidth="6*" align="right"/>
22042 <tbody>
22043 <row>
22044 <entry><option>acl_smtp_data</option></entry>
22045 <entry>Use: <emphasis>main</emphasis></entry>
22046 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
22047 <entry>Default: <emphasis>unset</emphasis></entry>
22048 </row>
22049 </tbody>
22050 </tgroup>
22051 </informaltable>
22052 <para>
22053 <indexterm role="concept">
22054 <primary>DATA</primary>
22055 <secondary>ACL for</secondary>
22056 </indexterm>
22057 This option defines the ACL that is run after an SMTP DATA command has been
22058 processed and the message itself has been received, but before the final
22059 acknowledgment is sent. See chapter <xref linkend="CHAPACL"/> for further details.
22060 </para>
22061 <para revisionflag="changed">
22062 <indexterm role="option">
22063 <primary><option>acl_smtp_data_prdr</option></primary>
22064 </indexterm>
22065 </para>
22066 <informaltable frame="all" revisionflag="changed">
22067 <tgroup cols="4" colsep="0" rowsep="0">
22068 <colspec colwidth="8*" align="left"/>
22069 <colspec colwidth="6*" align="center"/>
22070 <colspec colwidth="6*" align="center"/>
22071 <colspec colwidth="6*" align="right"/>
22072 <tbody>
22073 <row>
22074 <entry><option>acl_smtp_data_prdr</option></entry>
22075 <entry>Use: <emphasis>main</emphasis></entry>
22076 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
22077 <entry>Default: <emphasis>accept</emphasis></entry>
22078 </row>
22079 </tbody>
22080 </tgroup>
22081 </informaltable>
22082 <para revisionflag="changed">
22083 <indexterm role="concept">
22084 <primary>PRDR</primary>
22085 <secondary>ACL for</secondary>
22086 </indexterm>
22087 <indexterm role="concept">
22088 <primary>DATA</primary>
22089 <secondary>PRDR ACL for</secondary>
22090 </indexterm>
22091 <indexterm role="concept">
22092 <primary>access control lists (ACLs)</primary>
22093 <secondary>PRDR-related</secondary>
22094 </indexterm>
22095 <indexterm role="concept">
22096 <primary>access control lists (ACLs)</primary>
22097 <secondary>per-user data processing</secondary>
22098 </indexterm>
22099 </para>
22100 <para>
22101 This option defines the ACL that,
22102 if the PRDR feature has been negotiated,
22103 is run for each recipient after an SMTP DATA command has been
22104 processed and the message itself has been received, but before the
22105 acknowledgment is sent. See chapter <xref linkend="CHAPACL"/> for further details.
22106 </para>
22107 <para revisionflag="changed">
22108 <indexterm role="option">
22109 <primary><option>acl_smtp_dkim</option></primary>
22110 </indexterm>
22111 </para>
22112 <informaltable frame="all" revisionflag="changed">
22113 <tgroup cols="4" colsep="0" rowsep="0">
22114 <colspec colwidth="8*" align="left"/>
22115 <colspec colwidth="6*" align="center"/>
22116 <colspec colwidth="6*" align="center"/>
22117 <colspec colwidth="6*" align="right"/>
22118 <tbody>
22119 <row>
22120 <entry><option>acl_smtp_dkim</option></entry>
22121 <entry>Use: <emphasis>main</emphasis></entry>
22122 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
22123 <entry>Default: <emphasis>unset</emphasis></entry>
22124 </row>
22125 </tbody>
22126 </tgroup>
22127 </informaltable>
22128 <para revisionflag="changed">
22129 <indexterm role="concept">
22130 <primary>DKIM</primary>
22131 <secondary>ACL for</secondary>
22132 </indexterm>
22133 This option defines the ACL that is run for each DKIM signature
22134 of a received message.
22135 See chapter <xref linkend="CHAPdkim"/> for further details.
22136 </para>
22137 <para>
22138 <indexterm role="option">
22139 <primary><option>acl_smtp_etrn</option></primary>
22140 </indexterm>
22141 </para>
22142 <informaltable frame="all">
22143 <tgroup cols="4" colsep="0" rowsep="0">
22144 <colspec colwidth="8*" align="left"/>
22145 <colspec colwidth="6*" align="center"/>
22146 <colspec colwidth="6*" align="center"/>
22147 <colspec colwidth="6*" align="right"/>
22148 <tbody>
22149 <row>
22150 <entry><option>acl_smtp_etrn</option></entry>
22151 <entry>Use: <emphasis>main</emphasis></entry>
22152 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
22153 <entry>Default: <emphasis>unset</emphasis></entry>
22154 </row>
22155 </tbody>
22156 </tgroup>
22157 </informaltable>
22158 <para>
22159 <indexterm role="concept">
22160 <primary>ETRN</primary>
22161 <secondary>ACL for</secondary>
22162 </indexterm>
22163 This option defines the ACL that is run when an SMTP ETRN command is
22164 received. See chapter <xref linkend="CHAPACL"/> for further details.
22165 </para>
22166 <para>
22167 <indexterm role="option">
22168 <primary><option>acl_smtp_expn</option></primary>
22169 </indexterm>
22170 </para>
22171 <informaltable frame="all">
22172 <tgroup cols="4" colsep="0" rowsep="0">
22173 <colspec colwidth="8*" align="left"/>
22174 <colspec colwidth="6*" align="center"/>
22175 <colspec colwidth="6*" align="center"/>
22176 <colspec colwidth="6*" align="right"/>
22177 <tbody>
22178 <row>
22179 <entry><option>acl_smtp_expn</option></entry>
22180 <entry>Use: <emphasis>main</emphasis></entry>
22181 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
22182 <entry>Default: <emphasis>unset</emphasis></entry>
22183 </row>
22184 </tbody>
22185 </tgroup>
22186 </informaltable>
22187 <para>
22188 <indexterm role="concept">
22189 <primary>EXPN</primary>
22190 <secondary>ACL for</secondary>
22191 </indexterm>
22192 This option defines the ACL that is run when an SMTP EXPN command is
22193 received. See chapter <xref linkend="CHAPACL"/> for further details.
22194 </para>
22195 <para>
22196 <indexterm role="option">
22197 <primary><option>acl_smtp_helo</option></primary>
22198 </indexterm>
22199 </para>
22200 <informaltable frame="all">
22201 <tgroup cols="4" colsep="0" rowsep="0">
22202 <colspec colwidth="8*" align="left"/>
22203 <colspec colwidth="6*" align="center"/>
22204 <colspec colwidth="6*" align="center"/>
22205 <colspec colwidth="6*" align="right"/>
22206 <tbody>
22207 <row>
22208 <entry><option>acl_smtp_helo</option></entry>
22209 <entry>Use: <emphasis>main</emphasis></entry>
22210 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
22211 <entry>Default: <emphasis>unset</emphasis></entry>
22212 </row>
22213 </tbody>
22214 </tgroup>
22215 </informaltable>
22216 <para>
22217 <indexterm role="concept">
22218 <primary>EHLO</primary>
22219 <secondary>ACL for</secondary>
22220 </indexterm>
22221 <indexterm role="concept">
22222 <primary>HELO</primary>
22223 <secondary>ACL for</secondary>
22224 </indexterm>
22225 This option defines the ACL that is run when an SMTP EHLO or HELO
22226 command is received. See chapter <xref linkend="CHAPACL"/> for further details.
22227 </para>
22228 <para>
22229 <indexterm role="option">
22230 <primary><option>acl_smtp_mail</option></primary>
22231 </indexterm>
22232 </para>
22233 <informaltable frame="all">
22234 <tgroup cols="4" colsep="0" rowsep="0">
22235 <colspec colwidth="8*" align="left"/>
22236 <colspec colwidth="6*" align="center"/>
22237 <colspec colwidth="6*" align="center"/>
22238 <colspec colwidth="6*" align="right"/>
22239 <tbody>
22240 <row>
22241 <entry><option>acl_smtp_mail</option></entry>
22242 <entry>Use: <emphasis>main</emphasis></entry>
22243 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
22244 <entry>Default: <emphasis>unset</emphasis></entry>
22245 </row>
22246 </tbody>
22247 </tgroup>
22248 </informaltable>
22249 <para>
22250 <indexterm role="concept">
22251 <primary>MAIL</primary>
22252 <secondary>ACL for</secondary>
22253 </indexterm>
22254 This option defines the ACL that is run when an SMTP MAIL command is
22255 received. See chapter <xref linkend="CHAPACL"/> for further details.
22256 </para>
22257 <para>
22258 <indexterm role="option">
22259 <primary><option>acl_smtp_mailauth</option></primary>
22260 </indexterm>
22261 </para>
22262 <informaltable frame="all">
22263 <tgroup cols="4" colsep="0" rowsep="0">
22264 <colspec colwidth="8*" align="left"/>
22265 <colspec colwidth="6*" align="center"/>
22266 <colspec colwidth="6*" align="center"/>
22267 <colspec colwidth="6*" align="right"/>
22268 <tbody>
22269 <row>
22270 <entry><option>acl_smtp_mailauth</option></entry>
22271 <entry>Use: <emphasis>main</emphasis></entry>
22272 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
22273 <entry>Default: <emphasis>unset</emphasis></entry>
22274 </row>
22275 </tbody>
22276 </tgroup>
22277 </informaltable>
22278 <para>
22279 <indexterm role="concept">
22280 <primary>AUTH</primary>
22281 <secondary>on MAIL command</secondary>
22282 </indexterm>
22283 This option defines the ACL that is run when there is an AUTH parameter on
22284 a MAIL command. See chapter <xref linkend="CHAPACL"/> for details of ACLs, and chapter
22285 <xref linkend="CHAPSMTPAUTH"/> for details of authentication.
22286 </para>
22287 <para>
22288 <indexterm role="option">
22289 <primary><option>acl_smtp_mime</option></primary>
22290 </indexterm>
22291 </para>
22292 <informaltable frame="all">
22293 <tgroup cols="4" colsep="0" rowsep="0">
22294 <colspec colwidth="8*" align="left"/>
22295 <colspec colwidth="6*" align="center"/>
22296 <colspec colwidth="6*" align="center"/>
22297 <colspec colwidth="6*" align="right"/>
22298 <tbody>
22299 <row>
22300 <entry><option>acl_smtp_mime</option></entry>
22301 <entry>Use: <emphasis>main</emphasis></entry>
22302 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
22303 <entry>Default: <emphasis>unset</emphasis></entry>
22304 </row>
22305 </tbody>
22306 </tgroup>
22307 </informaltable>
22308 <para>
22309 <indexterm role="concept">
22310 <primary>MIME content scanning</primary>
22311 <secondary>ACL for</secondary>
22312 </indexterm>
22313 This option is available when Exim is built with the content-scanning
22314 extension. It defines the ACL that is run for each MIME part in a message. See
22315 section <xref linkend="SECTscanmimepart"/> for details.
22316 </para>
22317 <para revisionflag="changed">
22318 <indexterm role="option">
22319 <primary><option>acl_smtp_notquit</option></primary>
22320 </indexterm>
22321 </para>
22322 <informaltable frame="all" revisionflag="changed">
22323 <tgroup cols="4" colsep="0" rowsep="0">
22324 <colspec colwidth="8*" align="left"/>
22325 <colspec colwidth="6*" align="center"/>
22326 <colspec colwidth="6*" align="center"/>
22327 <colspec colwidth="6*" align="right"/>
22328 <tbody>
22329 <row>
22330 <entry><option>acl_smtp_notquit</option></entry>
22331 <entry>Use: <emphasis>main</emphasis></entry>
22332 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
22333 <entry>Default: <emphasis>unset</emphasis></entry>
22334 </row>
22335 </tbody>
22336 </tgroup>
22337 </informaltable>
22338 <para revisionflag="changed">
22339 <indexterm role="concept">
22340 <primary>not-QUIT, ACL for</primary>
22341 </indexterm>
22342 This option defines the ACL that is run when an SMTP session
22343 ends without a QUIT command being received.
22344 See chapter <xref linkend="CHAPACL"/> for further details.
22345 </para>
22346 <para>
22347 <indexterm role="option">
22348 <primary><option>acl_smtp_predata</option></primary>
22349 </indexterm>
22350 </para>
22351 <informaltable frame="all">
22352 <tgroup cols="4" colsep="0" rowsep="0">
22353 <colspec colwidth="8*" align="left"/>
22354 <colspec colwidth="6*" align="center"/>
22355 <colspec colwidth="6*" align="center"/>
22356 <colspec colwidth="6*" align="right"/>
22357 <tbody>
22358 <row>
22359 <entry><option>acl_smtp_predata</option></entry>
22360 <entry>Use: <emphasis>main</emphasis></entry>
22361 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
22362 <entry>Default: <emphasis>unset</emphasis></entry>
22363 </row>
22364 </tbody>
22365 </tgroup>
22366 </informaltable>
22367 <para>
22368 This option defines the ACL that is run when an SMTP DATA command is
22369 received, before the message itself is received. See chapter <xref linkend="CHAPACL"/> for
22370 further details.
22371 </para>
22372 <para>
22373 <indexterm role="option">
22374 <primary><option>acl_smtp_quit</option></primary>
22375 </indexterm>
22376 </para>
22377 <informaltable frame="all">
22378 <tgroup cols="4" colsep="0" rowsep="0">
22379 <colspec colwidth="8*" align="left"/>
22380 <colspec colwidth="6*" align="center"/>
22381 <colspec colwidth="6*" align="center"/>
22382 <colspec colwidth="6*" align="right"/>
22383 <tbody>
22384 <row>
22385 <entry><option>acl_smtp_quit</option></entry>
22386 <entry>Use: <emphasis>main</emphasis></entry>
22387 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
22388 <entry>Default: <emphasis>unset</emphasis></entry>
22389 </row>
22390 </tbody>
22391 </tgroup>
22392 </informaltable>
22393 <para>
22394 <indexterm role="concept">
22395 <primary>QUIT, ACL for</primary>
22396 </indexterm>
22397 This option defines the ACL that is run when an SMTP QUIT command is
22398 received. See chapter <xref linkend="CHAPACL"/> for further details.
22399 </para>
22400 <para>
22401 <indexterm role="option">
22402 <primary><option>acl_smtp_rcpt</option></primary>
22403 </indexterm>
22404 </para>
22405 <informaltable frame="all">
22406 <tgroup cols="4" colsep="0" rowsep="0">
22407 <colspec colwidth="8*" align="left"/>
22408 <colspec colwidth="6*" align="center"/>
22409 <colspec colwidth="6*" align="center"/>
22410 <colspec colwidth="6*" align="right"/>
22411 <tbody>
22412 <row>
22413 <entry><option>acl_smtp_rcpt</option></entry>
22414 <entry>Use: <emphasis>main</emphasis></entry>
22415 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
22416 <entry>Default: <emphasis>unset</emphasis></entry>
22417 </row>
22418 </tbody>
22419 </tgroup>
22420 </informaltable>
22421 <para>
22422 <indexterm role="concept">
22423 <primary>RCPT</primary>
22424 <secondary>ACL for</secondary>
22425 </indexterm>
22426 This option defines the ACL that is run when an SMTP RCPT command is
22427 received. See chapter <xref linkend="CHAPACL"/> for further details.
22428 </para>
22429 <para>
22430 <indexterm role="option">
22431 <primary><option>acl_smtp_starttls</option></primary>
22432 </indexterm>
22433 </para>
22434 <informaltable frame="all">
22435 <tgroup cols="4" colsep="0" rowsep="0">
22436 <colspec colwidth="8*" align="left"/>
22437 <colspec colwidth="6*" align="center"/>
22438 <colspec colwidth="6*" align="center"/>
22439 <colspec colwidth="6*" align="right"/>
22440 <tbody>
22441 <row>
22442 <entry><option>acl_smtp_starttls</option></entry>
22443 <entry>Use: <emphasis>main</emphasis></entry>
22444 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
22445 <entry>Default: <emphasis>unset</emphasis></entry>
22446 </row>
22447 </tbody>
22448 </tgroup>
22449 </informaltable>
22450 <para>
22451 <indexterm role="concept">
22452 <primary>STARTTLS, ACL for</primary>
22453 </indexterm>
22454 This option defines the ACL that is run when an SMTP STARTTLS command is
22455 received. See chapter <xref linkend="CHAPACL"/> for further details.
22456 </para>
22457 <para>
22458 <indexterm role="option">
22459 <primary><option>acl_smtp_vrfy</option></primary>
22460 </indexterm>
22461 </para>
22462 <informaltable frame="all">
22463 <tgroup cols="4" colsep="0" rowsep="0">
22464 <colspec colwidth="8*" align="left"/>
22465 <colspec colwidth="6*" align="center"/>
22466 <colspec colwidth="6*" align="center"/>
22467 <colspec colwidth="6*" align="right"/>
22468 <tbody>
22469 <row>
22470 <entry><option>acl_smtp_vrfy</option></entry>
22471 <entry>Use: <emphasis>main</emphasis></entry>
22472 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
22473 <entry>Default: <emphasis>unset</emphasis></entry>
22474 </row>
22475 </tbody>
22476 </tgroup>
22477 </informaltable>
22478 <para>
22479 <indexterm role="concept">
22480 <primary>VRFY</primary>
22481 <secondary>ACL for</secondary>
22482 </indexterm>
22483 This option defines the ACL that is run when an SMTP VRFY command is
22484 received. See chapter <xref linkend="CHAPACL"/> for further details.
22485 </para>
22486 <para>
22487 <indexterm role="option">
22488 <primary><option>admin_groups</option></primary>
22489 </indexterm>
22490 </para>
22491 <informaltable frame="all">
22492 <tgroup cols="4" colsep="0" rowsep="0">
22493 <colspec colwidth="8*" align="left"/>
22494 <colspec colwidth="6*" align="center"/>
22495 <colspec colwidth="6*" align="center"/>
22496 <colspec colwidth="6*" align="right"/>
22497 <tbody>
22498 <row>
22499 <entry><option>admin_groups</option></entry>
22500 <entry>Use: <emphasis>main</emphasis></entry>
22501 <entry>Type: <emphasis>string list</emphasis>&dagger;<emphasis></emphasis></entry>
22502 <entry>Default: <emphasis>unset</emphasis></entry>
22503 </row>
22504 </tbody>
22505 </tgroup>
22506 </informaltable>
22507 <para>
22508 <indexterm role="concept">
22509 <primary>admin user</primary>
22510 </indexterm>
22511 This option is expanded just once, at the start of Exim&#x2019;s processing. If the
22512 current group or any of the supplementary groups of an Exim caller is in this
22513 colon-separated list, the caller has admin privileges. If all your system
22514 programmers are in a specific group, for example, you can give them all Exim
22515 admin privileges by putting that group in <option>admin_groups</option>. However, this does
22516 not permit them to read Exim&#x2019;s spool files (whose group owner is the Exim gid).
22517 To permit this, you have to add individuals to the Exim group.
22518 </para>
22519 <para>
22520 <indexterm role="option">
22521 <primary><option>allow_domain_literals</option></primary>
22522 </indexterm>
22523 </para>
22524 <informaltable frame="all">
22525 <tgroup cols="4" colsep="0" rowsep="0">
22526 <colspec colwidth="8*" align="left"/>
22527 <colspec colwidth="6*" align="center"/>
22528 <colspec colwidth="6*" align="center"/>
22529 <colspec colwidth="6*" align="right"/>
22530 <tbody>
22531 <row>
22532 <entry><option>allow_domain_literals</option></entry>
22533 <entry>Use: <emphasis>main</emphasis></entry>
22534 <entry>Type: <emphasis>boolean</emphasis></entry>
22535 <entry>Default: <emphasis>false</emphasis></entry>
22536 </row>
22537 </tbody>
22538 </tgroup>
22539 </informaltable>
22540 <para>
22541 <indexterm role="concept">
22542 <primary>domain literal</primary>
22543 </indexterm>
22544 If this option is set, the RFC 2822 domain literal format is permitted in
22545 email addresses. The option is not set by default, because the domain literal
22546 format is not normally required these days, and few people know about it. It
22547 has, however, been exploited by mail abusers.
22548 </para>
22549 <para>
22550 Unfortunately, it seems that some DNS black list maintainers are using this
22551 format to report black listing to postmasters. If you want to accept messages
22552 addressed to your hosts by IP address, you need to set
22553 <option>allow_domain_literals</option> true, and also to add <literal>@[]</literal> to the list of local
22554 domains (defined in the named domain list <option>local_domains</option> in the default
22555 configuration). This <quote>magic string</quote> matches the domain literal form of all
22556 the local host&#x2019;s IP addresses.
22557 </para>
22558 <para>
22559 <indexterm role="option">
22560 <primary><option>allow_mx_to_ip</option></primary>
22561 </indexterm>
22562 </para>
22563 <informaltable frame="all">
22564 <tgroup cols="4" colsep="0" rowsep="0">
22565 <colspec colwidth="8*" align="left"/>
22566 <colspec colwidth="6*" align="center"/>
22567 <colspec colwidth="6*" align="center"/>
22568 <colspec colwidth="6*" align="right"/>
22569 <tbody>
22570 <row>
22571 <entry><option>allow_mx_to_ip</option></entry>
22572 <entry>Use: <emphasis>main</emphasis></entry>
22573 <entry>Type: <emphasis>boolean</emphasis></entry>
22574 <entry>Default: <emphasis>false</emphasis></entry>
22575 </row>
22576 </tbody>
22577 </tgroup>
22578 </informaltable>
22579 <para>
22580 <indexterm role="concept">
22581 <primary>MX record</primary>
22582 <secondary>pointing to IP address</secondary>
22583 </indexterm>
22584 It appears that more and more DNS zone administrators are breaking the rules
22585 and putting domain names that look like IP addresses on the right hand side of
22586 MX records. Exim follows the rules and rejects this, giving an error message
22587 that explains the misconfiguration. However, some other MTAs support this
22588 practice, so to avoid <quote>Why can&#x2019;t Exim do this?</quote> complaints,
22589 <option>allow_mx_to_ip</option> exists, in order to enable this heinous activity. It is not
22590 recommended, except when you have no other choice.
22591 </para>
22592 <para>
22593 <indexterm role="option">
22594 <primary><option>allow_utf8_domains</option></primary>
22595 </indexterm>
22596 </para>
22597 <informaltable frame="all">
22598 <tgroup cols="4" colsep="0" rowsep="0">
22599 <colspec colwidth="8*" align="left"/>
22600 <colspec colwidth="6*" align="center"/>
22601 <colspec colwidth="6*" align="center"/>
22602 <colspec colwidth="6*" align="right"/>
22603 <tbody>
22604 <row>
22605 <entry><option>allow_utf8_domains</option></entry>
22606 <entry>Use: <emphasis>main</emphasis></entry>
22607 <entry>Type: <emphasis>boolean</emphasis></entry>
22608 <entry>Default: <emphasis>false</emphasis></entry>
22609 </row>
22610 </tbody>
22611 </tgroup>
22612 </informaltable>
22613 <para>
22614 <indexterm role="concept">
22615 <primary>domain</primary>
22616 <secondary>UTF-8 characters in</secondary>
22617 </indexterm>
22618 <indexterm role="concept">
22619 <primary>UTF-8</primary>
22620 <secondary>in domain name</secondary>
22621 </indexterm>
22622 Lots of discussion is going on about internationalized domain names. One
22623 camp is strongly in favour of just using UTF-8 characters, and it seems
22624 that at least two other MTAs permit this. This option allows Exim users to
22625 experiment if they wish.
22626 </para>
22627 <para>
22628 If it is set true, Exim&#x2019;s domain parsing function allows valid
22629 UTF-8 multicharacters to appear in domain name components, in addition to
22630 letters, digits, and hyphens. However, just setting this option is not
22631 enough; if you want to look up these domain names in the DNS, you must also
22632 adjust the value of <option>dns_check_names_pattern</option> to match the extended form. A
22633 suitable setting is:
22634 </para>
22635 <literallayout class="monospaced">
22636 dns_check_names_pattern = (?i)^(?&gt;(?(1)\.|())[a-z0-9\xc0-\xff]\
22637   (?&gt;[-a-z0-9\x80-\xff]*[a-z0-9\x80-\xbf])?)+$
22638 </literallayout>
22639 <para>
22640 Alternatively, you can just disable this feature by setting
22641 </para>
22642 <literallayout class="monospaced">
22643 dns_check_names_pattern =
22644 </literallayout>
22645 <para>
22646 That is, set the option to an empty string so that no check is done.
22647 </para>
22648 <para>
22649 <indexterm role="option">
22650 <primary><option>auth_advertise_hosts</option></primary>
22651 </indexterm>
22652 </para>
22653 <informaltable frame="all">
22654 <tgroup cols="4" colsep="0" rowsep="0">
22655 <colspec colwidth="8*" align="left"/>
22656 <colspec colwidth="6*" align="center"/>
22657 <colspec colwidth="6*" align="center"/>
22658 <colspec colwidth="6*" align="right"/>
22659 <tbody>
22660 <row>
22661 <entry><option>auth_advertise_hosts</option></entry>
22662 <entry>Use: <emphasis>main</emphasis></entry>
22663 <entry>Type: <emphasis>host list</emphasis>&dagger;<emphasis></emphasis></entry>
22664 <entry>Default: <emphasis>*</emphasis></entry>
22665 </row>
22666 </tbody>
22667 </tgroup>
22668 </informaltable>
22669 <para>
22670 <indexterm role="concept">
22671 <primary>authentication</primary>
22672 <secondary>advertising</secondary>
22673 </indexterm>
22674 <indexterm role="concept">
22675 <primary>AUTH</primary>
22676 <secondary>advertising</secondary>
22677 </indexterm>
22678 If any server authentication mechanisms are configured, Exim advertises them in
22679 response to an EHLO command only if the calling host matches this list.
22680 Otherwise, Exim does not advertise AUTH.
22681 Exim does not accept AUTH commands from clients to which it has not
22682 advertised the availability of AUTH. The advertising of individual
22683 authentication mechanisms can be controlled by the use of the
22684 <option>server_advertise_condition</option> generic authenticator option on the individual
22685 authenticators. See chapter <xref linkend="CHAPSMTPAUTH"/> for further details.
22686 </para>
22687 <para>
22688 Certain mail clients (for example, Netscape) require the user to provide a name
22689 and password for authentication if AUTH is advertised, even though it may
22690 not be needed (the host may accept messages from hosts on its local LAN without
22691 authentication, for example). The <option>auth_advertise_hosts</option> option can be used
22692 to make these clients more friendly by excluding them from the set of hosts to
22693 which Exim advertises AUTH.
22694 </para>
22695 <para>
22696 <indexterm role="concept">
22697 <primary>AUTH</primary>
22698 <secondary>advertising when encrypted</secondary>
22699 </indexterm>
22700 If you want to advertise the availability of AUTH only when the connection
22701 is encrypted using TLS, you can make use of the fact that the value of this
22702 option is expanded, with a setting like this:
22703 </para>
22704 <literallayout class="monospaced">
22705 auth_advertise_hosts = ${if eq{$tls_in_cipher}{}{}{*}}
22706 </literallayout>
22707 <para>
22708 <indexterm role="variable">
22709 <primary><varname>$tls_in_cipher</varname></primary>
22710 </indexterm>
22711 If <varname>$tls_in_cipher</varname> is empty, the session is not encrypted, and the result of
22712 the expansion is empty, thus matching no hosts. Otherwise, the result of the
22713 expansion is *, which matches all hosts.
22714 </para>
22715 <para>
22716 <indexterm role="option">
22717 <primary><option>auto_thaw</option></primary>
22718 </indexterm>
22719 </para>
22720 <informaltable frame="all">
22721 <tgroup cols="4" colsep="0" rowsep="0">
22722 <colspec colwidth="8*" align="left"/>
22723 <colspec colwidth="6*" align="center"/>
22724 <colspec colwidth="6*" align="center"/>
22725 <colspec colwidth="6*" align="right"/>
22726 <tbody>
22727 <row>
22728 <entry><option>auto_thaw</option></entry>
22729 <entry>Use: <emphasis>main</emphasis></entry>
22730 <entry>Type: <emphasis>time</emphasis></entry>
22731 <entry>Default: <emphasis>0s</emphasis></entry>
22732 </row>
22733 </tbody>
22734 </tgroup>
22735 </informaltable>
22736 <para>
22737 <indexterm role="concept">
22738 <primary>thawing messages</primary>
22739 </indexterm>
22740 <indexterm role="concept">
22741 <primary>unfreezing messages</primary>
22742 </indexterm>
22743 If this option is set to a time greater than zero, a queue runner will try a
22744 new delivery attempt on any frozen message, other than a bounce message, if
22745 this much time has passed since it was frozen. This may result in the message
22746 being re-frozen if nothing has changed since the last attempt. It is a way of
22747 saying <quote>keep on trying, even though there are big problems</quote>.
22748 </para>
22749 <para>
22750 <emphasis role="bold">Note</emphasis>: This is an old option, which predates <option>timeout_frozen_after</option> and
22751 <option>ignore_bounce_errors_after</option>. It is retained for compatibility, but it is not
22752 thought to be very useful any more, and its use should probably be avoided.
22753 </para>
22754 <para>
22755 <indexterm role="option">
22756 <primary><option>av_scanner</option></primary>
22757 </indexterm>
22758 </para>
22759 <informaltable frame="all">
22760 <tgroup cols="4" colsep="0" rowsep="0">
22761 <colspec colwidth="8*" align="left"/>
22762 <colspec colwidth="6*" align="center"/>
22763 <colspec colwidth="6*" align="center"/>
22764 <colspec colwidth="6*" align="right"/>
22765 <tbody>
22766 <row>
22767 <entry><option>av_scanner</option></entry>
22768 <entry>Use: <emphasis>main</emphasis></entry>
22769 <entry>Type: <emphasis>string</emphasis></entry>
22770 <entry>Default: <emphasis>see below</emphasis></entry>
22771 </row>
22772 </tbody>
22773 </tgroup>
22774 </informaltable>
22775 <para>
22776 This option is available if Exim is built with the content-scanning extension.
22777 It specifies which anti-virus scanner to use. The default value is:
22778 </para>
22779 <literallayout class="monospaced">
22780 sophie:/var/run/sophie
22781 </literallayout>
22782 <para>
22783 If the value of <option>av_scanner</option> starts with a dollar character, it is expanded
22784 before use. See section <xref linkend="SECTscanvirus"/> for further details.
22785 </para>
22786 <para>
22787 <indexterm role="option">
22788 <primary><option>bi_command</option></primary>
22789 </indexterm>
22790 </para>
22791 <informaltable frame="all">
22792 <tgroup cols="4" colsep="0" rowsep="0">
22793 <colspec colwidth="8*" align="left"/>
22794 <colspec colwidth="6*" align="center"/>
22795 <colspec colwidth="6*" align="center"/>
22796 <colspec colwidth="6*" align="right"/>
22797 <tbody>
22798 <row>
22799 <entry><option>bi_command</option></entry>
22800 <entry>Use: <emphasis>main</emphasis></entry>
22801 <entry>Type: <emphasis>string</emphasis></entry>
22802 <entry>Default: <emphasis>unset</emphasis></entry>
22803 </row>
22804 </tbody>
22805 </tgroup>
22806 </informaltable>
22807 <para>
22808 <indexterm role="option">
22809 <primary><option>-bi</option></primary>
22810 </indexterm>
22811 This option supplies the name of a command that is run when Exim is called with
22812 the <option>-bi</option> option (see chapter <xref linkend="CHAPcommandline"/>). The string value is
22813 just the command name, it is not a complete command line. If an argument is
22814 required, it must come from the <option>-oA</option> command line option.
22815 </para>
22816 <para>
22817 <indexterm role="option">
22818 <primary><option>bounce_message_file</option></primary>
22819 </indexterm>
22820 </para>
22821 <informaltable frame="all">
22822 <tgroup cols="4" colsep="0" rowsep="0">
22823 <colspec colwidth="8*" align="left"/>
22824 <colspec colwidth="6*" align="center"/>
22825 <colspec colwidth="6*" align="center"/>
22826 <colspec colwidth="6*" align="right"/>
22827 <tbody>
22828 <row>
22829 <entry><option>bounce_message_file</option></entry>
22830 <entry>Use: <emphasis>main</emphasis></entry>
22831 <entry>Type: <emphasis>string</emphasis></entry>
22832 <entry>Default: <emphasis>unset</emphasis></entry>
22833 </row>
22834 </tbody>
22835 </tgroup>
22836 </informaltable>
22837 <para>
22838 <indexterm role="concept">
22839 <primary>bounce message</primary>
22840 <secondary>customizing</secondary>
22841 </indexterm>
22842 <indexterm role="concept">
22843 <primary>customizing</primary>
22844 <secondary>bounce message</secondary>
22845 </indexterm>
22846 This option defines a template file containing paragraphs of text to be used
22847 for constructing bounce messages.  Details of the file&#x2019;s contents are given in
22848 chapter <xref linkend="CHAPemsgcust"/>. See also <option>warn_message_file</option>.
22849 </para>
22850 <para>
22851 <indexterm role="option">
22852 <primary><option>bounce_message_text</option></primary>
22853 </indexterm>
22854 </para>
22855 <informaltable frame="all">
22856 <tgroup cols="4" colsep="0" rowsep="0">
22857 <colspec colwidth="8*" align="left"/>
22858 <colspec colwidth="6*" align="center"/>
22859 <colspec colwidth="6*" align="center"/>
22860 <colspec colwidth="6*" align="right"/>
22861 <tbody>
22862 <row>
22863 <entry><option>bounce_message_text</option></entry>
22864 <entry>Use: <emphasis>main</emphasis></entry>
22865 <entry>Type: <emphasis>string</emphasis></entry>
22866 <entry>Default: <emphasis>unset</emphasis></entry>
22867 </row>
22868 </tbody>
22869 </tgroup>
22870 </informaltable>
22871 <para>
22872 When this option is set, its contents are included in the default bounce
22873 message immediately after <quote>This message was created automatically by mail
22874 delivery software.</quote> It is not used if <option>bounce_message_file</option> is set.
22875 </para>
22876 <para>
22877 <indexterm role="option">
22878 <primary><option>bounce_return_body</option></primary>
22879 </indexterm>
22880 </para>
22881 <informaltable frame="all">
22882 <tgroup cols="4" colsep="0" rowsep="0">
22883 <colspec colwidth="8*" align="left"/>
22884 <colspec colwidth="6*" align="center"/>
22885 <colspec colwidth="6*" align="center"/>
22886 <colspec colwidth="6*" align="right"/>
22887 <tbody>
22888 <row>
22889 <entry><option>bounce_return_body</option></entry>
22890 <entry>Use: <emphasis>main</emphasis></entry>
22891 <entry>Type: <emphasis>boolean</emphasis></entry>
22892 <entry>Default: <emphasis>true</emphasis></entry>
22893 </row>
22894 </tbody>
22895 </tgroup>
22896 </informaltable>
22897 <para>
22898 <indexterm role="concept">
22899 <primary>bounce message</primary>
22900 <secondary>including body</secondary>
22901 </indexterm>
22902 This option controls whether the body of an incoming message is included in a
22903 bounce message when <option>bounce_return_message</option> is true. The default setting
22904 causes the entire message, both header and body, to be returned (subject to the
22905 value of <option>bounce_return_size_limit</option>). If this option is false, only the
22906 message header is included. In the case of a non-SMTP message containing an
22907 error that is detected during reception, only those header lines preceding the
22908 point at which the error was detected are returned.
22909 <indexterm role="concept">
22910 <primary>bounce message</primary>
22911 <secondary>including original</secondary>
22912 </indexterm>
22913 </para>
22914 <para>
22915 <indexterm role="option">
22916 <primary><option>bounce_return_message</option></primary>
22917 </indexterm>
22918 </para>
22919 <informaltable frame="all">
22920 <tgroup cols="4" colsep="0" rowsep="0">
22921 <colspec colwidth="8*" align="left"/>
22922 <colspec colwidth="6*" align="center"/>
22923 <colspec colwidth="6*" align="center"/>
22924 <colspec colwidth="6*" align="right"/>
22925 <tbody>
22926 <row>
22927 <entry><option>bounce_return_message</option></entry>
22928 <entry>Use: <emphasis>main</emphasis></entry>
22929 <entry>Type: <emphasis>boolean</emphasis></entry>
22930 <entry>Default: <emphasis>true</emphasis></entry>
22931 </row>
22932 </tbody>
22933 </tgroup>
22934 </informaltable>
22935 <para>
22936 If this option is set false, none of the original message is included in
22937 bounce messages generated by Exim. See also <option>bounce_return_size_limit</option> and
22938 <option>bounce_return_body</option>.
22939 </para>
22940 <para>
22941 <indexterm role="option">
22942 <primary><option>bounce_return_size_limit</option></primary>
22943 </indexterm>
22944 </para>
22945 <informaltable frame="all">
22946 <tgroup cols="4" colsep="0" rowsep="0">
22947 <colspec colwidth="8*" align="left"/>
22948 <colspec colwidth="6*" align="center"/>
22949 <colspec colwidth="6*" align="center"/>
22950 <colspec colwidth="6*" align="right"/>
22951 <tbody>
22952 <row>
22953 <entry><option>bounce_return_size_limit</option></entry>
22954 <entry>Use: <emphasis>main</emphasis></entry>
22955 <entry>Type: <emphasis>integer</emphasis></entry>
22956 <entry>Default: <emphasis>100K</emphasis></entry>
22957 </row>
22958 </tbody>
22959 </tgroup>
22960 </informaltable>
22961 <para>
22962 <indexterm role="concept">
22963 <primary>size</primary>
22964 <secondary>of bounce, limit</secondary>
22965 </indexterm>
22966 <indexterm role="concept">
22967 <primary>bounce message</primary>
22968 <secondary>size limit</secondary>
22969 </indexterm>
22970 <indexterm role="concept">
22971 <primary>limit</primary>
22972 <secondary>bounce message size</secondary>
22973 </indexterm>
22974 This option sets a limit in bytes on the size of messages that are returned to
22975 senders as part of bounce messages when <option>bounce_return_message</option> is true. The
22976 limit should be less than the value of the global <option>message_size_limit</option> and of
22977 any <option>message_size_limit</option> settings on transports, to allow for the bounce text
22978 that Exim generates. If this option is set to zero there is no limit.
22979 </para>
22980 <para>
22981 When the body of any message that is to be included in a bounce message is
22982 greater than the limit, it is truncated, and a comment pointing this out is
22983 added at the top. The actual cutoff may be greater than the value given, owing
22984 to the use of buffering for transferring the message in chunks (typically 8K in
22985 size). The idea is to save bandwidth on those undeliverable 15-megabyte
22986 messages.
22987 </para>
22988 <para>
22989 <indexterm role="option">
22990 <primary><option>bounce_sender_authentication</option></primary>
22991 </indexterm>
22992 </para>
22993 <informaltable frame="all">
22994 <tgroup cols="4" colsep="0" rowsep="0">
22995 <colspec colwidth="8*" align="left"/>
22996 <colspec colwidth="6*" align="center"/>
22997 <colspec colwidth="6*" align="center"/>
22998 <colspec colwidth="6*" align="right"/>
22999 <tbody>
23000 <row>
23001 <entry><option>bounce_sender_authentication</option></entry>
23002 <entry>Use: <emphasis>main</emphasis></entry>
23003 <entry>Type: <emphasis>string</emphasis></entry>
23004 <entry>Default: <emphasis>unset</emphasis></entry>
23005 </row>
23006 </tbody>
23007 </tgroup>
23008 </informaltable>
23009 <para>
23010 <indexterm role="concept">
23011 <primary>bounce message</primary>
23012 <secondary>sender authentication</secondary>
23013 </indexterm>
23014 <indexterm role="concept">
23015 <primary>authentication</primary>
23016 <secondary>bounce message</secondary>
23017 </indexterm>
23018 <indexterm role="concept">
23019 <primary>AUTH</primary>
23020 <secondary>on bounce message</secondary>
23021 </indexterm>
23022 This option provides an authenticated sender address that is sent with any
23023 bounce messages generated by Exim that are sent over an authenticated SMTP
23024 connection. A typical setting might be:
23025 </para>
23026 <literallayout class="monospaced">
23027 bounce_sender_authentication = mailer-daemon@my.domain.example
23028 </literallayout>
23029 <para>
23030 which would cause bounce messages to be sent using the SMTP command:
23031 </para>
23032 <literallayout class="monospaced">
23033 MAIL FROM:&lt;&gt; AUTH=mailer-daemon@my.domain.example
23034 </literallayout>
23035 <para>
23036 The value of <option>bounce_sender_authentication</option> must always be a complete email
23037 address.
23038 </para>
23039 <para>
23040 <indexterm role="option">
23041 <primary><option>callout_domain_negative_expire</option></primary>
23042 </indexterm>
23043 </para>
23044 <informaltable frame="all">
23045 <tgroup cols="4" colsep="0" rowsep="0">
23046 <colspec colwidth="8*" align="left"/>
23047 <colspec colwidth="6*" align="center"/>
23048 <colspec colwidth="6*" align="center"/>
23049 <colspec colwidth="6*" align="right"/>
23050 <tbody>
23051 <row>
23052 <entry><option>callout_domain_negative_expire</option></entry>
23053 <entry>Use: <emphasis>main</emphasis></entry>
23054 <entry>Type: <emphasis>time</emphasis></entry>
23055 <entry>Default: <emphasis>3h</emphasis></entry>
23056 </row>
23057 </tbody>
23058 </tgroup>
23059 </informaltable>
23060 <para>
23061 <indexterm role="concept">
23062 <primary>caching</primary>
23063 <secondary>callout timeouts</secondary>
23064 </indexterm>
23065 <indexterm role="concept">
23066 <primary>callout</primary>
23067 <secondary>caching timeouts</secondary>
23068 </indexterm>
23069 This option specifies the expiry time for negative callout cache data for a
23070 domain. See section <xref linkend="SECTcallver"/> for details of callout verification, and
23071 section <xref linkend="SECTcallvercache"/> for details of the caching.
23072 </para>
23073 <para>
23074 <indexterm role="option">
23075 <primary><option>callout_domain_positive_expire</option></primary>
23076 </indexterm>
23077 </para>
23078 <informaltable frame="all">
23079 <tgroup cols="4" colsep="0" rowsep="0">
23080 <colspec colwidth="8*" align="left"/>
23081 <colspec colwidth="6*" align="center"/>
23082 <colspec colwidth="6*" align="center"/>
23083 <colspec colwidth="6*" align="right"/>
23084 <tbody>
23085 <row>
23086 <entry><option>callout_domain_positive_expire</option></entry>
23087 <entry>Use: <emphasis>main</emphasis></entry>
23088 <entry>Type: <emphasis>time</emphasis></entry>
23089 <entry>Default: <emphasis>7d</emphasis></entry>
23090 </row>
23091 </tbody>
23092 </tgroup>
23093 </informaltable>
23094 <para>
23095 This option specifies the expiry time for positive callout cache data for a
23096 domain. See section <xref linkend="SECTcallver"/> for details of callout verification, and
23097 section <xref linkend="SECTcallvercache"/> for details of the caching.
23098 </para>
23099 <para>
23100 <indexterm role="option">
23101 <primary><option>callout_negative_expire</option></primary>
23102 </indexterm>
23103 </para>
23104 <informaltable frame="all">
23105 <tgroup cols="4" colsep="0" rowsep="0">
23106 <colspec colwidth="8*" align="left"/>
23107 <colspec colwidth="6*" align="center"/>
23108 <colspec colwidth="6*" align="center"/>
23109 <colspec colwidth="6*" align="right"/>
23110 <tbody>
23111 <row>
23112 <entry><option>callout_negative_expire</option></entry>
23113 <entry>Use: <emphasis>main</emphasis></entry>
23114 <entry>Type: <emphasis>time</emphasis></entry>
23115 <entry>Default: <emphasis>2h</emphasis></entry>
23116 </row>
23117 </tbody>
23118 </tgroup>
23119 </informaltable>
23120 <para>
23121 This option specifies the expiry time for negative callout cache data for an
23122 address. See section <xref linkend="SECTcallver"/> for details of callout verification, and
23123 section <xref linkend="SECTcallvercache"/> for details of the caching.
23124 </para>
23125 <para>
23126 <indexterm role="option">
23127 <primary><option>callout_positive_expire</option></primary>
23128 </indexterm>
23129 </para>
23130 <informaltable frame="all">
23131 <tgroup cols="4" colsep="0" rowsep="0">
23132 <colspec colwidth="8*" align="left"/>
23133 <colspec colwidth="6*" align="center"/>
23134 <colspec colwidth="6*" align="center"/>
23135 <colspec colwidth="6*" align="right"/>
23136 <tbody>
23137 <row>
23138 <entry><option>callout_positive_expire</option></entry>
23139 <entry>Use: <emphasis>main</emphasis></entry>
23140 <entry>Type: <emphasis>time</emphasis></entry>
23141 <entry>Default: <emphasis>24h</emphasis></entry>
23142 </row>
23143 </tbody>
23144 </tgroup>
23145 </informaltable>
23146 <para>
23147 This option specifies the expiry time for positive callout cache data for an
23148 address. See section <xref linkend="SECTcallver"/> for details of callout verification, and
23149 section <xref linkend="SECTcallvercache"/> for details of the caching.
23150 </para>
23151 <para>
23152 <indexterm role="option">
23153 <primary><option>callout_random_local_part</option></primary>
23154 </indexterm>
23155 </para>
23156 <informaltable frame="all">
23157 <tgroup cols="4" colsep="0" rowsep="0">
23158 <colspec colwidth="8*" align="left"/>
23159 <colspec colwidth="6*" align="center"/>
23160 <colspec colwidth="6*" align="center"/>
23161 <colspec colwidth="6*" align="right"/>
23162 <tbody>
23163 <row>
23164 <entry><option>callout_random_local_part</option></entry>
23165 <entry>Use: <emphasis>main</emphasis></entry>
23166 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
23167 <entry>Default: <emphasis>see below</emphasis></entry>
23168 </row>
23169 </tbody>
23170 </tgroup>
23171 </informaltable>
23172 <para>
23173 This option defines the <quote>random</quote> local part that can be used as part of
23174 callout verification. The default value is
23175 </para>
23176 <literallayout class="monospaced">
23177 $primary_hostname-$tod_epoch-testing
23178 </literallayout>
23179 <para>
23180 See section <xref linkend="CALLaddparcall"/> for details of how this value is used.
23181 </para>
23182 <para>
23183 <indexterm role="option">
23184 <primary><option>check_log_inodes</option></primary>
23185 </indexterm>
23186 </para>
23187 <informaltable frame="all">
23188 <tgroup cols="4" colsep="0" rowsep="0">
23189 <colspec colwidth="8*" align="left"/>
23190 <colspec colwidth="6*" align="center"/>
23191 <colspec colwidth="6*" align="center"/>
23192 <colspec colwidth="6*" align="right"/>
23193 <tbody>
23194 <row>
23195 <entry><option>check_log_inodes</option></entry>
23196 <entry>Use: <emphasis>main</emphasis></entry>
23197 <entry>Type: <emphasis>integer</emphasis></entry>
23198 <entry>Default: <emphasis>0</emphasis></entry>
23199 </row>
23200 </tbody>
23201 </tgroup>
23202 </informaltable>
23203 <para>
23204 See <option>check_spool_space</option> below.
23205 </para>
23206 <para>
23207 <indexterm role="option">
23208 <primary><option>check_log_space</option></primary>
23209 </indexterm>
23210 </para>
23211 <informaltable frame="all">
23212 <tgroup cols="4" colsep="0" rowsep="0">
23213 <colspec colwidth="8*" align="left"/>
23214 <colspec colwidth="6*" align="center"/>
23215 <colspec colwidth="6*" align="center"/>
23216 <colspec colwidth="6*" align="right"/>
23217 <tbody>
23218 <row>
23219 <entry><option>check_log_space</option></entry>
23220 <entry>Use: <emphasis>main</emphasis></entry>
23221 <entry>Type: <emphasis>integer</emphasis></entry>
23222 <entry>Default: <emphasis>0</emphasis></entry>
23223 </row>
23224 </tbody>
23225 </tgroup>
23226 </informaltable>
23227 <para>
23228 See <option>check_spool_space</option> below.
23229 </para>
23230 <para>
23231 <indexterm role="option">
23232 <primary><option>check_rfc2047_length</option></primary>
23233 </indexterm>
23234 <indexterm role="concept">
23235 <primary>RFC 2047</primary>
23236 <secondary>disabling length check</secondary>
23237 </indexterm>
23238 <indexterm role="option">
23239 <primary><option>check_rfc2047_length</option></primary>
23240 </indexterm>
23241 </para>
23242 <informaltable frame="all">
23243 <tgroup cols="4" colsep="0" rowsep="0">
23244 <colspec colwidth="8*" align="left"/>
23245 <colspec colwidth="6*" align="center"/>
23246 <colspec colwidth="6*" align="center"/>
23247 <colspec colwidth="6*" align="right"/>
23248 <tbody>
23249 <row>
23250 <entry><option>check_rfc2047_length</option></entry>
23251 <entry>Use: <emphasis>main</emphasis></entry>
23252 <entry>Type: <emphasis>boolean</emphasis></entry>
23253 <entry>Default: <emphasis>true</emphasis></entry>
23254 </row>
23255 </tbody>
23256 </tgroup>
23257 </informaltable>
23258 <para>
23259 RFC 2047 defines a way of encoding non-ASCII characters in headers using a
23260 system of <quote>encoded words</quote>. The RFC specifies a maximum length for an encoded
23261 word; strings to be encoded that exceed this length are supposed to use
23262 multiple encoded words. By default, Exim does not recognize encoded words that
23263 exceed the maximum length. However, it seems that some software, in violation
23264 of the RFC, generates overlong encoded words. If <option>check_rfc2047_length</option> is
23265 set false, Exim recognizes encoded words of any length.
23266 </para>
23267 <para>
23268 <indexterm role="option">
23269 <primary><option>check_spool_inodes</option></primary>
23270 </indexterm>
23271 </para>
23272 <informaltable frame="all">
23273 <tgroup cols="4" colsep="0" rowsep="0">
23274 <colspec colwidth="8*" align="left"/>
23275 <colspec colwidth="6*" align="center"/>
23276 <colspec colwidth="6*" align="center"/>
23277 <colspec colwidth="6*" align="right"/>
23278 <tbody>
23279 <row>
23280 <entry><option>check_spool_inodes</option></entry>
23281 <entry>Use: <emphasis>main</emphasis></entry>
23282 <entry>Type: <emphasis>integer</emphasis></entry>
23283 <entry>Default: <emphasis>0</emphasis></entry>
23284 </row>
23285 </tbody>
23286 </tgroup>
23287 </informaltable>
23288 <para>
23289 See <option>check_spool_space</option> below.
23290 </para>
23291 <para>
23292 <indexterm role="option">
23293 <primary><option>check_spool_space</option></primary>
23294 </indexterm>
23295 </para>
23296 <informaltable frame="all">
23297 <tgroup cols="4" colsep="0" rowsep="0">
23298 <colspec colwidth="8*" align="left"/>
23299 <colspec colwidth="6*" align="center"/>
23300 <colspec colwidth="6*" align="center"/>
23301 <colspec colwidth="6*" align="right"/>
23302 <tbody>
23303 <row>
23304 <entry><option>check_spool_space</option></entry>
23305 <entry>Use: <emphasis>main</emphasis></entry>
23306 <entry>Type: <emphasis>integer</emphasis></entry>
23307 <entry>Default: <emphasis>0</emphasis></entry>
23308 </row>
23309 </tbody>
23310 </tgroup>
23311 </informaltable>
23312 <para>
23313 <indexterm role="concept">
23314 <primary>checking disk space</primary>
23315 </indexterm>
23316 <indexterm role="concept">
23317 <primary>disk space, checking</primary>
23318 </indexterm>
23319 <indexterm role="concept">
23320 <primary>spool directory</primary>
23321 <secondary>checking space</secondary>
23322 </indexterm>
23323 The four <option>check_...</option> options allow for checking of disk resources before a
23324 message is accepted.
23325 </para>
23326 <para>
23327 <indexterm role="variable">
23328 <primary><varname>$log_inodes</varname></primary>
23329 </indexterm>
23330 <indexterm role="variable">
23331 <primary><varname>$log_space</varname></primary>
23332 </indexterm>
23333 <indexterm role="variable">
23334 <primary><varname>$spool_inodes</varname></primary>
23335 </indexterm>
23336 <indexterm role="variable">
23337 <primary><varname>$spool_space</varname></primary>
23338 </indexterm>
23339 When any of these options are set, they apply to all incoming messages. If you
23340 want to apply different checks to different kinds of message, you can do so by
23341 testing the variables <varname>$log_inodes</varname>, <varname>$log_space</varname>, <varname>$spool_inodes</varname>, and
23342 <varname>$spool_space</varname> in an ACL with appropriate additional conditions.
23343 </para>
23344 <para>
23345 <option>check_spool_space</option> and <option>check_spool_inodes</option> check the spool partition if
23346 either value is greater than zero, for example:
23347 </para>
23348 <literallayout class="monospaced">
23349 check_spool_space = 10M
23350 check_spool_inodes = 100
23351 </literallayout>
23352 <para>
23353 The spool partition is the one that contains the directory defined by
23354 SPOOL_DIRECTORY in <filename>Local/Makefile</filename>. It is used for holding messages in
23355 transit.
23356 </para>
23357 <para>
23358 <option>check_log_space</option> and <option>check_log_inodes</option>  check the partition in which log
23359 files are written if either is greater than zero. These should be set only if
23360 <option>log_file_path</option> and <option>spool_directory</option> refer to different partitions.
23361 </para>
23362 <para>
23363 If there is less space or fewer inodes than requested, Exim refuses to accept
23364 incoming mail. In the case of SMTP input this is done by giving a 452 temporary
23365 error response to the MAIL command. If ESMTP is in use and there was a
23366 SIZE parameter on the MAIL command, its value is added to the
23367 <option>check_spool_space</option> value, and the check is performed even if
23368 <option>check_spool_space</option> is zero, unless <option>no_smtp_check_spool_space</option> is set.
23369 </para>
23370 <para>
23371 The values for <option>check_spool_space</option> and <option>check_log_space</option> are held as a
23372 number of kilobytes. If a non-multiple of 1024 is specified, it is rounded up.
23373 </para>
23374 <para>
23375 For non-SMTP input and for batched SMTP input, the test is done at start-up; on
23376 failure a message is written to stderr and Exim exits with a non-zero code, as
23377 it obviously cannot send an error message of any kind.
23378 </para>
23379 <para>
23380 <indexterm role="option">
23381 <primary><option>daemon_smtp_ports</option></primary>
23382 </indexterm>
23383 </para>
23384 <informaltable frame="all">
23385 <tgroup cols="4" colsep="0" rowsep="0">
23386 <colspec colwidth="8*" align="left"/>
23387 <colspec colwidth="6*" align="center"/>
23388 <colspec colwidth="6*" align="center"/>
23389 <colspec colwidth="6*" align="right"/>
23390 <tbody>
23391 <row>
23392 <entry><option>daemon_smtp_ports</option></entry>
23393 <entry>Use: <emphasis>main</emphasis></entry>
23394 <entry>Type: <emphasis>string</emphasis></entry>
23395 <entry>Default: <emphasis><literal>smtp</literal></emphasis></entry>
23396 </row>
23397 </tbody>
23398 </tgroup>
23399 </informaltable>
23400 <para>
23401 <indexterm role="concept">
23402 <primary>port</primary>
23403 <secondary>for daemon</secondary>
23404 </indexterm>
23405 <indexterm role="concept">
23406 <primary>TCP/IP</primary>
23407 <secondary>setting listening ports</secondary>
23408 </indexterm>
23409 This option specifies one or more default SMTP ports on which the Exim daemon
23410 listens. See chapter <xref linkend="CHAPinterfaces"/> for details of how it is used. For
23411 backward compatibility, <option>daemon_smtp_port</option> (singular) is a synonym.
23412 </para>
23413 <para>
23414 <indexterm role="option">
23415 <primary><option>daemon_startup_retries</option></primary>
23416 </indexterm>
23417 </para>
23418 <informaltable frame="all">
23419 <tgroup cols="4" colsep="0" rowsep="0">
23420 <colspec colwidth="8*" align="left"/>
23421 <colspec colwidth="6*" align="center"/>
23422 <colspec colwidth="6*" align="center"/>
23423 <colspec colwidth="6*" align="right"/>
23424 <tbody>
23425 <row>
23426 <entry><option>daemon_startup_retries</option></entry>
23427 <entry>Use: <emphasis>main</emphasis></entry>
23428 <entry>Type: <emphasis>integer</emphasis></entry>
23429 <entry>Default: <emphasis>9</emphasis></entry>
23430 </row>
23431 </tbody>
23432 </tgroup>
23433 </informaltable>
23434 <para>
23435 <indexterm role="concept">
23436 <primary>daemon startup, retrying</primary>
23437 </indexterm>
23438 This option, along with <option>daemon_startup_sleep</option>, controls the retrying done by
23439 the daemon at startup when it cannot immediately bind a listening socket
23440 (typically because the socket is already in use): <option>daemon_startup_retries</option>
23441 defines the number of retries after the first failure, and
23442 <option>daemon_startup_sleep</option> defines the length of time to wait between retries.
23443 </para>
23444 <para>
23445 <indexterm role="option">
23446 <primary><option>daemon_startup_sleep</option></primary>
23447 </indexterm>
23448 </para>
23449 <informaltable frame="all">
23450 <tgroup cols="4" colsep="0" rowsep="0">
23451 <colspec colwidth="8*" align="left"/>
23452 <colspec colwidth="6*" align="center"/>
23453 <colspec colwidth="6*" align="center"/>
23454 <colspec colwidth="6*" align="right"/>
23455 <tbody>
23456 <row>
23457 <entry><option>daemon_startup_sleep</option></entry>
23458 <entry>Use: <emphasis>main</emphasis></entry>
23459 <entry>Type: <emphasis>time</emphasis></entry>
23460 <entry>Default: <emphasis>30s</emphasis></entry>
23461 </row>
23462 </tbody>
23463 </tgroup>
23464 </informaltable>
23465 <para>
23466 See <option>daemon_startup_retries</option>.
23467 </para>
23468 <para>
23469 <indexterm role="option">
23470 <primary><option>delay_warning</option></primary>
23471 </indexterm>
23472 </para>
23473 <informaltable frame="all">
23474 <tgroup cols="4" colsep="0" rowsep="0">
23475 <colspec colwidth="8*" align="left"/>
23476 <colspec colwidth="6*" align="center"/>
23477 <colspec colwidth="6*" align="center"/>
23478 <colspec colwidth="6*" align="right"/>
23479 <tbody>
23480 <row>
23481 <entry><option>delay_warning</option></entry>
23482 <entry>Use: <emphasis>main</emphasis></entry>
23483 <entry>Type: <emphasis>time list</emphasis></entry>
23484 <entry>Default: <emphasis>24h</emphasis></entry>
23485 </row>
23486 </tbody>
23487 </tgroup>
23488 </informaltable>
23489 <para>
23490 <indexterm role="concept">
23491 <primary>warning of delay</primary>
23492 </indexterm>
23493 <indexterm role="concept">
23494 <primary>delay warning, specifying</primary>
23495 </indexterm>
23496 When a message is delayed, Exim sends a warning message to the sender at
23497 intervals specified by this option. The data is a colon-separated list of times
23498 after which to send warning messages. If the value of the option is an empty
23499 string or a zero time, no warnings are sent. Up to 10 times may be given. If a
23500 message has been on the queue for longer than the last time, the last interval
23501 between the times is used to compute subsequent warning times. For example,
23502 with
23503 </para>
23504 <literallayout class="monospaced">
23505 delay_warning = 4h:8h:24h
23506 </literallayout>
23507 <para>
23508 the first message is sent after 4 hours, the second after 8 hours, and
23509 the third one after 24 hours. After that, messages are sent every 16 hours,
23510 because that is the interval between the last two times on the list. If you set
23511 just one time, it specifies the repeat interval. For example, with:
23512 </para>
23513 <literallayout class="monospaced">
23514 delay_warning = 6h
23515 </literallayout>
23516 <para>
23517 messages are repeated every six hours. To stop warnings after a given time, set
23518 a very large time at the end of the list. For example:
23519 </para>
23520 <literallayout class="monospaced">
23521 delay_warning = 2h:12h:99d
23522 </literallayout>
23523 <para>
23524 Note that the option is only evaluated at the time a delivery attempt fails,
23525 which depends on retry and queue-runner configuration.
23526 Typically retries will be configured more frequently than warning messages.
23527 </para>
23528 <para>
23529 <indexterm role="option">
23530 <primary><option>delay_warning_condition</option></primary>
23531 </indexterm>
23532 </para>
23533 <informaltable frame="all">
23534 <tgroup cols="4" colsep="0" rowsep="0">
23535 <colspec colwidth="8*" align="left"/>
23536 <colspec colwidth="6*" align="center"/>
23537 <colspec colwidth="6*" align="center"/>
23538 <colspec colwidth="6*" align="right"/>
23539 <tbody>
23540 <row>
23541 <entry><option>delay_warning_condition</option></entry>
23542 <entry>Use: <emphasis>main</emphasis></entry>
23543 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
23544 <entry>Default: <emphasis>see below</emphasis></entry>
23545 </row>
23546 </tbody>
23547 </tgroup>
23548 </informaltable>
23549 <para>
23550 <indexterm role="variable">
23551 <primary><varname>$domain</varname></primary>
23552 </indexterm>
23553 The string is expanded at the time a warning message might be sent. If all the
23554 deferred addresses have the same domain, it is set in <varname>$domain</varname> during the
23555 expansion. Otherwise <varname>$domain</varname> is empty. If the result of the expansion is a
23556 forced failure, an empty string, or a string matching any of <quote>0</quote>, <quote>no</quote> or
23557 <quote>false</quote> (the comparison being done caselessly) then the warning message is
23558 not sent. The default is:
23559 </para>
23560 <literallayout class="monospaced">
23561 delay_warning_condition = ${if or {\
23562   { !eq{$h_list-id:$h_list-post:$h_list-subscribe:}{} }\
23563   { match{$h_precedence:}{(?i)bulk|list|junk} }\
23564   { match{$h_auto-submitted:}{(?i)auto-generated|auto-replied} }\
23565   } {no}{yes}}
23566 </literallayout>
23567 <para>
23568 This suppresses the sending of warnings for messages that contain <emphasis>List-ID:</emphasis>,
23569 <emphasis>List-Post:</emphasis>, or <emphasis>List-Subscribe:</emphasis> headers, or have <quote>bulk</quote>, <quote>list</quote> or
23570 <quote>junk</quote> in a <emphasis>Precedence:</emphasis> header, or have <quote>auto-generated</quote> or
23571 <quote>auto-replied</quote> in an <emphasis>Auto-Submitted:</emphasis> header.
23572 </para>
23573 <para>
23574 <indexterm role="option">
23575 <primary><option>deliver_drop_privilege</option></primary>
23576 </indexterm>
23577 </para>
23578 <informaltable frame="all">
23579 <tgroup cols="4" colsep="0" rowsep="0">
23580 <colspec colwidth="8*" align="left"/>
23581 <colspec colwidth="6*" align="center"/>
23582 <colspec colwidth="6*" align="center"/>
23583 <colspec colwidth="6*" align="right"/>
23584 <tbody>
23585 <row>
23586 <entry><option>deliver_drop_privilege</option></entry>
23587 <entry>Use: <emphasis>main</emphasis></entry>
23588 <entry>Type: <emphasis>boolean</emphasis></entry>
23589 <entry>Default: <emphasis>false</emphasis></entry>
23590 </row>
23591 </tbody>
23592 </tgroup>
23593 </informaltable>
23594 <para>
23595 <indexterm role="concept">
23596 <primary>unprivileged delivery</primary>
23597 </indexterm>
23598 <indexterm role="concept">
23599 <primary>delivery</primary>
23600 <secondary>unprivileged</secondary>
23601 </indexterm>
23602 If this option is set true, Exim drops its root privilege at the start of a
23603 delivery process, and runs as the Exim user throughout. This severely restricts
23604 the kinds of local delivery that are possible, but is viable in certain types
23605 of configuration. There is a discussion about the use of root privilege in
23606 chapter <xref linkend="CHAPsecurity"/>.
23607 </para>
23608 <para>
23609 <indexterm role="option">
23610 <primary><option>deliver_queue_load_max</option></primary>
23611 </indexterm>
23612 </para>
23613 <informaltable frame="all">
23614 <tgroup cols="4" colsep="0" rowsep="0">
23615 <colspec colwidth="8*" align="left"/>
23616 <colspec colwidth="6*" align="center"/>
23617 <colspec colwidth="6*" align="center"/>
23618 <colspec colwidth="6*" align="right"/>
23619 <tbody>
23620 <row>
23621 <entry><option>deliver_queue_load_max</option></entry>
23622 <entry>Use: <emphasis>main</emphasis></entry>
23623 <entry>Type: <emphasis>fixed-point</emphasis></entry>
23624 <entry>Default: <emphasis>unset</emphasis></entry>
23625 </row>
23626 </tbody>
23627 </tgroup>
23628 </informaltable>
23629 <para>
23630 <indexterm role="concept">
23631 <primary>load average</primary>
23632 </indexterm>
23633 <indexterm role="concept">
23634 <primary>queue runner</primary>
23635 <secondary>abandoning</secondary>
23636 </indexterm>
23637 When this option is set, a queue run is abandoned if the system load average
23638 becomes greater than the value of the option. The option has no effect on
23639 ancient operating systems on which Exim cannot determine the load average.
23640 See also <option>queue_only_load</option> and <option>smtp_load_reserve</option>.
23641 </para>
23642 <para>
23643 <indexterm role="option">
23644 <primary><option>delivery_date_remove</option></primary>
23645 </indexterm>
23646 </para>
23647 <informaltable frame="all">
23648 <tgroup cols="4" colsep="0" rowsep="0">
23649 <colspec colwidth="8*" align="left"/>
23650 <colspec colwidth="6*" align="center"/>
23651 <colspec colwidth="6*" align="center"/>
23652 <colspec colwidth="6*" align="right"/>
23653 <tbody>
23654 <row>
23655 <entry><option>delivery_date_remove</option></entry>
23656 <entry>Use: <emphasis>main</emphasis></entry>
23657 <entry>Type: <emphasis>boolean</emphasis></entry>
23658 <entry>Default: <emphasis>true</emphasis></entry>
23659 </row>
23660 </tbody>
23661 </tgroup>
23662 </informaltable>
23663 <para>
23664 <indexterm role="concept">
23665 <primary><emphasis>Delivery-date:</emphasis> header line</primary>
23666 </indexterm>
23667 Exim&#x2019;s transports have an option for adding a <emphasis>Delivery-date:</emphasis> header to a
23668 message when it is delivered, in exactly the same way as <emphasis>Return-path:</emphasis> is
23669 handled. <emphasis>Delivery-date:</emphasis> records the actual time of delivery. Such headers
23670 should not be present in incoming messages, and this option causes them to be
23671 removed at the time the message is received, to avoid any problems that might
23672 occur when a delivered message is subsequently sent on to some other recipient.
23673 </para>
23674 <para>
23675 <indexterm role="option">
23676 <primary><option>disable_fsync</option></primary>
23677 </indexterm>
23678 </para>
23679 <informaltable frame="all">
23680 <tgroup cols="4" colsep="0" rowsep="0">
23681 <colspec colwidth="8*" align="left"/>
23682 <colspec colwidth="6*" align="center"/>
23683 <colspec colwidth="6*" align="center"/>
23684 <colspec colwidth="6*" align="right"/>
23685 <tbody>
23686 <row>
23687 <entry><option>disable_fsync</option></entry>
23688 <entry>Use: <emphasis>main</emphasis></entry>
23689 <entry>Type: <emphasis>boolean</emphasis></entry>
23690 <entry>Default: <emphasis>false</emphasis></entry>
23691 </row>
23692 </tbody>
23693 </tgroup>
23694 </informaltable>
23695 <para>
23696 <indexterm role="concept">
23697 <primary><function>fsync()</function>, disabling</primary>
23698 </indexterm>
23699 This option is available only if Exim was built with the compile-time option
23700 ENABLE_DISABLE_FSYNC. When this is not set, a reference to <option>disable_fsync</option> in
23701 a runtime configuration generates an <quote>unknown option</quote> error. You should not
23702 build Exim with ENABLE_DISABLE_FSYNC or set <option>disable_fsync</option> unless you
23703 really, really, really understand what you are doing. <emphasis>No pre-compiled
23704 distributions of Exim should ever make this option available.</emphasis>
23705 </para>
23706 <para>
23707 When <option>disable_fsync</option> is set true, Exim no longer calls <function>fsync()</function> to force
23708 updated files&#x2019; data to be written to disc before continuing. Unexpected events
23709 such as crashes and power outages may cause data to be lost or scrambled.
23710 Here be Dragons. <emphasis role="bold">Beware.</emphasis>
23711 </para>
23712 <para>
23713 <indexterm role="option">
23714 <primary><option>disable_ipv6</option></primary>
23715 </indexterm>
23716 </para>
23717 <informaltable frame="all">
23718 <tgroup cols="4" colsep="0" rowsep="0">
23719 <colspec colwidth="8*" align="left"/>
23720 <colspec colwidth="6*" align="center"/>
23721 <colspec colwidth="6*" align="center"/>
23722 <colspec colwidth="6*" align="right"/>
23723 <tbody>
23724 <row>
23725 <entry><option>disable_ipv6</option></entry>
23726 <entry>Use: <emphasis>main</emphasis></entry>
23727 <entry>Type: <emphasis>boolean</emphasis></entry>
23728 <entry>Default: <emphasis>false</emphasis></entry>
23729 </row>
23730 </tbody>
23731 </tgroup>
23732 </informaltable>
23733 <para>
23734 <indexterm role="concept">
23735 <primary>IPv6</primary>
23736 <secondary>disabling</secondary>
23737 </indexterm>
23738 If this option is set true, even if the Exim binary has IPv6 support, no IPv6
23739 activities take place. AAAA records are never looked up, and any IPv6 addresses
23740 that are listed in <option>local_interfaces</option>, data for the <option>manualroute</option> router,
23741 etc. are ignored. If IP literals are enabled, the <command>ipliteral</command> router declines
23742 to handle IPv6 literal addresses.
23743 </para>
23744 <para revisionflag="changed">
23745 <indexterm role="option">
23746 <primary><option>dkim_verify_signers</option></primary>
23747 </indexterm>
23748 </para>
23749 <informaltable frame="all" revisionflag="changed">
23750 <tgroup cols="4" colsep="0" rowsep="0">
23751 <colspec colwidth="8*" align="left"/>
23752 <colspec colwidth="6*" align="center"/>
23753 <colspec colwidth="6*" align="center"/>
23754 <colspec colwidth="6*" align="right"/>
23755 <tbody>
23756 <row>
23757 <entry><option>dkim_verify_signers</option></entry>
23758 <entry>Use: <emphasis>main</emphasis></entry>
23759 <entry>Type: <emphasis>domain list</emphasis>&dagger;<emphasis></emphasis></entry>
23760 <entry>Default: <emphasis>$dkim_signers</emphasis></entry>
23761 </row>
23762 </tbody>
23763 </tgroup>
23764 </informaltable>
23765 <para revisionflag="changed">
23766 <indexterm role="concept">
23767 <primary>DKIM</primary>
23768 <secondary>controlling calls to the ACL</secondary>
23769 </indexterm>
23770 This option gives a list of DKIM domains for which the DKIM ACL is run.
23771 It is expanded after the message is received; by default it runs
23772 the ACL once for each signature in the message.
23773 See chapter <xref linkend="CHAPdkim"/>.
23774 </para>
23775 <para>
23776 <indexterm role="option">
23777 <primary><option>dns_again_means_nonexist</option></primary>
23778 </indexterm>
23779 </para>
23780 <informaltable frame="all">
23781 <tgroup cols="4" colsep="0" rowsep="0">
23782 <colspec colwidth="8*" align="left"/>
23783 <colspec colwidth="6*" align="center"/>
23784 <colspec colwidth="6*" align="center"/>
23785 <colspec colwidth="6*" align="right"/>
23786 <tbody>
23787 <row>
23788 <entry><option>dns_again_means_nonexist</option></entry>
23789 <entry>Use: <emphasis>main</emphasis></entry>
23790 <entry>Type: <emphasis>domain list</emphasis>&dagger;<emphasis></emphasis></entry>
23791 <entry>Default: <emphasis>unset</emphasis></entry>
23792 </row>
23793 </tbody>
23794 </tgroup>
23795 </informaltable>
23796 <para>
23797 <indexterm role="concept">
23798 <primary>DNS</primary>
23799 <secondary><quote>try again</quote> response; overriding</secondary>
23800 </indexterm>
23801 DNS lookups give a <quote>try again</quote> response for the DNS errors
23802 <quote>non-authoritative host not found</quote> and <quote>SERVERFAIL</quote>. This can cause Exim to
23803 keep trying to deliver a message, or to give repeated temporary errors to
23804 incoming mail. Sometimes the effect is caused by a badly set up name server and
23805 may persist for a long time. If a domain which exhibits this problem matches
23806 anything in <option>dns_again_means_nonexist</option>, it is treated as if it did not exist.
23807 This option should be used with care. You can make it apply to reverse lookups
23808 by a setting such as this:
23809 </para>
23810 <literallayout class="monospaced">
23811 dns_again_means_nonexist = *.in-addr.arpa
23812 </literallayout>
23813 <para>
23814 This option applies to all DNS lookups that Exim does. It also applies when the
23815 <function>gethostbyname()</function> or <function>getipnodebyname()</function> functions give temporary errors,
23816 since these are most likely to be caused by DNS lookup problems. The
23817 <command>dnslookup</command> router has some options of its own for controlling what happens
23818 when lookups for MX or SRV records give temporary errors. These more specific
23819 options are applied after this global option.
23820 </para>
23821 <para>
23822 <indexterm role="option">
23823 <primary><option>dns_check_names_pattern</option></primary>
23824 </indexterm>
23825 </para>
23826 <informaltable frame="all">
23827 <tgroup cols="4" colsep="0" rowsep="0">
23828 <colspec colwidth="8*" align="left"/>
23829 <colspec colwidth="6*" align="center"/>
23830 <colspec colwidth="6*" align="center"/>
23831 <colspec colwidth="6*" align="right"/>
23832 <tbody>
23833 <row>
23834 <entry><option>dns_check_names_pattern</option></entry>
23835 <entry>Use: <emphasis>main</emphasis></entry>
23836 <entry>Type: <emphasis>string</emphasis></entry>
23837 <entry>Default: <emphasis>see below</emphasis></entry>
23838 </row>
23839 </tbody>
23840 </tgroup>
23841 </informaltable>
23842 <para>
23843 <indexterm role="concept">
23844 <primary>DNS</primary>
23845 <secondary>pre-check of name syntax</secondary>
23846 </indexterm>
23847 When this option is set to a non-empty string, it causes Exim to check domain
23848 names for characters that are not allowed in host names before handing them to
23849 the DNS resolver, because some resolvers give temporary errors for names that
23850 contain unusual characters. If a domain name contains any unwanted characters,
23851 a <quote>not found</quote> result is forced, and the resolver is not called. The check is
23852 done by matching the domain name against a regular expression, which is the
23853 value of this option. The default pattern is
23854 </para>
23855 <literallayout class="monospaced">
23856 dns_check_names_pattern = \
23857   (?i)^(?&gt;(?(1)\.|())[^\W_](?&gt;[a-z0-9/-]*[^\W_])?)+$
23858 </literallayout>
23859 <para>
23860 which permits only letters, digits, slashes, and hyphens in components, but
23861 they must start and end with a letter or digit. Slashes are not, in fact,
23862 permitted in host names, but they are found in certain NS records (which can be
23863 accessed in Exim by using a <option>dnsdb</option> lookup). If you set
23864 <option>allow_utf8_domains</option>, you must modify this pattern, or set the option to an
23865 empty string.
23866 </para>
23867 <para>
23868 <indexterm role="option">
23869 <primary><option>dns_csa_search_limit</option></primary>
23870 </indexterm>
23871 </para>
23872 <informaltable frame="all">
23873 <tgroup cols="4" colsep="0" rowsep="0">
23874 <colspec colwidth="8*" align="left"/>
23875 <colspec colwidth="6*" align="center"/>
23876 <colspec colwidth="6*" align="center"/>
23877 <colspec colwidth="6*" align="right"/>
23878 <tbody>
23879 <row>
23880 <entry><option>dns_csa_search_limit</option></entry>
23881 <entry>Use: <emphasis>main</emphasis></entry>
23882 <entry>Type: <emphasis>integer</emphasis></entry>
23883 <entry>Default: <emphasis>5</emphasis></entry>
23884 </row>
23885 </tbody>
23886 </tgroup>
23887 </informaltable>
23888 <para>
23889 This option controls the depth of parental searching for CSA SRV records in the
23890 DNS, as described in more detail in section <xref linkend="SECTverifyCSA"/>.
23891 </para>
23892 <para>
23893 <indexterm role="option">
23894 <primary><option>dns_csa_use_reverse</option></primary>
23895 </indexterm>
23896 </para>
23897 <informaltable frame="all">
23898 <tgroup cols="4" colsep="0" rowsep="0">
23899 <colspec colwidth="8*" align="left"/>
23900 <colspec colwidth="6*" align="center"/>
23901 <colspec colwidth="6*" align="center"/>
23902 <colspec colwidth="6*" align="right"/>
23903 <tbody>
23904 <row>
23905 <entry><option>dns_csa_use_reverse</option></entry>
23906 <entry>Use: <emphasis>main</emphasis></entry>
23907 <entry>Type: <emphasis>boolean</emphasis></entry>
23908 <entry>Default: <emphasis>true</emphasis></entry>
23909 </row>
23910 </tbody>
23911 </tgroup>
23912 </informaltable>
23913 <para>
23914 This option controls whether or not an IP address, given as a CSA domain, is
23915 reversed and looked up in the reverse DNS, as described in more detail in
23916 section <xref linkend="SECTverifyCSA"/>.
23917 </para>
23918 <para>
23919 <indexterm role="option">
23920 <primary><option>dns_dnssec_ok</option></primary>
23921 </indexterm>
23922 </para>
23923 <informaltable frame="all">
23924 <tgroup cols="4" colsep="0" rowsep="0">
23925 <colspec colwidth="8*" align="left"/>
23926 <colspec colwidth="6*" align="center"/>
23927 <colspec colwidth="6*" align="center"/>
23928 <colspec colwidth="6*" align="right"/>
23929 <tbody>
23930 <row>
23931 <entry><option>dns_dnssec_ok</option></entry>
23932 <entry>Use: <emphasis>main</emphasis></entry>
23933 <entry>Type: <emphasis>integer</emphasis></entry>
23934 <entry>Default: <emphasis>-1</emphasis></entry>
23935 </row>
23936 </tbody>
23937 </tgroup>
23938 </informaltable>
23939 <para>
23940 <indexterm role="concept">
23941 <primary>DNS</primary>
23942 <secondary>resolver options</secondary>
23943 </indexterm>
23944 <indexterm role="concept">
23945 <primary>DNS</primary>
23946 <secondary>DNSSEC</secondary>
23947 </indexterm>
23948 If this option is set to a non-negative number then Exim will initialise the
23949 DNS resolver library to either use or not use DNSSEC, overriding the system
23950 default. A value of 0 coerces DNSSEC off, a value of 1 coerces DNSSEC on.
23951 </para>
23952 <para>
23953 If the resolver library does not support DNSSEC then this option has no effect.
23954 </para>
23955 <para>
23956 <indexterm role="option">
23957 <primary><option>dns_ipv4_lookup</option></primary>
23958 </indexterm>
23959 </para>
23960 <informaltable frame="all">
23961 <tgroup cols="4" colsep="0" rowsep="0">
23962 <colspec colwidth="8*" align="left"/>
23963 <colspec colwidth="6*" align="center"/>
23964 <colspec colwidth="6*" align="center"/>
23965 <colspec colwidth="6*" align="right"/>
23966 <tbody>
23967 <row>
23968 <entry><option>dns_ipv4_lookup</option></entry>
23969 <entry>Use: <emphasis>main</emphasis></entry>
23970 <entry>Type: <emphasis>domain list</emphasis>&dagger;<emphasis></emphasis></entry>
23971 <entry>Default: <emphasis>unset</emphasis></entry>
23972 </row>
23973 </tbody>
23974 </tgroup>
23975 </informaltable>
23976 <para>
23977 <indexterm role="concept">
23978 <primary>IPv6</primary>
23979 <secondary>DNS lookup for AAAA records</secondary>
23980 </indexterm>
23981 <indexterm role="concept">
23982 <primary>DNS</primary>
23983 <secondary>IPv6 lookup for AAAA records</secondary>
23984 </indexterm>
23985 When Exim is compiled with IPv6 support and <option>disable_ipv6</option> is not set, it
23986 looks for IPv6 address records (AAAA records) as well as IPv4 address records
23987 (A records) when trying to find IP addresses for hosts, unless the host&#x2019;s
23988 domain matches this list.
23989 </para>
23990 <para>
23991 This is a fudge to help with name servers that give big delays or otherwise do
23992 not work for the AAAA record type. In due course, when the world&#x2019;s name
23993 servers have all been upgraded, there should be no need for this option.
23994 </para>
23995 <para>
23996 <indexterm role="option">
23997 <primary><option>dns_retrans</option></primary>
23998 </indexterm>
23999 </para>
24000 <informaltable frame="all">
24001 <tgroup cols="4" colsep="0" rowsep="0">
24002 <colspec colwidth="8*" align="left"/>
24003 <colspec colwidth="6*" align="center"/>
24004 <colspec colwidth="6*" align="center"/>
24005 <colspec colwidth="6*" align="right"/>
24006 <tbody>
24007 <row>
24008 <entry><option>dns_retrans</option></entry>
24009 <entry>Use: <emphasis>main</emphasis></entry>
24010 <entry>Type: <emphasis>time</emphasis></entry>
24011 <entry>Default: <emphasis>0s</emphasis></entry>
24012 </row>
24013 </tbody>
24014 </tgroup>
24015 </informaltable>
24016 <para>
24017 <indexterm role="concept">
24018 <primary>DNS</primary>
24019 <secondary>resolver options</secondary>
24020 </indexterm>
24021 <indexterm role="concept">
24022 <primary>timeout</primary>
24023 <secondary>dns lookup</secondary>
24024 </indexterm>
24025 <indexterm role="concept">
24026 <primary>DNS</primary>
24027 <secondary>timeout</secondary>
24028 </indexterm>
24029 The options <option>dns_retrans</option> and <option>dns_retry</option> can be used to set the
24030 retransmission and retry parameters for DNS lookups. Values of zero (the
24031 defaults) leave the system default settings unchanged. The first value is the
24032 time between retries, and the second is the number of retries. It isn&#x2019;t
24033 totally clear exactly how these settings affect the total time a DNS lookup may
24034 take. I haven&#x2019;t found any documentation about timeouts on DNS lookups; these
24035 parameter values are available in the external resolver interface structure,
24036 but nowhere does it seem to describe how they are used or what you might want
24037 to set in them.
24038 </para>
24039 <para revisionflag="changed">
24040 See also the <option>slow_lookup_log</option> option.
24041 </para>
24042 <para>
24043 <indexterm role="option">
24044 <primary><option>dns_retry</option></primary>
24045 </indexterm>
24046 </para>
24047 <informaltable frame="all">
24048 <tgroup cols="4" colsep="0" rowsep="0">
24049 <colspec colwidth="8*" align="left"/>
24050 <colspec colwidth="6*" align="center"/>
24051 <colspec colwidth="6*" align="center"/>
24052 <colspec colwidth="6*" align="right"/>
24053 <tbody>
24054 <row>
24055 <entry><option>dns_retry</option></entry>
24056 <entry>Use: <emphasis>main</emphasis></entry>
24057 <entry>Type: <emphasis>integer</emphasis></entry>
24058 <entry>Default: <emphasis>0</emphasis></entry>
24059 </row>
24060 </tbody>
24061 </tgroup>
24062 </informaltable>
24063 <para>
24064 See <option>dns_retrans</option> above.
24065 </para>
24066 <para revisionflag="changed">
24067 <indexterm role="option">
24068 <primary><option>dns_trust_aa</option></primary>
24069 </indexterm>
24070 </para>
24071 <informaltable frame="all" revisionflag="changed">
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>dns_trust_aa</option></entry>
24080 <entry>Use: <emphasis>main</emphasis></entry>
24081 <entry>Type: <emphasis>domain list</emphasis>&dagger;<emphasis></emphasis></entry>
24082 <entry>Default: <emphasis>unset</emphasis></entry>
24083 </row>
24084 </tbody>
24085 </tgroup>
24086 </informaltable>
24087 <para revisionflag="changed">
24088 <indexterm role="concept">
24089 <primary>DNS</primary>
24090 <secondary>resolver options</secondary>
24091 </indexterm>
24092 <indexterm role="concept">
24093 <primary>DNS</primary>
24094 <secondary>DNSSEC</secondary>
24095 </indexterm>
24096 If this option is set then lookup results marked with the AA bit
24097 (Authoritative Answer) are trusted the same way as if they were
24098 DNSSEC-verified. The authority section&#x2019;s name of the answer must
24099 match with this expanded domain list.
24100 </para>
24101 <para revisionflag="changed">
24102 Use this option only if you talk directly to a resolver that is
24103 authoritative for some zones and does not set the AD (Authentic Data)
24104 bit in the answer. Some DNS servers may have an configuration option to
24105 mark the answers from their own zones as verified (they set the AD bit).
24106 Others do not have this option. It is considered as poor practice using
24107 a resolver that is an authoritative server for some zones.
24108 </para>
24109 <para revisionflag="changed">
24110 Use this option only if you really have to (e.g. if you want
24111 to use DANE for remote delivery to a server that is listed in the DNS
24112 zones that your resolver is authoritative for).
24113 </para>
24114 <para revisionflag="changed">
24115 If the DNS answer packet has the AA bit set and contains resource record
24116 in the answer section, the name of the first NS record appearing in the
24117 authority section is compared against the list. If the answer packet is
24118 authoritative but the answer section is empty, the name of the first SOA
24119 record in the authoritative section is used instead.
24120 </para>
24121 <para>
24122 <indexterm role="concept">
24123 <primary>DNS</primary>
24124 <secondary>resolver options</secondary>
24125 </indexterm>
24126 <indexterm role="option">
24127 <primary><option>dns_use_edns0</option></primary>
24128 </indexterm>
24129 </para>
24130 <informaltable frame="all">
24131 <tgroup cols="4" colsep="0" rowsep="0">
24132 <colspec colwidth="8*" align="left"/>
24133 <colspec colwidth="6*" align="center"/>
24134 <colspec colwidth="6*" align="center"/>
24135 <colspec colwidth="6*" align="right"/>
24136 <tbody>
24137 <row>
24138 <entry><option>dns_use_edns0</option></entry>
24139 <entry>Use: <emphasis>main</emphasis></entry>
24140 <entry>Type: <emphasis>integer</emphasis></entry>
24141 <entry>Default: <emphasis>-1</emphasis></entry>
24142 </row>
24143 </tbody>
24144 </tgroup>
24145 </informaltable>
24146 <para>
24147 <indexterm role="concept">
24148 <primary>DNS</primary>
24149 <secondary>resolver options</secondary>
24150 </indexterm>
24151 <indexterm role="concept">
24152 <primary>DNS</primary>
24153 <secondary>EDNS0</secondary>
24154 </indexterm>
24155 If this option is set to a non-negative number then Exim will initialise the
24156 DNS resolver library to either use or not use EDNS0 extensions, overriding
24157 the system default. A value of 0 coerces EDNS0 off, a value of 1 coerces EDNS0
24158 on.
24159 </para>
24160 <para>
24161 If the resolver library does not support EDNS0 then this option has no effect.
24162 </para>
24163 <para>
24164 <indexterm role="option">
24165 <primary><option>drop_cr</option></primary>
24166 </indexterm>
24167 </para>
24168 <informaltable frame="all">
24169 <tgroup cols="4" colsep="0" rowsep="0">
24170 <colspec colwidth="8*" align="left"/>
24171 <colspec colwidth="6*" align="center"/>
24172 <colspec colwidth="6*" align="center"/>
24173 <colspec colwidth="6*" align="right"/>
24174 <tbody>
24175 <row>
24176 <entry><option>drop_cr</option></entry>
24177 <entry>Use: <emphasis>main</emphasis></entry>
24178 <entry>Type: <emphasis>boolean</emphasis></entry>
24179 <entry>Default: <emphasis>false</emphasis></entry>
24180 </row>
24181 </tbody>
24182 </tgroup>
24183 </informaltable>
24184 <para>
24185 This is an obsolete option that is now a no-op. It used to affect the way Exim
24186 handled CR and LF characters in incoming messages. What happens now is
24187 described in section <xref linkend="SECTlineendings"/>.
24188 </para>
24189 <para revisionflag="changed">
24190 <indexterm role="option">
24191 <primary><option>dsn_advertise_hosts</option></primary>
24192 </indexterm>
24193 </para>
24194 <informaltable frame="all" revisionflag="changed">
24195 <tgroup cols="4" colsep="0" rowsep="0">
24196 <colspec colwidth="8*" align="left"/>
24197 <colspec colwidth="6*" align="center"/>
24198 <colspec colwidth="6*" align="center"/>
24199 <colspec colwidth="6*" align="right"/>
24200 <tbody>
24201 <row>
24202 <entry><option>dsn_advertise_hosts</option></entry>
24203 <entry>Use: <emphasis>main</emphasis></entry>
24204 <entry>Type: <emphasis>host list</emphasis>&dagger;<emphasis></emphasis></entry>
24205 <entry>Default: <emphasis>unset</emphasis></entry>
24206 </row>
24207 </tbody>
24208 </tgroup>
24209 </informaltable>
24210 <para revisionflag="changed">
24211 <indexterm role="concept">
24212 <primary>bounce messages</primary>
24213 <secondary>success</secondary>
24214 </indexterm>
24215 <indexterm role="concept">
24216 <primary>DSN</primary>
24217 <secondary>success</secondary>
24218 </indexterm>
24219 <indexterm role="concept">
24220 <primary>Delivery Status Notification</primary>
24221 <secondary>success</secondary>
24222 </indexterm>
24223 DSN extensions (RFC3461) will be advertised in the EHLO message to,
24224 and accepted from, these hosts.
24225 Hosts may use the NOTIFY and ENVID options on RCPT TO commands,
24226 and RET and ORCPT options on MAIL FROM commands.
24227 A NOTIFY=SUCCESS option requests success-DSN messages.
24228 A NOTIFY= option with no argument requests that no delay or failure DSNs
24229 are sent.
24230 </para>
24231 <para>
24232 <indexterm role="option">
24233 <primary><option>dsn_from</option></primary>
24234 </indexterm>
24235 </para>
24236 <informaltable frame="all">
24237 <tgroup cols="4" colsep="0" rowsep="0">
24238 <colspec colwidth="8*" align="left"/>
24239 <colspec colwidth="6*" align="center"/>
24240 <colspec colwidth="6*" align="center"/>
24241 <colspec colwidth="6*" align="right"/>
24242 <tbody>
24243 <row>
24244 <entry><option>dsn_from</option></entry>
24245 <entry>Use: <emphasis>main</emphasis></entry>
24246 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
24247 <entry>Default: <emphasis>see below</emphasis></entry>
24248 </row>
24249 </tbody>
24250 </tgroup>
24251 </informaltable>
24252 <para>
24253 <indexterm role="concept">
24254 <primary><emphasis>From:</emphasis> header line</primary>
24255 <secondary>in bounces</secondary>
24256 </indexterm>
24257 <indexterm role="concept">
24258 <primary>bounce messages</primary>
24259 <secondary><emphasis>From:</emphasis> line, specifying</secondary>
24260 </indexterm>
24261 This option can be used to vary the contents of <emphasis>From:</emphasis> header lines in
24262 bounces and other automatically generated messages (<quote>Delivery Status
24263 Notifications</quote> &ndash; hence the name of the option). The default setting is:
24264 </para>
24265 <literallayout class="monospaced">
24266 dsn_from = Mail Delivery System &lt;Mailer-Daemon@$qualify_domain&gt;
24267 </literallayout>
24268 <para>
24269 The value is expanded every time it is needed. If the expansion fails, a
24270 panic is logged, and the default value is used.
24271 </para>
24272 <para>
24273 <indexterm role="option">
24274 <primary><option>envelope_to_remove</option></primary>
24275 </indexterm>
24276 </para>
24277 <informaltable frame="all">
24278 <tgroup cols="4" colsep="0" rowsep="0">
24279 <colspec colwidth="8*" align="left"/>
24280 <colspec colwidth="6*" align="center"/>
24281 <colspec colwidth="6*" align="center"/>
24282 <colspec colwidth="6*" align="right"/>
24283 <tbody>
24284 <row>
24285 <entry><option>envelope_to_remove</option></entry>
24286 <entry>Use: <emphasis>main</emphasis></entry>
24287 <entry>Type: <emphasis>boolean</emphasis></entry>
24288 <entry>Default: <emphasis>true</emphasis></entry>
24289 </row>
24290 </tbody>
24291 </tgroup>
24292 </informaltable>
24293 <para>
24294 <indexterm role="concept">
24295 <primary><emphasis>Envelope-to:</emphasis> header line</primary>
24296 </indexterm>
24297 Exim&#x2019;s transports have an option for adding an <emphasis>Envelope-to:</emphasis> header to a
24298 message when it is delivered, in exactly the same way as <emphasis>Return-path:</emphasis> is
24299 handled. <emphasis>Envelope-to:</emphasis> records the original recipient address from the
24300 message&#x2019;s envelope that caused the delivery to happen. Such headers should not
24301 be present in incoming messages, and this option causes them to be removed at
24302 the time the message is received, to avoid any problems that might occur when a
24303 delivered message is subsequently sent on to some other recipient.
24304 </para>
24305 <para>
24306 <indexterm role="option">
24307 <primary><option>errors_copy</option></primary>
24308 </indexterm>
24309 </para>
24310 <informaltable frame="all">
24311 <tgroup cols="4" colsep="0" rowsep="0">
24312 <colspec colwidth="8*" align="left"/>
24313 <colspec colwidth="6*" align="center"/>
24314 <colspec colwidth="6*" align="center"/>
24315 <colspec colwidth="6*" align="right"/>
24316 <tbody>
24317 <row>
24318 <entry><option>errors_copy</option></entry>
24319 <entry>Use: <emphasis>main</emphasis></entry>
24320 <entry>Type: <emphasis>string list</emphasis>&dagger;<emphasis></emphasis></entry>
24321 <entry>Default: <emphasis>unset</emphasis></entry>
24322 </row>
24323 </tbody>
24324 </tgroup>
24325 </informaltable>
24326 <para>
24327 <indexterm role="concept">
24328 <primary>bounce message</primary>
24329 <secondary>copy to other address</secondary>
24330 </indexterm>
24331 <indexterm role="concept">
24332 <primary>copy of bounce message</primary>
24333 </indexterm>
24334 Setting this option causes Exim to send bcc copies of bounce messages that it
24335 generates to other addresses. <emphasis role="bold">Note</emphasis>: This does not apply to bounce messages
24336 coming from elsewhere. The value of the option is a colon-separated list of
24337 items. Each item consists of a pattern, terminated by white space, followed by
24338 a comma-separated list of email addresses. If a pattern contains spaces, it
24339 must be enclosed in double quotes.
24340 </para>
24341 <para>
24342 Each pattern is processed in the same way as a single item in an address list
24343 (see section <xref linkend="SECTaddresslist"/>). When a pattern matches the recipient of
24344 the bounce message, the message is copied to the addresses on the list. The
24345 items are scanned in order, and once a matching one is found, no further items
24346 are examined. For example:
24347 </para>
24348 <literallayout class="monospaced">
24349 errors_copy = spqr@mydomain   postmaster@mydomain.example :\
24350               rqps@mydomain   hostmaster@mydomain.example,\
24351                               postmaster@mydomain.example
24352 </literallayout>
24353 <para>
24354 <indexterm role="variable">
24355 <primary><varname>$domain</varname></primary>
24356 </indexterm>
24357 <indexterm role="variable">
24358 <primary><varname>$local_part</varname></primary>
24359 </indexterm>
24360 The address list is expanded before use. The expansion variables <varname>$local_part</varname>
24361 and <varname>$domain</varname> are set from the original recipient of the error message, and if
24362 there was any wildcard matching in the pattern, the expansion
24363 <indexterm role="concept">
24364 <primary>numerical variables (<varname>$1</varname> <varname>$2</varname> etc)</primary>
24365 <secondary>in <option>errors_copy</option></secondary>
24366 </indexterm>
24367 variables <varname>$0</varname>, <varname>$1</varname>, etc. are set in the normal way.
24368 </para>
24369 <para>
24370 <indexterm role="option">
24371 <primary><option>errors_reply_to</option></primary>
24372 </indexterm>
24373 </para>
24374 <informaltable frame="all">
24375 <tgroup cols="4" colsep="0" rowsep="0">
24376 <colspec colwidth="8*" align="left"/>
24377 <colspec colwidth="6*" align="center"/>
24378 <colspec colwidth="6*" align="center"/>
24379 <colspec colwidth="6*" align="right"/>
24380 <tbody>
24381 <row>
24382 <entry><option>errors_reply_to</option></entry>
24383 <entry>Use: <emphasis>main</emphasis></entry>
24384 <entry>Type: <emphasis>string</emphasis></entry>
24385 <entry>Default: <emphasis>unset</emphasis></entry>
24386 </row>
24387 </tbody>
24388 </tgroup>
24389 </informaltable>
24390 <para>
24391 <indexterm role="concept">
24392 <primary>bounce message</primary>
24393 <secondary><emphasis>Reply-to:</emphasis> in</secondary>
24394 </indexterm>
24395 By default, Exim&#x2019;s bounce and delivery warning messages contain the header line
24396 </para>
24397 <literallayout>
24398 <literal>From: Mail Delivery System &lt;Mailer-Daemon@</literal><emphasis>qualify-domain</emphasis><literal>&gt;</literal>
24399 </literallayout>
24400 <para>
24401 <indexterm role="option">
24402 <primary><option>quota_warn_message</option></primary>
24403 </indexterm>
24404 where <emphasis>qualify-domain</emphasis> is the value of the <option>qualify_domain</option> option.
24405 A warning message that is generated by the <option>quota_warn_message</option> option in an
24406 <command>appendfile</command> transport may contain its own <emphasis>From:</emphasis> header line that
24407 overrides the default.
24408 </para>
24409 <para>
24410 Experience shows that people reply to bounce messages. If the
24411 <option>errors_reply_to</option> option is set, a <emphasis>Reply-To:</emphasis> header is added to bounce
24412 and warning messages. For example:
24413 </para>
24414 <literallayout class="monospaced">
24415 errors_reply_to = postmaster@my.domain.example
24416 </literallayout>
24417 <para>
24418 The value of the option is not expanded. It must specify a valid RFC 2822
24419 address. However, if a warning message that is generated by the
24420 <option>quota_warn_message</option> option in an <command>appendfile</command> transport contain its
24421 own <emphasis>Reply-To:</emphasis> header line, the value of the <option>errors_reply_to</option> option is
24422 not used.
24423 </para>
24424 <para>
24425 <indexterm role="option">
24426 <primary><option>exim_group</option></primary>
24427 </indexterm>
24428 </para>
24429 <informaltable frame="all">
24430 <tgroup cols="4" colsep="0" rowsep="0">
24431 <colspec colwidth="8*" align="left"/>
24432 <colspec colwidth="6*" align="center"/>
24433 <colspec colwidth="6*" align="center"/>
24434 <colspec colwidth="6*" align="right"/>
24435 <tbody>
24436 <row>
24437 <entry><option>exim_group</option></entry>
24438 <entry>Use: <emphasis>main</emphasis></entry>
24439 <entry>Type: <emphasis>string</emphasis></entry>
24440 <entry>Default: <emphasis>compile-time configured</emphasis></entry>
24441 </row>
24442 </tbody>
24443 </tgroup>
24444 </informaltable>
24445 <para>
24446 <indexterm role="concept">
24447 <primary>gid (group id)</primary>
24448 <secondary>Exim&#x2019;s own</secondary>
24449 </indexterm>
24450 <indexterm role="concept">
24451 <primary>Exim group</primary>
24452 </indexterm>
24453 This option changes the gid under which Exim runs when it gives up root
24454 privilege. The default value is compiled into the binary. The value of this
24455 option is used only when <option>exim_user</option> is also set. Unless it consists entirely
24456 of digits, the string is looked up using <function>getgrnam()</function>, and failure causes a
24457 configuration error. See chapter <xref linkend="CHAPsecurity"/> for a discussion of
24458 security issues.
24459 </para>
24460 <para>
24461 <indexterm role="option">
24462 <primary><option>exim_path</option></primary>
24463 </indexterm>
24464 </para>
24465 <informaltable frame="all">
24466 <tgroup cols="4" colsep="0" rowsep="0">
24467 <colspec colwidth="8*" align="left"/>
24468 <colspec colwidth="6*" align="center"/>
24469 <colspec colwidth="6*" align="center"/>
24470 <colspec colwidth="6*" align="right"/>
24471 <tbody>
24472 <row>
24473 <entry><option>exim_path</option></entry>
24474 <entry>Use: <emphasis>main</emphasis></entry>
24475 <entry>Type: <emphasis>string</emphasis></entry>
24476 <entry>Default: <emphasis>see below</emphasis></entry>
24477 </row>
24478 </tbody>
24479 </tgroup>
24480 </informaltable>
24481 <para>
24482 <indexterm role="concept">
24483 <primary>Exim binary, path name</primary>
24484 </indexterm>
24485 This option specifies the path name of the Exim binary, which is used when Exim
24486 needs to re-exec itself. The default is set up to point to the file <emphasis>exim</emphasis> in
24487 the directory configured at compile time by the BIN_DIRECTORY setting. It
24488 is necessary to change <option>exim_path</option> if, exceptionally, Exim is run from some
24489 other place.
24490 <emphasis role="bold">Warning</emphasis>: Do not use a macro to define the value of this option, because
24491 you will break those Exim utilities that scan the configuration file to find
24492 where the binary is. (They then use the <option>-bP</option> option to extract option
24493 settings such as the value of <option>spool_directory</option>.)
24494 </para>
24495 <para>
24496 <indexterm role="option">
24497 <primary><option>exim_user</option></primary>
24498 </indexterm>
24499 </para>
24500 <informaltable frame="all">
24501 <tgroup cols="4" colsep="0" rowsep="0">
24502 <colspec colwidth="8*" align="left"/>
24503 <colspec colwidth="6*" align="center"/>
24504 <colspec colwidth="6*" align="center"/>
24505 <colspec colwidth="6*" align="right"/>
24506 <tbody>
24507 <row>
24508 <entry><option>exim_user</option></entry>
24509 <entry>Use: <emphasis>main</emphasis></entry>
24510 <entry>Type: <emphasis>string</emphasis></entry>
24511 <entry>Default: <emphasis>compile-time configured</emphasis></entry>
24512 </row>
24513 </tbody>
24514 </tgroup>
24515 </informaltable>
24516 <para>
24517 <indexterm role="concept">
24518 <primary>uid (user id)</primary>
24519 <secondary>Exim&#x2019;s own</secondary>
24520 </indexterm>
24521 <indexterm role="concept">
24522 <primary>Exim user</primary>
24523 </indexterm>
24524 This option changes the uid under which Exim runs when it gives up root
24525 privilege. The default value is compiled into the binary. Ownership of the run
24526 time configuration file and the use of the <option>-C</option> and <option>-D</option> command line
24527 options is checked against the values in the binary, not what is set here.
24528 </para>
24529 <para>
24530 Unless it consists entirely of digits, the string is looked up using
24531 <function>getpwnam()</function>, and failure causes a configuration error. If <option>exim_group</option> is
24532 not also supplied, the gid is taken from the result of <function>getpwnam()</function> if it is
24533 used. See chapter <xref linkend="CHAPsecurity"/> for a discussion of security issues.
24534 </para>
24535 <para>
24536 <indexterm role="option">
24537 <primary><option>extra_local_interfaces</option></primary>
24538 </indexterm>
24539 </para>
24540 <informaltable frame="all">
24541 <tgroup cols="4" colsep="0" rowsep="0">
24542 <colspec colwidth="8*" align="left"/>
24543 <colspec colwidth="6*" align="center"/>
24544 <colspec colwidth="6*" align="center"/>
24545 <colspec colwidth="6*" align="right"/>
24546 <tbody>
24547 <row>
24548 <entry><option>extra_local_interfaces</option></entry>
24549 <entry>Use: <emphasis>main</emphasis></entry>
24550 <entry>Type: <emphasis>string list</emphasis></entry>
24551 <entry>Default: <emphasis>unset</emphasis></entry>
24552 </row>
24553 </tbody>
24554 </tgroup>
24555 </informaltable>
24556 <para>
24557 This option defines network interfaces that are to be considered local when
24558 routing, but which are not used for listening by the daemon. See section
24559 <xref linkend="SECTreclocipadd"/> for details.
24560 </para>
24561 <para>
24562 <indexterm role="option">
24563 <primary><option>extract_addresses_remove_arguments</option></primary>
24564 </indexterm>
24565 </para>
24566 <informaltable frame="all">
24567 <tgroup cols="4" colsep="0" rowsep="0">
24568 <colspec colwidth="8*" align="left"/>
24569 <colspec colwidth="6*" align="center"/>
24570 <colspec colwidth="6*" align="center"/>
24571 <colspec colwidth="6*" align="right"/>
24572 <tbody>
24573 <row>
24574 <entry><option>extract_addresses_remove_ &nbsp;&nbsp;arguments</option></entry>
24575 <entry>Use: <emphasis>main</emphasis></entry>
24576 <entry>Type: <emphasis>boolean</emphasis></entry>
24577 <entry>Default: <emphasis>true</emphasis></entry>
24578 </row>
24579 </tbody>
24580 </tgroup>
24581 </informaltable>
24582 <para>
24583 <indexterm role="option">
24584 <primary><option>-t</option></primary>
24585 </indexterm>
24586 <indexterm role="concept">
24587 <primary>command line</primary>
24588 <secondary>addresses with <option>-t</option></secondary>
24589 </indexterm>
24590 <indexterm role="concept">
24591 <primary>Sendmail compatibility</primary>
24592 <secondary><option>-t</option> option</secondary>
24593 </indexterm>
24594 According to some Sendmail documentation (Sun, IRIX, HP-UX), if any addresses
24595 are present on the command line when the <option>-t</option> option is used to build an
24596 envelope from a message&#x2019;s <emphasis>To:</emphasis>, <emphasis>Cc:</emphasis> and <emphasis>Bcc:</emphasis> headers, the command
24597 line addresses are removed from the recipients list. This is also how Smail
24598 behaves. However, other Sendmail documentation (the O&#x2019;Reilly book) states that
24599 command line addresses are added to those obtained from the header lines. When
24600 <option>extract_addresses_remove_arguments</option> is true (the default), Exim subtracts
24601 argument headers. If it is set false, Exim adds rather than removes argument
24602 addresses.
24603 </para>
24604 <para>
24605 <indexterm role="option">
24606 <primary><option>finduser_retries</option></primary>
24607 </indexterm>
24608 </para>
24609 <informaltable frame="all">
24610 <tgroup cols="4" colsep="0" rowsep="0">
24611 <colspec colwidth="8*" align="left"/>
24612 <colspec colwidth="6*" align="center"/>
24613 <colspec colwidth="6*" align="center"/>
24614 <colspec colwidth="6*" align="right"/>
24615 <tbody>
24616 <row>
24617 <entry><option>finduser_retries</option></entry>
24618 <entry>Use: <emphasis>main</emphasis></entry>
24619 <entry>Type: <emphasis>integer</emphasis></entry>
24620 <entry>Default: <emphasis>0</emphasis></entry>
24621 </row>
24622 </tbody>
24623 </tgroup>
24624 </informaltable>
24625 <para>
24626 <indexterm role="concept">
24627 <primary>NIS, retrying user lookups</primary>
24628 </indexterm>
24629 On systems running NIS or other schemes in which user and group information is
24630 distributed from a remote system, there can be times when <function>getpwnam()</function> and
24631 related functions fail, even when given valid data, because things time out.
24632 Unfortunately these failures cannot be distinguished from genuine <quote>not found</quote>
24633 errors. If <option>finduser_retries</option> is set greater than zero, Exim will try that
24634 many extra times to find a user or a group, waiting for one second between
24635 retries.
24636 </para>
24637 <para>
24638 <indexterm role="concept">
24639 <primary><filename>/etc/passwd</filename></primary>
24640 <secondary>multiple reading of</secondary>
24641 </indexterm>
24642 You should not set this option greater than zero if your user information is in
24643 a traditional <filename>/etc/passwd</filename> file, because it will cause Exim needlessly to
24644 search the file multiple times for non-existent users, and also cause delay.
24645 </para>
24646 <para>
24647 <indexterm role="option">
24648 <primary><option>freeze_tell</option></primary>
24649 </indexterm>
24650 </para>
24651 <informaltable frame="all">
24652 <tgroup cols="4" colsep="0" rowsep="0">
24653 <colspec colwidth="8*" align="left"/>
24654 <colspec colwidth="6*" align="center"/>
24655 <colspec colwidth="6*" align="center"/>
24656 <colspec colwidth="6*" align="right"/>
24657 <tbody>
24658 <row>
24659 <entry><option>freeze_tell</option></entry>
24660 <entry>Use: <emphasis>main</emphasis></entry>
24661 <entry>Type: <emphasis>string list, comma separated</emphasis></entry>
24662 <entry>Default: <emphasis>unset</emphasis></entry>
24663 </row>
24664 </tbody>
24665 </tgroup>
24666 </informaltable>
24667 <para>
24668 <indexterm role="concept">
24669 <primary>freezing messages</primary>
24670 <secondary>sending a message when freezing</secondary>
24671 </indexterm>
24672 On encountering certain errors, or when configured to do so in a system filter,
24673 ACL, or special router, Exim freezes a message. This means that no further
24674 delivery attempts take place until an administrator thaws the message, or the
24675 <option>auto_thaw</option>, <option>ignore_bounce_errors_after</option>, or <option>timeout_frozen_after</option>
24676 feature cause it to be processed. If <option>freeze_tell</option> is set, Exim generates a
24677 warning message whenever it freezes something, unless the message it is
24678 freezing is a locally-generated bounce message. (Without this exception there
24679 is the possibility of looping.) The warning message is sent to the addresses
24680 supplied as the comma-separated value of this option. If several of the
24681 message&#x2019;s addresses cause freezing, only a single message is sent. If the
24682 freezing was automatic, the reason(s) for freezing can be found in the message
24683 log. If you configure freezing in a filter or ACL, you must arrange for any
24684 logging that you require.
24685 </para>
24686 <para>
24687 <indexterm role="option">
24688 <primary><option>gecos_name</option></primary>
24689 </indexterm>
24690 </para>
24691 <informaltable frame="all">
24692 <tgroup cols="4" colsep="0" rowsep="0">
24693 <colspec colwidth="8*" align="left"/>
24694 <colspec colwidth="6*" align="center"/>
24695 <colspec colwidth="6*" align="center"/>
24696 <colspec colwidth="6*" align="right"/>
24697 <tbody>
24698 <row>
24699 <entry><option>gecos_name</option></entry>
24700 <entry>Use: <emphasis>main</emphasis></entry>
24701 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
24702 <entry>Default: <emphasis>unset</emphasis></entry>
24703 </row>
24704 </tbody>
24705 </tgroup>
24706 </informaltable>
24707 <para>
24708 <indexterm role="concept">
24709 <primary>HP-UX</primary>
24710 </indexterm>
24711 <indexterm role="concept">
24712 <primary><quote>gecos</quote> field, parsing</primary>
24713 </indexterm>
24714 Some operating systems, notably HP-UX, use the <quote>gecos</quote> field in the system
24715 password file to hold other information in addition to users&#x2019; real names. Exim
24716 looks up this field for use when it is creating <emphasis>Sender:</emphasis> or <emphasis>From:</emphasis>
24717 headers. If either <option>gecos_pattern</option> or <option>gecos_name</option> are unset, the contents
24718 of the field are used unchanged, except that, if an ampersand is encountered,
24719 it is replaced by the user&#x2019;s login name with the first character forced to
24720 upper case, since this is a convention that is observed on many systems.
24721 </para>
24722 <para>
24723 When these options are set, <option>gecos_pattern</option> is treated as a regular
24724 expression that is to be applied to the field (again with &amp; replaced by the
24725 login name), and if it matches, <option>gecos_name</option> is expanded and used as the
24726 user&#x2019;s name.
24727 </para>
24728 <para>
24729 <indexterm role="concept">
24730 <primary>numerical variables (<varname>$1</varname> <varname>$2</varname> etc)</primary>
24731 <secondary>in <option>gecos_name</option></secondary>
24732 </indexterm>
24733 Numeric variables such as <varname>$1</varname>, <varname>$2</varname>, etc. can be used in the expansion to
24734 pick up sub-fields that were matched by the pattern. In HP-UX, where the user&#x2019;s
24735 name terminates at the first comma, the following can be used:
24736 </para>
24737 <literallayout class="monospaced">
24738 gecos_pattern = ([^,]*)
24739 gecos_name = $1
24740 </literallayout>
24741 <para>
24742 <indexterm role="option">
24743 <primary><option>gecos_pattern</option></primary>
24744 </indexterm>
24745 </para>
24746 <informaltable frame="all">
24747 <tgroup cols="4" colsep="0" rowsep="0">
24748 <colspec colwidth="8*" align="left"/>
24749 <colspec colwidth="6*" align="center"/>
24750 <colspec colwidth="6*" align="center"/>
24751 <colspec colwidth="6*" align="right"/>
24752 <tbody>
24753 <row>
24754 <entry><option>gecos_pattern</option></entry>
24755 <entry>Use: <emphasis>main</emphasis></entry>
24756 <entry>Type: <emphasis>string</emphasis></entry>
24757 <entry>Default: <emphasis>unset</emphasis></entry>
24758 </row>
24759 </tbody>
24760 </tgroup>
24761 </informaltable>
24762 <para>
24763 See <option>gecos_name</option> above.
24764 </para>
24765 <para>
24766 <indexterm role="option">
24767 <primary><option>gnutls_compat_mode</option></primary>
24768 </indexterm>
24769 </para>
24770 <informaltable frame="all">
24771 <tgroup cols="4" colsep="0" rowsep="0">
24772 <colspec colwidth="8*" align="left"/>
24773 <colspec colwidth="6*" align="center"/>
24774 <colspec colwidth="6*" align="center"/>
24775 <colspec colwidth="6*" align="right"/>
24776 <tbody>
24777 <row>
24778 <entry><option>gnutls_compat_mode</option></entry>
24779 <entry>Use: <emphasis>main</emphasis></entry>
24780 <entry>Type: <emphasis>boolean</emphasis></entry>
24781 <entry>Default: <emphasis>unset</emphasis></entry>
24782 </row>
24783 </tbody>
24784 </tgroup>
24785 </informaltable>
24786 <para>
24787 This option controls whether GnuTLS is used in compatibility mode in an Exim
24788 server. This reduces security slightly, but improves interworking with older
24789 implementations of TLS.
24790 </para>
24791 <para>
24792 option gnutls_allow_auto_pkcs11 main boolean unset
24793 This option will let GnuTLS (2.12.0 or later) autoload PKCS11 modules with
24794 the p11-kit configuration files in <filename>/etc/pkcs11/modules/</filename>.
24795 </para>
24796 <para>
24797 See
24798 <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>
24799 for documentation.
24800 </para>
24801 <para>
24802 <indexterm role="option">
24803 <primary><option>headers_charset</option></primary>
24804 </indexterm>
24805 </para>
24806 <informaltable frame="all">
24807 <tgroup cols="4" colsep="0" rowsep="0">
24808 <colspec colwidth="8*" align="left"/>
24809 <colspec colwidth="6*" align="center"/>
24810 <colspec colwidth="6*" align="center"/>
24811 <colspec colwidth="6*" align="right"/>
24812 <tbody>
24813 <row>
24814 <entry><option>headers_charset</option></entry>
24815 <entry>Use: <emphasis>main</emphasis></entry>
24816 <entry>Type: <emphasis>string</emphasis></entry>
24817 <entry>Default: <emphasis>see below</emphasis></entry>
24818 </row>
24819 </tbody>
24820 </tgroup>
24821 </informaltable>
24822 <para>
24823 This option sets a default character set for translating from encoded MIME
24824 <quote>words</quote> in header lines, when referenced by an <varname>$h_xxx</varname> expansion item. The
24825 default is the value of HEADERS_CHARSET in <filename>Local/Makefile</filename>. The
24826 ultimate default is ISO-8859-1. For more details see the description of header
24827 insertions in section <xref linkend="SECTexpansionitems"/>.
24828 </para>
24829 <para>
24830 <indexterm role="option">
24831 <primary><option>header_maxsize</option></primary>
24832 </indexterm>
24833 </para>
24834 <informaltable frame="all">
24835 <tgroup cols="4" colsep="0" rowsep="0">
24836 <colspec colwidth="8*" align="left"/>
24837 <colspec colwidth="6*" align="center"/>
24838 <colspec colwidth="6*" align="center"/>
24839 <colspec colwidth="6*" align="right"/>
24840 <tbody>
24841 <row>
24842 <entry><option>header_maxsize</option></entry>
24843 <entry>Use: <emphasis>main</emphasis></entry>
24844 <entry>Type: <emphasis>integer</emphasis></entry>
24845 <entry>Default: <emphasis>see below</emphasis></entry>
24846 </row>
24847 </tbody>
24848 </tgroup>
24849 </informaltable>
24850 <para>
24851 <indexterm role="concept">
24852 <primary>header section</primary>
24853 <secondary>maximum size of</secondary>
24854 </indexterm>
24855 <indexterm role="concept">
24856 <primary>limit</primary>
24857 <secondary>size of message header section</secondary>
24858 </indexterm>
24859 This option controls the overall maximum size of a message&#x2019;s header
24860 section. The default is the value of HEADER_MAXSIZE in
24861 <filename>Local/Makefile</filename>; the default for that is 1M. Messages with larger header
24862 sections are rejected.
24863 </para>
24864 <para>
24865 <indexterm role="option">
24866 <primary><option>header_line_maxsize</option></primary>
24867 </indexterm>
24868 </para>
24869 <informaltable frame="all">
24870 <tgroup cols="4" colsep="0" rowsep="0">
24871 <colspec colwidth="8*" align="left"/>
24872 <colspec colwidth="6*" align="center"/>
24873 <colspec colwidth="6*" align="center"/>
24874 <colspec colwidth="6*" align="right"/>
24875 <tbody>
24876 <row>
24877 <entry><option>header_line_maxsize</option></entry>
24878 <entry>Use: <emphasis>main</emphasis></entry>
24879 <entry>Type: <emphasis>integer</emphasis></entry>
24880 <entry>Default: <emphasis>0</emphasis></entry>
24881 </row>
24882 </tbody>
24883 </tgroup>
24884 </informaltable>
24885 <para>
24886 <indexterm role="concept">
24887 <primary>header lines</primary>
24888 <secondary>maximum size of</secondary>
24889 </indexterm>
24890 <indexterm role="concept">
24891 <primary>limit</primary>
24892 <secondary>size of one header line</secondary>
24893 </indexterm>
24894 This option limits the length of any individual header line in a message, after
24895 all the continuations have been joined together. Messages with individual
24896 header lines that are longer than the limit are rejected. The default value of
24897 zero means <quote>no limit</quote>.
24898 </para>
24899 <para>
24900 <indexterm role="option">
24901 <primary><option>helo_accept_junk_hosts</option></primary>
24902 </indexterm>
24903 </para>
24904 <informaltable frame="all">
24905 <tgroup cols="4" colsep="0" rowsep="0">
24906 <colspec colwidth="8*" align="left"/>
24907 <colspec colwidth="6*" align="center"/>
24908 <colspec colwidth="6*" align="center"/>
24909 <colspec colwidth="6*" align="right"/>
24910 <tbody>
24911 <row>
24912 <entry><option>helo_accept_junk_hosts</option></entry>
24913 <entry>Use: <emphasis>main</emphasis></entry>
24914 <entry>Type: <emphasis>host list</emphasis>&dagger;<emphasis></emphasis></entry>
24915 <entry>Default: <emphasis>unset</emphasis></entry>
24916 </row>
24917 </tbody>
24918 </tgroup>
24919 </informaltable>
24920 <para>
24921 <indexterm role="concept">
24922 <primary>HELO</primary>
24923 <secondary>accepting junk data</secondary>
24924 </indexterm>
24925 <indexterm role="concept">
24926 <primary>EHLO</primary>
24927 <secondary>accepting junk data</secondary>
24928 </indexterm>
24929 Exim checks the syntax of HELO and EHLO commands for incoming SMTP
24930 mail, and gives an error response for invalid data. Unfortunately, there are
24931 some SMTP clients that send syntactic junk. They can be accommodated by setting
24932 this option. Note that this is a syntax check only. See <option>helo_verify_hosts</option>
24933 if you want to do semantic checking.
24934 See also <option>helo_allow_chars</option> for a way of extending the permitted character
24935 set.
24936 </para>
24937 <para>
24938 <indexterm role="option">
24939 <primary><option>helo_allow_chars</option></primary>
24940 </indexterm>
24941 </para>
24942 <informaltable frame="all">
24943 <tgroup cols="4" colsep="0" rowsep="0">
24944 <colspec colwidth="8*" align="left"/>
24945 <colspec colwidth="6*" align="center"/>
24946 <colspec colwidth="6*" align="center"/>
24947 <colspec colwidth="6*" align="right"/>
24948 <tbody>
24949 <row>
24950 <entry><option>helo_allow_chars</option></entry>
24951 <entry>Use: <emphasis>main</emphasis></entry>
24952 <entry>Type: <emphasis>string</emphasis></entry>
24953 <entry>Default: <emphasis>unset</emphasis></entry>
24954 </row>
24955 </tbody>
24956 </tgroup>
24957 </informaltable>
24958 <para>
24959 <indexterm role="concept">
24960 <primary>HELO</primary>
24961 <secondary>underscores in</secondary>
24962 </indexterm>
24963 <indexterm role="concept">
24964 <primary>EHLO</primary>
24965 <secondary>underscores in</secondary>
24966 </indexterm>
24967 <indexterm role="concept">
24968 <primary>underscore in EHLO/HELO</primary>
24969 </indexterm>
24970 This option can be set to a string of rogue characters that are permitted in
24971 all EHLO and HELO names in addition to the standard letters, digits,
24972 hyphens, and dots. If you really must allow underscores, you can set
24973 </para>
24974 <literallayout class="monospaced">
24975 helo_allow_chars = _
24976 </literallayout>
24977 <para>
24978 Note that the value is one string, not a list.
24979 </para>
24980 <para>
24981 <indexterm role="option">
24982 <primary><option>helo_lookup_domains</option></primary>
24983 </indexterm>
24984 </para>
24985 <informaltable frame="all">
24986 <tgroup cols="4" colsep="0" rowsep="0">
24987 <colspec colwidth="8*" align="left"/>
24988 <colspec colwidth="6*" align="center"/>
24989 <colspec colwidth="6*" align="center"/>
24990 <colspec colwidth="6*" align="right"/>
24991 <tbody>
24992 <row>
24993 <entry><option>helo_lookup_domains</option></entry>
24994 <entry>Use: <emphasis>main</emphasis></entry>
24995 <entry>Type: <emphasis>domain list</emphasis>&dagger;<emphasis></emphasis></entry>
24996 <entry>Default: <emphasis><literal>@:@[]</literal></emphasis></entry>
24997 </row>
24998 </tbody>
24999 </tgroup>
25000 </informaltable>
25001 <para>
25002 <indexterm role="concept">
25003 <primary>HELO</primary>
25004 <secondary>forcing reverse lookup</secondary>
25005 </indexterm>
25006 <indexterm role="concept">
25007 <primary>EHLO</primary>
25008 <secondary>forcing reverse lookup</secondary>
25009 </indexterm>
25010 If the domain given by a client in a HELO or EHLO command matches this
25011 list, a reverse lookup is done in order to establish the host&#x2019;s true name. The
25012 default forces a lookup if the client host gives the server&#x2019;s name or any of
25013 its IP addresses (in brackets), something that broken clients have been seen to
25014 do.
25015 </para>
25016 <para>
25017 <indexterm role="option">
25018 <primary><option>helo_try_verify_hosts</option></primary>
25019 </indexterm>
25020 </para>
25021 <informaltable frame="all">
25022 <tgroup cols="4" colsep="0" rowsep="0">
25023 <colspec colwidth="8*" align="left"/>
25024 <colspec colwidth="6*" align="center"/>
25025 <colspec colwidth="6*" align="center"/>
25026 <colspec colwidth="6*" align="right"/>
25027 <tbody>
25028 <row>
25029 <entry><option>helo_try_verify_hosts</option></entry>
25030 <entry>Use: <emphasis>main</emphasis></entry>
25031 <entry>Type: <emphasis>host list</emphasis>&dagger;<emphasis></emphasis></entry>
25032 <entry>Default: <emphasis>unset</emphasis></entry>
25033 </row>
25034 </tbody>
25035 </tgroup>
25036 </informaltable>
25037 <para>
25038 <indexterm role="concept">
25039 <primary>HELO verifying</primary>
25040 <secondary>optional</secondary>
25041 </indexterm>
25042 <indexterm role="concept">
25043 <primary>EHLO</primary>
25044 <secondary>verifying, optional</secondary>
25045 </indexterm>
25046 By default, Exim just checks the syntax of HELO and EHLO commands (see
25047 <option>helo_accept_junk_hosts</option> and <option>helo_allow_chars</option>). However, some sites like
25048 to do more extensive checking of the data supplied by these commands. The ACL
25049 condition <literal>verify = helo</literal> is provided to make this possible.
25050 Formerly, it was necessary also to set this option (<option>helo_try_verify_hosts</option>)
25051 to force the check to occur. From release 4.53 onwards, this is no longer
25052 necessary. If the check has not been done before <literal>verify = helo</literal> is
25053 encountered, it is done at that time. Consequently, this option is obsolete.
25054 Its specification is retained here for backwards compatibility.
25055 </para>
25056 <para>
25057 When an EHLO or HELO command is received, if the calling host matches
25058 <option>helo_try_verify_hosts</option>, Exim checks that the host name given in the HELO or
25059 EHLO command either:
25060 </para>
25061 <itemizedlist>
25062 <listitem>
25063 <para>
25064 is an IP literal matching the calling address of the host, or
25065 </para>
25066 </listitem>
25067 <listitem>
25068 <para>
25069 <indexterm role="concept">
25070 <primary>DNS</primary>
25071 <secondary>reverse lookup</secondary>
25072 </indexterm>
25073 <indexterm role="concept">
25074 <primary>reverse DNS lookup</primary>
25075 </indexterm>
25076 matches the host name that Exim obtains by doing a reverse lookup of the
25077 calling host address, or
25078 </para>
25079 </listitem>
25080 <listitem>
25081 <para>
25082 when looked up in DNS yields the calling host address.
25083 </para>
25084 </listitem>
25085 </itemizedlist>
25086 <para>
25087 However, the EHLO or HELO command is not rejected if any of the checks
25088 fail. Processing continues, but the result of the check is remembered, and can
25089 be detected later in an ACL by the <literal>verify = helo</literal> condition.
25090 </para>
25091 <para>
25092 If DNS was used for successful verification, the variable
25093 <indexterm role="concept">
25094 <primary>DNS</primary>
25095 <secondary>DNSSEC</secondary>
25096 </indexterm>
25097 <varname>$helo_verify_dnssec</varname> records the DNSSEC status of the lookups.
25098 </para>
25099 <para>
25100 <indexterm role="option">
25101 <primary><option>helo_verify_hosts</option></primary>
25102 </indexterm>
25103 </para>
25104 <informaltable frame="all">
25105 <tgroup cols="4" colsep="0" rowsep="0">
25106 <colspec colwidth="8*" align="left"/>
25107 <colspec colwidth="6*" align="center"/>
25108 <colspec colwidth="6*" align="center"/>
25109 <colspec colwidth="6*" align="right"/>
25110 <tbody>
25111 <row>
25112 <entry><option>helo_verify_hosts</option></entry>
25113 <entry>Use: <emphasis>main</emphasis></entry>
25114 <entry>Type: <emphasis>host list</emphasis>&dagger;<emphasis></emphasis></entry>
25115 <entry>Default: <emphasis>unset</emphasis></entry>
25116 </row>
25117 </tbody>
25118 </tgroup>
25119 </informaltable>
25120 <para>
25121 <indexterm role="concept">
25122 <primary>HELO verifying</primary>
25123 <secondary>mandatory</secondary>
25124 </indexterm>
25125 <indexterm role="concept">
25126 <primary>EHLO</primary>
25127 <secondary>verifying, mandatory</secondary>
25128 </indexterm>
25129 Like <option>helo_try_verify_hosts</option>, this option is obsolete, and retained only for
25130 backwards compatibility. For hosts that match this option, Exim checks the host
25131 name given in the HELO or EHLO in the same way as for
25132 <option>helo_try_verify_hosts</option>. If the check fails, the HELO or EHLO command is
25133 rejected with a 550 error, and entries are written to the main and reject logs.
25134 If a MAIL command is received before EHLO or HELO, it is rejected with a 503
25135 error.
25136 </para>
25137 <para>
25138 <indexterm role="option">
25139 <primary><option>hold_domains</option></primary>
25140 </indexterm>
25141 </para>
25142 <informaltable frame="all">
25143 <tgroup cols="4" colsep="0" rowsep="0">
25144 <colspec colwidth="8*" align="left"/>
25145 <colspec colwidth="6*" align="center"/>
25146 <colspec colwidth="6*" align="center"/>
25147 <colspec colwidth="6*" align="right"/>
25148 <tbody>
25149 <row>
25150 <entry><option>hold_domains</option></entry>
25151 <entry>Use: <emphasis>main</emphasis></entry>
25152 <entry>Type: <emphasis>domain list</emphasis>&dagger;<emphasis></emphasis></entry>
25153 <entry>Default: <emphasis>unset</emphasis></entry>
25154 </row>
25155 </tbody>
25156 </tgroup>
25157 </informaltable>
25158 <para>
25159 <indexterm role="concept">
25160 <primary>domain</primary>
25161 <secondary>delaying delivery</secondary>
25162 </indexterm>
25163 <indexterm role="concept">
25164 <primary>delivery</primary>
25165 <secondary>delaying certain domains</secondary>
25166 </indexterm>
25167 This option allows mail for particular domains to be held on the queue
25168 manually. The option is overridden if a message delivery is forced with the
25169 <option>-M</option>, <option>-qf</option>, <option>-Rf</option> or <option>-Sf</option> options, and also while testing or
25170 verifying addresses using <option>-bt</option> or <option>-bv</option>. Otherwise, if a domain matches an
25171 item in <option>hold_domains</option>, no routing or delivery for that address is done, and
25172 it is deferred every time the message is looked at.
25173 </para>
25174 <para>
25175 This option is intended as a temporary operational measure for delaying the
25176 delivery of mail while some problem is being sorted out, or some new
25177 configuration tested. If you just want to delay the processing of some
25178 domains until a queue run occurs, you should use <option>queue_domains</option> or
25179 <option>queue_smtp_domains</option>, not <option>hold_domains</option>.
25180 </para>
25181 <para>
25182 A setting of <option>hold_domains</option> does not override Exim&#x2019;s code for removing
25183 messages from the queue if they have been there longer than the longest retry
25184 time in any retry rule. If you want to hold messages for longer than the normal
25185 retry times, insert a dummy retry rule with a long retry time.
25186 </para>
25187 <para>
25188 <indexterm role="option">
25189 <primary><option>host_lookup</option></primary>
25190 </indexterm>
25191 </para>
25192 <informaltable frame="all">
25193 <tgroup cols="4" colsep="0" rowsep="0">
25194 <colspec colwidth="8*" align="left"/>
25195 <colspec colwidth="6*" align="center"/>
25196 <colspec colwidth="6*" align="center"/>
25197 <colspec colwidth="6*" align="right"/>
25198 <tbody>
25199 <row>
25200 <entry><option>host_lookup</option></entry>
25201 <entry>Use: <emphasis>main</emphasis></entry>
25202 <entry>Type: <emphasis>host list</emphasis>&dagger;<emphasis></emphasis></entry>
25203 <entry>Default: <emphasis>unset</emphasis></entry>
25204 </row>
25205 </tbody>
25206 </tgroup>
25207 </informaltable>
25208 <para>
25209 <indexterm role="concept">
25210 <primary>host name</primary>
25211 <secondary>lookup, forcing</secondary>
25212 </indexterm>
25213 Exim does not look up the name of a calling host from its IP address unless it
25214 is required to compare against some host list, or the host matches
25215 <option>helo_try_verify_hosts</option> or <option>helo_verify_hosts</option>, or the host matches this
25216 option (which normally contains IP addresses rather than host names). The
25217 default configuration file contains
25218 </para>
25219 <literallayout class="monospaced">
25220 host_lookup = *
25221 </literallayout>
25222 <para>
25223 which causes a lookup to happen for all hosts. If the expense of these lookups
25224 is felt to be too great, the setting can be changed or removed.
25225 </para>
25226 <para>
25227 After a successful reverse lookup, Exim does a forward lookup on the name it
25228 has obtained, to verify that it yields the IP address that it started with. If
25229 this check fails, Exim behaves as if the name lookup failed.
25230 </para>
25231 <para>
25232 <indexterm role="variable">
25233 <primary><varname>$host_lookup_failed</varname></primary>
25234 </indexterm>
25235 <indexterm role="variable">
25236 <primary><varname>$sender_host_name</varname></primary>
25237 </indexterm>
25238 After any kind of failure, the host name (in <varname>$sender_host_name</varname>) remains
25239 unset, and <varname>$host_lookup_failed</varname> is set to the string <quote>1</quote>. See also
25240 <option>dns_again_means_nonexist</option>, <option>helo_lookup_domains</option>, and
25241 <literal>verify = reverse_host_lookup</literal> in ACLs.
25242 </para>
25243 <para>
25244 <indexterm role="option">
25245 <primary><option>host_lookup_order</option></primary>
25246 </indexterm>
25247 </para>
25248 <informaltable frame="all">
25249 <tgroup cols="4" colsep="0" rowsep="0">
25250 <colspec colwidth="8*" align="left"/>
25251 <colspec colwidth="6*" align="center"/>
25252 <colspec colwidth="6*" align="center"/>
25253 <colspec colwidth="6*" align="right"/>
25254 <tbody>
25255 <row>
25256 <entry><option>host_lookup_order</option></entry>
25257 <entry>Use: <emphasis>main</emphasis></entry>
25258 <entry>Type: <emphasis>string list</emphasis></entry>
25259 <entry>Default: <emphasis><literal>bydns:byaddr</literal></emphasis></entry>
25260 </row>
25261 </tbody>
25262 </tgroup>
25263 </informaltable>
25264 <para>
25265 This option specifies the order of different lookup methods when Exim is trying
25266 to find a host name from an IP address. The default is to do a DNS lookup
25267 first, and then to try a local lookup (using <function>gethostbyaddr()</function> or equivalent)
25268 if that fails. You can change the order of these lookups, or omit one entirely,
25269 if you want.
25270 </para>
25271 <para>
25272 <emphasis role="bold">Warning</emphasis>: The <quote>byaddr</quote> method does not always yield aliases when there are
25273 multiple PTR records in the DNS and the IP address is not listed in
25274 <filename>/etc/hosts</filename>. Different operating systems give different results in this
25275 case. That is why the default tries a DNS lookup first.
25276 </para>
25277 <para>
25278 <indexterm role="option">
25279 <primary><option>host_reject_connection</option></primary>
25280 </indexterm>
25281 </para>
25282 <informaltable frame="all">
25283 <tgroup cols="4" colsep="0" rowsep="0">
25284 <colspec colwidth="8*" align="left"/>
25285 <colspec colwidth="6*" align="center"/>
25286 <colspec colwidth="6*" align="center"/>
25287 <colspec colwidth="6*" align="right"/>
25288 <tbody>
25289 <row>
25290 <entry><option>host_reject_connection</option></entry>
25291 <entry>Use: <emphasis>main</emphasis></entry>
25292 <entry>Type: <emphasis>host list</emphasis>&dagger;<emphasis></emphasis></entry>
25293 <entry>Default: <emphasis>unset</emphasis></entry>
25294 </row>
25295 </tbody>
25296 </tgroup>
25297 </informaltable>
25298 <para>
25299 <indexterm role="concept">
25300 <primary>host</primary>
25301 <secondary>rejecting connections from</secondary>
25302 </indexterm>
25303 If this option is set, incoming SMTP calls from the hosts listed are rejected
25304 as soon as the connection is made.
25305 This option is obsolete, and retained only for backward compatibility, because
25306 nowadays the ACL specified by <option>acl_smtp_connect</option> can also reject incoming
25307 connections immediately.
25308 </para>
25309 <para>
25310 The ability to give an immediate rejection (either by this option or using an
25311 ACL) is provided for use in unusual cases. Many hosts will just try again,
25312 sometimes without much delay. Normally, it is better to use an ACL to reject
25313 incoming messages at a later stage, such as after RCPT commands. See
25314 chapter <xref linkend="CHAPACL"/>.
25315 </para>
25316 <para>
25317 <indexterm role="option">
25318 <primary><option>hosts_connection_nolog</option></primary>
25319 </indexterm>
25320 </para>
25321 <informaltable frame="all">
25322 <tgroup cols="4" colsep="0" rowsep="0">
25323 <colspec colwidth="8*" align="left"/>
25324 <colspec colwidth="6*" align="center"/>
25325 <colspec colwidth="6*" align="center"/>
25326 <colspec colwidth="6*" align="right"/>
25327 <tbody>
25328 <row>
25329 <entry><option>hosts_connection_nolog</option></entry>
25330 <entry>Use: <emphasis>main</emphasis></entry>
25331 <entry>Type: <emphasis>host list</emphasis>&dagger;<emphasis></emphasis></entry>
25332 <entry>Default: <emphasis>unset</emphasis></entry>
25333 </row>
25334 </tbody>
25335 </tgroup>
25336 </informaltable>
25337 <para>
25338 <indexterm role="concept">
25339 <primary>host</primary>
25340 <secondary>not logging connections from</secondary>
25341 </indexterm>
25342 This option defines a list of hosts for which connection logging does not
25343 happen, even though the <option>smtp_connection</option> log selector is set. For example,
25344 you might want not to log SMTP connections from local processes, or from
25345 127.0.0.1, or from your local LAN. This option is consulted in the main loop of
25346 the daemon; you should therefore strive to restrict its value to a short inline
25347 list of IP addresses and networks. To disable logging SMTP connections from
25348 local processes, you must create a host list with an empty item. For example:
25349 </para>
25350 <literallayout class="monospaced">
25351 hosts_connection_nolog = :
25352 </literallayout>
25353 <para>
25354 If the <option>smtp_connection</option> log selector is not set, this option has no effect.
25355 </para>
25356 <para>
25357 <indexterm role="option">
25358 <primary><option>hosts_treat_as_local</option></primary>
25359 </indexterm>
25360 </para>
25361 <informaltable frame="all">
25362 <tgroup cols="4" colsep="0" rowsep="0">
25363 <colspec colwidth="8*" align="left"/>
25364 <colspec colwidth="6*" align="center"/>
25365 <colspec colwidth="6*" align="center"/>
25366 <colspec colwidth="6*" align="right"/>
25367 <tbody>
25368 <row>
25369 <entry><option>hosts_treat_as_local</option></entry>
25370 <entry>Use: <emphasis>main</emphasis></entry>
25371 <entry>Type: <emphasis>domain list</emphasis>&dagger;<emphasis></emphasis></entry>
25372 <entry>Default: <emphasis>unset</emphasis></entry>
25373 </row>
25374 </tbody>
25375 </tgroup>
25376 </informaltable>
25377 <para>
25378 <indexterm role="concept">
25379 <primary>local host</primary>
25380 <secondary>domains treated as</secondary>
25381 </indexterm>
25382 <indexterm role="concept">
25383 <primary>host</primary>
25384 <secondary>treated as local</secondary>
25385 </indexterm>
25386 If this option is set, any host names that match the domain list are treated as
25387 if they were the local host when Exim is scanning host lists obtained from MX
25388 records
25389 or other sources. Note that the value of this option is a domain list, not a
25390 host list, because it is always used to check host names, not IP addresses.
25391 </para>
25392 <para>
25393 This option also applies when Exim is matching the special items
25394 <literal>@mx_any</literal>, <literal>@mx_primary</literal>, and <literal>@mx_secondary</literal> in a domain list (see
25395 section <xref linkend="SECTdomainlist"/>), and when checking the <option>hosts</option> option in the
25396 <command>smtp</command> transport for the local host (see the <option>allow_localhost</option> option in
25397 that transport). See also <option>local_interfaces</option>, <option>extra_local_interfaces</option>, and
25398 chapter <xref linkend="CHAPinterfaces"/>, which contains a discussion about local network
25399 interfaces and recognizing the local host.
25400 </para>
25401 <para>
25402 <indexterm role="option">
25403 <primary><option>ibase_servers</option></primary>
25404 </indexterm>
25405 </para>
25406 <informaltable frame="all">
25407 <tgroup cols="4" colsep="0" rowsep="0">
25408 <colspec colwidth="8*" align="left"/>
25409 <colspec colwidth="6*" align="center"/>
25410 <colspec colwidth="6*" align="center"/>
25411 <colspec colwidth="6*" align="right"/>
25412 <tbody>
25413 <row>
25414 <entry><option>ibase_servers</option></entry>
25415 <entry>Use: <emphasis>main</emphasis></entry>
25416 <entry>Type: <emphasis>string list</emphasis></entry>
25417 <entry>Default: <emphasis>unset</emphasis></entry>
25418 </row>
25419 </tbody>
25420 </tgroup>
25421 </informaltable>
25422 <para>
25423 <indexterm role="concept">
25424 <primary>InterBase</primary>
25425 <secondary>server list</secondary>
25426 </indexterm>
25427 This option provides a list of InterBase servers and associated connection data,
25428 to be used in conjunction with <command>ibase</command> lookups (see section <xref linkend="SECID72"/>).
25429 The option is available only if Exim has been built with InterBase support.
25430 </para>
25431 <para>
25432 <indexterm role="option">
25433 <primary><option>ignore_bounce_errors_after</option></primary>
25434 </indexterm>
25435 </para>
25436 <informaltable frame="all">
25437 <tgroup cols="4" colsep="0" rowsep="0">
25438 <colspec colwidth="8*" align="left"/>
25439 <colspec colwidth="6*" align="center"/>
25440 <colspec colwidth="6*" align="center"/>
25441 <colspec colwidth="6*" align="right"/>
25442 <tbody>
25443 <row>
25444 <entry><option>ignore_bounce_errors_after</option></entry>
25445 <entry>Use: <emphasis>main</emphasis></entry>
25446 <entry>Type: <emphasis>time</emphasis></entry>
25447 <entry>Default: <emphasis>10w</emphasis></entry>
25448 </row>
25449 </tbody>
25450 </tgroup>
25451 </informaltable>
25452 <para>
25453 <indexterm role="concept">
25454 <primary>bounce message</primary>
25455 <secondary>discarding</secondary>
25456 </indexterm>
25457 <indexterm role="concept">
25458 <primary>discarding bounce message</primary>
25459 </indexterm>
25460 This option affects the processing of bounce messages that cannot be delivered,
25461 that is, those that suffer a permanent delivery failure. (Bounce messages that
25462 suffer temporary delivery failures are of course retried in the usual way.)
25463 </para>
25464 <para>
25465 After a permanent delivery failure, bounce messages are frozen,
25466 because there is no sender to whom they can be returned. When a frozen bounce
25467 message has been on the queue for more than the given time, it is unfrozen at
25468 the next queue run, and a further delivery is attempted. If delivery fails
25469 again, the bounce message is discarded. This makes it possible to keep failed
25470 bounce messages around for a shorter time than the normal maximum retry time
25471 for frozen messages. For example,
25472 </para>
25473 <literallayout class="monospaced">
25474 ignore_bounce_errors_after = 12h
25475 </literallayout>
25476 <para>
25477 retries failed bounce message deliveries after 12 hours, discarding any further
25478 failures. If the value of this option is set to a zero time period, bounce
25479 failures are discarded immediately. Setting a very long time (as in the default
25480 value) has the effect of disabling this option. For ways of automatically
25481 dealing with other kinds of frozen message, see <option>auto_thaw</option> and
25482 <option>timeout_frozen_after</option>.
25483 </para>
25484 <para>
25485 <indexterm role="option">
25486 <primary><option>ignore_fromline_hosts</option></primary>
25487 </indexterm>
25488 </para>
25489 <informaltable frame="all">
25490 <tgroup cols="4" colsep="0" rowsep="0">
25491 <colspec colwidth="8*" align="left"/>
25492 <colspec colwidth="6*" align="center"/>
25493 <colspec colwidth="6*" align="center"/>
25494 <colspec colwidth="6*" align="right"/>
25495 <tbody>
25496 <row>
25497 <entry><option>ignore_fromline_hosts</option></entry>
25498 <entry>Use: <emphasis>main</emphasis></entry>
25499 <entry>Type: <emphasis>host list</emphasis>&dagger;<emphasis></emphasis></entry>
25500 <entry>Default: <emphasis>unset</emphasis></entry>
25501 </row>
25502 </tbody>
25503 </tgroup>
25504 </informaltable>
25505 <para>
25506 <indexterm role="concept">
25507 <primary><quote>From</quote> line</primary>
25508 </indexterm>
25509 <indexterm role="concept">
25510 <primary>UUCP</primary>
25511 <secondary><quote>From</quote> line</secondary>
25512 </indexterm>
25513 Some broken SMTP clients insist on sending a UUCP-like <quote>From&nbsp;</quote> line before
25514 the headers of a message. By default this is treated as the start of the
25515 message&#x2019;s body, which means that any following headers are not recognized as
25516 such. Exim can be made to ignore it by setting <option>ignore_fromline_hosts</option> to
25517 match those hosts that insist on sending it. If the sender is actually a local
25518 process rather than a remote host, and is using <option>-bs</option> to inject the messages,
25519 <option>ignore_fromline_local</option> must be set to achieve this effect.
25520 </para>
25521 <para>
25522 <indexterm role="option">
25523 <primary><option>ignore_fromline_local</option></primary>
25524 </indexterm>
25525 </para>
25526 <informaltable frame="all">
25527 <tgroup cols="4" colsep="0" rowsep="0">
25528 <colspec colwidth="8*" align="left"/>
25529 <colspec colwidth="6*" align="center"/>
25530 <colspec colwidth="6*" align="center"/>
25531 <colspec colwidth="6*" align="right"/>
25532 <tbody>
25533 <row>
25534 <entry><option>ignore_fromline_local</option></entry>
25535 <entry>Use: <emphasis>main</emphasis></entry>
25536 <entry>Type: <emphasis>boolean</emphasis></entry>
25537 <entry>Default: <emphasis>false</emphasis></entry>
25538 </row>
25539 </tbody>
25540 </tgroup>
25541 </informaltable>
25542 <para>
25543 See <option>ignore_fromline_hosts</option> above.
25544 </para>
25545 <para>
25546 <indexterm role="option">
25547 <primary><option>keep_malformed</option></primary>
25548 </indexterm>
25549 </para>
25550 <informaltable frame="all">
25551 <tgroup cols="4" colsep="0" rowsep="0">
25552 <colspec colwidth="8*" align="left"/>
25553 <colspec colwidth="6*" align="center"/>
25554 <colspec colwidth="6*" align="center"/>
25555 <colspec colwidth="6*" align="right"/>
25556 <tbody>
25557 <row>
25558 <entry><option>keep_malformed</option></entry>
25559 <entry>Use: <emphasis>main</emphasis></entry>
25560 <entry>Type: <emphasis>time</emphasis></entry>
25561 <entry>Default: <emphasis>4d</emphasis></entry>
25562 </row>
25563 </tbody>
25564 </tgroup>
25565 </informaltable>
25566 <para>
25567 This option specifies the length of time to keep messages whose spool files
25568 have been corrupted in some way. This should, of course, never happen. At the
25569 next attempt to deliver such a message, it gets removed. The incident is
25570 logged.
25571 </para>
25572 <para>
25573 <indexterm role="option">
25574 <primary><option>ldap_ca_cert_dir</option></primary>
25575 </indexterm>
25576 </para>
25577 <informaltable frame="all">
25578 <tgroup cols="4" colsep="0" rowsep="0">
25579 <colspec colwidth="8*" align="left"/>
25580 <colspec colwidth="6*" align="center"/>
25581 <colspec colwidth="6*" align="center"/>
25582 <colspec colwidth="6*" align="right"/>
25583 <tbody>
25584 <row>
25585 <entry><option>ldap_ca_cert_dir</option></entry>
25586 <entry>Use: <emphasis>main</emphasis></entry>
25587 <entry>Type: <emphasis>string</emphasis></entry>
25588 <entry>Default: <emphasis>unset</emphasis></entry>
25589 </row>
25590 </tbody>
25591 </tgroup>
25592 </informaltable>
25593 <para>
25594 <indexterm role="concept">
25595 <primary>LDAP</primary>
25596 <secondary>,</secondary>
25597 </indexterm>
25598 This option indicates which directory contains CA certificates for verifying
25599 a TLS certificate presented by an LDAP server.
25600 While Exim does not provide a default value, your SSL library may.
25601 Analogous to <option>tls_verify_certificates</option> but as a client-side option for LDAP
25602 and constrained to be a directory.
25603 </para>
25604 <para>
25605 <indexterm role="option">
25606 <primary><option>ldap_ca_cert_file</option></primary>
25607 </indexterm>
25608 </para>
25609 <informaltable frame="all">
25610 <tgroup cols="4" colsep="0" rowsep="0">
25611 <colspec colwidth="8*" align="left"/>
25612 <colspec colwidth="6*" align="center"/>
25613 <colspec colwidth="6*" align="center"/>
25614 <colspec colwidth="6*" align="right"/>
25615 <tbody>
25616 <row>
25617 <entry><option>ldap_ca_cert_file</option></entry>
25618 <entry>Use: <emphasis>main</emphasis></entry>
25619 <entry>Type: <emphasis>string</emphasis></entry>
25620 <entry>Default: <emphasis>unset</emphasis></entry>
25621 </row>
25622 </tbody>
25623 </tgroup>
25624 </informaltable>
25625 <para>
25626 <indexterm role="concept">
25627 <primary>LDAP</primary>
25628 <secondary>,</secondary>
25629 </indexterm>
25630 This option indicates which file contains CA certificates for verifying
25631 a TLS certificate presented by an LDAP server.
25632 While Exim does not provide a default value, your SSL library may.
25633 Analogous to <option>tls_verify_certificates</option> but as a client-side option for LDAP
25634 and constrained to be a file.
25635 </para>
25636 <para>
25637 <indexterm role="option">
25638 <primary><option>ldap_cert_file</option></primary>
25639 </indexterm>
25640 </para>
25641 <informaltable frame="all">
25642 <tgroup cols="4" colsep="0" rowsep="0">
25643 <colspec colwidth="8*" align="left"/>
25644 <colspec colwidth="6*" align="center"/>
25645 <colspec colwidth="6*" align="center"/>
25646 <colspec colwidth="6*" align="right"/>
25647 <tbody>
25648 <row>
25649 <entry><option>ldap_cert_file</option></entry>
25650 <entry>Use: <emphasis>main</emphasis></entry>
25651 <entry>Type: <emphasis>string</emphasis></entry>
25652 <entry>Default: <emphasis>unset</emphasis></entry>
25653 </row>
25654 </tbody>
25655 </tgroup>
25656 </informaltable>
25657 <para>
25658 <indexterm role="concept">
25659 <primary>LDAP</primary>
25660 <secondary>TLS client certificate file</secondary>
25661 </indexterm>
25662 This option indicates which file contains an TLS client certificate which
25663 Exim should present to the LDAP server during TLS negotiation.
25664 Should be used together with <option>ldap_cert_key</option>.
25665 </para>
25666 <para>
25667 <indexterm role="option">
25668 <primary><option>ldap_cert_key</option></primary>
25669 </indexterm>
25670 </para>
25671 <informaltable frame="all">
25672 <tgroup cols="4" colsep="0" rowsep="0">
25673 <colspec colwidth="8*" align="left"/>
25674 <colspec colwidth="6*" align="center"/>
25675 <colspec colwidth="6*" align="center"/>
25676 <colspec colwidth="6*" align="right"/>
25677 <tbody>
25678 <row>
25679 <entry><option>ldap_cert_key</option></entry>
25680 <entry>Use: <emphasis>main</emphasis></entry>
25681 <entry>Type: <emphasis>string</emphasis></entry>
25682 <entry>Default: <emphasis>unset</emphasis></entry>
25683 </row>
25684 </tbody>
25685 </tgroup>
25686 </informaltable>
25687 <para>
25688 <indexterm role="concept">
25689 <primary>LDAP</primary>
25690 <secondary>TLS client key file</secondary>
25691 </indexterm>
25692 This option indicates which file contains the secret/private key to use
25693 to prove identity to the LDAP server during TLS negotiation.
25694 Should be used together with <option>ldap_cert_file</option>, which contains the
25695 identity to be proven.
25696 </para>
25697 <para>
25698 <indexterm role="option">
25699 <primary><option>ldap_cipher_suite</option></primary>
25700 </indexterm>
25701 </para>
25702 <informaltable frame="all">
25703 <tgroup cols="4" colsep="0" rowsep="0">
25704 <colspec colwidth="8*" align="left"/>
25705 <colspec colwidth="6*" align="center"/>
25706 <colspec colwidth="6*" align="center"/>
25707 <colspec colwidth="6*" align="right"/>
25708 <tbody>
25709 <row>
25710 <entry><option>ldap_cipher_suite</option></entry>
25711 <entry>Use: <emphasis>main</emphasis></entry>
25712 <entry>Type: <emphasis>string</emphasis></entry>
25713 <entry>Default: <emphasis>unset</emphasis></entry>
25714 </row>
25715 </tbody>
25716 </tgroup>
25717 </informaltable>
25718 <para>
25719 <indexterm role="concept">
25720 <primary>LDAP</primary>
25721 <secondary>TLS cipher suite</secondary>
25722 </indexterm>
25723 This controls the TLS cipher-suite negotiation during TLS negotiation with
25724 the LDAP server.  See <xref linkend="SECTreqciphssl"/> for more details of the format of
25725 cipher-suite options with OpenSSL (as used by LDAP client libraries).
25726 </para>
25727 <para>
25728 <indexterm role="option">
25729 <primary><option>ldap_default_servers</option></primary>
25730 </indexterm>
25731 </para>
25732 <informaltable frame="all">
25733 <tgroup cols="4" colsep="0" rowsep="0">
25734 <colspec colwidth="8*" align="left"/>
25735 <colspec colwidth="6*" align="center"/>
25736 <colspec colwidth="6*" align="center"/>
25737 <colspec colwidth="6*" align="right"/>
25738 <tbody>
25739 <row>
25740 <entry><option>ldap_default_servers</option></entry>
25741 <entry>Use: <emphasis>main</emphasis></entry>
25742 <entry>Type: <emphasis>string list</emphasis></entry>
25743 <entry>Default: <emphasis>unset</emphasis></entry>
25744 </row>
25745 </tbody>
25746 </tgroup>
25747 </informaltable>
25748 <para>
25749 <indexterm role="concept">
25750 <primary>LDAP</primary>
25751 <secondary>default servers</secondary>
25752 </indexterm>
25753 This option provides a list of LDAP servers which are tried in turn when an
25754 LDAP query does not contain a server. See section <xref linkend="SECTforldaque"/> for
25755 details of LDAP queries. This option is available only when Exim has been built
25756 with LDAP support.
25757 </para>
25758 <para>
25759 <indexterm role="option">
25760 <primary><option>ldap_require_cert</option></primary>
25761 </indexterm>
25762 </para>
25763 <informaltable frame="all">
25764 <tgroup cols="4" colsep="0" rowsep="0">
25765 <colspec colwidth="8*" align="left"/>
25766 <colspec colwidth="6*" align="center"/>
25767 <colspec colwidth="6*" align="center"/>
25768 <colspec colwidth="6*" align="right"/>
25769 <tbody>
25770 <row>
25771 <entry><option>ldap_require_cert</option></entry>
25772 <entry>Use: <emphasis>main</emphasis></entry>
25773 <entry>Type: <emphasis>string</emphasis></entry>
25774 <entry>Default: <emphasis>unset.</emphasis></entry>
25775 </row>
25776 </tbody>
25777 </tgroup>
25778 </informaltable>
25779 <para>
25780 <indexterm role="concept">
25781 <primary>LDAP</primary>
25782 <secondary>policy for LDAP server TLS cert presentation</secondary>
25783 </indexterm>
25784 This should be one of the values "hard", "demand", "allow", "try" or "never".
25785 A value other than one of these is interpreted as "never".
25786 See the entry "TLS_REQCERT" in your system man page for ldap.conf(5).
25787 Although Exim does not set a default, the LDAP library probably defaults
25788 to hard/demand.
25789 </para>
25790 <para>
25791 <indexterm role="option">
25792 <primary><option>ldap_start_tls</option></primary>
25793 </indexterm>
25794 </para>
25795 <informaltable frame="all">
25796 <tgroup cols="4" colsep="0" rowsep="0">
25797 <colspec colwidth="8*" align="left"/>
25798 <colspec colwidth="6*" align="center"/>
25799 <colspec colwidth="6*" align="center"/>
25800 <colspec colwidth="6*" align="right"/>
25801 <tbody>
25802 <row>
25803 <entry><option>ldap_start_tls</option></entry>
25804 <entry>Use: <emphasis>main</emphasis></entry>
25805 <entry>Type: <emphasis>boolean</emphasis></entry>
25806 <entry>Default: <emphasis>false</emphasis></entry>
25807 </row>
25808 </tbody>
25809 </tgroup>
25810 </informaltable>
25811 <para>
25812 <indexterm role="concept">
25813 <primary>LDAP</primary>
25814 <secondary>whether or not to negotiate TLS</secondary>
25815 </indexterm>
25816 If set, Exim will attempt to negotiate TLS with the LDAP server when
25817 connecting on a regular LDAP port.  This is the LDAP equivalent of SMTP&#x2019;s
25818 "STARTTLS".  This is distinct from using "ldaps", which is the LDAP form
25819 of SSL-on-connect.
25820 In the event of failure to negotiate TLS, the action taken is controlled
25821 by <option>ldap_require_cert</option>.
25822 </para>
25823 <para>
25824 <indexterm role="option">
25825 <primary><option>ldap_version</option></primary>
25826 </indexterm>
25827 </para>
25828 <informaltable frame="all">
25829 <tgroup cols="4" colsep="0" rowsep="0">
25830 <colspec colwidth="8*" align="left"/>
25831 <colspec colwidth="6*" align="center"/>
25832 <colspec colwidth="6*" align="center"/>
25833 <colspec colwidth="6*" align="right"/>
25834 <tbody>
25835 <row>
25836 <entry><option>ldap_version</option></entry>
25837 <entry>Use: <emphasis>main</emphasis></entry>
25838 <entry>Type: <emphasis>integer</emphasis></entry>
25839 <entry>Default: <emphasis>unset</emphasis></entry>
25840 </row>
25841 </tbody>
25842 </tgroup>
25843 </informaltable>
25844 <para>
25845 <indexterm role="concept">
25846 <primary>LDAP</primary>
25847 <secondary>protocol version, forcing</secondary>
25848 </indexterm>
25849 This option can be used to force Exim to set a specific protocol version for
25850 LDAP. If it option is unset, it is shown by the <option>-bP</option> command line option as
25851 -1. When this is the case, the default is 3 if LDAP_VERSION3 is defined in
25852 the LDAP headers; otherwise it is 2. This option is available only when Exim
25853 has been built with LDAP support.
25854 </para>
25855 <para>
25856 <indexterm role="option">
25857 <primary><option>local_from_check</option></primary>
25858 </indexterm>
25859 </para>
25860 <informaltable frame="all">
25861 <tgroup cols="4" colsep="0" rowsep="0">
25862 <colspec colwidth="8*" align="left"/>
25863 <colspec colwidth="6*" align="center"/>
25864 <colspec colwidth="6*" align="center"/>
25865 <colspec colwidth="6*" align="right"/>
25866 <tbody>
25867 <row>
25868 <entry><option>local_from_check</option></entry>
25869 <entry>Use: <emphasis>main</emphasis></entry>
25870 <entry>Type: <emphasis>boolean</emphasis></entry>
25871 <entry>Default: <emphasis>true</emphasis></entry>
25872 </row>
25873 </tbody>
25874 </tgroup>
25875 </informaltable>
25876 <para>
25877 <indexterm role="concept">
25878 <primary><emphasis>Sender:</emphasis> header line</primary>
25879 <secondary>disabling addition of</secondary>
25880 </indexterm>
25881 <indexterm role="concept">
25882 <primary><emphasis>From:</emphasis> header line</primary>
25883 <secondary>disabling checking of</secondary>
25884 </indexterm>
25885 When a message is submitted locally (that is, not over a TCP/IP connection) by
25886 an untrusted user, Exim removes any existing <emphasis>Sender:</emphasis> header line, and
25887 checks that the <emphasis>From:</emphasis> header line matches the login of the calling user and
25888 the domain specified by <option>qualify_domain</option>.
25889 </para>
25890 <para>
25891 <emphasis role="bold">Note</emphasis>: An unqualified address (no domain) in the <emphasis>From:</emphasis> header in a
25892 locally submitted message is automatically qualified by Exim, unless the
25893 <option>-bnq</option> command line option is used.
25894 </para>
25895 <para>
25896 You can use <option>local_from_prefix</option> and <option>local_from_suffix</option> to permit affixes
25897 on the local part. If the <emphasis>From:</emphasis> header line does not match, Exim adds a
25898 <emphasis>Sender:</emphasis> header with an address constructed from the calling user&#x2019;s login
25899 and the default qualify domain.
25900 </para>
25901 <para>
25902 If <option>local_from_check</option> is set false, the <emphasis>From:</emphasis> header check is disabled,
25903 and no <emphasis>Sender:</emphasis> header is ever added. If, in addition, you want to retain
25904 <emphasis>Sender:</emphasis> header lines supplied by untrusted users, you must also set
25905 <option>local_sender_retain</option> to be true.
25906 </para>
25907 <para>
25908 <indexterm role="concept">
25909 <primary>envelope sender</primary>
25910 </indexterm>
25911 These options affect only the header lines in the message. The envelope sender
25912 is still forced to be the login id at the qualify domain unless
25913 <option>untrusted_set_sender</option> permits the user to supply an envelope sender.
25914 </para>
25915 <para>
25916 For messages received over TCP/IP, an ACL can specify <quote>submission mode</quote> to
25917 request similar header line checking. See section <xref linkend="SECTthesenhea"/>, which
25918 has more details about <emphasis>Sender:</emphasis> processing.
25919 </para>
25920 <para>
25921 <indexterm role="option">
25922 <primary><option>local_from_prefix</option></primary>
25923 </indexterm>
25924 </para>
25925 <informaltable frame="all">
25926 <tgroup cols="4" colsep="0" rowsep="0">
25927 <colspec colwidth="8*" align="left"/>
25928 <colspec colwidth="6*" align="center"/>
25929 <colspec colwidth="6*" align="center"/>
25930 <colspec colwidth="6*" align="right"/>
25931 <tbody>
25932 <row>
25933 <entry><option>local_from_prefix</option></entry>
25934 <entry>Use: <emphasis>main</emphasis></entry>
25935 <entry>Type: <emphasis>string</emphasis></entry>
25936 <entry>Default: <emphasis>unset</emphasis></entry>
25937 </row>
25938 </tbody>
25939 </tgroup>
25940 </informaltable>
25941 <para>
25942 When Exim checks the <emphasis>From:</emphasis> header line of locally submitted messages for
25943 matching the login id (see <option>local_from_check</option> above), it can be configured to
25944 ignore certain prefixes and suffixes in the local part of the address. This is
25945 done by setting <option>local_from_prefix</option> and/or <option>local_from_suffix</option> to
25946 appropriate lists, in the same form as the <option>local_part_prefix</option> and
25947 <option>local_part_suffix</option> router options (see chapter <xref linkend="CHAProutergeneric"/>). For
25948 example, if
25949 </para>
25950 <literallayout class="monospaced">
25951 local_from_prefix = *-
25952 </literallayout>
25953 <para>
25954 is set, a <emphasis>From:</emphasis> line containing
25955 </para>
25956 <literallayout class="monospaced">
25957 From: anything-user@your.domain.example
25958 </literallayout>
25959 <para>
25960 will not cause a <emphasis>Sender:</emphasis> header to be added if <emphasis>user@your.domain.example</emphasis>
25961 matches the actual sender address that is constructed from the login name and
25962 qualify domain.
25963 </para>
25964 <para>
25965 <indexterm role="option">
25966 <primary><option>local_from_suffix</option></primary>
25967 </indexterm>
25968 </para>
25969 <informaltable frame="all">
25970 <tgroup cols="4" colsep="0" rowsep="0">
25971 <colspec colwidth="8*" align="left"/>
25972 <colspec colwidth="6*" align="center"/>
25973 <colspec colwidth="6*" align="center"/>
25974 <colspec colwidth="6*" align="right"/>
25975 <tbody>
25976 <row>
25977 <entry><option>local_from_suffix</option></entry>
25978 <entry>Use: <emphasis>main</emphasis></entry>
25979 <entry>Type: <emphasis>string</emphasis></entry>
25980 <entry>Default: <emphasis>unset</emphasis></entry>
25981 </row>
25982 </tbody>
25983 </tgroup>
25984 </informaltable>
25985 <para>
25986 See <option>local_from_prefix</option> above.
25987 </para>
25988 <para>
25989 <indexterm role="option">
25990 <primary><option>local_interfaces</option></primary>
25991 </indexterm>
25992 </para>
25993 <informaltable frame="all">
25994 <tgroup cols="4" colsep="0" rowsep="0">
25995 <colspec colwidth="8*" align="left"/>
25996 <colspec colwidth="6*" align="center"/>
25997 <colspec colwidth="6*" align="center"/>
25998 <colspec colwidth="6*" align="right"/>
25999 <tbody>
26000 <row>
26001 <entry><option>local_interfaces</option></entry>
26002 <entry>Use: <emphasis>main</emphasis></entry>
26003 <entry>Type: <emphasis>string list</emphasis></entry>
26004 <entry>Default: <emphasis>see below</emphasis></entry>
26005 </row>
26006 </tbody>
26007 </tgroup>
26008 </informaltable>
26009 <para>
26010 This option controls which network interfaces are used by the daemon for
26011 listening; they are also used to identify the local host when routing. Chapter
26012 <xref linkend="CHAPinterfaces"/> contains a full description of this option and the related
26013 options <option>daemon_smtp_ports</option>, <option>extra_local_interfaces</option>,
26014 <option>hosts_treat_as_local</option>, and <option>tls_on_connect_ports</option>. The default value for
26015 <option>local_interfaces</option> is
26016 </para>
26017 <literallayout class="monospaced">
26018 local_interfaces = 0.0.0.0
26019 </literallayout>
26020 <para>
26021 when Exim is built without IPv6 support; otherwise it is
26022 </para>
26023 <literallayout class="monospaced">
26024 local_interfaces = &lt;; ::0 ; 0.0.0.0
26025 </literallayout>
26026 <para>
26027 <indexterm role="option">
26028 <primary><option>local_scan_timeout</option></primary>
26029 </indexterm>
26030 </para>
26031 <informaltable frame="all">
26032 <tgroup cols="4" colsep="0" rowsep="0">
26033 <colspec colwidth="8*" align="left"/>
26034 <colspec colwidth="6*" align="center"/>
26035 <colspec colwidth="6*" align="center"/>
26036 <colspec colwidth="6*" align="right"/>
26037 <tbody>
26038 <row>
26039 <entry><option>local_scan_timeout</option></entry>
26040 <entry>Use: <emphasis>main</emphasis></entry>
26041 <entry>Type: <emphasis>time</emphasis></entry>
26042 <entry>Default: <emphasis>5m</emphasis></entry>
26043 </row>
26044 </tbody>
26045 </tgroup>
26046 </informaltable>
26047 <para>
26048 <indexterm role="concept">
26049 <primary>timeout</primary>
26050 <secondary>for <function>local_scan()</function> function</secondary>
26051 </indexterm>
26052 <indexterm role="concept">
26053 <primary><function>local_scan()</function> function</primary>
26054 <secondary>timeout</secondary>
26055 </indexterm>
26056 This timeout applies to the <function>local_scan()</function> function (see chapter
26057 <xref linkend="CHAPlocalscan"/>). Zero means <quote>no timeout</quote>. If the timeout is exceeded,
26058 the incoming message is rejected with a temporary error if it is an SMTP
26059 message. For a non-SMTP message, the message is dropped and Exim ends with a
26060 non-zero code. The incident is logged on the main and reject logs.
26061 </para>
26062 <para>
26063 <indexterm role="option">
26064 <primary><option>local_sender_retain</option></primary>
26065 </indexterm>
26066 </para>
26067 <informaltable frame="all">
26068 <tgroup cols="4" colsep="0" rowsep="0">
26069 <colspec colwidth="8*" align="left"/>
26070 <colspec colwidth="6*" align="center"/>
26071 <colspec colwidth="6*" align="center"/>
26072 <colspec colwidth="6*" align="right"/>
26073 <tbody>
26074 <row>
26075 <entry><option>local_sender_retain</option></entry>
26076 <entry>Use: <emphasis>main</emphasis></entry>
26077 <entry>Type: <emphasis>boolean</emphasis></entry>
26078 <entry>Default: <emphasis>false</emphasis></entry>
26079 </row>
26080 </tbody>
26081 </tgroup>
26082 </informaltable>
26083 <para>
26084 <indexterm role="concept">
26085 <primary><emphasis>Sender:</emphasis> header line</primary>
26086 <secondary>retaining from local submission</secondary>
26087 </indexterm>
26088 When a message is submitted locally (that is, not over a TCP/IP connection) by
26089 an untrusted user, Exim removes any existing <emphasis>Sender:</emphasis> header line. If you
26090 do not want this to happen, you must set <option>local_sender_retain</option>, and you must
26091 also set <option>local_from_check</option> to be false (Exim will complain if you do not).
26092 See also the ACL modifier <literal>control = suppress_local_fixups</literal>. Section
26093 <xref linkend="SECTthesenhea"/> has more details about <emphasis>Sender:</emphasis> processing.
26094 </para>
26095 <para>
26096 <indexterm role="option">
26097 <primary><option>localhost_number</option></primary>
26098 </indexterm>
26099 </para>
26100 <informaltable frame="all">
26101 <tgroup cols="4" colsep="0" rowsep="0">
26102 <colspec colwidth="8*" align="left"/>
26103 <colspec colwidth="6*" align="center"/>
26104 <colspec colwidth="6*" align="center"/>
26105 <colspec colwidth="6*" align="right"/>
26106 <tbody>
26107 <row>
26108 <entry><option>localhost_number</option></entry>
26109 <entry>Use: <emphasis>main</emphasis></entry>
26110 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
26111 <entry>Default: <emphasis>unset</emphasis></entry>
26112 </row>
26113 </tbody>
26114 </tgroup>
26115 </informaltable>
26116 <para>
26117 <indexterm role="concept">
26118 <primary>host</primary>
26119 <secondary>locally unique number for</secondary>
26120 </indexterm>
26121 <indexterm role="concept">
26122 <primary>message ids</primary>
26123 <secondary>with multiple hosts</secondary>
26124 </indexterm>
26125 <indexterm role="variable">
26126 <primary><varname>$localhost_number</varname></primary>
26127 </indexterm>
26128 Exim&#x2019;s message ids are normally unique only within the local host. If
26129 uniqueness among a set of hosts is required, each host must set a different
26130 value for the <option>localhost_number</option> option. The string is expanded immediately
26131 after reading the configuration file (so that a number can be computed from the
26132 host name, for example) and the result of the expansion must be a number in the
26133 range 0&ndash;16 (or 0&ndash;10 on operating systems with case-insensitive file
26134 systems). This is available in subsequent string expansions via the variable
26135 <varname>$localhost_number</varname>. When <option>localhost_number is set</option>, the final two
26136 characters of the message id, instead of just being a fractional part of the
26137 time, are computed from the time and the local host number as described in
26138 section <xref linkend="SECTmessiden"/>.
26139 </para>
26140 <para>
26141 <indexterm role="option">
26142 <primary><option>log_file_path</option></primary>
26143 </indexterm>
26144 </para>
26145 <informaltable frame="all">
26146 <tgroup cols="4" colsep="0" rowsep="0">
26147 <colspec colwidth="8*" align="left"/>
26148 <colspec colwidth="6*" align="center"/>
26149 <colspec colwidth="6*" align="center"/>
26150 <colspec colwidth="6*" align="right"/>
26151 <tbody>
26152 <row>
26153 <entry><option>log_file_path</option></entry>
26154 <entry>Use: <emphasis>main</emphasis></entry>
26155 <entry>Type: <emphasis>string list</emphasis>&dagger;<emphasis></emphasis></entry>
26156 <entry>Default: <emphasis>set at compile time</emphasis></entry>
26157 </row>
26158 </tbody>
26159 </tgroup>
26160 </informaltable>
26161 <para>
26162 <indexterm role="concept">
26163 <primary>log</primary>
26164 <secondary>file path for</secondary>
26165 </indexterm>
26166 This option sets the path which is used to determine the names of Exim&#x2019;s log
26167 files, or indicates that logging is to be to syslog, or both. It is expanded
26168 when Exim is entered, so it can, for example, contain a reference to the host
26169 name. If no specific path is set for the log files at compile or run time,
26170 or if the option is unset at run time (i.e.  <literal>log_file_path = </literal>)
26171 they are written in a sub-directory called <filename>log</filename> in Exim&#x2019;s spool directory.
26172 Chapter <xref linkend="CHAPlog"/> contains further details about Exim&#x2019;s logging, and
26173 section <xref linkend="SECTwhelogwri"/> describes how the contents of <option>log_file_path</option> are
26174 used. If this string is fixed at your installation (contains no expansion
26175 variables) it is recommended that you do not set this option in the
26176 configuration file, but instead supply the path using LOG_FILE_PATH in
26177 <filename>Local/Makefile</filename> so that it is available to Exim for logging errors detected
26178 early on &ndash; in particular, failure to read the configuration file.
26179 </para>
26180 <para>
26181 <indexterm role="option">
26182 <primary><option>log_selector</option></primary>
26183 </indexterm>
26184 </para>
26185 <informaltable frame="all">
26186 <tgroup cols="4" colsep="0" rowsep="0">
26187 <colspec colwidth="8*" align="left"/>
26188 <colspec colwidth="6*" align="center"/>
26189 <colspec colwidth="6*" align="center"/>
26190 <colspec colwidth="6*" align="right"/>
26191 <tbody>
26192 <row>
26193 <entry><option>log_selector</option></entry>
26194 <entry>Use: <emphasis>main</emphasis></entry>
26195 <entry>Type: <emphasis>string</emphasis></entry>
26196 <entry>Default: <emphasis>unset</emphasis></entry>
26197 </row>
26198 </tbody>
26199 </tgroup>
26200 </informaltable>
26201 <para>
26202 <indexterm role="concept">
26203 <primary>log</primary>
26204 <secondary>selectors</secondary>
26205 </indexterm>
26206 This option can be used to reduce or increase the number of things that Exim
26207 writes to its log files. Its argument is made up of names preceded by plus or
26208 minus characters. For example:
26209 </para>
26210 <literallayout class="monospaced">
26211 log_selector = +arguments -retry_defer
26212 </literallayout>
26213 <para>
26214 A list of possible names and what they control is given in the chapter on
26215 logging, in section <xref linkend="SECTlogselector"/>.
26216 </para>
26217 <para>
26218 <indexterm role="option">
26219 <primary><option>log_timezone</option></primary>
26220 </indexterm>
26221 </para>
26222 <informaltable frame="all">
26223 <tgroup cols="4" colsep="0" rowsep="0">
26224 <colspec colwidth="8*" align="left"/>
26225 <colspec colwidth="6*" align="center"/>
26226 <colspec colwidth="6*" align="center"/>
26227 <colspec colwidth="6*" align="right"/>
26228 <tbody>
26229 <row>
26230 <entry><option>log_timezone</option></entry>
26231 <entry>Use: <emphasis>main</emphasis></entry>
26232 <entry>Type: <emphasis>boolean</emphasis></entry>
26233 <entry>Default: <emphasis>false</emphasis></entry>
26234 </row>
26235 </tbody>
26236 </tgroup>
26237 </informaltable>
26238 <para>
26239 <indexterm role="concept">
26240 <primary>log</primary>
26241 <secondary>timezone for entries</secondary>
26242 </indexterm>
26243 <indexterm role="variable">
26244 <primary><varname>$tod_log</varname></primary>
26245 </indexterm>
26246 <indexterm role="variable">
26247 <primary><varname>$tod_zone</varname></primary>
26248 </indexterm>
26249 By default, the timestamps on log lines are in local time without the
26250 timezone. This means that if your timezone changes twice a year, the timestamps
26251 in log lines are ambiguous for an hour when the clocks go back. One way of
26252 avoiding this problem is to set the timezone to UTC. An alternative is to set
26253 <option>log_timezone</option> true. This turns on the addition of the timezone offset to
26254 timestamps in log lines. Turning on this option can add quite a lot to the size
26255 of log files because each line is extended by 6 characters. Note that the
26256 <varname>$tod_log</varname> variable contains the log timestamp without the zone, but there is
26257 another variable called <varname>$tod_zone</varname> that contains just the timezone offset.
26258 </para>
26259 <para>
26260 <indexterm role="option">
26261 <primary><option>lookup_open_max</option></primary>
26262 </indexterm>
26263 </para>
26264 <informaltable frame="all">
26265 <tgroup cols="4" colsep="0" rowsep="0">
26266 <colspec colwidth="8*" align="left"/>
26267 <colspec colwidth="6*" align="center"/>
26268 <colspec colwidth="6*" align="center"/>
26269 <colspec colwidth="6*" align="right"/>
26270 <tbody>
26271 <row>
26272 <entry><option>lookup_open_max</option></entry>
26273 <entry>Use: <emphasis>main</emphasis></entry>
26274 <entry>Type: <emphasis>integer</emphasis></entry>
26275 <entry>Default: <emphasis>25</emphasis></entry>
26276 </row>
26277 </tbody>
26278 </tgroup>
26279 </informaltable>
26280 <para>
26281 <indexterm role="concept">
26282 <primary>too many open files</primary>
26283 </indexterm>
26284 <indexterm role="concept">
26285 <primary>open files, too many</primary>
26286 </indexterm>
26287 <indexterm role="concept">
26288 <primary>file</primary>
26289 <secondary>too many open</secondary>
26290 </indexterm>
26291 <indexterm role="concept">
26292 <primary>lookup</primary>
26293 <secondary>maximum open files</secondary>
26294 </indexterm>
26295 <indexterm role="concept">
26296 <primary>limit</primary>
26297 <secondary>open files for lookups</secondary>
26298 </indexterm>
26299 This option limits the number of simultaneously open files for single-key
26300 lookups that use regular files (that is, <command>lsearch</command>, <command>dbm</command>, and <command>cdb</command>).
26301 Exim normally keeps these files open during routing, because often the same
26302 file is required several times. If the limit is reached, Exim closes the least
26303 recently used file. Note that if you are using the <emphasis>ndbm</emphasis> library, it
26304 actually opens two files for each logical DBM database, though it still counts
26305 as one for the purposes of <option>lookup_open_max</option>. If you are getting <quote>too many
26306 open files</quote> errors with NDBM, you need to reduce the value of
26307 <option>lookup_open_max</option>.
26308 </para>
26309 <para>
26310 <indexterm role="option">
26311 <primary><option>max_username_length</option></primary>
26312 </indexterm>
26313 </para>
26314 <informaltable frame="all">
26315 <tgroup cols="4" colsep="0" rowsep="0">
26316 <colspec colwidth="8*" align="left"/>
26317 <colspec colwidth="6*" align="center"/>
26318 <colspec colwidth="6*" align="center"/>
26319 <colspec colwidth="6*" align="right"/>
26320 <tbody>
26321 <row>
26322 <entry><option>max_username_length</option></entry>
26323 <entry>Use: <emphasis>main</emphasis></entry>
26324 <entry>Type: <emphasis>integer</emphasis></entry>
26325 <entry>Default: <emphasis>0</emphasis></entry>
26326 </row>
26327 </tbody>
26328 </tgroup>
26329 </informaltable>
26330 <para>
26331 <indexterm role="concept">
26332 <primary>length of login name</primary>
26333 </indexterm>
26334 <indexterm role="concept">
26335 <primary>user name</primary>
26336 <secondary>maximum length</secondary>
26337 </indexterm>
26338 <indexterm role="concept">
26339 <primary>limit</primary>
26340 <secondary>user name length</secondary>
26341 </indexterm>
26342 Some operating systems are broken in that they truncate long arguments to
26343 <function>getpwnam()</function> to eight characters, instead of returning <quote>no such user</quote>. If
26344 this option is set greater than zero, any attempt to call <function>getpwnam()</function> with
26345 an argument that is longer behaves as if <function>getpwnam()</function> failed.
26346 </para>
26347 <para>
26348 <indexterm role="option">
26349 <primary><option>message_body_newlines</option></primary>
26350 </indexterm>
26351 </para>
26352 <informaltable frame="all">
26353 <tgroup cols="4" colsep="0" rowsep="0">
26354 <colspec colwidth="8*" align="left"/>
26355 <colspec colwidth="6*" align="center"/>
26356 <colspec colwidth="6*" align="center"/>
26357 <colspec colwidth="6*" align="right"/>
26358 <tbody>
26359 <row>
26360 <entry><option>message_body_newlines</option></entry>
26361 <entry>Use: <emphasis>main</emphasis></entry>
26362 <entry>Type: <emphasis>bool</emphasis></entry>
26363 <entry>Default: <emphasis>false</emphasis></entry>
26364 </row>
26365 </tbody>
26366 </tgroup>
26367 </informaltable>
26368 <para>
26369 <indexterm role="concept">
26370 <primary>message body</primary>
26371 <secondary>newlines in variables</secondary>
26372 </indexterm>
26373 <indexterm role="concept">
26374 <primary>newline</primary>
26375 <secondary>in message body variables</secondary>
26376 </indexterm>
26377 <indexterm role="variable">
26378 <primary><varname>$message_body</varname></primary>
26379 </indexterm>
26380 <indexterm role="variable">
26381 <primary><varname>$message_body_end</varname></primary>
26382 </indexterm>
26383 By default, newlines in the message body are replaced by spaces when setting
26384 the <varname>$message_body</varname> and <varname>$message_body_end</varname> expansion variables. If this
26385 option is set true, this no longer happens.
26386 </para>
26387 <para>
26388 <indexterm role="option">
26389 <primary><option>message_body_visible</option></primary>
26390 </indexterm>
26391 </para>
26392 <informaltable frame="all">
26393 <tgroup cols="4" colsep="0" rowsep="0">
26394 <colspec colwidth="8*" align="left"/>
26395 <colspec colwidth="6*" align="center"/>
26396 <colspec colwidth="6*" align="center"/>
26397 <colspec colwidth="6*" align="right"/>
26398 <tbody>
26399 <row>
26400 <entry><option>message_body_visible</option></entry>
26401 <entry>Use: <emphasis>main</emphasis></entry>
26402 <entry>Type: <emphasis>integer</emphasis></entry>
26403 <entry>Default: <emphasis>500</emphasis></entry>
26404 </row>
26405 </tbody>
26406 </tgroup>
26407 </informaltable>
26408 <para>
26409 <indexterm role="concept">
26410 <primary>body of message</primary>
26411 <secondary>visible size</secondary>
26412 </indexterm>
26413 <indexterm role="concept">
26414 <primary>message body</primary>
26415 <secondary>visible size</secondary>
26416 </indexterm>
26417 <indexterm role="variable">
26418 <primary><varname>$message_body</varname></primary>
26419 </indexterm>
26420 <indexterm role="variable">
26421 <primary><varname>$message_body_end</varname></primary>
26422 </indexterm>
26423 This option specifies how much of a message&#x2019;s body is to be included in the
26424 <varname>$message_body</varname> and <varname>$message_body_end</varname> expansion variables.
26425 </para>
26426 <para>
26427 <indexterm role="option">
26428 <primary><option>message_id_header_domain</option></primary>
26429 </indexterm>
26430 </para>
26431 <informaltable frame="all">
26432 <tgroup cols="4" colsep="0" rowsep="0">
26433 <colspec colwidth="8*" align="left"/>
26434 <colspec colwidth="6*" align="center"/>
26435 <colspec colwidth="6*" align="center"/>
26436 <colspec colwidth="6*" align="right"/>
26437 <tbody>
26438 <row>
26439 <entry><option>message_id_header_domain</option></entry>
26440 <entry>Use: <emphasis>main</emphasis></entry>
26441 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
26442 <entry>Default: <emphasis>unset</emphasis></entry>
26443 </row>
26444 </tbody>
26445 </tgroup>
26446 </informaltable>
26447 <para>
26448 <indexterm role="concept">
26449 <primary><emphasis>Message-ID:</emphasis> header line</primary>
26450 </indexterm>
26451 If this option is set, the string is expanded and used as the right hand side
26452 (domain) of the <emphasis>Message-ID:</emphasis> header that Exim creates if a
26453 locally-originated incoming message does not have one. <quote>Locally-originated</quote>
26454 means <quote>not received over TCP/IP.</quote>
26455 Otherwise, the primary host name is used.
26456 Only letters, digits, dot and hyphen are accepted; any other characters are
26457 replaced by hyphens. If the expansion is forced to fail, or if the result is an
26458 empty string, the option is ignored.
26459 </para>
26460 <para>
26461 <indexterm role="option">
26462 <primary><option>message_id_header_text</option></primary>
26463 </indexterm>
26464 </para>
26465 <informaltable frame="all">
26466 <tgroup cols="4" colsep="0" rowsep="0">
26467 <colspec colwidth="8*" align="left"/>
26468 <colspec colwidth="6*" align="center"/>
26469 <colspec colwidth="6*" align="center"/>
26470 <colspec colwidth="6*" align="right"/>
26471 <tbody>
26472 <row>
26473 <entry><option>message_id_header_text</option></entry>
26474 <entry>Use: <emphasis>main</emphasis></entry>
26475 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
26476 <entry>Default: <emphasis>unset</emphasis></entry>
26477 </row>
26478 </tbody>
26479 </tgroup>
26480 </informaltable>
26481 <para>
26482 If this variable is set, the string is expanded and used to augment the text of
26483 the <emphasis>Message-id:</emphasis> header that Exim creates if a locally-originated incoming
26484 message does not have one. The text of this header is required by RFC 2822 to
26485 take the form of an address. By default, Exim uses its internal message id as
26486 the local part, and the primary host name as the domain. If this option is set,
26487 it is expanded, and provided the expansion is not forced to fail, and does not
26488 yield an empty string, the result is inserted into the header immediately
26489 before the @, separated from the internal message id by a dot. Any characters
26490 that are illegal in an address are automatically converted into hyphens. This
26491 means that variables such as <varname>$tod_log</varname> can be used, because the spaces and
26492 colons will become hyphens.
26493 </para>
26494 <para>
26495 <indexterm role="option">
26496 <primary><option>message_logs</option></primary>
26497 </indexterm>
26498 </para>
26499 <informaltable frame="all">
26500 <tgroup cols="4" colsep="0" rowsep="0">
26501 <colspec colwidth="8*" align="left"/>
26502 <colspec colwidth="6*" align="center"/>
26503 <colspec colwidth="6*" align="center"/>
26504 <colspec colwidth="6*" align="right"/>
26505 <tbody>
26506 <row>
26507 <entry><option>message_logs</option></entry>
26508 <entry>Use: <emphasis>main</emphasis></entry>
26509 <entry>Type: <emphasis>boolean</emphasis></entry>
26510 <entry>Default: <emphasis>true</emphasis></entry>
26511 </row>
26512 </tbody>
26513 </tgroup>
26514 </informaltable>
26515 <para>
26516 <indexterm role="concept">
26517 <primary>message logs</primary>
26518 <secondary>disabling</secondary>
26519 </indexterm>
26520 <indexterm role="concept">
26521 <primary>log</primary>
26522 <secondary>message log; disabling</secondary>
26523 </indexterm>
26524 If this option is turned off, per-message log files are not created in the
26525 <filename>msglog</filename> spool sub-directory. This reduces the amount of disk I/O required by
26526 Exim, by reducing the number of files involved in handling a message from a
26527 minimum of four (header spool file, body spool file, delivery journal, and
26528 per-message log) to three. The other major I/O activity is Exim&#x2019;s main log,
26529 which is not affected by this option.
26530 </para>
26531 <para>
26532 <indexterm role="option">
26533 <primary><option>message_size_limit</option></primary>
26534 </indexterm>
26535 </para>
26536 <informaltable frame="all">
26537 <tgroup cols="4" colsep="0" rowsep="0">
26538 <colspec colwidth="8*" align="left"/>
26539 <colspec colwidth="6*" align="center"/>
26540 <colspec colwidth="6*" align="center"/>
26541 <colspec colwidth="6*" align="right"/>
26542 <tbody>
26543 <row>
26544 <entry><option>message_size_limit</option></entry>
26545 <entry>Use: <emphasis>main</emphasis></entry>
26546 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
26547 <entry>Default: <emphasis>50M</emphasis></entry>
26548 </row>
26549 </tbody>
26550 </tgroup>
26551 </informaltable>
26552 <para>
26553 <indexterm role="concept">
26554 <primary>message</primary>
26555 <secondary>size limit</secondary>
26556 </indexterm>
26557 <indexterm role="concept">
26558 <primary>limit</primary>
26559 <secondary>message size</secondary>
26560 </indexterm>
26561 <indexterm role="concept">
26562 <primary>size</primary>
26563 <secondary>of message, limit</secondary>
26564 </indexterm>
26565 This option limits the maximum size of message that Exim will process. The
26566 value is expanded for each incoming connection so, for example, it can be made
26567 to depend on the IP address of the remote host for messages arriving via
26568 TCP/IP. After expansion, the value must be a sequence of decimal digits,
26569 optionally followed by K or M.
26570 </para>
26571 <para>
26572 <emphasis role="bold">Note</emphasis>: This limit cannot be made to depend on a message&#x2019;s sender or any
26573 other properties of an individual message, because it has to be advertised in
26574 the server&#x2019;s response to EHLO. String expansion failure causes a temporary
26575 error. A value of zero means no limit, but its use is not recommended. See also
26576 <option>bounce_return_size_limit</option>.
26577 </para>
26578 <para>
26579 Incoming SMTP messages are failed with a 552 error if the limit is
26580 exceeded; locally-generated messages either get a stderr message or a delivery
26581 failure message to the sender, depending on the <option>-oe</option> setting. Rejection of
26582 an oversized message is logged in both the main and the reject logs. See also
26583 the generic transport option <option>message_size_limit</option>, which limits the size of
26584 message that an individual transport can process.
26585 </para>
26586 <para>
26587 If you use a virus-scanner and set this option to to a value larger than the
26588 maximum size that your virus-scanner is configured to support, you may get
26589 failures triggered by large mails.  The right size to configure for the
26590 virus-scanner depends upon what data is passed and the options in use but it&#x2019;s
26591 probably safest to just set it to a little larger than this value.  E.g., with a
26592 default Exim message size of 50M and a default ClamAV StreamMaxLength of 10M,
26593 some problems may result.
26594 </para>
26595 <para>
26596 A value of 0 will disable size limit checking; Exim will still advertise the
26597 SIZE extension in an EHLO response, but without a limit, so as to permit
26598 SMTP clients to still indicate the message size along with the MAIL verb.
26599 </para>
26600 <para>
26601 <indexterm role="option">
26602 <primary><option>move_frozen_messages</option></primary>
26603 </indexterm>
26604 </para>
26605 <informaltable frame="all">
26606 <tgroup cols="4" colsep="0" rowsep="0">
26607 <colspec colwidth="8*" align="left"/>
26608 <colspec colwidth="6*" align="center"/>
26609 <colspec colwidth="6*" align="center"/>
26610 <colspec colwidth="6*" align="right"/>
26611 <tbody>
26612 <row>
26613 <entry><option>move_frozen_messages</option></entry>
26614 <entry>Use: <emphasis>main</emphasis></entry>
26615 <entry>Type: <emphasis>boolean</emphasis></entry>
26616 <entry>Default: <emphasis>false</emphasis></entry>
26617 </row>
26618 </tbody>
26619 </tgroup>
26620 </informaltable>
26621 <para>
26622 <indexterm role="concept">
26623 <primary>frozen messages</primary>
26624 <secondary>moving</secondary>
26625 </indexterm>
26626 This option, which is available only if Exim has been built with the setting
26627 </para>
26628 <literallayout class="monospaced">
26629 SUPPORT_MOVE_FROZEN_MESSAGES=yes
26630 </literallayout>
26631 <para>
26632 in <filename>Local/Makefile</filename>, causes frozen messages and their message logs to be
26633 moved from the <filename>input</filename> and <filename>msglog</filename> directories on the spool to <filename>Finput</filename>
26634 and <filename>Fmsglog</filename>, respectively. There is currently no support in Exim or the
26635 standard utilities for handling such moved messages, and they do not show up in
26636 lists generated by <option>-bp</option> or by the Exim monitor.
26637 </para>
26638 <para>
26639 <indexterm role="option">
26640 <primary><option>mua_wrapper</option></primary>
26641 </indexterm>
26642 </para>
26643 <informaltable frame="all">
26644 <tgroup cols="4" colsep="0" rowsep="0">
26645 <colspec colwidth="8*" align="left"/>
26646 <colspec colwidth="6*" align="center"/>
26647 <colspec colwidth="6*" align="center"/>
26648 <colspec colwidth="6*" align="right"/>
26649 <tbody>
26650 <row>
26651 <entry><option>mua_wrapper</option></entry>
26652 <entry>Use: <emphasis>main</emphasis></entry>
26653 <entry>Type: <emphasis>boolean</emphasis></entry>
26654 <entry>Default: <emphasis>false</emphasis></entry>
26655 </row>
26656 </tbody>
26657 </tgroup>
26658 </informaltable>
26659 <para>
26660 Setting this option true causes Exim to run in a very restrictive mode in which
26661 it passes messages synchronously to a smart host. Chapter <xref linkend="CHAPnonqueueing"/>
26662 contains a full description of this facility.
26663 </para>
26664 <para>
26665 <indexterm role="option">
26666 <primary><option>mysql_servers</option></primary>
26667 </indexterm>
26668 </para>
26669 <informaltable frame="all">
26670 <tgroup cols="4" colsep="0" rowsep="0">
26671 <colspec colwidth="8*" align="left"/>
26672 <colspec colwidth="6*" align="center"/>
26673 <colspec colwidth="6*" align="center"/>
26674 <colspec colwidth="6*" align="right"/>
26675 <tbody>
26676 <row>
26677 <entry><option>mysql_servers</option></entry>
26678 <entry>Use: <emphasis>main</emphasis></entry>
26679 <entry>Type: <emphasis>string list</emphasis></entry>
26680 <entry>Default: <emphasis>unset</emphasis></entry>
26681 </row>
26682 </tbody>
26683 </tgroup>
26684 </informaltable>
26685 <para>
26686 <indexterm role="concept">
26687 <primary>MySQL</primary>
26688 <secondary>server list</secondary>
26689 </indexterm>
26690 This option provides a list of MySQL servers and associated connection data, to
26691 be used in conjunction with <command>mysql</command> lookups (see section <xref linkend="SECID72"/>). The
26692 option is available only if Exim has been built with MySQL support.
26693 </para>
26694 <para>
26695 <indexterm role="option">
26696 <primary><option>never_users</option></primary>
26697 </indexterm>
26698 </para>
26699 <informaltable frame="all">
26700 <tgroup cols="4" colsep="0" rowsep="0">
26701 <colspec colwidth="8*" align="left"/>
26702 <colspec colwidth="6*" align="center"/>
26703 <colspec colwidth="6*" align="center"/>
26704 <colspec colwidth="6*" align="right"/>
26705 <tbody>
26706 <row>
26707 <entry><option>never_users</option></entry>
26708 <entry>Use: <emphasis>main</emphasis></entry>
26709 <entry>Type: <emphasis>string list</emphasis>&dagger;<emphasis></emphasis></entry>
26710 <entry>Default: <emphasis>unset</emphasis></entry>
26711 </row>
26712 </tbody>
26713 </tgroup>
26714 </informaltable>
26715 <para>
26716 This option is expanded just once, at the start of Exim&#x2019;s processing. Local
26717 message deliveries are normally run in processes that are setuid to the
26718 recipient, and remote deliveries are normally run under Exim&#x2019;s own uid and gid.
26719 It is usually desirable to prevent any deliveries from running as root, as a
26720 safety precaution.
26721 </para>
26722 <para>
26723 When Exim is built, an option called FIXED_NEVER_USERS can be set to a
26724 list of users that must not be used for local deliveries. This list is fixed in
26725 the binary and cannot be overridden by the configuration file. By default, it
26726 contains just the single user name <quote>root</quote>. The <option>never_users</option> runtime option
26727 can be used to add more users to the fixed list.
26728 </para>
26729 <para>
26730 If a message is to be delivered as one of the users on the fixed list or the
26731 <option>never_users</option> list, an error occurs, and delivery is deferred. A common
26732 example is
26733 </para>
26734 <literallayout class="monospaced">
26735 never_users = root:daemon:bin
26736 </literallayout>
26737 <para>
26738 Including root is redundant if it is also on the fixed list, but it does no
26739 harm. This option overrides the <option>pipe_as_creator</option> option of the <command>pipe</command>
26740 transport driver.
26741 </para>
26742 <para>
26743 <indexterm role="option">
26744 <primary><option>openssl_options</option></primary>
26745 </indexterm>
26746 </para>
26747 <informaltable frame="all">
26748 <tgroup cols="4" colsep="0" rowsep="0">
26749 <colspec colwidth="8*" align="left"/>
26750 <colspec colwidth="6*" align="center"/>
26751 <colspec colwidth="6*" align="center"/>
26752 <colspec colwidth="6*" align="right"/>
26753 <tbody>
26754 <row>
26755 <entry><option>openssl_options</option></entry>
26756 <entry>Use: <emphasis>main</emphasis></entry>
26757 <entry>Type: <emphasis>string list</emphasis></entry>
26758 <entry>Default: <emphasis>+no_sslv2</emphasis></entry>
26759 </row>
26760 </tbody>
26761 </tgroup>
26762 </informaltable>
26763 <para>
26764 <indexterm role="concept">
26765 <primary>OpenSSL </primary>
26766 <secondary>compatibility</secondary>
26767 </indexterm>
26768 This option allows an administrator to adjust the SSL options applied
26769 by OpenSSL to connections.  It is given as a space-separated list of items,
26770 each one to be +added or -subtracted from the current value.
26771 </para>
26772 <para>
26773 This option is only available if Exim is built against OpenSSL.  The values
26774 available for this option vary according to the age of your OpenSSL install.
26775 The <quote>all</quote> value controls a subset of flags which are available, typically
26776 the bug workaround options.  The <emphasis>SSL_CTX_set_options</emphasis> man page will
26777 list the values known on your system and Exim should support all the
26778 <quote>bug workaround</quote> options and many of the <quote>modifying</quote> options.  The Exim
26779 names lose the leading <quote>SSL_OP_</quote> and are lower-cased.
26780 </para>
26781 <para>
26782 Note that adjusting the options can have severe impact upon the security of
26783 SSL as used by Exim.  It is possible to disable safety checks and shoot
26784 yourself in the foot in various unpleasant ways.  This option should not be
26785 adjusted lightly.  An unrecognised item will be detected at startup, by
26786 invoking Exim with the <option>-bV</option> flag.
26787 </para>
26788 <para>
26789 The option affects Exim operating both as a server and as a client.
26790 </para>
26791 <para>
26792 Historical note: prior to release 4.80, Exim defaulted this value to
26793 "+dont_insert_empty_fragments", which may still be needed for compatibility
26794 with some clients, but which lowers security by increasing exposure to
26795 some now infamous attacks.
26796 </para>
26797 <para>
26798 Examples:
26799 </para>
26800 <literallayout class="monospaced">
26801 # Make both old MS and old Eudora happy:
26802 openssl_options = -all +microsoft_big_sslv3_buffer \
26803                        +dont_insert_empty_fragments
26804
26805 # Disable older protocol versions:
26806 openssl_options = +no_sslv2 +no_sslv3
26807 </literallayout>
26808 <para>
26809 Possible options may include:
26810 </para>
26811 <itemizedlist>
26812 <listitem>
26813 <para>
26814 <literal>all</literal>
26815 </para>
26816 </listitem>
26817 <listitem>
26818 <para>
26819 <literal>allow_unsafe_legacy_renegotiation</literal>
26820 </para>
26821 </listitem>
26822 <listitem>
26823 <para>
26824 <literal>cipher_server_preference</literal>
26825 </para>
26826 </listitem>
26827 <listitem>
26828 <para>
26829 <literal>dont_insert_empty_fragments</literal>
26830 </para>
26831 </listitem>
26832 <listitem>
26833 <para>
26834 <literal>ephemeral_rsa</literal>
26835 </para>
26836 </listitem>
26837 <listitem>
26838 <para>
26839 <literal>legacy_server_connect</literal>
26840 </para>
26841 </listitem>
26842 <listitem>
26843 <para>
26844 <literal>microsoft_big_sslv3_buffer</literal>
26845 </para>
26846 </listitem>
26847 <listitem>
26848 <para>
26849 <literal>microsoft_sess_id_bug</literal>
26850 </para>
26851 </listitem>
26852 <listitem>
26853 <para>
26854 <literal>msie_sslv2_rsa_padding</literal>
26855 </para>
26856 </listitem>
26857 <listitem>
26858 <para>
26859 <literal>netscape_challenge_bug</literal>
26860 </para>
26861 </listitem>
26862 <listitem>
26863 <para>
26864 <literal>netscape_reuse_cipher_change_bug</literal>
26865 </para>
26866 </listitem>
26867 <listitem>
26868 <para>
26869 <literal>no_compression</literal>
26870 </para>
26871 </listitem>
26872 <listitem>
26873 <para>
26874 <literal>no_session_resumption_on_renegotiation</literal>
26875 </para>
26876 </listitem>
26877 <listitem>
26878 <para>
26879 <literal>no_sslv2</literal>
26880 </para>
26881 </listitem>
26882 <listitem>
26883 <para>
26884 <literal>no_sslv3</literal>
26885 </para>
26886 </listitem>
26887 <listitem>
26888 <para>
26889 <literal>no_ticket</literal>
26890 </para>
26891 </listitem>
26892 <listitem>
26893 <para>
26894 <literal>no_tlsv1</literal>
26895 </para>
26896 </listitem>
26897 <listitem>
26898 <para>
26899 <literal>no_tlsv1_1</literal>
26900 </para>
26901 </listitem>
26902 <listitem>
26903 <para>
26904 <literal>no_tlsv1_2</literal>
26905 </para>
26906 </listitem>
26907 <listitem>
26908 <para>
26909 <literal>safari_ecdhe_ecdsa_bug</literal>
26910 </para>
26911 </listitem>
26912 <listitem>
26913 <para>
26914 <literal>single_dh_use</literal>
26915 </para>
26916 </listitem>
26917 <listitem>
26918 <para>
26919 <literal>single_ecdh_use</literal>
26920 </para>
26921 </listitem>
26922 <listitem>
26923 <para>
26924 <literal>ssleay_080_client_dh_bug</literal>
26925 </para>
26926 </listitem>
26927 <listitem>
26928 <para>
26929 <literal>sslref2_reuse_cert_type_bug</literal>
26930 </para>
26931 </listitem>
26932 <listitem>
26933 <para>
26934 <literal>tls_block_padding_bug</literal>
26935 </para>
26936 </listitem>
26937 <listitem>
26938 <para>
26939 <literal>tls_d5_bug</literal>
26940 </para>
26941 </listitem>
26942 <listitem>
26943 <para>
26944 <literal>tls_rollback_bug</literal>
26945 </para>
26946 </listitem>
26947 </itemizedlist>
26948 <para>
26949 As an aside, the <literal>safari_ecdhe_ecdsa_bug</literal> item is a misnomer and affects
26950 all clients connecting using the MacOS SecureTransport TLS facility prior
26951 to MacOS 10.8.4, including email clients.  If you see old MacOS clients failing
26952 to negotiate TLS then this option value might help, provided that your OpenSSL
26953 release is new enough to contain this work-around.  This may be a situation
26954 where you have to upgrade OpenSSL to get buggy clients working.
26955 </para>
26956 <para>
26957 <indexterm role="option">
26958 <primary><option>oracle_servers</option></primary>
26959 </indexterm>
26960 </para>
26961 <informaltable frame="all">
26962 <tgroup cols="4" colsep="0" rowsep="0">
26963 <colspec colwidth="8*" align="left"/>
26964 <colspec colwidth="6*" align="center"/>
26965 <colspec colwidth="6*" align="center"/>
26966 <colspec colwidth="6*" align="right"/>
26967 <tbody>
26968 <row>
26969 <entry><option>oracle_servers</option></entry>
26970 <entry>Use: <emphasis>main</emphasis></entry>
26971 <entry>Type: <emphasis>string list</emphasis></entry>
26972 <entry>Default: <emphasis>unset</emphasis></entry>
26973 </row>
26974 </tbody>
26975 </tgroup>
26976 </informaltable>
26977 <para>
26978 <indexterm role="concept">
26979 <primary>Oracle</primary>
26980 <secondary>server list</secondary>
26981 </indexterm>
26982 This option provides a list of Oracle servers and associated connection data,
26983 to be used in conjunction with <command>oracle</command> lookups (see section <xref linkend="SECID72"/>).
26984 The option is available only if Exim has been built with Oracle support.
26985 </para>
26986 <para>
26987 <indexterm role="option">
26988 <primary><option>percent_hack_domains</option></primary>
26989 </indexterm>
26990 </para>
26991 <informaltable frame="all">
26992 <tgroup cols="4" colsep="0" rowsep="0">
26993 <colspec colwidth="8*" align="left"/>
26994 <colspec colwidth="6*" align="center"/>
26995 <colspec colwidth="6*" align="center"/>
26996 <colspec colwidth="6*" align="right"/>
26997 <tbody>
26998 <row>
26999 <entry><option>percent_hack_domains</option></entry>
27000 <entry>Use: <emphasis>main</emphasis></entry>
27001 <entry>Type: <emphasis>domain list</emphasis>&dagger;<emphasis></emphasis></entry>
27002 <entry>Default: <emphasis>unset</emphasis></entry>
27003 </row>
27004 </tbody>
27005 </tgroup>
27006 </informaltable>
27007 <para>
27008 <indexterm role="concept">
27009 <primary><quote>percent hack</quote></primary>
27010 </indexterm>
27011 <indexterm role="concept">
27012 <primary>source routing</primary>
27013 <secondary>in email address</secondary>
27014 </indexterm>
27015 <indexterm role="concept">
27016 <primary>address</primary>
27017 <secondary>source-routed</secondary>
27018 </indexterm>
27019 The <quote>percent hack</quote> is the convention whereby a local part containing a
27020 percent sign is re-interpreted as a new email address, with the percent
27021 replaced by @. This is sometimes called <quote>source routing</quote>, though that term is
27022 also applied to RFC 2822 addresses that begin with an @ character. If this
27023 option is set, Exim implements the percent facility for those domains listed,
27024 but no others. This happens before an incoming SMTP address is tested against
27025 an ACL.
27026 </para>
27027 <para>
27028 <emphasis role="bold">Warning</emphasis>: The <quote>percent hack</quote> has often been abused by people who are
27029 trying to get round relaying restrictions. For this reason, it is best avoided
27030 if at all possible. Unfortunately, a number of less security-conscious MTAs
27031 implement it unconditionally. If you are running Exim on a gateway host, and
27032 routing mail through to internal MTAs without processing the local parts, it is
27033 a good idea to reject recipient addresses with percent characters in their
27034 local parts. Exim&#x2019;s default configuration does this.
27035 </para>
27036 <para>
27037 <indexterm role="option">
27038 <primary><option>perl_at_start</option></primary>
27039 </indexterm>
27040 </para>
27041 <informaltable frame="all">
27042 <tgroup cols="4" colsep="0" rowsep="0">
27043 <colspec colwidth="8*" align="left"/>
27044 <colspec colwidth="6*" align="center"/>
27045 <colspec colwidth="6*" align="center"/>
27046 <colspec colwidth="6*" align="right"/>
27047 <tbody>
27048 <row>
27049 <entry><option>perl_at_start</option></entry>
27050 <entry>Use: <emphasis>main</emphasis></entry>
27051 <entry>Type: <emphasis>boolean</emphasis></entry>
27052 <entry>Default: <emphasis>false</emphasis></entry>
27053 </row>
27054 </tbody>
27055 </tgroup>
27056 </informaltable>
27057 <para>
27058 This option is available only when Exim is built with an embedded Perl
27059 interpreter. See chapter <xref linkend="CHAPperl"/> for details of its use.
27060 </para>
27061 <para>
27062 <indexterm role="option">
27063 <primary><option>perl_startup</option></primary>
27064 </indexterm>
27065 </para>
27066 <informaltable frame="all">
27067 <tgroup cols="4" colsep="0" rowsep="0">
27068 <colspec colwidth="8*" align="left"/>
27069 <colspec colwidth="6*" align="center"/>
27070 <colspec colwidth="6*" align="center"/>
27071 <colspec colwidth="6*" align="right"/>
27072 <tbody>
27073 <row>
27074 <entry><option>perl_startup</option></entry>
27075 <entry>Use: <emphasis>main</emphasis></entry>
27076 <entry>Type: <emphasis>string</emphasis></entry>
27077 <entry>Default: <emphasis>unset</emphasis></entry>
27078 </row>
27079 </tbody>
27080 </tgroup>
27081 </informaltable>
27082 <para>
27083 This option is available only when Exim is built with an embedded Perl
27084 interpreter. See chapter <xref linkend="CHAPperl"/> for details of its use.
27085 </para>
27086 <para>
27087 <indexterm role="option">
27088 <primary><option>pgsql_servers</option></primary>
27089 </indexterm>
27090 </para>
27091 <informaltable frame="all">
27092 <tgroup cols="4" colsep="0" rowsep="0">
27093 <colspec colwidth="8*" align="left"/>
27094 <colspec colwidth="6*" align="center"/>
27095 <colspec colwidth="6*" align="center"/>
27096 <colspec colwidth="6*" align="right"/>
27097 <tbody>
27098 <row>
27099 <entry><option>pgsql_servers</option></entry>
27100 <entry>Use: <emphasis>main</emphasis></entry>
27101 <entry>Type: <emphasis>string list</emphasis></entry>
27102 <entry>Default: <emphasis>unset</emphasis></entry>
27103 </row>
27104 </tbody>
27105 </tgroup>
27106 </informaltable>
27107 <para>
27108 <indexterm role="concept">
27109 <primary>PostgreSQL lookup type</primary>
27110 <secondary>server list</secondary>
27111 </indexterm>
27112 This option provides a list of PostgreSQL servers and associated connection
27113 data, to be used in conjunction with <command>pgsql</command> lookups (see section
27114 <xref linkend="SECID72"/>). The option is available only if Exim has been built with
27115 PostgreSQL support.
27116 </para>
27117 <para>
27118 <indexterm role="option">
27119 <primary><option>pid_file_path</option></primary>
27120 </indexterm>
27121 </para>
27122 <informaltable frame="all">
27123 <tgroup cols="4" colsep="0" rowsep="0">
27124 <colspec colwidth="8*" align="left"/>
27125 <colspec colwidth="6*" align="center"/>
27126 <colspec colwidth="6*" align="center"/>
27127 <colspec colwidth="6*" align="right"/>
27128 <tbody>
27129 <row>
27130 <entry><option>pid_file_path</option></entry>
27131 <entry>Use: <emphasis>main</emphasis></entry>
27132 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
27133 <entry>Default: <emphasis>set at compile time</emphasis></entry>
27134 </row>
27135 </tbody>
27136 </tgroup>
27137 </informaltable>
27138 <para>
27139 <indexterm role="concept">
27140 <primary>daemon</primary>
27141 <secondary>pid file path</secondary>
27142 </indexterm>
27143 <indexterm role="concept">
27144 <primary>pid file, path for</primary>
27145 </indexterm>
27146 This option sets the name of the file to which the Exim daemon writes its
27147 process id. The string is expanded, so it can contain, for example, references
27148 to the host name:
27149 </para>
27150 <literallayout class="monospaced">
27151 pid_file_path = /var/log/$primary_hostname/exim.pid
27152 </literallayout>
27153 <para>
27154 If no path is set, the pid is written to the file <filename>exim-daemon.pid</filename> in Exim&#x2019;s
27155 spool directory.
27156 The value set by the option can be overridden by the <option>-oP</option> command line
27157 option. A pid file is not written if a <quote>non-standard</quote> daemon is run by means
27158 of the <option>-oX</option> option, unless a path is explicitly supplied by <option>-oP</option>.
27159 </para>
27160 <para>
27161 <indexterm role="option">
27162 <primary><option>pipelining_advertise_hosts</option></primary>
27163 </indexterm>
27164 </para>
27165 <informaltable frame="all">
27166 <tgroup cols="4" colsep="0" rowsep="0">
27167 <colspec colwidth="8*" align="left"/>
27168 <colspec colwidth="6*" align="center"/>
27169 <colspec colwidth="6*" align="center"/>
27170 <colspec colwidth="6*" align="right"/>
27171 <tbody>
27172 <row>
27173 <entry><option>pipelining_advertise_hosts</option></entry>
27174 <entry>Use: <emphasis>main</emphasis></entry>
27175 <entry>Type: <emphasis>host list</emphasis>&dagger;<emphasis></emphasis></entry>
27176 <entry>Default: <emphasis>*</emphasis></entry>
27177 </row>
27178 </tbody>
27179 </tgroup>
27180 </informaltable>
27181 <para>
27182 <indexterm role="concept">
27183 <primary>PIPELINING</primary>
27184 <secondary>suppressing advertising</secondary>
27185 </indexterm>
27186 This option can be used to suppress the advertisement of the SMTP
27187 PIPELINING extension to specific hosts. See also the <emphasis role="bold">no_pipelining</emphasis>
27188 control in section <xref linkend="SECTcontrols"/>. When PIPELINING is not advertised and
27189 <option>smtp_enforce_sync</option> is true, an Exim server enforces strict synchronization
27190 for each SMTP command and response. When PIPELINING is advertised, Exim assumes
27191 that clients will use it; <quote>out of order</quote> commands that are <quote>expected</quote> do
27192 not count as protocol errors (see <option>smtp_max_synprot_errors</option>).
27193 </para>
27194 <para>
27195 <indexterm role="option">
27196 <primary><option>prdr_enable</option></primary>
27197 </indexterm>
27198 </para>
27199 <informaltable frame="all">
27200 <tgroup cols="4" colsep="0" rowsep="0">
27201 <colspec colwidth="8*" align="left"/>
27202 <colspec colwidth="6*" align="center"/>
27203 <colspec colwidth="6*" align="center"/>
27204 <colspec colwidth="6*" align="right"/>
27205 <tbody>
27206 <row>
27207 <entry><option>prdr_enable</option></entry>
27208 <entry>Use: <emphasis>main</emphasis></entry>
27209 <entry>Type: <emphasis>boolean</emphasis></entry>
27210 <entry>Default: <emphasis>false</emphasis></entry>
27211 </row>
27212 </tbody>
27213 </tgroup>
27214 </informaltable>
27215 <para>
27216 <indexterm role="concept">
27217 <primary>PRDR</primary>
27218 <secondary>enabling on server</secondary>
27219 </indexterm>
27220 This option can be used to enable the Per-Recipient Data Response extension
27221 to SMTP, defined by Eric Hall.
27222 If the option is set, PRDR is advertised by Exim when operating as a server.
27223 If the client requests PRDR, and more than one recipient, for a message
27224 an additional ACL is called for each recipient after the message content
27225 is received.  See section <xref linkend="SECTPRDRACL"/>.
27226 </para>
27227 <para>
27228 <indexterm role="option">
27229 <primary><option>preserve_message_logs</option></primary>
27230 </indexterm>
27231 </para>
27232 <informaltable frame="all">
27233 <tgroup cols="4" colsep="0" rowsep="0">
27234 <colspec colwidth="8*" align="left"/>
27235 <colspec colwidth="6*" align="center"/>
27236 <colspec colwidth="6*" align="center"/>
27237 <colspec colwidth="6*" align="right"/>
27238 <tbody>
27239 <row>
27240 <entry><option>preserve_message_logs</option></entry>
27241 <entry>Use: <emphasis>main</emphasis></entry>
27242 <entry>Type: <emphasis>boolean</emphasis></entry>
27243 <entry>Default: <emphasis>false</emphasis></entry>
27244 </row>
27245 </tbody>
27246 </tgroup>
27247 </informaltable>
27248 <para>
27249 <indexterm role="concept">
27250 <primary>message logs</primary>
27251 <secondary>preserving</secondary>
27252 </indexterm>
27253 If this option is set, message log files are not deleted when messages are
27254 completed. Instead, they are moved to a sub-directory of the spool directory
27255 called <filename>msglog.OLD</filename>, where they remain available for statistical or debugging
27256 purposes. This is a dangerous option to set on systems with any appreciable
27257 volume of mail. Use with care!
27258 </para>
27259 <para>
27260 <indexterm role="option">
27261 <primary><option>primary_hostname</option></primary>
27262 </indexterm>
27263 </para>
27264 <informaltable frame="all">
27265 <tgroup cols="4" colsep="0" rowsep="0">
27266 <colspec colwidth="8*" align="left"/>
27267 <colspec colwidth="6*" align="center"/>
27268 <colspec colwidth="6*" align="center"/>
27269 <colspec colwidth="6*" align="right"/>
27270 <tbody>
27271 <row>
27272 <entry><option>primary_hostname</option></entry>
27273 <entry>Use: <emphasis>main</emphasis></entry>
27274 <entry>Type: <emphasis>string</emphasis></entry>
27275 <entry>Default: <emphasis>see below</emphasis></entry>
27276 </row>
27277 </tbody>
27278 </tgroup>
27279 </informaltable>
27280 <para>
27281 <indexterm role="concept">
27282 <primary>name</primary>
27283 <secondary>of local host</secondary>
27284 </indexterm>
27285 <indexterm role="concept">
27286 <primary>host</primary>
27287 <secondary>name of local</secondary>
27288 </indexterm>
27289 <indexterm role="concept">
27290 <primary>local host</primary>
27291 <secondary>name of</secondary>
27292 </indexterm>
27293 <indexterm role="variable">
27294 <primary><varname>$primary_hostname</varname></primary>
27295 </indexterm>
27296 This specifies the name of the current host. It is used in the default EHLO or
27297 HELO command for outgoing SMTP messages (changeable via the <option>helo_data</option>
27298 option in the <command>smtp</command> transport), and as the default for <option>qualify_domain</option>.
27299 The value is also used by default in some SMTP response messages from an Exim
27300 server. This can be changed dynamically by setting <option>smtp_active_hostname</option>.
27301 </para>
27302 <para>
27303 If <option>primary_hostname</option> is not set, Exim calls <function>uname()</function> to find the host
27304 name. If this fails, Exim panics and dies. If the name returned by <function>uname()</function>
27305 contains only one component, Exim passes it to <function>gethostbyname()</function> (or
27306 <function>getipnodebyname()</function> when available) in order to obtain the fully qualified
27307 version. The variable <varname>$primary_hostname</varname> contains the host name, whether set
27308 explicitly by this option, or defaulted.
27309 </para>
27310 <para>
27311 <indexterm role="option">
27312 <primary><option>print_topbitchars</option></primary>
27313 </indexterm>
27314 </para>
27315 <informaltable frame="all">
27316 <tgroup cols="4" colsep="0" rowsep="0">
27317 <colspec colwidth="8*" align="left"/>
27318 <colspec colwidth="6*" align="center"/>
27319 <colspec colwidth="6*" align="center"/>
27320 <colspec colwidth="6*" align="right"/>
27321 <tbody>
27322 <row>
27323 <entry><option>print_topbitchars</option></entry>
27324 <entry>Use: <emphasis>main</emphasis></entry>
27325 <entry>Type: <emphasis>boolean</emphasis></entry>
27326 <entry>Default: <emphasis>false</emphasis></entry>
27327 </row>
27328 </tbody>
27329 </tgroup>
27330 </informaltable>
27331 <para>
27332 <indexterm role="concept">
27333 <primary>printing characters</primary>
27334 </indexterm>
27335 <indexterm role="concept">
27336 <primary>8-bit characters</primary>
27337 </indexterm>
27338 By default, Exim considers only those characters whose codes lie in the range
27339 32&ndash;126 to be printing characters. In a number of circumstances (for example,
27340 when writing log entries) non-printing characters are converted into escape
27341 sequences, primarily to avoid messing up the layout. If <option>print_topbitchars</option>
27342 is set, code values of 128 and above are also considered to be printing
27343 characters.
27344 </para>
27345 <para>
27346 This option also affects the header syntax checks performed by the
27347 <command>autoreply</command> transport, and whether Exim uses RFC 2047 encoding of
27348 the user&#x2019;s full name when constructing From: and Sender: addresses (as
27349 described in section <xref linkend="SECTconstr"/>). Setting this option can cause
27350 Exim to generate eight bit message headers that do not conform to the
27351 standards.
27352 </para>
27353 <para>
27354 <indexterm role="option">
27355 <primary><option>process_log_path</option></primary>
27356 </indexterm>
27357 </para>
27358 <informaltable frame="all">
27359 <tgroup cols="4" colsep="0" rowsep="0">
27360 <colspec colwidth="8*" align="left"/>
27361 <colspec colwidth="6*" align="center"/>
27362 <colspec colwidth="6*" align="center"/>
27363 <colspec colwidth="6*" align="right"/>
27364 <tbody>
27365 <row>
27366 <entry><option>process_log_path</option></entry>
27367 <entry>Use: <emphasis>main</emphasis></entry>
27368 <entry>Type: <emphasis>string</emphasis></entry>
27369 <entry>Default: <emphasis>unset</emphasis></entry>
27370 </row>
27371 </tbody>
27372 </tgroup>
27373 </informaltable>
27374 <para>
27375 <indexterm role="concept">
27376 <primary>process log path</primary>
27377 </indexterm>
27378 <indexterm role="concept">
27379 <primary>log</primary>
27380 <secondary>process log</secondary>
27381 </indexterm>
27382 <indexterm role="concept">
27383 <primary><emphasis>exiwhat</emphasis></primary>
27384 </indexterm>
27385 This option sets the name of the file to which an Exim process writes its
27386 <quote>process log</quote> when sent a USR1 signal. This is used by the <emphasis>exiwhat</emphasis>
27387 utility script. If this option is unset, the file called <filename>exim-process.info</filename>
27388 in Exim&#x2019;s spool directory is used. The ability to specify the name explicitly
27389 can be useful in environments where two different Exims are running, using
27390 different spool directories.
27391 </para>
27392 <para>
27393 <indexterm role="option">
27394 <primary><option>prod_requires_admin</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>prod_requires_admin</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="option">
27415 <primary><option>-M</option></primary>
27416 </indexterm>
27417 <indexterm role="option">
27418 <primary><option>-R</option></primary>
27419 </indexterm>
27420 <indexterm role="option">
27421 <primary><option>-q</option></primary>
27422 </indexterm>
27423 The <option>-M</option>, <option>-R</option>, and <option>-q</option> command-line options require the caller to be an
27424 admin user unless <option>prod_requires_admin</option> is set false. See also
27425 <option>queue_list_requires_admin</option>.
27426 </para>
27427 <para>
27428 <indexterm role="option">
27429 <primary><option>qualify_domain</option></primary>
27430 </indexterm>
27431 </para>
27432 <informaltable frame="all">
27433 <tgroup cols="4" colsep="0" rowsep="0">
27434 <colspec colwidth="8*" align="left"/>
27435 <colspec colwidth="6*" align="center"/>
27436 <colspec colwidth="6*" align="center"/>
27437 <colspec colwidth="6*" align="right"/>
27438 <tbody>
27439 <row>
27440 <entry><option>qualify_domain</option></entry>
27441 <entry>Use: <emphasis>main</emphasis></entry>
27442 <entry>Type: <emphasis>string</emphasis></entry>
27443 <entry>Default: <emphasis>see below</emphasis></entry>
27444 </row>
27445 </tbody>
27446 </tgroup>
27447 </informaltable>
27448 <para>
27449 <indexterm role="concept">
27450 <primary>domain</primary>
27451 <secondary>for qualifying addresses</secondary>
27452 </indexterm>
27453 <indexterm role="concept">
27454 <primary>address</primary>
27455 <secondary>qualification</secondary>
27456 </indexterm>
27457 This option specifies the domain name that is added to any envelope sender
27458 addresses that do not have a domain qualification. It also applies to
27459 recipient addresses if <option>qualify_recipient</option> is not set. Unqualified addresses
27460 are accepted by default only for locally-generated messages. Qualification is
27461 also applied to addresses in header lines such as <emphasis>From:</emphasis> and <emphasis>To:</emphasis> for
27462 locally-generated messages, unless the <option>-bnq</option> command line option is used.
27463 </para>
27464 <para>
27465 Messages from external sources must always contain fully qualified addresses,
27466 unless the sending host matches <option>sender_unqualified_hosts</option> or
27467 <option>recipient_unqualified_hosts</option> (as appropriate), in which case incoming
27468 addresses are qualified with <option>qualify_domain</option> or <option>qualify_recipient</option> as
27469 necessary. Internally, Exim always works with fully qualified envelope
27470 addresses. If <option>qualify_domain</option> is not set, it defaults to the
27471 <option>primary_hostname</option> value.
27472 </para>
27473 <para>
27474 <indexterm role="option">
27475 <primary><option>qualify_recipient</option></primary>
27476 </indexterm>
27477 </para>
27478 <informaltable frame="all">
27479 <tgroup cols="4" colsep="0" rowsep="0">
27480 <colspec colwidth="8*" align="left"/>
27481 <colspec colwidth="6*" align="center"/>
27482 <colspec colwidth="6*" align="center"/>
27483 <colspec colwidth="6*" align="right"/>
27484 <tbody>
27485 <row>
27486 <entry><option>qualify_recipient</option></entry>
27487 <entry>Use: <emphasis>main</emphasis></entry>
27488 <entry>Type: <emphasis>string</emphasis></entry>
27489 <entry>Default: <emphasis>see below</emphasis></entry>
27490 </row>
27491 </tbody>
27492 </tgroup>
27493 </informaltable>
27494 <para>
27495 This option allows you to specify a different domain for qualifying recipient
27496 addresses to the one that is used for senders. See <option>qualify_domain</option> above.
27497 </para>
27498 <para>
27499 <indexterm role="option">
27500 <primary><option>queue_domains</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>queue_domains</option></entry>
27512 <entry>Use: <emphasis>main</emphasis></entry>
27513 <entry>Type: <emphasis>domain list</emphasis>&dagger;<emphasis></emphasis></entry>
27514 <entry>Default: <emphasis>unset</emphasis></entry>
27515 </row>
27516 </tbody>
27517 </tgroup>
27518 </informaltable>
27519 <para>
27520 <indexterm role="concept">
27521 <primary>domain</primary>
27522 <secondary>specifying non-immediate delivery</secondary>
27523 </indexterm>
27524 <indexterm role="concept">
27525 <primary>queueing incoming messages</primary>
27526 </indexterm>
27527 <indexterm role="concept">
27528 <primary>message</primary>
27529 <secondary>queueing certain domains</secondary>
27530 </indexterm>
27531 This option lists domains for which immediate delivery is not required.
27532 A delivery process is started whenever a message is received, but only those
27533 domains that do not match are processed. All other deliveries wait until the
27534 next queue run. See also <option>hold_domains</option> and <option>queue_smtp_domains</option>.
27535 </para>
27536 <para>
27537 <indexterm role="option">
27538 <primary><option>queue_list_requires_admin</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>queue_list_requires_admin</option></entry>
27550 <entry>Use: <emphasis>main</emphasis></entry>
27551 <entry>Type: <emphasis>boolean</emphasis></entry>
27552 <entry>Default: <emphasis>true</emphasis></entry>
27553 </row>
27554 </tbody>
27555 </tgroup>
27556 </informaltable>
27557 <para>
27558 <indexterm role="option">
27559 <primary><option>-bp</option></primary>
27560 </indexterm>
27561 The <option>-bp</option> command-line option, which lists the messages that are on the
27562 queue, requires the caller to be an admin user unless
27563 <option>queue_list_requires_admin</option> is set false. See also <option>prod_requires_admin</option>.
27564 </para>
27565 <para>
27566 <indexterm role="option">
27567 <primary><option>queue_only</option></primary>
27568 </indexterm>
27569 </para>
27570 <informaltable frame="all">
27571 <tgroup cols="4" colsep="0" rowsep="0">
27572 <colspec colwidth="8*" align="left"/>
27573 <colspec colwidth="6*" align="center"/>
27574 <colspec colwidth="6*" align="center"/>
27575 <colspec colwidth="6*" align="right"/>
27576 <tbody>
27577 <row>
27578 <entry><option>queue_only</option></entry>
27579 <entry>Use: <emphasis>main</emphasis></entry>
27580 <entry>Type: <emphasis>boolean</emphasis></entry>
27581 <entry>Default: <emphasis>false</emphasis></entry>
27582 </row>
27583 </tbody>
27584 </tgroup>
27585 </informaltable>
27586 <para>
27587 <indexterm role="concept">
27588 <primary>queueing incoming messages</primary>
27589 </indexterm>
27590 <indexterm role="concept">
27591 <primary>message</primary>
27592 <secondary>queueing unconditionally</secondary>
27593 </indexterm>
27594 If <option>queue_only</option> is set, a delivery process is not automatically started
27595 whenever a message is received. Instead, the message waits on the queue for the
27596 next queue run. Even if <option>queue_only</option> is false, incoming messages may not get
27597 delivered immediately when certain conditions (such as heavy load) occur.
27598 </para>
27599 <para>
27600 The <option>-odq</option> command line has the same effect as <option>queue_only</option>. The <option>-odb</option>
27601 and <option>-odi</option> command line options override <option>queue_only</option> unless
27602 <option>queue_only_override</option> is set false. See also <option>queue_only_file</option>,
27603 <option>queue_only_load</option>, and <option>smtp_accept_queue</option>.
27604 </para>
27605 <para>
27606 <indexterm role="option">
27607 <primary><option>queue_only_file</option></primary>
27608 </indexterm>
27609 </para>
27610 <informaltable frame="all">
27611 <tgroup cols="4" colsep="0" rowsep="0">
27612 <colspec colwidth="8*" align="left"/>
27613 <colspec colwidth="6*" align="center"/>
27614 <colspec colwidth="6*" align="center"/>
27615 <colspec colwidth="6*" align="right"/>
27616 <tbody>
27617 <row>
27618 <entry><option>queue_only_file</option></entry>
27619 <entry>Use: <emphasis>main</emphasis></entry>
27620 <entry>Type: <emphasis>string</emphasis></entry>
27621 <entry>Default: <emphasis>unset</emphasis></entry>
27622 </row>
27623 </tbody>
27624 </tgroup>
27625 </informaltable>
27626 <para>
27627 <indexterm role="concept">
27628 <primary>queueing incoming messages</primary>
27629 </indexterm>
27630 <indexterm role="concept">
27631 <primary>message</primary>
27632 <secondary>queueing by file existence</secondary>
27633 </indexterm>
27634 This option can be set to a colon-separated list of absolute path names, each
27635 one optionally preceded by <quote>smtp</quote>. When Exim is receiving a message,
27636 it tests for the existence of each listed path using a call to <function>stat()</function>. For
27637 each path that exists, the corresponding queueing option is set.
27638 For paths with no prefix, <option>queue_only</option> is set; for paths prefixed by
27639 <quote>smtp</quote>, <option>queue_smtp_domains</option> is set to match all domains. So, for example,
27640 </para>
27641 <literallayout class="monospaced">
27642 queue_only_file = smtp/some/file
27643 </literallayout>
27644 <para>
27645 causes Exim to behave as if <option>queue_smtp_domains</option> were set to <quote>*</quote> whenever
27646 <filename>/some/file</filename> exists.
27647 </para>
27648 <para>
27649 <indexterm role="option">
27650 <primary><option>queue_only_load</option></primary>
27651 </indexterm>
27652 </para>
27653 <informaltable frame="all">
27654 <tgroup cols="4" colsep="0" rowsep="0">
27655 <colspec colwidth="8*" align="left"/>
27656 <colspec colwidth="6*" align="center"/>
27657 <colspec colwidth="6*" align="center"/>
27658 <colspec colwidth="6*" align="right"/>
27659 <tbody>
27660 <row>
27661 <entry><option>queue_only_load</option></entry>
27662 <entry>Use: <emphasis>main</emphasis></entry>
27663 <entry>Type: <emphasis>fixed-point</emphasis></entry>
27664 <entry>Default: <emphasis>unset</emphasis></entry>
27665 </row>
27666 </tbody>
27667 </tgroup>
27668 </informaltable>
27669 <para>
27670 <indexterm role="concept">
27671 <primary>load average</primary>
27672 </indexterm>
27673 <indexterm role="concept">
27674 <primary>queueing incoming messages</primary>
27675 </indexterm>
27676 <indexterm role="concept">
27677 <primary>message</primary>
27678 <secondary>queueing by load</secondary>
27679 </indexterm>
27680 If the system load average is higher than this value, incoming messages from
27681 all sources are queued, and no automatic deliveries are started. If this
27682 happens during local or remote SMTP input, all subsequent messages received on
27683 the same SMTP connection are queued by default, whatever happens to the load in
27684 the meantime, but this can be changed by setting <option>queue_only_load_latch</option>
27685 false.
27686 </para>
27687 <para>
27688 Deliveries will subsequently be performed by queue runner processes. This
27689 option has no effect on ancient operating systems on which Exim cannot
27690 determine the load average. See also <option>deliver_queue_load_max</option> and
27691 <option>smtp_load_reserve</option>.
27692 </para>
27693 <para>
27694 <indexterm role="option">
27695 <primary><option>queue_only_load_latch</option></primary>
27696 </indexterm>
27697 </para>
27698 <informaltable frame="all">
27699 <tgroup cols="4" colsep="0" rowsep="0">
27700 <colspec colwidth="8*" align="left"/>
27701 <colspec colwidth="6*" align="center"/>
27702 <colspec colwidth="6*" align="center"/>
27703 <colspec colwidth="6*" align="right"/>
27704 <tbody>
27705 <row>
27706 <entry><option>queue_only_load_latch</option></entry>
27707 <entry>Use: <emphasis>main</emphasis></entry>
27708 <entry>Type: <emphasis>boolean</emphasis></entry>
27709 <entry>Default: <emphasis>true</emphasis></entry>
27710 </row>
27711 </tbody>
27712 </tgroup>
27713 </informaltable>
27714 <para>
27715 <indexterm role="concept">
27716 <primary>load average</primary>
27717 <secondary>re-evaluating per message</secondary>
27718 </indexterm>
27719 When this option is true (the default), once one message has been queued
27720 because the load average is higher than the value set by <option>queue_only_load</option>,
27721 all subsequent messages received on the same SMTP connection are also queued.
27722 This is a deliberate choice; even though the load average may fall below the
27723 threshold, it doesn&#x2019;t seem right to deliver later messages on the same
27724 connection when not delivering earlier ones. However, there are special
27725 circumstances such as very long-lived connections from scanning appliances
27726 where this is not the best strategy. In such cases, <option>queue_only_load_latch</option>
27727 should be set false. This causes the value of the load average to be
27728 re-evaluated for each message.
27729 </para>
27730 <para>
27731 <indexterm role="option">
27732 <primary><option>queue_only_override</option></primary>
27733 </indexterm>
27734 </para>
27735 <informaltable frame="all">
27736 <tgroup cols="4" colsep="0" rowsep="0">
27737 <colspec colwidth="8*" align="left"/>
27738 <colspec colwidth="6*" align="center"/>
27739 <colspec colwidth="6*" align="center"/>
27740 <colspec colwidth="6*" align="right"/>
27741 <tbody>
27742 <row>
27743 <entry><option>queue_only_override</option></entry>
27744 <entry>Use: <emphasis>main</emphasis></entry>
27745 <entry>Type: <emphasis>boolean</emphasis></entry>
27746 <entry>Default: <emphasis>true</emphasis></entry>
27747 </row>
27748 </tbody>
27749 </tgroup>
27750 </informaltable>
27751 <para>
27752 <indexterm role="concept">
27753 <primary>queueing incoming messages</primary>
27754 </indexterm>
27755 When this option is true, the <option>-od</option><emphasis>x</emphasis> command line options override the
27756 setting of <option>queue_only</option> or <option>queue_only_file</option> in the configuration file. If
27757 <option>queue_only_override</option> is set false, the <option>-od</option><emphasis>x</emphasis> options cannot be used
27758 to override; they are accepted, but ignored.
27759 </para>
27760 <para>
27761 <indexterm role="option">
27762 <primary><option>queue_run_in_order</option></primary>
27763 </indexterm>
27764 </para>
27765 <informaltable frame="all">
27766 <tgroup cols="4" colsep="0" rowsep="0">
27767 <colspec colwidth="8*" align="left"/>
27768 <colspec colwidth="6*" align="center"/>
27769 <colspec colwidth="6*" align="center"/>
27770 <colspec colwidth="6*" align="right"/>
27771 <tbody>
27772 <row>
27773 <entry><option>queue_run_in_order</option></entry>
27774 <entry>Use: <emphasis>main</emphasis></entry>
27775 <entry>Type: <emphasis>boolean</emphasis></entry>
27776 <entry>Default: <emphasis>false</emphasis></entry>
27777 </row>
27778 </tbody>
27779 </tgroup>
27780 </informaltable>
27781 <para>
27782 <indexterm role="concept">
27783 <primary>queue runner</primary>
27784 <secondary>processing messages in order</secondary>
27785 </indexterm>
27786 If this option is set, queue runs happen in order of message arrival instead of
27787 in an arbitrary order. For this to happen, a complete list of the entire queue
27788 must be set up before the deliveries start. When the queue is all held in a
27789 single directory (the default), a single list is created for both the ordered
27790 and the non-ordered cases. However, if <option>split_spool_directory</option> is set, a
27791 single list is not created when <option>queue_run_in_order</option> is false. In this case,
27792 the sub-directories are processed one at a time (in a random order), and this
27793 avoids setting up one huge list for the whole queue. Thus, setting
27794 <option>queue_run_in_order</option> with <option>split_spool_directory</option> may degrade performance
27795 when the queue is large, because of the extra work in setting up the single,
27796 large list. In most situations, <option>queue_run_in_order</option> should not be set.
27797 </para>
27798 <para>
27799 <indexterm role="option">
27800 <primary><option>queue_run_max</option></primary>
27801 </indexterm>
27802 </para>
27803 <informaltable frame="all">
27804 <tgroup cols="4" colsep="0" rowsep="0">
27805 <colspec colwidth="8*" align="left"/>
27806 <colspec colwidth="6*" align="center"/>
27807 <colspec colwidth="6*" align="center"/>
27808 <colspec colwidth="6*" align="right"/>
27809 <tbody>
27810 <row>
27811 <entry><option>queue_run_max</option></entry>
27812 <entry>Use: <emphasis>main</emphasis></entry>
27813 <entry>Type: <emphasis>integer</emphasis></entry>
27814 <entry>Default: <emphasis>5</emphasis></entry>
27815 </row>
27816 </tbody>
27817 </tgroup>
27818 </informaltable>
27819 <para>
27820 <indexterm role="concept">
27821 <primary>queue runner</primary>
27822 <secondary>maximum number of</secondary>
27823 </indexterm>
27824 This controls the maximum number of queue runner processes that an Exim daemon
27825 can run simultaneously. This does not mean that it starts them all at once,
27826 but rather that if the maximum number are still running when the time comes to
27827 start another one, it refrains from starting another one. This can happen with
27828 very large queues and/or very sluggish deliveries. This option does not,
27829 however, interlock with other processes, so additional queue runners can be
27830 started by other means, or by killing and restarting the daemon.
27831 </para>
27832 <para>
27833 Setting this option to zero does not suppress queue runs; rather, it disables
27834 the limit, allowing any number of simultaneous queue runner processes to be
27835 run. If you do not want queue runs to occur, omit the <option>-q</option><emphasis>xx</emphasis> setting on
27836 the daemon&#x2019;s command line.
27837 </para>
27838 <para>
27839 <indexterm role="option">
27840 <primary><option>queue_smtp_domains</option></primary>
27841 </indexterm>
27842 </para>
27843 <informaltable frame="all">
27844 <tgroup cols="4" colsep="0" rowsep="0">
27845 <colspec colwidth="8*" align="left"/>
27846 <colspec colwidth="6*" align="center"/>
27847 <colspec colwidth="6*" align="center"/>
27848 <colspec colwidth="6*" align="right"/>
27849 <tbody>
27850 <row>
27851 <entry><option>queue_smtp_domains</option></entry>
27852 <entry>Use: <emphasis>main</emphasis></entry>
27853 <entry>Type: <emphasis>domain list</emphasis>&dagger;<emphasis></emphasis></entry>
27854 <entry>Default: <emphasis>unset</emphasis></entry>
27855 </row>
27856 </tbody>
27857 </tgroup>
27858 </informaltable>
27859 <para>
27860 <indexterm role="concept">
27861 <primary>queueing incoming messages</primary>
27862 </indexterm>
27863 <indexterm role="concept">
27864 <primary>message</primary>
27865 <secondary>queueing remote deliveries</secondary>
27866 </indexterm>
27867 When this option is set, a delivery process is started whenever a message is
27868 received, routing is performed, and local deliveries take place.
27869 However, if any SMTP deliveries are required for domains that match
27870 <option>queue_smtp_domains</option>, they are not immediately delivered, but instead the
27871 message waits on the queue for the next queue run. Since routing of the message
27872 has taken place, Exim knows to which remote hosts it must be delivered, and so
27873 when the queue run happens, multiple messages for the same host are delivered
27874 over a single SMTP connection. The <option>-odqs</option> command line option causes all
27875 SMTP deliveries to be queued in this way, and is equivalent to setting
27876 <option>queue_smtp_domains</option> to <quote>*</quote>. See also <option>hold_domains</option> and
27877 <option>queue_domains</option>.
27878 </para>
27879 <para>
27880 <indexterm role="option">
27881 <primary><option>receive_timeout</option></primary>
27882 </indexterm>
27883 </para>
27884 <informaltable frame="all">
27885 <tgroup cols="4" colsep="0" rowsep="0">
27886 <colspec colwidth="8*" align="left"/>
27887 <colspec colwidth="6*" align="center"/>
27888 <colspec colwidth="6*" align="center"/>
27889 <colspec colwidth="6*" align="right"/>
27890 <tbody>
27891 <row>
27892 <entry><option>receive_timeout</option></entry>
27893 <entry>Use: <emphasis>main</emphasis></entry>
27894 <entry>Type: <emphasis>time</emphasis></entry>
27895 <entry>Default: <emphasis>0s</emphasis></entry>
27896 </row>
27897 </tbody>
27898 </tgroup>
27899 </informaltable>
27900 <para>
27901 <indexterm role="concept">
27902 <primary>timeout</primary>
27903 <secondary>for non-SMTP input</secondary>
27904 </indexterm>
27905 This option sets the timeout for accepting a non-SMTP message, that is, the
27906 maximum time that Exim waits when reading a message on the standard input. If
27907 the value is zero, it will wait for ever. This setting is overridden by the
27908 <option>-or</option> command line option. The timeout for incoming SMTP messages is
27909 controlled by <option>smtp_receive_timeout</option>.
27910 </para>
27911 <para>
27912 <indexterm role="option">
27913 <primary><option>received_header_text</option></primary>
27914 </indexterm>
27915 </para>
27916 <informaltable frame="all">
27917 <tgroup cols="4" colsep="0" rowsep="0">
27918 <colspec colwidth="8*" align="left"/>
27919 <colspec colwidth="6*" align="center"/>
27920 <colspec colwidth="6*" align="center"/>
27921 <colspec colwidth="6*" align="right"/>
27922 <tbody>
27923 <row>
27924 <entry><option>received_header_text</option></entry>
27925 <entry>Use: <emphasis>main</emphasis></entry>
27926 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
27927 <entry>Default: <emphasis>see below</emphasis></entry>
27928 </row>
27929 </tbody>
27930 </tgroup>
27931 </informaltable>
27932 <para>
27933 <indexterm role="concept">
27934 <primary>customizing</primary>
27935 <secondary><emphasis>Received:</emphasis> header</secondary>
27936 </indexterm>
27937 <indexterm role="concept">
27938 <primary><emphasis>Received:</emphasis> header line</primary>
27939 <secondary>customizing</secondary>
27940 </indexterm>
27941 This string defines the contents of the <emphasis>Received:</emphasis> message header that is
27942 added to each message, except for the timestamp, which is automatically added
27943 on at the end (preceded by a semicolon). The string is expanded each time it is
27944 used. If the expansion yields an empty string, no <emphasis>Received:</emphasis> header line is
27945 added to the message. Otherwise, the string should start with the text
27946 <quote>Received:</quote> and conform to the RFC 2822 specification for <emphasis>Received:</emphasis>
27947 header lines. The default setting is:
27948 </para>
27949 <literallayout class="monospaced">
27950 received_header_text = Received: \
27951   ${if def:sender_rcvhost {from $sender_rcvhost\n\t}\
27952   {${if def:sender_ident \
27953   {from ${quote_local_part:$sender_ident} }}\
27954   ${if def:sender_helo_name {(helo=$sender_helo_name)\n\t}}}}\
27955   by $primary_hostname \
27956   ${if def:received_protocol {with $received_protocol}} \
27957   ${if def:tls_in_cipher {($tls_in_cipher)\n\t}}\
27958   (Exim $version_number)\n\t\
27959   ${if def:sender_address \
27960   {(envelope-from &lt;$sender_address&gt;)\n\t}}\
27961   id $message_exim_id\
27962   ${if def:received_for {\n\tfor $received_for}}
27963 </literallayout>
27964 <para>
27965 The reference to the TLS cipher is omitted when Exim is built without TLS
27966 support. The use of conditional expansions ensures that this works for both
27967 locally generated messages and messages received from remote hosts, giving
27968 header lines such as the following:
27969 </para>
27970 <literallayout class="monospaced">
27971 Received: from scrooge.carol.example ([192.168.12.25] ident=root)
27972 by marley.carol.example with esmtp (Exim 4.00)
27973 (envelope-from &lt;bob@carol.example&gt;)
27974 id 16IOWa-00019l-00
27975 for chas@dickens.example; Tue, 25 Dec 2001 14:43:44 +0000
27976 Received: by scrooge.carol.example with local (Exim 4.00)
27977 id 16IOWW-000083-00; Tue, 25 Dec 2001 14:43:41 +0000
27978 </literallayout>
27979 <para>
27980 Until the body of the message has been received, the timestamp is the time when
27981 the message started to be received. Once the body has arrived, and all policy
27982 checks have taken place, the timestamp is updated to the time at which the
27983 message was accepted.
27984 </para>
27985 <para>
27986 <indexterm role="option">
27987 <primary><option>received_headers_max</option></primary>
27988 </indexterm>
27989 </para>
27990 <informaltable frame="all">
27991 <tgroup cols="4" colsep="0" rowsep="0">
27992 <colspec colwidth="8*" align="left"/>
27993 <colspec colwidth="6*" align="center"/>
27994 <colspec colwidth="6*" align="center"/>
27995 <colspec colwidth="6*" align="right"/>
27996 <tbody>
27997 <row>
27998 <entry><option>received_headers_max</option></entry>
27999 <entry>Use: <emphasis>main</emphasis></entry>
28000 <entry>Type: <emphasis>integer</emphasis></entry>
28001 <entry>Default: <emphasis>30</emphasis></entry>
28002 </row>
28003 </tbody>
28004 </tgroup>
28005 </informaltable>
28006 <para>
28007 <indexterm role="concept">
28008 <primary>loop</primary>
28009 <secondary>prevention</secondary>
28010 </indexterm>
28011 <indexterm role="concept">
28012 <primary>mail loop prevention</primary>
28013 </indexterm>
28014 <indexterm role="concept">
28015 <primary><emphasis>Received:</emphasis> header line</primary>
28016 <secondary>counting</secondary>
28017 </indexterm>
28018 When a message is to be delivered, the number of <emphasis>Received:</emphasis> headers is
28019 counted, and if it is greater than this parameter, a mail loop is assumed to
28020 have occurred, the delivery is abandoned, and an error message is generated.
28021 This applies to both local and remote deliveries.
28022 </para>
28023 <para>
28024 <indexterm role="option">
28025 <primary><option>recipient_unqualified_hosts</option></primary>
28026 </indexterm>
28027 </para>
28028 <informaltable frame="all">
28029 <tgroup cols="4" colsep="0" rowsep="0">
28030 <colspec colwidth="8*" align="left"/>
28031 <colspec colwidth="6*" align="center"/>
28032 <colspec colwidth="6*" align="center"/>
28033 <colspec colwidth="6*" align="right"/>
28034 <tbody>
28035 <row>
28036 <entry><option>recipient_unqualified_hosts</option></entry>
28037 <entry>Use: <emphasis>main</emphasis></entry>
28038 <entry>Type: <emphasis>host list</emphasis>&dagger;<emphasis></emphasis></entry>
28039 <entry>Default: <emphasis>unset</emphasis></entry>
28040 </row>
28041 </tbody>
28042 </tgroup>
28043 </informaltable>
28044 <para>
28045 <indexterm role="concept">
28046 <primary>unqualified addresses</primary>
28047 </indexterm>
28048 <indexterm role="concept">
28049 <primary>host</primary>
28050 <secondary>unqualified addresses from</secondary>
28051 </indexterm>
28052 This option lists those hosts from which Exim is prepared to accept unqualified
28053 recipient addresses in message envelopes. The addresses are made fully
28054 qualified by the addition of the <option>qualify_recipient</option> value. This option also
28055 affects message header lines. Exim does not reject unqualified recipient
28056 addresses in headers, but it qualifies them only if the message came from a
28057 host that matches <option>recipient_unqualified_hosts</option>,
28058 or if the message was submitted locally (not using TCP/IP), and the <option>-bnq</option>
28059 option was not set.
28060 </para>
28061 <para>
28062 <indexterm role="option">
28063 <primary><option>recipients_max</option></primary>
28064 </indexterm>
28065 </para>
28066 <informaltable frame="all">
28067 <tgroup cols="4" colsep="0" rowsep="0">
28068 <colspec colwidth="8*" align="left"/>
28069 <colspec colwidth="6*" align="center"/>
28070 <colspec colwidth="6*" align="center"/>
28071 <colspec colwidth="6*" align="right"/>
28072 <tbody>
28073 <row>
28074 <entry><option>recipients_max</option></entry>
28075 <entry>Use: <emphasis>main</emphasis></entry>
28076 <entry>Type: <emphasis>integer</emphasis></entry>
28077 <entry>Default: <emphasis>0</emphasis></entry>
28078 </row>
28079 </tbody>
28080 </tgroup>
28081 </informaltable>
28082 <para>
28083 <indexterm role="concept">
28084 <primary>limit</primary>
28085 <secondary>number of recipients</secondary>
28086 </indexterm>
28087 <indexterm role="concept">
28088 <primary>recipient</primary>
28089 <secondary>maximum number</secondary>
28090 </indexterm>
28091 If this option is set greater than zero, it specifies the maximum number of
28092 original recipients for any message. Additional recipients that are generated
28093 by aliasing or forwarding do not count. SMTP messages get a 452 response for
28094 all recipients over the limit; earlier recipients are delivered as normal.
28095 Non-SMTP messages with too many recipients are failed, and no deliveries are
28096 done.
28097 </para>
28098 <para>
28099 <indexterm role="concept">
28100 <primary>RCPT</primary>
28101 <secondary>maximum number of incoming</secondary>
28102 </indexterm>
28103 <emphasis role="bold">Note</emphasis>: The RFCs specify that an SMTP server should accept at least 100
28104 RCPT commands in a single message.
28105 </para>
28106 <para>
28107 <indexterm role="option">
28108 <primary><option>recipients_max_reject</option></primary>
28109 </indexterm>
28110 </para>
28111 <informaltable frame="all">
28112 <tgroup cols="4" colsep="0" rowsep="0">
28113 <colspec colwidth="8*" align="left"/>
28114 <colspec colwidth="6*" align="center"/>
28115 <colspec colwidth="6*" align="center"/>
28116 <colspec colwidth="6*" align="right"/>
28117 <tbody>
28118 <row>
28119 <entry><option>recipients_max_reject</option></entry>
28120 <entry>Use: <emphasis>main</emphasis></entry>
28121 <entry>Type: <emphasis>boolean</emphasis></entry>
28122 <entry>Default: <emphasis>false</emphasis></entry>
28123 </row>
28124 </tbody>
28125 </tgroup>
28126 </informaltable>
28127 <para>
28128 If this option is set true, Exim rejects SMTP messages containing too many
28129 recipients by giving 552 errors to the surplus RCPT commands, and a 554
28130 error to the eventual DATA command. Otherwise (the default) it gives a 452
28131 error to the surplus RCPT commands and accepts the message on behalf of the
28132 initial set of recipients. The remote server should then re-send the message
28133 for the remaining recipients at a later time.
28134 </para>
28135 <para>
28136 <indexterm role="option">
28137 <primary><option>remote_max_parallel</option></primary>
28138 </indexterm>
28139 </para>
28140 <informaltable frame="all">
28141 <tgroup cols="4" colsep="0" rowsep="0">
28142 <colspec colwidth="8*" align="left"/>
28143 <colspec colwidth="6*" align="center"/>
28144 <colspec colwidth="6*" align="center"/>
28145 <colspec colwidth="6*" align="right"/>
28146 <tbody>
28147 <row>
28148 <entry><option>remote_max_parallel</option></entry>
28149 <entry>Use: <emphasis>main</emphasis></entry>
28150 <entry>Type: <emphasis>integer</emphasis></entry>
28151 <entry>Default: <emphasis>2</emphasis></entry>
28152 </row>
28153 </tbody>
28154 </tgroup>
28155 </informaltable>
28156 <para>
28157 <indexterm role="concept">
28158 <primary>delivery</primary>
28159 <secondary>parallelism for remote</secondary>
28160 </indexterm>
28161 This option controls parallel delivery of one message to a number of remote
28162 hosts. If the value is less than 2, parallel delivery is disabled, and Exim
28163 does all the remote deliveries for a message one by one. Otherwise, if a single
28164 message has to be delivered to more than one remote host, or if several copies
28165 have to be sent to the same remote host, up to <option>remote_max_parallel</option>
28166 deliveries are done simultaneously. If more than <option>remote_max_parallel</option>
28167 deliveries are required, the maximum number of processes are started, and as
28168 each one finishes, another is begun. The order of starting processes is the
28169 same as if sequential delivery were being done, and can be controlled by the
28170 <option>remote_sort_domains</option> option. If parallel delivery takes place while running
28171 with debugging turned on, the debugging output from each delivery process is
28172 tagged with its process id.
28173 </para>
28174 <para>
28175 This option controls only the maximum number of parallel deliveries for one
28176 message in one Exim delivery process. Because Exim has no central queue
28177 manager, there is no way of controlling the total number of simultaneous
28178 deliveries if the configuration allows a delivery attempt as soon as a message
28179 is received.
28180 </para>
28181 <para>
28182 <indexterm role="concept">
28183 <primary>number of deliveries</primary>
28184 </indexterm>
28185 <indexterm role="concept">
28186 <primary>delivery</primary>
28187 <secondary>maximum number of</secondary>
28188 </indexterm>
28189 If you want to control the total number of deliveries on the system, you
28190 need to set the <option>queue_only</option> option. This ensures that all incoming messages
28191 are added to the queue without starting a delivery process. Then set up an Exim
28192 daemon to start queue runner processes at appropriate intervals (probably
28193 fairly often, for example, every minute), and limit the total number of queue
28194 runners by setting the <option>queue_run_max</option> parameter. Because each queue runner
28195 delivers only one message at a time, the maximum number of deliveries that can
28196 then take place at once is <option>queue_run_max</option> multiplied by
28197 <option>remote_max_parallel</option>.
28198 </para>
28199 <para>
28200 If it is purely remote deliveries you want to control, use
28201 <option>queue_smtp_domains</option> instead of <option>queue_only</option>. This has the added benefit of
28202 doing the SMTP routing before queueing, so that several messages for the same
28203 host will eventually get delivered down the same connection.
28204 </para>
28205 <para>
28206 <indexterm role="option">
28207 <primary><option>remote_sort_domains</option></primary>
28208 </indexterm>
28209 </para>
28210 <informaltable frame="all">
28211 <tgroup cols="4" colsep="0" rowsep="0">
28212 <colspec colwidth="8*" align="left"/>
28213 <colspec colwidth="6*" align="center"/>
28214 <colspec colwidth="6*" align="center"/>
28215 <colspec colwidth="6*" align="right"/>
28216 <tbody>
28217 <row>
28218 <entry><option>remote_sort_domains</option></entry>
28219 <entry>Use: <emphasis>main</emphasis></entry>
28220 <entry>Type: <emphasis>domain list</emphasis>&dagger;<emphasis></emphasis></entry>
28221 <entry>Default: <emphasis>unset</emphasis></entry>
28222 </row>
28223 </tbody>
28224 </tgroup>
28225 </informaltable>
28226 <para>
28227 <indexterm role="concept">
28228 <primary>sorting remote deliveries</primary>
28229 </indexterm>
28230 <indexterm role="concept">
28231 <primary>delivery</primary>
28232 <secondary>sorting remote</secondary>
28233 </indexterm>
28234 When there are a number of remote deliveries for a message, they are sorted by
28235 domain into the order given by this list. For example,
28236 </para>
28237 <literallayout class="monospaced">
28238 remote_sort_domains = *.cam.ac.uk:*.uk
28239 </literallayout>
28240 <para>
28241 would attempt to deliver to all addresses in the <emphasis>cam.ac.uk</emphasis> domain first,
28242 then to those in the <option>uk</option> domain, then to any others.
28243 </para>
28244 <para>
28245 <indexterm role="option">
28246 <primary><option>retry_data_expire</option></primary>
28247 </indexterm>
28248 </para>
28249 <informaltable frame="all">
28250 <tgroup cols="4" colsep="0" rowsep="0">
28251 <colspec colwidth="8*" align="left"/>
28252 <colspec colwidth="6*" align="center"/>
28253 <colspec colwidth="6*" align="center"/>
28254 <colspec colwidth="6*" align="right"/>
28255 <tbody>
28256 <row>
28257 <entry><option>retry_data_expire</option></entry>
28258 <entry>Use: <emphasis>main</emphasis></entry>
28259 <entry>Type: <emphasis>time</emphasis></entry>
28260 <entry>Default: <emphasis>7d</emphasis></entry>
28261 </row>
28262 </tbody>
28263 </tgroup>
28264 </informaltable>
28265 <para>
28266 <indexterm role="concept">
28267 <primary>hints database</primary>
28268 <secondary>data expiry</secondary>
28269 </indexterm>
28270 This option sets a <quote>use before</quote> time on retry information in Exim&#x2019;s hints
28271 database. Any older retry data is ignored. This means that, for example, once a
28272 host has not been tried for 7 days, Exim behaves as if it has no knowledge of
28273 past failures.
28274 </para>
28275 <para>
28276 <indexterm role="option">
28277 <primary><option>retry_interval_max</option></primary>
28278 </indexterm>
28279 </para>
28280 <informaltable frame="all">
28281 <tgroup cols="4" colsep="0" rowsep="0">
28282 <colspec colwidth="8*" align="left"/>
28283 <colspec colwidth="6*" align="center"/>
28284 <colspec colwidth="6*" align="center"/>
28285 <colspec colwidth="6*" align="right"/>
28286 <tbody>
28287 <row>
28288 <entry><option>retry_interval_max</option></entry>
28289 <entry>Use: <emphasis>main</emphasis></entry>
28290 <entry>Type: <emphasis>time</emphasis></entry>
28291 <entry>Default: <emphasis>24h</emphasis></entry>
28292 </row>
28293 </tbody>
28294 </tgroup>
28295 </informaltable>
28296 <para>
28297 <indexterm role="concept">
28298 <primary>retry</primary>
28299 <secondary>limit on interval</secondary>
28300 </indexterm>
28301 <indexterm role="concept">
28302 <primary>limit</primary>
28303 <secondary>on retry interval</secondary>
28304 </indexterm>
28305 Chapter <xref linkend="CHAPretry"/> describes Exim&#x2019;s mechanisms for controlling the
28306 intervals between delivery attempts for messages that cannot be delivered
28307 straight away. This option sets an overall limit to the length of time between
28308 retries. It cannot be set greater than 24 hours; any attempt to do so forces
28309 the default value.
28310 </para>
28311 <para>
28312 <indexterm role="option">
28313 <primary><option>return_path_remove</option></primary>
28314 </indexterm>
28315 </para>
28316 <informaltable frame="all">
28317 <tgroup cols="4" colsep="0" rowsep="0">
28318 <colspec colwidth="8*" align="left"/>
28319 <colspec colwidth="6*" align="center"/>
28320 <colspec colwidth="6*" align="center"/>
28321 <colspec colwidth="6*" align="right"/>
28322 <tbody>
28323 <row>
28324 <entry><option>return_path_remove</option></entry>
28325 <entry>Use: <emphasis>main</emphasis></entry>
28326 <entry>Type: <emphasis>boolean</emphasis></entry>
28327 <entry>Default: <emphasis>true</emphasis></entry>
28328 </row>
28329 </tbody>
28330 </tgroup>
28331 </informaltable>
28332 <para>
28333 <indexterm role="concept">
28334 <primary><emphasis>Return-path:</emphasis> header line</primary>
28335 <secondary>removing</secondary>
28336 </indexterm>
28337 RFC 2821, section 4.4, states that an SMTP server must insert a
28338 <emphasis>Return-path:</emphasis> header line into a message when it makes a <quote>final delivery</quote>.
28339 The <emphasis>Return-path:</emphasis> header preserves the sender address as received in the
28340 MAIL command. This description implies that this header should not be present
28341 in an incoming message. If <option>return_path_remove</option> is true, any existing
28342 <emphasis>Return-path:</emphasis> headers are removed from messages at the time they are
28343 received. Exim&#x2019;s transports have options for adding <emphasis>Return-path:</emphasis> headers at
28344 the time of delivery. They are normally used only for final local deliveries.
28345 </para>
28346 <para>
28347 <indexterm role="option">
28348 <primary><option>return_size_limit</option></primary>
28349 </indexterm>
28350 </para>
28351 <informaltable frame="all">
28352 <tgroup cols="4" colsep="0" rowsep="0">
28353 <colspec colwidth="8*" align="left"/>
28354 <colspec colwidth="6*" align="center"/>
28355 <colspec colwidth="6*" align="center"/>
28356 <colspec colwidth="6*" align="right"/>
28357 <tbody>
28358 <row>
28359 <entry><option>return_size_limit</option></entry>
28360 <entry>Use: <emphasis>main</emphasis></entry>
28361 <entry>Type: <emphasis>integer</emphasis></entry>
28362 <entry>Default: <emphasis>100K</emphasis></entry>
28363 </row>
28364 </tbody>
28365 </tgroup>
28366 </informaltable>
28367 <para>
28368 This option is an obsolete synonym for <option>bounce_return_size_limit</option>.
28369 </para>
28370 <para revisionflag="changed">
28371 <indexterm role="option">
28372 <primary><option>rfc1413_hosts</option></primary>
28373 </indexterm>
28374 </para>
28375 <informaltable frame="all" revisionflag="changed">
28376 <tgroup cols="4" colsep="0" rowsep="0">
28377 <colspec colwidth="8*" align="left"/>
28378 <colspec colwidth="6*" align="center"/>
28379 <colspec colwidth="6*" align="center"/>
28380 <colspec colwidth="6*" align="right"/>
28381 <tbody>
28382 <row>
28383 <entry><option>rfc1413_hosts</option></entry>
28384 <entry>Use: <emphasis>main</emphasis></entry>
28385 <entry>Type: <emphasis>host list</emphasis>&dagger;<emphasis></emphasis></entry>
28386 <entry>Default: <emphasis>@[]</emphasis></entry>
28387 </row>
28388 </tbody>
28389 </tgroup>
28390 </informaltable>
28391 <para revisionflag="changed">
28392 <indexterm role="concept">
28393 <primary>RFC 1413</primary>
28394 </indexterm>
28395 <indexterm role="concept">
28396 <primary>host</primary>
28397 <secondary>for RFC 1413 calls</secondary>
28398 </indexterm>
28399 RFC 1413 identification calls are made to any client host which matches
28400 an item in the list.
28401 The default value specifies just this host, being any local interface
28402 for the system.
28403 </para>
28404 <para revisionflag="changed">
28405 <indexterm role="option">
28406 <primary><option>rfc1413_query_timeout</option></primary>
28407 </indexterm>
28408 </para>
28409 <informaltable frame="all" revisionflag="changed">
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>rfc1413_query_timeout</option></entry>
28418 <entry>Use: <emphasis>main</emphasis></entry>
28419 <entry>Type: <emphasis>time</emphasis></entry>
28420 <entry>Default: <emphasis>0s</emphasis></entry>
28421 </row>
28422 </tbody>
28423 </tgroup>
28424 </informaltable>
28425 <para>
28426 <indexterm role="concept">
28427 <primary>RFC 1413</primary>
28428 <secondary>query timeout</secondary>
28429 </indexterm>
28430 <indexterm role="concept">
28431 <primary>timeout</primary>
28432 <secondary>for RFC 1413 call</secondary>
28433 </indexterm>
28434 This sets the timeout on RFC 1413 identification calls. If it is set to zero,
28435 no RFC 1413 calls are ever made.
28436 </para>
28437 <para>
28438 <indexterm role="option">
28439 <primary><option>sender_unqualified_hosts</option></primary>
28440 </indexterm>
28441 </para>
28442 <informaltable frame="all">
28443 <tgroup cols="4" colsep="0" rowsep="0">
28444 <colspec colwidth="8*" align="left"/>
28445 <colspec colwidth="6*" align="center"/>
28446 <colspec colwidth="6*" align="center"/>
28447 <colspec colwidth="6*" align="right"/>
28448 <tbody>
28449 <row>
28450 <entry><option>sender_unqualified_hosts</option></entry>
28451 <entry>Use: <emphasis>main</emphasis></entry>
28452 <entry>Type: <emphasis>host list</emphasis>&dagger;<emphasis></emphasis></entry>
28453 <entry>Default: <emphasis>unset</emphasis></entry>
28454 </row>
28455 </tbody>
28456 </tgroup>
28457 </informaltable>
28458 <para>
28459 <indexterm role="concept">
28460 <primary>unqualified addresses</primary>
28461 </indexterm>
28462 <indexterm role="concept">
28463 <primary>host</primary>
28464 <secondary>unqualified addresses from</secondary>
28465 </indexterm>
28466 This option lists those hosts from which Exim is prepared to accept unqualified
28467 sender addresses. The addresses are made fully qualified by the addition of
28468 <option>qualify_domain</option>. This option also affects message header lines. Exim does
28469 not reject unqualified addresses in headers that contain sender addresses, but
28470 it qualifies them only if the message came from a host that matches
28471 <option>sender_unqualified_hosts</option>, or if the message was submitted locally (not
28472 using TCP/IP), and the <option>-bnq</option> option was not set.
28473 </para>
28474 <para revisionflag="changed">
28475 <indexterm role="option">
28476 <primary><option>slow_lookup_log</option></primary>
28477 </indexterm>
28478 </para>
28479 <informaltable frame="all" revisionflag="changed">
28480 <tgroup cols="4" colsep="0" rowsep="0">
28481 <colspec colwidth="8*" align="left"/>
28482 <colspec colwidth="6*" align="center"/>
28483 <colspec colwidth="6*" align="center"/>
28484 <colspec colwidth="6*" align="right"/>
28485 <tbody>
28486 <row>
28487 <entry><option>slow_lookup_log</option></entry>
28488 <entry>Use: <emphasis>main</emphasis></entry>
28489 <entry>Type: <emphasis>integer</emphasis></entry>
28490 <entry>Default: <emphasis>0</emphasis></entry>
28491 </row>
28492 </tbody>
28493 </tgroup>
28494 </informaltable>
28495 <para revisionflag="changed">
28496 <indexterm role="concept">
28497 <primary>logging</primary>
28498 <secondary>slow lookups</secondary>
28499 </indexterm>
28500 <indexterm role="concept">
28501 <primary>dns</primary>
28502 <secondary>logging slow lookups</secondary>
28503 </indexterm>
28504 This option controls logging of slow lookups.
28505 If the value is nonzero it is taken as a number of milliseconds
28506 and lookups taking longer than this are logged.
28507 Currently this applies only to DNS lookups.
28508 </para>
28509 <para>
28510 <indexterm role="option">
28511 <primary><option>smtp_accept_keepalive</option></primary>
28512 </indexterm>
28513 </para>
28514 <informaltable frame="all">
28515 <tgroup cols="4" colsep="0" rowsep="0">
28516 <colspec colwidth="8*" align="left"/>
28517 <colspec colwidth="6*" align="center"/>
28518 <colspec colwidth="6*" align="center"/>
28519 <colspec colwidth="6*" align="right"/>
28520 <tbody>
28521 <row>
28522 <entry><option>smtp_accept_keepalive</option></entry>
28523 <entry>Use: <emphasis>main</emphasis></entry>
28524 <entry>Type: <emphasis>boolean</emphasis></entry>
28525 <entry>Default: <emphasis>true</emphasis></entry>
28526 </row>
28527 </tbody>
28528 </tgroup>
28529 </informaltable>
28530 <para>
28531 <indexterm role="concept">
28532 <primary>keepalive</primary>
28533 <secondary>on incoming connection</secondary>
28534 </indexterm>
28535 This option controls the setting of the SO_KEEPALIVE option on incoming
28536 TCP/IP socket connections. When set, it causes the kernel to probe idle
28537 connections periodically, by sending packets with <quote>old</quote> sequence numbers. The
28538 other end of the connection should send an acknowledgment if the connection is
28539 still okay or a reset if the connection has been aborted. The reason for doing
28540 this is that it has the beneficial effect of freeing up certain types of
28541 connection that can get stuck when the remote host is disconnected without
28542 tidying up the TCP/IP call properly. The keepalive mechanism takes several
28543 hours to detect unreachable hosts.
28544 </para>
28545 <para>
28546 <indexterm role="option">
28547 <primary><option>smtp_accept_max</option></primary>
28548 </indexterm>
28549 </para>
28550 <informaltable frame="all">
28551 <tgroup cols="4" colsep="0" rowsep="0">
28552 <colspec colwidth="8*" align="left"/>
28553 <colspec colwidth="6*" align="center"/>
28554 <colspec colwidth="6*" align="center"/>
28555 <colspec colwidth="6*" align="right"/>
28556 <tbody>
28557 <row>
28558 <entry><option>smtp_accept_max</option></entry>
28559 <entry>Use: <emphasis>main</emphasis></entry>
28560 <entry>Type: <emphasis>integer</emphasis></entry>
28561 <entry>Default: <emphasis>20</emphasis></entry>
28562 </row>
28563 </tbody>
28564 </tgroup>
28565 </informaltable>
28566 <para>
28567 <indexterm role="concept">
28568 <primary>limit</primary>
28569 <secondary>incoming SMTP connections</secondary>
28570 </indexterm>
28571 <indexterm role="concept">
28572 <primary>SMTP</primary>
28573 <secondary>incoming connection count</secondary>
28574 </indexterm>
28575 <indexterm role="concept">
28576 <primary>inetd</primary>
28577 </indexterm>
28578 This option specifies the maximum number of simultaneous incoming SMTP calls
28579 that Exim will accept. It applies only to the listening daemon; there is no
28580 control (in Exim) when incoming SMTP is being handled by <emphasis>inetd</emphasis>. If the
28581 value is set to zero, no limit is applied. However, it is required to be
28582 non-zero if either <option>smtp_accept_max_per_host</option> or <option>smtp_accept_queue</option> is
28583 set. See also <option>smtp_accept_reserve</option> and <option>smtp_load_reserve</option>.
28584 </para>
28585 <para>
28586 A new SMTP connection is immediately rejected if the <option>smtp_accept_max</option> limit
28587 has been reached. If not, Exim first checks <option>smtp_accept_max_per_host</option>. If
28588 that limit has not been reached for the client host, <option>smtp_accept_reserve</option>
28589 and <option>smtp_load_reserve</option> are then checked before accepting the connection.
28590 </para>
28591 <para>
28592 <indexterm role="option">
28593 <primary><option>smtp_accept_max_nonmail</option></primary>
28594 </indexterm>
28595 </para>
28596 <informaltable frame="all">
28597 <tgroup cols="4" colsep="0" rowsep="0">
28598 <colspec colwidth="8*" align="left"/>
28599 <colspec colwidth="6*" align="center"/>
28600 <colspec colwidth="6*" align="center"/>
28601 <colspec colwidth="6*" align="right"/>
28602 <tbody>
28603 <row>
28604 <entry><option>smtp_accept_max_nonmail</option></entry>
28605 <entry>Use: <emphasis>main</emphasis></entry>
28606 <entry>Type: <emphasis>integer</emphasis></entry>
28607 <entry>Default: <emphasis>10</emphasis></entry>
28608 </row>
28609 </tbody>
28610 </tgroup>
28611 </informaltable>
28612 <para>
28613 <indexterm role="concept">
28614 <primary>limit</primary>
28615 <secondary>non-mail SMTP commands</secondary>
28616 </indexterm>
28617 <indexterm role="concept">
28618 <primary>SMTP</primary>
28619 <secondary>limiting non-mail commands</secondary>
28620 </indexterm>
28621 Exim counts the number of <quote>non-mail</quote> commands in an SMTP session, and drops
28622 the connection if there are too many. This option defines <quote>too many</quote>. The
28623 check catches some denial-of-service attacks, repeated failing AUTHs, or a mad
28624 client looping sending EHLO, for example. The check is applied only if the
28625 client host matches <option>smtp_accept_max_nonmail_hosts</option>.
28626 </para>
28627 <para>
28628 When a new message is expected, one occurrence of RSET is not counted. This
28629 allows a client to send one RSET between messages (this is not necessary,
28630 but some clients do it). Exim also allows one uncounted occurrence of HELO
28631 or EHLO, and one occurrence of STARTTLS between messages. After
28632 starting up a TLS session, another EHLO is expected, and so it too is not
28633 counted. The first occurrence of AUTH in a connection, or immediately
28634 following STARTTLS is not counted. Otherwise, all commands other than
28635 MAIL, RCPT, DATA, and QUIT are counted.
28636 </para>
28637 <para>
28638 <indexterm role="option">
28639 <primary><option>smtp_accept_max_nonmail_hosts</option></primary>
28640 </indexterm>
28641 </para>
28642 <informaltable frame="all">
28643 <tgroup cols="4" colsep="0" rowsep="0">
28644 <colspec colwidth="8*" align="left"/>
28645 <colspec colwidth="6*" align="center"/>
28646 <colspec colwidth="6*" align="center"/>
28647 <colspec colwidth="6*" align="right"/>
28648 <tbody>
28649 <row>
28650 <entry><option>smtp_accept_max_nonmail_hosts</option></entry>
28651 <entry>Use: <emphasis>main</emphasis></entry>
28652 <entry>Type: <emphasis>host list</emphasis>&dagger;<emphasis></emphasis></entry>
28653 <entry>Default: <emphasis>*</emphasis></entry>
28654 </row>
28655 </tbody>
28656 </tgroup>
28657 </informaltable>
28658 <para>
28659 You can control which hosts are subject to the <option>smtp_accept_max_nonmail</option>
28660 check by setting this option. The default value makes it apply to all hosts. By
28661 changing the value, you can exclude any badly-behaved hosts that you have to
28662 live with.
28663 </para>
28664 <para>
28665 <indexterm role="option">
28666 <primary><option>smtp_accept_max_per_connection</option></primary>
28667 </indexterm>
28668 </para>
28669 <informaltable frame="all">
28670 <tgroup cols="4" colsep="0" rowsep="0">
28671 <colspec colwidth="8*" align="left"/>
28672 <colspec colwidth="6*" align="center"/>
28673 <colspec colwidth="6*" align="center"/>
28674 <colspec colwidth="6*" align="right"/>
28675 <tbody>
28676 <row>
28677 <entry><option>smtp_accept_max_per_connection</option></entry>
28678 <entry>Use: <emphasis>main</emphasis></entry>
28679 <entry>Type: <emphasis>integer</emphasis></entry>
28680 <entry>Default: <emphasis>1000</emphasis></entry>
28681 </row>
28682 </tbody>
28683 </tgroup>
28684 </informaltable>
28685 <para>
28686 <indexterm role="concept">
28687 <primary>SMTP</primary>
28688 <secondary>limiting incoming message count</secondary>
28689 </indexterm>
28690 <indexterm role="concept">
28691 <primary>limit</primary>
28692 <secondary>messages per SMTP connection</secondary>
28693 </indexterm>
28694 The value of this option limits the number of MAIL commands that Exim is
28695 prepared to accept over a single SMTP connection, whether or not each command
28696 results in the transfer of a message. After the limit is reached, a 421
28697 response is given to subsequent MAIL commands. This limit is a safety
28698 precaution against a client that goes mad (incidents of this type have been
28699 seen).
28700 </para>
28701 <para>
28702 <indexterm role="option">
28703 <primary><option>smtp_accept_max_per_host</option></primary>
28704 </indexterm>
28705 </para>
28706 <informaltable frame="all">
28707 <tgroup cols="4" colsep="0" rowsep="0">
28708 <colspec colwidth="8*" align="left"/>
28709 <colspec colwidth="6*" align="center"/>
28710 <colspec colwidth="6*" align="center"/>
28711 <colspec colwidth="6*" align="right"/>
28712 <tbody>
28713 <row>
28714 <entry><option>smtp_accept_max_per_host</option></entry>
28715 <entry>Use: <emphasis>main</emphasis></entry>
28716 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
28717 <entry>Default: <emphasis>unset</emphasis></entry>
28718 </row>
28719 </tbody>
28720 </tgroup>
28721 </informaltable>
28722 <para>
28723 <indexterm role="concept">
28724 <primary>limit</primary>
28725 <secondary>SMTP connections from one host</secondary>
28726 </indexterm>
28727 <indexterm role="concept">
28728 <primary>host</primary>
28729 <secondary>limiting SMTP connections from</secondary>
28730 </indexterm>
28731 This option restricts the number of simultaneous IP connections from a single
28732 host (strictly, from a single IP address) to the Exim daemon. The option is
28733 expanded, to enable different limits to be applied to different hosts by
28734 reference to <varname>$sender_host_address</varname>. Once the limit is reached, additional
28735 connection attempts from the same host are rejected with error code 421. This
28736 is entirely independent of <option>smtp_accept_reserve</option>. The option&#x2019;s default value
28737 of zero imposes no limit. If this option is set greater than zero, it is
28738 required that <option>smtp_accept_max</option> be non-zero.
28739 </para>
28740 <para>
28741 <emphasis role="bold">Warning</emphasis>: When setting this option you should not use any expansion
28742 constructions that take an appreciable amount of time. The expansion and test
28743 happen in the main daemon loop, in order to reject additional connections
28744 without forking additional processes (otherwise a denial-of-service attack
28745 could cause a vast number or processes to be created). While the daemon is
28746 doing this processing, it cannot accept any other incoming connections.
28747 </para>
28748 <para>
28749 <indexterm role="option">
28750 <primary><option>smtp_accept_queue</option></primary>
28751 </indexterm>
28752 </para>
28753 <informaltable frame="all">
28754 <tgroup cols="4" colsep="0" rowsep="0">
28755 <colspec colwidth="8*" align="left"/>
28756 <colspec colwidth="6*" align="center"/>
28757 <colspec colwidth="6*" align="center"/>
28758 <colspec colwidth="6*" align="right"/>
28759 <tbody>
28760 <row>
28761 <entry><option>smtp_accept_queue</option></entry>
28762 <entry>Use: <emphasis>main</emphasis></entry>
28763 <entry>Type: <emphasis>integer</emphasis></entry>
28764 <entry>Default: <emphasis>0</emphasis></entry>
28765 </row>
28766 </tbody>
28767 </tgroup>
28768 </informaltable>
28769 <para>
28770 <indexterm role="concept">
28771 <primary>SMTP</primary>
28772 <secondary>incoming connection count</secondary>
28773 </indexterm>
28774 <indexterm role="concept">
28775 <primary>queueing incoming messages</primary>
28776 </indexterm>
28777 <indexterm role="concept">
28778 <primary>message</primary>
28779 <secondary>queueing by SMTP connection count</secondary>
28780 </indexterm>
28781 If the number of simultaneous incoming SMTP connections being handled via the
28782 listening daemon exceeds this value, messages received by SMTP are just placed
28783 on the queue; no delivery processes are started automatically. The count is
28784 fixed at the start of an SMTP connection. It cannot be updated in the
28785 subprocess that receives messages, and so the queueing or not queueing applies
28786 to all messages received in the same connection.
28787 </para>
28788 <para>
28789 A value of zero implies no limit, and clearly any non-zero value is useful only
28790 if it is less than the <option>smtp_accept_max</option> value (unless that is zero). See
28791 also <option>queue_only</option>, <option>queue_only_load</option>, <option>queue_smtp_domains</option>, and the
28792 various <option>-od</option><emphasis>x</emphasis> command line options.
28793 </para>
28794 <para>
28795 <indexterm role="option">
28796 <primary><option>smtp_accept_queue_per_connection</option></primary>
28797 </indexterm>
28798 </para>
28799 <informaltable frame="all">
28800 <tgroup cols="4" colsep="0" rowsep="0">
28801 <colspec colwidth="8*" align="left"/>
28802 <colspec colwidth="6*" align="center"/>
28803 <colspec colwidth="6*" align="center"/>
28804 <colspec colwidth="6*" align="right"/>
28805 <tbody>
28806 <row>
28807 <entry><option>smtp_accept_queue_per_connection</option></entry>
28808 <entry>Use: <emphasis>main</emphasis></entry>
28809 <entry>Type: <emphasis>integer</emphasis></entry>
28810 <entry>Default: <emphasis>10</emphasis></entry>
28811 </row>
28812 </tbody>
28813 </tgroup>
28814 </informaltable>
28815 <para>
28816 <indexterm role="concept">
28817 <primary>queueing incoming messages</primary>
28818 </indexterm>
28819 <indexterm role="concept">
28820 <primary>message</primary>
28821 <secondary>queueing by message count</secondary>
28822 </indexterm>
28823 This option limits the number of delivery processes that Exim starts
28824 automatically when receiving messages via SMTP, whether via the daemon or by
28825 the use of <option>-bs</option> or <option>-bS</option>. If the value of the option is greater than zero,
28826 and the number of messages received in a single SMTP session exceeds this
28827 number, subsequent messages are placed on the queue, but no delivery processes
28828 are started. This helps to limit the number of Exim processes when a server
28829 restarts after downtime and there is a lot of mail waiting for it on other
28830 systems. On large systems, the default should probably be increased, and on
28831 dial-in client systems it should probably be set to zero (that is, disabled).
28832 </para>
28833 <para>
28834 <indexterm role="option">
28835 <primary><option>smtp_accept_reserve</option></primary>
28836 </indexterm>
28837 </para>
28838 <informaltable frame="all">
28839 <tgroup cols="4" colsep="0" rowsep="0">
28840 <colspec colwidth="8*" align="left"/>
28841 <colspec colwidth="6*" align="center"/>
28842 <colspec colwidth="6*" align="center"/>
28843 <colspec colwidth="6*" align="right"/>
28844 <tbody>
28845 <row>
28846 <entry><option>smtp_accept_reserve</option></entry>
28847 <entry>Use: <emphasis>main</emphasis></entry>
28848 <entry>Type: <emphasis>integer</emphasis></entry>
28849 <entry>Default: <emphasis>0</emphasis></entry>
28850 </row>
28851 </tbody>
28852 </tgroup>
28853 </informaltable>
28854 <para>
28855 <indexterm role="concept">
28856 <primary>SMTP</primary>
28857 <secondary>incoming call count</secondary>
28858 </indexterm>
28859 <indexterm role="concept">
28860 <primary>host</primary>
28861 <secondary>reserved</secondary>
28862 </indexterm>
28863 When <option>smtp_accept_max</option> is set greater than zero, this option specifies a
28864 number of SMTP connections that are reserved for connections from the hosts
28865 that are specified in <option>smtp_reserve_hosts</option>. The value set in
28866 <option>smtp_accept_max</option> includes this reserve pool. The specified hosts are not
28867 restricted to this number of connections; the option specifies a minimum number
28868 of connection slots for them, not a maximum. It is a guarantee that this group
28869 of hosts can always get at least <option>smtp_accept_reserve</option> connections. However,
28870 the limit specified by <option>smtp_accept_max_per_host</option> is still applied to each
28871 individual host.
28872 </para>
28873 <para>
28874 For example, if <option>smtp_accept_max</option> is set to 50 and <option>smtp_accept_reserve</option> is
28875 set to 5, once there are 45 active connections (from any hosts), new
28876 connections are accepted only from hosts listed in <option>smtp_reserve_hosts</option>,
28877 provided the other criteria for acceptance are met.
28878 </para>
28879 <para>
28880 <indexterm role="option">
28881 <primary><option>smtp_active_hostname</option></primary>
28882 </indexterm>
28883 </para>
28884 <informaltable frame="all">
28885 <tgroup cols="4" colsep="0" rowsep="0">
28886 <colspec colwidth="8*" align="left"/>
28887 <colspec colwidth="6*" align="center"/>
28888 <colspec colwidth="6*" align="center"/>
28889 <colspec colwidth="6*" align="right"/>
28890 <tbody>
28891 <row>
28892 <entry><option>smtp_active_hostname</option></entry>
28893 <entry>Use: <emphasis>main</emphasis></entry>
28894 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
28895 <entry>Default: <emphasis>unset</emphasis></entry>
28896 </row>
28897 </tbody>
28898 </tgroup>
28899 </informaltable>
28900 <para>
28901 <indexterm role="concept">
28902 <primary>host</primary>
28903 <secondary>name in SMTP responses</secondary>
28904 </indexterm>
28905 <indexterm role="concept">
28906 <primary>SMTP</primary>
28907 <secondary>host name in responses</secondary>
28908 </indexterm>
28909 <indexterm role="variable">
28910 <primary><varname>$primary_hostname</varname></primary>
28911 </indexterm>
28912 This option is provided for multi-homed servers that want to masquerade as
28913 several different hosts. At the start of an incoming SMTP connection, its value
28914 is expanded and used instead of the value of <varname>$primary_hostname</varname> in SMTP
28915 responses. For example, it is used as domain name in the response to an
28916 incoming HELO or EHLO command.
28917 </para>
28918 <para>
28919 <indexterm role="variable">
28920 <primary><varname>$smtp_active_hostname</varname></primary>
28921 </indexterm>
28922 The active hostname is placed in the <varname>$smtp_active_hostname</varname> variable, which
28923 is saved with any messages that are received. It is therefore available for use
28924 in routers and transports when the message is later delivered.
28925 </para>
28926 <para>
28927 If this option is unset, or if its expansion is forced to fail, or if the
28928 expansion results in an empty string, the value of <varname>$primary_hostname</varname> is
28929 used. Other expansion failures cause a message to be written to the main and
28930 panic logs, and the SMTP command receives a temporary error. Typically, the
28931 value of <option>smtp_active_hostname</option> depends on the incoming interface address.
28932 For example:
28933 </para>
28934 <literallayout class="monospaced">
28935 smtp_active_hostname = ${if eq{$received_ip_address}{10.0.0.1}\
28936   {cox.mydomain}{box.mydomain}}
28937 </literallayout>
28938 <para>
28939 Although <varname>$smtp_active_hostname</varname> is primarily concerned with incoming
28940 messages, it is also used as the default for HELO commands in callout
28941 verification if there is no remote transport from which to obtain a
28942 <option>helo_data</option> value.
28943 </para>
28944 <para>
28945 <indexterm role="option">
28946 <primary><option>smtp_banner</option></primary>
28947 </indexterm>
28948 </para>
28949 <informaltable frame="all">
28950 <tgroup cols="4" colsep="0" rowsep="0">
28951 <colspec colwidth="8*" align="left"/>
28952 <colspec colwidth="6*" align="center"/>
28953 <colspec colwidth="6*" align="center"/>
28954 <colspec colwidth="6*" align="right"/>
28955 <tbody>
28956 <row>
28957 <entry><option>smtp_banner</option></entry>
28958 <entry>Use: <emphasis>main</emphasis></entry>
28959 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
28960 <entry>Default: <emphasis>see below</emphasis></entry>
28961 </row>
28962 </tbody>
28963 </tgroup>
28964 </informaltable>
28965 <para>
28966 <indexterm role="concept">
28967 <primary>SMTP</primary>
28968 <secondary>welcome banner</secondary>
28969 </indexterm>
28970 <indexterm role="concept">
28971 <primary>banner for SMTP</primary>
28972 </indexterm>
28973 <indexterm role="concept">
28974 <primary>welcome banner for SMTP</primary>
28975 </indexterm>
28976 <indexterm role="concept">
28977 <primary>customizing</primary>
28978 <secondary>SMTP banner</secondary>
28979 </indexterm>
28980 This string, which is expanded every time it is used, is output as the initial
28981 positive response to an SMTP connection. The default setting is:
28982 </para>
28983 <literallayout class="monospaced">
28984 smtp_banner = $smtp_active_hostname ESMTP Exim \
28985   $version_number $tod_full
28986 </literallayout>
28987 <para>
28988 Failure to expand the string causes a panic error. If you want to create a
28989 multiline response to the initial SMTP connection, use <quote>\n</quote> in the string at
28990 appropriate points, but not at the end. Note that the 220 code is not included
28991 in this string. Exim adds it automatically (several times in the case of a
28992 multiline response).
28993 </para>
28994 <para>
28995 <indexterm role="option">
28996 <primary><option>smtp_check_spool_space</option></primary>
28997 </indexterm>
28998 </para>
28999 <informaltable frame="all">
29000 <tgroup cols="4" colsep="0" rowsep="0">
29001 <colspec colwidth="8*" align="left"/>
29002 <colspec colwidth="6*" align="center"/>
29003 <colspec colwidth="6*" align="center"/>
29004 <colspec colwidth="6*" align="right"/>
29005 <tbody>
29006 <row>
29007 <entry><option>smtp_check_spool_space</option></entry>
29008 <entry>Use: <emphasis>main</emphasis></entry>
29009 <entry>Type: <emphasis>boolean</emphasis></entry>
29010 <entry>Default: <emphasis>true</emphasis></entry>
29011 </row>
29012 </tbody>
29013 </tgroup>
29014 </informaltable>
29015 <para>
29016 <indexterm role="concept">
29017 <primary>checking disk space</primary>
29018 </indexterm>
29019 <indexterm role="concept">
29020 <primary>disk space, checking</primary>
29021 </indexterm>
29022 <indexterm role="concept">
29023 <primary>spool directory</primary>
29024 <secondary>checking space</secondary>
29025 </indexterm>
29026 When this option is set, if an incoming SMTP session encounters the SIZE
29027 option on a MAIL command, it checks that there is enough space in the
29028 spool directory&#x2019;s partition to accept a message of that size, while still
29029 leaving free the amount specified by <option>check_spool_space</option> (even if that value
29030 is zero). If there isn&#x2019;t enough space, a temporary error code is returned.
29031 </para>
29032 <para>
29033 <indexterm role="option">
29034 <primary><option>smtp_connect_backlog</option></primary>
29035 </indexterm>
29036 </para>
29037 <informaltable frame="all">
29038 <tgroup cols="4" colsep="0" rowsep="0">
29039 <colspec colwidth="8*" align="left"/>
29040 <colspec colwidth="6*" align="center"/>
29041 <colspec colwidth="6*" align="center"/>
29042 <colspec colwidth="6*" align="right"/>
29043 <tbody>
29044 <row>
29045 <entry><option>smtp_connect_backlog</option></entry>
29046 <entry>Use: <emphasis>main</emphasis></entry>
29047 <entry>Type: <emphasis>integer</emphasis></entry>
29048 <entry>Default: <emphasis>20</emphasis></entry>
29049 </row>
29050 </tbody>
29051 </tgroup>
29052 </informaltable>
29053 <para>
29054 <indexterm role="concept">
29055 <primary>connection backlog</primary>
29056 </indexterm>
29057 <indexterm role="concept">
29058 <primary>SMTP</primary>
29059 <secondary>connection backlog</secondary>
29060 </indexterm>
29061 <indexterm role="concept">
29062 <primary>backlog of connections</primary>
29063 </indexterm>
29064 This option specifies a maximum number of waiting SMTP connections. Exim passes
29065 this value to the TCP/IP system when it sets up its listener. Once this number
29066 of connections are waiting for the daemon&#x2019;s attention, subsequent connection
29067 attempts are refused at the TCP/IP level. At least, that is what the manuals
29068 say; in some circumstances such connection attempts have been observed to time
29069 out instead. For large systems it is probably a good idea to increase the
29070 value (to 50, say). It also gives some protection against denial-of-service
29071 attacks by SYN flooding.
29072 </para>
29073 <para>
29074 <indexterm role="option">
29075 <primary><option>smtp_enforce_sync</option></primary>
29076 </indexterm>
29077 </para>
29078 <informaltable frame="all">
29079 <tgroup cols="4" colsep="0" rowsep="0">
29080 <colspec colwidth="8*" align="left"/>
29081 <colspec colwidth="6*" align="center"/>
29082 <colspec colwidth="6*" align="center"/>
29083 <colspec colwidth="6*" align="right"/>
29084 <tbody>
29085 <row>
29086 <entry><option>smtp_enforce_sync</option></entry>
29087 <entry>Use: <emphasis>main</emphasis></entry>
29088 <entry>Type: <emphasis>boolean</emphasis></entry>
29089 <entry>Default: <emphasis>true</emphasis></entry>
29090 </row>
29091 </tbody>
29092 </tgroup>
29093 </informaltable>
29094 <para>
29095 <indexterm role="concept">
29096 <primary>SMTP</primary>
29097 <secondary>synchronization checking</secondary>
29098 </indexterm>
29099 <indexterm role="concept">
29100 <primary>synchronization checking in SMTP</primary>
29101 </indexterm>
29102 The SMTP protocol specification requires the client to wait for a response from
29103 the server at certain points in the dialogue. Without PIPELINING these
29104 synchronization points are after every command; with PIPELINING they are
29105 fewer, but they still exist.
29106 </para>
29107 <para>
29108 Some spamming sites send out a complete set of SMTP commands without waiting
29109 for any response. Exim protects against this by rejecting a message if the
29110 client has sent further input when it should not have. The error response <quote>554
29111 SMTP synchronization error</quote> is sent, and the connection is dropped. Testing
29112 for this error cannot be perfect because of transmission delays (unexpected
29113 input may be on its way but not yet received when Exim checks). However, it
29114 does detect many instances.
29115 </para>
29116 <para>
29117 The check can be globally disabled by setting <option>smtp_enforce_sync</option> false.
29118 If you want to disable the check selectively (for example, only for certain
29119 hosts), you can do so by an appropriate use of a <option>control</option> modifier in an ACL
29120 (see section <xref linkend="SECTcontrols"/>). See also <option>pipelining_advertise_hosts</option>.
29121 </para>
29122 <para>
29123 <indexterm role="option">
29124 <primary><option>smtp_etrn_command</option></primary>
29125 </indexterm>
29126 </para>
29127 <informaltable frame="all">
29128 <tgroup cols="4" colsep="0" rowsep="0">
29129 <colspec colwidth="8*" align="left"/>
29130 <colspec colwidth="6*" align="center"/>
29131 <colspec colwidth="6*" align="center"/>
29132 <colspec colwidth="6*" align="right"/>
29133 <tbody>
29134 <row>
29135 <entry><option>smtp_etrn_command</option></entry>
29136 <entry>Use: <emphasis>main</emphasis></entry>
29137 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
29138 <entry>Default: <emphasis>unset</emphasis></entry>
29139 </row>
29140 </tbody>
29141 </tgroup>
29142 </informaltable>
29143 <para>
29144 <indexterm role="concept">
29145 <primary>ETRN</primary>
29146 <secondary>command to be run</secondary>
29147 </indexterm>
29148 <indexterm role="variable">
29149 <primary><varname>$domain</varname></primary>
29150 </indexterm>
29151 If this option is set, the given command is run whenever an SMTP ETRN
29152 command is received from a host that is permitted to issue such commands (see
29153 chapter <xref linkend="CHAPACL"/>). The string is split up into separate arguments which
29154 are independently expanded. The expansion variable <varname>$domain</varname> is set to the
29155 argument of the ETRN command, and no syntax checking is done on it. For
29156 example:
29157 </para>
29158 <literallayout class="monospaced">
29159 smtp_etrn_command = /etc/etrn_command $domain \
29160                     $sender_host_address
29161 </literallayout>
29162 <para>
29163 A new process is created to run the command, but Exim does not wait for it to
29164 complete. Consequently, its status cannot be checked. If the command cannot be
29165 run, a line is written to the panic log, but the ETRN caller still receives
29166 a 250 success response. Exim is normally running under its own uid when
29167 receiving SMTP, so it is not possible for it to change the uid before running
29168 the command.
29169 </para>
29170 <para>
29171 <indexterm role="option">
29172 <primary><option>smtp_etrn_serialize</option></primary>
29173 </indexterm>
29174 </para>
29175 <informaltable frame="all">
29176 <tgroup cols="4" colsep="0" rowsep="0">
29177 <colspec colwidth="8*" align="left"/>
29178 <colspec colwidth="6*" align="center"/>
29179 <colspec colwidth="6*" align="center"/>
29180 <colspec colwidth="6*" align="right"/>
29181 <tbody>
29182 <row>
29183 <entry><option>smtp_etrn_serialize</option></entry>
29184 <entry>Use: <emphasis>main</emphasis></entry>
29185 <entry>Type: <emphasis>boolean</emphasis></entry>
29186 <entry>Default: <emphasis>true</emphasis></entry>
29187 </row>
29188 </tbody>
29189 </tgroup>
29190 </informaltable>
29191 <para>
29192 <indexterm role="concept">
29193 <primary>ETRN</primary>
29194 <secondary>serializing</secondary>
29195 </indexterm>
29196 When this option is set, it prevents the simultaneous execution of more than
29197 one identical command as a result of ETRN in an SMTP connection. See
29198 section <xref linkend="SECTETRN"/> for details.
29199 </para>
29200 <para>
29201 <indexterm role="option">
29202 <primary><option>smtp_load_reserve</option></primary>
29203 </indexterm>
29204 </para>
29205 <informaltable frame="all">
29206 <tgroup cols="4" colsep="0" rowsep="0">
29207 <colspec colwidth="8*" align="left"/>
29208 <colspec colwidth="6*" align="center"/>
29209 <colspec colwidth="6*" align="center"/>
29210 <colspec colwidth="6*" align="right"/>
29211 <tbody>
29212 <row>
29213 <entry><option>smtp_load_reserve</option></entry>
29214 <entry>Use: <emphasis>main</emphasis></entry>
29215 <entry>Type: <emphasis>fixed-point</emphasis></entry>
29216 <entry>Default: <emphasis>unset</emphasis></entry>
29217 </row>
29218 </tbody>
29219 </tgroup>
29220 </informaltable>
29221 <para>
29222 <indexterm role="concept">
29223 <primary>load average</primary>
29224 </indexterm>
29225 If the system load average ever gets higher than this, incoming SMTP calls are
29226 accepted only from those hosts that match an entry in <option>smtp_reserve_hosts</option>.
29227 If <option>smtp_reserve_hosts</option> is not set, no incoming SMTP calls are accepted when
29228 the load is over the limit. The option has no effect on ancient operating
29229 systems on which Exim cannot determine the load average. See also
29230 <option>deliver_queue_load_max</option> and <option>queue_only_load</option>.
29231 </para>
29232 <para>
29233 <indexterm role="option">
29234 <primary><option>smtp_max_synprot_errors</option></primary>
29235 </indexterm>
29236 </para>
29237 <informaltable frame="all">
29238 <tgroup cols="4" colsep="0" rowsep="0">
29239 <colspec colwidth="8*" align="left"/>
29240 <colspec colwidth="6*" align="center"/>
29241 <colspec colwidth="6*" align="center"/>
29242 <colspec colwidth="6*" align="right"/>
29243 <tbody>
29244 <row>
29245 <entry><option>smtp_max_synprot_errors</option></entry>
29246 <entry>Use: <emphasis>main</emphasis></entry>
29247 <entry>Type: <emphasis>integer</emphasis></entry>
29248 <entry>Default: <emphasis>3</emphasis></entry>
29249 </row>
29250 </tbody>
29251 </tgroup>
29252 </informaltable>
29253 <para>
29254 <indexterm role="concept">
29255 <primary>SMTP</primary>
29256 <secondary>limiting syntax and protocol errors</secondary>
29257 </indexterm>
29258 <indexterm role="concept">
29259 <primary>limit</primary>
29260 <secondary>SMTP syntax and protocol errors</secondary>
29261 </indexterm>
29262 Exim rejects SMTP commands that contain syntax or protocol errors. In
29263 particular, a syntactically invalid email address, as in this command:
29264 </para>
29265 <literallayout class="monospaced">
29266 RCPT TO:&lt;abc xyz@a.b.c&gt;
29267 </literallayout>
29268 <para>
29269 causes immediate rejection of the command, before any other tests are done.
29270 (The ACL cannot be run if there is no valid address to set up for it.) An
29271 example of a protocol error is receiving RCPT before MAIL. If there are
29272 too many syntax or protocol errors in one SMTP session, the connection is
29273 dropped. The limit is set by this option.
29274 </para>
29275 <para>
29276 <indexterm role="concept">
29277 <primary>PIPELINING</primary>
29278 <secondary>expected errors</secondary>
29279 </indexterm>
29280 When the PIPELINING extension to SMTP is in use, some protocol errors are
29281 <quote>expected</quote>, for instance, a RCPT command after a rejected MAIL command.
29282 Exim assumes that PIPELINING will be used if it advertises it (see
29283 <option>pipelining_advertise_hosts</option>), and in this situation, <quote>expected</quote> errors do
29284 not count towards the limit.
29285 </para>
29286 <para>
29287 <indexterm role="option">
29288 <primary><option>smtp_max_unknown_commands</option></primary>
29289 </indexterm>
29290 </para>
29291 <informaltable frame="all">
29292 <tgroup cols="4" colsep="0" rowsep="0">
29293 <colspec colwidth="8*" align="left"/>
29294 <colspec colwidth="6*" align="center"/>
29295 <colspec colwidth="6*" align="center"/>
29296 <colspec colwidth="6*" align="right"/>
29297 <tbody>
29298 <row>
29299 <entry><option>smtp_max_unknown_commands</option></entry>
29300 <entry>Use: <emphasis>main</emphasis></entry>
29301 <entry>Type: <emphasis>integer</emphasis></entry>
29302 <entry>Default: <emphasis>3</emphasis></entry>
29303 </row>
29304 </tbody>
29305 </tgroup>
29306 </informaltable>
29307 <para>
29308 <indexterm role="concept">
29309 <primary>SMTP</primary>
29310 <secondary>limiting unknown commands</secondary>
29311 </indexterm>
29312 <indexterm role="concept">
29313 <primary>limit</primary>
29314 <secondary>unknown SMTP commands</secondary>
29315 </indexterm>
29316 If there are too many unrecognized commands in an incoming SMTP session, an
29317 Exim server drops the connection. This is a defence against some kinds of abuse
29318 that subvert web
29319 clients
29320 into making connections to SMTP ports; in these circumstances, a number of
29321 non-SMTP command lines are sent first.
29322 </para>
29323 <para>
29324 <indexterm role="option">
29325 <primary><option>smtp_ratelimit_hosts</option></primary>
29326 </indexterm>
29327 </para>
29328 <informaltable frame="all">
29329 <tgroup cols="4" colsep="0" rowsep="0">
29330 <colspec colwidth="8*" align="left"/>
29331 <colspec colwidth="6*" align="center"/>
29332 <colspec colwidth="6*" align="center"/>
29333 <colspec colwidth="6*" align="right"/>
29334 <tbody>
29335 <row>
29336 <entry><option>smtp_ratelimit_hosts</option></entry>
29337 <entry>Use: <emphasis>main</emphasis></entry>
29338 <entry>Type: <emphasis>host list</emphasis>&dagger;<emphasis></emphasis></entry>
29339 <entry>Default: <emphasis>unset</emphasis></entry>
29340 </row>
29341 </tbody>
29342 </tgroup>
29343 </informaltable>
29344 <para>
29345 <indexterm role="concept">
29346 <primary>SMTP</primary>
29347 <secondary>rate limiting</secondary>
29348 </indexterm>
29349 <indexterm role="concept">
29350 <primary>limit</primary>
29351 <secondary>rate of message arrival</secondary>
29352 </indexterm>
29353 <indexterm role="concept">
29354 <primary>RCPT</primary>
29355 <secondary>rate limiting</secondary>
29356 </indexterm>
29357 Some sites find it helpful to be able to limit the rate at which certain hosts
29358 can send them messages, and the rate at which an individual message can specify
29359 recipients.
29360 </para>
29361 <para>
29362 Exim has two rate-limiting facilities. This section describes the older
29363 facility, which can limit rates within a single connection. The newer
29364 <option>ratelimit</option> ACL condition can limit rates across all connections. See section
29365 <xref linkend="SECTratelimiting"/> for details of the newer facility.
29366 </para>
29367 <para>
29368 When a host matches <option>smtp_ratelimit_hosts</option>, the values of
29369 <option>smtp_ratelimit_mail</option> and <option>smtp_ratelimit_rcpt</option> are used to control the
29370 rate of acceptance of MAIL and RCPT commands in a single SMTP session,
29371 respectively. Each option, if set, must contain a set of four comma-separated
29372 values:
29373 </para>
29374 <itemizedlist>
29375 <listitem>
29376 <para>
29377 A threshold, before which there is no rate limiting.
29378 </para>
29379 </listitem>
29380 <listitem>
29381 <para>
29382 An initial time delay. Unlike other times in Exim, numbers with decimal
29383 fractional parts are allowed here.
29384 </para>
29385 </listitem>
29386 <listitem>
29387 <para>
29388 A factor by which to increase the delay each time.
29389 </para>
29390 </listitem>
29391 <listitem>
29392 <para>
29393 A maximum value for the delay. This should normally be less than 5 minutes,
29394 because after that time, the client is liable to timeout the SMTP command.
29395 </para>
29396 </listitem>
29397 </itemizedlist>
29398 <para>
29399 For example, these settings have been used successfully at the site which
29400 first suggested this feature, for controlling mail from their customers:
29401 </para>
29402 <literallayout class="monospaced">
29403 smtp_ratelimit_mail = 2,0.5s,1.05,4m
29404 smtp_ratelimit_rcpt = 4,0.25s,1.015,4m
29405 </literallayout>
29406 <para>
29407 The first setting specifies delays that are applied to MAIL commands after
29408 two have been received over a single connection. The initial delay is 0.5
29409 seconds, increasing by a factor of 1.05 each time. The second setting applies
29410 delays to RCPT commands when more than four occur in a single message.
29411 </para>
29412 <para>
29413 <indexterm role="option">
29414 <primary><option>smtp_ratelimit_mail</option></primary>
29415 </indexterm>
29416 </para>
29417 <informaltable frame="all">
29418 <tgroup cols="4" colsep="0" rowsep="0">
29419 <colspec colwidth="8*" align="left"/>
29420 <colspec colwidth="6*" align="center"/>
29421 <colspec colwidth="6*" align="center"/>
29422 <colspec colwidth="6*" align="right"/>
29423 <tbody>
29424 <row>
29425 <entry><option>smtp_ratelimit_mail</option></entry>
29426 <entry>Use: <emphasis>main</emphasis></entry>
29427 <entry>Type: <emphasis>string</emphasis></entry>
29428 <entry>Default: <emphasis>unset</emphasis></entry>
29429 </row>
29430 </tbody>
29431 </tgroup>
29432 </informaltable>
29433 <para>
29434 See <option>smtp_ratelimit_hosts</option> above.
29435 </para>
29436 <para>
29437 <indexterm role="option">
29438 <primary><option>smtp_ratelimit_rcpt</option></primary>
29439 </indexterm>
29440 </para>
29441 <informaltable frame="all">
29442 <tgroup cols="4" colsep="0" rowsep="0">
29443 <colspec colwidth="8*" align="left"/>
29444 <colspec colwidth="6*" align="center"/>
29445 <colspec colwidth="6*" align="center"/>
29446 <colspec colwidth="6*" align="right"/>
29447 <tbody>
29448 <row>
29449 <entry><option>smtp_ratelimit_rcpt</option></entry>
29450 <entry>Use: <emphasis>main</emphasis></entry>
29451 <entry>Type: <emphasis>string</emphasis></entry>
29452 <entry>Default: <emphasis>unset</emphasis></entry>
29453 </row>
29454 </tbody>
29455 </tgroup>
29456 </informaltable>
29457 <para>
29458 See <option>smtp_ratelimit_hosts</option> above.
29459 </para>
29460 <para>
29461 <indexterm role="option">
29462 <primary><option>smtp_receive_timeout</option></primary>
29463 </indexterm>
29464 </para>
29465 <informaltable frame="all">
29466 <tgroup cols="4" colsep="0" rowsep="0">
29467 <colspec colwidth="8*" align="left"/>
29468 <colspec colwidth="6*" align="center"/>
29469 <colspec colwidth="6*" align="center"/>
29470 <colspec colwidth="6*" align="right"/>
29471 <tbody>
29472 <row>
29473 <entry><option>smtp_receive_timeout</option></entry>
29474 <entry>Use: <emphasis>main</emphasis></entry>
29475 <entry>Type: <emphasis>time</emphasis>&dagger;<emphasis></emphasis></entry>
29476 <entry>Default: <emphasis>5m</emphasis></entry>
29477 </row>
29478 </tbody>
29479 </tgroup>
29480 </informaltable>
29481 <para>
29482 <indexterm role="concept">
29483 <primary>timeout</primary>
29484 <secondary>for SMTP input</secondary>
29485 </indexterm>
29486 <indexterm role="concept">
29487 <primary>SMTP</primary>
29488 <secondary>input timeout</secondary>
29489 </indexterm>
29490 This sets a timeout value for SMTP reception. It applies to all forms of SMTP
29491 input, including batch SMTP. If a line of input (either an SMTP command or a
29492 data line) is not received within this time, the SMTP connection is dropped and
29493 the message is abandoned.
29494 A line is written to the log containing one of the following messages:
29495 </para>
29496 <literallayout class="monospaced">
29497 SMTP command timeout on connection from...
29498 SMTP data timeout on connection from...
29499 </literallayout>
29500 <para>
29501 The former means that Exim was expecting to read an SMTP command; the latter
29502 means that it was in the DATA phase, reading the contents of a message.
29503 </para>
29504 <para revisionflag="changed">
29505 If the first character of the option is a <quote>$</quote> the option is
29506 expanded before use and may depend on
29507 <varname>$sender_host_name</varname>, <varname>$sender_host_address</varname> and <varname>$sender_host_port</varname>.
29508 </para>
29509 <para>
29510 <indexterm role="option">
29511 <primary><option>-os</option></primary>
29512 </indexterm>
29513 The value set by this option can be overridden by the
29514 <option>-os</option> command-line option. A setting of zero time disables the timeout, but
29515 this should never be used for SMTP over TCP/IP. (It can be useful in some cases
29516 of local input using <option>-bs</option> or <option>-bS</option>.) For non-SMTP input, the reception
29517 timeout is controlled by <option>receive_timeout</option> and <option>-or</option>.
29518 </para>
29519 <para>
29520 <indexterm role="option">
29521 <primary><option>smtp_reserve_hosts</option></primary>
29522 </indexterm>
29523 </para>
29524 <informaltable frame="all">
29525 <tgroup cols="4" colsep="0" rowsep="0">
29526 <colspec colwidth="8*" align="left"/>
29527 <colspec colwidth="6*" align="center"/>
29528 <colspec colwidth="6*" align="center"/>
29529 <colspec colwidth="6*" align="right"/>
29530 <tbody>
29531 <row>
29532 <entry><option>smtp_reserve_hosts</option></entry>
29533 <entry>Use: <emphasis>main</emphasis></entry>
29534 <entry>Type: <emphasis>host list</emphasis>&dagger;<emphasis></emphasis></entry>
29535 <entry>Default: <emphasis>unset</emphasis></entry>
29536 </row>
29537 </tbody>
29538 </tgroup>
29539 </informaltable>
29540 <para>
29541 This option defines hosts for which SMTP connections are reserved; see
29542 <option>smtp_accept_reserve</option> and <option>smtp_load_reserve</option> above.
29543 </para>
29544 <para>
29545 <indexterm role="option">
29546 <primary><option>smtp_return_error_details</option></primary>
29547 </indexterm>
29548 </para>
29549 <informaltable frame="all">
29550 <tgroup cols="4" colsep="0" rowsep="0">
29551 <colspec colwidth="8*" align="left"/>
29552 <colspec colwidth="6*" align="center"/>
29553 <colspec colwidth="6*" align="center"/>
29554 <colspec colwidth="6*" align="right"/>
29555 <tbody>
29556 <row>
29557 <entry><option>smtp_return_error_details</option></entry>
29558 <entry>Use: <emphasis>main</emphasis></entry>
29559 <entry>Type: <emphasis>boolean</emphasis></entry>
29560 <entry>Default: <emphasis>false</emphasis></entry>
29561 </row>
29562 </tbody>
29563 </tgroup>
29564 </informaltable>
29565 <para>
29566 <indexterm role="concept">
29567 <primary>SMTP</primary>
29568 <secondary>details policy failures</secondary>
29569 </indexterm>
29570 <indexterm role="concept">
29571 <primary>policy control</primary>
29572 <secondary>rejection, returning details</secondary>
29573 </indexterm>
29574 In the default state, Exim uses bland messages such as
29575 <quote>Administrative prohibition</quote> when it rejects SMTP commands for policy
29576 reasons. Many sysadmins like this because it gives away little information
29577 to spammers. However, some other sysadmins who are applying strict checking
29578 policies want to give out much fuller information about failures. Setting
29579 <option>smtp_return_error_details</option> true causes Exim to be more forthcoming. For
29580 example, instead of <quote>Administrative prohibition</quote>, it might give:
29581 </para>
29582 <literallayout class="monospaced">
29583 550-Rejected after DATA: '&gt;' missing at end of address:
29584 550 failing address in "From" header is: &lt;user@dom.ain
29585 </literallayout>
29586 <para>
29587 <indexterm role="option">
29588 <primary><option>spamd_address</option></primary>
29589 </indexterm>
29590 </para>
29591 <informaltable frame="all">
29592 <tgroup cols="4" colsep="0" rowsep="0">
29593 <colspec colwidth="8*" align="left"/>
29594 <colspec colwidth="6*" align="center"/>
29595 <colspec colwidth="6*" align="center"/>
29596 <colspec colwidth="6*" align="right"/>
29597 <tbody>
29598 <row>
29599 <entry><option>spamd_address</option></entry>
29600 <entry>Use: <emphasis>main</emphasis></entry>
29601 <entry>Type: <emphasis>string</emphasis></entry>
29602 <entry>Default: <emphasis>see below</emphasis></entry>
29603 </row>
29604 </tbody>
29605 </tgroup>
29606 </informaltable>
29607 <para>
29608 This option is available when Exim is compiled with the content-scanning
29609 extension. It specifies how Exim connects to SpamAssassin&#x2019;s <option>spamd</option> daemon.
29610 The default value is
29611 </para>
29612 <literallayout class="monospaced">
29613 127.0.0.1 783
29614 </literallayout>
29615 <para>
29616 See section <xref linkend="SECTscanspamass"/> for more details.
29617 </para>
29618 <para>
29619 <indexterm role="option">
29620 <primary><option>split_spool_directory</option></primary>
29621 </indexterm>
29622 </para>
29623 <informaltable frame="all">
29624 <tgroup cols="4" colsep="0" rowsep="0">
29625 <colspec colwidth="8*" align="left"/>
29626 <colspec colwidth="6*" align="center"/>
29627 <colspec colwidth="6*" align="center"/>
29628 <colspec colwidth="6*" align="right"/>
29629 <tbody>
29630 <row>
29631 <entry><option>split_spool_directory</option></entry>
29632 <entry>Use: <emphasis>main</emphasis></entry>
29633 <entry>Type: <emphasis>boolean</emphasis></entry>
29634 <entry>Default: <emphasis>false</emphasis></entry>
29635 </row>
29636 </tbody>
29637 </tgroup>
29638 </informaltable>
29639 <para>
29640 <indexterm role="concept">
29641 <primary>multiple spool directories</primary>
29642 </indexterm>
29643 <indexterm role="concept">
29644 <primary>spool directory</primary>
29645 <secondary>split</secondary>
29646 </indexterm>
29647 <indexterm role="concept">
29648 <primary>directories, multiple</primary>
29649 </indexterm>
29650 If this option is set, it causes Exim to split its input directory into 62
29651 subdirectories, each with a single alphanumeric character as its name. The
29652 sixth character of the message id is used to allocate messages to
29653 subdirectories; this is the least significant base-62 digit of the time of
29654 arrival of the message.
29655 </para>
29656 <para>
29657 Splitting up the spool in this way may provide better performance on systems
29658 where there are long mail queues, by reducing the number of files in any one
29659 directory. The msglog directory is also split up in a similar way to the input
29660 directory; however, if <option>preserve_message_logs</option> is set, all old msglog files
29661 are still placed in the single directory <filename>msglog.OLD</filename>.
29662 </para>
29663 <para>
29664 It is not necessary to take any special action for existing messages when
29665 changing <option>split_spool_directory</option>. Exim notices messages that are in the
29666 <quote>wrong</quote> place, and continues to process them. If the option is turned off
29667 after a period of being on, the subdirectories will eventually empty and be
29668 automatically deleted.
29669 </para>
29670 <para>
29671 When <option>split_spool_directory</option> is set, the behaviour of queue runner processes
29672 changes. Instead of creating a list of all messages in the queue, and then
29673 trying to deliver each one in turn, it constructs a list of those in one
29674 sub-directory and tries to deliver them, before moving on to the next
29675 sub-directory. The sub-directories are processed in a random order. This
29676 spreads out the scanning of the input directories, and uses less memory. It is
29677 particularly beneficial when there are lots of messages on the queue. However,
29678 if <option>queue_run_in_order</option> is set, none of this new processing happens. The
29679 entire queue has to be scanned and sorted before any deliveries can start.
29680 </para>
29681 <para>
29682 <indexterm role="option">
29683 <primary><option>spool_directory</option></primary>
29684 </indexterm>
29685 </para>
29686 <informaltable frame="all">
29687 <tgroup cols="4" colsep="0" rowsep="0">
29688 <colspec colwidth="8*" align="left"/>
29689 <colspec colwidth="6*" align="center"/>
29690 <colspec colwidth="6*" align="center"/>
29691 <colspec colwidth="6*" align="right"/>
29692 <tbody>
29693 <row>
29694 <entry><option>spool_directory</option></entry>
29695 <entry>Use: <emphasis>main</emphasis></entry>
29696 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
29697 <entry>Default: <emphasis>set at compile time</emphasis></entry>
29698 </row>
29699 </tbody>
29700 </tgroup>
29701 </informaltable>
29702 <para>
29703 <indexterm role="concept">
29704 <primary>spool directory</primary>
29705 <secondary>path to</secondary>
29706 </indexterm>
29707 This defines the directory in which Exim keeps its spool, that is, the messages
29708 it is waiting to deliver. The default value is taken from the compile-time
29709 configuration setting, if there is one. If not, this option must be set. The
29710 string is expanded, so it can contain, for example, a reference to
29711 <varname>$primary_hostname</varname>.
29712 </para>
29713 <para>
29714 If the spool directory name is fixed on your installation, it is recommended
29715 that you set it at build time rather than from this option, particularly if the
29716 log files are being written to the spool directory (see <option>log_file_path</option>).
29717 Otherwise log files cannot be used for errors that are detected early on, such
29718 as failures in the configuration file.
29719 </para>
29720 <para>
29721 By using this option to override the compiled-in path, it is possible to run
29722 tests of Exim without using the standard spool.
29723 </para>
29724 <para>
29725 <indexterm role="option">
29726 <primary><option>sqlite_lock_timeout</option></primary>
29727 </indexterm>
29728 </para>
29729 <informaltable frame="all">
29730 <tgroup cols="4" colsep="0" rowsep="0">
29731 <colspec colwidth="8*" align="left"/>
29732 <colspec colwidth="6*" align="center"/>
29733 <colspec colwidth="6*" align="center"/>
29734 <colspec colwidth="6*" align="right"/>
29735 <tbody>
29736 <row>
29737 <entry><option>sqlite_lock_timeout</option></entry>
29738 <entry>Use: <emphasis>main</emphasis></entry>
29739 <entry>Type: <emphasis>time</emphasis></entry>
29740 <entry>Default: <emphasis>5s</emphasis></entry>
29741 </row>
29742 </tbody>
29743 </tgroup>
29744 </informaltable>
29745 <para>
29746 <indexterm role="concept">
29747 <primary>sqlite lookup type</primary>
29748 <secondary>lock timeout</secondary>
29749 </indexterm>
29750 This option controls the timeout that the <command>sqlite</command> lookup uses when trying to
29751 access an SQLite database. See section <xref linkend="SECTsqlite"/> for more details.
29752 </para>
29753 <para>
29754 <indexterm role="option">
29755 <primary><option>strict_acl_vars</option></primary>
29756 </indexterm>
29757 </para>
29758 <informaltable frame="all">
29759 <tgroup cols="4" colsep="0" rowsep="0">
29760 <colspec colwidth="8*" align="left"/>
29761 <colspec colwidth="6*" align="center"/>
29762 <colspec colwidth="6*" align="center"/>
29763 <colspec colwidth="6*" align="right"/>
29764 <tbody>
29765 <row>
29766 <entry><option>strict_acl_vars</option></entry>
29767 <entry>Use: <emphasis>main</emphasis></entry>
29768 <entry>Type: <emphasis>boolean</emphasis></entry>
29769 <entry>Default: <emphasis>false</emphasis></entry>
29770 </row>
29771 </tbody>
29772 </tgroup>
29773 </informaltable>
29774 <para>
29775 <indexterm role="concept">
29776 <primary>access control lists (ACLs)</primary>
29777 <secondary>variables, handling unset</secondary>
29778 </indexterm>
29779 This option controls what happens if a syntactically valid but undefined ACL
29780 variable is referenced. If it is false (the default), an empty string
29781 is substituted; if it is true, an error is generated. See section
29782 <xref linkend="SECTaclvariables"/> for details of ACL variables.
29783 </para>
29784 <para>
29785 <indexterm role="option">
29786 <primary><option>strip_excess_angle_brackets</option></primary>
29787 </indexterm>
29788 </para>
29789 <informaltable frame="all">
29790 <tgroup cols="4" colsep="0" rowsep="0">
29791 <colspec colwidth="8*" align="left"/>
29792 <colspec colwidth="6*" align="center"/>
29793 <colspec colwidth="6*" align="center"/>
29794 <colspec colwidth="6*" align="right"/>
29795 <tbody>
29796 <row>
29797 <entry><option>strip_excess_angle_brackets</option></entry>
29798 <entry>Use: <emphasis>main</emphasis></entry>
29799 <entry>Type: <emphasis>boolean</emphasis></entry>
29800 <entry>Default: <emphasis>false</emphasis></entry>
29801 </row>
29802 </tbody>
29803 </tgroup>
29804 </informaltable>
29805 <para>
29806 <indexterm role="concept">
29807 <primary>angle brackets, excess</primary>
29808 </indexterm>
29809 If this option is set, redundant pairs of angle brackets round <quote>route-addr</quote>
29810 items in addresses are stripped. For example, <emphasis>&lt;&lt;xxx@a.b.c.d&gt;&gt;</emphasis> is
29811 treated as <emphasis>&lt;xxx@a.b.c.d&gt;</emphasis>. If this is in the envelope and the message is
29812 passed on to another MTA, the excess angle brackets are not passed on. If this
29813 option is not set, multiple pairs of angle brackets cause a syntax error.
29814 </para>
29815 <para>
29816 <indexterm role="option">
29817 <primary><option>strip_trailing_dot</option></primary>
29818 </indexterm>
29819 </para>
29820 <informaltable frame="all">
29821 <tgroup cols="4" colsep="0" rowsep="0">
29822 <colspec colwidth="8*" align="left"/>
29823 <colspec colwidth="6*" align="center"/>
29824 <colspec colwidth="6*" align="center"/>
29825 <colspec colwidth="6*" align="right"/>
29826 <tbody>
29827 <row>
29828 <entry><option>strip_trailing_dot</option></entry>
29829 <entry>Use: <emphasis>main</emphasis></entry>
29830 <entry>Type: <emphasis>boolean</emphasis></entry>
29831 <entry>Default: <emphasis>false</emphasis></entry>
29832 </row>
29833 </tbody>
29834 </tgroup>
29835 </informaltable>
29836 <para>
29837 <indexterm role="concept">
29838 <primary>trailing dot on domain</primary>
29839 </indexterm>
29840 <indexterm role="concept">
29841 <primary>dot</primary>
29842 <secondary>trailing on domain</secondary>
29843 </indexterm>
29844 If this option is set, a trailing dot at the end of a domain in an address is
29845 ignored. If this is in the envelope and the message is passed on to another
29846 MTA, the dot is not passed on. If this option is not set, a dot at the end of a
29847 domain causes a syntax error.
29848 However, addresses in header lines are checked only when an ACL requests header
29849 syntax checking.
29850 </para>
29851 <para>
29852 <indexterm role="option">
29853 <primary><option>syslog_duplication</option></primary>
29854 </indexterm>
29855 </para>
29856 <informaltable frame="all">
29857 <tgroup cols="4" colsep="0" rowsep="0">
29858 <colspec colwidth="8*" align="left"/>
29859 <colspec colwidth="6*" align="center"/>
29860 <colspec colwidth="6*" align="center"/>
29861 <colspec colwidth="6*" align="right"/>
29862 <tbody>
29863 <row>
29864 <entry><option>syslog_duplication</option></entry>
29865 <entry>Use: <emphasis>main</emphasis></entry>
29866 <entry>Type: <emphasis>boolean</emphasis></entry>
29867 <entry>Default: <emphasis>true</emphasis></entry>
29868 </row>
29869 </tbody>
29870 </tgroup>
29871 </informaltable>
29872 <para>
29873 <indexterm role="concept">
29874 <primary>syslog</primary>
29875 <secondary>duplicate log lines; suppressing</secondary>
29876 </indexterm>
29877 When Exim is logging to syslog, it writes the log lines for its three
29878 separate logs at different syslog priorities so that they can in principle
29879 be separated on the logging hosts. Some installations do not require this
29880 separation, and in those cases, the duplication of certain log lines is a
29881 nuisance. If <option>syslog_duplication</option> is set false, only one copy of any
29882 particular log line is written to syslog. For lines that normally go to
29883 both the main log and the reject log, the reject log version (possibly
29884 containing message header lines) is written, at LOG_NOTICE priority.
29885 Lines that normally go to both the main and the panic log are written at
29886 the LOG_ALERT priority.
29887 </para>
29888 <para>
29889 <indexterm role="option">
29890 <primary><option>syslog_facility</option></primary>
29891 </indexterm>
29892 </para>
29893 <informaltable frame="all">
29894 <tgroup cols="4" colsep="0" rowsep="0">
29895 <colspec colwidth="8*" align="left"/>
29896 <colspec colwidth="6*" align="center"/>
29897 <colspec colwidth="6*" align="center"/>
29898 <colspec colwidth="6*" align="right"/>
29899 <tbody>
29900 <row>
29901 <entry><option>syslog_facility</option></entry>
29902 <entry>Use: <emphasis>main</emphasis></entry>
29903 <entry>Type: <emphasis>string</emphasis></entry>
29904 <entry>Default: <emphasis>unset</emphasis></entry>
29905 </row>
29906 </tbody>
29907 </tgroup>
29908 </informaltable>
29909 <para>
29910 <indexterm role="concept">
29911 <primary>syslog</primary>
29912 <secondary>facility; setting</secondary>
29913 </indexterm>
29914 This option sets the syslog <quote>facility</quote> name, used when Exim is logging to
29915 syslog. The value must be one of the strings <quote>mail</quote>, <quote>user</quote>, <quote>news</quote>,
29916 <quote>uucp</quote>, <quote>daemon</quote>, or <quote>local<emphasis>x</emphasis></quote> where <emphasis>x</emphasis> is a digit between 0 and 7.
29917 If this option is unset, <quote>mail</quote> is used. See chapter <xref linkend="CHAPlog"/> for
29918 details of Exim&#x2019;s logging.
29919 </para>
29920 <para>
29921 <indexterm role="option">
29922 <primary><option>syslog_processname</option></primary>
29923 </indexterm>
29924 </para>
29925 <informaltable frame="all">
29926 <tgroup cols="4" colsep="0" rowsep="0">
29927 <colspec colwidth="8*" align="left"/>
29928 <colspec colwidth="6*" align="center"/>
29929 <colspec colwidth="6*" align="center"/>
29930 <colspec colwidth="6*" align="right"/>
29931 <tbody>
29932 <row>
29933 <entry><option>syslog_processname</option></entry>
29934 <entry>Use: <emphasis>main</emphasis></entry>
29935 <entry>Type: <emphasis>string</emphasis></entry>
29936 <entry>Default: <emphasis><literal>exim</literal></emphasis></entry>
29937 </row>
29938 </tbody>
29939 </tgroup>
29940 </informaltable>
29941 <para>
29942 <indexterm role="concept">
29943 <primary>syslog</primary>
29944 <secondary>process name; setting</secondary>
29945 </indexterm>
29946 This option sets the syslog <quote>ident</quote> name, used when Exim is logging to
29947 syslog. The value must be no longer than 32 characters. See chapter
29948 <xref linkend="CHAPlog"/> for details of Exim&#x2019;s logging.
29949 </para>
29950 <para>
29951 <indexterm role="option">
29952 <primary><option>syslog_timestamp</option></primary>
29953 </indexterm>
29954 </para>
29955 <informaltable frame="all">
29956 <tgroup cols="4" colsep="0" rowsep="0">
29957 <colspec colwidth="8*" align="left"/>
29958 <colspec colwidth="6*" align="center"/>
29959 <colspec colwidth="6*" align="center"/>
29960 <colspec colwidth="6*" align="right"/>
29961 <tbody>
29962 <row>
29963 <entry><option>syslog_timestamp</option></entry>
29964 <entry>Use: <emphasis>main</emphasis></entry>
29965 <entry>Type: <emphasis>boolean</emphasis></entry>
29966 <entry>Default: <emphasis>true</emphasis></entry>
29967 </row>
29968 </tbody>
29969 </tgroup>
29970 </informaltable>
29971 <para>
29972 <indexterm role="concept">
29973 <primary>syslog</primary>
29974 <secondary>timestamps</secondary>
29975 </indexterm>
29976 If <option>syslog_timestamp</option> is set false, the timestamps on Exim&#x2019;s log lines are
29977 omitted when these lines are sent to syslog. See chapter <xref linkend="CHAPlog"/> for
29978 details of Exim&#x2019;s logging.
29979 </para>
29980 <para>
29981 <indexterm role="option">
29982 <primary><option>system_filter</option></primary>
29983 </indexterm>
29984 </para>
29985 <informaltable frame="all">
29986 <tgroup cols="4" colsep="0" rowsep="0">
29987 <colspec colwidth="8*" align="left"/>
29988 <colspec colwidth="6*" align="center"/>
29989 <colspec colwidth="6*" align="center"/>
29990 <colspec colwidth="6*" align="right"/>
29991 <tbody>
29992 <row>
29993 <entry><option>system_filter</option></entry>
29994 <entry>Use: <emphasis>main</emphasis></entry>
29995 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
29996 <entry>Default: <emphasis>unset</emphasis></entry>
29997 </row>
29998 </tbody>
29999 </tgroup>
30000 </informaltable>
30001 <para>
30002 <indexterm role="concept">
30003 <primary>filter</primary>
30004 <secondary>system filter</secondary>
30005 </indexterm>
30006 <indexterm role="concept">
30007 <primary>system filter</primary>
30008 <secondary>specifying</secondary>
30009 </indexterm>
30010 <indexterm role="concept">
30011 <primary>Sieve filter</primary>
30012 <secondary>not available for system filter</secondary>
30013 </indexterm>
30014 This option specifies an Exim filter file that is applied to all messages at
30015 the start of each delivery attempt, before any routing is done. System filters
30016 must be Exim filters; they cannot be Sieve filters. If the system filter
30017 generates any deliveries to files or pipes, or any new mail messages, the
30018 appropriate <option>system_filter_..._transport</option> option(s) must be set, to define
30019 which transports are to be used. Details of this facility are given in chapter
30020 <xref linkend="CHAPsystemfilter"/>.
30021 </para>
30022 <para>
30023 <indexterm role="option">
30024 <primary><option>system_filter_directory_transport</option></primary>
30025 </indexterm>
30026 </para>
30027 <informaltable frame="all">
30028 <tgroup cols="4" colsep="0" rowsep="0">
30029 <colspec colwidth="8*" align="left"/>
30030 <colspec colwidth="6*" align="center"/>
30031 <colspec colwidth="6*" align="center"/>
30032 <colspec colwidth="6*" align="right"/>
30033 <tbody>
30034 <row>
30035 <entry><option>system_filter_directory_transport</option></entry>
30036 <entry>Use: <emphasis>main</emphasis></entry>
30037 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
30038 <entry>Default: <emphasis>unset</emphasis></entry>
30039 </row>
30040 </tbody>
30041 </tgroup>
30042 </informaltable>
30043 <para>
30044 <indexterm role="variable">
30045 <primary><varname>$address_file</varname></primary>
30046 </indexterm>
30047 This sets the name of the transport driver that is to be used when the
30048 <option>save</option> command in a system message filter specifies a path ending in <quote>/</quote>,
30049 implying delivery of each message into a separate file in some directory.
30050 During the delivery, the variable <varname>$address_file</varname> contains the path name.
30051 </para>
30052 <para>
30053 <indexterm role="option">
30054 <primary><option>system_filter_file_transport</option></primary>
30055 </indexterm>
30056 </para>
30057 <informaltable frame="all">
30058 <tgroup cols="4" colsep="0" rowsep="0">
30059 <colspec colwidth="8*" align="left"/>
30060 <colspec colwidth="6*" align="center"/>
30061 <colspec colwidth="6*" align="center"/>
30062 <colspec colwidth="6*" align="right"/>
30063 <tbody>
30064 <row>
30065 <entry><option>system_filter_file_transport</option></entry>
30066 <entry>Use: <emphasis>main</emphasis></entry>
30067 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
30068 <entry>Default: <emphasis>unset</emphasis></entry>
30069 </row>
30070 </tbody>
30071 </tgroup>
30072 </informaltable>
30073 <para>
30074 <indexterm role="concept">
30075 <primary>file</primary>
30076 <secondary>transport for system filter</secondary>
30077 </indexterm>
30078 This sets the name of the transport driver that is to be used when the <option>save</option>
30079 command in a system message filter specifies a path not ending in <quote>/</quote>. During
30080 the delivery, the variable <varname>$address_file</varname> contains the path name.
30081 </para>
30082 <para>
30083 <indexterm role="option">
30084 <primary><option>system_filter_group</option></primary>
30085 </indexterm>
30086 </para>
30087 <informaltable frame="all">
30088 <tgroup cols="4" colsep="0" rowsep="0">
30089 <colspec colwidth="8*" align="left"/>
30090 <colspec colwidth="6*" align="center"/>
30091 <colspec colwidth="6*" align="center"/>
30092 <colspec colwidth="6*" align="right"/>
30093 <tbody>
30094 <row>
30095 <entry><option>system_filter_group</option></entry>
30096 <entry>Use: <emphasis>main</emphasis></entry>
30097 <entry>Type: <emphasis>string</emphasis></entry>
30098 <entry>Default: <emphasis>unset</emphasis></entry>
30099 </row>
30100 </tbody>
30101 </tgroup>
30102 </informaltable>
30103 <para>
30104 <indexterm role="concept">
30105 <primary>gid (group id)</primary>
30106 <secondary>system filter</secondary>
30107 </indexterm>
30108 This option is used only when <option>system_filter_user</option> is also set. It sets the
30109 gid under which the system filter is run, overriding any gid that is associated
30110 with the user. The value may be numerical or symbolic.
30111 </para>
30112 <para>
30113 <indexterm role="option">
30114 <primary><option>system_filter_pipe_transport</option></primary>
30115 </indexterm>
30116 </para>
30117 <informaltable frame="all">
30118 <tgroup cols="4" colsep="0" rowsep="0">
30119 <colspec colwidth="8*" align="left"/>
30120 <colspec colwidth="6*" align="center"/>
30121 <colspec colwidth="6*" align="center"/>
30122 <colspec colwidth="6*" align="right"/>
30123 <tbody>
30124 <row>
30125 <entry><option>system_filter_pipe_transport</option></entry>
30126 <entry>Use: <emphasis>main</emphasis></entry>
30127 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
30128 <entry>Default: <emphasis>unset</emphasis></entry>
30129 </row>
30130 </tbody>
30131 </tgroup>
30132 </informaltable>
30133 <para>
30134 <indexterm role="concept">
30135 <primary><command>pipe</command> transport</primary>
30136 <secondary>for system filter</secondary>
30137 </indexterm>
30138 <indexterm role="variable">
30139 <primary><varname>$address_pipe</varname></primary>
30140 </indexterm>
30141 This specifies the transport driver that is to be used when a <option>pipe</option> command
30142 is used in a system filter. During the delivery, the variable <varname>$address_pipe</varname>
30143 contains the pipe command.
30144 </para>
30145 <para>
30146 <indexterm role="option">
30147 <primary><option>system_filter_reply_transport</option></primary>
30148 </indexterm>
30149 </para>
30150 <informaltable frame="all">
30151 <tgroup cols="4" colsep="0" rowsep="0">
30152 <colspec colwidth="8*" align="left"/>
30153 <colspec colwidth="6*" align="center"/>
30154 <colspec colwidth="6*" align="center"/>
30155 <colspec colwidth="6*" align="right"/>
30156 <tbody>
30157 <row>
30158 <entry><option>system_filter_reply_transport</option></entry>
30159 <entry>Use: <emphasis>main</emphasis></entry>
30160 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
30161 <entry>Default: <emphasis>unset</emphasis></entry>
30162 </row>
30163 </tbody>
30164 </tgroup>
30165 </informaltable>
30166 <para>
30167 <indexterm role="concept">
30168 <primary><command>autoreply</command> transport</primary>
30169 <secondary>for system filter</secondary>
30170 </indexterm>
30171 This specifies the transport driver that is to be used when a <option>mail</option> command
30172 is used in a system filter.
30173 </para>
30174 <para>
30175 <indexterm role="option">
30176 <primary><option>system_filter_user</option></primary>
30177 </indexterm>
30178 </para>
30179 <informaltable frame="all">
30180 <tgroup cols="4" colsep="0" rowsep="0">
30181 <colspec colwidth="8*" align="left"/>
30182 <colspec colwidth="6*" align="center"/>
30183 <colspec colwidth="6*" align="center"/>
30184 <colspec colwidth="6*" align="right"/>
30185 <tbody>
30186 <row>
30187 <entry><option>system_filter_user</option></entry>
30188 <entry>Use: <emphasis>main</emphasis></entry>
30189 <entry>Type: <emphasis>string</emphasis></entry>
30190 <entry>Default: <emphasis>unset</emphasis></entry>
30191 </row>
30192 </tbody>
30193 </tgroup>
30194 </informaltable>
30195 <para>
30196 <indexterm role="concept">
30197 <primary>uid (user id)</primary>
30198 <secondary>system filter</secondary>
30199 </indexterm>
30200 If this option is set to root, the system filter is run in the main Exim
30201 delivery process, as root.  Otherwise, the system filter runs in a separate
30202 process, as the given user, defaulting to the Exim run-time user.
30203 Unless the string consists entirely of digits, it
30204 is looked up in the password data. Failure to find the named user causes a
30205 configuration error. The gid is either taken from the password data, or
30206 specified by <option>system_filter_group</option>. When the uid is specified numerically,
30207 <option>system_filter_group</option> is required to be set.
30208 </para>
30209 <para>
30210 If the system filter generates any pipe, file, or reply deliveries, the uid
30211 under which the filter is run is used when transporting them, unless a
30212 transport option overrides.
30213 </para>
30214 <para>
30215 <indexterm role="option">
30216 <primary><option>tcp_nodelay</option></primary>
30217 </indexterm>
30218 </para>
30219 <informaltable frame="all">
30220 <tgroup cols="4" colsep="0" rowsep="0">
30221 <colspec colwidth="8*" align="left"/>
30222 <colspec colwidth="6*" align="center"/>
30223 <colspec colwidth="6*" align="center"/>
30224 <colspec colwidth="6*" align="right"/>
30225 <tbody>
30226 <row>
30227 <entry><option>tcp_nodelay</option></entry>
30228 <entry>Use: <emphasis>main</emphasis></entry>
30229 <entry>Type: <emphasis>boolean</emphasis></entry>
30230 <entry>Default: <emphasis>true</emphasis></entry>
30231 </row>
30232 </tbody>
30233 </tgroup>
30234 </informaltable>
30235 <para>
30236 <indexterm role="concept">
30237 <primary>daemon</primary>
30238 <secondary>TCP_NODELAY on sockets</secondary>
30239 </indexterm>
30240 <indexterm role="concept">
30241 <primary>Nagle algorithm</primary>
30242 </indexterm>
30243 <indexterm role="concept">
30244 <primary>TCP_NODELAY on listening sockets</primary>
30245 </indexterm>
30246 If this option is set false, it stops the Exim daemon setting the
30247 TCP_NODELAY option on its listening sockets. Setting TCP_NODELAY
30248 turns off the <quote>Nagle algorithm</quote>, which is a way of improving network
30249 performance in interactive (character-by-character) situations. Turning it off
30250 should improve Exim&#x2019;s performance a bit, so that is what happens by default.
30251 However, it appears that some broken clients cannot cope, and time out. Hence
30252 this option. It affects only those sockets that are set up for listening by the
30253 daemon. Sockets created by the smtp transport for delivering mail always set
30254 TCP_NODELAY.
30255 </para>
30256 <para>
30257 <indexterm role="option">
30258 <primary><option>timeout_frozen_after</option></primary>
30259 </indexterm>
30260 </para>
30261 <informaltable frame="all">
30262 <tgroup cols="4" colsep="0" rowsep="0">
30263 <colspec colwidth="8*" align="left"/>
30264 <colspec colwidth="6*" align="center"/>
30265 <colspec colwidth="6*" align="center"/>
30266 <colspec colwidth="6*" align="right"/>
30267 <tbody>
30268 <row>
30269 <entry><option>timeout_frozen_after</option></entry>
30270 <entry>Use: <emphasis>main</emphasis></entry>
30271 <entry>Type: <emphasis>time</emphasis></entry>
30272 <entry>Default: <emphasis>0s</emphasis></entry>
30273 </row>
30274 </tbody>
30275 </tgroup>
30276 </informaltable>
30277 <para>
30278 <indexterm role="concept">
30279 <primary>frozen messages</primary>
30280 <secondary>timing out</secondary>
30281 </indexterm>
30282 <indexterm role="concept">
30283 <primary>timeout</primary>
30284 <secondary>frozen messages</secondary>
30285 </indexterm>
30286 If <option>timeout_frozen_after</option> is set to a time greater than zero, a frozen
30287 message of any kind that has been on the queue for longer than the given time
30288 is automatically cancelled at the next queue run. If the frozen message is a
30289 bounce message, it is just discarded; otherwise, a bounce is sent to the
30290 sender, in a similar manner to cancellation by the <option>-Mg</option> command line option.
30291 If you want to timeout frozen bounce messages earlier than other kinds of
30292 frozen message, see <option>ignore_bounce_errors_after</option>.
30293 </para>
30294 <para>
30295 <emphasis role="bold">Note:</emphasis> the default value of zero means no timeouts; with this setting,
30296 frozen messages remain on the queue forever (except for any frozen bounce
30297 messages that are released by <option>ignore_bounce_errors_after</option>).
30298 </para>
30299 <para>
30300 <indexterm role="option">
30301 <primary><option>timezone</option></primary>
30302 </indexterm>
30303 </para>
30304 <informaltable frame="all">
30305 <tgroup cols="4" colsep="0" rowsep="0">
30306 <colspec colwidth="8*" align="left"/>
30307 <colspec colwidth="6*" align="center"/>
30308 <colspec colwidth="6*" align="center"/>
30309 <colspec colwidth="6*" align="right"/>
30310 <tbody>
30311 <row>
30312 <entry><option>timezone</option></entry>
30313 <entry>Use: <emphasis>main</emphasis></entry>
30314 <entry>Type: <emphasis>string</emphasis></entry>
30315 <entry>Default: <emphasis>unset</emphasis></entry>
30316 </row>
30317 </tbody>
30318 </tgroup>
30319 </informaltable>
30320 <para>
30321 <indexterm role="concept">
30322 <primary>timezone, setting</primary>
30323 </indexterm>
30324 The value of <option>timezone</option> is used to set the environment variable TZ while
30325 running Exim (if it is different on entry). This ensures that all timestamps
30326 created by Exim are in the required timezone. If you want all your timestamps
30327 to be in UTC (aka GMT) you should set
30328 </para>
30329 <literallayout class="monospaced">
30330 timezone = UTC
30331 </literallayout>
30332 <para>
30333 The default value is taken from TIMEZONE_DEFAULT in <filename>Local/Makefile</filename>,
30334 or, if that is not set, from the value of the TZ environment variable when Exim
30335 is built. If <option>timezone</option> is set to the empty string, either at build or run
30336 time, any existing TZ variable is removed from the environment when Exim
30337 runs. This is appropriate behaviour for obtaining wall-clock time on some, but
30338 unfortunately not all, operating systems.
30339 </para>
30340 <para>
30341 <indexterm role="option">
30342 <primary><option>tls_advertise_hosts</option></primary>
30343 </indexterm>
30344 </para>
30345 <informaltable frame="all">
30346 <tgroup cols="4" colsep="0" rowsep="0">
30347 <colspec colwidth="8*" align="left"/>
30348 <colspec colwidth="6*" align="center"/>
30349 <colspec colwidth="6*" align="center"/>
30350 <colspec colwidth="6*" align="right"/>
30351 <tbody>
30352 <row>
30353 <entry><option>tls_advertise_hosts</option></entry>
30354 <entry>Use: <emphasis>main</emphasis></entry>
30355 <entry>Type: <emphasis>host list</emphasis>&dagger;<emphasis></emphasis></entry>
30356 <entry>Default: <emphasis>unset</emphasis></entry>
30357 </row>
30358 </tbody>
30359 </tgroup>
30360 </informaltable>
30361 <para>
30362 <indexterm role="concept">
30363 <primary>TLS</primary>
30364 <secondary>advertising</secondary>
30365 </indexterm>
30366 <indexterm role="concept">
30367 <primary>encryption</primary>
30368 <secondary>on SMTP connection</secondary>
30369 </indexterm>
30370 <indexterm role="concept">
30371 <primary>SMTP</primary>
30372 <secondary>encrypted connection</secondary>
30373 </indexterm>
30374 When Exim is built with support for TLS encrypted connections, the availability
30375 of the STARTTLS command to set up an encrypted session is advertised in
30376 response to EHLO only to those client hosts that match this option. See
30377 chapter <xref linkend="CHAPTLS"/> for details of Exim&#x2019;s support for TLS.
30378 </para>
30379 <para>
30380 <indexterm role="option">
30381 <primary><option>tls_certificate</option></primary>
30382 </indexterm>
30383 </para>
30384 <informaltable frame="all">
30385 <tgroup cols="4" colsep="0" rowsep="0">
30386 <colspec colwidth="8*" align="left"/>
30387 <colspec colwidth="6*" align="center"/>
30388 <colspec colwidth="6*" align="center"/>
30389 <colspec colwidth="6*" align="right"/>
30390 <tbody>
30391 <row>
30392 <entry><option>tls_certificate</option></entry>
30393 <entry>Use: <emphasis>main</emphasis></entry>
30394 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
30395 <entry>Default: <emphasis>unset</emphasis></entry>
30396 </row>
30397 </tbody>
30398 </tgroup>
30399 </informaltable>
30400 <para>
30401 <indexterm role="concept">
30402 <primary>TLS</primary>
30403 <secondary>server certificate; location of</secondary>
30404 </indexterm>
30405 <indexterm role="concept">
30406 <primary>certificate</primary>
30407 <secondary>server, location of</secondary>
30408 </indexterm>
30409 The value of this option is expanded, and must then be the absolute path to a
30410 file which contains the server&#x2019;s certificates. The server&#x2019;s private key is also
30411 assumed to be in this file if <option>tls_privatekey</option> is unset. See chapter
30412 <xref linkend="CHAPTLS"/> for further details.
30413 </para>
30414 <para>
30415 <emphasis role="bold">Note</emphasis>: The certificates defined by this option are used only when Exim is
30416 receiving incoming messages as a server. If you want to supply certificates for
30417 use when sending messages as a client, you must set the <option>tls_certificate</option>
30418 option in the relevant <command>smtp</command> transport.
30419 </para>
30420 <para>
30421 If the option contains <varname>$tls_out_sni</varname> and Exim is built against OpenSSL, then
30422 if the OpenSSL build supports TLS extensions and the TLS client sends the
30423 Server Name Indication extension, then this option and others documented in
30424 <xref linkend="SECTtlssni"/> will be re-expanded.
30425 </para>
30426 <para>
30427 <indexterm role="option">
30428 <primary><option>tls_crl</option></primary>
30429 </indexterm>
30430 </para>
30431 <informaltable frame="all">
30432 <tgroup cols="4" colsep="0" rowsep="0">
30433 <colspec colwidth="8*" align="left"/>
30434 <colspec colwidth="6*" align="center"/>
30435 <colspec colwidth="6*" align="center"/>
30436 <colspec colwidth="6*" align="right"/>
30437 <tbody>
30438 <row>
30439 <entry><option>tls_crl</option></entry>
30440 <entry>Use: <emphasis>main</emphasis></entry>
30441 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
30442 <entry>Default: <emphasis>unset</emphasis></entry>
30443 </row>
30444 </tbody>
30445 </tgroup>
30446 </informaltable>
30447 <para>
30448 <indexterm role="concept">
30449 <primary>TLS</primary>
30450 <secondary>server certificate revocation list</secondary>
30451 </indexterm>
30452 <indexterm role="concept">
30453 <primary>certificate</primary>
30454 <secondary>revocation list for server</secondary>
30455 </indexterm>
30456 This option specifies a certificate revocation list. The expanded value must
30457 be the name of a file that contains a CRL in PEM format.
30458 </para>
30459 <para>
30460 See <xref linkend="SECTtlssni"/> for discussion of when this option might be re-expanded.
30461 </para>
30462 <para>
30463 <indexterm role="option">
30464 <primary><option>tls_dh_max_bits</option></primary>
30465 </indexterm>
30466 </para>
30467 <informaltable frame="all">
30468 <tgroup cols="4" colsep="0" rowsep="0">
30469 <colspec colwidth="8*" align="left"/>
30470 <colspec colwidth="6*" align="center"/>
30471 <colspec colwidth="6*" align="center"/>
30472 <colspec colwidth="6*" align="right"/>
30473 <tbody>
30474 <row>
30475 <entry><option>tls_dh_max_bits</option></entry>
30476 <entry>Use: <emphasis>main</emphasis></entry>
30477 <entry>Type: <emphasis>integer</emphasis></entry>
30478 <entry>Default: <emphasis>2236</emphasis></entry>
30479 </row>
30480 </tbody>
30481 </tgroup>
30482 </informaltable>
30483 <para>
30484 <indexterm role="concept">
30485 <primary>TLS</primary>
30486 <secondary>D-H bit count</secondary>
30487 </indexterm>
30488 The number of bits used for Diffie-Hellman key-exchange may be suggested by
30489 the chosen TLS library.  That value might prove to be too high for
30490 interoperability.  This option provides a maximum clamp on the value
30491 suggested, trading off security for interoperability.
30492 </para>
30493 <para>
30494 The value must be at least 1024.
30495 </para>
30496 <para>
30497 The value 2236 was chosen because, at time of adding the option, it was the
30498 hard-coded maximum value supported by the NSS cryptographic library, as used
30499 by Thunderbird, while GnuTLS was suggesting 2432 bits as normal.
30500 </para>
30501 <para>
30502 If you prefer more security and are willing to break some clients, raise this
30503 number.
30504 </para>
30505 <para>
30506 Note that the value passed to GnuTLS for *generating* a new prime may be a
30507 little less than this figure, because GnuTLS is inexact and may produce a
30508 larger prime than requested.
30509 </para>
30510 <para>
30511 <indexterm role="option">
30512 <primary><option>tls_dhparam</option></primary>
30513 </indexterm>
30514 </para>
30515 <informaltable frame="all">
30516 <tgroup cols="4" colsep="0" rowsep="0">
30517 <colspec colwidth="8*" align="left"/>
30518 <colspec colwidth="6*" align="center"/>
30519 <colspec colwidth="6*" align="center"/>
30520 <colspec colwidth="6*" align="right"/>
30521 <tbody>
30522 <row>
30523 <entry><option>tls_dhparam</option></entry>
30524 <entry>Use: <emphasis>main</emphasis></entry>
30525 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
30526 <entry>Default: <emphasis>unset</emphasis></entry>
30527 </row>
30528 </tbody>
30529 </tgroup>
30530 </informaltable>
30531 <para>
30532 <indexterm role="concept">
30533 <primary>TLS</primary>
30534 <secondary>D-H parameters for server</secondary>
30535 </indexterm>
30536 The value of this option is expanded and indicates the source of DH parameters
30537 to be used by Exim.
30538 </para>
30539 <para>
30540 If it is a filename starting with a <literal>/</literal>, then it names a file from which DH
30541 parameters should be loaded.  If the file exists, it should hold a PEM-encoded
30542 PKCS#3 representation of the DH prime.  If the file does not exist, for
30543 OpenSSL it is an error.  For GnuTLS, Exim will attempt to create the file and
30544 fill it with a generated DH prime.  For OpenSSL, if the DH bit-count from
30545 loading the file is greater than <option>tls_dh_max_bits</option> then it will be ignored,
30546 and treated as though the <option>tls_dhparam</option> were set to "none".
30547 </para>
30548 <para>
30549 If this option expands to the string "none", then no DH parameters will be
30550 loaded by Exim.
30551 </para>
30552 <para>
30553 If this option expands to the string "historic" and Exim is using GnuTLS, then
30554 Exim will attempt to load a file from inside the spool directory.  If the file
30555 does not exist, Exim will attempt to create it.
30556 See section <xref linkend="SECTgnutlsparam"/> for further details.
30557 </para>
30558 <para>
30559 If Exim is using OpenSSL and this option is empty or unset, then Exim will load
30560 a default DH prime; the default is the 2048 bit prime described in section
30561 2.2 of RFC 5114, "2048-bit MODP Group with 224-bit Prime Order Subgroup", which
30562 in IKE is assigned number 23.
30563 </para>
30564 <para>
30565 Otherwise, the option must expand to the name used by Exim for any of a number
30566 of DH primes specified in RFC 2409, RFC 3526 and RFC 5114.  As names, Exim uses
30567 "ike" followed by the number used by IKE, of "default" which corresponds to
30568 "ike23".
30569 </para>
30570 <para>
30571 The available primes are:
30572 <literal>ike1</literal>, <literal>ike2</literal>, <literal>ike5</literal>,
30573 <literal>ike14</literal>, <literal>ike15</literal>, <literal>ike16</literal>, <literal>ike17</literal>, <literal>ike18</literal>,
30574 <literal>ike22</literal>, <literal>ike23</literal> (aka <literal>default</literal>) and <literal>ike24</literal>.
30575 </para>
30576 <para>
30577 Some of these will be too small to be accepted by clients.
30578 Some may be too large to be accepted by clients.
30579 </para>
30580 <para>
30581 The TLS protocol does not negotiate an acceptable size for this; clients tend
30582 to hard-drop connections if what is offered by the server is unacceptable,
30583 whether too large or too small, and there&#x2019;s no provision for the client to
30584 tell the server what these constraints are.  Thus, as a server operator, you
30585 need to make an educated guess as to what is most likely to work for your
30586 userbase.
30587 </para>
30588 <para>
30589 Some known size constraints suggest that a bit-size in the range 2048 to 2236
30590 is most likely to maximise interoperability.  The upper bound comes from
30591 applications using the Mozilla Network Security Services (NSS) library, which
30592 used to set its <literal>DH_MAX_P_BITS</literal> upper-bound to 2236.  This affects many
30593 mail user agents (MUAs). The lower bound comes from Debian installs of Exim4
30594 prior to the 4.80 release, as Debian used to patch Exim to raise the minimum
30595 acceptable bound from 1024 to 2048.
30596 </para>
30597 <para revisionflag="changed">
30598 <indexterm role="option">
30599 <primary><option>tls_eccurve</option></primary>
30600 </indexterm>
30601 </para>
30602 <informaltable frame="all" revisionflag="changed">
30603 <tgroup cols="4" colsep="0" rowsep="0">
30604 <colspec colwidth="8*" align="left"/>
30605 <colspec colwidth="6*" align="center"/>
30606 <colspec colwidth="6*" align="center"/>
30607 <colspec colwidth="6*" align="right"/>
30608 <tbody>
30609 <row>
30610 <entry><option>tls_eccurve</option></entry>
30611 <entry>Use: <emphasis>main</emphasis></entry>
30612 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
30613 <entry>Default: <emphasis>prime256v1</emphasis></entry>
30614 </row>
30615 </tbody>
30616 </tgroup>
30617 </informaltable>
30618 <para revisionflag="changed">
30619 <indexterm role="concept">
30620 <primary>TLS</primary>
30621 <secondary>EC cryptography</secondary>
30622 </indexterm>
30623 If built with a recent-enough version of OpenSSL,
30624 this option selects a EC curve for use by Exim.
30625 </para>
30626 <para revisionflag="changed">
30627 Curve names of the form <emphasis>prime256v1</emphasis> are accepted.
30628 For even more-recent library versions, names of the form <emphasis>P-512</emphasis>
30629 are also accepted, plus the special value <emphasis>auto</emphasis>
30630 which tell the library to choose.
30631 </para>
30632 <para revisionflag="changed">
30633 If the option is set to an empty string, no EC curves will be enabled.
30634 </para>
30635 <para>
30636 <indexterm role="option">
30637 <primary><option>tls_ocsp_file</option></primary>
30638 </indexterm>
30639 </para>
30640 <informaltable frame="all">
30641 <tgroup cols="4" colsep="0" rowsep="0">
30642 <colspec colwidth="8*" align="left"/>
30643 <colspec colwidth="6*" align="center"/>
30644 <colspec colwidth="6*" align="center"/>
30645 <colspec colwidth="6*" align="right"/>
30646 <tbody>
30647 <row>
30648 <entry><option>tls_ocsp_file</option></entry>
30649 <entry>Use: <emphasis>main</emphasis></entry>
30650 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
30651 <entry>Default: <emphasis>unset</emphasis></entry>
30652 </row>
30653 </tbody>
30654 </tgroup>
30655 </informaltable>
30656 <para>
30657 <indexterm role="concept">
30658 <primary>TLS</primary>
30659 <secondary>certificate status</secondary>
30660 </indexterm>
30661 <indexterm role="concept">
30662 <primary>TLS</primary>
30663 <secondary>OCSP proof file</secondary>
30664 </indexterm>
30665 This option
30666 must if set expand to the absolute path to a file which contains a current
30667 status proof for the server&#x2019;s certificate, as obtained from the
30668 Certificate Authority.
30669 </para>
30670 <para>
30671 <indexterm role="option">
30672 <primary><option>tls_on_connect_ports</option></primary>
30673 </indexterm>
30674 </para>
30675 <informaltable frame="all">
30676 <tgroup cols="4" colsep="0" rowsep="0">
30677 <colspec colwidth="8*" align="left"/>
30678 <colspec colwidth="6*" align="center"/>
30679 <colspec colwidth="6*" align="center"/>
30680 <colspec colwidth="6*" align="right"/>
30681 <tbody>
30682 <row>
30683 <entry><option>tls_on_connect_ports</option></entry>
30684 <entry>Use: <emphasis>main</emphasis></entry>
30685 <entry>Type: <emphasis>string list</emphasis></entry>
30686 <entry>Default: <emphasis>unset</emphasis></entry>
30687 </row>
30688 </tbody>
30689 </tgroup>
30690 </informaltable>
30691 <para>
30692 <indexterm role="concept">
30693 <primary>SSMTP</primary>
30694 </indexterm>
30695 <indexterm role="concept">
30696 <primary>SMTPS</primary>
30697 </indexterm>
30698 This option specifies a list of incoming SSMTP (aka SMTPS) ports that should
30699 operate the obsolete SSMTP (SMTPS) protocol, where a TLS session is immediately
30700 set up without waiting for the client to issue a STARTTLS command. For
30701 further details, see section <xref linkend="SECTsupobssmt"/>.
30702 </para>
30703 <para>
30704 <indexterm role="option">
30705 <primary><option>tls_privatekey</option></primary>
30706 </indexterm>
30707 </para>
30708 <informaltable frame="all">
30709 <tgroup cols="4" colsep="0" rowsep="0">
30710 <colspec colwidth="8*" align="left"/>
30711 <colspec colwidth="6*" align="center"/>
30712 <colspec colwidth="6*" align="center"/>
30713 <colspec colwidth="6*" align="right"/>
30714 <tbody>
30715 <row>
30716 <entry><option>tls_privatekey</option></entry>
30717 <entry>Use: <emphasis>main</emphasis></entry>
30718 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
30719 <entry>Default: <emphasis>unset</emphasis></entry>
30720 </row>
30721 </tbody>
30722 </tgroup>
30723 </informaltable>
30724 <para>
30725 <indexterm role="concept">
30726 <primary>TLS</primary>
30727 <secondary>server private key; location of</secondary>
30728 </indexterm>
30729 The value of this option is expanded, and must then be the absolute path to a
30730 file which contains the server&#x2019;s private key. If this option is unset, or if
30731 the expansion is forced to fail, or the result is an empty string, the private
30732 key is assumed to be in the same file as the server&#x2019;s certificates. See chapter
30733 <xref linkend="CHAPTLS"/> for further details.
30734 </para>
30735 <para>
30736 See <xref linkend="SECTtlssni"/> for discussion of when this option might be re-expanded.
30737 </para>
30738 <para>
30739 <indexterm role="option">
30740 <primary><option>tls_remember_esmtp</option></primary>
30741 </indexterm>
30742 </para>
30743 <informaltable frame="all">
30744 <tgroup cols="4" colsep="0" rowsep="0">
30745 <colspec colwidth="8*" align="left"/>
30746 <colspec colwidth="6*" align="center"/>
30747 <colspec colwidth="6*" align="center"/>
30748 <colspec colwidth="6*" align="right"/>
30749 <tbody>
30750 <row>
30751 <entry><option>tls_remember_esmtp</option></entry>
30752 <entry>Use: <emphasis>main</emphasis></entry>
30753 <entry>Type: <emphasis>boolean</emphasis></entry>
30754 <entry>Default: <emphasis>false</emphasis></entry>
30755 </row>
30756 </tbody>
30757 </tgroup>
30758 </informaltable>
30759 <para>
30760 <indexterm role="concept">
30761 <primary>TLS</primary>
30762 <secondary>esmtp state; remembering</secondary>
30763 </indexterm>
30764 <indexterm role="concept">
30765 <primary>TLS</primary>
30766 <secondary>broken clients</secondary>
30767 </indexterm>
30768 If this option is set true, Exim violates the RFCs by remembering that it is in
30769 <quote>esmtp</quote> state after successfully negotiating a TLS session. This provides
30770 support for broken clients that fail to send a new EHLO after starting a
30771 TLS session.
30772 </para>
30773 <para>
30774 <indexterm role="option">
30775 <primary><option>tls_require_ciphers</option></primary>
30776 </indexterm>
30777 </para>
30778 <informaltable frame="all">
30779 <tgroup cols="4" colsep="0" rowsep="0">
30780 <colspec colwidth="8*" align="left"/>
30781 <colspec colwidth="6*" align="center"/>
30782 <colspec colwidth="6*" align="center"/>
30783 <colspec colwidth="6*" align="right"/>
30784 <tbody>
30785 <row>
30786 <entry><option>tls_require_ciphers</option></entry>
30787 <entry>Use: <emphasis>main</emphasis></entry>
30788 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
30789 <entry>Default: <emphasis>unset</emphasis></entry>
30790 </row>
30791 </tbody>
30792 </tgroup>
30793 </informaltable>
30794 <para>
30795 <indexterm role="concept">
30796 <primary>TLS</primary>
30797 <secondary>requiring specific ciphers</secondary>
30798 </indexterm>
30799 <indexterm role="concept">
30800 <primary>cipher</primary>
30801 <secondary>requiring specific</secondary>
30802 </indexterm>
30803 This option controls which ciphers can be used for incoming TLS connections.
30804 The <command>smtp</command> transport has an option of the same name for controlling outgoing
30805 connections. This option is expanded for each connection, so can be varied for
30806 different clients if required. The value of this option must be a list of
30807 permitted cipher suites. The OpenSSL and GnuTLS libraries handle cipher control
30808 in somewhat different ways. If GnuTLS is being used, the client controls the
30809 preference order of the available ciphers. Details are given in sections
30810 <xref linkend="SECTreqciphssl"/> and <xref linkend="SECTreqciphgnu"/>.
30811 </para>
30812 <para>
30813 <indexterm role="option">
30814 <primary><option>tls_try_verify_hosts</option></primary>
30815 </indexterm>
30816 </para>
30817 <informaltable frame="all">
30818 <tgroup cols="4" colsep="0" rowsep="0">
30819 <colspec colwidth="8*" align="left"/>
30820 <colspec colwidth="6*" align="center"/>
30821 <colspec colwidth="6*" align="center"/>
30822 <colspec colwidth="6*" align="right"/>
30823 <tbody>
30824 <row>
30825 <entry><option>tls_try_verify_hosts</option></entry>
30826 <entry>Use: <emphasis>main</emphasis></entry>
30827 <entry>Type: <emphasis>host list</emphasis>&dagger;<emphasis></emphasis></entry>
30828 <entry>Default: <emphasis>unset</emphasis></entry>
30829 </row>
30830 </tbody>
30831 </tgroup>
30832 </informaltable>
30833 <para>
30834 <indexterm role="concept">
30835 <primary>TLS</primary>
30836 <secondary>client certificate verification</secondary>
30837 </indexterm>
30838 <indexterm role="concept">
30839 <primary>certificate</primary>
30840 <secondary>verification of client</secondary>
30841 </indexterm>
30842 See <option>tls_verify_hosts</option> below.
30843 </para>
30844 <para revisionflag="changed">
30845 <indexterm role="option">
30846 <primary><option>tls_verify_certificates</option></primary>
30847 </indexterm>
30848 </para>
30849 <informaltable frame="all" revisionflag="changed">
30850 <tgroup cols="4" colsep="0" rowsep="0">
30851 <colspec colwidth="8*" align="left"/>
30852 <colspec colwidth="6*" align="center"/>
30853 <colspec colwidth="6*" align="center"/>
30854 <colspec colwidth="6*" align="right"/>
30855 <tbody>
30856 <row>
30857 <entry><option>tls_verify_certificates</option></entry>
30858 <entry>Use: <emphasis>main</emphasis></entry>
30859 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
30860 <entry>Default: <emphasis>system</emphasis></entry>
30861 </row>
30862 </tbody>
30863 </tgroup>
30864 </informaltable>
30865 <para revisionflag="changed">
30866 <indexterm role="concept">
30867 <primary>TLS</primary>
30868 <secondary>client certificate verification</secondary>
30869 </indexterm>
30870 <indexterm role="concept">
30871 <primary>certificate</primary>
30872 <secondary>verification of client</secondary>
30873 </indexterm>
30874 The value of this option is expanded, and must then be either the
30875 word "system"
30876 or the absolute path to
30877 a file or directory containing permitted certificates for clients that
30878 match <option>tls_verify_hosts</option> or <option>tls_try_verify_hosts</option>.
30879 </para>
30880 <para revisionflag="changed">
30881 The "system" value for the option will use a
30882 system default location compiled into the SSL library.
30883 This is not available for GnuTLS versions preceding 3.0.20,
30884 and will be taken as empty; an explicit location
30885 must be specified.
30886 </para>
30887 <para revisionflag="changed">
30888 The use of a directory for the option value is not available for GnuTLS versions
30889 preceding 3.3.6 and a single file must be used.
30890 </para>
30891 <para revisionflag="changed">
30892 With OpenSSL the certificates specified
30893 explicitly
30894 either by file or directory
30895 are added to those given by the system default location.
30896 </para>
30897 <para>
30898 These certificates should be for the certificate authorities trusted, rather
30899 than the public cert of individual clients.  With both OpenSSL and GnuTLS, if
30900 the value is a file then the certificates are sent by Exim as a server to
30901 connecting clients, defining the list of accepted certificate authorities.
30902 Thus the values defined should be considered public data.  To avoid this,
30903 use the explicit directory version.
30904 </para>
30905 <para>
30906 See <xref linkend="SECTtlssni"/> for discussion of when this option might be re-expanded.
30907 </para>
30908 <para>
30909 A forced expansion failure or setting to an empty string is equivalent to
30910 being unset.
30911 </para>
30912 <para>
30913 <indexterm role="option">
30914 <primary><option>tls_verify_hosts</option></primary>
30915 </indexterm>
30916 </para>
30917 <informaltable frame="all">
30918 <tgroup cols="4" colsep="0" rowsep="0">
30919 <colspec colwidth="8*" align="left"/>
30920 <colspec colwidth="6*" align="center"/>
30921 <colspec colwidth="6*" align="center"/>
30922 <colspec colwidth="6*" align="right"/>
30923 <tbody>
30924 <row>
30925 <entry><option>tls_verify_hosts</option></entry>
30926 <entry>Use: <emphasis>main</emphasis></entry>
30927 <entry>Type: <emphasis>host list</emphasis>&dagger;<emphasis></emphasis></entry>
30928 <entry>Default: <emphasis>unset</emphasis></entry>
30929 </row>
30930 </tbody>
30931 </tgroup>
30932 </informaltable>
30933 <para>
30934 <indexterm role="concept">
30935 <primary>TLS</primary>
30936 <secondary>client certificate verification</secondary>
30937 </indexterm>
30938 <indexterm role="concept">
30939 <primary>certificate</primary>
30940 <secondary>verification of client</secondary>
30941 </indexterm>
30942 This option, along with <option>tls_try_verify_hosts</option>, controls the checking of
30943 certificates from clients. The expected certificates are defined by
30944 <option>tls_verify_certificates</option>, which must be set. A configuration error occurs if
30945 either <option>tls_verify_hosts</option> or <option>tls_try_verify_hosts</option> is set and
30946 <option>tls_verify_certificates</option> is not set.
30947 </para>
30948 <para>
30949 Any client that matches <option>tls_verify_hosts</option> is constrained by
30950 <option>tls_verify_certificates</option>. When the client initiates a TLS session, it must
30951 present one of the listed certificates. If it does not, the connection is
30952 aborted. <emphasis role="bold">Warning</emphasis>: Including a host in <option>tls_verify_hosts</option> does not require
30953 the host to use TLS. It can still send SMTP commands through unencrypted
30954 connections. Forcing a client to use TLS has to be done separately using an
30955 ACL to reject inappropriate commands when the connection is not encrypted.
30956 </para>
30957 <para>
30958 A weaker form of checking is provided by <option>tls_try_verify_hosts</option>. If a client
30959 matches this option (but not <option>tls_verify_hosts</option>), Exim requests a
30960 certificate and checks it against <option>tls_verify_certificates</option>, but does not
30961 abort the connection if there is no certificate or if it does not match. This
30962 state can be detected in an ACL, which makes it possible to implement policies
30963 such as <quote>accept for relay only if a verified certificate has been received,
30964 but accept for local delivery if encrypted, even without a verified
30965 certificate</quote>.
30966 </para>
30967 <para>
30968 Client hosts that match neither of these lists are not asked to present
30969 certificates.
30970 </para>
30971 <para>
30972 <indexterm role="option">
30973 <primary><option>trusted_groups</option></primary>
30974 </indexterm>
30975 </para>
30976 <informaltable frame="all">
30977 <tgroup cols="4" colsep="0" rowsep="0">
30978 <colspec colwidth="8*" align="left"/>
30979 <colspec colwidth="6*" align="center"/>
30980 <colspec colwidth="6*" align="center"/>
30981 <colspec colwidth="6*" align="right"/>
30982 <tbody>
30983 <row>
30984 <entry><option>trusted_groups</option></entry>
30985 <entry>Use: <emphasis>main</emphasis></entry>
30986 <entry>Type: <emphasis>string list</emphasis>&dagger;<emphasis></emphasis></entry>
30987 <entry>Default: <emphasis>unset</emphasis></entry>
30988 </row>
30989 </tbody>
30990 </tgroup>
30991 </informaltable>
30992 <para>
30993 <indexterm role="concept">
30994 <primary>trusted groups</primary>
30995 </indexterm>
30996 <indexterm role="concept">
30997 <primary>groups</primary>
30998 <secondary>trusted</secondary>
30999 </indexterm>
31000 This option is expanded just once, at the start of Exim&#x2019;s processing. If this
31001 option is set, any process that is running in one of the listed groups, or
31002 which has one of them as a supplementary group, is trusted. The groups can be
31003 specified numerically or by name. See section <xref linkend="SECTtrustedadmin"/> for
31004 details of what trusted callers are permitted to do. If neither
31005 <option>trusted_groups</option> nor <option>trusted_users</option> is set, only root and the Exim user
31006 are trusted.
31007 </para>
31008 <para>
31009 <indexterm role="option">
31010 <primary><option>trusted_users</option></primary>
31011 </indexterm>
31012 </para>
31013 <informaltable frame="all">
31014 <tgroup cols="4" colsep="0" rowsep="0">
31015 <colspec colwidth="8*" align="left"/>
31016 <colspec colwidth="6*" align="center"/>
31017 <colspec colwidth="6*" align="center"/>
31018 <colspec colwidth="6*" align="right"/>
31019 <tbody>
31020 <row>
31021 <entry><option>trusted_users</option></entry>
31022 <entry>Use: <emphasis>main</emphasis></entry>
31023 <entry>Type: <emphasis>string list</emphasis>&dagger;<emphasis></emphasis></entry>
31024 <entry>Default: <emphasis>unset</emphasis></entry>
31025 </row>
31026 </tbody>
31027 </tgroup>
31028 </informaltable>
31029 <para>
31030 <indexterm role="concept">
31031 <primary>trusted users</primary>
31032 </indexterm>
31033 <indexterm role="concept">
31034 <primary>user</primary>
31035 <secondary>trusted</secondary>
31036 </indexterm>
31037 This option is expanded just once, at the start of Exim&#x2019;s processing. If this
31038 option is set, any process that is running as one of the listed users is
31039 trusted. The users can be specified numerically or by name. See section
31040 <xref linkend="SECTtrustedadmin"/> for details of what trusted callers are permitted to do.
31041 If neither <option>trusted_groups</option> nor <option>trusted_users</option> is set, only root and the
31042 Exim user are trusted.
31043 </para>
31044 <para>
31045 <indexterm role="option">
31046 <primary><option>unknown_login</option></primary>
31047 </indexterm>
31048 </para>
31049 <informaltable frame="all">
31050 <tgroup cols="4" colsep="0" rowsep="0">
31051 <colspec colwidth="8*" align="left"/>
31052 <colspec colwidth="6*" align="center"/>
31053 <colspec colwidth="6*" align="center"/>
31054 <colspec colwidth="6*" align="right"/>
31055 <tbody>
31056 <row>
31057 <entry><option>unknown_login</option></entry>
31058 <entry>Use: <emphasis>main</emphasis></entry>
31059 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
31060 <entry>Default: <emphasis>unset</emphasis></entry>
31061 </row>
31062 </tbody>
31063 </tgroup>
31064 </informaltable>
31065 <para>
31066 <indexterm role="concept">
31067 <primary>uid (user id)</primary>
31068 <secondary>unknown caller</secondary>
31069 </indexterm>
31070 <indexterm role="variable">
31071 <primary><varname>$caller_uid</varname></primary>
31072 </indexterm>
31073 This is a specialized feature for use in unusual configurations. By default, if
31074 the uid of the caller of Exim cannot be looked up using <function>getpwuid()</function>, Exim
31075 gives up. The <option>unknown_login</option> option can be used to set a login name to be
31076 used in this circumstance. It is expanded, so values like <option>user$caller_uid</option>
31077 can be set. When <option>unknown_login</option> is used, the value of <option>unknown_username</option>
31078 is used for the user&#x2019;s real name (gecos field), unless this has been set by the
31079 <option>-F</option> option.
31080 </para>
31081 <para>
31082 <indexterm role="option">
31083 <primary><option>unknown_username</option></primary>
31084 </indexterm>
31085 </para>
31086 <informaltable frame="all">
31087 <tgroup cols="4" colsep="0" rowsep="0">
31088 <colspec colwidth="8*" align="left"/>
31089 <colspec colwidth="6*" align="center"/>
31090 <colspec colwidth="6*" align="center"/>
31091 <colspec colwidth="6*" align="right"/>
31092 <tbody>
31093 <row>
31094 <entry><option>unknown_username</option></entry>
31095 <entry>Use: <emphasis>main</emphasis></entry>
31096 <entry>Type: <emphasis>string</emphasis></entry>
31097 <entry>Default: <emphasis>unset</emphasis></entry>
31098 </row>
31099 </tbody>
31100 </tgroup>
31101 </informaltable>
31102 <para>
31103 See <option>unknown_login</option>.
31104 </para>
31105 <para>
31106 <indexterm role="option">
31107 <primary><option>untrusted_set_sender</option></primary>
31108 </indexterm>
31109 </para>
31110 <informaltable frame="all">
31111 <tgroup cols="4" colsep="0" rowsep="0">
31112 <colspec colwidth="8*" align="left"/>
31113 <colspec colwidth="6*" align="center"/>
31114 <colspec colwidth="6*" align="center"/>
31115 <colspec colwidth="6*" align="right"/>
31116 <tbody>
31117 <row>
31118 <entry><option>untrusted_set_sender</option></entry>
31119 <entry>Use: <emphasis>main</emphasis></entry>
31120 <entry>Type: <emphasis>address list</emphasis>&dagger;<emphasis></emphasis></entry>
31121 <entry>Default: <emphasis>unset</emphasis></entry>
31122 </row>
31123 </tbody>
31124 </tgroup>
31125 </informaltable>
31126 <para>
31127 <indexterm role="concept">
31128 <primary>trusted users</primary>
31129 </indexterm>
31130 <indexterm role="concept">
31131 <primary>sender</primary>
31132 <secondary>setting by untrusted user</secondary>
31133 </indexterm>
31134 <indexterm role="concept">
31135 <primary>untrusted user setting sender</primary>
31136 </indexterm>
31137 <indexterm role="concept">
31138 <primary>user</primary>
31139 <secondary>untrusted setting sender</secondary>
31140 </indexterm>
31141 <indexterm role="concept">
31142 <primary>envelope sender</primary>
31143 </indexterm>
31144 When an untrusted user submits a message to Exim using the standard input, Exim
31145 normally creates an envelope sender address from the user&#x2019;s login and the
31146 default qualification domain. Data from the <option>-f</option> option (for setting envelope
31147 senders on non-SMTP messages) or the SMTP MAIL command (if <option>-bs</option> or <option>-bS</option>
31148 is used) is ignored.
31149 </para>
31150 <para>
31151 However, untrusted users are permitted to set an empty envelope sender address,
31152 to declare that a message should never generate any bounces. For example:
31153 </para>
31154 <literallayout class="monospaced">
31155 exim -f '&lt;&gt;' user@domain.example
31156 </literallayout>
31157 <para>
31158 <indexterm role="variable">
31159 <primary><varname>$sender_ident</varname></primary>
31160 </indexterm>
31161 The <option>untrusted_set_sender</option> option allows you to permit untrusted users to set
31162 other envelope sender addresses in a controlled way. When it is set, untrusted
31163 users are allowed to set envelope sender addresses that match any of the
31164 patterns in the list. Like all address lists, the string is expanded. The
31165 identity of the user is in <varname>$sender_ident</varname>, so you can, for example, restrict
31166 users to setting senders that start with their login ids
31167 followed by a hyphen
31168 by a setting like this:
31169 </para>
31170 <literallayout class="monospaced">
31171 untrusted_set_sender = ^$sender_ident-
31172 </literallayout>
31173 <para>
31174 If you want to allow untrusted users to set envelope sender addresses without
31175 restriction, you can use
31176 </para>
31177 <literallayout class="monospaced">
31178 untrusted_set_sender = *
31179 </literallayout>
31180 <para>
31181 The <option>untrusted_set_sender</option> option applies to all forms of local input, but
31182 only to the setting of the envelope sender. It does not permit untrusted users
31183 to use the other options which trusted user can use to override message
31184 parameters. Furthermore, it does not stop Exim from removing an existing
31185 <emphasis>Sender:</emphasis> header in the message, or from adding a <emphasis>Sender:</emphasis> header if
31186 necessary. See <option>local_sender_retain</option> and <option>local_from_check</option> for ways of
31187 overriding these actions. The handling of the <emphasis>Sender:</emphasis> header is also
31188 described in section <xref linkend="SECTthesenhea"/>.
31189 </para>
31190 <para>
31191 The log line for a message&#x2019;s arrival shows the envelope sender following
31192 <quote>&lt;=</quote>. For local messages, the user&#x2019;s login always follows, after <quote>U=</quote>. In
31193 <option>-bp</option> displays, and in the Exim monitor, if an untrusted user sets an
31194 envelope sender address, the user&#x2019;s login is shown in parentheses after the
31195 sender address.
31196 </para>
31197 <para>
31198 <indexterm role="option">
31199 <primary><option>uucp_from_pattern</option></primary>
31200 </indexterm>
31201 </para>
31202 <informaltable frame="all">
31203 <tgroup cols="4" colsep="0" rowsep="0">
31204 <colspec colwidth="8*" align="left"/>
31205 <colspec colwidth="6*" align="center"/>
31206 <colspec colwidth="6*" align="center"/>
31207 <colspec colwidth="6*" align="right"/>
31208 <tbody>
31209 <row>
31210 <entry><option>uucp_from_pattern</option></entry>
31211 <entry>Use: <emphasis>main</emphasis></entry>
31212 <entry>Type: <emphasis>string</emphasis></entry>
31213 <entry>Default: <emphasis>see below</emphasis></entry>
31214 </row>
31215 </tbody>
31216 </tgroup>
31217 </informaltable>
31218 <para>
31219 <indexterm role="concept">
31220 <primary><quote>From</quote> line</primary>
31221 </indexterm>
31222 <indexterm role="concept">
31223 <primary>UUCP</primary>
31224 <secondary><quote>From</quote> line</secondary>
31225 </indexterm>
31226 Some applications that pass messages to an MTA via a command line interface use
31227 an initial line starting with <quote>From&nbsp;</quote> to pass the envelope sender. In
31228 particular, this is used by UUCP software. Exim recognizes such a line by means
31229 of a regular expression that is set in <option>uucp_from_pattern</option>. When the pattern
31230 matches, the sender address is constructed by expanding the contents of
31231 <option>uucp_from_sender</option>, provided that the caller of Exim is a trusted user. The
31232 default pattern recognizes lines in the following two forms:
31233 </para>
31234 <literallayout class="monospaced">
31235 From ph10 Fri Jan  5 12:35 GMT 1996
31236 From ph10 Fri, 7 Jan 97 14:00:00 GMT
31237 </literallayout>
31238 <para>
31239 The pattern can be seen by running
31240 </para>
31241 <literallayout class="monospaced">
31242 exim -bP uucp_from_pattern
31243 </literallayout>
31244 <para>
31245 It checks only up to the hours and minutes, and allows for a 2-digit or 4-digit
31246 year in the second case. The first word after <quote>From&nbsp;</quote> is matched in the
31247 regular expression by a parenthesized subpattern. The default value for
31248 <option>uucp_from_sender</option> is <quote>$1</quote>, which therefore just uses this first word
31249 (<quote>ph10</quote> in the example above) as the message&#x2019;s sender. See also
31250 <option>ignore_fromline_hosts</option>.
31251 </para>
31252 <para>
31253 <indexterm role="option">
31254 <primary><option>uucp_from_sender</option></primary>
31255 </indexterm>
31256 </para>
31257 <informaltable frame="all">
31258 <tgroup cols="4" colsep="0" rowsep="0">
31259 <colspec colwidth="8*" align="left"/>
31260 <colspec colwidth="6*" align="center"/>
31261 <colspec colwidth="6*" align="center"/>
31262 <colspec colwidth="6*" align="right"/>
31263 <tbody>
31264 <row>
31265 <entry><option>uucp_from_sender</option></entry>
31266 <entry>Use: <emphasis>main</emphasis></entry>
31267 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
31268 <entry>Default: <emphasis><literal>$1</literal></emphasis></entry>
31269 </row>
31270 </tbody>
31271 </tgroup>
31272 </informaltable>
31273 <para>
31274 See <option>uucp_from_pattern</option> above.
31275 </para>
31276 <para>
31277 <indexterm role="option">
31278 <primary><option>warn_message_file</option></primary>
31279 </indexterm>
31280 </para>
31281 <informaltable frame="all">
31282 <tgroup cols="4" colsep="0" rowsep="0">
31283 <colspec colwidth="8*" align="left"/>
31284 <colspec colwidth="6*" align="center"/>
31285 <colspec colwidth="6*" align="center"/>
31286 <colspec colwidth="6*" align="right"/>
31287 <tbody>
31288 <row>
31289 <entry><option>warn_message_file</option></entry>
31290 <entry>Use: <emphasis>main</emphasis></entry>
31291 <entry>Type: <emphasis>string</emphasis></entry>
31292 <entry>Default: <emphasis>unset</emphasis></entry>
31293 </row>
31294 </tbody>
31295 </tgroup>
31296 </informaltable>
31297 <para>
31298 <indexterm role="concept">
31299 <primary>warning of delay</primary>
31300 <secondary>customizing the message</secondary>
31301 </indexterm>
31302 <indexterm role="concept">
31303 <primary>customizing</primary>
31304 <secondary>warning message</secondary>
31305 </indexterm>
31306 This option defines a template file containing paragraphs of text to be used
31307 for constructing the warning message which is sent by Exim when a message has
31308 been on the queue for a specified amount of time, as specified by
31309 <option>delay_warning</option>. Details of the file&#x2019;s contents are given in chapter
31310 <xref linkend="CHAPemsgcust"/>. See also <option>bounce_message_file</option>.
31311 </para>
31312 <para>
31313 <indexterm role="option">
31314 <primary><option>write_rejectlog</option></primary>
31315 </indexterm>
31316 </para>
31317 <informaltable frame="all">
31318 <tgroup cols="4" colsep="0" rowsep="0">
31319 <colspec colwidth="8*" align="left"/>
31320 <colspec colwidth="6*" align="center"/>
31321 <colspec colwidth="6*" align="center"/>
31322 <colspec colwidth="6*" align="right"/>
31323 <tbody>
31324 <row>
31325 <entry><option>write_rejectlog</option></entry>
31326 <entry>Use: <emphasis>main</emphasis></entry>
31327 <entry>Type: <emphasis>boolean</emphasis></entry>
31328 <entry>Default: <emphasis>true</emphasis></entry>
31329 </row>
31330 </tbody>
31331 </tgroup>
31332 </informaltable>
31333 <para>
31334 <indexterm role="concept">
31335 <primary>reject log</primary>
31336 <secondary>disabling</secondary>
31337 </indexterm>
31338 If this option is set false, Exim no longer writes anything to the reject log.
31339 See chapter <xref linkend="CHAPlog"/> for details of what Exim writes to its logs.
31340 <indexterm role="concept" startref="IIDconfima" class="endofrange"/>
31341 <indexterm role="concept" startref="IIDmaiconf" class="endofrange"/>
31342 </para>
31343 </section>
31344 </chapter>
31345
31346 <chapter id="CHAProutergeneric">
31347 <title>Generic options for routers</title>
31348 <para>
31349 <indexterm role="concept" id="IIDgenoprou1" class="startofrange">
31350 <primary>options</primary>
31351 <secondary>generic; for routers</secondary>
31352 </indexterm>
31353 <indexterm role="concept" id="IIDgenoprou2" class="startofrange">
31354 <primary>generic options</primary>
31355 <secondary>router</secondary>
31356 </indexterm>
31357 This chapter describes the generic options that apply to all routers.
31358 Those that are preconditions are marked with &Dagger; in the <quote>use</quote> field.
31359 </para>
31360 <para>
31361 For a general description of how a router operates, see sections
31362 <xref linkend="SECTrunindrou"/> and <xref linkend="SECTrouprecon"/>. The latter specifies the order in
31363 which the preconditions are tested. The order of expansion of the options that
31364 provide data for a transport is: <option>errors_to</option>, <option>headers_add</option>,
31365 <option>headers_remove</option>, <option>transport</option>.
31366 </para>
31367 <para>
31368 <indexterm role="option">
31369 <primary><option>address_data</option></primary>
31370 </indexterm>
31371 </para>
31372 <informaltable frame="all">
31373 <tgroup cols="4" colsep="0" rowsep="0">
31374 <colspec colwidth="8*" align="left"/>
31375 <colspec colwidth="6*" align="center"/>
31376 <colspec colwidth="6*" align="center"/>
31377 <colspec colwidth="6*" align="right"/>
31378 <tbody>
31379 <row>
31380 <entry><option>address_data</option></entry>
31381 <entry>Use: <emphasis>routers</emphasis></entry>
31382 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
31383 <entry>Default: <emphasis>unset</emphasis></entry>
31384 </row>
31385 </tbody>
31386 </tgroup>
31387 </informaltable>
31388 <para>
31389 <indexterm role="concept">
31390 <primary>router</primary>
31391 <secondary>data attached to address</secondary>
31392 </indexterm>
31393 The string is expanded just before the router is run, that is, after all the
31394 precondition tests have succeeded. If the expansion is forced to fail, the
31395 router declines, the value of <option>address_data</option> remains unchanged, and the
31396 <option>more</option> option controls what happens next. Other expansion failures cause
31397 delivery of the address to be deferred.
31398 </para>
31399 <para>
31400 <indexterm role="variable">
31401 <primary><varname>$address_data</varname></primary>
31402 </indexterm>
31403 When the expansion succeeds, the value is retained with the address, and can be
31404 accessed using the variable <varname>$address_data</varname> in the current router, subsequent
31405 routers, and the eventual transport.
31406 </para>
31407 <para>
31408 <emphasis role="bold">Warning</emphasis>: If the current or any subsequent router is a <command>redirect</command> router
31409 that runs a user&#x2019;s filter file, the contents of <varname>$address_data</varname> are accessible
31410 in the filter. This is not normally a problem, because such data is usually
31411 either not confidential or it <quote>belongs</quote> to the current user, but if you do
31412 put confidential data into <varname>$address_data</varname> you need to remember this point.
31413 </para>
31414 <para>
31415 Even if the router declines or passes, the value of <varname>$address_data</varname> remains
31416 with the address, though it can be changed by another <option>address_data</option> setting
31417 on a subsequent router. If a router generates child addresses, the value of
31418 <varname>$address_data</varname> propagates to them. This also applies to the special kind of
31419 <quote>child</quote> that is generated by a router with the <option>unseen</option> option.
31420 </para>
31421 <para>
31422 The idea of <option>address_data</option> is that you can use it to look up a lot of data
31423 for the address once, and then pick out parts of the data later. For example,
31424 you could use a single LDAP lookup to return a string of the form
31425 </para>
31426 <literallayout class="monospaced">
31427 uid=1234 gid=5678 mailbox=/mail/xyz forward=/home/xyz/.forward
31428 </literallayout>
31429 <para>
31430 In the transport you could pick out the mailbox by a setting such as
31431 </para>
31432 <literallayout class="monospaced">
31433 file = ${extract{mailbox}{$address_data}}
31434 </literallayout>
31435 <para>
31436 This makes the configuration file less messy, and also reduces the number of
31437 lookups (though Exim does cache lookups).
31438 </para>
31439 <para>
31440 <indexterm role="variable">
31441 <primary><varname>$sender_address_data</varname></primary>
31442 </indexterm>
31443 <indexterm role="variable">
31444 <primary><varname>$address_data</varname></primary>
31445 </indexterm>
31446 The <option>address_data</option> facility is also useful as a means of passing information
31447 from one router to another, and from a router to a transport. In addition, if
31448 <varname>$address_data</varname> is set by a router when verifying a recipient address from an
31449 ACL, it remains available for use in the rest of the ACL statement. After
31450 verifying a sender, the value is transferred to <varname>$sender_address_data</varname>.
31451 </para>
31452 <para>
31453 <indexterm role="option">
31454 <primary><option>address_test</option></primary>
31455 </indexterm>
31456 </para>
31457 <informaltable frame="all">
31458 <tgroup cols="4" colsep="0" rowsep="0">
31459 <colspec colwidth="8*" align="left"/>
31460 <colspec colwidth="6*" align="center"/>
31461 <colspec colwidth="6*" align="center"/>
31462 <colspec colwidth="6*" align="right"/>
31463 <tbody>
31464 <row>
31465 <entry><option>address_test</option></entry>
31466 <entry>Use: <emphasis>routers</emphasis>&Dagger;<emphasis></emphasis></entry>
31467 <entry>Type: <emphasis>boolean</emphasis></entry>
31468 <entry>Default: <emphasis>true</emphasis></entry>
31469 </row>
31470 </tbody>
31471 </tgroup>
31472 </informaltable>
31473 <para>
31474 <indexterm role="option">
31475 <primary><option>-bt</option></primary>
31476 </indexterm>
31477 <indexterm role="concept">
31478 <primary>router</primary>
31479 <secondary>skipping when address testing</secondary>
31480 </indexterm>
31481 If this option is set false, the router is skipped when routing is being tested
31482 by means of the <option>-bt</option> command line option. This can be a convenience when
31483 your first router sends messages to an external scanner, because it saves you
31484 having to set the <quote>already scanned</quote> indicator when testing real address
31485 routing.
31486 </para>
31487 <para>
31488 <indexterm role="option">
31489 <primary><option>cannot_route_message</option></primary>
31490 </indexterm>
31491 </para>
31492 <informaltable frame="all">
31493 <tgroup cols="4" colsep="0" rowsep="0">
31494 <colspec colwidth="8*" align="left"/>
31495 <colspec colwidth="6*" align="center"/>
31496 <colspec colwidth="6*" align="center"/>
31497 <colspec colwidth="6*" align="right"/>
31498 <tbody>
31499 <row>
31500 <entry><option>cannot_route_message</option></entry>
31501 <entry>Use: <emphasis>routers</emphasis></entry>
31502 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
31503 <entry>Default: <emphasis>unset</emphasis></entry>
31504 </row>
31505 </tbody>
31506 </tgroup>
31507 </informaltable>
31508 <para>
31509 <indexterm role="concept">
31510 <primary>router</primary>
31511 <secondary>customizing <quote>cannot route</quote> message</secondary>
31512 </indexterm>
31513 <indexterm role="concept">
31514 <primary>customizing</primary>
31515 <secondary><quote>cannot route</quote> message</secondary>
31516 </indexterm>
31517 This option specifies a text message that is used when an address cannot be
31518 routed because Exim has run out of routers. The default message is
31519 <quote>Unrouteable address</quote>. This option is useful only on routers that have
31520 <option>more</option> set false, or on the very last router in a configuration, because the
31521 value that is used is taken from the last router that is considered. This
31522 includes a router that is skipped because its preconditions are not met, as
31523 well as a router that declines. For example, using the default configuration,
31524 you could put:
31525 </para>
31526 <literallayout class="monospaced">
31527 cannot_route_message = Remote domain not found in DNS
31528 </literallayout>
31529 <para>
31530 on the first router, which is a <command>dnslookup</command> router with <option>more</option> set false,
31531 and
31532 </para>
31533 <literallayout class="monospaced">
31534 cannot_route_message = Unknown local user
31535 </literallayout>
31536 <para>
31537 on the final router that checks for local users. If string expansion fails for
31538 this option, the default message is used. Unless the expansion failure was
31539 explicitly forced, a message about the failure is written to the main and panic
31540 logs, in addition to the normal message about the routing failure.
31541 </para>
31542 <para>
31543 <indexterm role="option">
31544 <primary><option>caseful_local_part</option></primary>
31545 </indexterm>
31546 </para>
31547 <informaltable frame="all">
31548 <tgroup cols="4" colsep="0" rowsep="0">
31549 <colspec colwidth="8*" align="left"/>
31550 <colspec colwidth="6*" align="center"/>
31551 <colspec colwidth="6*" align="center"/>
31552 <colspec colwidth="6*" align="right"/>
31553 <tbody>
31554 <row>
31555 <entry><option>caseful_local_part</option></entry>
31556 <entry>Use: <emphasis>routers</emphasis></entry>
31557 <entry>Type: <emphasis>boolean</emphasis></entry>
31558 <entry>Default: <emphasis>false</emphasis></entry>
31559 </row>
31560 </tbody>
31561 </tgroup>
31562 </informaltable>
31563 <para>
31564 <indexterm role="concept">
31565 <primary>case of local parts</primary>
31566 </indexterm>
31567 <indexterm role="concept">
31568 <primary>router</primary>
31569 <secondary>case of local parts</secondary>
31570 </indexterm>
31571 By default, routers handle the local parts of addresses in a case-insensitive
31572 manner, though the actual case is preserved for transmission with the message.
31573 If you want the case of letters to be significant in a router, you must set
31574 this option true. For individual router options that contain address or local
31575 part lists (for example, <option>local_parts</option>), case-sensitive matching can be
31576 turned on by <quote>+caseful</quote> as a list item. See section <xref linkend="SECTcasletadd"/> for
31577 more details.
31578 </para>
31579 <para>
31580 <indexterm role="variable">
31581 <primary><varname>$local_part</varname></primary>
31582 </indexterm>
31583 <indexterm role="variable">
31584 <primary><varname>$original_local_part</varname></primary>
31585 </indexterm>
31586 <indexterm role="variable">
31587 <primary><varname>$parent_local_part</varname></primary>
31588 </indexterm>
31589 The value of the <varname>$local_part</varname> variable is forced to lower case while a
31590 router is running unless <option>caseful_local_part</option> is set. When a router assigns
31591 an address to a transport, the value of <varname>$local_part</varname> when the transport runs
31592 is the same as it was in the router. Similarly, when a router generates child
31593 addresses by aliasing or forwarding, the values of <varname>$original_local_part</varname>
31594 and <varname>$parent_local_part</varname> are those that were used by the redirecting router.
31595 </para>
31596 <para>
31597 This option applies to the processing of an address by a router. When a
31598 recipient address is being processed in an ACL, there is a separate <option>control</option>
31599 modifier that can be used to specify case-sensitive processing within the ACL
31600 (see section <xref linkend="SECTcontrols"/>).
31601 </para>
31602 <para>
31603 <indexterm role="option">
31604 <primary><option>check_local_user</option></primary>
31605 </indexterm>
31606 </para>
31607 <informaltable frame="all">
31608 <tgroup cols="4" colsep="0" rowsep="0">
31609 <colspec colwidth="8*" align="left"/>
31610 <colspec colwidth="6*" align="center"/>
31611 <colspec colwidth="6*" align="center"/>
31612 <colspec colwidth="6*" align="right"/>
31613 <tbody>
31614 <row>
31615 <entry><option>check_local_user</option></entry>
31616 <entry>Use: <emphasis>routers</emphasis>&Dagger;<emphasis></emphasis></entry>
31617 <entry>Type: <emphasis>boolean</emphasis></entry>
31618 <entry>Default: <emphasis>false</emphasis></entry>
31619 </row>
31620 </tbody>
31621 </tgroup>
31622 </informaltable>
31623 <para>
31624 <indexterm role="concept">
31625 <primary>local user, checking in router</primary>
31626 </indexterm>
31627 <indexterm role="concept">
31628 <primary>router</primary>
31629 <secondary>checking for local user</secondary>
31630 </indexterm>
31631 <indexterm role="concept">
31632 <primary><filename>/etc/passwd</filename></primary>
31633 </indexterm>
31634 <indexterm role="variable">
31635 <primary><varname>$home</varname></primary>
31636 </indexterm>
31637 When this option is true, Exim checks that the local part of the recipient
31638 address (with affixes removed if relevant) is the name of an account on the
31639 local system. The check is done by calling the <function>getpwnam()</function> function rather
31640 than trying to read <filename>/etc/passwd</filename> directly. This means that other methods of
31641 holding password data (such as NIS) are supported. If the local part is a local
31642 user, <varname>$home</varname> is set from the password data, and can be tested in other
31643 preconditions that are evaluated after this one (the order of evaluation is
31644 given in section <xref linkend="SECTrouprecon"/>). However, the value of <varname>$home</varname> can be
31645 overridden by <option>router_home_directory</option>. If the local part is not a local user,
31646 the router is skipped.
31647 </para>
31648 <para>
31649 If you want to check that the local part is either the name of a local user
31650 or matches something else, you cannot combine <option>check_local_user</option> with a
31651 setting of <option>local_parts</option>, because that specifies the logical <emphasis>and</emphasis> of the
31652 two conditions. However, you can use a <command>passwd</command> lookup in a <option>local_parts</option>
31653 setting to achieve this. For example:
31654 </para>
31655 <literallayout class="monospaced">
31656 local_parts = passwd;$local_part : lsearch;/etc/other/users
31657 </literallayout>
31658 <para>
31659 Note, however, that the side effects of <option>check_local_user</option> (such as setting
31660 up a home directory) do not occur when a <command>passwd</command> lookup is used in a
31661 <option>local_parts</option> (or any other) precondition.
31662 </para>
31663 <para>
31664 <indexterm role="option">
31665 <primary><option>condition</option></primary>
31666 </indexterm>
31667 </para>
31668 <informaltable frame="all">
31669 <tgroup cols="4" colsep="0" rowsep="0">
31670 <colspec colwidth="8*" align="left"/>
31671 <colspec colwidth="6*" align="center"/>
31672 <colspec colwidth="6*" align="center"/>
31673 <colspec colwidth="6*" align="right"/>
31674 <tbody>
31675 <row>
31676 <entry><option>condition</option></entry>
31677 <entry>Use: <emphasis>routers</emphasis>&Dagger;<emphasis></emphasis></entry>
31678 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
31679 <entry>Default: <emphasis>unset</emphasis></entry>
31680 </row>
31681 </tbody>
31682 </tgroup>
31683 </informaltable>
31684 <para>
31685 <indexterm role="concept">
31686 <primary>router</primary>
31687 <secondary>customized precondition</secondary>
31688 </indexterm>
31689 This option specifies a general precondition test that has to succeed for the
31690 router to be called. The <option>condition</option> option is the last precondition to be
31691 evaluated (see section <xref linkend="SECTrouprecon"/>). The string is expanded, and if the
31692 result is a forced failure, or an empty string, or one of the strings <quote>0</quote> or
31693 <quote>no</quote> or <quote>false</quote> (checked without regard to the case of the letters), the
31694 router is skipped, and the address is offered to the next one.
31695 </para>
31696 <para>
31697 If the result is any other value, the router is run (as this is the last
31698 precondition to be evaluated, all the other preconditions must be true).
31699 </para>
31700 <para>
31701 This option is unusual in that multiple <option>condition</option> options may be present.
31702 All <option>condition</option> options must succeed.
31703 </para>
31704 <para>
31705 The <option>condition</option> option provides a means of applying custom conditions to the
31706 running of routers. Note that in the case of a simple conditional expansion,
31707 the default expansion values are exactly what is wanted. For example:
31708 </para>
31709 <literallayout class="monospaced">
31710 condition = ${if &gt;{$message_age}{600}}
31711 </literallayout>
31712 <para>
31713 Because of the default behaviour of the string expansion, this is equivalent to
31714 </para>
31715 <literallayout class="monospaced">
31716 condition = ${if &gt;{$message_age}{600}{true}{}}
31717 </literallayout>
31718 <para>
31719 A multiple condition example, which succeeds:
31720 </para>
31721 <literallayout class="monospaced">
31722 condition = ${if &gt;{$message_age}{600}}
31723 condition = ${if !eq{${lc:$local_part}}{postmaster}}
31724 condition = foobar
31725 </literallayout>
31726 <para>
31727 If the expansion fails (other than forced failure) delivery is deferred. Some
31728 of the other precondition options are common special cases that could in fact
31729 be specified using <option>condition</option>.
31730 </para>
31731 <para>
31732 Historical note: We have <option>condition</option> on ACLs and on Routers.  Routers
31733 are far older, and use one set of semantics.  ACLs are newer and when
31734 they were created, the ACL <option>condition</option> process was given far stricter
31735 parse semantics.  The <option>bool{}</option> expansion condition uses the same rules as
31736 ACLs.  The <option>bool_lax{}</option> expansion condition uses the same rules as
31737 Routers.  More pointedly, the <option>bool_lax{}</option> was written to match the existing
31738 Router rules processing behavior.
31739 </para>
31740 <para>
31741 This is best illustrated in an example:
31742 </para>
31743 <literallayout class="monospaced">
31744 # If used in an ACL condition will fail with a syntax error, but
31745 # in a router condition any extra characters are treated as a string
31746
31747 $ exim -be '${if eq {${lc:GOOGLE.com}} {google.com}} {yes} {no}}'
31748 true {yes} {no}}
31749
31750 $ exim -be '${if eq {${lc:WHOIS.com}} {google.com}} {yes} {no}}'
31751  {yes} {no}}
31752 </literallayout>
31753 <para>
31754 In each example above, the <option>if</option> statement actually ends after
31755 <quote>{google.com}}</quote>.  Since no true or false braces were defined, the
31756 default <option>if</option> behavior is to return a boolean true or a null answer
31757 (which evaluates to false). The rest of the line is then treated as a
31758 string. So the first example resulted in the boolean answer <quote>true</quote>
31759 with the string <quote> {yes} {no}}</quote> appended to it. The second example
31760 resulted in the null output (indicating false) with the string
31761 <quote> {yes} {no}}</quote> appended to it.
31762 </para>
31763 <para>
31764 In fact you can put excess forward braces in too.  In the router
31765 <option>condition</option>, Exim&#x2019;s parser only looks for <quote>{</quote> symbols when they
31766 mean something, like after a <quote>$</quote> or when required as part of a
31767 conditional.  But otherwise <quote>{</quote> and <quote>}</quote> are treated as ordinary
31768 string characters.
31769 </para>
31770 <para>
31771 Thus, in a Router, the above expansion strings will both always evaluate
31772 true, as the result of expansion is a non-empty string which doesn&#x2019;t
31773 match an explicit false value.  This can be tricky to debug.  By
31774 contrast, in an ACL either of those strings will always result in an
31775 expansion error because the result doesn&#x2019;t look sufficiently boolean.
31776 </para>
31777 <para>
31778 <indexterm role="option">
31779 <primary><option>debug_print</option></primary>
31780 </indexterm>
31781 </para>
31782 <informaltable frame="all">
31783 <tgroup cols="4" colsep="0" rowsep="0">
31784 <colspec colwidth="8*" align="left"/>
31785 <colspec colwidth="6*" align="center"/>
31786 <colspec colwidth="6*" align="center"/>
31787 <colspec colwidth="6*" align="right"/>
31788 <tbody>
31789 <row>
31790 <entry><option>debug_print</option></entry>
31791 <entry>Use: <emphasis>routers</emphasis></entry>
31792 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
31793 <entry>Default: <emphasis>unset</emphasis></entry>
31794 </row>
31795 </tbody>
31796 </tgroup>
31797 </informaltable>
31798 <para>
31799 <indexterm role="concept">
31800 <primary>testing</primary>
31801 <secondary>variables in drivers</secondary>
31802 </indexterm>
31803 If this option is set and debugging is enabled (see the <option>-d</option> command line
31804 option) or in address-testing mode (see the <option>-bt</option> command line option),
31805 the string is expanded and included in the debugging output.
31806 If expansion of the string fails, the error message is written to the debugging
31807 output, and Exim carries on processing.
31808 This option is provided to help with checking out the values of variables and
31809 so on when debugging router configurations. For example, if a <option>condition</option>
31810 option appears not to be working, <option>debug_print</option> can be used to output the
31811 variables it references. The output happens after checks for <option>domains</option>,
31812 <option>local_parts</option>, and <option>check_local_user</option> but before any other preconditions
31813 are tested. A newline is added to the text if it does not end with one.
31814 The variable <varname>$router_name</varname> contains the name of the router.
31815 </para>
31816 <para>
31817 <indexterm role="option">
31818 <primary><option>disable_logging</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>disable_logging</option></entry>
31830 <entry>Use: <emphasis>routers</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 If this option is set true, nothing is logged for any routing errors
31839 or for any deliveries caused by this router. You should not set this option
31840 unless you really, really know what you are doing. See also the generic
31841 transport option of the same name.
31842 </para>
31843 <para revisionflag="changed">
31844 <indexterm role="option">
31845 <primary><option>dnssec_request_domains</option></primary>
31846 </indexterm>
31847 </para>
31848 <informaltable frame="all" revisionflag="changed">
31849 <tgroup cols="4" colsep="0" rowsep="0">
31850 <colspec colwidth="8*" align="left"/>
31851 <colspec colwidth="6*" align="center"/>
31852 <colspec colwidth="6*" align="center"/>
31853 <colspec colwidth="6*" align="right"/>
31854 <tbody>
31855 <row>
31856 <entry><option>dnssec_request_domains</option></entry>
31857 <entry>Use: <emphasis>routers</emphasis></entry>
31858 <entry>Type: <emphasis>domain list</emphasis>&dagger;<emphasis></emphasis></entry>
31859 <entry>Default: <emphasis>unset</emphasis></entry>
31860 </row>
31861 </tbody>
31862 </tgroup>
31863 </informaltable>
31864 <para revisionflag="changed">
31865 <indexterm role="concept">
31866 <primary>MX record</primary>
31867 <secondary>security</secondary>
31868 </indexterm>
31869 <indexterm role="concept">
31870 <primary>DNSSEC</primary>
31871 <secondary>MX lookup</secondary>
31872 </indexterm>
31873 <indexterm role="concept">
31874 <primary>security</primary>
31875 <secondary>MX lookup</secondary>
31876 </indexterm>
31877 <indexterm role="concept">
31878 <primary>DNS</primary>
31879 <secondary>DNSSEC</secondary>
31880 </indexterm>
31881 DNS lookups for domains matching <option>dnssec_request_domains</option> will be done with
31882 the dnssec request bit set.
31883 This applies to all of the SRV, MX, AAAA, A lookup sequence.
31884 </para>
31885 <para revisionflag="changed">
31886 <indexterm role="option">
31887 <primary><option>dnssec_require_domains</option></primary>
31888 </indexterm>
31889 </para>
31890 <informaltable frame="all" revisionflag="changed">
31891 <tgroup cols="4" colsep="0" rowsep="0">
31892 <colspec colwidth="8*" align="left"/>
31893 <colspec colwidth="6*" align="center"/>
31894 <colspec colwidth="6*" align="center"/>
31895 <colspec colwidth="6*" align="right"/>
31896 <tbody>
31897 <row>
31898 <entry><option>dnssec_require_domains</option></entry>
31899 <entry>Use: <emphasis>routers</emphasis></entry>
31900 <entry>Type: <emphasis>domain list</emphasis>&dagger;<emphasis></emphasis></entry>
31901 <entry>Default: <emphasis>unset</emphasis></entry>
31902 </row>
31903 </tbody>
31904 </tgroup>
31905 </informaltable>
31906 <para revisionflag="changed">
31907 <indexterm role="concept">
31908 <primary>MX record</primary>
31909 <secondary>security</secondary>
31910 </indexterm>
31911 <indexterm role="concept">
31912 <primary>DNSSEC</primary>
31913 <secondary>MX lookup</secondary>
31914 </indexterm>
31915 <indexterm role="concept">
31916 <primary>security</primary>
31917 <secondary>MX lookup</secondary>
31918 </indexterm>
31919 <indexterm role="concept">
31920 <primary>DNS</primary>
31921 <secondary>DNSSEC</secondary>
31922 </indexterm>
31923 DNS lookups for domains matching <option>dnssec_request_domains</option> will be done with
31924 the dnssec request bit set.  Any returns not having the Authenticated Data bit
31925 (AD bit) set will be ignored and logged as a host-lookup failure.
31926 This applies to all of the SRV, MX, AAAA, A lookup sequence.
31927 </para>
31928 <para>
31929 <indexterm role="option">
31930 <primary><option>domains</option></primary>
31931 </indexterm>
31932 </para>
31933 <informaltable frame="all">
31934 <tgroup cols="4" colsep="0" rowsep="0">
31935 <colspec colwidth="8*" align="left"/>
31936 <colspec colwidth="6*" align="center"/>
31937 <colspec colwidth="6*" align="center"/>
31938 <colspec colwidth="6*" align="right"/>
31939 <tbody>
31940 <row>
31941 <entry><option>domains</option></entry>
31942 <entry>Use: <emphasis>routers</emphasis>&Dagger;<emphasis></emphasis></entry>
31943 <entry>Type: <emphasis>domain list</emphasis>&dagger;<emphasis></emphasis></entry>
31944 <entry>Default: <emphasis>unset</emphasis></entry>
31945 </row>
31946 </tbody>
31947 </tgroup>
31948 </informaltable>
31949 <para>
31950 <indexterm role="concept">
31951 <primary>router</primary>
31952 <secondary>restricting to specific domains</secondary>
31953 </indexterm>
31954 <indexterm role="variable">
31955 <primary><varname>$domain_data</varname></primary>
31956 </indexterm>
31957 If this option is set, the router is skipped unless the current domain matches
31958 the list. If the match is achieved by means of a file lookup, the data that the
31959 lookup returned for the domain is placed in <varname>$domain_data</varname> for use in string
31960 expansions of the driver&#x2019;s private options. See section <xref linkend="SECTrouprecon"/> for
31961 a list of the order in which preconditions are evaluated.
31962 </para>
31963 <para>
31964 <indexterm role="option">
31965 <primary><option>driver</option></primary>
31966 </indexterm>
31967 </para>
31968 <informaltable frame="all">
31969 <tgroup cols="4" colsep="0" rowsep="0">
31970 <colspec colwidth="8*" align="left"/>
31971 <colspec colwidth="6*" align="center"/>
31972 <colspec colwidth="6*" align="center"/>
31973 <colspec colwidth="6*" align="right"/>
31974 <tbody>
31975 <row>
31976 <entry><option>driver</option></entry>
31977 <entry>Use: <emphasis>routers</emphasis></entry>
31978 <entry>Type: <emphasis>string</emphasis></entry>
31979 <entry>Default: <emphasis>unset</emphasis></entry>
31980 </row>
31981 </tbody>
31982 </tgroup>
31983 </informaltable>
31984 <para>
31985 This option must always be set. It specifies which of the available routers is
31986 to be used.
31987 </para>
31988 <para revisionflag="changed">
31989 <indexterm role="option">
31990 <primary><option>dsn_lasthop</option></primary>
31991 </indexterm>
31992 </para>
31993 <informaltable frame="all" revisionflag="changed">
31994 <tgroup cols="4" colsep="0" rowsep="0">
31995 <colspec colwidth="8*" align="left"/>
31996 <colspec colwidth="6*" align="center"/>
31997 <colspec colwidth="6*" align="center"/>
31998 <colspec colwidth="6*" align="right"/>
31999 <tbody>
32000 <row>
32001 <entry><option>dsn_lasthop</option></entry>
32002 <entry>Use: <emphasis>routers</emphasis></entry>
32003 <entry>Type: <emphasis>boolean</emphasis></entry>
32004 <entry>Default: <emphasis>false</emphasis></entry>
32005 </row>
32006 </tbody>
32007 </tgroup>
32008 </informaltable>
32009 <para revisionflag="changed">
32010 <indexterm role="concept">
32011 <primary>DSN</primary>
32012 <secondary>success</secondary>
32013 </indexterm>
32014 <indexterm role="concept">
32015 <primary>Delivery Status Notification</primary>
32016 <secondary>success</secondary>
32017 </indexterm>
32018 If this option is set true, and extended DSN (RFC3461) processing is in effect,
32019 Exim will not pass on DSN requests to downstream DSN-aware hosts but will
32020 instead send a success DSN as if the next hop does not support DSN.
32021 Not effective on redirect routers.
32022 </para>
32023 <para>
32024 <indexterm role="option">
32025 <primary><option>errors_to</option></primary>
32026 </indexterm>
32027 </para>
32028 <informaltable frame="all">
32029 <tgroup cols="4" colsep="0" rowsep="0">
32030 <colspec colwidth="8*" align="left"/>
32031 <colspec colwidth="6*" align="center"/>
32032 <colspec colwidth="6*" align="center"/>
32033 <colspec colwidth="6*" align="right"/>
32034 <tbody>
32035 <row>
32036 <entry><option>errors_to</option></entry>
32037 <entry>Use: <emphasis>routers</emphasis></entry>
32038 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
32039 <entry>Default: <emphasis>unset</emphasis></entry>
32040 </row>
32041 </tbody>
32042 </tgroup>
32043 </informaltable>
32044 <para>
32045 <indexterm role="concept">
32046 <primary>envelope sender</primary>
32047 </indexterm>
32048 <indexterm role="concept">
32049 <primary>router</primary>
32050 <secondary>changing address for errors</secondary>
32051 </indexterm>
32052 If a router successfully handles an address, it may assign the address to a
32053 transport for delivery or it may generate child addresses. In both cases, if
32054 there is a delivery problem during later processing, the resulting bounce
32055 message is sent to the address that results from expanding this string,
32056 provided that the address verifies successfully. The <option>errors_to</option> option is
32057 expanded before <option>headers_add</option>, <option>headers_remove</option>, and <option>transport</option>.
32058 </para>
32059 <para>
32060 The <option>errors_to</option> setting associated with an address can be overridden if it
32061 subsequently passes through other routers that have their own <option>errors_to</option>
32062 settings, or if the message is delivered by a transport with a <option>return_path</option>
32063 setting.
32064 </para>
32065 <para>
32066 If <option>errors_to</option> is unset, or the expansion is forced to fail, or the result of
32067 the expansion fails to verify, the errors address associated with the incoming
32068 address is used. At top level, this is the envelope sender. A non-forced
32069 expansion failure causes delivery to be deferred.
32070 </para>
32071 <para>
32072 If an address for which <option>errors_to</option> has been set ends up being delivered over
32073 SMTP, the envelope sender for that delivery is the <option>errors_to</option> value, so that
32074 any bounces that are generated by other MTAs on the delivery route are also
32075 sent there. You can set <option>errors_to</option> to the empty string by either of these
32076 settings:
32077 </para>
32078 <literallayout class="monospaced">
32079 errors_to =
32080 errors_to = ""
32081 </literallayout>
32082 <para>
32083 An expansion item that yields an empty string has the same effect. If you do
32084 this, a locally detected delivery error for addresses processed by this router
32085 no longer gives rise to a bounce message; the error is discarded. If the
32086 address is delivered to a remote host, the return path is set to <literal>&lt;&gt;</literal>, unless
32087 overridden by the <option>return_path</option> option on the transport.
32088 </para>
32089 <para>
32090 <indexterm role="variable">
32091 <primary><varname>$address_data</varname></primary>
32092 </indexterm>
32093 If for some reason you want to discard local errors, but use a non-empty
32094 MAIL command for remote delivery, you can preserve the original return
32095 path in <varname>$address_data</varname> in the router, and reinstate it in the transport by
32096 setting <option>return_path</option>.
32097 </para>
32098 <para>
32099 The most common use of <option>errors_to</option> is to direct mailing list bounces to the
32100 manager of the list, as described in section <xref linkend="SECTmailinglists"/>, or to
32101 implement VERP (Variable Envelope Return Paths) (see section <xref linkend="SECTverp"/>).
32102 </para>
32103 <para>
32104 <indexterm role="option">
32105 <primary><option>expn</option></primary>
32106 </indexterm>
32107 </para>
32108 <informaltable frame="all">
32109 <tgroup cols="4" colsep="0" rowsep="0">
32110 <colspec colwidth="8*" align="left"/>
32111 <colspec colwidth="6*" align="center"/>
32112 <colspec colwidth="6*" align="center"/>
32113 <colspec colwidth="6*" align="right"/>
32114 <tbody>
32115 <row>
32116 <entry><option>expn</option></entry>
32117 <entry>Use: <emphasis>routers</emphasis>&Dagger;<emphasis></emphasis></entry>
32118 <entry>Type: <emphasis>boolean</emphasis></entry>
32119 <entry>Default: <emphasis>true</emphasis></entry>
32120 </row>
32121 </tbody>
32122 </tgroup>
32123 </informaltable>
32124 <para>
32125 <indexterm role="concept">
32126 <primary>address</primary>
32127 <secondary>testing</secondary>
32128 </indexterm>
32129 <indexterm role="concept">
32130 <primary>testing</primary>
32131 <secondary>addresses</secondary>
32132 </indexterm>
32133 <indexterm role="concept">
32134 <primary>EXPN</primary>
32135 <secondary>router skipping</secondary>
32136 </indexterm>
32137 <indexterm role="concept">
32138 <primary>router</primary>
32139 <secondary>skipping for EXPN</secondary>
32140 </indexterm>
32141 If this option is turned off, the router is skipped when testing an address
32142 as a result of processing an SMTP EXPN command. You might, for example,
32143 want to turn it off on a router for users&#x2019; <filename>.forward</filename> files, while leaving it
32144 on for the system alias file.
32145 See section <xref linkend="SECTrouprecon"/> for a list of the order in which preconditions
32146 are evaluated.
32147 </para>
32148 <para>
32149 The use of the SMTP EXPN command is controlled by an ACL (see chapter
32150 <xref linkend="CHAPACL"/>). When Exim is running an EXPN command, it is similar to testing
32151 an address with <option>-bt</option>. Compare VRFY, whose counterpart is <option>-bv</option>.
32152 </para>
32153 <para>
32154 <indexterm role="option">
32155 <primary><option>fail_verify</option></primary>
32156 </indexterm>
32157 </para>
32158 <informaltable frame="all">
32159 <tgroup cols="4" colsep="0" rowsep="0">
32160 <colspec colwidth="8*" align="left"/>
32161 <colspec colwidth="6*" align="center"/>
32162 <colspec colwidth="6*" align="center"/>
32163 <colspec colwidth="6*" align="right"/>
32164 <tbody>
32165 <row>
32166 <entry><option>fail_verify</option></entry>
32167 <entry>Use: <emphasis>routers</emphasis></entry>
32168 <entry>Type: <emphasis>boolean</emphasis></entry>
32169 <entry>Default: <emphasis>false</emphasis></entry>
32170 </row>
32171 </tbody>
32172 </tgroup>
32173 </informaltable>
32174 <para>
32175 <indexterm role="concept">
32176 <primary>router</primary>
32177 <secondary>forcing verification failure</secondary>
32178 </indexterm>
32179 Setting this option has the effect of setting both <option>fail_verify_sender</option> and
32180 <option>fail_verify_recipient</option> to the same value.
32181 </para>
32182 <para>
32183 <indexterm role="option">
32184 <primary><option>fail_verify_recipient</option></primary>
32185 </indexterm>
32186 </para>
32187 <informaltable frame="all">
32188 <tgroup cols="4" colsep="0" rowsep="0">
32189 <colspec colwidth="8*" align="left"/>
32190 <colspec colwidth="6*" align="center"/>
32191 <colspec colwidth="6*" align="center"/>
32192 <colspec colwidth="6*" align="right"/>
32193 <tbody>
32194 <row>
32195 <entry><option>fail_verify_recipient</option></entry>
32196 <entry>Use: <emphasis>routers</emphasis></entry>
32197 <entry>Type: <emphasis>boolean</emphasis></entry>
32198 <entry>Default: <emphasis>false</emphasis></entry>
32199 </row>
32200 </tbody>
32201 </tgroup>
32202 </informaltable>
32203 <para>
32204 If this option is true and an address is accepted by this router when
32205 verifying a recipient, verification fails.
32206 </para>
32207 <para>
32208 <indexterm role="option">
32209 <primary><option>fail_verify_sender</option></primary>
32210 </indexterm>
32211 </para>
32212 <informaltable frame="all">
32213 <tgroup cols="4" colsep="0" rowsep="0">
32214 <colspec colwidth="8*" align="left"/>
32215 <colspec colwidth="6*" align="center"/>
32216 <colspec colwidth="6*" align="center"/>
32217 <colspec colwidth="6*" align="right"/>
32218 <tbody>
32219 <row>
32220 <entry><option>fail_verify_sender</option></entry>
32221 <entry>Use: <emphasis>routers</emphasis></entry>
32222 <entry>Type: <emphasis>boolean</emphasis></entry>
32223 <entry>Default: <emphasis>false</emphasis></entry>
32224 </row>
32225 </tbody>
32226 </tgroup>
32227 </informaltable>
32228 <para>
32229 If this option is true and an address is accepted by this router when
32230 verifying a sender, verification fails.
32231 </para>
32232 <para>
32233 <indexterm role="option">
32234 <primary><option>fallback_hosts</option></primary>
32235 </indexterm>
32236 </para>
32237 <informaltable frame="all">
32238 <tgroup cols="4" colsep="0" rowsep="0">
32239 <colspec colwidth="8*" align="left"/>
32240 <colspec colwidth="6*" align="center"/>
32241 <colspec colwidth="6*" align="center"/>
32242 <colspec colwidth="6*" align="right"/>
32243 <tbody>
32244 <row>
32245 <entry><option>fallback_hosts</option></entry>
32246 <entry>Use: <emphasis>routers</emphasis></entry>
32247 <entry>Type: <emphasis>string list</emphasis></entry>
32248 <entry>Default: <emphasis>unset</emphasis></entry>
32249 </row>
32250 </tbody>
32251 </tgroup>
32252 </informaltable>
32253 <para>
32254 <indexterm role="concept">
32255 <primary>router</primary>
32256 <secondary>fallback hosts</secondary>
32257 </indexterm>
32258 <indexterm role="concept">
32259 <primary>fallback</primary>
32260 <secondary>hosts specified on router</secondary>
32261 </indexterm>
32262 String expansion is not applied to this option. The argument must be a
32263 colon-separated list of host names or IP addresses. The list separator can be
32264 changed (see section <xref linkend="SECTlistconstruct"/>), and a port can be specified with
32265 each name or address. In fact, the format of each item is exactly the same as
32266 defined for the list of hosts in a <command>manualroute</command> router (see section
32267 <xref linkend="SECTformatonehostitem"/>).
32268 </para>
32269 <para>
32270 If a router queues an address for a remote transport, this host list is
32271 associated with the address, and used instead of the transport&#x2019;s fallback host
32272 list. If <option>hosts_randomize</option> is set on the transport, the order of the list is
32273 randomized for each use. See the <option>fallback_hosts</option> option of the <command>smtp</command>
32274 transport for further details.
32275 </para>
32276 <para>
32277 <indexterm role="option">
32278 <primary><option>group</option></primary>
32279 </indexterm>
32280 </para>
32281 <informaltable frame="all">
32282 <tgroup cols="4" colsep="0" rowsep="0">
32283 <colspec colwidth="8*" align="left"/>
32284 <colspec colwidth="6*" align="center"/>
32285 <colspec colwidth="6*" align="center"/>
32286 <colspec colwidth="6*" align="right"/>
32287 <tbody>
32288 <row>
32289 <entry><option>group</option></entry>
32290 <entry>Use: <emphasis>routers</emphasis></entry>
32291 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
32292 <entry>Default: <emphasis>see below</emphasis></entry>
32293 </row>
32294 </tbody>
32295 </tgroup>
32296 </informaltable>
32297 <para>
32298 <indexterm role="concept">
32299 <primary>gid (group id)</primary>
32300 <secondary>local delivery</secondary>
32301 </indexterm>
32302 <indexterm role="concept">
32303 <primary>local transports</primary>
32304 <secondary>uid and gid</secondary>
32305 </indexterm>
32306 <indexterm role="concept">
32307 <primary>transport</primary>
32308 <secondary>local</secondary>
32309 </indexterm>
32310 <indexterm role="concept">
32311 <primary>router</primary>
32312 <secondary>setting group</secondary>
32313 </indexterm>
32314 When a router queues an address for a transport, and the transport does not
32315 specify a group, the group given here is used when running the delivery
32316 process.
32317 The group may be specified numerically or by name. If expansion fails, the
32318 error is logged and delivery is deferred.
32319 The default is unset, unless <option>check_local_user</option> is set, when the default
32320 is taken from the password information. See also <option>initgroups</option> and <option>user</option>
32321 and the discussion in chapter <xref linkend="CHAPenvironment"/>.
32322 </para>
32323 <para>
32324 <indexterm role="option">
32325 <primary><option>headers_add</option></primary>
32326 </indexterm>
32327 </para>
32328 <informaltable frame="all">
32329 <tgroup cols="4" colsep="0" rowsep="0">
32330 <colspec colwidth="8*" align="left"/>
32331 <colspec colwidth="6*" align="center"/>
32332 <colspec colwidth="6*" align="center"/>
32333 <colspec colwidth="6*" align="right"/>
32334 <tbody>
32335 <row>
32336 <entry><option>headers_add</option></entry>
32337 <entry>Use: <emphasis>routers</emphasis></entry>
32338 <entry>Type: <emphasis>list</emphasis>&dagger;<emphasis></emphasis></entry>
32339 <entry>Default: <emphasis>unset</emphasis></entry>
32340 </row>
32341 </tbody>
32342 </tgroup>
32343 </informaltable>
32344 <para>
32345 <indexterm role="concept">
32346 <primary>header lines</primary>
32347 <secondary>adding</secondary>
32348 </indexterm>
32349 <indexterm role="concept">
32350 <primary>router</primary>
32351 <secondary>adding header lines</secondary>
32352 </indexterm>
32353 This option specifies a list of text headers,
32354 </para>
32355 <para revisionflag="changed">
32356 newline-separated (by default, changeable in the usual way),
32357 </para>
32358 <para>
32359 that is associated with any addresses that are accepted by the router.
32360 Each item is separately expanded, at routing time.  However, this
32361 option has no effect when an address is just being verified. The way in which
32362 the text is used to add header lines at transport time is described in section
32363 <xref linkend="SECTheadersaddrem"/>. New header lines are not actually added until the
32364 message is in the process of being transported. This means that references to
32365 header lines in string expansions in the transport&#x2019;s configuration do not
32366 <quote>see</quote> the added header lines.
32367 </para>
32368 <para>
32369 The <option>headers_add</option> option is expanded after <option>errors_to</option>, but before
32370 <option>headers_remove</option> and <option>transport</option>. If an item is empty, or if
32371 an item expansion is forced to fail, the item has no effect. Other expansion
32372 failures are treated as configuration errors.
32373 </para>
32374 <para>
32375 Unlike most options, <option>headers_add</option> can be specified multiple times
32376 for a router; all listed headers are added.
32377 </para>
32378 <para>
32379 <emphasis role="bold">Warning 1</emphasis>: The <option>headers_add</option> option cannot be used for a <command>redirect</command>
32380 router that has the <option>one_time</option> option set.
32381 </para>
32382 <para>
32383 <indexterm role="concept">
32384 <primary>duplicate addresses</primary>
32385 </indexterm>
32386 <indexterm role="option">
32387 <primary><option>unseen</option></primary>
32388 </indexterm>
32389 <emphasis role="bold">Warning 2</emphasis>: If the <option>unseen</option> option is set on the router, all header
32390 additions are deleted when the address is passed on to subsequent routers.
32391 For a <option>redirect</option> router, if a generated address is the same as the incoming
32392 address, this can lead to duplicate addresses with different header
32393 modifications. Exim does not do duplicate deliveries (except, in certain
32394 circumstances, to pipes -- see section <xref linkend="SECTdupaddr"/>), but it is undefined
32395 which of the duplicates is discarded, so this ambiguous situation should be
32396 avoided. The <option>repeat_use</option> option of the <option>redirect</option> router may be of help.
32397 </para>
32398 <para>
32399 <indexterm role="option">
32400 <primary><option>headers_remove</option></primary>
32401 </indexterm>
32402 </para>
32403 <informaltable frame="all">
32404 <tgroup cols="4" colsep="0" rowsep="0">
32405 <colspec colwidth="8*" align="left"/>
32406 <colspec colwidth="6*" align="center"/>
32407 <colspec colwidth="6*" align="center"/>
32408 <colspec colwidth="6*" align="right"/>
32409 <tbody>
32410 <row>
32411 <entry><option>headers_remove</option></entry>
32412 <entry>Use: <emphasis>routers</emphasis></entry>
32413 <entry>Type: <emphasis>list</emphasis>&dagger;<emphasis></emphasis></entry>
32414 <entry>Default: <emphasis>unset</emphasis></entry>
32415 </row>
32416 </tbody>
32417 </tgroup>
32418 </informaltable>
32419 <para>
32420 <indexterm role="concept">
32421 <primary>header lines</primary>
32422 <secondary>removing</secondary>
32423 </indexterm>
32424 <indexterm role="concept">
32425 <primary>router</primary>
32426 <secondary>removing header lines</secondary>
32427 </indexterm>
32428 This option specifies a list of text headers,
32429 </para>
32430 <para revisionflag="changed">
32431 colon-separated (by default, changeable in the usual way),
32432 </para>
32433 <para>
32434 that is associated with any addresses that are accepted by the router.
32435 Each item is separately expanded, at routing time.  However, this
32436 option has no effect when an address is just being verified. The way in which
32437 the text is used to remove header lines at transport time is described in
32438 section <xref linkend="SECTheadersaddrem"/>. Header lines are not actually removed until
32439 the message is in the process of being transported. This means that references
32440 to header lines in string expansions in the transport&#x2019;s configuration still
32441 <quote>see</quote> the original header lines.
32442 </para>
32443 <para>
32444 The <option>headers_remove</option> option is expanded after <option>errors_to</option> and
32445 <option>headers_add</option>, but before <option>transport</option>. If an item expansion is forced to fail,
32446 the item has no effect. Other expansion failures are treated as configuration
32447 errors.
32448 </para>
32449 <para>
32450 Unlike most options, <option>headers_remove</option> can be specified multiple times
32451 for a router; all listed headers are removed.
32452 </para>
32453 <para>
32454 <emphasis role="bold">Warning 1</emphasis>: The <option>headers_remove</option> option cannot be used for a <command>redirect</command>
32455 router that has the <option>one_time</option> option set.
32456 </para>
32457 <para>
32458 <emphasis role="bold">Warning 2</emphasis>: If the <option>unseen</option> option is set on the router, all header
32459 removal requests are deleted when the address is passed on to subsequent
32460 routers, and this can lead to problems with duplicates -- see the similar
32461 warning for <option>headers_add</option> above.
32462 </para>
32463 <para revisionflag="changed">
32464 <emphasis role="bold">Warning 3</emphasis>: Because of the separate expansion of the list items,
32465 items that contain a list separator must have it doubled.
32466 To avoid this, change the list separator (<xref linkend="SECTlistsepchange"/>).
32467 </para>
32468 <para>
32469 <indexterm role="option">
32470 <primary><option>ignore_target_hosts</option></primary>
32471 </indexterm>
32472 </para>
32473 <informaltable frame="all">
32474 <tgroup cols="4" colsep="0" rowsep="0">
32475 <colspec colwidth="8*" align="left"/>
32476 <colspec colwidth="6*" align="center"/>
32477 <colspec colwidth="6*" align="center"/>
32478 <colspec colwidth="6*" align="right"/>
32479 <tbody>
32480 <row>
32481 <entry><option>ignore_target_hosts</option></entry>
32482 <entry>Use: <emphasis>routers</emphasis></entry>
32483 <entry>Type: <emphasis>host list</emphasis>&dagger;<emphasis></emphasis></entry>
32484 <entry>Default: <emphasis>unset</emphasis></entry>
32485 </row>
32486 </tbody>
32487 </tgroup>
32488 </informaltable>
32489 <para>
32490 <indexterm role="concept">
32491 <primary>IP address</primary>
32492 <secondary>discarding</secondary>
32493 </indexterm>
32494 <indexterm role="concept">
32495 <primary>router</primary>
32496 <secondary>discarding IP addresses</secondary>
32497 </indexterm>
32498 Although this option is a host list, it should normally contain IP address
32499 entries rather than names. If any host that is looked up by the router has an
32500 IP address that matches an item in this list, Exim behaves as if that IP
32501 address did not exist. This option allows you to cope with rogue DNS entries
32502 like
32503 </para>
32504 <literallayout class="monospaced">
32505 remote.domain.example.  A  127.0.0.1
32506 </literallayout>
32507 <para>
32508 by setting
32509 </para>
32510 <literallayout class="monospaced">
32511 ignore_target_hosts = 127.0.0.1
32512 </literallayout>
32513 <para>
32514 on the relevant router. If all the hosts found by a <command>dnslookup</command> router are
32515 discarded in this way, the router declines. In a conventional configuration, an
32516 attempt to mail to such a domain would normally provoke the <quote>unrouteable
32517 domain</quote> error, and an attempt to verify an address in the domain would fail.
32518 Similarly, if <option>ignore_target_hosts</option> is set on an <command>ipliteral</command> router, the
32519 router declines if presented with one of the listed addresses.
32520 </para>
32521 <para>
32522 You can use this option to disable the use of IPv4 or IPv6 for mail delivery by
32523 means of the first or the second of the following settings, respectively:
32524 </para>
32525 <literallayout class="monospaced">
32526 ignore_target_hosts = 0.0.0.0/0
32527 ignore_target_hosts = &lt;; 0::0/0
32528 </literallayout>
32529 <para>
32530 The pattern in the first line matches all IPv4 addresses, whereas the pattern
32531 in the second line matches all IPv6 addresses.
32532 </para>
32533 <para>
32534 This option may also be useful for ignoring link-local and site-local IPv6
32535 addresses. Because, like all host lists, the value of <option>ignore_target_hosts</option>
32536 is expanded before use as a list, it is possible to make it dependent on the
32537 domain that is being routed.
32538 </para>
32539 <para>
32540 <indexterm role="variable">
32541 <primary><varname>$host_address</varname></primary>
32542 </indexterm>
32543 During its expansion, <varname>$host_address</varname> is set to the IP address that is being
32544 checked.
32545 </para>
32546 <para>
32547 <indexterm role="option">
32548 <primary><option>initgroups</option></primary>
32549 </indexterm>
32550 </para>
32551 <informaltable frame="all">
32552 <tgroup cols="4" colsep="0" rowsep="0">
32553 <colspec colwidth="8*" align="left"/>
32554 <colspec colwidth="6*" align="center"/>
32555 <colspec colwidth="6*" align="center"/>
32556 <colspec colwidth="6*" align="right"/>
32557 <tbody>
32558 <row>
32559 <entry><option>initgroups</option></entry>
32560 <entry>Use: <emphasis>routers</emphasis></entry>
32561 <entry>Type: <emphasis>boolean</emphasis></entry>
32562 <entry>Default: <emphasis>false</emphasis></entry>
32563 </row>
32564 </tbody>
32565 </tgroup>
32566 </informaltable>
32567 <para>
32568 <indexterm role="concept">
32569 <primary>additional groups</primary>
32570 </indexterm>
32571 <indexterm role="concept">
32572 <primary>groups</primary>
32573 <secondary>additional</secondary>
32574 </indexterm>
32575 <indexterm role="concept">
32576 <primary>local transports</primary>
32577 <secondary>uid and gid</secondary>
32578 </indexterm>
32579 <indexterm role="concept">
32580 <primary>transport</primary>
32581 <secondary>local</secondary>
32582 </indexterm>
32583 If the router queues an address for a transport, and this option is true, and
32584 the uid supplied by the router is not overridden by the transport, the
32585 <function>initgroups()</function> function is called when running the transport to ensure that
32586 any additional groups associated with the uid are set up. See also <option>group</option>
32587 and <option>user</option> and the discussion in chapter <xref linkend="CHAPenvironment"/>.
32588 </para>
32589 <para>
32590 <indexterm role="option">
32591 <primary><option>local_part_prefix</option></primary>
32592 </indexterm>
32593 </para>
32594 <informaltable frame="all">
32595 <tgroup cols="4" colsep="0" rowsep="0">
32596 <colspec colwidth="8*" align="left"/>
32597 <colspec colwidth="6*" align="center"/>
32598 <colspec colwidth="6*" align="center"/>
32599 <colspec colwidth="6*" align="right"/>
32600 <tbody>
32601 <row>
32602 <entry><option>local_part_prefix</option></entry>
32603 <entry>Use: <emphasis>routers</emphasis>&Dagger;<emphasis></emphasis></entry>
32604 <entry>Type: <emphasis>string list</emphasis></entry>
32605 <entry>Default: <emphasis>unset</emphasis></entry>
32606 </row>
32607 </tbody>
32608 </tgroup>
32609 </informaltable>
32610 <para>
32611 <indexterm role="concept">
32612 <primary>router</primary>
32613 <secondary>prefix for local part</secondary>
32614 </indexterm>
32615 <indexterm role="concept">
32616 <primary>prefix</primary>
32617 <secondary>for local part, used in router</secondary>
32618 </indexterm>
32619 If this option is set, the router is skipped unless the local part starts with
32620 one of the given strings, or <option>local_part_prefix_optional</option> is true. See
32621 section <xref linkend="SECTrouprecon"/> for a list of the order in which preconditions are
32622 evaluated.
32623 </para>
32624 <para>
32625 The list is scanned from left to right, and the first prefix that matches is
32626 used. A limited form of wildcard is available; if the prefix begins with an
32627 asterisk, it matches the longest possible sequence of arbitrary characters at
32628 the start of the local part. An asterisk should therefore always be followed by
32629 some character that does not occur in normal local parts.
32630 <indexterm role="concept">
32631 <primary>multiple mailboxes</primary>
32632 </indexterm>
32633 <indexterm role="concept">
32634 <primary>mailbox</primary>
32635 <secondary>multiple</secondary>
32636 </indexterm>
32637 Wildcarding can be used to set up multiple user mailboxes, as described in
32638 section <xref linkend="SECTmulbox"/>.
32639 </para>
32640 <para>
32641 <indexterm role="variable">
32642 <primary><varname>$local_part</varname></primary>
32643 </indexterm>
32644 <indexterm role="variable">
32645 <primary><varname>$local_part_prefix</varname></primary>
32646 </indexterm>
32647 During the testing of the <option>local_parts</option> option, and while the router is
32648 running, the prefix is removed from the local part, and is available in the
32649 expansion variable <varname>$local_part_prefix</varname>. When a message is being delivered, if
32650 the router accepts the address, this remains true during subsequent delivery by
32651 a transport. In particular, the local part that is transmitted in the RCPT
32652 command for LMTP, SMTP, and BSMTP deliveries has the prefix removed by default.
32653 This behaviour can be overridden by setting <option>rcpt_include_affixes</option> true on
32654 the relevant transport.
32655 </para>
32656 <para>
32657 When an address is being verified, <option>local_part_prefix</option> affects only the
32658 behaviour of the router. If the callout feature of verification is in use, this
32659 means that the full address, including the prefix, will be used during the
32660 callout.
32661 </para>
32662 <para>
32663 The prefix facility is commonly used to handle local parts of the form
32664 <option>owner-something</option>. Another common use is to support local parts of the form
32665 <option>real-username</option> to bypass a user&#x2019;s <filename>.forward</filename> file &ndash; helpful when trying
32666 to tell a user their forwarding is broken &ndash; by placing a router like this one
32667 immediately before the router that handles <filename>.forward</filename> files:
32668 </para>
32669 <literallayout class="monospaced">
32670 real_localuser:
32671   driver = accept
32672   local_part_prefix = real-
32673   check_local_user
32674   transport = local_delivery
32675 </literallayout>
32676 <para>
32677 For security, it would probably be a good idea to restrict the use of this
32678 router to locally-generated messages, using a condition such as this:
32679 </para>
32680 <literallayout class="monospaced">
32681   condition = ${if match {$sender_host_address}\
32682                          {\N^(|127\.0\.0\.1)$\N}}
32683 </literallayout>
32684 <para>
32685 If both <option>local_part_prefix</option> and <option>local_part_suffix</option> are set for a router,
32686 both conditions must be met if not optional. Care must be taken if wildcards
32687 are used in both a prefix and a suffix on the same router. Different
32688 separator characters must be used to avoid ambiguity.
32689 </para>
32690 <para>
32691 <indexterm role="option">
32692 <primary><option>local_part_prefix_optional</option></primary>
32693 </indexterm>
32694 </para>
32695 <informaltable frame="all">
32696 <tgroup cols="4" colsep="0" rowsep="0">
32697 <colspec colwidth="8*" align="left"/>
32698 <colspec colwidth="6*" align="center"/>
32699 <colspec colwidth="6*" align="center"/>
32700 <colspec colwidth="6*" align="right"/>
32701 <tbody>
32702 <row>
32703 <entry><option>local_part_prefix_optional</option></entry>
32704 <entry>Use: <emphasis>routers</emphasis></entry>
32705 <entry>Type: <emphasis>boolean</emphasis></entry>
32706 <entry>Default: <emphasis>false</emphasis></entry>
32707 </row>
32708 </tbody>
32709 </tgroup>
32710 </informaltable>
32711 <para>
32712 See <option>local_part_prefix</option> above.
32713 </para>
32714 <para>
32715 <indexterm role="option">
32716 <primary><option>local_part_suffix</option></primary>
32717 </indexterm>
32718 </para>
32719 <informaltable frame="all">
32720 <tgroup cols="4" colsep="0" rowsep="0">
32721 <colspec colwidth="8*" align="left"/>
32722 <colspec colwidth="6*" align="center"/>
32723 <colspec colwidth="6*" align="center"/>
32724 <colspec colwidth="6*" align="right"/>
32725 <tbody>
32726 <row>
32727 <entry><option>local_part_suffix</option></entry>
32728 <entry>Use: <emphasis>routers</emphasis>&Dagger;<emphasis></emphasis></entry>
32729 <entry>Type: <emphasis>string list</emphasis></entry>
32730 <entry>Default: <emphasis>unset</emphasis></entry>
32731 </row>
32732 </tbody>
32733 </tgroup>
32734 </informaltable>
32735 <para>
32736 <indexterm role="concept">
32737 <primary>router</primary>
32738 <secondary>suffix for local part</secondary>
32739 </indexterm>
32740 <indexterm role="concept">
32741 <primary>suffix for local part</primary>
32742 <secondary>used in router</secondary>
32743 </indexterm>
32744 This option operates in the same way as <option>local_part_prefix</option>, except that the
32745 local part must end (rather than start) with the given string, the
32746 <option>local_part_suffix_optional</option> option determines whether the suffix is
32747 mandatory, and the wildcard * character, if present, must be the last
32748 character of the suffix. This option facility is commonly used to handle local
32749 parts of the form <option>something-request</option> and multiple user mailboxes of the form
32750 <option>username-foo</option>.
32751 </para>
32752 <para>
32753 <indexterm role="option">
32754 <primary><option>local_part_suffix_optional</option></primary>
32755 </indexterm>
32756 </para>
32757 <informaltable frame="all">
32758 <tgroup cols="4" colsep="0" rowsep="0">
32759 <colspec colwidth="8*" align="left"/>
32760 <colspec colwidth="6*" align="center"/>
32761 <colspec colwidth="6*" align="center"/>
32762 <colspec colwidth="6*" align="right"/>
32763 <tbody>
32764 <row>
32765 <entry><option>local_part_suffix_optional</option></entry>
32766 <entry>Use: <emphasis>routers</emphasis></entry>
32767 <entry>Type: <emphasis>boolean</emphasis></entry>
32768 <entry>Default: <emphasis>false</emphasis></entry>
32769 </row>
32770 </tbody>
32771 </tgroup>
32772 </informaltable>
32773 <para>
32774 See <option>local_part_suffix</option> above.
32775 </para>
32776 <para>
32777 <indexterm role="option">
32778 <primary><option>local_parts</option></primary>
32779 </indexterm>
32780 </para>
32781 <informaltable frame="all">
32782 <tgroup cols="4" colsep="0" rowsep="0">
32783 <colspec colwidth="8*" align="left"/>
32784 <colspec colwidth="6*" align="center"/>
32785 <colspec colwidth="6*" align="center"/>
32786 <colspec colwidth="6*" align="right"/>
32787 <tbody>
32788 <row>
32789 <entry><option>local_parts</option></entry>
32790 <entry>Use: <emphasis>routers</emphasis>&Dagger;<emphasis></emphasis></entry>
32791 <entry>Type: <emphasis>local part list</emphasis>&dagger;<emphasis></emphasis></entry>
32792 <entry>Default: <emphasis>unset</emphasis></entry>
32793 </row>
32794 </tbody>
32795 </tgroup>
32796 </informaltable>
32797 <para>
32798 <indexterm role="concept">
32799 <primary>router</primary>
32800 <secondary>restricting to specific local parts</secondary>
32801 </indexterm>
32802 <indexterm role="concept">
32803 <primary>local part</primary>
32804 <secondary>checking in router</secondary>
32805 </indexterm>
32806 The router is run only if the local part of the address matches the list.
32807 See section <xref linkend="SECTrouprecon"/> for a list of the order in which preconditions
32808 are evaluated, and
32809 section <xref linkend="SECTlocparlis"/> for a discussion of local part lists. Because the
32810 string is expanded, it is possible to make it depend on the domain, for
32811 example:
32812 </para>
32813 <literallayout class="monospaced">
32814 local_parts = dbm;/usr/local/specials/$domain
32815 </literallayout>
32816 <para>
32817 <indexterm role="variable">
32818 <primary><varname>$local_part_data</varname></primary>
32819 </indexterm>
32820 If the match is achieved by a lookup, the data that the lookup returned
32821 for the local part is placed in the variable <varname>$local_part_data</varname> for use in
32822 expansions of the router&#x2019;s private options. You might use this option, for
32823 example, if you have a large number of local virtual domains, and you want to
32824 send all postmaster mail to the same place without having to set up an alias in
32825 each virtual domain:
32826 </para>
32827 <literallayout class="monospaced">
32828 postmaster:
32829   driver = redirect
32830   local_parts = postmaster
32831   data = postmaster@real.domain.example
32832 </literallayout>
32833 <para>
32834 <indexterm role="option">
32835 <primary><option>log_as_local</option></primary>
32836 </indexterm>
32837 </para>
32838 <informaltable frame="all">
32839 <tgroup cols="4" colsep="0" rowsep="0">
32840 <colspec colwidth="8*" align="left"/>
32841 <colspec colwidth="6*" align="center"/>
32842 <colspec colwidth="6*" align="center"/>
32843 <colspec colwidth="6*" align="right"/>
32844 <tbody>
32845 <row>
32846 <entry><option>log_as_local</option></entry>
32847 <entry>Use: <emphasis>routers</emphasis></entry>
32848 <entry>Type: <emphasis>boolean</emphasis></entry>
32849 <entry>Default: <emphasis>see below</emphasis></entry>
32850 </row>
32851 </tbody>
32852 </tgroup>
32853 </informaltable>
32854 <para>
32855 <indexterm role="concept">
32856 <primary>log</primary>
32857 <secondary>delivery line</secondary>
32858 </indexterm>
32859 <indexterm role="concept">
32860 <primary>delivery</primary>
32861 <secondary>log line format</secondary>
32862 </indexterm>
32863 Exim has two logging styles for delivery, the idea being to make local
32864 deliveries stand out more visibly from remote ones. In the <quote>local</quote> style, the
32865 recipient address is given just as the local part, without a domain. The use of
32866 this style is controlled by this option. It defaults to true for the <command>accept</command>
32867 router, and false for all the others. This option applies only when a
32868 router assigns an address to a transport. It has no effect on routers that
32869 redirect addresses.
32870 </para>
32871 <para>
32872 <indexterm role="option">
32873 <primary><option>more</option></primary>
32874 </indexterm>
32875 </para>
32876 <informaltable frame="all">
32877 <tgroup cols="4" colsep="0" rowsep="0">
32878 <colspec colwidth="8*" align="left"/>
32879 <colspec colwidth="6*" align="center"/>
32880 <colspec colwidth="6*" align="center"/>
32881 <colspec colwidth="6*" align="right"/>
32882 <tbody>
32883 <row>
32884 <entry><option>more</option></entry>
32885 <entry>Use: <emphasis>routers</emphasis></entry>
32886 <entry>Type: <emphasis>boolean</emphasis>&dagger;<emphasis></emphasis></entry>
32887 <entry>Default: <emphasis>true</emphasis></entry>
32888 </row>
32889 </tbody>
32890 </tgroup>
32891 </informaltable>
32892 <para>
32893 The result of string expansion for this option must be a valid boolean value,
32894 that is, one of the strings <quote>yes</quote>, <quote>no</quote>, <quote>true</quote>, or <quote>false</quote>. Any other
32895 result causes an error, and delivery is deferred. If the expansion is forced to
32896 fail, the default value for the option (true) is used. Other failures cause
32897 delivery to be deferred.
32898 </para>
32899 <para>
32900 If this option is set false, and the router declines to handle the address, no
32901 further routers are tried, routing fails, and the address is bounced.
32902 <indexterm role="option">
32903 <primary><option>self</option></primary>
32904 </indexterm>
32905 However, if the router explicitly passes an address to the following router by
32906 means of the setting
32907 </para>
32908 <literallayout class="monospaced">
32909 self = pass
32910 </literallayout>
32911 <para>
32912 or otherwise, the setting of <option>more</option> is ignored. Also, the setting of <option>more</option>
32913 does not affect the behaviour if one of the precondition tests fails. In that
32914 case, the address is always passed to the next router.
32915 </para>
32916 <para>
32917 Note that <option>address_data</option> is not considered to be a precondition. If its
32918 expansion is forced to fail, the router declines, and the value of <option>more</option>
32919 controls what happens next.
32920 </para>
32921 <para>
32922 <indexterm role="option">
32923 <primary><option>pass_on_timeout</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>pass_on_timeout</option></entry>
32935 <entry>Use: <emphasis>routers</emphasis></entry>
32936 <entry>Type: <emphasis>boolean</emphasis></entry>
32937 <entry>Default: <emphasis>false</emphasis></entry>
32938 </row>
32939 </tbody>
32940 </tgroup>
32941 </informaltable>
32942 <para>
32943 <indexterm role="concept">
32944 <primary>timeout</primary>
32945 <secondary>of router</secondary>
32946 </indexterm>
32947 <indexterm role="concept">
32948 <primary>router</primary>
32949 <secondary>timeout</secondary>
32950 </indexterm>
32951 If a router times out during a host lookup, it normally causes deferral of the
32952 address. If <option>pass_on_timeout</option> is set, the address is passed on to the next
32953 router, overriding <option>no_more</option>. This may be helpful for systems that are
32954 intermittently connected to the Internet, or those that want to pass to a smart
32955 host any messages that cannot immediately be delivered.
32956 </para>
32957 <para>
32958 There are occasional other temporary errors that can occur while doing DNS
32959 lookups. They are treated in the same way as a timeout, and this option
32960 applies to all of them.
32961 </para>
32962 <para>
32963 <indexterm role="option">
32964 <primary><option>pass_router</option></primary>
32965 </indexterm>
32966 </para>
32967 <informaltable frame="all">
32968 <tgroup cols="4" colsep="0" rowsep="0">
32969 <colspec colwidth="8*" align="left"/>
32970 <colspec colwidth="6*" align="center"/>
32971 <colspec colwidth="6*" align="center"/>
32972 <colspec colwidth="6*" align="right"/>
32973 <tbody>
32974 <row>
32975 <entry><option>pass_router</option></entry>
32976 <entry>Use: <emphasis>routers</emphasis></entry>
32977 <entry>Type: <emphasis>string</emphasis></entry>
32978 <entry>Default: <emphasis>unset</emphasis></entry>
32979 </row>
32980 </tbody>
32981 </tgroup>
32982 </informaltable>
32983 <para>
32984 <indexterm role="concept">
32985 <primary>router</primary>
32986 <secondary>go to after <quote>pass</quote></secondary>
32987 </indexterm>
32988 Routers that recognize the generic <option>self</option> option (<command>dnslookup</command>,
32989 <command>ipliteral</command>, and <command>manualroute</command>) are able to return <quote>pass</quote>, forcing
32990 routing to continue, and overriding a false setting of <option>more</option>. When one of
32991 these routers returns <quote>pass</quote>, the address is normally handed on to the next
32992 router in sequence. This can be changed by setting <option>pass_router</option> to the name
32993 of another router. However (unlike <option>redirect_router</option>) the named router must
32994 be below the current router, to avoid loops. Note that this option applies only
32995 to the special case of <quote>pass</quote>. It does not apply when a router returns
32996 <quote>decline</quote> because it cannot handle an address.
32997 </para>
32998 <para>
32999 <indexterm role="option">
33000 <primary><option>redirect_router</option></primary>
33001 </indexterm>
33002 </para>
33003 <informaltable frame="all">
33004 <tgroup cols="4" colsep="0" rowsep="0">
33005 <colspec colwidth="8*" align="left"/>
33006 <colspec colwidth="6*" align="center"/>
33007 <colspec colwidth="6*" align="center"/>
33008 <colspec colwidth="6*" align="right"/>
33009 <tbody>
33010 <row>
33011 <entry><option>redirect_router</option></entry>
33012 <entry>Use: <emphasis>routers</emphasis></entry>
33013 <entry>Type: <emphasis>string</emphasis></entry>
33014 <entry>Default: <emphasis>unset</emphasis></entry>
33015 </row>
33016 </tbody>
33017 </tgroup>
33018 </informaltable>
33019 <para>
33020 <indexterm role="concept">
33021 <primary>router</primary>
33022 <secondary>start at after redirection</secondary>
33023 </indexterm>
33024 Sometimes an administrator knows that it is pointless to reprocess addresses
33025 generated from alias or forward files with the same router again. For
33026 example, if an alias file translates real names into login ids there is no
33027 point searching the alias file a second time, especially if it is a large file.
33028 </para>
33029 <para>
33030 The <option>redirect_router</option> option can be set to the name of any router instance.
33031 It causes the routing of any generated addresses to start at the named router
33032 instead of at the first router. This option has no effect if the router in
33033 which it is set does not generate new addresses.
33034 </para>
33035 <para>
33036 <indexterm role="option">
33037 <primary><option>require_files</option></primary>
33038 </indexterm>
33039 </para>
33040 <informaltable frame="all">
33041 <tgroup cols="4" colsep="0" rowsep="0">
33042 <colspec colwidth="8*" align="left"/>
33043 <colspec colwidth="6*" align="center"/>
33044 <colspec colwidth="6*" align="center"/>
33045 <colspec colwidth="6*" align="right"/>
33046 <tbody>
33047 <row>
33048 <entry><option>require_files</option></entry>
33049 <entry>Use: <emphasis>routers</emphasis>&Dagger;<emphasis></emphasis></entry>
33050 <entry>Type: <emphasis>string list</emphasis>&dagger;<emphasis></emphasis></entry>
33051 <entry>Default: <emphasis>unset</emphasis></entry>
33052 </row>
33053 </tbody>
33054 </tgroup>
33055 </informaltable>
33056 <para>
33057 <indexterm role="concept">
33058 <primary>file</primary>
33059 <secondary>requiring for router</secondary>
33060 </indexterm>
33061 <indexterm role="concept">
33062 <primary>router</primary>
33063 <secondary>requiring file existence</secondary>
33064 </indexterm>
33065 This option provides a general mechanism for predicating the running of a
33066 router on the existence or non-existence of certain files or directories.
33067 Before running a router, as one of its precondition tests, Exim works its way
33068 through the <option>require_files</option> list, expanding each item separately.
33069 </para>
33070 <para>
33071 Because the list is split before expansion, any colons in expansion items must
33072 be doubled, or the facility for using a different list separator must be used.
33073 If any expansion is forced to fail, the item is ignored. Other expansion
33074 failures cause routing of the address to be deferred.
33075 </para>
33076 <para>
33077 If any expanded string is empty, it is ignored. Otherwise, except as described
33078 below, each string must be a fully qualified file path, optionally preceded by
33079 <quote>!</quote>. The paths are passed to the <function>stat()</function> function to test for the
33080 existence of the files or directories. The router is skipped if any paths not
33081 preceded by <quote>!</quote> do not exist, or if any paths preceded by <quote>!</quote> do exist.
33082 </para>
33083 <para>
33084 <indexterm role="concept">
33085 <primary>NFS</primary>
33086 </indexterm>
33087 If <function>stat()</function> cannot determine whether a file exists or not, delivery of
33088 the message is deferred. This can happen when NFS-mounted filesystems are
33089 unavailable.
33090 </para>
33091 <para>
33092 This option is checked after the <option>domains</option>, <option>local_parts</option>, and <option>senders</option>
33093 options, so you cannot use it to check for the existence of a file in which to
33094 look up a domain, local part, or sender. (See section <xref linkend="SECTrouprecon"/> for a
33095 full list of the order in which preconditions are evaluated.) However, as
33096 these options are all expanded, you can use the <option>exists</option> expansion condition
33097 to make such tests. The <option>require_files</option> option is intended for checking files
33098 that the router may be going to use internally, or which are needed by a
33099 transport (for example <filename>.procmailrc</filename>).
33100 </para>
33101 <para>
33102 During delivery, the <function>stat()</function> function is run as root, but there is a
33103 facility for some checking of the accessibility of a file by another user.
33104 This is not a proper permissions check, but just a <quote>rough</quote> check that
33105 operates as follows:
33106 </para>
33107 <para>
33108 If an item in a <option>require_files</option> list does not contain any forward slash
33109 characters, it is taken to be the user (and optional group, separated by a
33110 comma) to be checked for subsequent files in the list. If no group is specified
33111 but the user is specified symbolically, the gid associated with the uid is
33112 used. For example:
33113 </para>
33114 <literallayout class="monospaced">
33115 require_files = mail:/some/file
33116 require_files = $local_part:$home/.procmailrc
33117 </literallayout>
33118 <para>
33119 If a user or group name in a <option>require_files</option> list does not exist, the
33120 <option>require_files</option> condition fails.
33121 </para>
33122 <para>
33123 Exim performs the check by scanning along the components of the file path, and
33124 checking the access for the given uid and gid. It checks for <quote>x</quote> access on
33125 directories, and <quote>r</quote> access on the final file. Note that this means that file
33126 access control lists, if the operating system has them, are ignored.
33127 </para>
33128 <para>
33129 <emphasis role="bold">Warning 1</emphasis>: When the router is being run to verify addresses for an
33130 incoming SMTP message, Exim is not running as root, but under its own uid. This
33131 may affect the result of a <option>require_files</option> check. In particular, <function>stat()</function>
33132 may yield the error EACCES (<quote>Permission denied</quote>). This means that the Exim
33133 user is not permitted to read one of the directories on the file&#x2019;s path.
33134 </para>
33135 <para>
33136 <emphasis role="bold">Warning 2</emphasis>: Even when Exim is running as root while delivering a message,
33137 <function>stat()</function> can yield EACCES for a file in an NFS directory that is mounted
33138 without root access. In this case, if a check for access by a particular user
33139 is requested, Exim creates a subprocess that runs as that user, and tries the
33140 check again in that process.
33141 </para>
33142 <para>
33143 The default action for handling an unresolved EACCES is to consider it to
33144 be caused by a configuration error, and routing is deferred because the
33145 existence or non-existence of the file cannot be determined. However, in some
33146 circumstances it may be desirable to treat this condition as if the file did
33147 not exist. If the file name (or the exclamation mark that precedes the file
33148 name for non-existence) is preceded by a plus sign, the EACCES error is treated
33149 as if the file did not exist. For example:
33150 </para>
33151 <literallayout class="monospaced">
33152 require_files = +/some/file
33153 </literallayout>
33154 <para>
33155 If the router is not an essential part of verification (for example, it
33156 handles users&#x2019; <filename>.forward</filename> files), another solution is to set the <option>verify</option>
33157 option false so that the router is skipped when verifying.
33158 </para>
33159 <para>
33160 <indexterm role="option">
33161 <primary><option>retry_use_local_part</option></primary>
33162 </indexterm>
33163 </para>
33164 <informaltable frame="all">
33165 <tgroup cols="4" colsep="0" rowsep="0">
33166 <colspec colwidth="8*" align="left"/>
33167 <colspec colwidth="6*" align="center"/>
33168 <colspec colwidth="6*" align="center"/>
33169 <colspec colwidth="6*" align="right"/>
33170 <tbody>
33171 <row>
33172 <entry><option>retry_use_local_part</option></entry>
33173 <entry>Use: <emphasis>routers</emphasis></entry>
33174 <entry>Type: <emphasis>boolean</emphasis></entry>
33175 <entry>Default: <emphasis>see below</emphasis></entry>
33176 </row>
33177 </tbody>
33178 </tgroup>
33179 </informaltable>
33180 <para>
33181 <indexterm role="concept">
33182 <primary>hints database</primary>
33183 <secondary>retry keys</secondary>
33184 </indexterm>
33185 <indexterm role="concept">
33186 <primary>local part</primary>
33187 <secondary>in retry keys</secondary>
33188 </indexterm>
33189 When a delivery suffers a temporary routing failure, a retry record is created
33190 in Exim&#x2019;s hints database. For addresses whose routing depends only on the
33191 domain, the key for the retry record should not involve the local part, but for
33192 other addresses, both the domain and the local part should be included.
33193 Usually, remote routing is of the former kind, and local routing is of the
33194 latter kind.
33195 </para>
33196 <para>
33197 This option controls whether the local part is used to form the key for retry
33198 hints for addresses that suffer temporary errors while being handled by this
33199 router. The default value is true for any router that has <option>check_local_user</option>
33200 set, and false otherwise. Note that this option does not apply to hints keys
33201 for transport delays; they are controlled by a generic transport option of the
33202 same name.
33203 </para>
33204 <para>
33205 The setting of <option>retry_use_local_part</option> applies only to the router on which it
33206 appears. If the router generates child addresses, they are routed
33207 independently; this setting does not become attached to them.
33208 </para>
33209 <para>
33210 <indexterm role="option">
33211 <primary><option>router_home_directory</option></primary>
33212 </indexterm>
33213 </para>
33214 <informaltable frame="all">
33215 <tgroup cols="4" colsep="0" rowsep="0">
33216 <colspec colwidth="8*" align="left"/>
33217 <colspec colwidth="6*" align="center"/>
33218 <colspec colwidth="6*" align="center"/>
33219 <colspec colwidth="6*" align="right"/>
33220 <tbody>
33221 <row>
33222 <entry><option>router_home_directory</option></entry>
33223 <entry>Use: <emphasis>routers</emphasis></entry>
33224 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
33225 <entry>Default: <emphasis>unset</emphasis></entry>
33226 </row>
33227 </tbody>
33228 </tgroup>
33229 </informaltable>
33230 <para>
33231 <indexterm role="concept">
33232 <primary>router</primary>
33233 <secondary>home directory for</secondary>
33234 </indexterm>
33235 <indexterm role="concept">
33236 <primary>home directory</primary>
33237 <secondary>for router</secondary>
33238 </indexterm>
33239 <indexterm role="variable">
33240 <primary><varname>$home</varname></primary>
33241 </indexterm>
33242 This option sets a home directory for use while the router is running. (Compare
33243 <option>transport_home_directory</option>, which sets a home directory for later
33244 transporting.) In particular, if used on a <command>redirect</command> router, this option
33245 sets a value for <varname>$home</varname> while a filter is running. The value is expanded;
33246 forced expansion failure causes the option to be ignored &ndash; other failures
33247 cause the router to defer.
33248 </para>
33249 <para>
33250 Expansion of <option>router_home_directory</option> happens immediately after the
33251 <option>check_local_user</option> test (if configured), before any further expansions take
33252 place.
33253 (See section <xref linkend="SECTrouprecon"/> for a list of the order in which preconditions
33254 are evaluated.)
33255 While the router is running, <option>router_home_directory</option> overrides the value of
33256 <varname>$home</varname> that came from <option>check_local_user</option>.
33257 </para>
33258 <para>
33259 When a router accepts an address and assigns it to a local transport (including
33260 the cases when a <command>redirect</command> router generates a pipe, file, or autoreply
33261 delivery), the home directory setting for the transport is taken from the first
33262 of these values that is set:
33263 </para>
33264 <itemizedlist>
33265 <listitem>
33266 <para>
33267 The <option>home_directory</option> option on the transport;
33268 </para>
33269 </listitem>
33270 <listitem>
33271 <para>
33272 The <option>transport_home_directory</option> option on the router;
33273 </para>
33274 </listitem>
33275 <listitem>
33276 <para>
33277 The password data if <option>check_local_user</option> is set on the router;
33278 </para>
33279 </listitem>
33280 <listitem>
33281 <para>
33282 The <option>router_home_directory</option> option on the router.
33283 </para>
33284 </listitem>
33285 </itemizedlist>
33286 <para>
33287 In other words, <option>router_home_directory</option> overrides the password data for the
33288 router, but not for the transport.
33289 </para>
33290 <para>
33291 <indexterm role="option">
33292 <primary><option>self</option></primary>
33293 </indexterm>
33294 </para>
33295 <informaltable frame="all">
33296 <tgroup cols="4" colsep="0" rowsep="0">
33297 <colspec colwidth="8*" align="left"/>
33298 <colspec colwidth="6*" align="center"/>
33299 <colspec colwidth="6*" align="center"/>
33300 <colspec colwidth="6*" align="right"/>
33301 <tbody>
33302 <row>
33303 <entry><option>self</option></entry>
33304 <entry>Use: <emphasis>routers</emphasis></entry>
33305 <entry>Type: <emphasis>string</emphasis></entry>
33306 <entry>Default: <emphasis>freeze</emphasis></entry>
33307 </row>
33308 </tbody>
33309 </tgroup>
33310 </informaltable>
33311 <para>
33312 <indexterm role="concept">
33313 <primary>MX record</primary>
33314 <secondary>pointing to local host</secondary>
33315 </indexterm>
33316 <indexterm role="concept">
33317 <primary>local host</primary>
33318 <secondary>MX pointing to</secondary>
33319 </indexterm>
33320 This option applies to those routers that use a recipient address to find a
33321 list of remote hosts. Currently, these are the <command>dnslookup</command>, <command>ipliteral</command>,
33322 and <command>manualroute</command> routers.
33323 Certain configurations of the <command>queryprogram</command> router can also specify a list
33324 of remote hosts.
33325 Usually such routers are configured to send the message to a remote host via an
33326 <command>smtp</command> transport. The <option>self</option> option specifies what happens when the first
33327 host on the list turns out to be the local host.
33328 The way in which Exim checks for the local host is described in section
33329 <xref linkend="SECTreclocipadd"/>.
33330 </para>
33331 <para>
33332 Normally this situation indicates either an error in Exim&#x2019;s configuration (for
33333 example, the router should be configured not to process this domain), or an
33334 error in the DNS (for example, the MX should not point to this host). For this
33335 reason, the default action is to log the incident, defer the address, and
33336 freeze the message. The following alternatives are provided for use in special
33337 cases:
33338 </para>
33339 <variablelist>
33340 <varlistentry>
33341 <term><option>defer</option></term>
33342 <listitem>
33343 <para>
33344 Delivery of the message is tried again later, but the message is not frozen.
33345 </para>
33346 </listitem></varlistentry>
33347 <varlistentry>
33348 <term><option>reroute</option>: &lt;<emphasis>domain</emphasis>&gt;</term>
33349 <listitem>
33350 <para>
33351 The domain is changed to the given domain, and the address is passed back to
33352 be reprocessed by the routers. No rewriting of headers takes place. This
33353 behaviour is essentially a redirection.
33354 </para>
33355 </listitem></varlistentry>
33356 <varlistentry>
33357 <term><option>reroute: rewrite:</option> &lt;<emphasis>domain</emphasis>&gt;</term>
33358 <listitem>
33359 <para>
33360 The domain is changed to the given domain, and the address is passed back to be
33361 reprocessed by the routers. Any headers that contain the original domain are
33362 rewritten.
33363 </para>
33364 </listitem></varlistentry>
33365 <varlistentry>
33366 <term><option>pass</option></term>
33367 <listitem>
33368 <para>
33369 <indexterm role="option">
33370 <primary><option>more</option></primary>
33371 </indexterm>
33372 <indexterm role="variable">
33373 <primary><varname>$self_hostname</varname></primary>
33374 </indexterm>
33375 The router passes the address to the next router, or to the router named in the
33376 <option>pass_router</option> option if it is set. This overrides <option>no_more</option>. During
33377 subsequent routing and delivery, the variable <varname>$self_hostname</varname> contains the
33378 name of the local host that the router encountered. This can be used to
33379 distinguish between different cases for hosts with multiple names. The
33380 combination
33381 </para>
33382 <literallayout class="monospaced">
33383 self = pass
33384 no_more
33385 </literallayout>
33386 <para>
33387 ensures that only those addresses that routed to the local host are passed on.
33388 Without <option>no_more</option>, addresses that were declined for other reasons would also
33389 be passed to the next router.
33390 </para>
33391 </listitem></varlistentry>
33392 <varlistentry>
33393 <term><option>fail</option></term>
33394 <listitem>
33395 <para>
33396 Delivery fails and an error report is generated.
33397 </para>
33398 </listitem></varlistentry>
33399 <varlistentry>
33400 <term><option>send</option></term>
33401 <listitem>
33402 <para>
33403 <indexterm role="concept">
33404 <primary>local host</primary>
33405 <secondary>sending to</secondary>
33406 </indexterm>
33407 The anomaly is ignored and the address is queued for the transport. This
33408 setting should be used with extreme caution. For an <command>smtp</command> transport, it
33409 makes sense only in cases where the program that is listening on the SMTP port
33410 is not this version of Exim. That is, it must be some other MTA, or Exim with a
33411 different configuration file that handles the domain in another way.
33412 </para>
33413 </listitem></varlistentry>
33414 </variablelist>
33415 <para>
33416 <indexterm role="option">
33417 <primary><option>senders</option></primary>
33418 </indexterm>
33419 </para>
33420 <informaltable frame="all">
33421 <tgroup cols="4" colsep="0" rowsep="0">
33422 <colspec colwidth="8*" align="left"/>
33423 <colspec colwidth="6*" align="center"/>
33424 <colspec colwidth="6*" align="center"/>
33425 <colspec colwidth="6*" align="right"/>
33426 <tbody>
33427 <row>
33428 <entry><option>senders</option></entry>
33429 <entry>Use: <emphasis>routers</emphasis>&Dagger;<emphasis></emphasis></entry>
33430 <entry>Type: <emphasis>address list</emphasis>&dagger;<emphasis></emphasis></entry>
33431 <entry>Default: <emphasis>unset</emphasis></entry>
33432 </row>
33433 </tbody>
33434 </tgroup>
33435 </informaltable>
33436 <para>
33437 <indexterm role="concept">
33438 <primary>router</primary>
33439 <secondary>checking senders</secondary>
33440 </indexterm>
33441 If this option is set, the router is skipped unless the message&#x2019;s sender
33442 address matches something on the list.
33443 See section <xref linkend="SECTrouprecon"/> for a list of the order in which preconditions
33444 are evaluated.
33445 </para>
33446 <para>
33447 There are issues concerning verification when the running of routers is
33448 dependent on the sender. When Exim is verifying the address in an <option>errors_to</option>
33449 setting, it sets the sender to the null string. When using the <option>-bt</option> option
33450 to check a configuration file, it is necessary also to use the <option>-f</option> option to
33451 set an appropriate sender. For incoming mail, the sender is unset when
33452 verifying the sender, but is available when verifying any recipients. If the
33453 SMTP VRFY command is enabled, it must be used after MAIL if the sender address
33454 matters.
33455 </para>
33456 <para>
33457 <indexterm role="option">
33458 <primary><option>translate_ip_address</option></primary>
33459 </indexterm>
33460 </para>
33461 <informaltable frame="all">
33462 <tgroup cols="4" colsep="0" rowsep="0">
33463 <colspec colwidth="8*" align="left"/>
33464 <colspec colwidth="6*" align="center"/>
33465 <colspec colwidth="6*" align="center"/>
33466 <colspec colwidth="6*" align="right"/>
33467 <tbody>
33468 <row>
33469 <entry><option>translate_ip_address</option></entry>
33470 <entry>Use: <emphasis>routers</emphasis></entry>
33471 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
33472 <entry>Default: <emphasis>unset</emphasis></entry>
33473 </row>
33474 </tbody>
33475 </tgroup>
33476 </informaltable>
33477 <para>
33478 <indexterm role="concept">
33479 <primary>IP address</primary>
33480 <secondary>translating</secondary>
33481 </indexterm>
33482 <indexterm role="concept">
33483 <primary>packet radio</primary>
33484 </indexterm>
33485 <indexterm role="concept">
33486 <primary>router</primary>
33487 <secondary>IP address translation</secondary>
33488 </indexterm>
33489 There exist some rare networking situations (for example, packet radio) where
33490 it is helpful to be able to translate IP addresses generated by normal routing
33491 mechanisms into other IP addresses, thus performing a kind of manual IP
33492 routing. This should be done only if the normal IP routing of the TCP/IP stack
33493 is inadequate or broken. Because this is an extremely uncommon requirement, the
33494 code to support this option is not included in the Exim binary unless
33495 SUPPORT_TRANSLATE_IP_ADDRESS=yes is set in <filename>Local/Makefile</filename>.
33496 </para>
33497 <para>
33498 <indexterm role="variable">
33499 <primary><varname>$host_address</varname></primary>
33500 </indexterm>
33501 The <option>translate_ip_address</option> string is expanded for every IP address generated
33502 by the router, with the generated address set in <varname>$host_address</varname>. If the
33503 expansion is forced to fail, no action is taken.
33504 For any other expansion error, delivery of the message is deferred.
33505 If the result of the expansion is an IP address, that replaces the original
33506 address; otherwise the result is assumed to be a host name &ndash; this is looked
33507 up using <function>gethostbyname()</function> (or <function>getipnodebyname()</function> when available) to
33508 produce one or more replacement IP addresses. For example, to subvert all IP
33509 addresses in some specific networks, this could be added to a router:
33510 </para>
33511 <literallayout class="monospaced">
33512 translate_ip_address = \
33513   ${lookup{${mask:$host_address/26}}lsearch{/some/file}\
33514     {$value}fail}}
33515 </literallayout>
33516 <para>
33517 The file would contain lines like
33518 </para>
33519 <literallayout class="monospaced">
33520 10.2.3.128/26    some.host
33521 10.8.4.34/26     10.44.8.15
33522 </literallayout>
33523 <para>
33524 You should not make use of this facility unless you really understand what you
33525 are doing.
33526 </para>
33527 <para>
33528 <indexterm role="option">
33529 <primary><option>transport</option></primary>
33530 </indexterm>
33531 </para>
33532 <informaltable frame="all">
33533 <tgroup cols="4" colsep="0" rowsep="0">
33534 <colspec colwidth="8*" align="left"/>
33535 <colspec colwidth="6*" align="center"/>
33536 <colspec colwidth="6*" align="center"/>
33537 <colspec colwidth="6*" align="right"/>
33538 <tbody>
33539 <row>
33540 <entry><option>transport</option></entry>
33541 <entry>Use: <emphasis>routers</emphasis></entry>
33542 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
33543 <entry>Default: <emphasis>unset</emphasis></entry>
33544 </row>
33545 </tbody>
33546 </tgroup>
33547 </informaltable>
33548 <para>
33549 This option specifies the transport to be used when a router accepts an address
33550 and sets it up for delivery. A transport is never needed if a router is used
33551 only for verification. The value of the option is expanded at routing time,
33552 after the expansion of <option>errors_to</option>, <option>headers_add</option>, and <option>headers_remove</option>,
33553 and result must be the name of one of the configured transports. If it is not,
33554 delivery is deferred.
33555 </para>
33556 <para>
33557 The <option>transport</option> option is not used by the <command>redirect</command> router, but it does
33558 have some private options that set up transports for pipe and file deliveries
33559 (see chapter <xref linkend="CHAPredirect"/>).
33560 </para>
33561 <para>
33562 <indexterm role="option">
33563 <primary><option>transport_current_directory</option></primary>
33564 </indexterm>
33565 </para>
33566 <informaltable frame="all">
33567 <tgroup cols="4" colsep="0" rowsep="0">
33568 <colspec colwidth="8*" align="left"/>
33569 <colspec colwidth="6*" align="center"/>
33570 <colspec colwidth="6*" align="center"/>
33571 <colspec colwidth="6*" align="right"/>
33572 <tbody>
33573 <row>
33574 <entry><option>transport_current_directory</option></entry>
33575 <entry>Use: <emphasis>routers</emphasis></entry>
33576 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
33577 <entry>Default: <emphasis>unset</emphasis></entry>
33578 </row>
33579 </tbody>
33580 </tgroup>
33581 </informaltable>
33582 <para>
33583 <indexterm role="concept">
33584 <primary>current directory for local transport</primary>
33585 </indexterm>
33586 This option associates a current directory with any address that is routed
33587 to a local transport. This can happen either because a transport is
33588 explicitly configured for the router, or because it generates a delivery to a
33589 file or a pipe. During the delivery process (that is, at transport time), this
33590 option string is expanded and is set as the current directory, unless
33591 overridden by a setting on the transport.
33592 If the expansion fails for any reason, including forced failure, an error is
33593 logged, and delivery is deferred.
33594 See chapter <xref linkend="CHAPenvironment"/> for details of the local delivery
33595 environment.
33596 </para>
33597 <para>
33598 <indexterm role="option">
33599 <primary><option>transport_home_directory</option></primary>
33600 </indexterm>
33601 </para>
33602 <informaltable frame="all">
33603 <tgroup cols="4" colsep="0" rowsep="0">
33604 <colspec colwidth="8*" align="left"/>
33605 <colspec colwidth="6*" align="center"/>
33606 <colspec colwidth="6*" align="center"/>
33607 <colspec colwidth="6*" align="right"/>
33608 <tbody>
33609 <row>
33610 <entry><option>transport_home_directory</option></entry>
33611 <entry>Use: <emphasis>routers</emphasis></entry>
33612 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
33613 <entry>Default: <emphasis>see below</emphasis></entry>
33614 </row>
33615 </tbody>
33616 </tgroup>
33617 </informaltable>
33618 <para>
33619 <indexterm role="concept">
33620 <primary>home directory</primary>
33621 <secondary>for local transport</secondary>
33622 </indexterm>
33623 This option associates a home directory with any address that is routed to a
33624 local transport. This can happen either because a transport is explicitly
33625 configured for the router, or because it generates a delivery to a file or a
33626 pipe. During the delivery process (that is, at transport time), the option
33627 string is expanded and is set as the home directory, unless overridden by a
33628 setting of <option>home_directory</option> on the transport.
33629 If the expansion fails for any reason, including forced failure, an error is
33630 logged, and delivery is deferred.
33631 </para>
33632 <para>
33633 If the transport does not specify a home directory, and
33634 <option>transport_home_directory</option> is not set for the router, the home directory for
33635 the transport is taken from the password data if <option>check_local_user</option> is set for
33636 the router. Otherwise it is taken from <option>router_home_directory</option> if that option
33637 is set; if not, no home directory is set for the transport.
33638 </para>
33639 <para>
33640 See chapter <xref linkend="CHAPenvironment"/> for further details of the local delivery
33641 environment.
33642 </para>
33643 <para>
33644 <indexterm role="option">
33645 <primary><option>unseen</option></primary>
33646 </indexterm>
33647 </para>
33648 <informaltable frame="all">
33649 <tgroup cols="4" colsep="0" rowsep="0">
33650 <colspec colwidth="8*" align="left"/>
33651 <colspec colwidth="6*" align="center"/>
33652 <colspec colwidth="6*" align="center"/>
33653 <colspec colwidth="6*" align="right"/>
33654 <tbody>
33655 <row>
33656 <entry><option>unseen</option></entry>
33657 <entry>Use: <emphasis>routers</emphasis></entry>
33658 <entry>Type: <emphasis>boolean</emphasis>&dagger;<emphasis></emphasis></entry>
33659 <entry>Default: <emphasis>false</emphasis></entry>
33660 </row>
33661 </tbody>
33662 </tgroup>
33663 </informaltable>
33664 <para>
33665 <indexterm role="concept">
33666 <primary>router</primary>
33667 <secondary>carrying on after success</secondary>
33668 </indexterm>
33669 The result of string expansion for this option must be a valid boolean value,
33670 that is, one of the strings <quote>yes</quote>, <quote>no</quote>, <quote>true</quote>, or <quote>false</quote>. Any other
33671 result causes an error, and delivery is deferred. If the expansion is forced to
33672 fail, the default value for the option (false) is used. Other failures cause
33673 delivery to be deferred.
33674 </para>
33675 <para>
33676 When this option is set true, routing does not cease if the router accepts the
33677 address. Instead, a copy of the incoming address is passed to the next router,
33678 overriding a false setting of <option>more</option>. There is little point in setting
33679 <option>more</option> false if <option>unseen</option> is always true, but it may be useful in cases when
33680 the value of <option>unseen</option> contains expansion items (and therefore, presumably, is
33681 sometimes true and sometimes false).
33682 </para>
33683 <para>
33684 <indexterm role="concept">
33685 <primary>copy of message (<option>unseen</option> option)</primary>
33686 </indexterm>
33687 Setting the <option>unseen</option> option has a similar effect to the <option>unseen</option> command
33688 qualifier in filter files. It can be used to cause copies of messages to be
33689 delivered to some other destination, while also carrying out a normal delivery.
33690 In effect, the current address is made into a <quote>parent</quote> that has two children
33691 &ndash; one that is delivered as specified by this router, and a clone that goes on
33692 to be routed further. For this reason, <option>unseen</option> may not be combined with the
33693 <option>one_time</option> option in a <command>redirect</command> router.
33694 </para>
33695 <para>
33696 <emphasis role="bold">Warning</emphasis>: Header lines added to the address (or specified for removal) by
33697 this router or by previous routers affect the <quote>unseen</quote> copy of the message
33698 only. The clone that continues to be processed by further routers starts with
33699 no added headers and none specified for removal. For a <option>redirect</option> router, if
33700 a generated address is the same as the incoming address, this can lead to
33701 duplicate addresses with different header modifications. Exim does not do
33702 duplicate deliveries (except, in certain circumstances, to pipes -- see section
33703 <xref linkend="SECTdupaddr"/>), but it is undefined which of the duplicates is discarded,
33704 so this ambiguous situation should be avoided. The <option>repeat_use</option> option of the
33705 <option>redirect</option> router may be of help.
33706 </para>
33707 <para>
33708 Unlike the handling of header modifications, any data that was set by the
33709 <option>address_data</option> option in the current or previous routers <emphasis>is</emphasis> passed on to
33710 subsequent routers.
33711 </para>
33712 <para>
33713 <indexterm role="option">
33714 <primary><option>user</option></primary>
33715 </indexterm>
33716 </para>
33717 <informaltable frame="all">
33718 <tgroup cols="4" colsep="0" rowsep="0">
33719 <colspec colwidth="8*" align="left"/>
33720 <colspec colwidth="6*" align="center"/>
33721 <colspec colwidth="6*" align="center"/>
33722 <colspec colwidth="6*" align="right"/>
33723 <tbody>
33724 <row>
33725 <entry><option>user</option></entry>
33726 <entry>Use: <emphasis>routers</emphasis></entry>
33727 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
33728 <entry>Default: <emphasis>see below</emphasis></entry>
33729 </row>
33730 </tbody>
33731 </tgroup>
33732 </informaltable>
33733 <para>
33734 <indexterm role="concept">
33735 <primary>uid (user id)</primary>
33736 <secondary>local delivery</secondary>
33737 </indexterm>
33738 <indexterm role="concept">
33739 <primary>local transports</primary>
33740 <secondary>uid and gid</secondary>
33741 </indexterm>
33742 <indexterm role="concept">
33743 <primary>transport</primary>
33744 <secondary>local</secondary>
33745 </indexterm>
33746 <indexterm role="concept">
33747 <primary>router</primary>
33748 <secondary>user for filter processing</secondary>
33749 </indexterm>
33750 <indexterm role="concept">
33751 <primary>filter</primary>
33752 <secondary>user for processing</secondary>
33753 </indexterm>
33754 When a router queues an address for a transport, and the transport does not
33755 specify a user, the user given here is used when running the delivery process.
33756 The user may be specified numerically or by name. If expansion fails, the
33757 error is logged and delivery is deferred.
33758 This user is also used by the <command>redirect</command> router when running a filter file.
33759 The default is unset, except when <option>check_local_user</option> is set. In this case,
33760 the default is taken from the password information. If the user is specified as
33761 a name, and <option>group</option> is not set, the group associated with the user is used.
33762 See also <option>initgroups</option> and <option>group</option> and the discussion in chapter
33763 <xref linkend="CHAPenvironment"/>.
33764 </para>
33765 <para>
33766 <indexterm role="option">
33767 <primary><option>verify</option></primary>
33768 </indexterm>
33769 </para>
33770 <informaltable frame="all">
33771 <tgroup cols="4" colsep="0" rowsep="0">
33772 <colspec colwidth="8*" align="left"/>
33773 <colspec colwidth="6*" align="center"/>
33774 <colspec colwidth="6*" align="center"/>
33775 <colspec colwidth="6*" align="right"/>
33776 <tbody>
33777 <row>
33778 <entry><option>verify</option></entry>
33779 <entry>Use: <emphasis>routers</emphasis>&Dagger;<emphasis></emphasis></entry>
33780 <entry>Type: <emphasis>boolean</emphasis></entry>
33781 <entry>Default: <emphasis>true</emphasis></entry>
33782 </row>
33783 </tbody>
33784 </tgroup>
33785 </informaltable>
33786 <para>
33787 Setting this option has the effect of setting <option>verify_sender</option> and
33788 <option>verify_recipient</option> to the same value.
33789 </para>
33790 <para>
33791 <indexterm role="option">
33792 <primary><option>verify_only</option></primary>
33793 </indexterm>
33794 </para>
33795 <informaltable frame="all">
33796 <tgroup cols="4" colsep="0" rowsep="0">
33797 <colspec colwidth="8*" align="left"/>
33798 <colspec colwidth="6*" align="center"/>
33799 <colspec colwidth="6*" align="center"/>
33800 <colspec colwidth="6*" align="right"/>
33801 <tbody>
33802 <row>
33803 <entry><option>verify_only</option></entry>
33804 <entry>Use: <emphasis>routers</emphasis>&Dagger;<emphasis></emphasis></entry>
33805 <entry>Type: <emphasis>boolean</emphasis></entry>
33806 <entry>Default: <emphasis>false</emphasis></entry>
33807 </row>
33808 </tbody>
33809 </tgroup>
33810 </informaltable>
33811 <para>
33812 <indexterm role="concept">
33813 <primary>EXPN</primary>
33814 <secondary>with <option>verify_only</option></secondary>
33815 </indexterm>
33816 <indexterm role="option">
33817 <primary><option>-bv</option></primary>
33818 </indexterm>
33819 <indexterm role="concept">
33820 <primary>router</primary>
33821 <secondary>used only when verifying</secondary>
33822 </indexterm>
33823 If this option is set, the router is used only when verifying an address,
33824 delivering in cutthrough mode or
33825 testing with the <option>-bv</option> option, not when actually doing a delivery, testing
33826 with the <option>-bt</option> option, or running the SMTP EXPN command. It can be further
33827 restricted to verifying only senders or recipients by means of
33828 <option>verify_sender</option> and <option>verify_recipient</option>.
33829 </para>
33830 <para>
33831 <emphasis role="bold">Warning</emphasis>: When the router is being run to verify addresses for an incoming
33832 SMTP message, Exim is not running as root, but under its own uid. If the router
33833 accesses any files, you need to make sure that they are accessible to the Exim
33834 user or group.
33835 </para>
33836 <para>
33837 <indexterm role="option">
33838 <primary><option>verify_recipient</option></primary>
33839 </indexterm>
33840 </para>
33841 <informaltable frame="all">
33842 <tgroup cols="4" colsep="0" rowsep="0">
33843 <colspec colwidth="8*" align="left"/>
33844 <colspec colwidth="6*" align="center"/>
33845 <colspec colwidth="6*" align="center"/>
33846 <colspec colwidth="6*" align="right"/>
33847 <tbody>
33848 <row>
33849 <entry><option>verify_recipient</option></entry>
33850 <entry>Use: <emphasis>routers</emphasis>&Dagger;<emphasis></emphasis></entry>
33851 <entry>Type: <emphasis>boolean</emphasis></entry>
33852 <entry>Default: <emphasis>true</emphasis></entry>
33853 </row>
33854 </tbody>
33855 </tgroup>
33856 </informaltable>
33857 <para>
33858 If this option is false, the router is skipped when verifying recipient
33859 addresses,
33860 delivering in cutthrough mode
33861 or testing recipient verification using <option>-bv</option>.
33862 See section <xref linkend="SECTrouprecon"/> for a list of the order in which preconditions
33863 are evaluated.
33864 See also the <varname>$verify_mode</varname> variable.
33865 </para>
33866 <para>
33867 <indexterm role="option">
33868 <primary><option>verify_sender</option></primary>
33869 </indexterm>
33870 </para>
33871 <informaltable frame="all">
33872 <tgroup cols="4" colsep="0" rowsep="0">
33873 <colspec colwidth="8*" align="left"/>
33874 <colspec colwidth="6*" align="center"/>
33875 <colspec colwidth="6*" align="center"/>
33876 <colspec colwidth="6*" align="right"/>
33877 <tbody>
33878 <row>
33879 <entry><option>verify_sender</option></entry>
33880 <entry>Use: <emphasis>routers</emphasis>&Dagger;<emphasis></emphasis></entry>
33881 <entry>Type: <emphasis>boolean</emphasis></entry>
33882 <entry>Default: <emphasis>true</emphasis></entry>
33883 </row>
33884 </tbody>
33885 </tgroup>
33886 </informaltable>
33887 <para>
33888 If this option is false, the router is skipped when verifying sender addresses
33889 or testing sender verification using <option>-bvs</option>.
33890 See section <xref linkend="SECTrouprecon"/> for a list of the order in which preconditions
33891 are evaluated.
33892 See also the <varname>$verify_mode</varname> variable.
33893 <indexterm role="concept" startref="IIDgenoprou1" class="endofrange"/>
33894 <indexterm role="concept" startref="IIDgenoprou2" class="endofrange"/>
33895 </para>
33896 </chapter>
33897
33898 <chapter id="CHID4">
33899 <title>The accept router</title>
33900 <para>
33901 <indexterm role="concept">
33902 <primary><command>accept</command> router</primary>
33903 </indexterm>
33904 <indexterm role="concept">
33905 <primary>routers</primary>
33906 <secondary><command>accept</command></secondary>
33907 </indexterm>
33908 The <command>accept</command> router has no private options of its own. Unless it is being
33909 used purely for verification (see <option>verify_only</option>) a transport is required to
33910 be defined by the generic <option>transport</option> option. If the preconditions that are
33911 specified by generic options are met, the router accepts the address and queues
33912 it for the given transport. The most common use of this router is for setting
33913 up deliveries to local mailboxes. For example:
33914 </para>
33915 <literallayout class="monospaced">
33916 localusers:
33917   driver = accept
33918   domains = mydomain.example
33919   check_local_user
33920   transport = local_delivery
33921 </literallayout>
33922 <para>
33923 The <option>domains</option> condition in this example checks the domain of the address, and
33924 <option>check_local_user</option> checks that the local part is the login of a local user.
33925 When both preconditions are met, the <command>accept</command> router runs, and queues the
33926 address for the <command>local_delivery</command> transport.
33927 </para>
33928 </chapter>
33929
33930 <chapter id="CHAPdnslookup">
33931 <title>The dnslookup router</title>
33932 <para>
33933 <indexterm role="concept" id="IIDdnsrou1" class="startofrange">
33934 <primary><command>dnslookup</command> router</primary>
33935 </indexterm>
33936 <indexterm role="concept" id="IIDdnsrou2" class="startofrange">
33937 <primary>routers</primary>
33938 <secondary><command>dnslookup</command></secondary>
33939 </indexterm>
33940 The <command>dnslookup</command> router looks up the hosts that handle mail for the
33941 recipient&#x2019;s domain in the DNS. A transport must always be set for this router,
33942 unless <option>verify_only</option> is set.
33943 </para>
33944 <para>
33945 If SRV support is configured (see <option>check_srv</option> below), Exim first searches for
33946 SRV records. If none are found, or if SRV support is not configured,
33947 MX records are looked up. If no MX records exist, address records are sought.
33948 However, <option>mx_domains</option> can be set to disable the direct use of address
33949 records.
33950 </para>
33951 <para>
33952 MX records of equal priority are sorted by Exim into a random order. Exim then
33953 looks for address records for the host names obtained from MX or SRV records.
33954 When a host has more than one IP address, they are sorted into a random order,
33955 except that IPv6 addresses are always sorted before IPv4 addresses. If all the
33956 IP addresses found are discarded by a setting of the <option>ignore_target_hosts</option>
33957 generic option, the router declines.
33958 </para>
33959 <para>
33960 Unless they have the highest priority (lowest MX value), MX records that point
33961 to the local host, or to any host name that matches <option>hosts_treat_as_local</option>,
33962 are discarded, together with any other MX records of equal or lower priority.
33963 </para>
33964 <para>
33965 <indexterm role="concept">
33966 <primary>MX record</primary>
33967 <secondary>pointing to local host</secondary>
33968 </indexterm>
33969 <indexterm role="concept">
33970 <primary>local host</primary>
33971 <secondary>MX pointing to</secondary>
33972 </indexterm>
33973 <indexterm role="option">
33974 <primary><option>self</option></primary>
33975 <secondary>in <command>dnslookup</command> router</secondary>
33976 </indexterm>
33977 If the host pointed to by the highest priority MX record, or looked up as an
33978 address record, is the local host, or matches <option>hosts_treat_as_local</option>, what
33979 happens is controlled by the generic <option>self</option> option.
33980 </para>
33981 <section id="SECTprowitdnsloo">
33982 <title>Problems with DNS lookups</title>
33983 <para>
33984 There have been problems with DNS servers when SRV records are looked up.
33985 Some misbehaving servers return a DNS error or timeout when a non-existent
33986 SRV record is sought. Similar problems have in the past been reported for
33987 MX records. The global <option>dns_again_means_nonexist</option> option can help with this
33988 problem, but it is heavy-handed because it is a global option.
33989 </para>
33990 <para>
33991 For this reason, there are two options, <option>srv_fail_domains</option> and
33992 <option>mx_fail_domains</option>, that control what happens when a DNS lookup in a
33993 <command>dnslookup</command> router results in a DNS failure or a <quote>try again</quote> response. If
33994 an attempt to look up an SRV or MX record causes one of these results, and the
33995 domain matches the relevant list, Exim behaves as if the DNS had responded <quote>no
33996 such record</quote>. In the case of an SRV lookup, this means that the router
33997 proceeds to look for MX records; in the case of an MX lookup, it proceeds to
33998 look for A or AAAA records, unless the domain matches <option>mx_domains</option>, in which
33999 case routing fails.
34000 </para>
34001 </section>
34002 <section id="SECTdnslookupdecline">
34003 <title>Declining addresses by dnslookup</title>
34004 <para>
34005 <indexterm role="concept">
34006 <primary><command>dnslookup</command> router</primary>
34007 <secondary>declines</secondary>
34008 </indexterm>
34009 There are a few cases where a <command>dnslookup</command> router will decline to accept
34010 an address; if such a router is expected to handle "all remaining non-local
34011 domains", then it is important to set <option>no_more</option>.
34012 </para>
34013 <para revisionflag="changed">
34014 The router will defer rather than decline if the domain
34015 is found in the <option>fail_defer_domains</option> router option.
34016 </para>
34017 <para>
34018 Reasons for a <command>dnslookup</command> router to decline currently include:
34019 </para>
34020 <itemizedlist>
34021 <listitem>
34022 <para>
34023 The domain does not exist in DNS
34024 </para>
34025 </listitem>
34026 <listitem>
34027 <para>
34028 The domain exists but the MX record&#x2019;s host part is just "."; this is a common
34029 convention (borrowed from SRV) used to indicate that there is no such service
34030 for this domain and to not fall back to trying A/AAAA records.
34031 </para>
34032 </listitem>
34033 <listitem>
34034 <para>
34035 Ditto, but for SRV records, when <option>check_srv</option> is set on this router.
34036 </para>
34037 </listitem>
34038 <listitem>
34039 <para>
34040 MX record points to a non-existent host.
34041 </para>
34042 </listitem>
34043 <listitem>
34044 <para>
34045 MX record points to an IP address and the main section option
34046 <option>allow_mx_to_ip</option> is not set.
34047 </para>
34048 </listitem>
34049 <listitem>
34050 <para>
34051 MX records exist and point to valid hosts, but all hosts resolve only to
34052 addresses blocked by the <option>ignore_target_hosts</option> generic option on this router.
34053 </para>
34054 </listitem>
34055 <listitem>
34056 <para>
34057 The domain is not syntactically valid (see also <option>allow_utf8_domains</option> and
34058 <option>dns_check_names_pattern</option> for handling one variant of this)
34059 </para>
34060 </listitem>
34061 <listitem>
34062 <para>
34063 <option>check_secondary_mx</option> is set on this router but the local host can
34064 not be found in the MX records (see below)
34065 </para>
34066 </listitem>
34067 </itemizedlist>
34068 </section>
34069 <section id="SECID118">
34070 <title>Private options for dnslookup</title>
34071 <para>
34072 <indexterm role="concept">
34073 <primary>options</primary>
34074 <secondary><command>dnslookup</command> router</secondary>
34075 </indexterm>
34076 The private options for the <command>dnslookup</command> router are as follows:
34077 </para>
34078 <para>
34079 <indexterm role="option">
34080 <primary><option>check_secondary_mx</option></primary>
34081 </indexterm>
34082 </para>
34083 <informaltable frame="all">
34084 <tgroup cols="4" colsep="0" rowsep="0">
34085 <colspec colwidth="8*" align="left"/>
34086 <colspec colwidth="6*" align="center"/>
34087 <colspec colwidth="6*" align="center"/>
34088 <colspec colwidth="6*" align="right"/>
34089 <tbody>
34090 <row>
34091 <entry><option>check_secondary_mx</option></entry>
34092 <entry>Use: <emphasis>dnslookup</emphasis></entry>
34093 <entry>Type: <emphasis>boolean</emphasis></entry>
34094 <entry>Default: <emphasis>false</emphasis></entry>
34095 </row>
34096 </tbody>
34097 </tgroup>
34098 </informaltable>
34099 <para>
34100 <indexterm role="concept">
34101 <primary>MX record</primary>
34102 <secondary>checking for secondary</secondary>
34103 </indexterm>
34104 If this option is set, the router declines unless the local host is found in
34105 (and removed from) the list of hosts obtained by MX lookup. This can be used to
34106 process domains for which the local host is a secondary mail exchanger
34107 differently to other domains. The way in which Exim decides whether a host is
34108 the local host is described in section <xref linkend="SECTreclocipadd"/>.
34109 </para>
34110 <para>
34111 <indexterm role="option">
34112 <primary><option>check_srv</option></primary>
34113 </indexterm>
34114 </para>
34115 <informaltable frame="all">
34116 <tgroup cols="4" colsep="0" rowsep="0">
34117 <colspec colwidth="8*" align="left"/>
34118 <colspec colwidth="6*" align="center"/>
34119 <colspec colwidth="6*" align="center"/>
34120 <colspec colwidth="6*" align="right"/>
34121 <tbody>
34122 <row>
34123 <entry><option>check_srv</option></entry>
34124 <entry>Use: <emphasis>dnslookup</emphasis></entry>
34125 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
34126 <entry>Default: <emphasis>unset</emphasis></entry>
34127 </row>
34128 </tbody>
34129 </tgroup>
34130 </informaltable>
34131 <para>
34132 <indexterm role="concept">
34133 <primary>SRV record</primary>
34134 <secondary>enabling use of</secondary>
34135 </indexterm>
34136 The <command>dnslookup</command> router supports the use of SRV records (see RFC 2782) in
34137 addition to MX and address records. The support is disabled by default. To
34138 enable SRV support, set the <option>check_srv</option> option to the name of the service
34139 required. For example,
34140 </para>
34141 <literallayout class="monospaced">
34142 check_srv = smtp
34143 </literallayout>
34144 <para>
34145 looks for SRV records that refer to the normal smtp service. The option is
34146 expanded, so the service name can vary from message to message or address
34147 to address. This might be helpful if SRV records are being used for a
34148 submission service. If the expansion is forced to fail, the <option>check_srv</option>
34149 option is ignored, and the router proceeds to look for MX records in the
34150 normal way.
34151 </para>
34152 <para>
34153 When the expansion succeeds, the router searches first for SRV records for
34154 the given service (it assumes TCP protocol). A single SRV record with a
34155 host name that consists of just a single dot indicates <quote>no such service for
34156 this domain</quote>; if this is encountered, the router declines. If other kinds of
34157 SRV record are found, they are used to construct a host list for delivery
34158 according to the rules of RFC 2782. MX records are not sought in this case.
34159 </para>
34160 <para>
34161 When no SRV records are found, MX records (and address records) are sought in
34162 the traditional way. In other words, SRV records take precedence over MX
34163 records, just as MX records take precedence over address records. Note that
34164 this behaviour is not sanctioned by RFC 2782, though a previous draft RFC
34165 defined it. It is apparently believed that MX records are sufficient for email
34166 and that SRV records should not be used for this purpose. However, SRV records
34167 have an additional <quote>weight</quote> feature which some people might find useful when
34168 trying to split an SMTP load between hosts of different power.
34169 </para>
34170 <para>
34171 See section <xref linkend="SECTprowitdnsloo"/> above for a discussion of Exim&#x2019;s behaviour
34172 when there is a DNS lookup error.
34173 </para>
34174 <para revisionflag="changed">
34175 <indexterm role="option">
34176 <primary><option>fail_defer_domains</option></primary>
34177 </indexterm>
34178 </para>
34179 <informaltable frame="all" revisionflag="changed">
34180 <tgroup cols="4" colsep="0" rowsep="0">
34181 <colspec colwidth="8*" align="left"/>
34182 <colspec colwidth="6*" align="center"/>
34183 <colspec colwidth="6*" align="center"/>
34184 <colspec colwidth="6*" align="right"/>
34185 <tbody>
34186 <row>
34187 <entry><option>fail_defer_domains</option></entry>
34188 <entry>Use: <emphasis>dnslookup</emphasis></entry>
34189 <entry>Type: <emphasis>domain list</emphasis>&dagger;<emphasis></emphasis></entry>
34190 <entry>Default: <emphasis>unset</emphasis></entry>
34191 </row>
34192 </tbody>
34193 </tgroup>
34194 </informaltable>
34195 <para revisionflag="changed">
34196 <indexterm role="concept">
34197 <primary>MX record</primary>
34198 <secondary>not found</secondary>
34199 </indexterm>
34200 DNS lookups for domains matching <option>fail_defer_domains</option>
34201 which find no matching record will cause the router to defer
34202 rather than the default behaviour of decline.
34203 This maybe be useful for queueing messages for a newly created
34204 domain while the DNS configuration is not ready.
34205 However, it will result in any message with mistyped domains
34206 also being queued.
34207 </para>
34208 <para>
34209 <indexterm role="option">
34210 <primary><option>mx_domains</option></primary>
34211 </indexterm>
34212 </para>
34213 <informaltable frame="all">
34214 <tgroup cols="4" colsep="0" rowsep="0">
34215 <colspec colwidth="8*" align="left"/>
34216 <colspec colwidth="6*" align="center"/>
34217 <colspec colwidth="6*" align="center"/>
34218 <colspec colwidth="6*" align="right"/>
34219 <tbody>
34220 <row>
34221 <entry><option>mx_domains</option></entry>
34222 <entry>Use: <emphasis>dnslookup</emphasis></entry>
34223 <entry>Type: <emphasis>domain list</emphasis>&dagger;<emphasis></emphasis></entry>
34224 <entry>Default: <emphasis>unset</emphasis></entry>
34225 </row>
34226 </tbody>
34227 </tgroup>
34228 </informaltable>
34229 <para>
34230 <indexterm role="concept">
34231 <primary>MX record</primary>
34232 <secondary>required to exist</secondary>
34233 </indexterm>
34234 <indexterm role="concept">
34235 <primary>SRV record</primary>
34236 <secondary>required to exist</secondary>
34237 </indexterm>
34238 A domain that matches <option>mx_domains</option> is required to have either an MX or an SRV
34239 record in order to be recognized. (The name of this option could be improved.)
34240 For example, if all the mail hosts in <emphasis>fict.example</emphasis> are known to have MX
34241 records, except for those in <emphasis>discworld.fict.example</emphasis>, you could use this
34242 setting:
34243 </para>
34244 <literallayout class="monospaced">
34245 mx_domains = ! *.discworld.fict.example : *.fict.example
34246 </literallayout>
34247 <para>
34248 This specifies that messages addressed to a domain that matches the list but
34249 has no MX record should be bounced immediately instead of being routed using
34250 the address record.
34251 </para>
34252 <para>
34253 <indexterm role="option">
34254 <primary><option>mx_fail_domains</option></primary>
34255 </indexterm>
34256 </para>
34257 <informaltable frame="all">
34258 <tgroup cols="4" colsep="0" rowsep="0">
34259 <colspec colwidth="8*" align="left"/>
34260 <colspec colwidth="6*" align="center"/>
34261 <colspec colwidth="6*" align="center"/>
34262 <colspec colwidth="6*" align="right"/>
34263 <tbody>
34264 <row>
34265 <entry><option>mx_fail_domains</option></entry>
34266 <entry>Use: <emphasis>dnslookup</emphasis></entry>
34267 <entry>Type: <emphasis>domain list</emphasis>&dagger;<emphasis></emphasis></entry>
34268 <entry>Default: <emphasis>unset</emphasis></entry>
34269 </row>
34270 </tbody>
34271 </tgroup>
34272 </informaltable>
34273 <para>
34274 If the DNS lookup for MX records for one of the domains in this list causes a
34275 DNS lookup error, Exim behaves as if no MX records were found. See section
34276 <xref linkend="SECTprowitdnsloo"/> for more discussion.
34277 </para>
34278 <para>
34279 <indexterm role="option">
34280 <primary><option>qualify_single</option></primary>
34281 </indexterm>
34282 </para>
34283 <informaltable frame="all">
34284 <tgroup cols="4" colsep="0" rowsep="0">
34285 <colspec colwidth="8*" align="left"/>
34286 <colspec colwidth="6*" align="center"/>
34287 <colspec colwidth="6*" align="center"/>
34288 <colspec colwidth="6*" align="right"/>
34289 <tbody>
34290 <row>
34291 <entry><option>qualify_single</option></entry>
34292 <entry>Use: <emphasis>dnslookup</emphasis></entry>
34293 <entry>Type: <emphasis>boolean</emphasis></entry>
34294 <entry>Default: <emphasis>true</emphasis></entry>
34295 </row>
34296 </tbody>
34297 </tgroup>
34298 </informaltable>
34299 <para>
34300 <indexterm role="concept">
34301 <primary>DNS</primary>
34302 <secondary>resolver options</secondary>
34303 </indexterm>
34304 <indexterm role="concept">
34305 <primary>DNS</primary>
34306 <secondary>qualifying single-component names</secondary>
34307 </indexterm>
34308 When this option is true, the resolver option RES_DEFNAMES is set for DNS
34309 lookups. Typically, but not standardly, this causes the resolver to qualify
34310 single-component names with the default domain. For example, on a machine
34311 called <emphasis>dictionary.ref.example</emphasis>, the domain <emphasis>thesaurus</emphasis> would be changed to
34312 <emphasis>thesaurus.ref.example</emphasis> inside the resolver. For details of what your
34313 resolver actually does, consult your man pages for <emphasis>resolver</emphasis> and
34314 <emphasis>resolv.conf</emphasis>.
34315 </para>
34316 <para>
34317 <indexterm role="option">
34318 <primary><option>rewrite_headers</option></primary>
34319 </indexterm>
34320 </para>
34321 <informaltable frame="all">
34322 <tgroup cols="4" colsep="0" rowsep="0">
34323 <colspec colwidth="8*" align="left"/>
34324 <colspec colwidth="6*" align="center"/>
34325 <colspec colwidth="6*" align="center"/>
34326 <colspec colwidth="6*" align="right"/>
34327 <tbody>
34328 <row>
34329 <entry><option>rewrite_headers</option></entry>
34330 <entry>Use: <emphasis>dnslookup</emphasis></entry>
34331 <entry>Type: <emphasis>boolean</emphasis></entry>
34332 <entry>Default: <emphasis>true</emphasis></entry>
34333 </row>
34334 </tbody>
34335 </tgroup>
34336 </informaltable>
34337 <para>
34338 <indexterm role="concept">
34339 <primary>rewriting</primary>
34340 <secondary>header lines</secondary>
34341 </indexterm>
34342 <indexterm role="concept">
34343 <primary>header lines</primary>
34344 <secondary>rewriting</secondary>
34345 </indexterm>
34346 If the domain name in the address that is being processed is not fully
34347 qualified, it may be expanded to its full form by a DNS lookup. For example, if
34348 an address is specified as <emphasis>dormouse@teaparty</emphasis>, the domain might be
34349 expanded to <emphasis>teaparty.wonderland.fict.example</emphasis>. Domain expansion can also
34350 occur as a result of setting the <option>widen_domains</option> option. If
34351 <option>rewrite_headers</option> is true, all occurrences of the abbreviated domain name in
34352 any <emphasis>Bcc:</emphasis>, <emphasis>Cc:</emphasis>, <emphasis>From:</emphasis>, <emphasis>Reply-to:</emphasis>, <emphasis>Sender:</emphasis>, and <emphasis>To:</emphasis>
34353 header lines of the message are rewritten with the full domain name.
34354 </para>
34355 <para>
34356 This option should be turned off only when it is known that no message is
34357 ever going to be sent outside an environment where the abbreviation makes
34358 sense.
34359 </para>
34360 <para>
34361 When an MX record is looked up in the DNS and matches a wildcard record, name
34362 servers normally return a record containing the name that has been looked up,
34363 making it impossible to detect whether a wildcard was present or not. However,
34364 some name servers have recently been seen to return the wildcard entry. If the
34365 name returned by a DNS lookup begins with an asterisk, it is not used for
34366 header rewriting.
34367 </para>
34368 <para>
34369 <indexterm role="option">
34370 <primary><option>same_domain_copy_routing</option></primary>
34371 </indexterm>
34372 </para>
34373 <informaltable frame="all">
34374 <tgroup cols="4" colsep="0" rowsep="0">
34375 <colspec colwidth="8*" align="left"/>
34376 <colspec colwidth="6*" align="center"/>
34377 <colspec colwidth="6*" align="center"/>
34378 <colspec colwidth="6*" align="right"/>
34379 <tbody>
34380 <row>
34381 <entry><option>same_domain_copy_routing</option></entry>
34382 <entry>Use: <emphasis>dnslookup</emphasis></entry>
34383 <entry>Type: <emphasis>boolean</emphasis></entry>
34384 <entry>Default: <emphasis>false</emphasis></entry>
34385 </row>
34386 </tbody>
34387 </tgroup>
34388 </informaltable>
34389 <para>
34390 <indexterm role="concept">
34391 <primary>address</primary>
34392 <secondary>copying routing</secondary>
34393 </indexterm>
34394 Addresses with the same domain are normally routed by the <command>dnslookup</command> router
34395 to the same list of hosts. However, this cannot be presumed, because the router
34396 options and preconditions may refer to the local part of the address. By
34397 default, therefore, Exim routes each address in a message independently. DNS
34398 servers run caches, so repeated DNS lookups are not normally expensive, and in
34399 any case, personal messages rarely have more than a few recipients.
34400 </para>
34401 <para>
34402 If you are running mailing lists with large numbers of subscribers at the same
34403 domain, and you are using a <command>dnslookup</command> router which is independent of the
34404 local part, you can set <option>same_domain_copy_routing</option> to bypass repeated DNS
34405 lookups for identical domains in one message. In this case, when <command>dnslookup</command>
34406 routes an address to a remote transport, any other unrouted addresses in the
34407 message that have the same domain are automatically given the same routing
34408 without processing them independently,
34409 provided the following conditions are met:
34410 </para>
34411 <itemizedlist>
34412 <listitem>
34413 <para>
34414 No router that processed the address specified <option>headers_add</option> or
34415 <option>headers_remove</option>.
34416 </para>
34417 </listitem>
34418 <listitem>
34419 <para>
34420 The router did not change the address in any way, for example, by <quote>widening</quote>
34421 the domain.
34422 </para>
34423 </listitem>
34424 </itemizedlist>
34425 <para>
34426 <indexterm role="option">
34427 <primary><option>search_parents</option></primary>
34428 </indexterm>
34429 </para>
34430 <informaltable frame="all">
34431 <tgroup cols="4" colsep="0" rowsep="0">
34432 <colspec colwidth="8*" align="left"/>
34433 <colspec colwidth="6*" align="center"/>
34434 <colspec colwidth="6*" align="center"/>
34435 <colspec colwidth="6*" align="right"/>
34436 <tbody>
34437 <row>
34438 <entry><option>search_parents</option></entry>
34439 <entry>Use: <emphasis>dnslookup</emphasis></entry>
34440 <entry>Type: <emphasis>boolean</emphasis></entry>
34441 <entry>Default: <emphasis>false</emphasis></entry>
34442 </row>
34443 </tbody>
34444 </tgroup>
34445 </informaltable>
34446 <para>
34447 <indexterm role="concept">
34448 <primary>DNS</primary>
34449 <secondary>resolver options</secondary>
34450 </indexterm>
34451 When this option is true, the resolver option RES_DNSRCH is set for DNS
34452 lookups. This is different from the <option>qualify_single</option> option in that it
34453 applies to domains containing dots. Typically, but not standardly, it causes
34454 the resolver to search for the name in the current domain and in parent
34455 domains. For example, on a machine in the <emphasis>fict.example</emphasis> domain, if looking
34456 up <emphasis>teaparty.wonderland</emphasis> failed, the resolver would try
34457 <emphasis>teaparty.wonderland.fict.example</emphasis>. For details of what your resolver
34458 actually does, consult your man pages for <emphasis>resolver</emphasis> and <emphasis>resolv.conf</emphasis>.
34459 </para>
34460 <para>
34461 Setting this option true can cause problems in domains that have a wildcard MX
34462 record, because any domain that does not have its own MX record matches the
34463 local wildcard.
34464 </para>
34465 <para>
34466 <indexterm role="option">
34467 <primary><option>srv_fail_domains</option></primary>
34468 </indexterm>
34469 </para>
34470 <informaltable frame="all">
34471 <tgroup cols="4" colsep="0" rowsep="0">
34472 <colspec colwidth="8*" align="left"/>
34473 <colspec colwidth="6*" align="center"/>
34474 <colspec colwidth="6*" align="center"/>
34475 <colspec colwidth="6*" align="right"/>
34476 <tbody>
34477 <row>
34478 <entry><option>srv_fail_domains</option></entry>
34479 <entry>Use: <emphasis>dnslookup</emphasis></entry>
34480 <entry>Type: <emphasis>domain list</emphasis>&dagger;<emphasis></emphasis></entry>
34481 <entry>Default: <emphasis>unset</emphasis></entry>
34482 </row>
34483 </tbody>
34484 </tgroup>
34485 </informaltable>
34486 <para>
34487 If the DNS lookup for SRV records for one of the domains in this list causes a
34488 DNS lookup error, Exim behaves as if no SRV records were found. See section
34489 <xref linkend="SECTprowitdnsloo"/> for more discussion.
34490 </para>
34491 <para>
34492 <indexterm role="option">
34493 <primary><option>widen_domains</option></primary>
34494 </indexterm>
34495 </para>
34496 <informaltable frame="all">
34497 <tgroup cols="4" colsep="0" rowsep="0">
34498 <colspec colwidth="8*" align="left"/>
34499 <colspec colwidth="6*" align="center"/>
34500 <colspec colwidth="6*" align="center"/>
34501 <colspec colwidth="6*" align="right"/>
34502 <tbody>
34503 <row>
34504 <entry><option>widen_domains</option></entry>
34505 <entry>Use: <emphasis>dnslookup</emphasis></entry>
34506 <entry>Type: <emphasis>string list</emphasis></entry>
34507 <entry>Default: <emphasis>unset</emphasis></entry>
34508 </row>
34509 </tbody>
34510 </tgroup>
34511 </informaltable>
34512 <para>
34513 <indexterm role="concept">
34514 <primary>domain</primary>
34515 <secondary>partial; widening</secondary>
34516 </indexterm>
34517 If a DNS lookup fails and this option is set, each of its strings in turn is
34518 added onto the end of the domain, and the lookup is tried again. For example,
34519 if
34520 </para>
34521 <literallayout class="monospaced">
34522 widen_domains = fict.example:ref.example
34523 </literallayout>
34524 <para>
34525 is set and a lookup of <emphasis>klingon.dictionary</emphasis> fails,
34526 <emphasis>klingon.dictionary.fict.example</emphasis> is looked up, and if this fails,
34527 <emphasis>klingon.dictionary.ref.example</emphasis> is tried. Note that the <option>qualify_single</option>
34528 and <option>search_parents</option> options can cause some widening to be undertaken inside
34529 the DNS resolver. <option>widen_domains</option> is not applied to sender addresses
34530 when verifying, unless <option>rewrite_headers</option> is false (not the default).
34531 </para>
34532 </section>
34533 <section id="SECID119">
34534 <title>Effect of qualify_single and search_parents</title>
34535 <para>
34536 When a domain from an envelope recipient is changed by the resolver as a result
34537 of the <option>qualify_single</option> or <option>search_parents</option> options, Exim rewrites the
34538 corresponding address in the message&#x2019;s header lines unless <option>rewrite_headers</option>
34539 is set false. Exim then re-routes the address, using the full domain.
34540 </para>
34541 <para>
34542 These two options affect only the DNS lookup that takes place inside the router
34543 for the domain of the address that is being routed. They do not affect lookups
34544 such as that implied by
34545 </para>
34546 <literallayout class="monospaced">
34547 domains = @mx_any
34548 </literallayout>
34549 <para>
34550 that may happen while processing a router precondition before the router is
34551 entered. No widening ever takes place for these lookups.
34552 <indexterm role="concept" startref="IIDdnsrou1" class="endofrange"/>
34553 <indexterm role="concept" startref="IIDdnsrou2" class="endofrange"/>
34554 </para>
34555 </section>
34556 </chapter>
34557
34558 <chapter id="CHID5">
34559 <title>The ipliteral router</title>
34560 <para>
34561 <indexterm role="concept">
34562 <primary><command>ipliteral</command> router</primary>
34563 </indexterm>
34564 <indexterm role="concept">
34565 <primary>domain literal</primary>
34566 <secondary>routing</secondary>
34567 </indexterm>
34568 <indexterm role="concept">
34569 <primary>routers</primary>
34570 <secondary><command>ipliteral</command></secondary>
34571 </indexterm>
34572 This router has no private options. Unless it is being used purely for
34573 verification (see <option>verify_only</option>) a transport is required to be defined by the
34574 generic <option>transport</option> option. The router accepts the address if its domain part
34575 takes the form of an RFC 2822 domain literal. For example, the <command>ipliteral</command>
34576 router handles the address
34577 </para>
34578 <literallayout class="monospaced">
34579 root@[192.168.1.1]
34580 </literallayout>
34581 <para>
34582 by setting up delivery to the host with that IP address. IPv4 domain literals
34583 consist of an IPv4 address enclosed in square brackets. IPv6 domain literals
34584 are similar, but the address is preceded by <literal>ipv6:</literal>. For example:
34585 </para>
34586 <literallayout class="monospaced">
34587 postmaster@[ipv6:fe80::a00:20ff:fe86:a061.5678]
34588 </literallayout>
34589 <para>
34590 Exim allows <literal>ipv4:</literal> before IPv4 addresses, for consistency, and on the
34591 grounds that sooner or later somebody will try it.
34592 </para>
34593 <para>
34594 <indexterm role="option">
34595 <primary><option>self</option></primary>
34596 <secondary>in <command>ipliteral</command> router</secondary>
34597 </indexterm>
34598 If the IP address matches something in <option>ignore_target_hosts</option>, the router
34599 declines. If an IP literal turns out to refer to the local host, the generic
34600 <option>self</option> option determines what happens.
34601 </para>
34602 <para>
34603 The RFCs require support for domain literals; however, their use is
34604 controversial in today&#x2019;s Internet. If you want to use this router, you must
34605 also set the main configuration option <option>allow_domain_literals</option>. Otherwise,
34606 Exim will not recognize the domain literal syntax in addresses.
34607 </para>
34608 </chapter>
34609
34610 <chapter id="CHID6">
34611 <title>The iplookup router</title>
34612 <para>
34613 <indexterm role="concept">
34614 <primary><command>iplookup</command> router</primary>
34615 </indexterm>
34616 <indexterm role="concept">
34617 <primary>routers</primary>
34618 <secondary><command>iplookup</command></secondary>
34619 </indexterm>
34620 The <command>iplookup</command> router was written to fulfil a specific requirement in
34621 Cambridge University (which in fact no longer exists). For this reason, it is
34622 not included in the binary of Exim by default. If you want to include it, you
34623 must set
34624 </para>
34625 <literallayout class="monospaced">
34626 ROUTER_IPLOOKUP=yes
34627 </literallayout>
34628 <para>
34629 in your <filename>Local/Makefile</filename> configuration file.
34630 </para>
34631 <para>
34632 The <command>iplookup</command> router routes an address by sending it over a TCP or UDP
34633 connection to one or more specific hosts. The host can then return the same or
34634 a different address &ndash; in effect rewriting the recipient address in the
34635 message&#x2019;s envelope. The new address is then passed on to subsequent routers. If
34636 this process fails, the address can be passed on to other routers, or delivery
34637 can be deferred. Since <command>iplookup</command> is just a rewriting router, a transport
34638 must not be specified for it.
34639 </para>
34640 <para>
34641 <indexterm role="concept">
34642 <primary>options</primary>
34643 <secondary><command>iplookup</command> router</secondary>
34644 </indexterm>
34645 <indexterm role="option">
34646 <primary><option>hosts</option></primary>
34647 </indexterm>
34648 </para>
34649 <informaltable frame="all">
34650 <tgroup cols="4" colsep="0" rowsep="0">
34651 <colspec colwidth="8*" align="left"/>
34652 <colspec colwidth="6*" align="center"/>
34653 <colspec colwidth="6*" align="center"/>
34654 <colspec colwidth="6*" align="right"/>
34655 <tbody>
34656 <row>
34657 <entry><option>hosts</option></entry>
34658 <entry>Use: <emphasis>iplookup</emphasis></entry>
34659 <entry>Type: <emphasis>string</emphasis></entry>
34660 <entry>Default: <emphasis>unset</emphasis></entry>
34661 </row>
34662 </tbody>
34663 </tgroup>
34664 </informaltable>
34665 <para>
34666 This option must be supplied. Its value is a colon-separated list of host
34667 names. The hosts are looked up using <function>gethostbyname()</function>
34668 (or <function>getipnodebyname()</function> when available)
34669 and are tried in order until one responds to the query. If none respond, what
34670 happens is controlled by <option>optional</option>.
34671 </para>
34672 <para>
34673 <indexterm role="option">
34674 <primary><option>optional</option></primary>
34675 </indexterm>
34676 </para>
34677 <informaltable frame="all">
34678 <tgroup cols="4" colsep="0" rowsep="0">
34679 <colspec colwidth="8*" align="left"/>
34680 <colspec colwidth="6*" align="center"/>
34681 <colspec colwidth="6*" align="center"/>
34682 <colspec colwidth="6*" align="right"/>
34683 <tbody>
34684 <row>
34685 <entry><option>optional</option></entry>
34686 <entry>Use: <emphasis>iplookup</emphasis></entry>
34687 <entry>Type: <emphasis>boolean</emphasis></entry>
34688 <entry>Default: <emphasis>false</emphasis></entry>
34689 </row>
34690 </tbody>
34691 </tgroup>
34692 </informaltable>
34693 <para>
34694 If <option>optional</option> is true, if no response is obtained from any host, the address
34695 is passed to the next router, overriding <option>no_more</option>. If <option>optional</option> is false,
34696 delivery to the address is deferred.
34697 </para>
34698 <para>
34699 <indexterm role="option">
34700 <primary><option>port</option></primary>
34701 </indexterm>
34702 </para>
34703 <informaltable frame="all">
34704 <tgroup cols="4" colsep="0" rowsep="0">
34705 <colspec colwidth="8*" align="left"/>
34706 <colspec colwidth="6*" align="center"/>
34707 <colspec colwidth="6*" align="center"/>
34708 <colspec colwidth="6*" align="right"/>
34709 <tbody>
34710 <row>
34711 <entry><option>port</option></entry>
34712 <entry>Use: <emphasis>iplookup</emphasis></entry>
34713 <entry>Type: <emphasis>integer</emphasis></entry>
34714 <entry>Default: <emphasis>0</emphasis></entry>
34715 </row>
34716 </tbody>
34717 </tgroup>
34718 </informaltable>
34719 <para>
34720 <indexterm role="concept">
34721 <primary>port</primary>
34722 <secondary><command>iplookup</command> router</secondary>
34723 </indexterm>
34724 This option must be supplied. It specifies the port number for the TCP or UDP
34725 call.
34726 </para>
34727 <para>
34728 <indexterm role="option">
34729 <primary><option>protocol</option></primary>
34730 </indexterm>
34731 </para>
34732 <informaltable frame="all">
34733 <tgroup cols="4" colsep="0" rowsep="0">
34734 <colspec colwidth="8*" align="left"/>
34735 <colspec colwidth="6*" align="center"/>
34736 <colspec colwidth="6*" align="center"/>
34737 <colspec colwidth="6*" align="right"/>
34738 <tbody>
34739 <row>
34740 <entry><option>protocol</option></entry>
34741 <entry>Use: <emphasis>iplookup</emphasis></entry>
34742 <entry>Type: <emphasis>string</emphasis></entry>
34743 <entry>Default: <emphasis>udp</emphasis></entry>
34744 </row>
34745 </tbody>
34746 </tgroup>
34747 </informaltable>
34748 <para>
34749 This option can be set to <quote>udp</quote> or <quote>tcp</quote> to specify which of the two
34750 protocols is to be used.
34751 </para>
34752 <para>
34753 <indexterm role="option">
34754 <primary><option>query</option></primary>
34755 </indexterm>
34756 </para>
34757 <informaltable frame="all">
34758 <tgroup cols="4" colsep="0" rowsep="0">
34759 <colspec colwidth="8*" align="left"/>
34760 <colspec colwidth="6*" align="center"/>
34761 <colspec colwidth="6*" align="center"/>
34762 <colspec colwidth="6*" align="right"/>
34763 <tbody>
34764 <row>
34765 <entry><option>query</option></entry>
34766 <entry>Use: <emphasis>iplookup</emphasis></entry>
34767 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
34768 <entry>Default: <emphasis>see below</emphasis></entry>
34769 </row>
34770 </tbody>
34771 </tgroup>
34772 </informaltable>
34773 <para>
34774 This defines the content of the query that is sent to the remote hosts. The
34775 default value is:
34776 </para>
34777 <literallayout class="monospaced">
34778 $local_part@$domain $local_part@$domain
34779 </literallayout>
34780 <para>
34781 The repetition serves as a way of checking that a response is to the correct
34782 query in the default case (see <option>response_pattern</option> below).
34783 </para>
34784 <para>
34785 <indexterm role="option">
34786 <primary><option>reroute</option></primary>
34787 </indexterm>
34788 </para>
34789 <informaltable frame="all">
34790 <tgroup cols="4" colsep="0" rowsep="0">
34791 <colspec colwidth="8*" align="left"/>
34792 <colspec colwidth="6*" align="center"/>
34793 <colspec colwidth="6*" align="center"/>
34794 <colspec colwidth="6*" align="right"/>
34795 <tbody>
34796 <row>
34797 <entry><option>reroute</option></entry>
34798 <entry>Use: <emphasis>iplookup</emphasis></entry>
34799 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
34800 <entry>Default: <emphasis>unset</emphasis></entry>
34801 </row>
34802 </tbody>
34803 </tgroup>
34804 </informaltable>
34805 <para>
34806 If this option is not set, the rerouted address is precisely the byte string
34807 returned by the remote host, up to the first white space, if any. If set, the
34808 string is expanded to form the rerouted address. It can include parts matched
34809 in the response by <option>response_pattern</option> by means of numeric variables such as
34810 <varname>$1</varname>, <varname>$2</varname>, etc. The variable <varname>$0</varname> refers to the entire input string,
34811 whether or not a pattern is in use. In all cases, the rerouted address must end
34812 up in the form <emphasis>local_part@domain</emphasis>.
34813 </para>
34814 <para>
34815 <indexterm role="option">
34816 <primary><option>response_pattern</option></primary>
34817 </indexterm>
34818 </para>
34819 <informaltable frame="all">
34820 <tgroup cols="4" colsep="0" rowsep="0">
34821 <colspec colwidth="8*" align="left"/>
34822 <colspec colwidth="6*" align="center"/>
34823 <colspec colwidth="6*" align="center"/>
34824 <colspec colwidth="6*" align="right"/>
34825 <tbody>
34826 <row>
34827 <entry><option>response_pattern</option></entry>
34828 <entry>Use: <emphasis>iplookup</emphasis></entry>
34829 <entry>Type: <emphasis>string</emphasis></entry>
34830 <entry>Default: <emphasis>unset</emphasis></entry>
34831 </row>
34832 </tbody>
34833 </tgroup>
34834 </informaltable>
34835 <para>
34836 This option can be set to a regular expression that is applied to the string
34837 returned from the remote host. If the pattern does not match the response, the
34838 router declines. If <option>response_pattern</option> is not set, no checking of the
34839 response is done, unless the query was defaulted, in which case there is a
34840 check that the text returned after the first white space is the original
34841 address. This checks that the answer that has been received is in response to
34842 the correct question. For example, if the response is just a new domain, the
34843 following could be used:
34844 </para>
34845 <literallayout class="monospaced">
34846 response_pattern = ^([^@]+)$
34847 reroute = $local_part@$1
34848 </literallayout>
34849 <para>
34850 <indexterm role="option">
34851 <primary><option>timeout</option></primary>
34852 </indexterm>
34853 </para>
34854 <informaltable frame="all">
34855 <tgroup cols="4" colsep="0" rowsep="0">
34856 <colspec colwidth="8*" align="left"/>
34857 <colspec colwidth="6*" align="center"/>
34858 <colspec colwidth="6*" align="center"/>
34859 <colspec colwidth="6*" align="right"/>
34860 <tbody>
34861 <row>
34862 <entry><option>timeout</option></entry>
34863 <entry>Use: <emphasis>iplookup</emphasis></entry>
34864 <entry>Type: <emphasis>time</emphasis></entry>
34865 <entry>Default: <emphasis>5s</emphasis></entry>
34866 </row>
34867 </tbody>
34868 </tgroup>
34869 </informaltable>
34870 <para>
34871 This specifies the amount of time to wait for a response from the remote
34872 machine. The same timeout is used for the <function>connect()</function> function for a TCP
34873 call. It does not apply to UDP.
34874 </para>
34875 </chapter>
34876
34877 <chapter id="CHID7">
34878 <title>The manualroute router</title>
34879 <para>
34880 <indexterm role="concept" id="IIDmanrou1" class="startofrange">
34881 <primary><command>manualroute</command> router</primary>
34882 </indexterm>
34883 <indexterm role="concept" id="IIDmanrou2" class="startofrange">
34884 <primary>routers</primary>
34885 <secondary><command>manualroute</command></secondary>
34886 </indexterm>
34887 <indexterm role="concept">
34888 <primary>domain</primary>
34889 <secondary>manually routing</secondary>
34890 </indexterm>
34891 The <command>manualroute</command> router is so-called because it provides a way of manually
34892 routing an address according to its domain. It is mainly used when you want to
34893 route addresses to remote hosts according to your own rules, bypassing the
34894 normal DNS routing that looks up MX records. However, <command>manualroute</command> can also
34895 route to local transports, a facility that may be useful if you want to save
34896 messages for dial-in hosts in local files.
34897 </para>
34898 <para>
34899 The <command>manualroute</command> router compares a list of domain patterns with the domain
34900 it is trying to route. If there is no match, the router declines. Each pattern
34901 has associated with it a list of hosts and some other optional data, which may
34902 include a transport. The combination of a pattern and its data is called a
34903 <quote>routing rule</quote>. For patterns that do not have an associated transport, the
34904 generic <option>transport</option> option must specify a transport, unless the router is
34905 being used purely for verification (see <option>verify_only</option>).
34906 </para>
34907 <para>
34908 <indexterm role="variable">
34909 <primary><varname>$host</varname></primary>
34910 </indexterm>
34911 In the case of verification, matching the domain pattern is sufficient for the
34912 router to accept the address. When actually routing an address for delivery,
34913 an address that matches a domain pattern is queued for the associated
34914 transport. If the transport is not a local one, a host list must be associated
34915 with the pattern; IP addresses are looked up for the hosts, and these are
34916 passed to the transport along with the mail address. For local transports, a
34917 host list is optional. If it is present, it is passed in <varname>$host</varname> as a single
34918 text string.
34919 </para>
34920 <para>
34921 The list of routing rules can be provided as an inline string in
34922 <option>route_list</option>, or the data can be obtained by looking up the domain in a file
34923 or database by setting <option>route_data</option>. Only one of these settings may appear in
34924 any one instance of <command>manualroute</command>. The format of routing rules is described
34925 below, following the list of private options.
34926 </para>
34927 <section id="SECTprioptman">
34928 <title>Private options for manualroute</title>
34929 <para>
34930 <indexterm role="concept">
34931 <primary>options</primary>
34932 <secondary><command>manualroute</command> router</secondary>
34933 </indexterm>
34934 The private options for the <command>manualroute</command> router are as follows:
34935 </para>
34936 <para>
34937 <indexterm role="option">
34938 <primary><option>host_all_ignored</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>host_all_ignored</option></entry>
34950 <entry>Use: <emphasis>manualroute</emphasis></entry>
34951 <entry>Type: <emphasis>string</emphasis></entry>
34952 <entry>Default: <emphasis>defer</emphasis></entry>
34953 </row>
34954 </tbody>
34955 </tgroup>
34956 </informaltable>
34957 <para>
34958 See <option>host_find_failed</option>.
34959 </para>
34960 <para>
34961 <indexterm role="option">
34962 <primary><option>host_find_failed</option></primary>
34963 </indexterm>
34964 </para>
34965 <informaltable frame="all">
34966 <tgroup cols="4" colsep="0" rowsep="0">
34967 <colspec colwidth="8*" align="left"/>
34968 <colspec colwidth="6*" align="center"/>
34969 <colspec colwidth="6*" align="center"/>
34970 <colspec colwidth="6*" align="right"/>
34971 <tbody>
34972 <row>
34973 <entry><option>host_find_failed</option></entry>
34974 <entry>Use: <emphasis>manualroute</emphasis></entry>
34975 <entry>Type: <emphasis>string</emphasis></entry>
34976 <entry>Default: <emphasis>freeze</emphasis></entry>
34977 </row>
34978 </tbody>
34979 </tgroup>
34980 </informaltable>
34981 <para>
34982 This option controls what happens when <command>manualroute</command> tries to find an IP
34983 address for a host, and the host does not exist. The option can be set to one
34984 of the following values:
34985 </para>
34986 <literallayout class="monospaced">
34987 decline
34988 defer
34989 fail
34990 freeze
34991 ignore
34992 pass
34993 </literallayout>
34994 <para>
34995 The default (<quote>freeze</quote>) assumes that this state is a serious configuration
34996 error. The difference between <quote>pass</quote> and <quote>decline</quote> is that the former
34997 forces the address to be passed to the next router (or the router defined by
34998 <option>pass_router</option>),
34999 <indexterm role="option">
35000 <primary><option>more</option></primary>
35001 </indexterm>
35002 overriding <option>no_more</option>, whereas the latter passes the address to the next
35003 router only if <option>more</option> is true.
35004 </para>
35005 <para>
35006 The value <quote>ignore</quote> causes Exim to completely ignore a host whose IP address
35007 cannot be found. If all the hosts in the list are ignored, the behaviour is
35008 controlled by the <option>host_all_ignored</option> option. This takes the same values
35009 as <option>host_find_failed</option>, except that it cannot be set to <quote>ignore</quote>.
35010 </para>
35011 <para>
35012 The <option>host_find_failed</option> option applies only to a definite <quote>does not exist</quote>
35013 state; if a host lookup gets a temporary error, delivery is deferred unless the
35014 generic <option>pass_on_timeout</option> option is set.
35015 </para>
35016 <para>
35017 <indexterm role="option">
35018 <primary><option>hosts_randomize</option></primary>
35019 </indexterm>
35020 </para>
35021 <informaltable frame="all">
35022 <tgroup cols="4" colsep="0" rowsep="0">
35023 <colspec colwidth="8*" align="left"/>
35024 <colspec colwidth="6*" align="center"/>
35025 <colspec colwidth="6*" align="center"/>
35026 <colspec colwidth="6*" align="right"/>
35027 <tbody>
35028 <row>
35029 <entry><option>hosts_randomize</option></entry>
35030 <entry>Use: <emphasis>manualroute</emphasis></entry>
35031 <entry>Type: <emphasis>boolean</emphasis></entry>
35032 <entry>Default: <emphasis>false</emphasis></entry>
35033 </row>
35034 </tbody>
35035 </tgroup>
35036 </informaltable>
35037 <para>
35038 <indexterm role="concept">
35039 <primary>randomized host list</primary>
35040 </indexterm>
35041 <indexterm role="concept">
35042 <primary>host</primary>
35043 <secondary>list of; randomized</secondary>
35044 </indexterm>
35045 If this option is set, the order of the items in a host list in a routing rule
35046 is randomized each time the list is used, unless an option in the routing rule
35047 overrides (see below). Randomizing the order of a host list can be used to do
35048 crude load sharing. However, if more than one mail address is routed by the
35049 same router to the same host list, the host lists are considered to be the same
35050 (even though they may be randomized into different orders) for the purpose of
35051 deciding whether to batch the deliveries into a single SMTP transaction.
35052 </para>
35053 <para>
35054 When <option>hosts_randomize</option> is true, a host list may be split
35055 into groups whose order is separately randomized. This makes it possible to
35056 set up MX-like behaviour. The boundaries between groups are indicated by an
35057 item that is just <literal>+</literal> in the host list. For example:
35058 </para>
35059 <literallayout class="monospaced">
35060 route_list = * host1:host2:host3:+:host4:host5
35061 </literallayout>
35062 <para>
35063 The order of the first three hosts and the order of the last two hosts is
35064 randomized for each use, but the first three always end up before the last two.
35065 If <option>hosts_randomize</option> is not set, a <literal>+</literal> item in the list is ignored. If a
35066 randomized host list is passed to an <command>smtp</command> transport that also has
35067 <option>hosts_randomize set</option>, the list is not re-randomized.
35068 </para>
35069 <para>
35070 <indexterm role="option">
35071 <primary><option>route_data</option></primary>
35072 </indexterm>
35073 </para>
35074 <informaltable frame="all">
35075 <tgroup cols="4" colsep="0" rowsep="0">
35076 <colspec colwidth="8*" align="left"/>
35077 <colspec colwidth="6*" align="center"/>
35078 <colspec colwidth="6*" align="center"/>
35079 <colspec colwidth="6*" align="right"/>
35080 <tbody>
35081 <row>
35082 <entry><option>route_data</option></entry>
35083 <entry>Use: <emphasis>manualroute</emphasis></entry>
35084 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
35085 <entry>Default: <emphasis>unset</emphasis></entry>
35086 </row>
35087 </tbody>
35088 </tgroup>
35089 </informaltable>
35090 <para>
35091 If this option is set, it must expand to yield the data part of a routing rule.
35092 Typically, the expansion string includes a lookup based on the domain. For
35093 example:
35094 </para>
35095 <literallayout class="monospaced">
35096 route_data = ${lookup{$domain}dbm{/etc/routes}}
35097 </literallayout>
35098 <para>
35099 If the expansion is forced to fail, or the result is an empty string, the
35100 router declines. Other kinds of expansion failure cause delivery to be
35101 deferred.
35102 </para>
35103 <para>
35104 <indexterm role="option">
35105 <primary><option>route_list</option></primary>
35106 </indexterm>
35107 </para>
35108 <informaltable frame="all">
35109 <tgroup cols="4" colsep="0" rowsep="0">
35110 <colspec colwidth="8*" align="left"/>
35111 <colspec colwidth="6*" align="center"/>
35112 <colspec colwidth="6*" align="center"/>
35113 <colspec colwidth="6*" align="right"/>
35114 <tbody>
35115 <row>
35116 <entry><option>route_list</option></entry>
35117 <entry>Use: <emphasis>manualroute</emphasis></entry>
35118 <entry>Type: <emphasis>string list</emphasis></entry>
35119 <entry>Default: <emphasis>unset</emphasis></entry>
35120 </row>
35121 </tbody>
35122 </tgroup>
35123 </informaltable>
35124 <para>
35125 This string is a list of routing rules, in the form defined below. Note that,
35126 unlike most string lists, the items are separated by semicolons. This is so
35127 that they may contain colon-separated host lists.
35128 </para>
35129 <para>
35130 <indexterm role="option">
35131 <primary><option>same_domain_copy_routing</option></primary>
35132 </indexterm>
35133 </para>
35134 <informaltable frame="all">
35135 <tgroup cols="4" colsep="0" rowsep="0">
35136 <colspec colwidth="8*" align="left"/>
35137 <colspec colwidth="6*" align="center"/>
35138 <colspec colwidth="6*" align="center"/>
35139 <colspec colwidth="6*" align="right"/>
35140 <tbody>
35141 <row>
35142 <entry><option>same_domain_copy_routing</option></entry>
35143 <entry>Use: <emphasis>manualroute</emphasis></entry>
35144 <entry>Type: <emphasis>boolean</emphasis></entry>
35145 <entry>Default: <emphasis>false</emphasis></entry>
35146 </row>
35147 </tbody>
35148 </tgroup>
35149 </informaltable>
35150 <para>
35151 <indexterm role="concept">
35152 <primary>address</primary>
35153 <secondary>copying routing</secondary>
35154 </indexterm>
35155 Addresses with the same domain are normally routed by the <command>manualroute</command>
35156 router to the same list of hosts. However, this cannot be presumed, because the
35157 router options and preconditions may refer to the local part of the address. By
35158 default, therefore, Exim routes each address in a message independently. DNS
35159 servers run caches, so repeated DNS lookups are not normally expensive, and in
35160 any case, personal messages rarely have more than a few recipients.
35161 </para>
35162 <para>
35163 If you are running mailing lists with large numbers of subscribers at the same
35164 domain, and you are using a <command>manualroute</command> router which is independent of the
35165 local part, you can set <option>same_domain_copy_routing</option> to bypass repeated DNS
35166 lookups for identical domains in one message. In this case, when
35167 <command>manualroute</command> routes an address to a remote transport, any other unrouted
35168 addresses in the message that have the same domain are automatically given the
35169 same routing without processing them independently. However, this is only done
35170 if <option>headers_add</option> and <option>headers_remove</option> are unset.
35171 </para>
35172 </section>
35173 <section id="SECID120">
35174 <title>Routing rules in route_list</title>
35175 <para>
35176 The value of <option>route_list</option> is a string consisting of a sequence of routing
35177 rules, separated by semicolons. If a semicolon is needed in a rule, it can be
35178 entered as two semicolons. Alternatively, the list separator can be changed as
35179 described (for colon-separated lists) in section <xref linkend="SECTlistconstruct"/>.
35180 Empty rules are ignored. The format of each rule is
35181 </para>
35182 <literallayout>
35183 &lt;<emphasis>domain pattern</emphasis>&gt;  &lt;<emphasis>list of hosts</emphasis>&gt;  &lt;<emphasis>options</emphasis>&gt;
35184 </literallayout>
35185 <para>
35186 The following example contains two rules, each with a simple domain pattern and
35187 no options:
35188 </para>
35189 <literallayout class="monospaced">
35190 route_list = \
35191   dict.ref.example  mail-1.ref.example:mail-2.ref.example ; \
35192   thes.ref.example  mail-3.ref.example:mail-4.ref.example
35193 </literallayout>
35194 <para>
35195 The three parts of a rule are separated by white space. The pattern and the
35196 list of hosts can be enclosed in quotes if necessary, and if they are, the
35197 usual quoting rules apply. Each rule in a <option>route_list</option> must start with a
35198 single domain pattern, which is the only mandatory item in the rule. The
35199 pattern is in the same format as one item in a domain list (see section
35200 <xref linkend="SECTdomainlist"/>),
35201 except that it may not be the name of an interpolated file.
35202 That is, it may be wildcarded, or a regular expression, or a file or database
35203 lookup (with semicolons doubled, because of the use of semicolon as a separator
35204 in a <option>route_list</option>).
35205 </para>
35206 <para>
35207 The rules in <option>route_list</option> are searched in order until one of the patterns
35208 matches the domain that is being routed. The list of hosts and then options are
35209 then used as described below. If there is no match, the router declines. When
35210 <option>route_list</option> is set, <option>route_data</option> must not be set.
35211 </para>
35212 </section>
35213 <section id="SECID121">
35214 <title>Routing rules in route_data</title>
35215 <para>
35216 The use of <option>route_list</option> is convenient when there are only a small number of
35217 routing rules. For larger numbers, it is easier to use a file or database to
35218 hold the routing information, and use the <option>route_data</option> option instead.
35219 The value of <option>route_data</option> is a list of hosts, followed by (optional) options.
35220 Most commonly, <option>route_data</option> is set as a string that contains an
35221 expansion lookup. For example, suppose we place two routing rules in a file
35222 like this:
35223 </para>
35224 <literallayout class="monospaced">
35225 dict.ref.example:  mail-1.ref.example:mail-2.ref.example
35226 thes.ref.example:  mail-3.ref.example:mail-4.ref.example
35227 </literallayout>
35228 <para>
35229 This data can be accessed by setting
35230 </para>
35231 <literallayout class="monospaced">
35232 route_data = ${lookup{$domain}lsearch{/the/file/name}}
35233 </literallayout>
35234 <para>
35235 Failure of the lookup results in an empty string, causing the router to
35236 decline. However, you do not have to use a lookup in <option>route_data</option>. The only
35237 requirement is that the result of expanding the string is a list of hosts,
35238 possibly followed by options, separated by white space. The list of hosts must
35239 be enclosed in quotes if it contains white space.
35240 </para>
35241 </section>
35242 <section id="SECID122">
35243 <title>Format of the list of hosts</title>
35244 <para>
35245 A list of hosts, whether obtained via <option>route_data</option> or <option>route_list</option>, is
35246 always separately expanded before use. If the expansion fails, the router
35247 declines. The result of the expansion must be a colon-separated list of names
35248 and/or IP addresses, optionally also including ports. The format of each item
35249 in the list is described in the next section. The list separator can be changed
35250 as described in section <xref linkend="SECTlistconstruct"/>.
35251 </para>
35252 <para>
35253 If the list of hosts was obtained from a <option>route_list</option> item, the following
35254 variables are set during its expansion:
35255 </para>
35256 <itemizedlist>
35257 <listitem>
35258 <para>
35259 <indexterm role="concept">
35260 <primary>numerical variables (<varname>$1</varname> <varname>$2</varname>  etc)</primary>
35261 <secondary>in <command>manualroute</command> router</secondary>
35262 </indexterm>
35263 If the domain was matched against a regular expression, the numeric variables
35264 <varname>$1</varname>, <varname>$2</varname>, etc. may be set. For example:
35265 </para>
35266 <literallayout class="monospaced">
35267 route_list = ^domain(\d+)   host-$1.text.example
35268 </literallayout>
35269 </listitem>
35270 <listitem>
35271 <para>
35272 <varname>$0</varname> is always set to the entire domain.
35273 </para>
35274 </listitem>
35275 <listitem>
35276 <para>
35277 <varname>$1</varname> is also set when partial matching is done in a file lookup.
35278 </para>
35279 </listitem>
35280 <listitem>
35281 <para>
35282 <indexterm role="variable">
35283 <primary><varname>$value</varname></primary>
35284 </indexterm>
35285 If the pattern that matched the domain was a lookup item, the data that was
35286 looked up is available in the expansion variable <varname>$value</varname>. For example:
35287 </para>
35288 <literallayout class="monospaced">
35289 route_list = lsearch;;/some/file.routes  $value
35290 </literallayout>
35291 </listitem>
35292 </itemizedlist>
35293 <para>
35294 Note the doubling of the semicolon in the pattern that is necessary because
35295 semicolon is the default route list separator.
35296 </para>
35297 </section>
35298 <section id="SECTformatonehostitem">
35299 <title>Format of one host item</title>
35300 <para>
35301 Each item in the list of hosts is either a host name or an IP address,
35302 optionally with an attached port number. When no port is given, an IP address
35303 is not enclosed in brackets. When a port is specified, it overrides the port
35304 specification on the transport. The port is separated from the name or address
35305 by a colon. This leads to some complications:
35306 </para>
35307 <itemizedlist>
35308 <listitem>
35309 <para>
35310 Because colon is the default separator for the list of hosts, either
35311 the colon that specifies a port must be doubled, or the list separator must
35312 be changed. The following two examples have the same effect:
35313 </para>
35314 <literallayout class="monospaced">
35315 route_list = * "host1.tld::1225 : host2.tld::1226"
35316 route_list = * "&lt;+ host1.tld:1225 + host2.tld:1226"
35317 </literallayout>
35318 </listitem>
35319 <listitem>
35320 <para>
35321 When IPv6 addresses are involved, it gets worse, because they contain
35322 colons of their own. To make this case easier, it is permitted to
35323 enclose an IP address (either v4 or v6) in square brackets if a port
35324 number follows. For example:
35325 </para>
35326 <literallayout class="monospaced">
35327 route_list = * "&lt;/ [10.1.1.1]:1225 / [::1]:1226"
35328 </literallayout>
35329 </listitem>
35330 </itemizedlist>
35331 </section>
35332 <section id="SECThostshowused">
35333 <title>How the list of hosts is used</title>
35334 <para>
35335 When an address is routed to an <command>smtp</command> transport by <command>manualroute</command>, each of
35336 the hosts is tried, in the order specified, when carrying out the SMTP
35337 delivery. However, the order can be changed by setting the <option>hosts_randomize</option>
35338 option, either on the router (see section <xref linkend="SECTprioptman"/> above), or on the
35339 transport.
35340 </para>
35341 <para>
35342 Hosts may be listed by name or by IP address. An unadorned name in the list of
35343 hosts is interpreted as a host name. A name that is followed by <literal>/MX</literal> is
35344 interpreted as an indirection to a sublist of hosts obtained by looking up MX
35345 records in the DNS. For example:
35346 </para>
35347 <literallayout class="monospaced">
35348 route_list = *  x.y.z:p.q.r/MX:e.f.g
35349 </literallayout>
35350 <para>
35351 If this feature is used with a port specifier, the port must come last. For
35352 example:
35353 </para>
35354 <literallayout class="monospaced">
35355 route_list = *  dom1.tld/mx::1225
35356 </literallayout>
35357 <para>
35358 If the <option>hosts_randomize</option> option is set, the order of the items in the list is
35359 randomized before any lookups are done. Exim then scans the list; for any name
35360 that is not followed by <literal>/MX</literal> it looks up an IP address. If this turns out to
35361 be an interface on the local host and the item is not the first in the list,
35362 Exim discards it and any subsequent items. If it is the first item, what
35363 happens is controlled by the
35364 <indexterm role="option">
35365 <primary><option>self</option></primary>
35366 <secondary>in <command>manualroute</command> router</secondary>
35367 </indexterm>
35368 <option>self</option> option of the router.
35369 </para>
35370 <para>
35371 A name on the list that is followed by <literal>/MX</literal> is replaced with the list of
35372 hosts obtained by looking up MX records for the name. This is always a DNS
35373 lookup; the <option>bydns</option> and <option>byname</option> options (see section <xref linkend="SECThowoptused"/>
35374 below) are not relevant here. The order of these hosts is determined by the
35375 preference values in the MX records, according to the usual rules. Because
35376 randomizing happens before the MX lookup, it does not affect the order that is
35377 defined by MX preferences.
35378 </para>
35379 <para>
35380 If the local host is present in the sublist obtained from MX records, but is
35381 not the most preferred host in that list, it and any equally or less
35382 preferred hosts are removed before the sublist is inserted into the main list.
35383 </para>
35384 <para>
35385 If the local host is the most preferred host in the MX list, what happens
35386 depends on where in the original list of hosts the <literal>/MX</literal> item appears. If it
35387 is not the first item (that is, there are previous hosts in the main list),
35388 Exim discards this name and any subsequent items in the main list.
35389 </para>
35390 <para>
35391 If the MX item is first in the list of hosts, and the local host is the
35392 most preferred host, what happens is controlled by the <option>self</option> option of the
35393 router.
35394 </para>
35395 <para>
35396 DNS failures when lookup up the MX records are treated in the same way as DNS
35397 failures when looking up IP addresses: <option>pass_on_timeout</option> and
35398 <option>host_find_failed</option> are used when relevant.
35399 </para>
35400 <para>
35401 The generic <option>ignore_target_hosts</option> option applies to all hosts in the list,
35402 whether obtained from an MX lookup or not.
35403 </para>
35404 </section>
35405 <section id="SECThowoptused">
35406 <title>How the options are used</title>
35407 <para>
35408 The options are a sequence of words; in practice no more than three are ever
35409 present. One of the words can be the name of a transport; this overrides the
35410 <option>transport</option> option on the router for this particular routing rule only. The
35411 other words (if present) control randomization of the list of hosts on a
35412 per-rule basis, and how the IP addresses of the hosts are to be found when
35413 routing to a remote transport. These options are as follows:
35414 </para>
35415 <itemizedlist>
35416 <listitem>
35417 <para>
35418 <option>randomize</option>: randomize the order of the hosts in this list, overriding the
35419 setting of <option>hosts_randomize</option> for this routing rule only.
35420 </para>
35421 </listitem>
35422 <listitem>
35423 <para>
35424 <option>no_randomize</option>: do not randomize the order of the hosts in this list,
35425 overriding the setting of <option>hosts_randomize</option> for this routing rule only.
35426 </para>
35427 </listitem>
35428 <listitem>
35429 <para>
35430 <option>byname</option>: use <function>getipnodebyname()</function> (<function>gethostbyname()</function> on older systems) to
35431 find IP addresses. This function may ultimately cause a DNS lookup, but it may
35432 also look in <filename>/etc/hosts</filename> or other sources of information.
35433 </para>
35434 </listitem>
35435 <listitem>
35436 <para>
35437 <option>bydns</option>: look up address records for the hosts directly in the DNS; fail if
35438 no address records are found. If there is a temporary DNS error (such as a
35439 timeout), delivery is deferred.
35440 </para>
35441 </listitem>
35442 </itemizedlist>
35443 <para>
35444 For example:
35445 </para>
35446 <literallayout class="monospaced">
35447 route_list = domain1  host1:host2:host3  randomize bydns;\
35448              domain2  host4:host5
35449 </literallayout>
35450 <para>
35451 If neither <option>byname</option> nor <option>bydns</option> is given, Exim behaves as follows: First, a
35452 DNS lookup is done. If this yields anything other than HOST_NOT_FOUND, that
35453 result is used. Otherwise, Exim goes on to try a call to <function>getipnodebyname()</function>
35454 or <function>gethostbyname()</function>, and the result of the lookup is the result of that
35455 call.
35456 </para>
35457 <para>
35458 <emphasis role="bold">Warning</emphasis>: It has been discovered that on some systems, if a DNS lookup
35459 called via <function>getipnodebyname()</function> times out, HOST_NOT_FOUND is returned
35460 instead of TRY_AGAIN. That is why the default action is to try a DNS
35461 lookup first. Only if that gives a definite <quote>no such host</quote> is the local
35462 function called.
35463 </para>
35464 <para>
35465 If no IP address for a host can be found, what happens is controlled by the
35466 <option>host_find_failed</option> option.
35467 </para>
35468 <para>
35469 <indexterm role="variable">
35470 <primary><varname>$host</varname></primary>
35471 </indexterm>
35472 When an address is routed to a local transport, IP addresses are not looked up.
35473 The host list is passed to the transport in the <varname>$host</varname> variable.
35474 </para>
35475 </section>
35476 <section id="SECID123">
35477 <title>Manualroute examples</title>
35478 <para>
35479 In some of the examples that follow, the presence of the <option>remote_smtp</option>
35480 transport, as defined in the default configuration file, is assumed:
35481 </para>
35482 <itemizedlist>
35483 <listitem>
35484 <para>
35485 <indexterm role="concept">
35486 <primary>smart host</primary>
35487 <secondary>example router</secondary>
35488 </indexterm>
35489 The <command>manualroute</command> router can be used to forward all external mail to a
35490 <emphasis>smart host</emphasis>. If you have set up, in the main part of the configuration, a
35491 named domain list that contains your local domains, for example:
35492 </para>
35493 <literallayout class="monospaced">
35494 domainlist local_domains = my.domain.example
35495 </literallayout>
35496 <para>
35497 You can arrange for all other domains to be routed to a smart host by making
35498 your first router something like this:
35499 </para>
35500 <literallayout class="monospaced">
35501 smart_route:
35502   driver = manualroute
35503   domains = !+local_domains
35504   transport = remote_smtp
35505   route_list = * smarthost.ref.example
35506 </literallayout>
35507 <para>
35508 This causes all non-local addresses to be sent to the single host
35509 <emphasis>smarthost.ref.example</emphasis>. If a colon-separated list of smart hosts is given,
35510 they are tried in order
35511 (but you can use <option>hosts_randomize</option> to vary the order each time).
35512 Another way of configuring the same thing is this:
35513 </para>
35514 <literallayout class="monospaced">
35515 smart_route:
35516   driver = manualroute
35517   transport = remote_smtp
35518   route_list = !+local_domains  smarthost.ref.example
35519 </literallayout>
35520 <para>
35521 There is no difference in behaviour between these two routers as they stand.
35522 However, they behave differently if <option>no_more</option> is added to them. In the first
35523 example, the router is skipped if the domain does not match the <option>domains</option>
35524 precondition; the following router is always tried. If the router runs, it
35525 always matches the domain and so can never decline. Therefore, <option>no_more</option>
35526 would have no effect. In the second case, the router is never skipped; it
35527 always runs. However, if it doesn&#x2019;t match the domain, it declines. In this case
35528 <option>no_more</option> would prevent subsequent routers from running.
35529 </para>
35530 </listitem>
35531 <listitem>
35532 <para>
35533 <indexterm role="concept">
35534 <primary>mail hub example</primary>
35535 </indexterm>
35536 A <emphasis>mail hub</emphasis> is a host which receives mail for a number of domains via MX
35537 records in the DNS and delivers it via its own private routing mechanism. Often
35538 the final destinations are behind a firewall, with the mail hub being the one
35539 machine that can connect to machines both inside and outside the firewall. The
35540 <command>manualroute</command> router is usually used on a mail hub to route incoming messages
35541 to the correct hosts. For a small number of domains, the routing can be inline,
35542 using the <option>route_list</option> option, but for a larger number a file or database
35543 lookup is easier to manage.
35544 </para>
35545 <para>
35546 If the domain names are in fact the names of the machines to which the mail is
35547 to be sent by the mail hub, the configuration can be quite simple. For
35548 example:
35549 </para>
35550 <literallayout class="monospaced">
35551 hub_route:
35552   driver = manualroute
35553   transport = remote_smtp
35554   route_list = *.rhodes.tvs.example  $domain
35555 </literallayout>
35556 <para>
35557 This configuration routes domains that match <literal>*.rhodes.tvs.example</literal> to hosts
35558 whose names are the same as the mail domains. A similar approach can be taken
35559 if the host name can be obtained from the domain name by a string manipulation
35560 that the expansion facilities can handle. Otherwise, a lookup based on the
35561 domain can be used to find the host:
35562 </para>
35563 <literallayout class="monospaced">
35564 through_firewall:
35565   driver = manualroute
35566   transport = remote_smtp
35567   route_data = ${lookup {$domain} cdb {/internal/host/routes}}
35568 </literallayout>
35569 <para>
35570 The result of the lookup must be the name or IP address of the host (or
35571 hosts) to which the address is to be routed. If the lookup fails, the route
35572 data is empty, causing the router to decline. The address then passes to the
35573 next router.
35574 </para>
35575 </listitem>
35576 <listitem>
35577 <para>
35578 <indexterm role="concept">
35579 <primary>batched SMTP output example</primary>
35580 </indexterm>
35581 <indexterm role="concept">
35582 <primary>SMTP</primary>
35583 <secondary>batched outgoing; example</secondary>
35584 </indexterm>
35585 You can use <command>manualroute</command> to deliver messages to pipes or files in batched
35586 SMTP format for onward transportation by some other means. This is one way of
35587 storing mail for a dial-up host when it is not connected. The route list entry
35588 can be as simple as a single domain name in a configuration like this:
35589 </para>
35590 <literallayout class="monospaced">
35591 save_in_file:
35592   driver = manualroute
35593   transport = batchsmtp_appendfile
35594   route_list = saved.domain.example
35595 </literallayout>
35596 <para>
35597 though often a pattern is used to pick up more than one domain. If there are
35598 several domains or groups of domains with different transport requirements,
35599 different transports can be listed in the routing information:
35600 </para>
35601 <literallayout class="monospaced">
35602 save_in_file:
35603   driver = manualroute
35604   route_list = \
35605     *.saved.domain1.example  $domain  batch_appendfile; \
35606     *.saved.domain2.example  \
35607       ${lookup{$domain}dbm{/domain2/hosts}{$value}fail} \
35608       batch_pipe
35609 </literallayout>
35610 <para>
35611 <indexterm role="variable">
35612 <primary><varname>$domain</varname></primary>
35613 </indexterm>
35614 <indexterm role="variable">
35615 <primary><varname>$host</varname></primary>
35616 </indexterm>
35617 The first of these just passes the domain in the <varname>$host</varname> variable, which
35618 doesn&#x2019;t achieve much (since it is also in <varname>$domain</varname>), but the second does a
35619 file lookup to find a value to pass, causing the router to decline to handle
35620 the address if the lookup fails.
35621 </para>
35622 </listitem>
35623 <listitem>
35624 <para>
35625 <indexterm role="concept">
35626 <primary>UUCP</primary>
35627 <secondary>example of router for</secondary>
35628 </indexterm>
35629 Routing mail directly to UUCP software is a specific case of the use of
35630 <command>manualroute</command> in a gateway to another mail environment. This is an example of
35631 one way it can be done:
35632 </para>
35633 <literallayout class="monospaced">
35634 # Transport
35635 uucp:
35636   driver = pipe
35637   user = nobody
35638   command = /usr/local/bin/uux -r - \
35639     ${substr_-5:$host}!rmail ${local_part}
35640   return_fail_output = true
35641
35642 # Router
35643 uucphost:
35644   transport = uucp
35645   driver = manualroute
35646   route_data = \
35647     ${lookup{$domain}lsearch{/usr/local/exim/uucphosts}}
35648 </literallayout>
35649 <para>
35650 The file <filename>/usr/local/exim/uucphosts</filename> contains entries like
35651 </para>
35652 <literallayout class="monospaced">
35653 darksite.ethereal.example:           darksite.UUCP
35654 </literallayout>
35655 <para>
35656 It can be set up more simply without adding and removing <quote>.UUCP</quote> but this way
35657 makes clear the distinction between the domain name
35658 <emphasis>darksite.ethereal.example</emphasis> and the UUCP host name <emphasis>darksite</emphasis>.
35659 </para>
35660 </listitem>
35661 </itemizedlist>
35662 <para>
35663 <indexterm role="concept" startref="IIDmanrou1" class="endofrange"/>
35664 <indexterm role="concept" startref="IIDmanrou2" class="endofrange"/>
35665 </para>
35666 </section>
35667 </chapter>
35668
35669 <chapter id="CHAPdriverlast">
35670 <title>The queryprogram router</title>
35671 <para>
35672 <indexterm role="concept" id="IIDquerou1" class="startofrange">
35673 <primary><command>queryprogram</command> router</primary>
35674 </indexterm>
35675 <indexterm role="concept" id="IIDquerou2" class="startofrange">
35676 <primary>routers</primary>
35677 <secondary><command>queryprogram</command></secondary>
35678 </indexterm>
35679 <indexterm role="concept">
35680 <primary>routing</primary>
35681 <secondary>by external program</secondary>
35682 </indexterm>
35683 The <command>queryprogram</command> router routes an address by running an external command
35684 and acting on its output. This is an expensive way to route, and is intended
35685 mainly for use in lightly-loaded systems, or for performing experiments.
35686 However, if it is possible to use the precondition options (<option>domains</option>,
35687 <option>local_parts</option>, etc) to skip this router for most addresses, it could sensibly
35688 be used in special cases, even on a busy host. There are the following private
35689 options:
35690 <indexterm role="concept">
35691 <primary>options</primary>
35692 <secondary><command>queryprogram</command> router</secondary>
35693 </indexterm>
35694 </para>
35695 <para>
35696 <indexterm role="option">
35697 <primary><option>command</option></primary>
35698 </indexterm>
35699 </para>
35700 <informaltable frame="all">
35701 <tgroup cols="4" colsep="0" rowsep="0">
35702 <colspec colwidth="8*" align="left"/>
35703 <colspec colwidth="6*" align="center"/>
35704 <colspec colwidth="6*" align="center"/>
35705 <colspec colwidth="6*" align="right"/>
35706 <tbody>
35707 <row>
35708 <entry><option>command</option></entry>
35709 <entry>Use: <emphasis>queryprogram</emphasis></entry>
35710 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
35711 <entry>Default: <emphasis>unset</emphasis></entry>
35712 </row>
35713 </tbody>
35714 </tgroup>
35715 </informaltable>
35716 <para>
35717 This option must be set. It specifies the command that is to be run. The
35718 command is split up into a command name and arguments, and then each is
35719 expanded separately (exactly as for a <command>pipe</command> transport, described in chapter
35720 <xref linkend="CHAPpipetransport"/>).
35721 </para>
35722 <para>
35723 <indexterm role="option">
35724 <primary><option>command_group</option></primary>
35725 </indexterm>
35726 </para>
35727 <informaltable frame="all">
35728 <tgroup cols="4" colsep="0" rowsep="0">
35729 <colspec colwidth="8*" align="left"/>
35730 <colspec colwidth="6*" align="center"/>
35731 <colspec colwidth="6*" align="center"/>
35732 <colspec colwidth="6*" align="right"/>
35733 <tbody>
35734 <row>
35735 <entry><option>command_group</option></entry>
35736 <entry>Use: <emphasis>queryprogram</emphasis></entry>
35737 <entry>Type: <emphasis>string</emphasis></entry>
35738 <entry>Default: <emphasis>unset</emphasis></entry>
35739 </row>
35740 </tbody>
35741 </tgroup>
35742 </informaltable>
35743 <para>
35744 <indexterm role="concept">
35745 <primary>gid (group id)</primary>
35746 <secondary>in <command>queryprogram</command> router</secondary>
35747 </indexterm>
35748 This option specifies a gid to be set when running the command while routing an
35749 address for deliver. It must be set if <option>command_user</option> specifies a numerical
35750 uid. If it begins with a digit, it is interpreted as the numerical value of the
35751 gid. Otherwise it is looked up using <function>getgrnam()</function>.
35752 </para>
35753 <para>
35754 <indexterm role="option">
35755 <primary><option>command_user</option></primary>
35756 </indexterm>
35757 </para>
35758 <informaltable frame="all">
35759 <tgroup cols="4" colsep="0" rowsep="0">
35760 <colspec colwidth="8*" align="left"/>
35761 <colspec colwidth="6*" align="center"/>
35762 <colspec colwidth="6*" align="center"/>
35763 <colspec colwidth="6*" align="right"/>
35764 <tbody>
35765 <row>
35766 <entry><option>command_user</option></entry>
35767 <entry>Use: <emphasis>queryprogram</emphasis></entry>
35768 <entry>Type: <emphasis>string</emphasis></entry>
35769 <entry>Default: <emphasis>unset</emphasis></entry>
35770 </row>
35771 </tbody>
35772 </tgroup>
35773 </informaltable>
35774 <para>
35775 <indexterm role="concept">
35776 <primary>uid (user id)</primary>
35777 <secondary>for <command>queryprogram</command></secondary>
35778 </indexterm>
35779 This option must be set. It specifies the uid which is set when running the
35780 command while routing an address for delivery. If the value begins with a digit,
35781 it is interpreted as the numerical value of the uid. Otherwise, it is looked up
35782 using <function>getpwnam()</function> to obtain a value for the uid and, if <option>command_group</option> is
35783 not set, a value for the gid also.
35784 </para>
35785 <para>
35786 <emphasis role="bold">Warning:</emphasis> Changing uid and gid is possible only when Exim is running as
35787 root, which it does during a normal delivery in a conventional configuration.
35788 However, when an address is being verified during message reception, Exim is
35789 usually running as the Exim user, not as root. If the <command>queryprogram</command> router
35790 is called from a non-root process, Exim cannot change uid or gid before running
35791 the command. In this circumstance the command runs under the current uid and
35792 gid.
35793 </para>
35794 <para>
35795 <indexterm role="option">
35796 <primary><option>current_directory</option></primary>
35797 </indexterm>
35798 </para>
35799 <informaltable frame="all">
35800 <tgroup cols="4" colsep="0" rowsep="0">
35801 <colspec colwidth="8*" align="left"/>
35802 <colspec colwidth="6*" align="center"/>
35803 <colspec colwidth="6*" align="center"/>
35804 <colspec colwidth="6*" align="right"/>
35805 <tbody>
35806 <row>
35807 <entry><option>current_directory</option></entry>
35808 <entry>Use: <emphasis>queryprogram</emphasis></entry>
35809 <entry>Type: <emphasis>string</emphasis></entry>
35810 <entry>Default: <emphasis>/</emphasis></entry>
35811 </row>
35812 </tbody>
35813 </tgroup>
35814 </informaltable>
35815 <para>
35816 This option specifies an absolute path which is made the current directory
35817 before running the command.
35818 </para>
35819 <para>
35820 <indexterm role="option">
35821 <primary><option>timeout</option></primary>
35822 </indexterm>
35823 </para>
35824 <informaltable frame="all">
35825 <tgroup cols="4" colsep="0" rowsep="0">
35826 <colspec colwidth="8*" align="left"/>
35827 <colspec colwidth="6*" align="center"/>
35828 <colspec colwidth="6*" align="center"/>
35829 <colspec colwidth="6*" align="right"/>
35830 <tbody>
35831 <row>
35832 <entry><option>timeout</option></entry>
35833 <entry>Use: <emphasis>queryprogram</emphasis></entry>
35834 <entry>Type: <emphasis>time</emphasis></entry>
35835 <entry>Default: <emphasis>1h</emphasis></entry>
35836 </row>
35837 </tbody>
35838 </tgroup>
35839 </informaltable>
35840 <para>
35841 If the command does not complete within the timeout period, its process group
35842 is killed and the message is frozen. A value of zero time specifies no
35843 timeout.
35844 </para>
35845 <para>
35846 The standard output of the command is connected to a pipe, which is read when
35847 the command terminates. It should consist of a single line of output,
35848 containing up to five fields, separated by white space. The maximum length of
35849 the line is 1023 characters. Longer lines are silently truncated. The first
35850 field is one of the following words (case-insensitive):
35851 </para>
35852 <itemizedlist>
35853 <listitem>
35854 <para>
35855 <emphasis>Accept</emphasis>: routing succeeded; the remaining fields specify what to do (see
35856 below).
35857 </para>
35858 </listitem>
35859 <listitem>
35860 <para>
35861 <emphasis>Decline</emphasis>: the router declines; pass the address to the next router, unless
35862 <option>no_more</option> is set.
35863 </para>
35864 </listitem>
35865 <listitem>
35866 <para>
35867 <emphasis>Fail</emphasis>: routing failed; do not pass the address to any more routers. Any
35868 subsequent text on the line is an error message. If the router is run as part
35869 of address verification during an incoming SMTP message, the message is
35870 included in the SMTP response.
35871 </para>
35872 </listitem>
35873 <listitem>
35874 <para>
35875 <emphasis>Defer</emphasis>: routing could not be completed at this time; try again later. Any
35876 subsequent text on the line is an error message which is logged. It is not
35877 included in any SMTP response.
35878 </para>
35879 </listitem>
35880 <listitem>
35881 <para>
35882 <emphasis>Freeze</emphasis>: the same as <emphasis>defer</emphasis>, except that the message is frozen.
35883 </para>
35884 </listitem>
35885 <listitem>
35886 <para>
35887 <emphasis>Pass</emphasis>: pass the address to the next router (or the router specified by
35888 <option>pass_router</option>), overriding <option>no_more</option>.
35889 </para>
35890 </listitem>
35891 <listitem>
35892 <para>
35893 <emphasis>Redirect</emphasis>: the message is redirected. The remainder of the line is a list of
35894 new addresses, which are routed independently, starting with the first router,
35895 or the router specified by <option>redirect_router</option>, if set.
35896 </para>
35897 </listitem>
35898 </itemizedlist>
35899 <para>
35900 When the first word is <emphasis>accept</emphasis>, the remainder of the line consists of a
35901 number of keyed data values, as follows (split into two lines here, to fit on
35902 the page):
35903 </para>
35904 <literallayout class="monospaced">
35905 ACCEPT TRANSPORT=&lt;transport&gt; HOSTS=&lt;list of hosts&gt;
35906 LOOKUP=byname|bydns DATA=&lt;text&gt;
35907 </literallayout>
35908 <para>
35909 The data items can be given in any order, and all are optional. If no transport
35910 is included, the transport specified by the generic <option>transport</option> option is
35911 used. The list of hosts and the lookup type are needed only if the transport is
35912 an <command>smtp</command> transport that does not itself supply a list of hosts.
35913 </para>
35914 <para>
35915 The format of the list of hosts is the same as for the <command>manualroute</command> router.
35916 As well as host names and IP addresses with optional port numbers, as described
35917 in section <xref linkend="SECTformatonehostitem"/>, it may contain names followed by
35918 <literal>/MX</literal> to specify sublists of hosts that are obtained by looking up MX records
35919 (see section <xref linkend="SECThostshowused"/>).
35920 </para>
35921 <para>
35922 If the lookup type is not specified, Exim behaves as follows when trying to
35923 find an IP address for each host: First, a DNS lookup is done. If this yields
35924 anything other than HOST_NOT_FOUND, that result is used. Otherwise, Exim
35925 goes on to try a call to <function>getipnodebyname()</function> or <function>gethostbyname()</function>, and the
35926 result of the lookup is the result of that call.
35927 </para>
35928 <para>
35929 <indexterm role="variable">
35930 <primary><varname>$address_data</varname></primary>
35931 </indexterm>
35932 If the DATA field is set, its value is placed in the <varname>$address_data</varname>
35933 variable. For example, this return line
35934 </para>
35935 <literallayout class="monospaced">
35936 accept hosts=x1.y.example:x2.y.example data="rule1"
35937 </literallayout>
35938 <para>
35939 routes the address to the default transport, passing a list of two hosts. When
35940 the transport runs, the string <quote>rule1</quote> is in <varname>$address_data</varname>.
35941 <indexterm role="concept" startref="IIDquerou1" class="endofrange"/>
35942 <indexterm role="concept" startref="IIDquerou2" class="endofrange"/>
35943 </para>
35944 </chapter>
35945
35946 <chapter id="CHAPredirect">
35947 <title>The redirect router</title>
35948 <para>
35949 <indexterm role="concept" id="IIDredrou1" class="startofrange">
35950 <primary><command>redirect</command> router</primary>
35951 </indexterm>
35952 <indexterm role="concept" id="IIDredrou2" class="startofrange">
35953 <primary>routers</primary>
35954 <secondary><command>redirect</command></secondary>
35955 </indexterm>
35956 <indexterm role="concept">
35957 <primary>alias file</primary>
35958 <secondary>in a <command>redirect</command> router</secondary>
35959 </indexterm>
35960 <indexterm role="concept">
35961 <primary>address redirection</primary>
35962 <secondary><command>redirect</command> router</secondary>
35963 </indexterm>
35964 The <command>redirect</command> router handles several kinds of address redirection. Its most
35965 common uses are for resolving local part aliases from a central alias file
35966 (usually called <filename>/etc/aliases</filename>) and for handling users&#x2019; personal <filename>.forward</filename>
35967 files, but it has many other potential uses. The incoming address can be
35968 redirected in several different ways:
35969 </para>
35970 <itemizedlist>
35971 <listitem>
35972 <para>
35973 It can be replaced by one or more new addresses which are themselves routed
35974 independently.
35975 </para>
35976 </listitem>
35977 <listitem>
35978 <para>
35979 It can be routed to be delivered to a given file or directory.
35980 </para>
35981 </listitem>
35982 <listitem>
35983 <para>
35984 It can be routed to be delivered to a specified pipe command.
35985 </para>
35986 </listitem>
35987 <listitem>
35988 <para>
35989 It can cause an automatic reply to be generated.
35990 </para>
35991 </listitem>
35992 <listitem>
35993 <para>
35994 It can be forced to fail, optionally with a custom error message.
35995 </para>
35996 </listitem>
35997 <listitem>
35998 <para>
35999 It can be temporarily deferred, optionally with a custom message.
36000 </para>
36001 </listitem>
36002 <listitem>
36003 <para>
36004 It can be discarded.
36005 </para>
36006 </listitem>
36007 </itemizedlist>
36008 <para>
36009 The generic <option>transport</option> option must not be set for <command>redirect</command> routers.
36010 However, there are some private options which define transports for delivery to
36011 files and pipes, and for generating autoreplies. See the <option>file_transport</option>,
36012 <option>pipe_transport</option> and <option>reply_transport</option> descriptions below.
36013 </para>
36014 <para revisionflag="changed">
36015 If success DSNs have been requested
36016 <indexterm role="concept">
36017 <primary>DSN</primary>
36018 <secondary>success</secondary>
36019 </indexterm>
36020 <indexterm role="concept">
36021 <primary>Delivery Status Notification</primary>
36022 <secondary>success</secondary>
36023 </indexterm>
36024 redirection triggers one and the DSN options are not passed any further.
36025 </para>
36026 <section id="SECID124">
36027 <title>Redirection data</title>
36028 <para>
36029 The router operates by interpreting a text string which it obtains either by
36030 expanding the contents of the <option>data</option> option, or by reading the entire
36031 contents of a file whose name is given in the <option>file</option> option. These two
36032 options are mutually exclusive. The first is commonly used for handling system
36033 aliases, in a configuration like this:
36034 </para>
36035 <literallayout class="monospaced">
36036 system_aliases:
36037   driver = redirect
36038   data = ${lookup{$local_part}lsearch{/etc/aliases}}
36039 </literallayout>
36040 <para>
36041 If the lookup fails, the expanded string in this example is empty. When the
36042 expansion of <option>data</option> results in an empty string, the router declines. A forced
36043 expansion failure also causes the router to decline; other expansion failures
36044 cause delivery to be deferred.
36045 </para>
36046 <para>
36047 A configuration using <option>file</option> is commonly used for handling users&#x2019;
36048 <filename>.forward</filename> files, like this:
36049 </para>
36050 <literallayout class="monospaced">
36051 userforward:
36052   driver = redirect
36053   check_local_user
36054   file = $home/.forward
36055   no_verify
36056 </literallayout>
36057 <para>
36058 If the file does not exist, or causes no action to be taken (for example, it is
36059 empty or consists only of comments), the router declines. <emphasis role="bold">Warning</emphasis>: This
36060 is not the case when the file contains syntactically valid items that happen to
36061 yield empty addresses, for example, items containing only RFC 2822 address
36062 comments.
36063 </para>
36064 </section>
36065 <section id="SECID125">
36066 <title>Forward files and address verification</title>
36067 <para>
36068 <indexterm role="concept">
36069 <primary>address redirection</primary>
36070 <secondary>while verifying</secondary>
36071 </indexterm>
36072 It is usual to set <option>no_verify</option> on <command>redirect</command> routers which handle users&#x2019;
36073 <filename>.forward</filename> files, as in the example above. There are two reasons for this:
36074 </para>
36075 <itemizedlist>
36076 <listitem>
36077 <para>
36078 When Exim is receiving an incoming SMTP message from a remote host, it is
36079 running under the Exim uid, not as root. Exim is unable to change uid to read
36080 the file as the user, and it may not be able to read it as the Exim user. So in
36081 practice the router may not be able to operate.
36082 </para>
36083 </listitem>
36084 <listitem>
36085 <para>
36086 However, even when the router can operate, the existence of a <filename>.forward</filename> file
36087 is unimportant when verifying an address. What should be checked is whether the
36088 local part is a valid user name or not. Cutting out the redirection processing
36089 saves some resources.
36090 </para>
36091 </listitem>
36092 </itemizedlist>
36093 </section>
36094 <section id="SECID126">
36095 <title>Interpreting redirection data</title>
36096 <para>
36097 <indexterm role="concept">
36098 <primary>Sieve filter</primary>
36099 <secondary>specifying in redirection data</secondary>
36100 </indexterm>
36101 <indexterm role="concept">
36102 <primary>filter</primary>
36103 <secondary>specifying in redirection data</secondary>
36104 </indexterm>
36105 The contents of the data string, whether obtained from <option>data</option> or <option>file</option>,
36106 can be interpreted in two different ways:
36107 </para>
36108 <itemizedlist>
36109 <listitem>
36110 <para>
36111 If the <option>allow_filter</option> option is set true, and the data begins with the text
36112 <quote>#Exim filter</quote> or <quote>#Sieve filter</quote>, it is interpreted as a list of
36113 <emphasis>filtering</emphasis> instructions in the form of an Exim or Sieve filter file,
36114 respectively. Details of the syntax and semantics of filter files are described
36115 in a separate document entitled <emphasis>Exim&#x2019;s interfaces to mail filtering</emphasis>; this
36116 document is intended for use by end users.
36117 </para>
36118 </listitem>
36119 <listitem>
36120 <para>
36121 Otherwise, the data must be a comma-separated list of redirection items, as
36122 described in the next section.
36123 </para>
36124 </listitem>
36125 </itemizedlist>
36126 <para>
36127 When a message is redirected to a file (a <quote>mail folder</quote>), the file name given
36128 in a non-filter redirection list must always be an absolute path. A filter may
36129 generate a relative path &ndash; how this is handled depends on the transport&#x2019;s
36130 configuration. See section <xref linkend="SECTfildiropt"/> for a discussion of this issue
36131 for the <command>appendfile</command> transport.
36132 </para>
36133 </section>
36134 <section id="SECTitenonfilred">
36135 <title>Items in a non-filter redirection list</title>
36136 <para>
36137 <indexterm role="concept">
36138 <primary>address redirection</primary>
36139 <secondary>non-filter list items</secondary>
36140 </indexterm>
36141 When the redirection data is not an Exim or Sieve filter, for example, if it
36142 comes from a conventional alias or forward file, it consists of a list of
36143 addresses, file names, pipe commands, or certain special items (see section
36144 <xref linkend="SECTspecitredli"/> below). The special items can be individually enabled or
36145 disabled by means of options whose names begin with <option>allow_</option> or <option>forbid_</option>,
36146 depending on their default values. The items in the list are separated by
36147 commas or newlines.
36148 If a comma is required in an item, the entire item must be enclosed in double
36149 quotes.
36150 </para>
36151 <para>
36152 Lines starting with a # character are comments, and are ignored, and # may
36153 also appear following a comma, in which case everything between the # and the
36154 next newline character is ignored.
36155 </para>
36156 <para>
36157 If an item is entirely enclosed in double quotes, these are removed. Otherwise
36158 double quotes are retained because some forms of mail address require their use
36159 (but never to enclose the entire address). In the following description,
36160 <quote>item</quote> refers to what remains after any surrounding double quotes have been
36161 removed.
36162 </para>
36163 <para>
36164 <indexterm role="variable">
36165 <primary><varname>$local_part</varname></primary>
36166 </indexterm>
36167 <emphasis role="bold">Warning</emphasis>: If you use an Exim expansion to construct a redirection address,
36168 and the expansion contains a reference to <varname>$local_part</varname>, you should make use
36169 of the <option>quote_local_part</option> expansion operator, in case the local part contains
36170 special characters. For example, to redirect all mail for the domain
36171 <emphasis>obsolete.example</emphasis>, retaining the existing local part, you could use this
36172 setting:
36173 </para>
36174 <literallayout class="monospaced">
36175 data = ${quote_local_part:$local_part}@newdomain.example
36176 </literallayout>
36177 </section>
36178 <section id="SECTredlocmai">
36179 <title>Redirecting to a local mailbox</title>
36180 <para>
36181 <indexterm role="concept">
36182 <primary>routing</primary>
36183 <secondary>loops in</secondary>
36184 </indexterm>
36185 <indexterm role="concept">
36186 <primary>loop</primary>
36187 <secondary>while routing, avoidance of</secondary>
36188 </indexterm>
36189 <indexterm role="concept">
36190 <primary>address redirection</primary>
36191 <secondary>to local mailbox</secondary>
36192 </indexterm>
36193 A redirection item may safely be the same as the address currently under
36194 consideration. This does not cause a routing loop, because a router is
36195 automatically skipped if any ancestor of the address that is being processed
36196 is the same as the current address and was processed by the current router.
36197 Such an address is therefore passed to the following routers, so it is handled
36198 as if there were no redirection. When making this loop-avoidance test, the
36199 complete local part, including any prefix or suffix, is used.
36200 </para>
36201 <para>
36202 <indexterm role="concept">
36203 <primary>address redirection</primary>
36204 <secondary>local part without domain</secondary>
36205 </indexterm>
36206 Specifying the same local part without a domain is a common usage in personal
36207 filter files when the user wants to have messages delivered to the local
36208 mailbox and also forwarded elsewhere. For example, the user whose login is
36209 <emphasis>cleo</emphasis> might have a <filename>.forward</filename> file containing this:
36210 </para>
36211 <literallayout class="monospaced">
36212 cleo, cleopatra@egypt.example
36213 </literallayout>
36214 <para>
36215 <indexterm role="concept">
36216 <primary>backslash in alias file</primary>
36217 </indexterm>
36218 <indexterm role="concept">
36219 <primary>alias file</primary>
36220 <secondary>backslash in</secondary>
36221 </indexterm>
36222 For compatibility with other MTAs, such unqualified local parts may be
36223 preceded by <quote>\</quote>, but this is not a requirement for loop prevention. However,
36224 it does make a difference if more than one domain is being handled
36225 synonymously.
36226 </para>
36227 <para>
36228 If an item begins with <quote>\</quote> and the rest of the item parses as a valid RFC
36229 2822 address that does not include a domain, the item is qualified using the
36230 domain of the incoming address. In the absence of a leading <quote>\</quote>, unqualified
36231 addresses are qualified using the value in <option>qualify_recipient</option>, but you can
36232 force the incoming domain to be used by setting <option>qualify_preserve_domain</option>.
36233 </para>
36234 <para>
36235 Care must be taken if there are alias names for local users.
36236 Consider an MTA handling a single local domain where the system alias file
36237 contains:
36238 </para>
36239 <literallayout class="monospaced">
36240 Sam.Reman: spqr
36241 </literallayout>
36242 <para>
36243 Now suppose that Sam (whose login id is <emphasis>spqr</emphasis>) wants to save copies of
36244 messages in the local mailbox, and also forward copies elsewhere. He creates
36245 this forward file:
36246 </para>
36247 <literallayout class="monospaced">
36248 Sam.Reman, spqr@reme.elsewhere.example
36249 </literallayout>
36250 <para>
36251 With these settings, an incoming message addressed to <emphasis>Sam.Reman</emphasis> fails. The
36252 <command>redirect</command> router for system aliases does not process <emphasis>Sam.Reman</emphasis> the
36253 second time round, because it has previously routed it,
36254 and the following routers presumably cannot handle the alias. The forward file
36255 should really contain
36256 </para>
36257 <literallayout class="monospaced">
36258 spqr, spqr@reme.elsewhere.example
36259 </literallayout>
36260 <para>
36261 but because this is such a common error, the <option>check_ancestor</option> option (see
36262 below) exists to provide a way to get round it. This is normally set on a
36263 <command>redirect</command> router that is handling users&#x2019; <filename>.forward</filename> files.
36264 </para>
36265 </section>
36266 <section id="SECTspecitredli">
36267 <title>Special items in redirection lists</title>
36268 <para>
36269 In addition to addresses, the following types of item may appear in redirection
36270 lists (that is, in non-filter redirection data):
36271 </para>
36272 <itemizedlist>
36273 <listitem>
36274 <para>
36275 <indexterm role="concept">
36276 <primary>pipe</primary>
36277 <secondary>in redirection list</secondary>
36278 </indexterm>
36279 <indexterm role="concept">
36280 <primary>address redirection</primary>
36281 <secondary>to pipe</secondary>
36282 </indexterm>
36283 An item is treated as a pipe command if it begins with <quote>|</quote> and does not parse
36284 as a valid RFC 2822 address that includes a domain. A transport for running the
36285 command must be specified by the <option>pipe_transport</option> option.
36286 Normally, either the router or the transport specifies a user and a group under
36287 which to run the delivery. The default is to use the Exim user and group.
36288 </para>
36289 <para>
36290 Single or double quotes can be used for enclosing the individual arguments of
36291 the pipe command; no interpretation of escapes is done for single quotes. If
36292 the command contains a comma character, it is necessary to put the whole item
36293 in double quotes, for example:
36294 </para>
36295 <literallayout class="monospaced">
36296 "|/some/command ready,steady,go"
36297 </literallayout>
36298 <para>
36299 since items in redirection lists are terminated by commas. Do not, however,
36300 quote just the command. An item such as
36301 </para>
36302 <literallayout class="monospaced">
36303 |"/some/command ready,steady,go"
36304 </literallayout>
36305 <para>
36306 is interpreted as a pipe with a rather strange command name, and no arguments.
36307 </para>
36308 <para>
36309 Note that the above example assumes that the text comes from a lookup source
36310 of some sort, so that the quotes are part of the data.  If composing a
36311 redirect router with a <option>data</option> option directly specifying this command, the
36312 quotes will be used by the configuration parser to define the extent of one
36313 string, but will not be passed down into the redirect router itself.  There
36314 are two main approaches to get around this: escape quotes to be part of the
36315 data itself, or avoid using this mechanism and instead create a custom
36316 transport with the <option>command</option> option set and reference that transport from
36317 an <option>accept</option> router.
36318 </para>
36319 </listitem>
36320 <listitem>
36321 <para>
36322 <indexterm role="concept">
36323 <primary>file</primary>
36324 <secondary>in redirection list</secondary>
36325 </indexterm>
36326 <indexterm role="concept">
36327 <primary>address redirection</primary>
36328 <secondary>to file</secondary>
36329 </indexterm>
36330 An item is interpreted as a path name if it begins with <quote>/</quote> and does not
36331 parse as a valid RFC 2822 address that includes a domain. For example,
36332 </para>
36333 <literallayout class="monospaced">
36334 /home/world/minbari
36335 </literallayout>
36336 <para>
36337 is treated as a file name, but
36338 </para>
36339 <literallayout class="monospaced">
36340 /s=molari/o=babylon/@x400gate.way
36341 </literallayout>
36342 <para>
36343 is treated as an address. For a file name, a transport must be specified using
36344 the <option>file_transport</option> option. However, if the generated path name ends with a
36345 forward slash character, it is interpreted as a directory name rather than a
36346 file name, and <option>directory_transport</option> is used instead.
36347 </para>
36348 <para>
36349 Normally, either the router or the transport specifies a user and a group under
36350 which to run the delivery. The default is to use the Exim user and group.
36351 </para>
36352 <para>
36353 <indexterm role="concept">
36354 <primary><filename>/dev/null</filename></primary>
36355 </indexterm>
36356 However, if a redirection item is the path <filename>/dev/null</filename>, delivery to it is
36357 bypassed at a high level, and the log entry shows <quote>**bypassed**</quote>
36358 instead of a transport name. In this case the user and group are not used.
36359 </para>
36360 </listitem>
36361 <listitem>
36362 <para>
36363 <indexterm role="concept">
36364 <primary>included address list</primary>
36365 </indexterm>
36366 <indexterm role="concept">
36367 <primary>address redirection</primary>
36368 <secondary>included external list</secondary>
36369 </indexterm>
36370 If an item is of the form
36371 </para>
36372 <literallayout class="monospaced">
36373 :include:&lt;path name&gt;
36374 </literallayout>
36375 <para>
36376 a list of further items is taken from the given file and included at that
36377 point. <emphasis role="bold">Note</emphasis>: Such a file can not be a filter file; it is just an
36378 out-of-line addition to the list. The items in the included list are separated
36379 by commas or newlines and are not subject to expansion. If this is the first
36380 item in an alias list in an <command>lsearch</command> file, a colon must be used to terminate
36381 the alias name. This example is incorrect:
36382 </para>
36383 <literallayout class="monospaced">
36384 list1    :include:/opt/lists/list1
36385 </literallayout>
36386 <para>
36387 It must be given as
36388 </para>
36389 <literallayout class="monospaced">
36390 list1:   :include:/opt/lists/list1
36391 </literallayout>
36392 </listitem>
36393 <listitem>
36394 <para>
36395 <indexterm role="concept">
36396 <primary>address redirection</primary>
36397 <secondary>to black hole</secondary>
36398 </indexterm>
36399 Sometimes you want to throw away mail to a particular local part. Making the
36400 <option>data</option> option expand to an empty string does not work, because that causes
36401 the router to decline. Instead, the alias item
36402 <indexterm role="concept">
36403 <primary>black hole</primary>
36404 </indexterm>
36405 <indexterm role="concept">
36406 <primary>abandoning mail</primary>
36407 </indexterm>
36408 <emphasis>:blackhole:</emphasis> can be used. It does what its name implies. No delivery is
36409 done, and no error message is generated. This has the same effect as specifying
36410 <filename>/dev/null</filename> as a destination, but it can be independently disabled.
36411 </para>
36412 <para>
36413 <emphasis role="bold">Warning</emphasis>: If <emphasis>:blackhole:</emphasis> appears anywhere in a redirection list, no
36414 delivery is done for the original local part, even if other redirection items
36415 are present. If you are generating a multi-item list (for example, by reading a
36416 database) and need the ability to provide a no-op item, you must use
36417 <filename>/dev/null</filename>.
36418 </para>
36419 </listitem>
36420 <listitem>
36421 <para>
36422 <indexterm role="concept">
36423 <primary>delivery</primary>
36424 <secondary>forcing failure</secondary>
36425 </indexterm>
36426 <indexterm role="concept">
36427 <primary>delivery</primary>
36428 <secondary>forcing deferral</secondary>
36429 </indexterm>
36430 <indexterm role="concept">
36431 <primary>failing delivery</primary>
36432 <secondary>forcing</secondary>
36433 </indexterm>
36434 <indexterm role="concept">
36435 <primary>deferred delivery, forcing</primary>
36436 </indexterm>
36437 <indexterm role="concept">
36438 <primary>customizing</primary>
36439 <secondary>failure message</secondary>
36440 </indexterm>
36441 An attempt to deliver a particular address can be deferred or forced to fail by
36442 redirection items of the form
36443 </para>
36444 <literallayout class="monospaced">
36445 :defer:
36446 :fail:
36447 </literallayout>
36448 <para>
36449 respectively. When a redirection list contains such an item, it applies
36450 to the entire redirection; any other items in the list are ignored. Any
36451 text following <emphasis>:fail:</emphasis> or <emphasis>:defer:</emphasis> is placed in the error text
36452 associated with the failure. For example, an alias file might contain:
36453 </para>
36454 <literallayout class="monospaced">
36455 X.Employee:  :fail: Gone away, no forwarding address
36456 </literallayout>
36457 <para>
36458 In the case of an address that is being verified from an ACL or as the subject
36459 of a
36460 <indexterm role="concept">
36461 <primary>VRFY</primary>
36462 <secondary>error text, display of</secondary>
36463 </indexterm>
36464 VRFY command, the text is included in the SMTP error response by
36465 default.
36466 <indexterm role="concept">
36467 <primary>EXPN</primary>
36468 <secondary>error text, display of</secondary>
36469 </indexterm>
36470 The text is not included in the response to an EXPN command. In non-SMTP cases
36471 the text is included in the error message that Exim generates.
36472 </para>
36473 <para>
36474 <indexterm role="concept">
36475 <primary>SMTP</primary>
36476 <secondary>error codes</secondary>
36477 </indexterm>
36478 By default, Exim sends a 451 SMTP code for a <emphasis>:defer:</emphasis>, and 550 for
36479 <emphasis>:fail:</emphasis>. However, if the message starts with three digits followed by a
36480 space, optionally followed by an extended code of the form <emphasis>n.n.n</emphasis>, also
36481 followed by a space, and the very first digit is the same as the default error
36482 code, the code from the message is used instead. If the very first digit is
36483 incorrect, a panic error is logged, and the default code is used. You can
36484 suppress the use of the supplied code in a redirect router by setting the
36485 <option>forbid_smtp_code</option> option true. In this case, any SMTP code is quietly
36486 ignored.
36487 </para>
36488 <para>
36489 <indexterm role="variable">
36490 <primary><varname>$acl_verify_message</varname></primary>
36491 </indexterm>
36492 In an ACL, an explicitly provided message overrides the default, but the
36493 default message is available in the variable <varname>$acl_verify_message</varname> and can
36494 therefore be included in a custom message if this is desired.
36495 </para>
36496 <para>
36497 Normally the error text is the rest of the redirection list &ndash; a comma does
36498 not terminate it &ndash; but a newline does act as a terminator. Newlines are not
36499 normally present in alias expansions. In <command>lsearch</command> lookups they are removed
36500 as part of the continuation process, but they may exist in other kinds of
36501 lookup and in <emphasis>:include:</emphasis> files.
36502 </para>
36503 <para>
36504 During routing for message delivery (as opposed to verification), a redirection
36505 containing <emphasis>:fail:</emphasis> causes an immediate failure of the incoming address,
36506 whereas <emphasis>:defer:</emphasis> causes the message to remain on the queue so that a
36507 subsequent delivery attempt can happen at a later time. If an address is
36508 deferred for too long, it will ultimately fail, because the normal retry
36509 rules still apply.
36510 </para>
36511 </listitem>
36512 <listitem>
36513 <para>
36514 <indexterm role="concept">
36515 <primary>alias file</primary>
36516 <secondary>exception to default</secondary>
36517 </indexterm>
36518 Sometimes it is useful to use a single-key search type with a default (see
36519 chapter <xref linkend="CHAPfdlookup"/>) to look up aliases. However, there may be a need
36520 for exceptions to the default. These can be handled by aliasing them to
36521 <emphasis>:unknown:</emphasis>. This differs from <emphasis>:fail:</emphasis> in that it causes the <command>redirect</command>
36522 router to decline, whereas <emphasis>:fail:</emphasis> forces routing to fail. A lookup which
36523 results in an empty redirection list has the same effect.
36524 </para>
36525 </listitem>
36526 </itemizedlist>
36527 </section>
36528 <section id="SECTdupaddr">
36529 <title>Duplicate addresses</title>
36530 <para>
36531 <indexterm role="concept">
36532 <primary>duplicate addresses</primary>
36533 </indexterm>
36534 <indexterm role="concept">
36535 <primary>address duplicate, discarding</primary>
36536 </indexterm>
36537 <indexterm role="concept">
36538 <primary>pipe</primary>
36539 <secondary>duplicated</secondary>
36540 </indexterm>
36541 Exim removes duplicate addresses from the list to which it is delivering, so as
36542 to deliver just one copy to each address. This does not apply to deliveries
36543 routed to pipes by different immediate parent addresses, but an indirect
36544 aliasing scheme of the type
36545 </para>
36546 <literallayout class="monospaced">
36547 pipe:       |/some/command $local_part
36548 localpart1: pipe
36549 localpart2: pipe
36550 </literallayout>
36551 <para>
36552 does not work with a message that is addressed to both local parts, because
36553 when the second is aliased to the intermediate local part <quote>pipe</quote> it gets
36554 discarded as being the same as a previously handled address. However, a scheme
36555 such as
36556 </para>
36557 <literallayout class="monospaced">
36558 localpart1: |/some/command $local_part
36559 localpart2: |/some/command $local_part
36560 </literallayout>
36561 <para>
36562 does result in two different pipe deliveries, because the immediate parents of
36563 the pipes are distinct.
36564 </para>
36565 </section>
36566 <section id="SECID128">
36567 <title>Repeated redirection expansion</title>
36568 <para>
36569 <indexterm role="concept">
36570 <primary>repeated redirection expansion</primary>
36571 </indexterm>
36572 <indexterm role="concept">
36573 <primary>address redirection</primary>
36574 <secondary>repeated for each delivery attempt</secondary>
36575 </indexterm>
36576 When a message cannot be delivered to all of its recipients immediately,
36577 leading to two or more delivery attempts, redirection expansion is carried out
36578 afresh each time for those addresses whose children were not all previously
36579 delivered. If redirection is being used as a mailing list, this can lead to new
36580 members of the list receiving copies of old messages. The <option>one_time</option> option
36581 can be used to avoid this.
36582 </para>
36583 </section>
36584 <section id="SECID129">
36585 <title>Errors in redirection lists</title>
36586 <para>
36587 <indexterm role="concept">
36588 <primary>address redirection</primary>
36589 <secondary>errors</secondary>
36590 </indexterm>
36591 If <option>skip_syntax_errors</option> is set, a malformed address that causes a parsing
36592 error is skipped, and an entry is written to the main log. This may be useful
36593 for mailing lists that are automatically managed. Otherwise, if an error is
36594 detected while generating the list of new addresses, the original address is
36595 deferred. See also <option>syntax_errors_to</option>.
36596 </para>
36597 </section>
36598 <section id="SECID130">
36599 <title>Private options for the redirect router</title>
36600 <para>
36601 <indexterm role="concept">
36602 <primary>options</primary>
36603 <secondary><command>redirect</command> router</secondary>
36604 </indexterm>
36605 The private options for the <command>redirect</command> router are as follows:
36606 </para>
36607 <para>
36608 <indexterm role="option">
36609 <primary><option>allow_defer</option></primary>
36610 </indexterm>
36611 </para>
36612 <informaltable frame="all">
36613 <tgroup cols="4" colsep="0" rowsep="0">
36614 <colspec colwidth="8*" align="left"/>
36615 <colspec colwidth="6*" align="center"/>
36616 <colspec colwidth="6*" align="center"/>
36617 <colspec colwidth="6*" align="right"/>
36618 <tbody>
36619 <row>
36620 <entry><option>allow_defer</option></entry>
36621 <entry>Use: <emphasis>redirect</emphasis></entry>
36622 <entry>Type: <emphasis>boolean</emphasis></entry>
36623 <entry>Default: <emphasis>false</emphasis></entry>
36624 </row>
36625 </tbody>
36626 </tgroup>
36627 </informaltable>
36628 <para>
36629 Setting this option allows the use of <emphasis>:defer:</emphasis> in non-filter redirection
36630 data, or the <option>defer</option> command in an Exim filter file.
36631 </para>
36632 <para>
36633 <indexterm role="option">
36634 <primary><option>allow_fail</option></primary>
36635 </indexterm>
36636 </para>
36637 <informaltable frame="all">
36638 <tgroup cols="4" colsep="0" rowsep="0">
36639 <colspec colwidth="8*" align="left"/>
36640 <colspec colwidth="6*" align="center"/>
36641 <colspec colwidth="6*" align="center"/>
36642 <colspec colwidth="6*" align="right"/>
36643 <tbody>
36644 <row>
36645 <entry><option>allow_fail</option></entry>
36646 <entry>Use: <emphasis>redirect</emphasis></entry>
36647 <entry>Type: <emphasis>boolean</emphasis></entry>
36648 <entry>Default: <emphasis>false</emphasis></entry>
36649 </row>
36650 </tbody>
36651 </tgroup>
36652 </informaltable>
36653 <para>
36654 <indexterm role="concept">
36655 <primary>failing delivery</primary>
36656 <secondary>from filter</secondary>
36657 </indexterm>
36658 If this option is true, the <emphasis>:fail:</emphasis> item can be used in a redirection list,
36659 and the <option>fail</option> command may be used in an Exim filter file.
36660 </para>
36661 <para>
36662 <indexterm role="option">
36663 <primary><option>allow_filter</option></primary>
36664 </indexterm>
36665 </para>
36666 <informaltable frame="all">
36667 <tgroup cols="4" colsep="0" rowsep="0">
36668 <colspec colwidth="8*" align="left"/>
36669 <colspec colwidth="6*" align="center"/>
36670 <colspec colwidth="6*" align="center"/>
36671 <colspec colwidth="6*" align="right"/>
36672 <tbody>
36673 <row>
36674 <entry><option>allow_filter</option></entry>
36675 <entry>Use: <emphasis>redirect</emphasis></entry>
36676 <entry>Type: <emphasis>boolean</emphasis></entry>
36677 <entry>Default: <emphasis>false</emphasis></entry>
36678 </row>
36679 </tbody>
36680 </tgroup>
36681 </informaltable>
36682 <para>
36683 <indexterm role="concept">
36684 <primary>filter</primary>
36685 <secondary>enabling use of</secondary>
36686 </indexterm>
36687 <indexterm role="concept">
36688 <primary>Sieve filter</primary>
36689 <secondary>enabling use of</secondary>
36690 </indexterm>
36691 Setting this option allows Exim to interpret redirection data that starts with
36692 <quote>#Exim filter</quote> or <quote>#Sieve filter</quote> as a set of filtering instructions. There
36693 are some features of Exim filter files that some administrators may wish to
36694 lock out; see the <option>forbid_filter_</option><emphasis>xxx</emphasis> options below.
36695 </para>
36696 <para>
36697 It is also possible to lock out Exim filters or Sieve filters while allowing
36698 the other type; see <option>forbid_exim_filter</option> and <option>forbid_sieve_filter</option>.
36699 </para>
36700 <para>
36701 The filter is run using the uid and gid set by the generic <option>user</option> and
36702 <option>group</option> options. These take their defaults from the password data if
36703 <option>check_local_user</option> is set, so in the normal case of users&#x2019; personal filter
36704 files, the filter is run as the relevant user. When <option>allow_filter</option> is set
36705 true, Exim insists that either <option>check_local_user</option> or <option>user</option> is set.
36706 </para>
36707 <para>
36708 <indexterm role="option">
36709 <primary><option>allow_freeze</option></primary>
36710 </indexterm>
36711 </para>
36712 <informaltable frame="all">
36713 <tgroup cols="4" colsep="0" rowsep="0">
36714 <colspec colwidth="8*" align="left"/>
36715 <colspec colwidth="6*" align="center"/>
36716 <colspec colwidth="6*" align="center"/>
36717 <colspec colwidth="6*" align="right"/>
36718 <tbody>
36719 <row>
36720 <entry><option>allow_freeze</option></entry>
36721 <entry>Use: <emphasis>redirect</emphasis></entry>
36722 <entry>Type: <emphasis>boolean</emphasis></entry>
36723 <entry>Default: <emphasis>false</emphasis></entry>
36724 </row>
36725 </tbody>
36726 </tgroup>
36727 </informaltable>
36728 <para>
36729 <indexterm role="concept">
36730 <primary>freezing messages</primary>
36731 <secondary>allowing in filter</secondary>
36732 </indexterm>
36733 Setting this option allows the use of the <option>freeze</option> command in an Exim filter.
36734 This command is more normally encountered in system filters, and is disabled by
36735 default for redirection filters because it isn&#x2019;t something you usually want to
36736 let ordinary users do.
36737 </para>
36738 <para>
36739 <indexterm role="option">
36740 <primary><option>check_ancestor</option></primary>
36741 </indexterm>
36742 </para>
36743 <informaltable frame="all">
36744 <tgroup cols="4" colsep="0" rowsep="0">
36745 <colspec colwidth="8*" align="left"/>
36746 <colspec colwidth="6*" align="center"/>
36747 <colspec colwidth="6*" align="center"/>
36748 <colspec colwidth="6*" align="right"/>
36749 <tbody>
36750 <row>
36751 <entry><option>check_ancestor</option></entry>
36752 <entry>Use: <emphasis>redirect</emphasis></entry>
36753 <entry>Type: <emphasis>boolean</emphasis></entry>
36754 <entry>Default: <emphasis>false</emphasis></entry>
36755 </row>
36756 </tbody>
36757 </tgroup>
36758 </informaltable>
36759 <para>
36760 This option is concerned with handling generated addresses that are the same
36761 as some address in the list of redirection ancestors of the current address.
36762 Although it is turned off by default in the code, it is set in the default
36763 configuration file for handling users&#x2019; <filename>.forward</filename> files. It is recommended
36764 for this use of the <command>redirect</command> router.
36765 </para>
36766 <para>
36767 When <option>check_ancestor</option> is set, if a generated address (including the domain)
36768 is the same as any ancestor of the current address, it is replaced by a copy of
36769 the current address. This helps in the case where local part A is aliased to B,
36770 and B has a <filename>.forward</filename> file pointing back to A. For example, within a single
36771 domain, the local part <quote>Joe.Bloggs</quote> is aliased to <quote>jb</quote> and
36772 <filename>&nbsp;jb/.forward</filename> contains:
36773 </para>
36774 <literallayout class="monospaced">
36775 \Joe.Bloggs, &lt;other item(s)&gt;
36776 </literallayout>
36777 <para>
36778 Without the <option>check_ancestor</option> setting, either local part (<quote>jb</quote> or
36779 <quote>joe.bloggs</quote>) gets processed once by each router and so ends up as it was
36780 originally. If <quote>jb</quote> is the real mailbox name, mail to <quote>jb</quote> gets delivered
36781 (having been turned into <quote>joe.bloggs</quote> by the <filename>.forward</filename> file and back to
36782 <quote>jb</quote> by the alias), but mail to <quote>joe.bloggs</quote> fails. Setting
36783 <option>check_ancestor</option> on the <command>redirect</command> router that handles the <filename>.forward</filename>
36784 file prevents it from turning <quote>jb</quote> back into <quote>joe.bloggs</quote> when that was the
36785 original address. See also the <option>repeat_use</option> option below.
36786 </para>
36787 <para>
36788 <indexterm role="option">
36789 <primary><option>check_group</option></primary>
36790 </indexterm>
36791 </para>
36792 <informaltable frame="all">
36793 <tgroup cols="4" colsep="0" rowsep="0">
36794 <colspec colwidth="8*" align="left"/>
36795 <colspec colwidth="6*" align="center"/>
36796 <colspec colwidth="6*" align="center"/>
36797 <colspec colwidth="6*" align="right"/>
36798 <tbody>
36799 <row>
36800 <entry><option>check_group</option></entry>
36801 <entry>Use: <emphasis>redirect</emphasis></entry>
36802 <entry>Type: <emphasis>boolean</emphasis></entry>
36803 <entry>Default: <emphasis>see below</emphasis></entry>
36804 </row>
36805 </tbody>
36806 </tgroup>
36807 </informaltable>
36808 <para>
36809 When the <option>file</option> option is used, the group owner of the file is checked only
36810 when this option is set. The permitted groups are those listed in the
36811 <option>owngroups</option> option, together with the user&#x2019;s default group if
36812 <option>check_local_user</option> is set. If the file has the wrong group, routing is
36813 deferred. The default setting for this option is true if <option>check_local_user</option>
36814 is set and the <option>modemask</option> option permits the group write bit, or if the
36815 <option>owngroups</option> option is set. Otherwise it is false, and no group check occurs.
36816 </para>
36817 <para>
36818 <indexterm role="option">
36819 <primary><option>check_owner</option></primary>
36820 </indexterm>
36821 </para>
36822 <informaltable frame="all">
36823 <tgroup cols="4" colsep="0" rowsep="0">
36824 <colspec colwidth="8*" align="left"/>
36825 <colspec colwidth="6*" align="center"/>
36826 <colspec colwidth="6*" align="center"/>
36827 <colspec colwidth="6*" align="right"/>
36828 <tbody>
36829 <row>
36830 <entry><option>check_owner</option></entry>
36831 <entry>Use: <emphasis>redirect</emphasis></entry>
36832 <entry>Type: <emphasis>boolean</emphasis></entry>
36833 <entry>Default: <emphasis>see below</emphasis></entry>
36834 </row>
36835 </tbody>
36836 </tgroup>
36837 </informaltable>
36838 <para>
36839 When the <option>file</option> option is used, the owner of the file is checked only when
36840 this option is set. If <option>check_local_user</option> is set, the local user is
36841 permitted; otherwise the owner must be one of those listed in the <option>owners</option>
36842 option. The default value for this option is true if <option>check_local_user</option> or
36843 <option>owners</option> is set. Otherwise the default is false, and no owner check occurs.
36844 </para>
36845 <para>
36846 <indexterm role="option">
36847 <primary><option>data</option></primary>
36848 </indexterm>
36849 </para>
36850 <informaltable frame="all">
36851 <tgroup cols="4" colsep="0" rowsep="0">
36852 <colspec colwidth="8*" align="left"/>
36853 <colspec colwidth="6*" align="center"/>
36854 <colspec colwidth="6*" align="center"/>
36855 <colspec colwidth="6*" align="right"/>
36856 <tbody>
36857 <row>
36858 <entry><option>data</option></entry>
36859 <entry>Use: <emphasis>redirect</emphasis></entry>
36860 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
36861 <entry>Default: <emphasis>unset</emphasis></entry>
36862 </row>
36863 </tbody>
36864 </tgroup>
36865 </informaltable>
36866 <para>
36867 This option is mutually exclusive with <option>file</option>. One or other of them must be
36868 set, but not both. The contents of <option>data</option> are expanded, and then used as the
36869 list of forwarding items, or as a set of filtering instructions. If the
36870 expansion is forced to fail, or the result is an empty string or a string that
36871 has no effect (consists entirely of comments), the router declines.
36872 </para>
36873 <para>
36874 When filtering instructions are used, the string must begin with <quote>#Exim
36875 filter</quote>, and all comments in the string, including this initial one, must be
36876 terminated with newline characters. For example:
36877 </para>
36878 <literallayout class="monospaced">
36879 data = #Exim filter\n\
36880        if $h_to: contains Exim then save $home/mail/exim endif
36881 </literallayout>
36882 <para>
36883 If you are reading the data from a database where newlines cannot be included,
36884 you can use the <varname>${sg}</varname> expansion item to turn the escape string of your
36885 choice into a newline.
36886 </para>
36887 <para>
36888 <indexterm role="option">
36889 <primary><option>directory_transport</option></primary>
36890 </indexterm>
36891 </para>
36892 <informaltable frame="all">
36893 <tgroup cols="4" colsep="0" rowsep="0">
36894 <colspec colwidth="8*" align="left"/>
36895 <colspec colwidth="6*" align="center"/>
36896 <colspec colwidth="6*" align="center"/>
36897 <colspec colwidth="6*" align="right"/>
36898 <tbody>
36899 <row>
36900 <entry><option>directory_transport</option></entry>
36901 <entry>Use: <emphasis>redirect</emphasis></entry>
36902 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
36903 <entry>Default: <emphasis>unset</emphasis></entry>
36904 </row>
36905 </tbody>
36906 </tgroup>
36907 </informaltable>
36908 <para>
36909 A <command>redirect</command> router sets up a direct delivery to a directory when a path name
36910 ending with a slash is specified as a new <quote>address</quote>. The transport used is
36911 specified by this option, which, after expansion, must be the name of a
36912 configured transport. This should normally be an <command>appendfile</command> transport.
36913 </para>
36914 <para>
36915 <indexterm role="option">
36916 <primary><option>file</option></primary>
36917 </indexterm>
36918 </para>
36919 <informaltable frame="all">
36920 <tgroup cols="4" colsep="0" rowsep="0">
36921 <colspec colwidth="8*" align="left"/>
36922 <colspec colwidth="6*" align="center"/>
36923 <colspec colwidth="6*" align="center"/>
36924 <colspec colwidth="6*" align="right"/>
36925 <tbody>
36926 <row>
36927 <entry><option>file</option></entry>
36928 <entry>Use: <emphasis>redirect</emphasis></entry>
36929 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
36930 <entry>Default: <emphasis>unset</emphasis></entry>
36931 </row>
36932 </tbody>
36933 </tgroup>
36934 </informaltable>
36935 <para>
36936 This option specifies the name of a file that contains the redirection data. It
36937 is mutually exclusive with the <option>data</option> option. The string is expanded before
36938 use; if the expansion is forced to fail, the router declines. Other expansion
36939 failures cause delivery to be deferred. The result of a successful expansion
36940 must be an absolute path. The entire file is read and used as the redirection
36941 data. If the data is an empty string or a string that has no effect (consists
36942 entirely of comments), the router declines.
36943 </para>
36944 <para>
36945 <indexterm role="concept">
36946 <primary>NFS</primary>
36947 <secondary>checking for file existence</secondary>
36948 </indexterm>
36949 If the attempt to open the file fails with a <quote>does not exist</quote> error, Exim
36950 runs a check on the containing directory,
36951 unless <option>ignore_enotdir</option> is true (see below).
36952 If the directory does not appear to exist, delivery is deferred. This can
36953 happen when users&#x2019; <filename>.forward</filename> files are in NFS-mounted directories, and there
36954 is a mount problem. If the containing directory does exist, but the file does
36955 not, the router declines.
36956 </para>
36957 <para>
36958 <indexterm role="option">
36959 <primary><option>file_transport</option></primary>
36960 </indexterm>
36961 </para>
36962 <informaltable frame="all">
36963 <tgroup cols="4" colsep="0" rowsep="0">
36964 <colspec colwidth="8*" align="left"/>
36965 <colspec colwidth="6*" align="center"/>
36966 <colspec colwidth="6*" align="center"/>
36967 <colspec colwidth="6*" align="right"/>
36968 <tbody>
36969 <row>
36970 <entry><option>file_transport</option></entry>
36971 <entry>Use: <emphasis>redirect</emphasis></entry>
36972 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
36973 <entry>Default: <emphasis>unset</emphasis></entry>
36974 </row>
36975 </tbody>
36976 </tgroup>
36977 </informaltable>
36978 <para>
36979 <indexterm role="variable">
36980 <primary><varname>$address_file</varname></primary>
36981 </indexterm>
36982 A <command>redirect</command> router sets up a direct delivery to a file when a path name not
36983 ending in a slash is specified as a new <quote>address</quote>. The transport used is
36984 specified by this option, which, after expansion, must be the name of a
36985 configured transport. This should normally be an <command>appendfile</command> transport. When
36986 it is running, the file name is in <varname>$address_file</varname>.
36987 </para>
36988 <para>
36989 <indexterm role="option">
36990 <primary><option>filter_prepend_home</option></primary>
36991 </indexterm>
36992 </para>
36993 <informaltable frame="all">
36994 <tgroup cols="4" colsep="0" rowsep="0">
36995 <colspec colwidth="8*" align="left"/>
36996 <colspec colwidth="6*" align="center"/>
36997 <colspec colwidth="6*" align="center"/>
36998 <colspec colwidth="6*" align="right"/>
36999 <tbody>
37000 <row>
37001 <entry><option>filter_prepend_home</option></entry>
37002 <entry>Use: <emphasis>redirect</emphasis></entry>
37003 <entry>Type: <emphasis>boolean</emphasis></entry>
37004 <entry>Default: <emphasis>true</emphasis></entry>
37005 </row>
37006 </tbody>
37007 </tgroup>
37008 </informaltable>
37009 <para>
37010 When this option is true, if a <command>save</command> command in an Exim filter specifies a
37011 relative path, and <varname>$home</varname> is defined, it is automatically prepended to the
37012 relative path. If this option is set false, this action does not happen. The
37013 relative path is then passed to the transport unmodified.
37014 </para>
37015 <para>
37016 <indexterm role="option">
37017 <primary><option>forbid_blackhole</option></primary>
37018 </indexterm>
37019 </para>
37020 <informaltable frame="all">
37021 <tgroup cols="4" colsep="0" rowsep="0">
37022 <colspec colwidth="8*" align="left"/>
37023 <colspec colwidth="6*" align="center"/>
37024 <colspec colwidth="6*" align="center"/>
37025 <colspec colwidth="6*" align="right"/>
37026 <tbody>
37027 <row>
37028 <entry><option>forbid_blackhole</option></entry>
37029 <entry>Use: <emphasis>redirect</emphasis></entry>
37030 <entry>Type: <emphasis>boolean</emphasis></entry>
37031 <entry>Default: <emphasis>false</emphasis></entry>
37032 </row>
37033 </tbody>
37034 </tgroup>
37035 </informaltable>
37036 <para>
37037 If this option is true, the <emphasis>:blackhole:</emphasis> item may not appear in a
37038 redirection list.
37039 </para>
37040 <para>
37041 <indexterm role="option">
37042 <primary><option>forbid_exim_filter</option></primary>
37043 </indexterm>
37044 </para>
37045 <informaltable frame="all">
37046 <tgroup cols="4" colsep="0" rowsep="0">
37047 <colspec colwidth="8*" align="left"/>
37048 <colspec colwidth="6*" align="center"/>
37049 <colspec colwidth="6*" align="center"/>
37050 <colspec colwidth="6*" align="right"/>
37051 <tbody>
37052 <row>
37053 <entry><option>forbid_exim_filter</option></entry>
37054 <entry>Use: <emphasis>redirect</emphasis></entry>
37055 <entry>Type: <emphasis>boolean</emphasis></entry>
37056 <entry>Default: <emphasis>false</emphasis></entry>
37057 </row>
37058 </tbody>
37059 </tgroup>
37060 </informaltable>
37061 <para>
37062 If this option is set true, only Sieve filters are permitted when
37063 <option>allow_filter</option> is true.
37064 </para>
37065 <para>
37066 <indexterm role="option">
37067 <primary><option>forbid_file</option></primary>
37068 </indexterm>
37069 </para>
37070 <informaltable frame="all">
37071 <tgroup cols="4" colsep="0" rowsep="0">
37072 <colspec colwidth="8*" align="left"/>
37073 <colspec colwidth="6*" align="center"/>
37074 <colspec colwidth="6*" align="center"/>
37075 <colspec colwidth="6*" align="right"/>
37076 <tbody>
37077 <row>
37078 <entry><option>forbid_file</option></entry>
37079 <entry>Use: <emphasis>redirect</emphasis></entry>
37080 <entry>Type: <emphasis>boolean</emphasis></entry>
37081 <entry>Default: <emphasis>false</emphasis></entry>
37082 </row>
37083 </tbody>
37084 </tgroup>
37085 </informaltable>
37086 <para>
37087 <indexterm role="concept">
37088 <primary>delivery</primary>
37089 <secondary>to file; forbidding</secondary>
37090 </indexterm>
37091 <indexterm role="concept">
37092 <primary>Sieve filter</primary>
37093 <secondary>forbidding delivery to a file</secondary>
37094 </indexterm>
37095 <indexterm role="concept">
37096 <primary>Sieve filter</primary>
37097 <secondary><quote>keep</quote> facility; disabling</secondary>
37098 </indexterm>
37099 If this option is true, this router may not generate a new address that
37100 specifies delivery to a local file or directory, either from a filter or from a
37101 conventional forward file. This option is forced to be true if <option>one_time</option> is
37102 set. It applies to Sieve filters as well as to Exim filters, but if true, it
37103 locks out the Sieve&#x2019;s <quote>keep</quote> facility.
37104 </para>
37105 <para>
37106 <indexterm role="option">
37107 <primary><option>forbid_filter_dlfunc</option></primary>
37108 </indexterm>
37109 </para>
37110 <informaltable frame="all">
37111 <tgroup cols="4" colsep="0" rowsep="0">
37112 <colspec colwidth="8*" align="left"/>
37113 <colspec colwidth="6*" align="center"/>
37114 <colspec colwidth="6*" align="center"/>
37115 <colspec colwidth="6*" align="right"/>
37116 <tbody>
37117 <row>
37118 <entry><option>forbid_filter_dlfunc</option></entry>
37119 <entry>Use: <emphasis>redirect</emphasis></entry>
37120 <entry>Type: <emphasis>boolean</emphasis></entry>
37121 <entry>Default: <emphasis>false</emphasis></entry>
37122 </row>
37123 </tbody>
37124 </tgroup>
37125 </informaltable>
37126 <para>
37127 <indexterm role="concept">
37128 <primary>filter</primary>
37129 <secondary>locking out certain features</secondary>
37130 </indexterm>
37131 If this option is true, string expansions in Exim filters are not allowed to
37132 make use of the <option>dlfunc</option> expansion facility to run dynamically loaded
37133 functions.
37134 </para>
37135 <para>
37136 <indexterm role="option">
37137 <primary><option>forbid_filter_existstest</option></primary>
37138 </indexterm>
37139 </para>
37140 <informaltable frame="all">
37141 <tgroup cols="4" colsep="0" rowsep="0">
37142 <colspec colwidth="8*" align="left"/>
37143 <colspec colwidth="6*" align="center"/>
37144 <colspec colwidth="6*" align="center"/>
37145 <colspec colwidth="6*" align="right"/>
37146 <tbody>
37147 <row>
37148 <entry><option>forbid_filter_existstest</option></entry>
37149 <entry>Use: <emphasis>redirect</emphasis></entry>
37150 <entry>Type: <emphasis>boolean</emphasis></entry>
37151 <entry>Default: <emphasis>false</emphasis></entry>
37152 </row>
37153 </tbody>
37154 </tgroup>
37155 </informaltable>
37156 <para>
37157 <indexterm role="concept">
37158 <primary>expansion</primary>
37159 <secondary>statting a file</secondary>
37160 </indexterm>
37161 If this option is true, string expansions in Exim filters are not allowed to
37162 make use of the <option>exists</option> condition or the <option>stat</option> expansion item.
37163 </para>
37164 <para>
37165 <indexterm role="option">
37166 <primary><option>forbid_filter_logwrite</option></primary>
37167 </indexterm>
37168 </para>
37169 <informaltable frame="all">
37170 <tgroup cols="4" colsep="0" rowsep="0">
37171 <colspec colwidth="8*" align="left"/>
37172 <colspec colwidth="6*" align="center"/>
37173 <colspec colwidth="6*" align="center"/>
37174 <colspec colwidth="6*" align="right"/>
37175 <tbody>
37176 <row>
37177 <entry><option>forbid_filter_logwrite</option></entry>
37178 <entry>Use: <emphasis>redirect</emphasis></entry>
37179 <entry>Type: <emphasis>boolean</emphasis></entry>
37180 <entry>Default: <emphasis>false</emphasis></entry>
37181 </row>
37182 </tbody>
37183 </tgroup>
37184 </informaltable>
37185 <para>
37186 If this option is true, use of the logging facility in Exim filters is not
37187 permitted. Logging is in any case available only if the filter is being run
37188 under some unprivileged uid (which is normally the case for ordinary users&#x2019;
37189 <filename>.forward</filename> files).
37190 </para>
37191 <para>
37192 <indexterm role="option">
37193 <primary><option>forbid_filter_lookup</option></primary>
37194 </indexterm>
37195 </para>
37196 <informaltable frame="all">
37197 <tgroup cols="4" colsep="0" rowsep="0">
37198 <colspec colwidth="8*" align="left"/>
37199 <colspec colwidth="6*" align="center"/>
37200 <colspec colwidth="6*" align="center"/>
37201 <colspec colwidth="6*" align="right"/>
37202 <tbody>
37203 <row>
37204 <entry><option>forbid_filter_lookup</option></entry>
37205 <entry>Use: <emphasis>redirect</emphasis></entry>
37206 <entry>Type: <emphasis>boolean</emphasis></entry>
37207 <entry>Default: <emphasis>false</emphasis></entry>
37208 </row>
37209 </tbody>
37210 </tgroup>
37211 </informaltable>
37212 <para>
37213 If this option is true, string expansions in Exim filter files are not allowed
37214 to make use of <option>lookup</option> items.
37215 </para>
37216 <para>
37217 <indexterm role="option">
37218 <primary><option>forbid_filter_perl</option></primary>
37219 </indexterm>
37220 </para>
37221 <informaltable frame="all">
37222 <tgroup cols="4" colsep="0" rowsep="0">
37223 <colspec colwidth="8*" align="left"/>
37224 <colspec colwidth="6*" align="center"/>
37225 <colspec colwidth="6*" align="center"/>
37226 <colspec colwidth="6*" align="right"/>
37227 <tbody>
37228 <row>
37229 <entry><option>forbid_filter_perl</option></entry>
37230 <entry>Use: <emphasis>redirect</emphasis></entry>
37231 <entry>Type: <emphasis>boolean</emphasis></entry>
37232 <entry>Default: <emphasis>false</emphasis></entry>
37233 </row>
37234 </tbody>
37235 </tgroup>
37236 </informaltable>
37237 <para>
37238 This option has an effect only if Exim is built with embedded Perl support. If
37239 it is true, string expansions in Exim filter files are not allowed to make use
37240 of the embedded Perl support.
37241 </para>
37242 <para>
37243 <indexterm role="option">
37244 <primary><option>forbid_filter_readfile</option></primary>
37245 </indexterm>
37246 </para>
37247 <informaltable frame="all">
37248 <tgroup cols="4" colsep="0" rowsep="0">
37249 <colspec colwidth="8*" align="left"/>
37250 <colspec colwidth="6*" align="center"/>
37251 <colspec colwidth="6*" align="center"/>
37252 <colspec colwidth="6*" align="right"/>
37253 <tbody>
37254 <row>
37255 <entry><option>forbid_filter_readfile</option></entry>
37256 <entry>Use: <emphasis>redirect</emphasis></entry>
37257 <entry>Type: <emphasis>boolean</emphasis></entry>
37258 <entry>Default: <emphasis>false</emphasis></entry>
37259 </row>
37260 </tbody>
37261 </tgroup>
37262 </informaltable>
37263 <para>
37264 If this option is true, string expansions in Exim filter files are not allowed
37265 to make use of <option>readfile</option> items.
37266 </para>
37267 <para>
37268 <indexterm role="option">
37269 <primary><option>forbid_filter_readsocket</option></primary>
37270 </indexterm>
37271 </para>
37272 <informaltable frame="all">
37273 <tgroup cols="4" colsep="0" rowsep="0">
37274 <colspec colwidth="8*" align="left"/>
37275 <colspec colwidth="6*" align="center"/>
37276 <colspec colwidth="6*" align="center"/>
37277 <colspec colwidth="6*" align="right"/>
37278 <tbody>
37279 <row>
37280 <entry><option>forbid_filter_readsocket</option></entry>
37281 <entry>Use: <emphasis>redirect</emphasis></entry>
37282 <entry>Type: <emphasis>boolean</emphasis></entry>
37283 <entry>Default: <emphasis>false</emphasis></entry>
37284 </row>
37285 </tbody>
37286 </tgroup>
37287 </informaltable>
37288 <para>
37289 If this option is true, string expansions in Exim filter files are not allowed
37290 to make use of <option>readsocket</option> items.
37291 </para>
37292 <para>
37293 <indexterm role="option">
37294 <primary><option>forbid_filter_reply</option></primary>
37295 </indexterm>
37296 </para>
37297 <informaltable frame="all">
37298 <tgroup cols="4" colsep="0" rowsep="0">
37299 <colspec colwidth="8*" align="left"/>
37300 <colspec colwidth="6*" align="center"/>
37301 <colspec colwidth="6*" align="center"/>
37302 <colspec colwidth="6*" align="right"/>
37303 <tbody>
37304 <row>
37305 <entry><option>forbid_filter_reply</option></entry>
37306 <entry>Use: <emphasis>redirect</emphasis></entry>
37307 <entry>Type: <emphasis>boolean</emphasis></entry>
37308 <entry>Default: <emphasis>false</emphasis></entry>
37309 </row>
37310 </tbody>
37311 </tgroup>
37312 </informaltable>
37313 <para>
37314 If this option is true, this router may not generate an automatic reply
37315 message. Automatic replies can be generated only from Exim or Sieve filter
37316 files, not from traditional forward files. This option is forced to be true if
37317 <option>one_time</option> is set.
37318 </para>
37319 <para>
37320 <indexterm role="option">
37321 <primary><option>forbid_filter_run</option></primary>
37322 </indexterm>
37323 </para>
37324 <informaltable frame="all">
37325 <tgroup cols="4" colsep="0" rowsep="0">
37326 <colspec colwidth="8*" align="left"/>
37327 <colspec colwidth="6*" align="center"/>
37328 <colspec colwidth="6*" align="center"/>
37329 <colspec colwidth="6*" align="right"/>
37330 <tbody>
37331 <row>
37332 <entry><option>forbid_filter_run</option></entry>
37333 <entry>Use: <emphasis>redirect</emphasis></entry>
37334 <entry>Type: <emphasis>boolean</emphasis></entry>
37335 <entry>Default: <emphasis>false</emphasis></entry>
37336 </row>
37337 </tbody>
37338 </tgroup>
37339 </informaltable>
37340 <para>
37341 If this option is true, string expansions in Exim filter files are not allowed
37342 to make use of <option>run</option> items.
37343 </para>
37344 <para>
37345 <indexterm role="option">
37346 <primary><option>forbid_include</option></primary>
37347 </indexterm>
37348 </para>
37349 <informaltable frame="all">
37350 <tgroup cols="4" colsep="0" rowsep="0">
37351 <colspec colwidth="8*" align="left"/>
37352 <colspec colwidth="6*" align="center"/>
37353 <colspec colwidth="6*" align="center"/>
37354 <colspec colwidth="6*" align="right"/>
37355 <tbody>
37356 <row>
37357 <entry><option>forbid_include</option></entry>
37358 <entry>Use: <emphasis>redirect</emphasis></entry>
37359 <entry>Type: <emphasis>boolean</emphasis></entry>
37360 <entry>Default: <emphasis>false</emphasis></entry>
37361 </row>
37362 </tbody>
37363 </tgroup>
37364 </informaltable>
37365 <para>
37366 If this option is true, items of the form
37367 </para>
37368 <literallayout class="monospaced">
37369 :include:&lt;path name&gt;
37370 </literallayout>
37371 <para>
37372 are not permitted in non-filter redirection lists.
37373 </para>
37374 <para>
37375 <indexterm role="option">
37376 <primary><option>forbid_pipe</option></primary>
37377 </indexterm>
37378 </para>
37379 <informaltable frame="all">
37380 <tgroup cols="4" colsep="0" rowsep="0">
37381 <colspec colwidth="8*" align="left"/>
37382 <colspec colwidth="6*" align="center"/>
37383 <colspec colwidth="6*" align="center"/>
37384 <colspec colwidth="6*" align="right"/>
37385 <tbody>
37386 <row>
37387 <entry><option>forbid_pipe</option></entry>
37388 <entry>Use: <emphasis>redirect</emphasis></entry>
37389 <entry>Type: <emphasis>boolean</emphasis></entry>
37390 <entry>Default: <emphasis>false</emphasis></entry>
37391 </row>
37392 </tbody>
37393 </tgroup>
37394 </informaltable>
37395 <para>
37396 <indexterm role="concept">
37397 <primary>delivery</primary>
37398 <secondary>to pipe; forbidding</secondary>
37399 </indexterm>
37400 If this option is true, this router may not generate a new address which
37401 specifies delivery to a pipe, either from an Exim filter or from a conventional
37402 forward file. This option is forced to be true if <option>one_time</option> is set.
37403 </para>
37404 <para>
37405 <indexterm role="option">
37406 <primary><option>forbid_sieve_filter</option></primary>
37407 </indexterm>
37408 </para>
37409 <informaltable frame="all">
37410 <tgroup cols="4" colsep="0" rowsep="0">
37411 <colspec colwidth="8*" align="left"/>
37412 <colspec colwidth="6*" align="center"/>
37413 <colspec colwidth="6*" align="center"/>
37414 <colspec colwidth="6*" align="right"/>
37415 <tbody>
37416 <row>
37417 <entry><option>forbid_sieve_filter</option></entry>
37418 <entry>Use: <emphasis>redirect</emphasis></entry>
37419 <entry>Type: <emphasis>boolean</emphasis></entry>
37420 <entry>Default: <emphasis>false</emphasis></entry>
37421 </row>
37422 </tbody>
37423 </tgroup>
37424 </informaltable>
37425 <para>
37426 If this option is set true, only Exim filters are permitted when
37427 <option>allow_filter</option> is true.
37428 </para>
37429 <para>
37430 <indexterm role="concept">
37431 <primary>SMTP</primary>
37432 <secondary>error codes</secondary>
37433 </indexterm>
37434 <indexterm role="option">
37435 <primary><option>forbid_smtp_code</option></primary>
37436 </indexterm>
37437 </para>
37438 <informaltable frame="all">
37439 <tgroup cols="4" colsep="0" rowsep="0">
37440 <colspec colwidth="8*" align="left"/>
37441 <colspec colwidth="6*" align="center"/>
37442 <colspec colwidth="6*" align="center"/>
37443 <colspec colwidth="6*" align="right"/>
37444 <tbody>
37445 <row>
37446 <entry><option>forbid_smtp_code</option></entry>
37447 <entry>Use: <emphasis>redirect</emphasis></entry>
37448 <entry>Type: <emphasis>boolean</emphasis></entry>
37449 <entry>Default: <emphasis>false</emphasis></entry>
37450 </row>
37451 </tbody>
37452 </tgroup>
37453 </informaltable>
37454 <para>
37455 If this option is set true, any SMTP error codes that are present at the start
37456 of messages specified for <literal>:defer:</literal> or <literal>:fail:</literal> are quietly ignored, and
37457 the default codes (451 and 550, respectively) are always used.
37458 </para>
37459 <para>
37460 <indexterm role="option">
37461 <primary><option>hide_child_in_errmsg</option></primary>
37462 </indexterm>
37463 </para>
37464 <informaltable frame="all">
37465 <tgroup cols="4" colsep="0" rowsep="0">
37466 <colspec colwidth="8*" align="left"/>
37467 <colspec colwidth="6*" align="center"/>
37468 <colspec colwidth="6*" align="center"/>
37469 <colspec colwidth="6*" align="right"/>
37470 <tbody>
37471 <row>
37472 <entry><option>hide_child_in_errmsg</option></entry>
37473 <entry>Use: <emphasis>redirect</emphasis></entry>
37474 <entry>Type: <emphasis>boolean</emphasis></entry>
37475 <entry>Default: <emphasis>false</emphasis></entry>
37476 </row>
37477 </tbody>
37478 </tgroup>
37479 </informaltable>
37480 <para>
37481 <indexterm role="concept">
37482 <primary>bounce message</primary>
37483 <secondary>redirection details; suppressing</secondary>
37484 </indexterm>
37485 If this option is true, it prevents Exim from quoting a child address if it
37486 generates a bounce or delay message for it. Instead it says <quote>an address
37487 generated from &lt;<emphasis>the top level address</emphasis>&gt;</quote>. Of course, this applies only to
37488 bounces generated locally. If a message is forwarded to another host, <emphasis>its</emphasis>
37489 bounce may well quote the generated address.
37490 </para>
37491 <para>
37492 <indexterm role="option">
37493 <primary><option>ignore_eacces</option></primary>
37494 </indexterm>
37495 </para>
37496 <informaltable frame="all">
37497 <tgroup cols="4" colsep="0" rowsep="0">
37498 <colspec colwidth="8*" align="left"/>
37499 <colspec colwidth="6*" align="center"/>
37500 <colspec colwidth="6*" align="center"/>
37501 <colspec colwidth="6*" align="right"/>
37502 <tbody>
37503 <row>
37504 <entry><option>ignore_eacces</option></entry>
37505 <entry>Use: <emphasis>redirect</emphasis></entry>
37506 <entry>Type: <emphasis>boolean</emphasis></entry>
37507 <entry>Default: <emphasis>false</emphasis></entry>
37508 </row>
37509 </tbody>
37510 </tgroup>
37511 </informaltable>
37512 <para>
37513 <indexterm role="concept">
37514 <primary>EACCES</primary>
37515 </indexterm>
37516 If this option is set and an attempt to open a redirection file yields the
37517 EACCES error (permission denied), the <command>redirect</command> router behaves as if the
37518 file did not exist.
37519 </para>
37520 <para>
37521 <indexterm role="option">
37522 <primary><option>ignore_enotdir</option></primary>
37523 </indexterm>
37524 </para>
37525 <informaltable frame="all">
37526 <tgroup cols="4" colsep="0" rowsep="0">
37527 <colspec colwidth="8*" align="left"/>
37528 <colspec colwidth="6*" align="center"/>
37529 <colspec colwidth="6*" align="center"/>
37530 <colspec colwidth="6*" align="right"/>
37531 <tbody>
37532 <row>
37533 <entry><option>ignore_enotdir</option></entry>
37534 <entry>Use: <emphasis>redirect</emphasis></entry>
37535 <entry>Type: <emphasis>boolean</emphasis></entry>
37536 <entry>Default: <emphasis>false</emphasis></entry>
37537 </row>
37538 </tbody>
37539 </tgroup>
37540 </informaltable>
37541 <para>
37542 <indexterm role="concept">
37543 <primary>ENOTDIR</primary>
37544 </indexterm>
37545 If this option is set and an attempt to open a redirection file yields the
37546 ENOTDIR error (something on the path is not a directory), the <command>redirect</command>
37547 router behaves as if the file did not exist.
37548 </para>
37549 <para>
37550 Setting <option>ignore_enotdir</option> has another effect as well: When a <command>redirect</command>
37551 router that has the <option>file</option> option set discovers that the file does not exist
37552 (the ENOENT error), it tries to <function>stat()</function> the parent directory, as a check
37553 against unmounted NFS directories. If the parent can not be statted, delivery
37554 is deferred. However, it seems wrong to do this check when <option>ignore_enotdir</option>
37555 is set, because that option tells Exim to ignore <quote>something on the path is not
37556 a directory</quote> (the ENOTDIR error). This is a confusing area, because it seems
37557 that some operating systems give ENOENT where others give ENOTDIR.
37558 </para>
37559 <para>
37560 <indexterm role="option">
37561 <primary><option>include_directory</option></primary>
37562 </indexterm>
37563 </para>
37564 <informaltable frame="all">
37565 <tgroup cols="4" colsep="0" rowsep="0">
37566 <colspec colwidth="8*" align="left"/>
37567 <colspec colwidth="6*" align="center"/>
37568 <colspec colwidth="6*" align="center"/>
37569 <colspec colwidth="6*" align="right"/>
37570 <tbody>
37571 <row>
37572 <entry><option>include_directory</option></entry>
37573 <entry>Use: <emphasis>redirect</emphasis></entry>
37574 <entry>Type: <emphasis>string</emphasis></entry>
37575 <entry>Default: <emphasis>unset</emphasis></entry>
37576 </row>
37577 </tbody>
37578 </tgroup>
37579 </informaltable>
37580 <para>
37581 If this option is set, the path names of any <emphasis>:include:</emphasis> items in a
37582 redirection list must start with this directory.
37583 </para>
37584 <para>
37585 <indexterm role="option">
37586 <primary><option>modemask</option></primary>
37587 </indexterm>
37588 </para>
37589 <informaltable frame="all">
37590 <tgroup cols="4" colsep="0" rowsep="0">
37591 <colspec colwidth="8*" align="left"/>
37592 <colspec colwidth="6*" align="center"/>
37593 <colspec colwidth="6*" align="center"/>
37594 <colspec colwidth="6*" align="right"/>
37595 <tbody>
37596 <row>
37597 <entry><option>modemask</option></entry>
37598 <entry>Use: <emphasis>redirect</emphasis></entry>
37599 <entry>Type: <emphasis>octal integer</emphasis></entry>
37600 <entry>Default: <emphasis>022</emphasis></entry>
37601 </row>
37602 </tbody>
37603 </tgroup>
37604 </informaltable>
37605 <para>
37606 This specifies mode bits which must not be set for a file specified by the
37607 <option>file</option> option. If any of the forbidden bits are set, delivery is deferred.
37608 </para>
37609 <para>
37610 <indexterm role="option">
37611 <primary><option>one_time</option></primary>
37612 </indexterm>
37613 </para>
37614 <informaltable frame="all">
37615 <tgroup cols="4" colsep="0" rowsep="0">
37616 <colspec colwidth="8*" align="left"/>
37617 <colspec colwidth="6*" align="center"/>
37618 <colspec colwidth="6*" align="center"/>
37619 <colspec colwidth="6*" align="right"/>
37620 <tbody>
37621 <row>
37622 <entry><option>one_time</option></entry>
37623 <entry>Use: <emphasis>redirect</emphasis></entry>
37624 <entry>Type: <emphasis>boolean</emphasis></entry>
37625 <entry>Default: <emphasis>false</emphasis></entry>
37626 </row>
37627 </tbody>
37628 </tgroup>
37629 </informaltable>
37630 <para>
37631 <indexterm role="concept">
37632 <primary>one-time aliasing/forwarding expansion</primary>
37633 </indexterm>
37634 <indexterm role="concept">
37635 <primary>alias file</primary>
37636 <secondary>one-time expansion</secondary>
37637 </indexterm>
37638 <indexterm role="concept">
37639 <primary>forward file</primary>
37640 <secondary>one-time expansion</secondary>
37641 </indexterm>
37642 <indexterm role="concept">
37643 <primary>mailing lists</primary>
37644 <secondary>one-time expansion</secondary>
37645 </indexterm>
37646 <indexterm role="concept">
37647 <primary>address redirection</primary>
37648 <secondary>one-time expansion</secondary>
37649 </indexterm>
37650 Sometimes the fact that Exim re-evaluates aliases and reprocesses redirection
37651 files each time it tries to deliver a message causes a problem when one or more
37652 of the generated addresses fails be delivered at the first attempt. The problem
37653 is not one of duplicate delivery &ndash; Exim is clever enough to handle that &ndash;
37654 but of what happens when the redirection list changes during the time that the
37655 message is on Exim&#x2019;s queue. This is particularly true in the case of mailing
37656 lists, where new subscribers might receive copies of messages that were posted
37657 before they subscribed.
37658 </para>
37659 <para>
37660 If <option>one_time</option> is set and any addresses generated by the router fail to
37661 deliver at the first attempt, the failing addresses are added to the message as
37662 <quote>top level</quote> addresses, and the parent address that generated them is marked
37663 <quote>delivered</quote>. Thus, redirection does not happen again at the next delivery
37664 attempt.
37665 </para>
37666 <para>
37667 <emphasis role="bold">Warning 1</emphasis>: Any header line addition or removal that is specified by this
37668 router would be lost if delivery did not succeed at the first attempt. For this
37669 reason, the <option>headers_add</option> and <option>headers_remove</option> generic options are not
37670 permitted when <option>one_time</option> is set.
37671 </para>
37672 <para>
37673 <emphasis role="bold">Warning 2</emphasis>: To ensure that the router generates only addresses (as opposed
37674 to pipe or file deliveries or auto-replies) <option>forbid_file</option>, <option>forbid_pipe</option>,
37675 and <option>forbid_filter_reply</option> are forced to be true when <option>one_time</option> is set.
37676 </para>
37677 <para>
37678 <emphasis role="bold">Warning 3</emphasis>: The <option>unseen</option> generic router option may not be set with
37679 <option>one_time</option>.
37680 </para>
37681 <para>
37682 The original top-level address is remembered with each of the generated
37683 addresses, and is output in any log messages. However, any intermediate parent
37684 addresses are not recorded. This makes a difference to the log only if
37685 <option>all_parents</option> log selector is set. It is expected that <option>one_time</option> will
37686 typically be used for mailing lists, where there is normally just one level of
37687 expansion.
37688 </para>
37689 <para>
37690 <indexterm role="option">
37691 <primary><option>owners</option></primary>
37692 </indexterm>
37693 </para>
37694 <informaltable frame="all">
37695 <tgroup cols="4" colsep="0" rowsep="0">
37696 <colspec colwidth="8*" align="left"/>
37697 <colspec colwidth="6*" align="center"/>
37698 <colspec colwidth="6*" align="center"/>
37699 <colspec colwidth="6*" align="right"/>
37700 <tbody>
37701 <row>
37702 <entry><option>owners</option></entry>
37703 <entry>Use: <emphasis>redirect</emphasis></entry>
37704 <entry>Type: <emphasis>string list</emphasis></entry>
37705 <entry>Default: <emphasis>unset</emphasis></entry>
37706 </row>
37707 </tbody>
37708 </tgroup>
37709 </informaltable>
37710 <para>
37711 <indexterm role="concept">
37712 <primary>ownership</primary>
37713 <secondary>alias file</secondary>
37714 </indexterm>
37715 <indexterm role="concept">
37716 <primary>ownership</primary>
37717 <secondary>forward file</secondary>
37718 </indexterm>
37719 <indexterm role="concept">
37720 <primary>alias file</primary>
37721 <secondary>ownership</secondary>
37722 </indexterm>
37723 <indexterm role="concept">
37724 <primary>forward file</primary>
37725 <secondary>ownership</secondary>
37726 </indexterm>
37727 This specifies a list of permitted owners for the file specified by <option>file</option>.
37728 This list is in addition to the local user when <option>check_local_user</option> is set.
37729 See <option>check_owner</option> above.
37730 </para>
37731 <para>
37732 <indexterm role="option">
37733 <primary><option>owngroups</option></primary>
37734 </indexterm>
37735 </para>
37736 <informaltable frame="all">
37737 <tgroup cols="4" colsep="0" rowsep="0">
37738 <colspec colwidth="8*" align="left"/>
37739 <colspec colwidth="6*" align="center"/>
37740 <colspec colwidth="6*" align="center"/>
37741 <colspec colwidth="6*" align="right"/>
37742 <tbody>
37743 <row>
37744 <entry><option>owngroups</option></entry>
37745 <entry>Use: <emphasis>redirect</emphasis></entry>
37746 <entry>Type: <emphasis>string list</emphasis></entry>
37747 <entry>Default: <emphasis>unset</emphasis></entry>
37748 </row>
37749 </tbody>
37750 </tgroup>
37751 </informaltable>
37752 <para>
37753 This specifies a list of permitted groups for the file specified by <option>file</option>.
37754 The list is in addition to the local user&#x2019;s primary group when
37755 <option>check_local_user</option> is set. See <option>check_group</option> above.
37756 </para>
37757 <para>
37758 <indexterm role="option">
37759 <primary><option>pipe_transport</option></primary>
37760 </indexterm>
37761 </para>
37762 <informaltable frame="all">
37763 <tgroup cols="4" colsep="0" rowsep="0">
37764 <colspec colwidth="8*" align="left"/>
37765 <colspec colwidth="6*" align="center"/>
37766 <colspec colwidth="6*" align="center"/>
37767 <colspec colwidth="6*" align="right"/>
37768 <tbody>
37769 <row>
37770 <entry><option>pipe_transport</option></entry>
37771 <entry>Use: <emphasis>redirect</emphasis></entry>
37772 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
37773 <entry>Default: <emphasis>unset</emphasis></entry>
37774 </row>
37775 </tbody>
37776 </tgroup>
37777 </informaltable>
37778 <para>
37779 <indexterm role="variable">
37780 <primary><varname>$address_pipe</varname></primary>
37781 </indexterm>
37782 A <command>redirect</command> router sets up a direct delivery to a pipe when a string
37783 starting with a vertical bar character is specified as a new <quote>address</quote>. The
37784 transport used is specified by this option, which, after expansion, must be the
37785 name of a configured transport. This should normally be a <command>pipe</command> transport.
37786 When the transport is run, the pipe command is in <varname>$address_pipe</varname>.
37787 </para>
37788 <para>
37789 <indexterm role="option">
37790 <primary><option>qualify_domain</option></primary>
37791 </indexterm>
37792 </para>
37793 <informaltable frame="all">
37794 <tgroup cols="4" colsep="0" rowsep="0">
37795 <colspec colwidth="8*" align="left"/>
37796 <colspec colwidth="6*" align="center"/>
37797 <colspec colwidth="6*" align="center"/>
37798 <colspec colwidth="6*" align="right"/>
37799 <tbody>
37800 <row>
37801 <entry><option>qualify_domain</option></entry>
37802 <entry>Use: <emphasis>redirect</emphasis></entry>
37803 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
37804 <entry>Default: <emphasis>unset</emphasis></entry>
37805 </row>
37806 </tbody>
37807 </tgroup>
37808 </informaltable>
37809 <para>
37810 <indexterm role="variable">
37811 <primary><varname>$qualify_recipient</varname></primary>
37812 </indexterm>
37813 If this option is set, and an unqualified address (one without a domain) is
37814 generated, and that address would normally be qualified by the global setting
37815 in <option>qualify_recipient</option>, it is instead qualified with the domain specified by
37816 expanding this string. If the expansion fails, the router declines. If you want
37817 to revert to the default, you can have the expansion generate
37818 <varname>$qualify_recipient</varname>.
37819 </para>
37820 <para>
37821 This option applies to all unqualified addresses generated by Exim filters,
37822 but for traditional <filename>.forward</filename> files, it applies only to addresses that are
37823 not preceded by a backslash. Sieve filters cannot generate unqualified
37824 addresses.
37825 </para>
37826 <para>
37827 <indexterm role="option">
37828 <primary><option>qualify_preserve_domain</option></primary>
37829 </indexterm>
37830 </para>
37831 <informaltable frame="all">
37832 <tgroup cols="4" colsep="0" rowsep="0">
37833 <colspec colwidth="8*" align="left"/>
37834 <colspec colwidth="6*" align="center"/>
37835 <colspec colwidth="6*" align="center"/>
37836 <colspec colwidth="6*" align="right"/>
37837 <tbody>
37838 <row>
37839 <entry><option>qualify_preserve_domain</option></entry>
37840 <entry>Use: <emphasis>redirect</emphasis></entry>
37841 <entry>Type: <emphasis>boolean</emphasis></entry>
37842 <entry>Default: <emphasis>false</emphasis></entry>
37843 </row>
37844 </tbody>
37845 </tgroup>
37846 </informaltable>
37847 <para>
37848 <indexterm role="concept">
37849 <primary>domain</primary>
37850 <secondary>in redirection; preserving</secondary>
37851 </indexterm>
37852 <indexterm role="concept">
37853 <primary>preserving domain in redirection</primary>
37854 </indexterm>
37855 <indexterm role="concept">
37856 <primary>address redirection</primary>
37857 <secondary>domain; preserving</secondary>
37858 </indexterm>
37859 If this option is set, the router&#x2019;s local <option>qualify_domain</option> option must not be
37860 set (a configuration error occurs if it is). If an unqualified address (one
37861 without a domain) is generated, it is qualified with the domain of the parent
37862 address (the immediately preceding ancestor) instead of the global
37863 <option>qualify_recipient</option> value. In the case of a traditional <filename>.forward</filename> file,
37864 this applies whether or not the address is preceded by a backslash.
37865 </para>
37866 <para>
37867 <indexterm role="option">
37868 <primary><option>repeat_use</option></primary>
37869 </indexterm>
37870 </para>
37871 <informaltable frame="all">
37872 <tgroup cols="4" colsep="0" rowsep="0">
37873 <colspec colwidth="8*" align="left"/>
37874 <colspec colwidth="6*" align="center"/>
37875 <colspec colwidth="6*" align="center"/>
37876 <colspec colwidth="6*" align="right"/>
37877 <tbody>
37878 <row>
37879 <entry><option>repeat_use</option></entry>
37880 <entry>Use: <emphasis>redirect</emphasis></entry>
37881 <entry>Type: <emphasis>boolean</emphasis></entry>
37882 <entry>Default: <emphasis>true</emphasis></entry>
37883 </row>
37884 </tbody>
37885 </tgroup>
37886 </informaltable>
37887 <para>
37888 If this option is set false, the router is skipped for a child address that has
37889 any ancestor that was routed by this router. This test happens before any of
37890 the other preconditions are tested. Exim&#x2019;s default anti-looping rules skip
37891 only when the ancestor is the same as the current address. See also
37892 <option>check_ancestor</option> above and the generic <option>redirect_router</option> option.
37893 </para>
37894 <para>
37895 <indexterm role="option">
37896 <primary><option>reply_transport</option></primary>
37897 </indexterm>
37898 </para>
37899 <informaltable frame="all">
37900 <tgroup cols="4" colsep="0" rowsep="0">
37901 <colspec colwidth="8*" align="left"/>
37902 <colspec colwidth="6*" align="center"/>
37903 <colspec colwidth="6*" align="center"/>
37904 <colspec colwidth="6*" align="right"/>
37905 <tbody>
37906 <row>
37907 <entry><option>reply_transport</option></entry>
37908 <entry>Use: <emphasis>redirect</emphasis></entry>
37909 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
37910 <entry>Default: <emphasis>unset</emphasis></entry>
37911 </row>
37912 </tbody>
37913 </tgroup>
37914 </informaltable>
37915 <para>
37916 A <command>redirect</command> router sets up an automatic reply when a <option>mail</option> or
37917 <option>vacation</option> command is used in a filter file. The transport used is specified
37918 by this option, which, after expansion, must be the name of a configured
37919 transport. This should normally be an <command>autoreply</command> transport. Other transports
37920 are unlikely to do anything sensible or useful.
37921 </para>
37922 <para>
37923 <indexterm role="option">
37924 <primary><option>rewrite</option></primary>
37925 </indexterm>
37926 </para>
37927 <informaltable frame="all">
37928 <tgroup cols="4" colsep="0" rowsep="0">
37929 <colspec colwidth="8*" align="left"/>
37930 <colspec colwidth="6*" align="center"/>
37931 <colspec colwidth="6*" align="center"/>
37932 <colspec colwidth="6*" align="right"/>
37933 <tbody>
37934 <row>
37935 <entry><option>rewrite</option></entry>
37936 <entry>Use: <emphasis>redirect</emphasis></entry>
37937 <entry>Type: <emphasis>boolean</emphasis></entry>
37938 <entry>Default: <emphasis>true</emphasis></entry>
37939 </row>
37940 </tbody>
37941 </tgroup>
37942 </informaltable>
37943 <para>
37944 <indexterm role="concept">
37945 <primary>address redirection</primary>
37946 <secondary>disabling rewriting</secondary>
37947 </indexterm>
37948 If this option is set false, addresses generated by the router are not
37949 subject to address rewriting. Otherwise, they are treated like new addresses
37950 and are rewritten according to the global rewriting rules.
37951 </para>
37952 <para>
37953 <indexterm role="option">
37954 <primary><option>sieve_subaddress</option></primary>
37955 </indexterm>
37956 </para>
37957 <informaltable frame="all">
37958 <tgroup cols="4" colsep="0" rowsep="0">
37959 <colspec colwidth="8*" align="left"/>
37960 <colspec colwidth="6*" align="center"/>
37961 <colspec colwidth="6*" align="center"/>
37962 <colspec colwidth="6*" align="right"/>
37963 <tbody>
37964 <row>
37965 <entry><option>sieve_subaddress</option></entry>
37966 <entry>Use: <emphasis>redirect</emphasis></entry>
37967 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
37968 <entry>Default: <emphasis>unset</emphasis></entry>
37969 </row>
37970 </tbody>
37971 </tgroup>
37972 </informaltable>
37973 <para>
37974 The value of this option is passed to a Sieve filter to specify the
37975 :subaddress part of an address.
37976 </para>
37977 <para>
37978 <indexterm role="option">
37979 <primary><option>sieve_useraddress</option></primary>
37980 </indexterm>
37981 </para>
37982 <informaltable frame="all">
37983 <tgroup cols="4" colsep="0" rowsep="0">
37984 <colspec colwidth="8*" align="left"/>
37985 <colspec colwidth="6*" align="center"/>
37986 <colspec colwidth="6*" align="center"/>
37987 <colspec colwidth="6*" align="right"/>
37988 <tbody>
37989 <row>
37990 <entry><option>sieve_useraddress</option></entry>
37991 <entry>Use: <emphasis>redirect</emphasis></entry>
37992 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
37993 <entry>Default: <emphasis>unset</emphasis></entry>
37994 </row>
37995 </tbody>
37996 </tgroup>
37997 </informaltable>
37998 <para>
37999 The value of this option is passed to a Sieve filter to specify the :user part
38000 of an address. However, if it is unset, the entire original local part
38001 (including any prefix or suffix) is used for :user.
38002 </para>
38003 <para>
38004 <indexterm role="option">
38005 <primary><option>sieve_vacation_directory</option></primary>
38006 </indexterm>
38007 </para>
38008 <informaltable frame="all">
38009 <tgroup cols="4" colsep="0" rowsep="0">
38010 <colspec colwidth="8*" align="left"/>
38011 <colspec colwidth="6*" align="center"/>
38012 <colspec colwidth="6*" align="center"/>
38013 <colspec colwidth="6*" align="right"/>
38014 <tbody>
38015 <row>
38016 <entry><option>sieve_vacation_directory</option></entry>
38017 <entry>Use: <emphasis>redirect</emphasis></entry>
38018 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
38019 <entry>Default: <emphasis>unset</emphasis></entry>
38020 </row>
38021 </tbody>
38022 </tgroup>
38023 </informaltable>
38024 <para>
38025 <indexterm role="concept">
38026 <primary>Sieve filter</primary>
38027 <secondary>vacation directory</secondary>
38028 </indexterm>
38029 To enable the <quote>vacation</quote> extension for Sieve filters, you must set
38030 <option>sieve_vacation_directory</option> to the directory where vacation databases are held
38031 (do not put anything else in that directory), and ensure that the
38032 <option>reply_transport</option> option refers to an <command>autoreply</command> transport. Each user
38033 needs their own directory; Exim will create it if necessary.
38034 </para>
38035 <para>
38036 <indexterm role="option">
38037 <primary><option>skip_syntax_errors</option></primary>
38038 </indexterm>
38039 </para>
38040 <informaltable frame="all">
38041 <tgroup cols="4" colsep="0" rowsep="0">
38042 <colspec colwidth="8*" align="left"/>
38043 <colspec colwidth="6*" align="center"/>
38044 <colspec colwidth="6*" align="center"/>
38045 <colspec colwidth="6*" align="right"/>
38046 <tbody>
38047 <row>
38048 <entry><option>skip_syntax_errors</option></entry>
38049 <entry>Use: <emphasis>redirect</emphasis></entry>
38050 <entry>Type: <emphasis>boolean</emphasis></entry>
38051 <entry>Default: <emphasis>false</emphasis></entry>
38052 </row>
38053 </tbody>
38054 </tgroup>
38055 </informaltable>
38056 <para>
38057 <indexterm role="concept">
38058 <primary>forward file</primary>
38059 <secondary>broken</secondary>
38060 </indexterm>
38061 <indexterm role="concept">
38062 <primary>address redirection</primary>
38063 <secondary>broken files</secondary>
38064 </indexterm>
38065 <indexterm role="concept">
38066 <primary>alias file</primary>
38067 <secondary>broken</secondary>
38068 </indexterm>
38069 <indexterm role="concept">
38070 <primary>broken alias or forward files</primary>
38071 </indexterm>
38072 <indexterm role="concept">
38073 <primary>ignoring faulty addresses</primary>
38074 </indexterm>
38075 <indexterm role="concept">
38076 <primary>skipping faulty addresses</primary>
38077 </indexterm>
38078 <indexterm role="concept">
38079 <primary>error</primary>
38080 <secondary>skipping bad syntax</secondary>
38081 </indexterm>
38082 If <option>skip_syntax_errors</option> is set, syntactically malformed addresses in
38083 non-filter redirection data are skipped, and each failing address is logged. If
38084 <option>syntax_errors_to</option> is set, a message is sent to the address it defines,
38085 giving details of the failures. If <option>syntax_errors_text</option> is set, its contents
38086 are expanded and placed at the head of the error message generated by
38087 <option>syntax_errors_to</option>. Usually it is appropriate to set <option>syntax_errors_to</option> to
38088 be the same address as the generic <option>errors_to</option> option. The
38089 <option>skip_syntax_errors</option> option is often used when handling mailing lists.
38090 </para>
38091 <para>
38092 If all the addresses in a redirection list are skipped because of syntax
38093 errors, the router declines to handle the original address, and it is passed to
38094 the following routers.
38095 </para>
38096 <para>
38097 If <option>skip_syntax_errors</option> is set when an Exim filter is interpreted, any syntax
38098 error in the filter causes filtering to be abandoned without any action being
38099 taken. The incident is logged, and the router declines to handle the address,
38100 so it is passed to the following routers.
38101 </para>
38102 <para>
38103 <indexterm role="concept">
38104 <primary>Sieve filter</primary>
38105 <secondary>syntax errors in</secondary>
38106 </indexterm>
38107 Syntax errors in a Sieve filter file cause the <quote>keep</quote> action to occur. This
38108 action is specified by RFC 3028. The values of <option>skip_syntax_errors</option>,
38109 <option>syntax_errors_to</option>, and <option>syntax_errors_text</option> are not used.
38110 </para>
38111 <para>
38112 <option>skip_syntax_errors</option> can be used to specify that errors in users&#x2019; forward
38113 lists or filter files should not prevent delivery. The <option>syntax_errors_to</option>
38114 option, used with an address that does not get redirected, can be used to
38115 notify users of these errors, by means of a router like this:
38116 </para>
38117 <literallayout class="monospaced">
38118 userforward:
38119   driver = redirect
38120   allow_filter
38121   check_local_user
38122   file = $home/.forward
38123   file_transport = address_file
38124   pipe_transport = address_pipe
38125   reply_transport = address_reply
38126   no_verify
38127   skip_syntax_errors
38128   syntax_errors_to = real-$local_part@$domain
38129   syntax_errors_text = \
38130    This is an automatically generated message. An error has\n\
38131    been found in your .forward file. Details of the error are\n\
38132    reported below. While this error persists, you will receive\n\
38133    a copy of this message for every message that is addressed\n\
38134    to you. If your .forward file is a filter file, or if it is\n\
38135    a non-filter file containing no valid forwarding addresses,\n\
38136    a copy of each incoming message will be put in your normal\n\
38137    mailbox. If a non-filter file contains at least one valid\n\
38138    forwarding address, forwarding to the valid addresses will\n\
38139    happen, and those will be the only deliveries that occur.
38140 </literallayout>
38141 <para>
38142 You also need a router to ensure that local addresses that are prefixed by
38143 <literal>real-</literal> are recognized, but not forwarded or filtered. For example, you could
38144 put this immediately before the <command>userforward</command> router:
38145 </para>
38146 <literallayout class="monospaced">
38147 real_localuser:
38148   driver = accept
38149   check_local_user
38150   local_part_prefix = real-
38151   transport = local_delivery
38152 </literallayout>
38153 <para>
38154 For security, it would probably be a good idea to restrict the use of this
38155 router to locally-generated messages, using a condition such as this:
38156 </para>
38157 <literallayout class="monospaced">
38158   condition = ${if match {$sender_host_address}\
38159                          {\N^(|127\.0\.0\.1)$\N}}
38160 </literallayout>
38161 <para>
38162 <indexterm role="option">
38163 <primary><option>syntax_errors_text</option></primary>
38164 </indexterm>
38165 </para>
38166 <informaltable frame="all">
38167 <tgroup cols="4" colsep="0" rowsep="0">
38168 <colspec colwidth="8*" align="left"/>
38169 <colspec colwidth="6*" align="center"/>
38170 <colspec colwidth="6*" align="center"/>
38171 <colspec colwidth="6*" align="right"/>
38172 <tbody>
38173 <row>
38174 <entry><option>syntax_errors_text</option></entry>
38175 <entry>Use: <emphasis>redirect</emphasis></entry>
38176 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
38177 <entry>Default: <emphasis>unset</emphasis></entry>
38178 </row>
38179 </tbody>
38180 </tgroup>
38181 </informaltable>
38182 <para>
38183 See <option>skip_syntax_errors</option> above.
38184 </para>
38185 <para>
38186 <indexterm role="option">
38187 <primary><option>syntax_errors_to</option></primary>
38188 </indexterm>
38189 </para>
38190 <informaltable frame="all">
38191 <tgroup cols="4" colsep="0" rowsep="0">
38192 <colspec colwidth="8*" align="left"/>
38193 <colspec colwidth="6*" align="center"/>
38194 <colspec colwidth="6*" align="center"/>
38195 <colspec colwidth="6*" align="right"/>
38196 <tbody>
38197 <row>
38198 <entry><option>syntax_errors_to</option></entry>
38199 <entry>Use: <emphasis>redirect</emphasis></entry>
38200 <entry>Type: <emphasis>string</emphasis></entry>
38201 <entry>Default: <emphasis>unset</emphasis></entry>
38202 </row>
38203 </tbody>
38204 </tgroup>
38205 </informaltable>
38206 <para>
38207 See <option>skip_syntax_errors</option> above.
38208 <indexterm role="concept" startref="IIDredrou1" class="endofrange"/>
38209 <indexterm role="concept" startref="IIDredrou2" class="endofrange"/>
38210 </para>
38211 </section>
38212 </chapter>
38213
38214 <chapter id="CHAPenvironment">
38215 <title>Environment for running local transports</title>
38216 <titleabbrev>Environment for local transports</titleabbrev>
38217 <para>
38218 <indexterm role="concept" id="IIDenvlotra1" class="startofrange">
38219 <primary>local transports</primary>
38220 <secondary>environment for</secondary>
38221 </indexterm>
38222 <indexterm role="concept" id="IIDenvlotra2" class="startofrange">
38223 <primary>environment for local transports</primary>
38224 </indexterm>
38225 <indexterm role="concept" id="IIDenvlotra3" class="startofrange">
38226 <primary>transport</primary>
38227 <secondary>local; environment for</secondary>
38228 </indexterm>
38229 Local transports handle deliveries to files and pipes. (The <command>autoreply</command>
38230 transport can be thought of as similar to a pipe.) Exim always runs transports
38231 in subprocesses, under specified uids and gids. Typical deliveries to local
38232 mailboxes run under the uid and gid of the local user.
38233 </para>
38234 <para>
38235 Exim also sets a specific current directory while running the transport; for
38236 some transports a home directory setting is also relevant. The <command>pipe</command>
38237 transport is the only one that sets up environment variables; see section
38238 <xref linkend="SECTpipeenv"/> for details.
38239 </para>
38240 <para>
38241 The values used for the uid, gid, and the directories may come from several
38242 different places. In many cases, the router that handles the address associates
38243 settings with that address as a result of its <option>check_local_user</option>, <option>group</option>,
38244 or <option>user</option> options. However, values may also be given in the transport&#x2019;s own
38245 configuration, and these override anything that comes from the router.
38246 </para>
38247 <section id="SECID131">
38248 <title>Concurrent deliveries</title>
38249 <para>
38250 <indexterm role="concept">
38251 <primary>concurrent deliveries</primary>
38252 </indexterm>
38253 <indexterm role="concept">
38254 <primary>simultaneous deliveries</primary>
38255 </indexterm>
38256 If two different messages for the same local recipient arrive more or less
38257 simultaneously, the two delivery processes are likely to run concurrently. When
38258 the <command>appendfile</command> transport is used to write to a file, Exim applies locking
38259 rules to stop concurrent processes from writing to the same file at the same
38260 time.
38261 </para>
38262 <para>
38263 However, when you use a <command>pipe</command> transport, it is up to you to arrange any
38264 locking that is needed. Here is a silly example:
38265 </para>
38266 <literallayout class="monospaced">
38267 my_transport:
38268   driver = pipe
38269   command = /bin/sh -c 'cat &gt;&gt;/some/file'
38270 </literallayout>
38271 <para>
38272 This is supposed to write the message at the end of the file. However, if two
38273 messages arrive at the same time, the file will be scrambled. You can use the
38274 <option>exim_lock</option> utility program (see section <xref linkend="SECTmailboxmaint"/>) to lock a
38275 file using the same algorithm that Exim itself uses.
38276 </para>
38277 </section>
38278 <section id="SECTenvuidgid">
38279 <title>Uids and gids</title>
38280 <para>
38281 <indexterm role="concept">
38282 <primary>local transports</primary>
38283 <secondary>uid and gid</secondary>
38284 </indexterm>
38285 <indexterm role="concept">
38286 <primary>transport</primary>
38287 <secondary>local; uid and gid</secondary>
38288 </indexterm>
38289 All transports have the options <option>group</option> and <option>user</option>. If <option>group</option> is set, it
38290 overrides any group that the router set in the address, even if <option>user</option> is not
38291 set for the transport. This makes it possible, for example, to run local mail
38292 delivery under the uid of the recipient (set by the router), but in a special
38293 group (set by the transport). For example:
38294 </para>
38295 <literallayout class="monospaced">
38296 # Routers ...
38297 # User/group are set by check_local_user in this router
38298 local_users:
38299   driver = accept
38300   check_local_user
38301   transport = group_delivery
38302
38303 # Transports ...
38304 # This transport overrides the group
38305 group_delivery:
38306   driver = appendfile
38307   file = /var/spool/mail/$local_part
38308   group = mail
38309 </literallayout>
38310 <para>
38311 If <option>user</option> is set for a transport, its value overrides what is set in the
38312 address by the router. If <option>user</option> is non-numeric and <option>group</option> is not set, the
38313 gid associated with the user is used. If <option>user</option> is numeric, <option>group</option> must be
38314 set.
38315 </para>
38316 <para>
38317 <indexterm role="option">
38318 <primary><option>initgroups</option></primary>
38319 </indexterm>
38320 When the uid is taken from the transport&#x2019;s configuration, the <function>initgroups()</function>
38321 function is called for the groups associated with that uid if the
38322 <option>initgroups</option> option is set for the transport. When the uid is not specified
38323 by the transport, but is associated with the address by a router, the option
38324 for calling <function>initgroups()</function> is taken from the router configuration.
38325 </para>
38326 <para>
38327 <indexterm role="concept">
38328 <primary><command>pipe</command> transport</primary>
38329 <secondary>uid for</secondary>
38330 </indexterm>
38331 The <command>pipe</command> transport contains the special option <option>pipe_as_creator</option>. If this
38332 is set and <option>user</option> is not set, the uid of the process that called Exim to
38333 receive the message is used, and if <option>group</option> is not set, the corresponding
38334 original gid is also used.
38335 </para>
38336 <para>
38337 This is the detailed preference order for obtaining a gid; the first of the
38338 following that is set is used:
38339 </para>
38340 <itemizedlist>
38341 <listitem>
38342 <para>
38343 A <option>group</option> setting of the transport;
38344 </para>
38345 </listitem>
38346 <listitem>
38347 <para>
38348 A <option>group</option> setting of the router;
38349 </para>
38350 </listitem>
38351 <listitem>
38352 <para>
38353 A gid associated with a user setting of the router, either as a result of
38354 <option>check_local_user</option> or an explicit non-numeric <option>user</option> setting;
38355 </para>
38356 </listitem>
38357 <listitem>
38358 <para>
38359 The group associated with a non-numeric <option>user</option> setting of the transport;
38360 </para>
38361 </listitem>
38362 <listitem>
38363 <para>
38364 In a <command>pipe</command> transport, the creator&#x2019;s gid if <option>deliver_as_creator</option> is set and
38365 the uid is the creator&#x2019;s uid;
38366 </para>
38367 </listitem>
38368 <listitem>
38369 <para>
38370 The Exim gid if the Exim uid is being used as a default.
38371 </para>
38372 </listitem>
38373 </itemizedlist>
38374 <para>
38375 If, for example, the user is specified numerically on the router and there are
38376 no group settings, no gid is available. In this situation, an error occurs.
38377 This is different for the uid, for which there always is an ultimate default.
38378 The first of the following that is set is used:
38379 </para>
38380 <itemizedlist>
38381 <listitem>
38382 <para>
38383 A <option>user</option> setting of the transport;
38384 </para>
38385 </listitem>
38386 <listitem>
38387 <para>
38388 In a <command>pipe</command> transport, the creator&#x2019;s uid if <option>deliver_as_creator</option> is set;
38389 </para>
38390 </listitem>
38391 <listitem>
38392 <para>
38393 A <option>user</option> setting of the router;
38394 </para>
38395 </listitem>
38396 <listitem>
38397 <para>
38398 A <option>check_local_user</option> setting of the router;
38399 </para>
38400 </listitem>
38401 <listitem>
38402 <para>
38403 The Exim uid.
38404 </para>
38405 </listitem>
38406 </itemizedlist>
38407 <para>
38408 Of course, an error will still occur if the uid that is chosen is on the
38409 <option>never_users</option> list.
38410 </para>
38411 </section>
38412 <section id="SECID132">
38413 <title>Current and home directories</title>
38414 <para>
38415 <indexterm role="concept">
38416 <primary>current directory for local transport</primary>
38417 </indexterm>
38418 <indexterm role="concept">
38419 <primary>home directory</primary>
38420 <secondary>for local transport</secondary>
38421 </indexterm>
38422 <indexterm role="concept">
38423 <primary>transport</primary>
38424 <secondary>local; home directory for</secondary>
38425 </indexterm>
38426 <indexterm role="concept">
38427 <primary>transport</primary>
38428 <secondary>local; current directory for</secondary>
38429 </indexterm>
38430 Routers may set current and home directories for local transports by means of
38431 the <option>transport_current_directory</option> and <option>transport_home_directory</option> options.
38432 However, if the transport&#x2019;s <option>current_directory</option> or <option>home_directory</option> options
38433 are set, they override the router&#x2019;s values. In detail, the home directory
38434 for a local transport is taken from the first of these values that is set:
38435 </para>
38436 <itemizedlist>
38437 <listitem>
38438 <para>
38439 The <option>home_directory</option> option on the transport;
38440 </para>
38441 </listitem>
38442 <listitem>
38443 <para>
38444 The <option>transport_home_directory</option> option on the router;
38445 </para>
38446 </listitem>
38447 <listitem>
38448 <para>
38449 The password data if <option>check_local_user</option> is set on the router;
38450 </para>
38451 </listitem>
38452 <listitem>
38453 <para>
38454 The <option>router_home_directory</option> option on the router.
38455 </para>
38456 </listitem>
38457 </itemizedlist>
38458 <para>
38459 The current directory is taken from the first of these values that is set:
38460 </para>
38461 <itemizedlist>
38462 <listitem>
38463 <para>
38464 The <option>current_directory</option> option on the transport;
38465 </para>
38466 </listitem>
38467 <listitem>
38468 <para>
38469 The <option>transport_current_directory</option> option on the router.
38470 </para>
38471 </listitem>
38472 </itemizedlist>
38473 <para>
38474 If neither the router nor the transport sets a current directory, Exim uses the
38475 value of the home directory, if it is set. Otherwise it sets the current
38476 directory to <filename>/</filename> before running a local transport.
38477 </para>
38478 </section>
38479 <section id="SECID133">
38480 <title>Expansion variables derived from the address</title>
38481 <para>
38482 <indexterm role="variable">
38483 <primary><varname>$domain</varname></primary>
38484 </indexterm>
38485 <indexterm role="variable">
38486 <primary><varname>$local_part</varname></primary>
38487 </indexterm>
38488 <indexterm role="variable">
38489 <primary><varname>$original_domain</varname></primary>
38490 </indexterm>
38491 Normally a local delivery is handling a single address, and in that case the
38492 variables such as <varname>$domain</varname> and <varname>$local_part</varname> are set during local
38493 deliveries. However, in some circumstances more than one address may be handled
38494 at once (for example, while writing batch SMTP for onward transmission by some
38495 other means). In this case, the variables associated with the local part are
38496 never set, <varname>$domain</varname> is set only if all the addresses have the same domain,
38497 and <varname>$original_domain</varname> is never set.
38498 <indexterm role="concept" startref="IIDenvlotra1" class="endofrange"/>
38499 <indexterm role="concept" startref="IIDenvlotra2" class="endofrange"/>
38500 <indexterm role="concept" startref="IIDenvlotra3" class="endofrange"/>
38501 </para>
38502 </section>
38503 </chapter>
38504
38505 <chapter id="CHAPtransportgeneric">
38506 <title>Generic options for transports</title>
38507 <para>
38508 <indexterm role="concept" id="IIDgenoptra1" class="startofrange">
38509 <primary>generic options</primary>
38510 <secondary>transport</secondary>
38511 </indexterm>
38512 <indexterm role="concept" id="IIDgenoptra2" class="startofrange">
38513 <primary>options</primary>
38514 <secondary>generic; for transports</secondary>
38515 </indexterm>
38516 <indexterm role="concept" id="IIDgenoptra3" class="startofrange">
38517 <primary>transport</primary>
38518 <secondary>generic options for</secondary>
38519 </indexterm>
38520 The following generic options apply to all transports:
38521 </para>
38522 <para>
38523 <indexterm role="option">
38524 <primary><option>body_only</option></primary>
38525 </indexterm>
38526 </para>
38527 <informaltable frame="all">
38528 <tgroup cols="4" colsep="0" rowsep="0">
38529 <colspec colwidth="8*" align="left"/>
38530 <colspec colwidth="6*" align="center"/>
38531 <colspec colwidth="6*" align="center"/>
38532 <colspec colwidth="6*" align="right"/>
38533 <tbody>
38534 <row>
38535 <entry><option>body_only</option></entry>
38536 <entry>Use: <emphasis>transports</emphasis></entry>
38537 <entry>Type: <emphasis>boolean</emphasis></entry>
38538 <entry>Default: <emphasis>false</emphasis></entry>
38539 </row>
38540 </tbody>
38541 </tgroup>
38542 </informaltable>
38543 <para>
38544 <indexterm role="concept">
38545 <primary>transport</primary>
38546 <secondary>body only</secondary>
38547 </indexterm>
38548 <indexterm role="concept">
38549 <primary>message</primary>
38550 <secondary>transporting body only</secondary>
38551 </indexterm>
38552 <indexterm role="concept">
38553 <primary>body of message</primary>
38554 <secondary>transporting</secondary>
38555 </indexterm>
38556 If this option is set, the message&#x2019;s headers are not transported. It is
38557 mutually exclusive with <option>headers_only</option>. If it is used with the <command>appendfile</command>
38558 or <command>pipe</command> transports, the settings of <option>message_prefix</option> and
38559 <option>message_suffix</option> should be checked, because this option does not
38560 automatically suppress them.
38561 </para>
38562 <para>
38563 <indexterm role="option">
38564 <primary><option>current_directory</option></primary>
38565 </indexterm>
38566 </para>
38567 <informaltable frame="all">
38568 <tgroup cols="4" colsep="0" rowsep="0">
38569 <colspec colwidth="8*" align="left"/>
38570 <colspec colwidth="6*" align="center"/>
38571 <colspec colwidth="6*" align="center"/>
38572 <colspec colwidth="6*" align="right"/>
38573 <tbody>
38574 <row>
38575 <entry><option>current_directory</option></entry>
38576 <entry>Use: <emphasis>transports</emphasis></entry>
38577 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
38578 <entry>Default: <emphasis>unset</emphasis></entry>
38579 </row>
38580 </tbody>
38581 </tgroup>
38582 </informaltable>
38583 <para>
38584 <indexterm role="concept">
38585 <primary>transport</primary>
38586 <secondary>current directory for</secondary>
38587 </indexterm>
38588 This specifies the current directory that is to be set while running the
38589 transport, overriding any value that may have been set by the router.
38590 If the expansion fails for any reason, including forced failure, an error is
38591 logged, and delivery is deferred.
38592 </para>
38593 <para>
38594 <indexterm role="option">
38595 <primary><option>disable_logging</option></primary>
38596 </indexterm>
38597 </para>
38598 <informaltable frame="all">
38599 <tgroup cols="4" colsep="0" rowsep="0">
38600 <colspec colwidth="8*" align="left"/>
38601 <colspec colwidth="6*" align="center"/>
38602 <colspec colwidth="6*" align="center"/>
38603 <colspec colwidth="6*" align="right"/>
38604 <tbody>
38605 <row>
38606 <entry><option>disable_logging</option></entry>
38607 <entry>Use: <emphasis>transports</emphasis></entry>
38608 <entry>Type: <emphasis>boolean</emphasis></entry>
38609 <entry>Default: <emphasis>false</emphasis></entry>
38610 </row>
38611 </tbody>
38612 </tgroup>
38613 </informaltable>
38614 <para>
38615 If this option is set true, nothing is logged for any
38616 deliveries by the transport or for any
38617 transport errors. You should not set this option unless you really, really know
38618 what you are doing.
38619 </para>
38620 <para>
38621 <indexterm role="option">
38622 <primary><option>debug_print</option></primary>
38623 </indexterm>
38624 </para>
38625 <informaltable frame="all">
38626 <tgroup cols="4" colsep="0" rowsep="0">
38627 <colspec colwidth="8*" align="left"/>
38628 <colspec colwidth="6*" align="center"/>
38629 <colspec colwidth="6*" align="center"/>
38630 <colspec colwidth="6*" align="right"/>
38631 <tbody>
38632 <row>
38633 <entry><option>debug_print</option></entry>
38634 <entry>Use: <emphasis>transports</emphasis></entry>
38635 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
38636 <entry>Default: <emphasis>unset</emphasis></entry>
38637 </row>
38638 </tbody>
38639 </tgroup>
38640 </informaltable>
38641 <para>
38642 <indexterm role="concept">
38643 <primary>testing</primary>
38644 <secondary>variables in drivers</secondary>
38645 </indexterm>
38646 If this option is set and debugging is enabled (see the <option>-d</option> command line
38647 option), the string is expanded and included in the debugging output when the
38648 transport is run.
38649 If expansion of the string fails, the error message is written to the debugging
38650 output, and Exim carries on processing.
38651 This facility is provided to help with checking out the values of variables and
38652 so on when debugging driver configurations. For example, if a <option>headers_add</option>
38653 option is not working properly, <option>debug_print</option> could be used to output the
38654 variables it references. A newline is added to the text if it does not end with
38655 one.
38656 The variables <varname>$transport_name</varname> and <varname>$router_name</varname> contain the name of the
38657 transport and the router that called it.
38658 </para>
38659 <para>
38660 <indexterm role="option">
38661 <primary><option>delivery_date_add</option></primary>
38662 </indexterm>
38663 </para>
38664 <informaltable frame="all">
38665 <tgroup cols="4" colsep="0" rowsep="0">
38666 <colspec colwidth="8*" align="left"/>
38667 <colspec colwidth="6*" align="center"/>
38668 <colspec colwidth="6*" align="center"/>
38669 <colspec colwidth="6*" align="right"/>
38670 <tbody>
38671 <row>
38672 <entry><option>delivery_date_add</option></entry>
38673 <entry>Use: <emphasis>transports</emphasis></entry>
38674 <entry>Type: <emphasis>boolean</emphasis></entry>
38675 <entry>Default: <emphasis>false</emphasis></entry>
38676 </row>
38677 </tbody>
38678 </tgroup>
38679 </informaltable>
38680 <para>
38681 <indexterm role="concept">
38682 <primary><emphasis>Delivery-date:</emphasis> header line</primary>
38683 </indexterm>
38684 If this option is true, a <emphasis>Delivery-date:</emphasis> header is added to the message.
38685 This gives the actual time the delivery was made. As this is not a standard
38686 header, Exim has a configuration option (<option>delivery_date_remove</option>) which
38687 requests its removal from incoming messages, so that delivered messages can
38688 safely be resent to other recipients.
38689 </para>
38690 <para>
38691 <indexterm role="option">
38692 <primary><option>driver</option></primary>
38693 </indexterm>
38694 </para>
38695 <informaltable frame="all">
38696 <tgroup cols="4" colsep="0" rowsep="0">
38697 <colspec colwidth="8*" align="left"/>
38698 <colspec colwidth="6*" align="center"/>
38699 <colspec colwidth="6*" align="center"/>
38700 <colspec colwidth="6*" align="right"/>
38701 <tbody>
38702 <row>
38703 <entry><option>driver</option></entry>
38704 <entry>Use: <emphasis>transports</emphasis></entry>
38705 <entry>Type: <emphasis>string</emphasis></entry>
38706 <entry>Default: <emphasis>unset</emphasis></entry>
38707 </row>
38708 </tbody>
38709 </tgroup>
38710 </informaltable>
38711 <para>
38712 This specifies which of the available transport drivers is to be used.
38713 There is no default, and this option must be set for every transport.
38714 </para>
38715 <para>
38716 <indexterm role="option">
38717 <primary><option>envelope_to_add</option></primary>
38718 </indexterm>
38719 </para>
38720 <informaltable frame="all">
38721 <tgroup cols="4" colsep="0" rowsep="0">
38722 <colspec colwidth="8*" align="left"/>
38723 <colspec colwidth="6*" align="center"/>
38724 <colspec colwidth="6*" align="center"/>
38725 <colspec colwidth="6*" align="right"/>
38726 <tbody>
38727 <row>
38728 <entry><option>envelope_to_add</option></entry>
38729 <entry>Use: <emphasis>transports</emphasis></entry>
38730 <entry>Type: <emphasis>boolean</emphasis></entry>
38731 <entry>Default: <emphasis>false</emphasis></entry>
38732 </row>
38733 </tbody>
38734 </tgroup>
38735 </informaltable>
38736 <para>
38737 <indexterm role="concept">
38738 <primary><emphasis>Envelope-to:</emphasis> header line</primary>
38739 </indexterm>
38740 If this option is true, an <emphasis>Envelope-to:</emphasis> header is added to the message.
38741 This gives the original address(es) in the incoming envelope that caused this
38742 delivery to happen. More than one address may be present if the transport is
38743 configured to handle several addresses at once, or if more than one original
38744 address was redirected to the same final address. As this is not a standard
38745 header, Exim has a configuration option (<option>envelope_to_remove</option>) which requests
38746 its removal from incoming messages, so that delivered messages can safely be
38747 resent to other recipients.
38748 </para>
38749 <para>
38750 <indexterm role="option">
38751 <primary><option>group</option></primary>
38752 </indexterm>
38753 </para>
38754 <informaltable frame="all">
38755 <tgroup cols="4" colsep="0" rowsep="0">
38756 <colspec colwidth="8*" align="left"/>
38757 <colspec colwidth="6*" align="center"/>
38758 <colspec colwidth="6*" align="center"/>
38759 <colspec colwidth="6*" align="right"/>
38760 <tbody>
38761 <row>
38762 <entry><option>group</option></entry>
38763 <entry>Use: <emphasis>transports</emphasis></entry>
38764 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
38765 <entry>Default: <emphasis>Exim group</emphasis></entry>
38766 </row>
38767 </tbody>
38768 </tgroup>
38769 </informaltable>
38770 <para>
38771 <indexterm role="concept">
38772 <primary>transport</primary>
38773 <secondary>group; specifying</secondary>
38774 </indexterm>
38775 This option specifies a gid for running the transport process, overriding any
38776 value that the router supplies, and also overriding any value associated with
38777 <option>user</option> (see below).
38778 </para>
38779 <para>
38780 <indexterm role="option">
38781 <primary><option>headers_add</option></primary>
38782 </indexterm>
38783 </para>
38784 <informaltable frame="all">
38785 <tgroup cols="4" colsep="0" rowsep="0">
38786 <colspec colwidth="8*" align="left"/>
38787 <colspec colwidth="6*" align="center"/>
38788 <colspec colwidth="6*" align="center"/>
38789 <colspec colwidth="6*" align="right"/>
38790 <tbody>
38791 <row>
38792 <entry><option>headers_add</option></entry>
38793 <entry>Use: <emphasis>transports</emphasis></entry>
38794 <entry>Type: <emphasis>list</emphasis>&dagger;<emphasis></emphasis></entry>
38795 <entry>Default: <emphasis>unset</emphasis></entry>
38796 </row>
38797 </tbody>
38798 </tgroup>
38799 </informaltable>
38800 <para>
38801 <indexterm role="concept">
38802 <primary>header lines</primary>
38803 <secondary>adding in transport</secondary>
38804 </indexterm>
38805 <indexterm role="concept">
38806 <primary>transport</primary>
38807 <secondary>header lines; adding</secondary>
38808 </indexterm>
38809 This option specifies a list of text headers,
38810 </para>
38811 <para revisionflag="changed">
38812 newline-separated (by default, changeable in the usual way),
38813 </para>
38814 <para>
38815 which are (separately) expanded and added to the header
38816 portion of a message as it is transported, as described in section
38817 <xref linkend="SECTheadersaddrem"/>. Additional header lines can also be specified by
38818 routers. If the result of the expansion is an empty string, or if the expansion
38819 is forced to fail, no action is taken. Other expansion failures are treated as
38820 errors and cause the delivery to be deferred.
38821 </para>
38822 <para>
38823 Unlike most options, <option>headers_add</option> can be specified multiple times
38824 for a transport; all listed headers are added.
38825 </para>
38826 <para>
38827 <indexterm role="option">
38828 <primary><option>headers_only</option></primary>
38829 </indexterm>
38830 </para>
38831 <informaltable frame="all">
38832 <tgroup cols="4" colsep="0" rowsep="0">
38833 <colspec colwidth="8*" align="left"/>
38834 <colspec colwidth="6*" align="center"/>
38835 <colspec colwidth="6*" align="center"/>
38836 <colspec colwidth="6*" align="right"/>
38837 <tbody>
38838 <row>
38839 <entry><option>headers_only</option></entry>
38840 <entry>Use: <emphasis>transports</emphasis></entry>
38841 <entry>Type: <emphasis>boolean</emphasis></entry>
38842 <entry>Default: <emphasis>false</emphasis></entry>
38843 </row>
38844 </tbody>
38845 </tgroup>
38846 </informaltable>
38847 <para>
38848 <indexterm role="concept">
38849 <primary>transport</primary>
38850 <secondary>header lines only</secondary>
38851 </indexterm>
38852 <indexterm role="concept">
38853 <primary>message</primary>
38854 <secondary>transporting headers only</secondary>
38855 </indexterm>
38856 <indexterm role="concept">
38857 <primary>header lines</primary>
38858 <secondary>transporting</secondary>
38859 </indexterm>
38860 If this option is set, the message&#x2019;s body is not transported. It is mutually
38861 exclusive with <option>body_only</option>. If it is used with the <command>appendfile</command> or <command>pipe</command>
38862 transports, the settings of <option>message_prefix</option> and <option>message_suffix</option> should be
38863 checked, since this option does not automatically suppress them.
38864 </para>
38865 <para>
38866 <indexterm role="option">
38867 <primary><option>headers_remove</option></primary>
38868 </indexterm>
38869 </para>
38870 <informaltable frame="all">
38871 <tgroup cols="4" colsep="0" rowsep="0">
38872 <colspec colwidth="8*" align="left"/>
38873 <colspec colwidth="6*" align="center"/>
38874 <colspec colwidth="6*" align="center"/>
38875 <colspec colwidth="6*" align="right"/>
38876 <tbody>
38877 <row>
38878 <entry><option>headers_remove</option></entry>
38879 <entry>Use: <emphasis>transports</emphasis></entry>
38880 <entry>Type: <emphasis>list</emphasis>&dagger;<emphasis></emphasis></entry>
38881 <entry>Default: <emphasis>unset</emphasis></entry>
38882 </row>
38883 </tbody>
38884 </tgroup>
38885 </informaltable>
38886 <para>
38887 <indexterm role="concept">
38888 <primary>header lines</primary>
38889 <secondary>removing</secondary>
38890 </indexterm>
38891 <indexterm role="concept">
38892 <primary>transport</primary>
38893 <secondary>header lines; removing</secondary>
38894 </indexterm>
38895 This option specifies a list of header names,
38896 </para>
38897 <para revisionflag="changed">
38898 colon-separated (by default, changeable in the usual way);
38899 </para>
38900 <para>
38901 these headers are omitted from the message as it is transported, as described
38902 in section <xref linkend="SECTheadersaddrem"/>. Header removal can also be specified by
38903 routers.
38904 Each list item is separately expanded.
38905 If the result of the expansion is an empty string, or if the expansion
38906 is forced to fail, no action is taken. Other expansion failures are treated as
38907 errors and cause the delivery to be deferred.
38908 </para>
38909 <para>
38910 Unlike most options, <option>headers_remove</option> can be specified multiple times
38911 for a router; all listed headers are removed.
38912 </para>
38913 <para>
38914 <emphasis role="bold">Warning</emphasis>: Because of the separate expansion of the list items,
38915 items that contain a list separator must have it doubled.
38916 To avoid this, change the list separator (<xref linkend="SECTlistsepchange"/>).
38917 </para>
38918 <para>
38919 <indexterm role="option">
38920 <primary><option>headers_rewrite</option></primary>
38921 </indexterm>
38922 </para>
38923 <informaltable frame="all">
38924 <tgroup cols="4" colsep="0" rowsep="0">
38925 <colspec colwidth="8*" align="left"/>
38926 <colspec colwidth="6*" align="center"/>
38927 <colspec colwidth="6*" align="center"/>
38928 <colspec colwidth="6*" align="right"/>
38929 <tbody>
38930 <row>
38931 <entry><option>headers_rewrite</option></entry>
38932 <entry>Use: <emphasis>transports</emphasis></entry>
38933 <entry>Type: <emphasis>string</emphasis></entry>
38934 <entry>Default: <emphasis>unset</emphasis></entry>
38935 </row>
38936 </tbody>
38937 </tgroup>
38938 </informaltable>
38939 <para>
38940 <indexterm role="concept">
38941 <primary>transport</primary>
38942 <secondary>header lines; rewriting</secondary>
38943 </indexterm>
38944 <indexterm role="concept">
38945 <primary>rewriting</primary>
38946 <secondary>at transport time</secondary>
38947 </indexterm>
38948 This option allows addresses in header lines to be rewritten at transport time,
38949 that is, as the message is being copied to its destination. The contents of the
38950 option are a colon-separated list of rewriting rules. Each rule is in exactly
38951 the same form as one of the general rewriting rules that are applied when a
38952 message is received. These are described in chapter <xref linkend="CHAPrewrite"/>. For
38953 example,
38954 </para>
38955 <literallayout class="monospaced">
38956 headers_rewrite = a@b c@d f : \
38957                   x@y w@z
38958 </literallayout>
38959 <para>
38960 changes <emphasis>a@b</emphasis> into <emphasis>c@d</emphasis> in <emphasis>From:</emphasis> header lines, and <emphasis>x@y</emphasis> into
38961 <emphasis>w@z</emphasis> in all address-bearing header lines. The rules are applied to the
38962 header lines just before they are written out at transport time, so they affect
38963 only those copies of the message that pass through the transport. However, only
38964 the message&#x2019;s original header lines, and any that were added by a system
38965 filter, are rewritten. If a router or transport adds header lines, they are not
38966 affected by this option. These rewriting rules are <emphasis>not</emphasis> applied to the
38967 envelope. You can change the return path using <option>return_path</option>, but you cannot
38968 change envelope recipients at this time.
38969 </para>
38970 <para>
38971 <indexterm role="option">
38972 <primary><option>home_directory</option></primary>
38973 </indexterm>
38974 </para>
38975 <informaltable frame="all">
38976 <tgroup cols="4" colsep="0" rowsep="0">
38977 <colspec colwidth="8*" align="left"/>
38978 <colspec colwidth="6*" align="center"/>
38979 <colspec colwidth="6*" align="center"/>
38980 <colspec colwidth="6*" align="right"/>
38981 <tbody>
38982 <row>
38983 <entry><option>home_directory</option></entry>
38984 <entry>Use: <emphasis>transports</emphasis></entry>
38985 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
38986 <entry>Default: <emphasis>unset</emphasis></entry>
38987 </row>
38988 </tbody>
38989 </tgroup>
38990 </informaltable>
38991 <para>
38992 <indexterm role="concept">
38993 <primary>transport</primary>
38994 <secondary>home directory for</secondary>
38995 </indexterm>
38996 <indexterm role="variable">
38997 <primary><varname>$home</varname></primary>
38998 </indexterm>
38999 This option specifies a home directory setting for a local transport,
39000 overriding any value that may be set by the router. The home directory is
39001 placed in <varname>$home</varname> while expanding the transport&#x2019;s private options. It is also
39002 used as the current directory if no current directory is set by the
39003 <option>current_directory</option> option on the transport or the
39004 <option>transport_current_directory</option> option on the router. If the expansion fails
39005 for any reason, including forced failure, an error is logged, and delivery is
39006 deferred.
39007 </para>
39008 <para>
39009 <indexterm role="option">
39010 <primary><option>initgroups</option></primary>
39011 </indexterm>
39012 </para>
39013 <informaltable frame="all">
39014 <tgroup cols="4" colsep="0" rowsep="0">
39015 <colspec colwidth="8*" align="left"/>
39016 <colspec colwidth="6*" align="center"/>
39017 <colspec colwidth="6*" align="center"/>
39018 <colspec colwidth="6*" align="right"/>
39019 <tbody>
39020 <row>
39021 <entry><option>initgroups</option></entry>
39022 <entry>Use: <emphasis>transports</emphasis></entry>
39023 <entry>Type: <emphasis>boolean</emphasis></entry>
39024 <entry>Default: <emphasis>false</emphasis></entry>
39025 </row>
39026 </tbody>
39027 </tgroup>
39028 </informaltable>
39029 <para>
39030 <indexterm role="concept">
39031 <primary>additional groups</primary>
39032 </indexterm>
39033 <indexterm role="concept">
39034 <primary>groups</primary>
39035 <secondary>additional</secondary>
39036 </indexterm>
39037 <indexterm role="concept">
39038 <primary>transport</primary>
39039 <secondary>group; additional</secondary>
39040 </indexterm>
39041 If this option is true and the uid for the delivery process is provided by the
39042 transport, the <function>initgroups()</function> function is called when running the transport
39043 to ensure that any additional groups associated with the uid are set up.
39044 </para>
39045 <para>
39046 <indexterm role="option">
39047 <primary><option>message_size_limit</option></primary>
39048 </indexterm>
39049 </para>
39050 <informaltable frame="all">
39051 <tgroup cols="4" colsep="0" rowsep="0">
39052 <colspec colwidth="8*" align="left"/>
39053 <colspec colwidth="6*" align="center"/>
39054 <colspec colwidth="6*" align="center"/>
39055 <colspec colwidth="6*" align="right"/>
39056 <tbody>
39057 <row>
39058 <entry><option>message_size_limit</option></entry>
39059 <entry>Use: <emphasis>transports</emphasis></entry>
39060 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
39061 <entry>Default: <emphasis>0</emphasis></entry>
39062 </row>
39063 </tbody>
39064 </tgroup>
39065 </informaltable>
39066 <para>
39067 <indexterm role="concept">
39068 <primary>limit</primary>
39069 <secondary>message size per transport</secondary>
39070 </indexterm>
39071 <indexterm role="concept">
39072 <primary>size</primary>
39073 <secondary>of message, limit</secondary>
39074 </indexterm>
39075 <indexterm role="concept">
39076 <primary>transport</primary>
39077 <secondary>message size; limiting</secondary>
39078 </indexterm>
39079 This option controls the size of messages passed through the transport. It is
39080 expanded before use; the result of the expansion must be a sequence of decimal
39081 digits, optionally followed by K or M. If the expansion fails for any reason,
39082 including forced failure, or if the result is not of the required form,
39083 delivery is deferred. If the value is greater than zero and the size of a
39084 message exceeds this limit, the address is failed. If there is any chance that
39085 the resulting bounce message could be routed to the same transport, you should
39086 ensure that <option>return_size_limit</option> is less than the transport&#x2019;s
39087 <option>message_size_limit</option>, as otherwise the bounce message will fail to get
39088 delivered.
39089 </para>
39090 <para>
39091 <indexterm role="option">
39092 <primary><option>rcpt_include_affixes</option></primary>
39093 </indexterm>
39094 </para>
39095 <informaltable frame="all">
39096 <tgroup cols="4" colsep="0" rowsep="0">
39097 <colspec colwidth="8*" align="left"/>
39098 <colspec colwidth="6*" align="center"/>
39099 <colspec colwidth="6*" align="center"/>
39100 <colspec colwidth="6*" align="right"/>
39101 <tbody>
39102 <row>
39103 <entry><option>rcpt_include_affixes</option></entry>
39104 <entry>Use: <emphasis>transports</emphasis></entry>
39105 <entry>Type: <emphasis>boolean</emphasis></entry>
39106 <entry>Default: <emphasis>false</emphasis></entry>
39107 </row>
39108 </tbody>
39109 </tgroup>
39110 </informaltable>
39111 <para>
39112 <indexterm role="concept">
39113 <primary>prefix</primary>
39114 <secondary>for local part, including in envelope</secondary>
39115 </indexterm>
39116 <indexterm role="concept">
39117 <primary>suffix for local part</primary>
39118 <secondary>including in envelope</secondary>
39119 </indexterm>
39120 <indexterm role="concept">
39121 <primary>local part</primary>
39122 <secondary>prefix</secondary>
39123 </indexterm>
39124 <indexterm role="concept">
39125 <primary>local part</primary>
39126 <secondary>suffix</secondary>
39127 </indexterm>
39128 When this option is false (the default), and an address that has had any
39129 affixes (prefixes or suffixes) removed from the local part is delivered by any
39130 form of SMTP or LMTP, the affixes are not included. For example, if a router
39131 that contains
39132 </para>
39133 <literallayout class="monospaced">
39134 local_part_prefix = *-
39135 </literallayout>
39136 <para>
39137 routes the address <emphasis>abc-xyz@some.domain</emphasis> to an SMTP transport, the envelope
39138 is delivered with
39139 </para>
39140 <literallayout class="monospaced">
39141 RCPT TO:&lt;xyz@some.domain&gt;
39142 </literallayout>
39143 <para>
39144 This is also the case when an ACL-time callout is being used to verify a
39145 recipient address. However, if <option>rcpt_include_affixes</option> is set true, the
39146 whole local part is included in the RCPT command. This option applies to BSMTP
39147 deliveries by the <command>appendfile</command> and <command>pipe</command> transports as well as to the
39148 <command>lmtp</command> and <command>smtp</command> transports.
39149 </para>
39150 <para>
39151 <indexterm role="option">
39152 <primary><option>retry_use_local_part</option></primary>
39153 </indexterm>
39154 </para>
39155 <informaltable frame="all">
39156 <tgroup cols="4" colsep="0" rowsep="0">
39157 <colspec colwidth="8*" align="left"/>
39158 <colspec colwidth="6*" align="center"/>
39159 <colspec colwidth="6*" align="center"/>
39160 <colspec colwidth="6*" align="right"/>
39161 <tbody>
39162 <row>
39163 <entry><option>retry_use_local_part</option></entry>
39164 <entry>Use: <emphasis>transports</emphasis></entry>
39165 <entry>Type: <emphasis>boolean</emphasis></entry>
39166 <entry>Default: <emphasis>see below</emphasis></entry>
39167 </row>
39168 </tbody>
39169 </tgroup>
39170 </informaltable>
39171 <para>
39172 <indexterm role="concept">
39173 <primary>hints database</primary>
39174 <secondary>retry keys</secondary>
39175 </indexterm>
39176 When a delivery suffers a temporary failure, a retry record is created
39177 in Exim&#x2019;s hints database. For remote deliveries, the key for the retry record
39178 is based on the name and/or IP address of the failing remote host. For local
39179 deliveries, the key is normally the entire address, including both the local
39180 part and the domain. This is suitable for most common cases of local delivery
39181 temporary failure &ndash; for example, exceeding a mailbox quota should delay only
39182 deliveries to that mailbox, not to the whole domain.
39183 </para>
39184 <para>
39185 However, in some special cases you may want to treat a temporary local delivery
39186 as a failure associated with the domain, and not with a particular local part.
39187 (For example, if you are storing all mail for some domain in files.) You can do
39188 this by setting <option>retry_use_local_part</option> false.
39189 </para>
39190 <para>
39191 For all the local transports, its default value is true. For remote transports,
39192 the default value is false for tidiness, but changing the value has no effect
39193 on a remote transport in the current implementation.
39194 </para>
39195 <para>
39196 <indexterm role="option">
39197 <primary><option>return_path</option></primary>
39198 </indexterm>
39199 </para>
39200 <informaltable frame="all">
39201 <tgroup cols="4" colsep="0" rowsep="0">
39202 <colspec colwidth="8*" align="left"/>
39203 <colspec colwidth="6*" align="center"/>
39204 <colspec colwidth="6*" align="center"/>
39205 <colspec colwidth="6*" align="right"/>
39206 <tbody>
39207 <row>
39208 <entry><option>return_path</option></entry>
39209 <entry>Use: <emphasis>transports</emphasis></entry>
39210 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
39211 <entry>Default: <emphasis>unset</emphasis></entry>
39212 </row>
39213 </tbody>
39214 </tgroup>
39215 </informaltable>
39216 <para>
39217 <indexterm role="concept">
39218 <primary>envelope sender</primary>
39219 </indexterm>
39220 <indexterm role="concept">
39221 <primary>transport</primary>
39222 <secondary>return path; changing</secondary>
39223 </indexterm>
39224 <indexterm role="concept">
39225 <primary>return path</primary>
39226 <secondary>changing in transport</secondary>
39227 </indexterm>
39228 If this option is set, the string is expanded at transport time and replaces
39229 the existing return path (envelope sender) value in the copy of the message
39230 that is being delivered. An empty return path is permitted. This feature is
39231 designed for remote deliveries, where the value of this option is used in the
39232 SMTP MAIL command. If you set <option>return_path</option> for a local transport, the
39233 only effect is to change the address that is placed in the <emphasis>Return-path:</emphasis>
39234 header line, if one is added to the message (see the next option).
39235 </para>
39236 <para>
39237 <emphasis role="bold">Note:</emphasis> A changed return path is not logged unless you add
39238 <option>return_path_on_delivery</option> to the log selector.
39239 </para>
39240 <para>
39241 <indexterm role="variable">
39242 <primary><varname>$return_path</varname></primary>
39243 </indexterm>
39244 The expansion can refer to the existing value via <varname>$return_path</varname>. This is
39245 either the message&#x2019;s envelope sender, or an address set by the
39246 <option>errors_to</option> option on a router. If the expansion is forced to fail, no
39247 replacement occurs; if it fails for another reason, delivery is deferred. This
39248 option can be used to support VERP (Variable Envelope Return Paths) &ndash; see
39249 section <xref linkend="SECTverp"/>.
39250 </para>
39251 <para>
39252 <emphasis role="bold">Note</emphasis>: If a delivery error is detected locally, including the case when a
39253 remote server rejects a message at SMTP time, the bounce message is not sent to
39254 the value of this option. It is sent to the previously set errors address.
39255 This defaults to the incoming sender address, but can be changed by setting
39256 <option>errors_to</option> in a router.
39257 </para>
39258 <para>
39259 <indexterm role="option">
39260 <primary><option>return_path_add</option></primary>
39261 </indexterm>
39262 </para>
39263 <informaltable frame="all">
39264 <tgroup cols="4" colsep="0" rowsep="0">
39265 <colspec colwidth="8*" align="left"/>
39266 <colspec colwidth="6*" align="center"/>
39267 <colspec colwidth="6*" align="center"/>
39268 <colspec colwidth="6*" align="right"/>
39269 <tbody>
39270 <row>
39271 <entry><option>return_path_add</option></entry>
39272 <entry>Use: <emphasis>transports</emphasis></entry>
39273 <entry>Type: <emphasis>boolean</emphasis></entry>
39274 <entry>Default: <emphasis>false</emphasis></entry>
39275 </row>
39276 </tbody>
39277 </tgroup>
39278 </informaltable>
39279 <para>
39280 <indexterm role="concept">
39281 <primary><emphasis>Return-path:</emphasis> header line</primary>
39282 </indexterm>
39283 If this option is true, a <emphasis>Return-path:</emphasis> header is added to the message.
39284 Although the return path is normally available in the prefix line of BSD
39285 mailboxes, this is commonly not displayed by MUAs, and so the user does not
39286 have easy access to it.
39287 </para>
39288 <para>
39289 RFC 2821 states that the <emphasis>Return-path:</emphasis> header is added to a message <quote>when
39290 the delivery SMTP server makes the final delivery</quote>. This implies that this
39291 header should not be present in incoming messages. Exim has a configuration
39292 option, <option>return_path_remove</option>, which requests removal of this header from
39293 incoming messages, so that delivered messages can safely be resent to other
39294 recipients.
39295 </para>
39296 <para>
39297 <indexterm role="option">
39298 <primary><option>shadow_condition</option></primary>
39299 </indexterm>
39300 </para>
39301 <informaltable frame="all">
39302 <tgroup cols="4" colsep="0" rowsep="0">
39303 <colspec colwidth="8*" align="left"/>
39304 <colspec colwidth="6*" align="center"/>
39305 <colspec colwidth="6*" align="center"/>
39306 <colspec colwidth="6*" align="right"/>
39307 <tbody>
39308 <row>
39309 <entry><option>shadow_condition</option></entry>
39310 <entry>Use: <emphasis>transports</emphasis></entry>
39311 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
39312 <entry>Default: <emphasis>unset</emphasis></entry>
39313 </row>
39314 </tbody>
39315 </tgroup>
39316 </informaltable>
39317 <para>
39318 See <option>shadow_transport</option> below.
39319 </para>
39320 <para>
39321 <indexterm role="option">
39322 <primary><option>shadow_transport</option></primary>
39323 </indexterm>
39324 </para>
39325 <informaltable frame="all">
39326 <tgroup cols="4" colsep="0" rowsep="0">
39327 <colspec colwidth="8*" align="left"/>
39328 <colspec colwidth="6*" align="center"/>
39329 <colspec colwidth="6*" align="center"/>
39330 <colspec colwidth="6*" align="right"/>
39331 <tbody>
39332 <row>
39333 <entry><option>shadow_transport</option></entry>
39334 <entry>Use: <emphasis>transports</emphasis></entry>
39335 <entry>Type: <emphasis>string</emphasis></entry>
39336 <entry>Default: <emphasis>unset</emphasis></entry>
39337 </row>
39338 </tbody>
39339 </tgroup>
39340 </informaltable>
39341 <para>
39342 <indexterm role="concept">
39343 <primary>shadow transport</primary>
39344 </indexterm>
39345 <indexterm role="concept">
39346 <primary>transport</primary>
39347 <secondary>shadow</secondary>
39348 </indexterm>
39349 A local transport may set the <option>shadow_transport</option> option to the name of
39350 another local transport. Shadow remote transports are not supported.
39351 </para>
39352 <para>
39353 Whenever a delivery to the main transport succeeds, and either
39354 <option>shadow_condition</option> is unset, or its expansion does not result in the empty
39355 string or one of the strings <quote>0</quote> or <quote>no</quote> or <quote>false</quote>, the message is also
39356 passed to the shadow transport, with the same delivery address or addresses. If
39357 expansion fails, no action is taken except that non-forced expansion failures
39358 cause a log line to be written.
39359 </para>
39360 <para>
39361 The result of the shadow transport is discarded and does not affect the
39362 subsequent processing of the message. Only a single level of shadowing is
39363 provided; the <option>shadow_transport</option> option is ignored on any transport when it
39364 is running as a shadow. Options concerned with output from pipes are also
39365 ignored. The log line for the successful delivery has an item added on the end,
39366 of the form
39367 </para>
39368 <literallayout class="monospaced">
39369 ST=&lt;shadow transport name&gt;
39370 </literallayout>
39371 <para>
39372 If the shadow transport did not succeed, the error message is put in
39373 parentheses afterwards. Shadow transports can be used for a number of different
39374 purposes, including keeping more detailed log information than Exim normally
39375 provides, and implementing automatic acknowledgment policies based on message
39376 headers that some sites insist on.
39377 </para>
39378 <para>
39379 <indexterm role="option">
39380 <primary><option>transport_filter</option></primary>
39381 </indexterm>
39382 </para>
39383 <informaltable frame="all">
39384 <tgroup cols="4" colsep="0" rowsep="0">
39385 <colspec colwidth="8*" align="left"/>
39386 <colspec colwidth="6*" align="center"/>
39387 <colspec colwidth="6*" align="center"/>
39388 <colspec colwidth="6*" align="right"/>
39389 <tbody>
39390 <row>
39391 <entry><option>transport_filter</option></entry>
39392 <entry>Use: <emphasis>transports</emphasis></entry>
39393 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
39394 <entry>Default: <emphasis>unset</emphasis></entry>
39395 </row>
39396 </tbody>
39397 </tgroup>
39398 </informaltable>
39399 <para>
39400 <indexterm role="concept">
39401 <primary>transport</primary>
39402 <secondary>filter</secondary>
39403 </indexterm>
39404 <indexterm role="concept">
39405 <primary>filter</primary>
39406 <secondary>transport filter</secondary>
39407 </indexterm>
39408 This option sets up a filtering (in the Unix shell sense) process for messages
39409 at transport time. It should not be confused with mail filtering as set up by
39410 individual users or via a system filter.
39411 </para>
39412 <para>
39413 When the message is about to be written out, the command specified by
39414 <option>transport_filter</option> is started up in a separate, parallel process, and
39415 the entire message, including the header lines, is passed to it on its standard
39416 input (this in fact is done from a third process, to avoid deadlock). The
39417 command must be specified as an absolute path.
39418 </para>
39419 <para>
39420 The lines of the message that are written to the transport filter are
39421 terminated by newline (<quote>\n</quote>). The message is passed to the filter before any
39422 SMTP-specific processing, such as turning <quote>\n</quote> into <quote>\r\n</quote> and escaping
39423 lines beginning with a dot, and also before any processing implied by the
39424 settings of <option>check_string</option> and <option>escape_string</option> in the <command>appendfile</command> or
39425 <command>pipe</command> transports.
39426 </para>
39427 <para>
39428 The standard error for the filter process is set to the same destination as its
39429 standard output; this is read and written to the message&#x2019;s ultimate
39430 destination. The process that writes the message to the filter, the
39431 filter itself, and the original process that reads the result and delivers it
39432 are all run in parallel, like a shell pipeline.
39433 </para>
39434 <para>
39435 The filter can perform any transformations it likes, but of course should take
39436 care not to break RFC 2822 syntax. Exim does not check the result, except to
39437 test for a final newline when SMTP is in use. All messages transmitted over
39438 SMTP must end with a newline, so Exim supplies one if it is missing.
39439 </para>
39440 <para>
39441 <indexterm role="concept">
39442 <primary>content scanning</primary>
39443 <secondary>per user</secondary>
39444 </indexterm>
39445 A transport filter can be used to provide content-scanning on a per-user basis
39446 at delivery time if the only required effect of the scan is to modify the
39447 message. For example, a content scan could insert a new header line containing
39448 a spam score. This could be interpreted by a filter in the user&#x2019;s MUA. It is
39449 not possible to discard a message at this stage.
39450 </para>
39451 <para>
39452 <indexterm role="concept">
39453 <primary>SMTP</primary>
39454 <secondary>SIZE</secondary>
39455 </indexterm>
39456 A problem might arise if the filter increases the size of a message that is
39457 being sent down an SMTP connection. If the receiving SMTP server has indicated
39458 support for the SIZE parameter, Exim will have sent the size of the message
39459 at the start of the SMTP session. If what is actually sent is substantially
39460 more, the server might reject the message. This can be worked round by setting
39461 the <option>size_addition</option> option on the <command>smtp</command> transport, either to allow for
39462 additions to the message, or to disable the use of SIZE altogether.
39463 </para>
39464 <para>
39465 <indexterm role="variable">
39466 <primary><varname>$pipe_addresses</varname></primary>
39467 </indexterm>
39468 The value of the <option>transport_filter</option> option is the command string for starting
39469 the filter, which is run directly from Exim, not under a shell. The string is
39470 parsed by Exim in the same way as a command string for the <command>pipe</command> transport:
39471 Exim breaks it up into arguments and then expands each argument separately (see
39472 section <xref linkend="SECThowcommandrun"/>). Any kind of expansion failure causes delivery
39473 to be deferred. The special argument <varname>$pipe_addresses</varname> is replaced by a number
39474 of arguments, one for each address that applies to this delivery. (This isn&#x2019;t
39475 an ideal name for this feature here, but as it was already implemented for the
39476 <command>pipe</command> transport, it seemed sensible not to change it.)
39477 </para>
39478 <para>
39479 <indexterm role="variable">
39480 <primary><varname>$host</varname></primary>
39481 </indexterm>
39482 <indexterm role="variable">
39483 <primary><varname>$host_address</varname></primary>
39484 </indexterm>
39485 The expansion variables <varname>$host</varname> and <varname>$host_address</varname> are available when the
39486 transport is a remote one. They contain the name and IP address of the host to
39487 which the message is being sent. For example:
39488 </para>
39489 <literallayout class="monospaced">
39490 transport_filter = /some/directory/transport-filter.pl \
39491   $host $host_address $sender_address $pipe_addresses
39492 </literallayout>
39493 <para>
39494 Two problems arise if you want to use more complicated expansion items to
39495 generate transport filter commands, both of which due to the fact that the
39496 command is split up <emphasis>before</emphasis> expansion.
39497 </para>
39498 <itemizedlist>
39499 <listitem>
39500 <para>
39501 If an expansion item contains white space, you must quote it, so that it is all
39502 part of the same command item. If the entire option setting is one such
39503 expansion item, you have to take care what kind of quoting you use. For
39504 example:
39505 </para>
39506 <literallayout class="monospaced">
39507 transport_filter = '/bin/cmd${if eq{$host}{a.b.c}{1}{2}}'
39508 </literallayout>
39509 <para>
39510 This runs the command <command>/bin/cmd1</command> if the host name is <emphasis>a.b.c</emphasis>, and
39511 <command>/bin/cmd2</command> otherwise. If double quotes had been used, they would have been
39512 stripped by Exim when it read the option&#x2019;s value. When the value is used, if
39513 the single quotes were missing, the line would be split into two items,
39514 <literal>/bin/cmd${if</literal> and <literal>eq{$host}{a.b.c}{1}{2}</literal>, and an error would occur when
39515 Exim tried to expand the first one.
39516 </para>
39517 </listitem>
39518 <listitem>
39519 <para>
39520 Except for the special case of <varname>$pipe_addresses</varname> that is mentioned above, an
39521 expansion cannot generate multiple arguments, or a command name followed by
39522 arguments. Consider this example:
39523 </para>
39524 <literallayout class="monospaced">
39525 transport_filter = ${lookup{$host}lsearch{/a/file}\
39526                     {$value}{/bin/cat}}
39527 </literallayout>
39528 <para>
39529 The result of the lookup is interpreted as the name of the command, even
39530 if it contains white space. The simplest way round this is to use a shell:
39531 </para>
39532 <literallayout class="monospaced">
39533 transport_filter = /bin/sh -c ${lookup{$host}lsearch{/a/file}\
39534                                {$value}{/bin/cat}}
39535 </literallayout>
39536 </listitem>
39537 </itemizedlist>
39538 <para>
39539 The filter process is run under the same uid and gid as the normal delivery.
39540 For remote deliveries this is the Exim uid/gid by default. The command should
39541 normally yield a zero return code. Transport filters are not supposed to fail.
39542 A non-zero code is taken to mean that the transport filter encountered some
39543 serious problem. Delivery of the message is deferred; the message remains on
39544 the queue and is tried again later. It is not possible to cause a message to be
39545 bounced from a transport filter.
39546 </para>
39547 <para>
39548 If a transport filter is set on an autoreply transport, the original message is
39549 passed through the filter as it is being copied into the newly generated
39550 message, which happens if the <option>return_message</option> option is set.
39551 </para>
39552 <para>
39553 <indexterm role="option">
39554 <primary><option>transport_filter_timeout</option></primary>
39555 </indexterm>
39556 </para>
39557 <informaltable frame="all">
39558 <tgroup cols="4" colsep="0" rowsep="0">
39559 <colspec colwidth="8*" align="left"/>
39560 <colspec colwidth="6*" align="center"/>
39561 <colspec colwidth="6*" align="center"/>
39562 <colspec colwidth="6*" align="right"/>
39563 <tbody>
39564 <row>
39565 <entry><option>transport_filter_timeout</option></entry>
39566 <entry>Use: <emphasis>transports</emphasis></entry>
39567 <entry>Type: <emphasis>time</emphasis></entry>
39568 <entry>Default: <emphasis>5m</emphasis></entry>
39569 </row>
39570 </tbody>
39571 </tgroup>
39572 </informaltable>
39573 <para>
39574 <indexterm role="concept">
39575 <primary>transport</primary>
39576 <secondary>filter, timeout</secondary>
39577 </indexterm>
39578 When Exim is reading the output of a transport filter, it applies a timeout
39579 that can be set by this option. Exceeding the timeout is normally treated as a
39580 temporary delivery failure. However, if a transport filter is used with a
39581 <command>pipe</command> transport, a timeout in the transport filter is treated in the same
39582 way as a timeout in the pipe command itself. By default, a timeout is a hard
39583 error, but if the <command>pipe</command> transport&#x2019;s <option>timeout_defer</option> option is set true, it
39584 becomes a temporary error.
39585 </para>
39586 <para>
39587 <indexterm role="option">
39588 <primary><option>user</option></primary>
39589 </indexterm>
39590 </para>
39591 <informaltable frame="all">
39592 <tgroup cols="4" colsep="0" rowsep="0">
39593 <colspec colwidth="8*" align="left"/>
39594 <colspec colwidth="6*" align="center"/>
39595 <colspec colwidth="6*" align="center"/>
39596 <colspec colwidth="6*" align="right"/>
39597 <tbody>
39598 <row>
39599 <entry><option>user</option></entry>
39600 <entry>Use: <emphasis>transports</emphasis></entry>
39601 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
39602 <entry>Default: <emphasis>Exim user</emphasis></entry>
39603 </row>
39604 </tbody>
39605 </tgroup>
39606 </informaltable>
39607 <para>
39608 <indexterm role="concept">
39609 <primary>uid (user id)</primary>
39610 <secondary>local delivery</secondary>
39611 </indexterm>
39612 <indexterm role="concept">
39613 <primary>transport</primary>
39614 <secondary>user, specifying</secondary>
39615 </indexterm>
39616 This option specifies the user under whose uid the delivery process is to be
39617 run, overriding any uid that may have been set by the router. If the user is
39618 given as a name, the uid is looked up from the password data, and the
39619 associated group is taken as the value of the gid to be used if the <option>group</option>
39620 option is not set.
39621 </para>
39622 <para>
39623 For deliveries that use local transports, a user and group are normally
39624 specified explicitly or implicitly (for example, as a result of
39625 <option>check_local_user</option>) by the router or transport.
39626 </para>
39627 <para>
39628 <indexterm role="concept">
39629 <primary>hints database</primary>
39630 <secondary>access by remote transport</secondary>
39631 </indexterm>
39632 For remote transports, you should leave this option unset unless you really are
39633 sure you know what you are doing. When a remote transport is running, it needs
39634 to be able to access Exim&#x2019;s hints databases, because each host may have its own
39635 retry data.
39636 <indexterm role="concept" startref="IIDgenoptra1" class="endofrange"/>
39637 <indexterm role="concept" startref="IIDgenoptra2" class="endofrange"/>
39638 <indexterm role="concept" startref="IIDgenoptra3" class="endofrange"/>
39639 </para>
39640 </chapter>
39641
39642 <chapter id="CHAPbatching">
39643 <title>Address batching in local transports</title>
39644 <titleabbrev>Address batching</titleabbrev>
39645 <para>
39646 <indexterm role="concept">
39647 <primary>transport</primary>
39648 <secondary>local; address batching in</secondary>
39649 </indexterm>
39650 The only remote transport (<command>smtp</command>) is normally configured to handle more than
39651 one address at a time, so that when several addresses are routed to the same
39652 remote host, just one copy of the message is sent. Local transports, however,
39653 normally handle one address at a time. That is, a separate instance of the
39654 transport is run for each address that is routed to the transport. A separate
39655 copy of the message is delivered each time.
39656 </para>
39657 <para>
39658 <indexterm role="concept">
39659 <primary>batched local delivery</primary>
39660 </indexterm>
39661 <indexterm role="option">
39662 <primary><option>batch_max</option></primary>
39663 </indexterm>
39664 <indexterm role="option">
39665 <primary><option>batch_id</option></primary>
39666 </indexterm>
39667 In special cases, it may be desirable to handle several addresses at once in a
39668 local transport, for example:
39669 </para>
39670 <itemizedlist>
39671 <listitem>
39672 <para>
39673 In an <command>appendfile</command> transport, when storing messages in files for later
39674 delivery by some other means, a single copy of the message with multiple
39675 recipients saves space.
39676 </para>
39677 </listitem>
39678 <listitem>
39679 <para>
39680 In an <command>lmtp</command> transport, when delivering over <quote>local SMTP</quote> to some process,
39681 a single copy saves time, and is the normal way LMTP is expected to work.
39682 </para>
39683 </listitem>
39684 <listitem>
39685 <para>
39686 In a <command>pipe</command> transport, when passing the message
39687 to a scanner program or
39688 to some other delivery mechanism such as UUCP, multiple recipients may be
39689 acceptable.
39690 </para>
39691 </listitem>
39692 </itemizedlist>
39693 <para>
39694 These three local transports all have the same options for controlling multiple
39695 (<quote>batched</quote>) deliveries, namely <option>batch_max</option> and <option>batch_id</option>. To save
39696 repeating the information for each transport, these options are described here.
39697 </para>
39698 <para>
39699 The <option>batch_max</option> option specifies the maximum number of addresses that can be
39700 delivered together in a single run of the transport. Its default value is one
39701 (no batching). When more than one address is routed to a transport that has a
39702 <option>batch_max</option> value greater than one, the addresses are delivered in a batch
39703 (that is, in a single run of the transport with multiple recipients), subject
39704 to certain conditions:
39705 </para>
39706 <itemizedlist>
39707 <listitem>
39708 <para>
39709 <indexterm role="variable">
39710 <primary><varname>$local_part</varname></primary>
39711 </indexterm>
39712 If any of the transport&#x2019;s options contain a reference to <varname>$local_part</varname>, no
39713 batching is possible.
39714 </para>
39715 </listitem>
39716 <listitem>
39717 <para>
39718 <indexterm role="variable">
39719 <primary><varname>$domain</varname></primary>
39720 </indexterm>
39721 If any of the transport&#x2019;s options contain a reference to <varname>$domain</varname>, only
39722 addresses with the same domain are batched.
39723 </para>
39724 </listitem>
39725 <listitem>
39726 <para>
39727 <indexterm role="concept">
39728 <primary>customizing</primary>
39729 <secondary>batching condition</secondary>
39730 </indexterm>
39731 If <option>batch_id</option> is set, it is expanded for each address, and only those
39732 addresses with the same expanded value are batched. This allows you to specify
39733 customized batching conditions. Failure of the expansion for any reason,
39734 including forced failure, disables batching, but it does not stop the delivery
39735 from taking place.
39736 </para>
39737 </listitem>
39738 <listitem>
39739 <para>
39740 Batched addresses must also have the same errors address (where to send
39741 delivery errors), the same header additions and removals, the same user and
39742 group for the transport, and if a host list is present, the first host must
39743 be the same.
39744 </para>
39745 </listitem>
39746 </itemizedlist>
39747 <para>
39748 In the case of the <command>appendfile</command> and <command>pipe</command> transports, batching applies
39749 both when the file or pipe command is specified in the transport, and when it
39750 is specified by a <command>redirect</command> router, but all the batched addresses must of
39751 course be routed to the same file or pipe command. These two transports have an
39752 option called <option>use_bsmtp</option>, which causes them to deliver the message in
39753 <quote>batched SMTP</quote> format, with the envelope represented as SMTP commands. The
39754 <option>check_string</option> and <option>escape_string</option> options are forced to the values
39755 </para>
39756 <literallayout class="monospaced">
39757 check_string = "."
39758 escape_string = ".."
39759 </literallayout>
39760 <para>
39761 when batched SMTP is in use. A full description of the batch SMTP mechanism is
39762 given in section <xref linkend="SECTbatchSMTP"/>. The <command>lmtp</command> transport does not have a
39763 <option>use_bsmtp</option> option, because it always delivers using the SMTP protocol.
39764 </para>
39765 <para>
39766 <indexterm role="concept">
39767 <primary><emphasis>Envelope-to:</emphasis> header line</primary>
39768 </indexterm>
39769 If the generic <option>envelope_to_add</option> option is set for a batching transport, the
39770 <emphasis>Envelope-to:</emphasis> header that is added to the message contains all the addresses
39771 that are being processed together. If you are using a batching <command>appendfile</command>
39772 transport without <option>use_bsmtp</option>, the only way to preserve the recipient
39773 addresses is to set the <option>envelope_to_add</option> option.
39774 </para>
39775 <para>
39776 <indexterm role="concept">
39777 <primary><command>pipe</command> transport</primary>
39778 <secondary>with multiple addresses</secondary>
39779 </indexterm>
39780 <indexterm role="variable">
39781 <primary><varname>$pipe_addresses</varname></primary>
39782 </indexterm>
39783 If you are using a <command>pipe</command> transport without BSMTP, and setting the
39784 transport&#x2019;s <option>command</option> option, you can include <varname>$pipe_addresses</varname> as part of
39785 the command. This is not a true variable; it is a bit of magic that causes each
39786 of the recipient addresses to be inserted into the command as a separate
39787 argument. This provides a way of accessing all the addresses that are being
39788 delivered in the batch. <emphasis role="bold">Note:</emphasis> This is not possible for pipe commands that
39789 are specified by a <command>redirect</command> router.
39790 </para>
39791 </chapter>
39792
39793 <chapter id="CHAPappendfile">
39794 <title>The appendfile transport</title>
39795 <para>
39796 <indexterm role="concept" id="IIDapptra1" class="startofrange">
39797 <primary><command>appendfile</command> transport</primary>
39798 </indexterm>
39799 <indexterm role="concept" id="IIDapptra2" class="startofrange">
39800 <primary>transports</primary>
39801 <secondary><command>appendfile</command></secondary>
39802 </indexterm>
39803 <indexterm role="concept">
39804 <primary>directory creation</primary>
39805 </indexterm>
39806 <indexterm role="concept">
39807 <primary>creating directories</primary>
39808 </indexterm>
39809 The <command>appendfile</command> transport delivers a message by appending it to an existing
39810 file, or by creating an entirely new file in a specified directory. Single
39811 files to which messages are appended can be in the traditional Unix mailbox
39812 format, or optionally in the MBX format supported by the Pine MUA and
39813 University of Washington IMAP daemon, <emphasis>inter alia</emphasis>. When each message is
39814 being delivered as a separate file, <quote>maildir</quote> format can optionally be used
39815 to give added protection against failures that happen part-way through the
39816 delivery. A third form of separate-file delivery known as <quote>mailstore</quote> is also
39817 supported. For all file formats, Exim attempts to create as many levels of
39818 directory as necessary, provided that <option>create_directory</option> is set.
39819 </para>
39820 <para>
39821 The code for the optional formats is not included in the Exim binary by
39822 default. It is necessary to set SUPPORT_MBX, SUPPORT_MAILDIR and/or
39823 SUPPORT_MAILSTORE in <filename>Local/Makefile</filename> to have the appropriate code
39824 included.
39825 </para>
39826 <para>
39827 <indexterm role="concept">
39828 <primary>quota</primary>
39829 <secondary>system</secondary>
39830 </indexterm>
39831 Exim recognizes system quota errors, and generates an appropriate message. Exim
39832 also supports its own quota control within the transport, for use when the
39833 system facility is unavailable or cannot be used for some reason.
39834 </para>
39835 <para>
39836 If there is an error while appending to a file (for example, quota exceeded or
39837 partition filled), Exim attempts to reset the file&#x2019;s length and last
39838 modification time back to what they were before. If there is an error while
39839 creating an entirely new file, the new file is removed.
39840 </para>
39841 <para>
39842 Before appending to a file, a number of security checks are made, and the
39843 file is locked. A detailed description is given below, after the list of
39844 private options.
39845 </para>
39846 <para>
39847 The <command>appendfile</command> transport is most commonly used for local deliveries to
39848 users&#x2019; mailboxes. However, it can also be used as a pseudo-remote transport for
39849 putting messages into files for remote delivery by some means other than Exim.
39850 <quote>Batch SMTP</quote> format is often used in this case (see the <option>use_bsmtp</option>
39851 option).
39852 </para>
39853 <section id="SECTfildiropt">
39854 <title>The file and directory options</title>
39855 <para>
39856 The <option>file</option> option specifies a single file, to which the message is appended;
39857 the <option>directory</option> option specifies a directory, in which a new file containing
39858 the message is created. Only one of these two options can be set, and for
39859 normal deliveries to mailboxes, one of them <emphasis>must</emphasis> be set.
39860 </para>
39861 <para>
39862 <indexterm role="variable">
39863 <primary><varname>$address_file</varname></primary>
39864 </indexterm>
39865 <indexterm role="variable">
39866 <primary><varname>$local_part</varname></primary>
39867 </indexterm>
39868 However, <command>appendfile</command> is also used for delivering messages to files or
39869 directories whose names (or parts of names) are obtained from alias,
39870 forwarding, or filtering operations (for example, a <option>save</option> command in a
39871 user&#x2019;s Exim filter). When such a transport is running, <varname>$local_part</varname> contains
39872 the local part that was aliased or forwarded, and <varname>$address_file</varname> contains the
39873 name (or partial name) of the file or directory generated by the redirection
39874 operation. There are two cases:
39875 </para>
39876 <itemizedlist>
39877 <listitem>
39878 <para>
39879 If neither <option>file</option> nor <option>directory</option> is set, the redirection operation
39880 must specify an absolute path (one that begins with <literal>/</literal>). This is the most
39881 common case when users with local accounts use filtering to sort mail into
39882 different folders. See for example, the <command>address_file</command> transport in the
39883 default configuration. If the path ends with a slash, it is assumed to be the
39884 name of a directory. A delivery to a directory can also be forced by setting
39885 <option>maildir_format</option> or <option>mailstore_format</option>.
39886 </para>
39887 </listitem>
39888 <listitem>
39889 <para>
39890 If <option>file</option> or <option>directory</option> is set for a delivery from a redirection, it is
39891 used to determine the file or directory name for the delivery. Normally, the
39892 contents of <varname>$address_file</varname> are used in some way in the string expansion.
39893 </para>
39894 </listitem>
39895 </itemizedlist>
39896 <para>
39897 <indexterm role="concept">
39898 <primary>Sieve filter</primary>
39899 <secondary>configuring <command>appendfile</command></secondary>
39900 </indexterm>
39901 <indexterm role="concept">
39902 <primary>Sieve filter</primary>
39903 <secondary>relative mailbox path handling</secondary>
39904 </indexterm>
39905 As an example of the second case, consider an environment where users do not
39906 have home directories. They may be permitted to use Exim filter commands of the
39907 form:
39908 </para>
39909 <literallayout class="monospaced">
39910 save folder23
39911 </literallayout>
39912 <para>
39913 or Sieve filter commands of the form:
39914 </para>
39915 <literallayout class="monospaced">
39916 require "fileinto";
39917 fileinto "folder23";
39918 </literallayout>
39919 <para>
39920 In this situation, the expansion of <option>file</option> or <option>directory</option> in the transport
39921 must transform the relative path into an appropriate absolute file name. In the
39922 case of Sieve filters, the name <emphasis>inbox</emphasis> must be handled. It is the name that
39923 is used as a result of a <quote>keep</quote> action in the filter. This example shows one
39924 way of handling this requirement:
39925 </para>
39926 <literallayout class="monospaced">
39927 file = ${if eq{$address_file}{inbox} \
39928             {/var/mail/$local_part} \
39929             {${if eq{${substr_0_1:$address_file}}{/} \
39930                   {$address_file} \
39931                   {$home/mail/$address_file} \
39932             }} \
39933        }
39934 </literallayout>
39935 <para>
39936 With this setting of <option>file</option>, <emphasis>inbox</emphasis> refers to the standard mailbox
39937 location, absolute paths are used without change, and other folders are in the
39938 <filename>mail</filename> directory within the home directory.
39939 </para>
39940 <para>
39941 <emphasis role="bold">Note 1</emphasis>: While processing an Exim filter, a relative path such as
39942 <filename>folder23</filename> is turned into an absolute path if a home directory is known to
39943 the router. In particular, this is the case if <option>check_local_user</option> is set. If
39944 you want to prevent this happening at routing time, you can set
39945 <option>router_home_directory</option> empty. This forces the router to pass the relative
39946 path to the transport.
39947 </para>
39948 <para>
39949 <emphasis role="bold">Note 2</emphasis>: An absolute path in <varname>$address_file</varname> is not treated specially;
39950 the <option>file</option> or <option>directory</option> option is still used if it is set.
39951 </para>
39952 </section>
39953 <section id="SECID134">
39954 <title>Private options for appendfile</title>
39955 <para>
39956 <indexterm role="concept">
39957 <primary>options</primary>
39958 <secondary><command>appendfile</command> transport</secondary>
39959 </indexterm>
39960 </para>
39961 <para>
39962 <indexterm role="option">
39963 <primary><option>allow_fifo</option></primary>
39964 </indexterm>
39965 </para>
39966 <informaltable frame="all">
39967 <tgroup cols="4" colsep="0" rowsep="0">
39968 <colspec colwidth="8*" align="left"/>
39969 <colspec colwidth="6*" align="center"/>
39970 <colspec colwidth="6*" align="center"/>
39971 <colspec colwidth="6*" align="right"/>
39972 <tbody>
39973 <row>
39974 <entry><option>allow_fifo</option></entry>
39975 <entry>Use: <emphasis>appendfile</emphasis></entry>
39976 <entry>Type: <emphasis>boolean</emphasis></entry>
39977 <entry>Default: <emphasis>false</emphasis></entry>
39978 </row>
39979 </tbody>
39980 </tgroup>
39981 </informaltable>
39982 <para>
39983 <indexterm role="concept">
39984 <primary>fifo (named pipe)</primary>
39985 </indexterm>
39986 <indexterm role="concept">
39987 <primary>named pipe (fifo)</primary>
39988 </indexterm>
39989 <indexterm role="concept">
39990 <primary>pipe</primary>
39991 <secondary>named (fifo)</secondary>
39992 </indexterm>
39993 Setting this option permits delivery to named pipes (FIFOs) as well as to
39994 regular files. If no process is reading the named pipe at delivery time, the
39995 delivery is deferred.
39996 </para>
39997 <para>
39998 <indexterm role="option">
39999 <primary><option>allow_symlink</option></primary>
40000 </indexterm>
40001 </para>
40002 <informaltable frame="all">
40003 <tgroup cols="4" colsep="0" rowsep="0">
40004 <colspec colwidth="8*" align="left"/>
40005 <colspec colwidth="6*" align="center"/>
40006 <colspec colwidth="6*" align="center"/>
40007 <colspec colwidth="6*" align="right"/>
40008 <tbody>
40009 <row>
40010 <entry><option>allow_symlink</option></entry>
40011 <entry>Use: <emphasis>appendfile</emphasis></entry>
40012 <entry>Type: <emphasis>boolean</emphasis></entry>
40013 <entry>Default: <emphasis>false</emphasis></entry>
40014 </row>
40015 </tbody>
40016 </tgroup>
40017 </informaltable>
40018 <para>
40019 <indexterm role="concept">
40020 <primary>symbolic link</primary>
40021 <secondary>to mailbox</secondary>
40022 </indexterm>
40023 <indexterm role="concept">
40024 <primary>mailbox</primary>
40025 <secondary>symbolic link</secondary>
40026 </indexterm>
40027 By default, <command>appendfile</command> will not deliver if the path name for the file is
40028 that of a symbolic link. Setting this option relaxes that constraint, but there
40029 are security issues involved in the use of symbolic links. Be sure you know
40030 what you are doing if you set this. Details of exactly what this option affects
40031 are included in the discussion which follows this list of options.
40032 </para>
40033 <para>
40034 <indexterm role="option">
40035 <primary><option>batch_id</option></primary>
40036 </indexterm>
40037 </para>
40038 <informaltable frame="all">
40039 <tgroup cols="4" colsep="0" rowsep="0">
40040 <colspec colwidth="8*" align="left"/>
40041 <colspec colwidth="6*" align="center"/>
40042 <colspec colwidth="6*" align="center"/>
40043 <colspec colwidth="6*" align="right"/>
40044 <tbody>
40045 <row>
40046 <entry><option>batch_id</option></entry>
40047 <entry>Use: <emphasis>appendfile</emphasis></entry>
40048 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
40049 <entry>Default: <emphasis>unset</emphasis></entry>
40050 </row>
40051 </tbody>
40052 </tgroup>
40053 </informaltable>
40054 <para>
40055 See the description of local delivery batching in chapter <xref linkend="CHAPbatching"/>.
40056 However, batching is automatically disabled for <command>appendfile</command> deliveries that
40057 happen as a result of forwarding or aliasing or other redirection directly to a
40058 file.
40059 </para>
40060 <para>
40061 <indexterm role="option">
40062 <primary><option>batch_max</option></primary>
40063 </indexterm>
40064 </para>
40065 <informaltable frame="all">
40066 <tgroup cols="4" colsep="0" rowsep="0">
40067 <colspec colwidth="8*" align="left"/>
40068 <colspec colwidth="6*" align="center"/>
40069 <colspec colwidth="6*" align="center"/>
40070 <colspec colwidth="6*" align="right"/>
40071 <tbody>
40072 <row>
40073 <entry><option>batch_max</option></entry>
40074 <entry>Use: <emphasis>appendfile</emphasis></entry>
40075 <entry>Type: <emphasis>integer</emphasis></entry>
40076 <entry>Default: <emphasis>1</emphasis></entry>
40077 </row>
40078 </tbody>
40079 </tgroup>
40080 </informaltable>
40081 <para>
40082 See the description of local delivery batching in chapter <xref linkend="CHAPbatching"/>.
40083 </para>
40084 <para>
40085 <indexterm role="option">
40086 <primary><option>check_group</option></primary>
40087 </indexterm>
40088 </para>
40089 <informaltable frame="all">
40090 <tgroup cols="4" colsep="0" rowsep="0">
40091 <colspec colwidth="8*" align="left"/>
40092 <colspec colwidth="6*" align="center"/>
40093 <colspec colwidth="6*" align="center"/>
40094 <colspec colwidth="6*" align="right"/>
40095 <tbody>
40096 <row>
40097 <entry><option>check_group</option></entry>
40098 <entry>Use: <emphasis>appendfile</emphasis></entry>
40099 <entry>Type: <emphasis>boolean</emphasis></entry>
40100 <entry>Default: <emphasis>false</emphasis></entry>
40101 </row>
40102 </tbody>
40103 </tgroup>
40104 </informaltable>
40105 <para>
40106 When this option is set, the group owner of the file defined by the <option>file</option>
40107 option is checked to see that it is the same as the group under which the
40108 delivery process is running. The default setting is false because the default
40109 file mode is 0600, which means that the group is irrelevant.
40110 </para>
40111 <para>
40112 <indexterm role="option">
40113 <primary><option>check_owner</option></primary>
40114 </indexterm>
40115 </para>
40116 <informaltable frame="all">
40117 <tgroup cols="4" colsep="0" rowsep="0">
40118 <colspec colwidth="8*" align="left"/>
40119 <colspec colwidth="6*" align="center"/>
40120 <colspec colwidth="6*" align="center"/>
40121 <colspec colwidth="6*" align="right"/>
40122 <tbody>
40123 <row>
40124 <entry><option>check_owner</option></entry>
40125 <entry>Use: <emphasis>appendfile</emphasis></entry>
40126 <entry>Type: <emphasis>boolean</emphasis></entry>
40127 <entry>Default: <emphasis>true</emphasis></entry>
40128 </row>
40129 </tbody>
40130 </tgroup>
40131 </informaltable>
40132 <para>
40133 When this option is set, the owner of the file defined by the <option>file</option> option
40134 is checked to ensure that it is the same as the user under which the delivery
40135 process is running.
40136 </para>
40137 <para>
40138 <indexterm role="option">
40139 <primary><option>check_string</option></primary>
40140 </indexterm>
40141 </para>
40142 <informaltable frame="all">
40143 <tgroup cols="4" colsep="0" rowsep="0">
40144 <colspec colwidth="8*" align="left"/>
40145 <colspec colwidth="6*" align="center"/>
40146 <colspec colwidth="6*" align="center"/>
40147 <colspec colwidth="6*" align="right"/>
40148 <tbody>
40149 <row>
40150 <entry><option>check_string</option></entry>
40151 <entry>Use: <emphasis>appendfile</emphasis></entry>
40152 <entry>Type: <emphasis>string</emphasis></entry>
40153 <entry>Default: <emphasis>see below</emphasis></entry>
40154 </row>
40155 </tbody>
40156 </tgroup>
40157 </informaltable>
40158 <para>
40159 <indexterm role="concept">
40160 <primary><quote>From</quote> line</primary>
40161 </indexterm>
40162 As <command>appendfile</command> writes the message, the start of each line is tested for
40163 matching <option>check_string</option>, and if it does, the initial matching characters are
40164 replaced by the contents of <option>escape_string</option>. The value of <option>check_string</option> is
40165 a literal string, not a regular expression, and the case of any letters it
40166 contains is significant.
40167 </para>
40168 <para>
40169 If <option>use_bsmtp</option> is set the values of <option>check_string</option> and <option>escape_string</option>
40170 are forced to <quote>.</quote> and <quote>..</quote> respectively, and any settings in the
40171 configuration are ignored. Otherwise, they default to <quote>From&nbsp;</quote> and
40172 <quote>&gt;From&nbsp;</quote> when the <option>file</option> option is set, and unset when any of the
40173 <option>directory</option>, <option>maildir</option>, or <option>mailstore</option> options are set.
40174 </para>
40175 <para>
40176 The default settings, along with <option>message_prefix</option> and <option>message_suffix</option>, are
40177 suitable for traditional <quote>BSD</quote> mailboxes, where a line beginning with
40178 <quote>From&nbsp;</quote> indicates the start of a new message. All four options need changing
40179 if another format is used. For example, to deliver to mailboxes in MMDF format:
40180 <indexterm role="concept">
40181 <primary>MMDF format mailbox</primary>
40182 </indexterm>
40183 <indexterm role="concept">
40184 <primary>mailbox</primary>
40185 <secondary>MMDF format</secondary>
40186 </indexterm>
40187 </para>
40188 <literallayout class="monospaced">
40189 check_string = "\1\1\1\1\n"
40190 escape_string = "\1\1\1\1 \n"
40191 message_prefix = "\1\1\1\1\n"
40192 message_suffix = "\1\1\1\1\n"
40193 </literallayout>
40194 <para>
40195 <indexterm role="option">
40196 <primary><option>create_directory</option></primary>
40197 </indexterm>
40198 </para>
40199 <informaltable frame="all">
40200 <tgroup cols="4" colsep="0" rowsep="0">
40201 <colspec colwidth="8*" align="left"/>
40202 <colspec colwidth="6*" align="center"/>
40203 <colspec colwidth="6*" align="center"/>
40204 <colspec colwidth="6*" align="right"/>
40205 <tbody>
40206 <row>
40207 <entry><option>create_directory</option></entry>
40208 <entry>Use: <emphasis>appendfile</emphasis></entry>
40209 <entry>Type: <emphasis>boolean</emphasis></entry>
40210 <entry>Default: <emphasis>true</emphasis></entry>
40211 </row>
40212 </tbody>
40213 </tgroup>
40214 </informaltable>
40215 <para>
40216 <indexterm role="concept">
40217 <primary>directory creation</primary>
40218 </indexterm>
40219 When this option is true, Exim attempts to create any missing superior
40220 directories for the file that it is about to write. A created directory&#x2019;s mode
40221 is given by the <option>directory_mode</option> option.
40222 </para>
40223 <para>
40224 The group ownership of a newly created directory is highly dependent on the
40225 operating system (and possibly the file system) that is being used. For
40226 example, in Solaris, if the parent directory has the setgid bit set, its group
40227 is propagated to the child; if not, the currently set group is used. However,
40228 in FreeBSD, the parent&#x2019;s group is always used.
40229 </para>
40230 <para>
40231 <indexterm role="option">
40232 <primary><option>create_file</option></primary>
40233 </indexterm>
40234 </para>
40235 <informaltable frame="all">
40236 <tgroup cols="4" colsep="0" rowsep="0">
40237 <colspec colwidth="8*" align="left"/>
40238 <colspec colwidth="6*" align="center"/>
40239 <colspec colwidth="6*" align="center"/>
40240 <colspec colwidth="6*" align="right"/>
40241 <tbody>
40242 <row>
40243 <entry><option>create_file</option></entry>
40244 <entry>Use: <emphasis>appendfile</emphasis></entry>
40245 <entry>Type: <emphasis>string</emphasis></entry>
40246 <entry>Default: <emphasis>anywhere</emphasis></entry>
40247 </row>
40248 </tbody>
40249 </tgroup>
40250 </informaltable>
40251 <para>
40252 This option constrains the location of files and directories that are created
40253 by this transport. It applies to files defined by the <option>file</option> option and
40254 directories defined by the <option>directory</option> option. In the case of maildir
40255 delivery, it applies to the top level directory, not the maildir directories
40256 beneath.
40257 </para>
40258 <para>
40259 The option must be set to one of the words <quote>anywhere</quote>, <quote>inhome</quote>, or
40260 <quote>belowhome</quote>. In the second and third cases, a home directory must have been
40261 set for the transport. This option is not useful when an explicit file name is
40262 given for normal mailbox deliveries. It is intended for the case when file
40263 names are generated from users&#x2019; <filename>.forward</filename> files. These are usually handled
40264 by an <command>appendfile</command> transport called <option>address_file</option>. See also
40265 <option>file_must_exist</option>.
40266 </para>
40267 <para>
40268 <indexterm role="option">
40269 <primary><option>directory</option></primary>
40270 </indexterm>
40271 </para>
40272 <informaltable frame="all">
40273 <tgroup cols="4" colsep="0" rowsep="0">
40274 <colspec colwidth="8*" align="left"/>
40275 <colspec colwidth="6*" align="center"/>
40276 <colspec colwidth="6*" align="center"/>
40277 <colspec colwidth="6*" align="right"/>
40278 <tbody>
40279 <row>
40280 <entry><option>directory</option></entry>
40281 <entry>Use: <emphasis>appendfile</emphasis></entry>
40282 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
40283 <entry>Default: <emphasis>unset</emphasis></entry>
40284 </row>
40285 </tbody>
40286 </tgroup>
40287 </informaltable>
40288 <para>
40289 This option is mutually exclusive with the <option>file</option> option, but one of <option>file</option>
40290 or <option>directory</option> must be set, unless the delivery is the direct result of a
40291 redirection (see section <xref linkend="SECTfildiropt"/>).
40292 </para>
40293 <para>
40294 When <option>directory</option> is set, the string is expanded, and the message is delivered
40295 into a new file or files in or below the given directory, instead of being
40296 appended to a single mailbox file. A number of different formats are provided
40297 (see <option>maildir_format</option> and <option>mailstore_format</option>), and see section
40298 <xref linkend="SECTopdir"/> for further details of this form of delivery.
40299 </para>
40300 <para>
40301 <indexterm role="option">
40302 <primary><option>directory_file</option></primary>
40303 </indexterm>
40304 </para>
40305 <informaltable frame="all">
40306 <tgroup cols="4" colsep="0" rowsep="0">
40307 <colspec colwidth="8*" align="left"/>
40308 <colspec colwidth="6*" align="center"/>
40309 <colspec colwidth="6*" align="center"/>
40310 <colspec colwidth="6*" align="right"/>
40311 <tbody>
40312 <row>
40313 <entry><option>directory_file</option></entry>
40314 <entry>Use: <emphasis>appendfile</emphasis></entry>
40315 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
40316 <entry>Default: <emphasis>see below</emphasis></entry>
40317 </row>
40318 </tbody>
40319 </tgroup>
40320 </informaltable>
40321 <para>
40322 <indexterm role="concept">
40323 <primary>base62</primary>
40324 </indexterm>
40325 <indexterm role="variable">
40326 <primary><varname>$inode</varname></primary>
40327 </indexterm>
40328 When <option>directory</option> is set, but neither <option>maildir_format</option> nor
40329 <option>mailstore_format</option> is set, <command>appendfile</command> delivers each message into a file
40330 whose name is obtained by expanding this string. The default value is:
40331 </para>
40332 <literallayout class="monospaced">
40333 q${base62:$tod_epoch}-$inode
40334 </literallayout>
40335 <para>
40336 This generates a unique name from the current time, in base 62 form, and the
40337 inode of the file. The variable <varname>$inode</varname> is available only when expanding this
40338 option.
40339 </para>
40340 <para>
40341 <indexterm role="option">
40342 <primary><option>directory_mode</option></primary>
40343 </indexterm>
40344 </para>
40345 <informaltable frame="all">
40346 <tgroup cols="4" colsep="0" rowsep="0">
40347 <colspec colwidth="8*" align="left"/>
40348 <colspec colwidth="6*" align="center"/>
40349 <colspec colwidth="6*" align="center"/>
40350 <colspec colwidth="6*" align="right"/>
40351 <tbody>
40352 <row>
40353 <entry><option>directory_mode</option></entry>
40354 <entry>Use: <emphasis>appendfile</emphasis></entry>
40355 <entry>Type: <emphasis>octal integer</emphasis></entry>
40356 <entry>Default: <emphasis>0700</emphasis></entry>
40357 </row>
40358 </tbody>
40359 </tgroup>
40360 </informaltable>
40361 <para>
40362 If <command>appendfile</command> creates any directories as a result of the
40363 <option>create_directory</option> option, their mode is specified by this option.
40364 </para>
40365 <para>
40366 <indexterm role="option">
40367 <primary><option>escape_string</option></primary>
40368 </indexterm>
40369 </para>
40370 <informaltable frame="all">
40371 <tgroup cols="4" colsep="0" rowsep="0">
40372 <colspec colwidth="8*" align="left"/>
40373 <colspec colwidth="6*" align="center"/>
40374 <colspec colwidth="6*" align="center"/>
40375 <colspec colwidth="6*" align="right"/>
40376 <tbody>
40377 <row>
40378 <entry><option>escape_string</option></entry>
40379 <entry>Use: <emphasis>appendfile</emphasis></entry>
40380 <entry>Type: <emphasis>string</emphasis></entry>
40381 <entry>Default: <emphasis>see description</emphasis></entry>
40382 </row>
40383 </tbody>
40384 </tgroup>
40385 </informaltable>
40386 <para>
40387 See <option>check_string</option> above.
40388 </para>
40389 <para>
40390 <indexterm role="option">
40391 <primary><option>file</option></primary>
40392 </indexterm>
40393 </para>
40394 <informaltable frame="all">
40395 <tgroup cols="4" colsep="0" rowsep="0">
40396 <colspec colwidth="8*" align="left"/>
40397 <colspec colwidth="6*" align="center"/>
40398 <colspec colwidth="6*" align="center"/>
40399 <colspec colwidth="6*" align="right"/>
40400 <tbody>
40401 <row>
40402 <entry><option>file</option></entry>
40403 <entry>Use: <emphasis>appendfile</emphasis></entry>
40404 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
40405 <entry>Default: <emphasis>unset</emphasis></entry>
40406 </row>
40407 </tbody>
40408 </tgroup>
40409 </informaltable>
40410 <para>
40411 This option is mutually exclusive with the <option>directory</option> option, but one of
40412 <option>file</option> or <option>directory</option> must be set, unless the delivery is the direct result
40413 of a redirection (see section <xref linkend="SECTfildiropt"/>). The <option>file</option> option
40414 specifies a single file, to which the message is appended. One or more of
40415 <option>use_fcntl_lock</option>, <option>use_flock_lock</option>, or <option>use_lockfile</option> must be set with
40416 <option>file</option>.
40417 </para>
40418 <para>
40419 <indexterm role="concept">
40420 <primary>NFS</primary>
40421 <secondary>lock file</secondary>
40422 </indexterm>
40423 <indexterm role="concept">
40424 <primary>locking files</primary>
40425 </indexterm>
40426 <indexterm role="concept">
40427 <primary>lock files</primary>
40428 </indexterm>
40429 If you are using more than one host to deliver over NFS into the same
40430 mailboxes, you should always use lock files.
40431 </para>
40432 <para>
40433 The string value is expanded for each delivery, and must yield an absolute
40434 path. The most common settings of this option are variations on one of these
40435 examples:
40436 </para>
40437 <literallayout class="monospaced">
40438 file = /var/spool/mail/$local_part
40439 file = /home/$local_part/inbox
40440 file = $home/inbox
40441 </literallayout>
40442 <para>
40443 <indexterm role="concept">
40444 <primary><quote>sticky</quote> bit</primary>
40445 </indexterm>
40446 In the first example, all deliveries are done into the same directory. If Exim
40447 is configured to use lock files (see <option>use_lockfile</option> below) it must be able to
40448 create a file in the directory, so the <quote>sticky</quote> bit must be turned on for
40449 deliveries to be possible, or alternatively the <option>group</option> option can be used to
40450 run the delivery under a group id which has write access to the directory.
40451 </para>
40452 <para>
40453 <indexterm role="option">
40454 <primary><option>file_format</option></primary>
40455 </indexterm>
40456 </para>
40457 <informaltable frame="all">
40458 <tgroup cols="4" colsep="0" rowsep="0">
40459 <colspec colwidth="8*" align="left"/>
40460 <colspec colwidth="6*" align="center"/>
40461 <colspec colwidth="6*" align="center"/>
40462 <colspec colwidth="6*" align="right"/>
40463 <tbody>
40464 <row>
40465 <entry><option>file_format</option></entry>
40466 <entry>Use: <emphasis>appendfile</emphasis></entry>
40467 <entry>Type: <emphasis>string</emphasis></entry>
40468 <entry>Default: <emphasis>unset</emphasis></entry>
40469 </row>
40470 </tbody>
40471 </tgroup>
40472 </informaltable>
40473 <para>
40474 <indexterm role="concept">
40475 <primary>file</primary>
40476 <secondary>mailbox; checking existing format</secondary>
40477 </indexterm>
40478 This option requests the transport to check the format of an existing file
40479 before adding to it. The check consists of matching a specific string at the
40480 start of the file. The value of the option consists of an even number of
40481 colon-separated strings. The first of each pair is the test string, and the
40482 second is the name of a transport. If the transport associated with a matched
40483 string is not the current transport, control is passed over to the other
40484 transport. For example, suppose the standard <command>local_delivery</command> transport has
40485 this added to it:
40486 </para>
40487 <literallayout class="monospaced">
40488 file_format = "From       : local_delivery :\
40489                \1\1\1\1\n : local_mmdf_delivery"
40490 </literallayout>
40491 <para>
40492 Mailboxes that begin with <quote>From</quote> are still handled by this transport, but if
40493 a mailbox begins with four binary ones followed by a newline, control is passed
40494 to a transport called <option>local_mmdf_delivery</option>, which presumably is configured
40495 to do the delivery in MMDF format. If a mailbox does not exist or is empty, it
40496 is assumed to match the current transport. If the start of a mailbox doesn&#x2019;t
40497 match any string, or if the transport named for a given string is not defined,
40498 delivery is deferred.
40499 </para>
40500 <para>
40501 <indexterm role="option">
40502 <primary><option>file_must_exist</option></primary>
40503 </indexterm>
40504 </para>
40505 <informaltable frame="all">
40506 <tgroup cols="4" colsep="0" rowsep="0">
40507 <colspec colwidth="8*" align="left"/>
40508 <colspec colwidth="6*" align="center"/>
40509 <colspec colwidth="6*" align="center"/>
40510 <colspec colwidth="6*" align="right"/>
40511 <tbody>
40512 <row>
40513 <entry><option>file_must_exist</option></entry>
40514 <entry>Use: <emphasis>appendfile</emphasis></entry>
40515 <entry>Type: <emphasis>boolean</emphasis></entry>
40516 <entry>Default: <emphasis>false</emphasis></entry>
40517 </row>
40518 </tbody>
40519 </tgroup>
40520 </informaltable>
40521 <para>
40522 If this option is true, the file specified by the <option>file</option> option must exist.
40523 A temporary error occurs if it does not, causing delivery to be deferred.
40524 If this option is false, the file is created if it does not exist.
40525 </para>
40526 <para>
40527 <indexterm role="option">
40528 <primary><option>lock_fcntl_timeout</option></primary>
40529 </indexterm>
40530 </para>
40531 <informaltable frame="all">
40532 <tgroup cols="4" colsep="0" rowsep="0">
40533 <colspec colwidth="8*" align="left"/>
40534 <colspec colwidth="6*" align="center"/>
40535 <colspec colwidth="6*" align="center"/>
40536 <colspec colwidth="6*" align="right"/>
40537 <tbody>
40538 <row>
40539 <entry><option>lock_fcntl_timeout</option></entry>
40540 <entry>Use: <emphasis>appendfile</emphasis></entry>
40541 <entry>Type: <emphasis>time</emphasis></entry>
40542 <entry>Default: <emphasis>0s</emphasis></entry>
40543 </row>
40544 </tbody>
40545 </tgroup>
40546 </informaltable>
40547 <para>
40548 <indexterm role="concept">
40549 <primary>timeout</primary>
40550 <secondary>mailbox locking</secondary>
40551 </indexterm>
40552 <indexterm role="concept">
40553 <primary>mailbox</primary>
40554 <secondary>locking, blocking and non-blocking</secondary>
40555 </indexterm>
40556 <indexterm role="concept">
40557 <primary>locking files</primary>
40558 </indexterm>
40559 By default, the <command>appendfile</command> transport uses non-blocking calls to <function>fcntl()</function>
40560 when locking an open mailbox file. If the call fails, the delivery process
40561 sleeps for <option>lock_interval</option> and tries again, up to <option>lock_retries</option> times.
40562 Non-blocking calls are used so that the file is not kept open during the wait
40563 for the lock; the reason for this is to make it as safe as possible for
40564 deliveries over NFS in the case when processes might be accessing an NFS
40565 mailbox without using a lock file. This should not be done, but
40566 misunderstandings and hence misconfigurations are not unknown.
40567 </para>
40568 <para>
40569 On a busy system, however, the performance of a non-blocking lock approach is
40570 not as good as using a blocking lock with a timeout. In this case, the waiting
40571 is done inside the system call, and Exim&#x2019;s delivery process acquires the lock
40572 and can proceed as soon as the previous lock holder releases it.
40573 </para>
40574 <para>
40575 If <option>lock_fcntl_timeout</option> is set to a non-zero time, blocking locks, with that
40576 timeout, are used. There may still be some retrying: the maximum number of
40577 retries is
40578 </para>
40579 <literallayout class="monospaced">
40580 (lock_retries * lock_interval) / lock_fcntl_timeout
40581 </literallayout>
40582 <para>
40583 rounded up to the next whole number. In other words, the total time during
40584 which <command>appendfile</command> is trying to get a lock is roughly the same, unless
40585 <option>lock_fcntl_timeout</option> is set very large.
40586 </para>
40587 <para>
40588 You should consider setting this option if you are getting a lot of delayed
40589 local deliveries because of errors of the form
40590 </para>
40591 <literallayout class="monospaced">
40592 failed to lock mailbox /some/file (fcntl)
40593 </literallayout>
40594 <para>
40595 <indexterm role="option">
40596 <primary><option>lock_flock_timeout</option></primary>
40597 </indexterm>
40598 </para>
40599 <informaltable frame="all">
40600 <tgroup cols="4" colsep="0" rowsep="0">
40601 <colspec colwidth="8*" align="left"/>
40602 <colspec colwidth="6*" align="center"/>
40603 <colspec colwidth="6*" align="center"/>
40604 <colspec colwidth="6*" align="right"/>
40605 <tbody>
40606 <row>
40607 <entry><option>lock_flock_timeout</option></entry>
40608 <entry>Use: <emphasis>appendfile</emphasis></entry>
40609 <entry>Type: <emphasis>time</emphasis></entry>
40610 <entry>Default: <emphasis>0s</emphasis></entry>
40611 </row>
40612 </tbody>
40613 </tgroup>
40614 </informaltable>
40615 <para>
40616 This timeout applies to file locking when using <function>flock()</function> (see
40617 <option>use_flock</option>); the timeout operates in a similar manner to
40618 <option>lock_fcntl_timeout</option>.
40619 </para>
40620 <para>
40621 <indexterm role="option">
40622 <primary><option>lock_interval</option></primary>
40623 </indexterm>
40624 </para>
40625 <informaltable frame="all">
40626 <tgroup cols="4" colsep="0" rowsep="0">
40627 <colspec colwidth="8*" align="left"/>
40628 <colspec colwidth="6*" align="center"/>
40629 <colspec colwidth="6*" align="center"/>
40630 <colspec colwidth="6*" align="right"/>
40631 <tbody>
40632 <row>
40633 <entry><option>lock_interval</option></entry>
40634 <entry>Use: <emphasis>appendfile</emphasis></entry>
40635 <entry>Type: <emphasis>time</emphasis></entry>
40636 <entry>Default: <emphasis>3s</emphasis></entry>
40637 </row>
40638 </tbody>
40639 </tgroup>
40640 </informaltable>
40641 <para>
40642 This specifies the time to wait between attempts to lock the file. See below
40643 for details of locking.
40644 </para>
40645 <para>
40646 <indexterm role="option">
40647 <primary><option>lock_retries</option></primary>
40648 </indexterm>
40649 </para>
40650 <informaltable frame="all">
40651 <tgroup cols="4" colsep="0" rowsep="0">
40652 <colspec colwidth="8*" align="left"/>
40653 <colspec colwidth="6*" align="center"/>
40654 <colspec colwidth="6*" align="center"/>
40655 <colspec colwidth="6*" align="right"/>
40656 <tbody>
40657 <row>
40658 <entry><option>lock_retries</option></entry>
40659 <entry>Use: <emphasis>appendfile</emphasis></entry>
40660 <entry>Type: <emphasis>integer</emphasis></entry>
40661 <entry>Default: <emphasis>10</emphasis></entry>
40662 </row>
40663 </tbody>
40664 </tgroup>
40665 </informaltable>
40666 <para>
40667 This specifies the maximum number of attempts to lock the file. A value of zero
40668 is treated as 1. See below for details of locking.
40669 </para>
40670 <para>
40671 <indexterm role="option">
40672 <primary><option>lockfile_mode</option></primary>
40673 </indexterm>
40674 </para>
40675 <informaltable frame="all">
40676 <tgroup cols="4" colsep="0" rowsep="0">
40677 <colspec colwidth="8*" align="left"/>
40678 <colspec colwidth="6*" align="center"/>
40679 <colspec colwidth="6*" align="center"/>
40680 <colspec colwidth="6*" align="right"/>
40681 <tbody>
40682 <row>
40683 <entry><option>lockfile_mode</option></entry>
40684 <entry>Use: <emphasis>appendfile</emphasis></entry>
40685 <entry>Type: <emphasis>octal integer</emphasis></entry>
40686 <entry>Default: <emphasis>0600</emphasis></entry>
40687 </row>
40688 </tbody>
40689 </tgroup>
40690 </informaltable>
40691 <para>
40692 This specifies the mode of the created lock file, when a lock file is being
40693 used (see <option>use_lockfile</option> and <option>use_mbx_lock</option>).
40694 </para>
40695 <para>
40696 <indexterm role="option">
40697 <primary><option>lockfile_timeout</option></primary>
40698 </indexterm>
40699 </para>
40700 <informaltable frame="all">
40701 <tgroup cols="4" colsep="0" rowsep="0">
40702 <colspec colwidth="8*" align="left"/>
40703 <colspec colwidth="6*" align="center"/>
40704 <colspec colwidth="6*" align="center"/>
40705 <colspec colwidth="6*" align="right"/>
40706 <tbody>
40707 <row>
40708 <entry><option>lockfile_timeout</option></entry>
40709 <entry>Use: <emphasis>appendfile</emphasis></entry>
40710 <entry>Type: <emphasis>time</emphasis></entry>
40711 <entry>Default: <emphasis>30m</emphasis></entry>
40712 </row>
40713 </tbody>
40714 </tgroup>
40715 </informaltable>
40716 <para>
40717 <indexterm role="concept">
40718 <primary>timeout</primary>
40719 <secondary>mailbox locking</secondary>
40720 </indexterm>
40721 When a lock file is being used (see <option>use_lockfile</option>), if a lock file already
40722 exists and is older than this value, it is assumed to have been left behind by
40723 accident, and Exim attempts to remove it.
40724 </para>
40725 <para>
40726 <indexterm role="option">
40727 <primary><option>mailbox_filecount</option></primary>
40728 </indexterm>
40729 </para>
40730 <informaltable frame="all">
40731 <tgroup cols="4" colsep="0" rowsep="0">
40732 <colspec colwidth="8*" align="left"/>
40733 <colspec colwidth="6*" align="center"/>
40734 <colspec colwidth="6*" align="center"/>
40735 <colspec colwidth="6*" align="right"/>
40736 <tbody>
40737 <row>
40738 <entry><option>mailbox_filecount</option></entry>
40739 <entry>Use: <emphasis>appendfile</emphasis></entry>
40740 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
40741 <entry>Default: <emphasis>unset</emphasis></entry>
40742 </row>
40743 </tbody>
40744 </tgroup>
40745 </informaltable>
40746 <para>
40747 <indexterm role="concept">
40748 <primary>mailbox</primary>
40749 <secondary>specifying size of</secondary>
40750 </indexterm>
40751 <indexterm role="concept">
40752 <primary>size</primary>
40753 <secondary>of mailbox</secondary>
40754 </indexterm>
40755 If this option is set, it is expanded, and the result is taken as the current
40756 number of files in the mailbox. It must be a decimal number, optionally
40757 followed by K or M. This provides a way of obtaining this information from an
40758 external source that maintains the data.
40759 </para>
40760 <para>
40761 <indexterm role="option">
40762 <primary><option>mailbox_size</option></primary>
40763 </indexterm>
40764 </para>
40765 <informaltable frame="all">
40766 <tgroup cols="4" colsep="0" rowsep="0">
40767 <colspec colwidth="8*" align="left"/>
40768 <colspec colwidth="6*" align="center"/>
40769 <colspec colwidth="6*" align="center"/>
40770 <colspec colwidth="6*" align="right"/>
40771 <tbody>
40772 <row>
40773 <entry><option>mailbox_size</option></entry>
40774 <entry>Use: <emphasis>appendfile</emphasis></entry>
40775 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
40776 <entry>Default: <emphasis>unset</emphasis></entry>
40777 </row>
40778 </tbody>
40779 </tgroup>
40780 </informaltable>
40781 <para>
40782 <indexterm role="concept">
40783 <primary>mailbox</primary>
40784 <secondary>specifying size of</secondary>
40785 </indexterm>
40786 <indexterm role="concept">
40787 <primary>size</primary>
40788 <secondary>of mailbox</secondary>
40789 </indexterm>
40790 If this option is set, it is expanded, and the result is taken as the current
40791 size the mailbox. It must be a decimal number, optionally followed by K or M.
40792 This provides a way of obtaining this information from an external source that
40793 maintains the data. This is likely to be helpful for maildir deliveries where
40794 it is computationally expensive to compute the size of a mailbox.
40795 </para>
40796 <para>
40797 <indexterm role="option">
40798 <primary><option>maildir_format</option></primary>
40799 </indexterm>
40800 </para>
40801 <informaltable frame="all">
40802 <tgroup cols="4" colsep="0" rowsep="0">
40803 <colspec colwidth="8*" align="left"/>
40804 <colspec colwidth="6*" align="center"/>
40805 <colspec colwidth="6*" align="center"/>
40806 <colspec colwidth="6*" align="right"/>
40807 <tbody>
40808 <row>
40809 <entry><option>maildir_format</option></entry>
40810 <entry>Use: <emphasis>appendfile</emphasis></entry>
40811 <entry>Type: <emphasis>boolean</emphasis></entry>
40812 <entry>Default: <emphasis>false</emphasis></entry>
40813 </row>
40814 </tbody>
40815 </tgroup>
40816 </informaltable>
40817 <para>
40818 <indexterm role="concept">
40819 <primary>maildir format</primary>
40820 <secondary>specifying</secondary>
40821 </indexterm>
40822 If this option is set with the <option>directory</option> option, the delivery is into a new
40823 file, in the <quote>maildir</quote> format that is used by other mail software. When the
40824 transport is activated directly from a <command>redirect</command> router (for example, the
40825 <command>address_file</command> transport in the default configuration), setting
40826 <option>maildir_format</option> causes the path received from the router to be treated as a
40827 directory, whether or not it ends with <literal>/</literal>. This option is available only if
40828 SUPPORT_MAILDIR is present in <filename>Local/Makefile</filename>. See section
40829 <xref linkend="SECTmaildirdelivery"/> below for further details.
40830 </para>
40831 <para>
40832 <indexterm role="option">
40833 <primary><option>maildir_quota_directory_regex</option></primary>
40834 </indexterm>
40835 </para>
40836 <informaltable frame="all">
40837 <tgroup cols="4" colsep="0" rowsep="0">
40838 <colspec colwidth="8*" align="left"/>
40839 <colspec colwidth="6*" align="center"/>
40840 <colspec colwidth="6*" align="center"/>
40841 <colspec colwidth="6*" align="right"/>
40842 <tbody>
40843 <row>
40844 <entry><option>maildir_quota_directory_regex</option></entry>
40845 <entry>Use: <emphasis>appendfile</emphasis></entry>
40846 <entry>Type: <emphasis>string</emphasis></entry>
40847 <entry>Default: <emphasis>See below</emphasis></entry>
40848 </row>
40849 </tbody>
40850 </tgroup>
40851 </informaltable>
40852 <para>
40853 <indexterm role="concept">
40854 <primary>maildir format</primary>
40855 <secondary>quota; directories included in</secondary>
40856 </indexterm>
40857 <indexterm role="concept">
40858 <primary>quota</primary>
40859 <secondary>maildir; directories included in</secondary>
40860 </indexterm>
40861 This option is relevant only when <option>maildir_use_size_file</option> is set. It defines
40862 a regular expression for specifying directories, relative to the quota
40863 directory (see <option>quota_directory</option>), that should be included in the quota
40864 calculation. The default value is:
40865 </para>
40866 <literallayout class="monospaced">
40867 maildir_quota_directory_regex = ^(?:cur|new|\..*)$
40868 </literallayout>
40869 <para>
40870 This includes the <filename>cur</filename> and <filename>new</filename> directories, and any maildir++ folders
40871 (directories whose names begin with a dot). If you want to exclude the
40872 <filename>Trash</filename>
40873 folder from the count (as some sites do), you need to change this setting to
40874 </para>
40875 <literallayout class="monospaced">
40876 maildir_quota_directory_regex = ^(?:cur|new|\.(?!Trash).*)$
40877 </literallayout>
40878 <para>
40879 This uses a negative lookahead in the regular expression to exclude the
40880 directory whose name is <filename>.Trash</filename>. When a directory is excluded from quota
40881 calculations, quota processing is bypassed for any messages that are delivered
40882 directly into that directory.
40883 </para>
40884 <para>
40885 <indexterm role="option">
40886 <primary><option>maildir_retries</option></primary>
40887 </indexterm>
40888 </para>
40889 <informaltable frame="all">
40890 <tgroup cols="4" colsep="0" rowsep="0">
40891 <colspec colwidth="8*" align="left"/>
40892 <colspec colwidth="6*" align="center"/>
40893 <colspec colwidth="6*" align="center"/>
40894 <colspec colwidth="6*" align="right"/>
40895 <tbody>
40896 <row>
40897 <entry><option>maildir_retries</option></entry>
40898 <entry>Use: <emphasis>appendfile</emphasis></entry>
40899 <entry>Type: <emphasis>integer</emphasis></entry>
40900 <entry>Default: <emphasis>10</emphasis></entry>
40901 </row>
40902 </tbody>
40903 </tgroup>
40904 </informaltable>
40905 <para>
40906 This option specifies the number of times to retry when writing a file in
40907 <quote>maildir</quote> format. See section <xref linkend="SECTmaildirdelivery"/> below.
40908 </para>
40909 <para>
40910 <indexterm role="option">
40911 <primary><option>maildir_tag</option></primary>
40912 </indexterm>
40913 </para>
40914 <informaltable frame="all">
40915 <tgroup cols="4" colsep="0" rowsep="0">
40916 <colspec colwidth="8*" align="left"/>
40917 <colspec colwidth="6*" align="center"/>
40918 <colspec colwidth="6*" align="center"/>
40919 <colspec colwidth="6*" align="right"/>
40920 <tbody>
40921 <row>
40922 <entry><option>maildir_tag</option></entry>
40923 <entry>Use: <emphasis>appendfile</emphasis></entry>
40924 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
40925 <entry>Default: <emphasis>unset</emphasis></entry>
40926 </row>
40927 </tbody>
40928 </tgroup>
40929 </informaltable>
40930 <para>
40931 This option applies only to deliveries in maildir format, and is described in
40932 section <xref linkend="SECTmaildirdelivery"/> below.
40933 </para>
40934 <para>
40935 <indexterm role="option">
40936 <primary><option>maildir_use_size_file</option></primary>
40937 </indexterm>
40938 </para>
40939 <informaltable frame="all">
40940 <tgroup cols="4" colsep="0" rowsep="0">
40941 <colspec colwidth="8*" align="left"/>
40942 <colspec colwidth="6*" align="center"/>
40943 <colspec colwidth="6*" align="center"/>
40944 <colspec colwidth="6*" align="right"/>
40945 <tbody>
40946 <row>
40947 <entry><option>maildir_use_size_file</option></entry>
40948 <entry>Use: <emphasis>appendfile</emphasis>&dagger;<emphasis></emphasis></entry>
40949 <entry>Type: <emphasis>boolean</emphasis></entry>
40950 <entry>Default: <emphasis>false</emphasis></entry>
40951 </row>
40952 </tbody>
40953 </tgroup>
40954 </informaltable>
40955 <para>
40956 <indexterm role="concept">
40957 <primary>maildir format</primary>
40958 <secondary><filename>maildirsize</filename> file</secondary>
40959 </indexterm>
40960 The result of string expansion for this option must be a valid boolean value.
40961 If it is true, it enables support for <filename>maildirsize</filename> files. Exim
40962 creates a <filename>maildirsize</filename> file in a maildir if one does not exist, taking the
40963 quota from the <option>quota</option> option of the transport. If <option>quota</option> is unset, the
40964 value is zero. See <option>maildir_quota_directory_regex</option> above and section
40965 <xref linkend="SECTmaildirdelivery"/> below for further details.
40966 </para>
40967 <para>
40968 <indexterm role="option">
40969 <primary><option>maildirfolder_create_regex</option></primary>
40970 </indexterm>
40971 </para>
40972 <informaltable frame="all">
40973 <tgroup cols="4" colsep="0" rowsep="0">
40974 <colspec colwidth="8*" align="left"/>
40975 <colspec colwidth="6*" align="center"/>
40976 <colspec colwidth="6*" align="center"/>
40977 <colspec colwidth="6*" align="right"/>
40978 <tbody>
40979 <row>
40980 <entry><option>maildirfolder_create_regex</option></entry>
40981 <entry>Use: <emphasis>appendfile</emphasis></entry>
40982 <entry>Type: <emphasis>string</emphasis></entry>
40983 <entry>Default: <emphasis>unset</emphasis></entry>
40984 </row>
40985 </tbody>
40986 </tgroup>
40987 </informaltable>
40988 <para>
40989 <indexterm role="concept">
40990 <primary>maildir format</primary>
40991 <secondary><filename>maildirfolder</filename> file</secondary>
40992 </indexterm>
40993 <indexterm role="concept">
40994 <primary><filename>maildirfolder</filename>, creating</primary>
40995 </indexterm>
40996 The value of this option is a regular expression. If it is unset, it has no
40997 effect. Otherwise, before a maildir delivery takes place, the pattern is
40998 matched against the name of the maildir directory, that is, the directory
40999 containing the <filename>new</filename> and <filename>tmp</filename> subdirectories that will be used for the
41000 delivery. If there is a match, Exim checks for the existence of a file called
41001 <filename>maildirfolder</filename> in the directory, and creates it if it does not exist.
41002 See section <xref linkend="SECTmaildirdelivery"/> for more details.
41003 </para>
41004 <para>
41005 <indexterm role="option">
41006 <primary><option>mailstore_format</option></primary>
41007 </indexterm>
41008 </para>
41009 <informaltable frame="all">
41010 <tgroup cols="4" colsep="0" rowsep="0">
41011 <colspec colwidth="8*" align="left"/>
41012 <colspec colwidth="6*" align="center"/>
41013 <colspec colwidth="6*" align="center"/>
41014 <colspec colwidth="6*" align="right"/>
41015 <tbody>
41016 <row>
41017 <entry><option>mailstore_format</option></entry>
41018 <entry>Use: <emphasis>appendfile</emphasis></entry>
41019 <entry>Type: <emphasis>boolean</emphasis></entry>
41020 <entry>Default: <emphasis>false</emphasis></entry>
41021 </row>
41022 </tbody>
41023 </tgroup>
41024 </informaltable>
41025 <para>
41026 <indexterm role="concept">
41027 <primary>mailstore format</primary>
41028 <secondary>specifying</secondary>
41029 </indexterm>
41030 If this option is set with the <option>directory</option> option, the delivery is into two
41031 new files in  <quote>mailstore</quote> format. The option is available only if
41032 SUPPORT_MAILSTORE is present in <filename>Local/Makefile</filename>. See section <xref linkend="SECTopdir"/>
41033 below for further details.
41034 </para>
41035 <para>
41036 <indexterm role="option">
41037 <primary><option>mailstore_prefix</option></primary>
41038 </indexterm>
41039 </para>
41040 <informaltable frame="all">
41041 <tgroup cols="4" colsep="0" rowsep="0">
41042 <colspec colwidth="8*" align="left"/>
41043 <colspec colwidth="6*" align="center"/>
41044 <colspec colwidth="6*" align="center"/>
41045 <colspec colwidth="6*" align="right"/>
41046 <tbody>
41047 <row>
41048 <entry><option>mailstore_prefix</option></entry>
41049 <entry>Use: <emphasis>appendfile</emphasis></entry>
41050 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
41051 <entry>Default: <emphasis>unset</emphasis></entry>
41052 </row>
41053 </tbody>
41054 </tgroup>
41055 </informaltable>
41056 <para>
41057 This option applies only to deliveries in mailstore format, and is described in
41058 section <xref linkend="SECTopdir"/> below.
41059 </para>
41060 <para>
41061 <indexterm role="option">
41062 <primary><option>mailstore_suffix</option></primary>
41063 </indexterm>
41064 </para>
41065 <informaltable frame="all">
41066 <tgroup cols="4" colsep="0" rowsep="0">
41067 <colspec colwidth="8*" align="left"/>
41068 <colspec colwidth="6*" align="center"/>
41069 <colspec colwidth="6*" align="center"/>
41070 <colspec colwidth="6*" align="right"/>
41071 <tbody>
41072 <row>
41073 <entry><option>mailstore_suffix</option></entry>
41074 <entry>Use: <emphasis>appendfile</emphasis></entry>
41075 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
41076 <entry>Default: <emphasis>unset</emphasis></entry>
41077 </row>
41078 </tbody>
41079 </tgroup>
41080 </informaltable>
41081 <para>
41082 This option applies only to deliveries in mailstore format, and is described in
41083 section <xref linkend="SECTopdir"/> below.
41084 </para>
41085 <para>
41086 <indexterm role="option">
41087 <primary><option>mbx_format</option></primary>
41088 </indexterm>
41089 </para>
41090 <informaltable frame="all">
41091 <tgroup cols="4" colsep="0" rowsep="0">
41092 <colspec colwidth="8*" align="left"/>
41093 <colspec colwidth="6*" align="center"/>
41094 <colspec colwidth="6*" align="center"/>
41095 <colspec colwidth="6*" align="right"/>
41096 <tbody>
41097 <row>
41098 <entry><option>mbx_format</option></entry>
41099 <entry>Use: <emphasis>appendfile</emphasis></entry>
41100 <entry>Type: <emphasis>boolean</emphasis></entry>
41101 <entry>Default: <emphasis>false</emphasis></entry>
41102 </row>
41103 </tbody>
41104 </tgroup>
41105 </informaltable>
41106 <para>
41107 <indexterm role="concept">
41108 <primary>locking files</primary>
41109 </indexterm>
41110 <indexterm role="concept">
41111 <primary>file</primary>
41112 <secondary>locking</secondary>
41113 </indexterm>
41114 <indexterm role="concept">
41115 <primary>file</primary>
41116 <secondary>MBX format</secondary>
41117 </indexterm>
41118 <indexterm role="concept">
41119 <primary>MBX format, specifying</primary>
41120 </indexterm>
41121 This option is available only if Exim has been compiled with SUPPORT_MBX
41122 set in <filename>Local/Makefile</filename>. If <option>mbx_format</option> is set with the <option>file</option> option,
41123 the message is appended to the mailbox file in MBX format instead of
41124 traditional Unix format. This format is supported by Pine4 and its associated
41125 IMAP and POP daemons, by means of the <emphasis>c-client</emphasis> library that they all use.
41126 </para>
41127 <para>
41128 <emphasis role="bold">Note</emphasis>: The <option>message_prefix</option> and <option>message_suffix</option> options are not
41129 automatically changed by the use of <option>mbx_format</option>. They should normally be set
41130 empty when using MBX format, so this option almost always appears in this
41131 combination:
41132 </para>
41133 <literallayout class="monospaced">
41134 mbx_format = true
41135 message_prefix =
41136 message_suffix =
41137 </literallayout>
41138 <para>
41139 If none of the locking options are mentioned in the configuration,
41140 <option>use_mbx_lock</option> is assumed and the other locking options default to false. It
41141 is possible to specify the other kinds of locking with <option>mbx_format</option>, but
41142 <option>use_fcntl_lock</option> and <option>use_mbx_lock</option> are mutually exclusive. MBX locking
41143 interworks with <emphasis>c-client</emphasis>, providing for shared access to the mailbox. It
41144 should not be used if any program that does not use this form of locking is
41145 going to access the mailbox, nor should it be used if the mailbox file is NFS
41146 mounted, because it works only when the mailbox is accessed from a single host.
41147 </para>
41148 <para>
41149 If you set <option>use_fcntl_lock</option> with an MBX-format mailbox, you cannot use
41150 the standard version of <emphasis>c-client</emphasis>, because as long as it has a mailbox open
41151 (this means for the whole of a Pine or IMAP session), Exim will not be able to
41152 append messages to it.
41153 </para>
41154 <para>
41155 <indexterm role="option">
41156 <primary><option>message_prefix</option></primary>
41157 </indexterm>
41158 </para>
41159 <informaltable frame="all">
41160 <tgroup cols="4" colsep="0" rowsep="0">
41161 <colspec colwidth="8*" align="left"/>
41162 <colspec colwidth="6*" align="center"/>
41163 <colspec colwidth="6*" align="center"/>
41164 <colspec colwidth="6*" align="right"/>
41165 <tbody>
41166 <row>
41167 <entry><option>message_prefix</option></entry>
41168 <entry>Use: <emphasis>appendfile</emphasis></entry>
41169 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
41170 <entry>Default: <emphasis>see below</emphasis></entry>
41171 </row>
41172 </tbody>
41173 </tgroup>
41174 </informaltable>
41175 <para>
41176 <indexterm role="concept">
41177 <primary><quote>From</quote> line</primary>
41178 </indexterm>
41179 The string specified here is expanded and output at the start of every message.
41180 The default is unset unless <option>file</option> is specified and <option>use_bsmtp</option> is not set,
41181 in which case it is:
41182 </para>
41183 <literallayout class="monospaced">
41184 message_prefix = "From ${if def:return_path{$return_path}\
41185   {MAILER-DAEMON}} $tod_bsdinbox\n"
41186 </literallayout>
41187 <para>
41188 <emphasis role="bold">Note:</emphasis> If you set <option>use_crlf</option> true, you must change any occurrences of
41189 <literal>\n</literal> to <literal>\r\n</literal> in <option>message_prefix</option>.
41190 </para>
41191 <para>
41192 <indexterm role="option">
41193 <primary><option>message_suffix</option></primary>
41194 </indexterm>
41195 </para>
41196 <informaltable frame="all">
41197 <tgroup cols="4" colsep="0" rowsep="0">
41198 <colspec colwidth="8*" align="left"/>
41199 <colspec colwidth="6*" align="center"/>
41200 <colspec colwidth="6*" align="center"/>
41201 <colspec colwidth="6*" align="right"/>
41202 <tbody>
41203 <row>
41204 <entry><option>message_suffix</option></entry>
41205 <entry>Use: <emphasis>appendfile</emphasis></entry>
41206 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
41207 <entry>Default: <emphasis>see below</emphasis></entry>
41208 </row>
41209 </tbody>
41210 </tgroup>
41211 </informaltable>
41212 <para>
41213 The string specified here is expanded and output at the end of every message.
41214 The default is unset unless <option>file</option> is specified and <option>use_bsmtp</option> is not set,
41215 in which case it is a single newline character. The suffix can be suppressed by
41216 setting
41217 </para>
41218 <literallayout class="monospaced">
41219 message_suffix =
41220 </literallayout>
41221 <para>
41222 <emphasis role="bold">Note:</emphasis> If you set <option>use_crlf</option> true, you must change any occurrences of
41223 <literal>\n</literal> to <literal>\r\n</literal> in <option>message_suffix</option>.
41224 </para>
41225 <para>
41226 <indexterm role="option">
41227 <primary><option>mode</option></primary>
41228 </indexterm>
41229 </para>
41230 <informaltable frame="all">
41231 <tgroup cols="4" colsep="0" rowsep="0">
41232 <colspec colwidth="8*" align="left"/>
41233 <colspec colwidth="6*" align="center"/>
41234 <colspec colwidth="6*" align="center"/>
41235 <colspec colwidth="6*" align="right"/>
41236 <tbody>
41237 <row>
41238 <entry><option>mode</option></entry>
41239 <entry>Use: <emphasis>appendfile</emphasis></entry>
41240 <entry>Type: <emphasis>octal integer</emphasis></entry>
41241 <entry>Default: <emphasis>0600</emphasis></entry>
41242 </row>
41243 </tbody>
41244 </tgroup>
41245 </informaltable>
41246 <para>
41247 If the output file is created, it is given this mode. If it already exists and
41248 has wider permissions, they are reduced to this mode. If it has narrower
41249 permissions, an error occurs unless <option>mode_fail_narrower</option> is false. However,
41250 if the delivery is the result of a <option>save</option> command in a filter file specifying
41251 a particular mode, the mode of the output file is always forced to take that
41252 value, and this option is ignored.
41253 </para>
41254 <para>
41255 <indexterm role="option">
41256 <primary><option>mode_fail_narrower</option></primary>
41257 </indexterm>
41258 </para>
41259 <informaltable frame="all">
41260 <tgroup cols="4" colsep="0" rowsep="0">
41261 <colspec colwidth="8*" align="left"/>
41262 <colspec colwidth="6*" align="center"/>
41263 <colspec colwidth="6*" align="center"/>
41264 <colspec colwidth="6*" align="right"/>
41265 <tbody>
41266 <row>
41267 <entry><option>mode_fail_narrower</option></entry>
41268 <entry>Use: <emphasis>appendfile</emphasis></entry>
41269 <entry>Type: <emphasis>boolean</emphasis></entry>
41270 <entry>Default: <emphasis>true</emphasis></entry>
41271 </row>
41272 </tbody>
41273 </tgroup>
41274 </informaltable>
41275 <para>
41276 This option applies in the case when an existing mailbox file has a narrower
41277 mode than that specified by the <option>mode</option> option. If <option>mode_fail_narrower</option> is
41278 true, the delivery is deferred (<quote>mailbox has the wrong mode</quote>); otherwise Exim
41279 continues with the delivery attempt, using the existing mode of the file.
41280 </para>
41281 <para>
41282 <indexterm role="option">
41283 <primary><option>notify_comsat</option></primary>
41284 </indexterm>
41285 </para>
41286 <informaltable frame="all">
41287 <tgroup cols="4" colsep="0" rowsep="0">
41288 <colspec colwidth="8*" align="left"/>
41289 <colspec colwidth="6*" align="center"/>
41290 <colspec colwidth="6*" align="center"/>
41291 <colspec colwidth="6*" align="right"/>
41292 <tbody>
41293 <row>
41294 <entry><option>notify_comsat</option></entry>
41295 <entry>Use: <emphasis>appendfile</emphasis></entry>
41296 <entry>Type: <emphasis>boolean</emphasis></entry>
41297 <entry>Default: <emphasis>false</emphasis></entry>
41298 </row>
41299 </tbody>
41300 </tgroup>
41301 </informaltable>
41302 <para>
41303 If this option is true, the <emphasis>comsat</emphasis> daemon is notified after every
41304 successful delivery to a user mailbox. This is the daemon that notifies logged
41305 on users about incoming mail.
41306 </para>
41307 <para>
41308 <indexterm role="option">
41309 <primary><option>quota</option></primary>
41310 </indexterm>
41311 </para>
41312 <informaltable frame="all">
41313 <tgroup cols="4" colsep="0" rowsep="0">
41314 <colspec colwidth="8*" align="left"/>
41315 <colspec colwidth="6*" align="center"/>
41316 <colspec colwidth="6*" align="center"/>
41317 <colspec colwidth="6*" align="right"/>
41318 <tbody>
41319 <row>
41320 <entry><option>quota</option></entry>
41321 <entry>Use: <emphasis>appendfile</emphasis></entry>
41322 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
41323 <entry>Default: <emphasis>unset</emphasis></entry>
41324 </row>
41325 </tbody>
41326 </tgroup>
41327 </informaltable>
41328 <para>
41329 <indexterm role="concept">
41330 <primary>quota</primary>
41331 <secondary>imposed by Exim</secondary>
41332 </indexterm>
41333 This option imposes a limit on the size of the file to which Exim is appending,
41334 or to the total space used in the directory tree when the <option>directory</option> option
41335 is set. In the latter case, computation of the space used is expensive, because
41336 all the files in the directory (and any sub-directories) have to be
41337 individually inspected and their sizes summed. (See <option>quota_size_regex</option> and
41338 <option>maildir_use_size_file</option> for ways to avoid this in environments where users
41339 have no shell access to their mailboxes).
41340 </para>
41341 <para>
41342 As there is no interlock against two simultaneous deliveries into a
41343 multi-file mailbox, it is possible for the quota to be overrun in this case.
41344 For single-file mailboxes, of course, an interlock is a necessity.
41345 </para>
41346 <para>
41347 A file&#x2019;s size is taken as its <emphasis>used</emphasis> value. Because of blocking effects, this
41348 may be a lot less than the actual amount of disk space allocated to the file.
41349 If the sizes of a number of files are being added up, the rounding effect can
41350 become quite noticeable, especially on systems that have large block sizes.
41351 Nevertheless, it seems best to stick to the <emphasis>used</emphasis> figure, because this is
41352 the obvious value which users understand most easily.
41353 </para>
41354 <para>
41355 The value of the option is expanded, and must then be a numerical value
41356 (decimal point allowed), optionally followed by one of the letters K, M, or G,
41357 for kilobytes, megabytes, or gigabytes. If Exim is running on a system with
41358 large file support (Linux and FreeBSD have this), mailboxes larger than 2G can
41359 be handled.
41360 </para>
41361 <para>
41362 <emphasis role="bold">Note</emphasis>: A value of zero is interpreted as <quote>no quota</quote>.
41363 </para>
41364 <para>
41365 The expansion happens while Exim is running as root, before it changes uid for
41366 the delivery. This means that files that are inaccessible to the end user can
41367 be used to hold quota values that are looked up in the expansion. When delivery
41368 fails because this quota is exceeded, the handling of the error is as for
41369 system quota failures.
41370 </para>
41371 <para>
41372 By default, Exim&#x2019;s quota checking mimics system quotas, and restricts the
41373 mailbox to the specified maximum size, though the value is not accurate to the
41374 last byte, owing to separator lines and additional headers that may get added
41375 during message delivery. When a mailbox is nearly full, large messages may get
41376 refused even though small ones are accepted, because the size of the current
41377 message is added to the quota when the check is made. This behaviour can be
41378 changed by setting <option>quota_is_inclusive</option> false. When this is done, the check
41379 for exceeding the quota does not include the current message. Thus, deliveries
41380 continue until the quota has been exceeded; thereafter, no further messages are
41381 delivered. See also <option>quota_warn_threshold</option>.
41382 </para>
41383 <para>
41384 <indexterm role="option">
41385 <primary><option>quota_directory</option></primary>
41386 </indexterm>
41387 </para>
41388 <informaltable frame="all">
41389 <tgroup cols="4" colsep="0" rowsep="0">
41390 <colspec colwidth="8*" align="left"/>
41391 <colspec colwidth="6*" align="center"/>
41392 <colspec colwidth="6*" align="center"/>
41393 <colspec colwidth="6*" align="right"/>
41394 <tbody>
41395 <row>
41396 <entry><option>quota_directory</option></entry>
41397 <entry>Use: <emphasis>appendfile</emphasis></entry>
41398 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
41399 <entry>Default: <emphasis>unset</emphasis></entry>
41400 </row>
41401 </tbody>
41402 </tgroup>
41403 </informaltable>
41404 <para>
41405 This option defines the directory to check for quota purposes when delivering
41406 into individual files. The default is the delivery directory, or, if a file
41407 called <filename>maildirfolder</filename> exists in a maildir directory, the parent of the
41408 delivery directory.
41409 </para>
41410 <para>
41411 <indexterm role="option">
41412 <primary><option>quota_filecount</option></primary>
41413 </indexterm>
41414 </para>
41415 <informaltable frame="all">
41416 <tgroup cols="4" colsep="0" rowsep="0">
41417 <colspec colwidth="8*" align="left"/>
41418 <colspec colwidth="6*" align="center"/>
41419 <colspec colwidth="6*" align="center"/>
41420 <colspec colwidth="6*" align="right"/>
41421 <tbody>
41422 <row>
41423 <entry><option>quota_filecount</option></entry>
41424 <entry>Use: <emphasis>appendfile</emphasis></entry>
41425 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
41426 <entry>Default: <emphasis>0</emphasis></entry>
41427 </row>
41428 </tbody>
41429 </tgroup>
41430 </informaltable>
41431 <para>
41432 This option applies when the <option>directory</option> option is set. It limits the total
41433 number of files in the directory (compare the inode limit in system quotas). It
41434 can only be used if <option>quota</option> is also set. The value is expanded; an expansion
41435 failure causes delivery to be deferred. A value of zero is interpreted as
41436 <quote>no quota</quote>.
41437 </para>
41438 <para>
41439 <indexterm role="option">
41440 <primary><option>quota_is_inclusive</option></primary>
41441 </indexterm>
41442 </para>
41443 <informaltable frame="all">
41444 <tgroup cols="4" colsep="0" rowsep="0">
41445 <colspec colwidth="8*" align="left"/>
41446 <colspec colwidth="6*" align="center"/>
41447 <colspec colwidth="6*" align="center"/>
41448 <colspec colwidth="6*" align="right"/>
41449 <tbody>
41450 <row>
41451 <entry><option>quota_is_inclusive</option></entry>
41452 <entry>Use: <emphasis>appendfile</emphasis></entry>
41453 <entry>Type: <emphasis>boolean</emphasis></entry>
41454 <entry>Default: <emphasis>true</emphasis></entry>
41455 </row>
41456 </tbody>
41457 </tgroup>
41458 </informaltable>
41459 <para>
41460 See <option>quota</option> above.
41461 </para>
41462 <para>
41463 <indexterm role="option">
41464 <primary><option>quota_size_regex</option></primary>
41465 </indexterm>
41466 </para>
41467 <informaltable frame="all">
41468 <tgroup cols="4" colsep="0" rowsep="0">
41469 <colspec colwidth="8*" align="left"/>
41470 <colspec colwidth="6*" align="center"/>
41471 <colspec colwidth="6*" align="center"/>
41472 <colspec colwidth="6*" align="right"/>
41473 <tbody>
41474 <row>
41475 <entry><option>quota_size_regex</option></entry>
41476 <entry>Use: <emphasis>appendfile</emphasis></entry>
41477 <entry>Type: <emphasis>string</emphasis></entry>
41478 <entry>Default: <emphasis>unset</emphasis></entry>
41479 </row>
41480 </tbody>
41481 </tgroup>
41482 </informaltable>
41483 <para>
41484 This option applies when one of the delivery modes that writes a separate file
41485 for each message is being used. When Exim wants to find the size of one of
41486 these files in order to test the quota, it first checks <option>quota_size_regex</option>.
41487 If this is set to a regular expression that matches the file name, and it
41488 captures one string, that string is interpreted as a representation of the
41489 file&#x2019;s size. The value of <option>quota_size_regex</option> is not expanded.
41490 </para>
41491 <para>
41492 This feature is useful only when users have no shell access to their mailboxes
41493 &ndash; otherwise they could defeat the quota simply by renaming the files. This
41494 facility can be used with maildir deliveries, by setting <option>maildir_tag</option> to add
41495 the file length to the file name. For example:
41496 </para>
41497 <literallayout class="monospaced">
41498 maildir_tag = ,S=$message_size
41499 quota_size_regex = ,S=(\d+)
41500 </literallayout>
41501 <para>
41502 An alternative to <varname>$message_size</varname> is <varname>$message_linecount</varname>, which contains the
41503 number of lines in the message.
41504 </para>
41505 <para>
41506 The regular expression should not assume that the length is at the end of the
41507 file name (even though <option>maildir_tag</option> puts it there) because maildir MUAs
41508 sometimes add other information onto the ends of message file names.
41509 </para>
41510 <para>
41511 Section <xref linkend="SECID136"/> contains further information.
41512 </para>
41513 <para>
41514 <indexterm role="option">
41515 <primary><option>quota_warn_message</option></primary>
41516 </indexterm>
41517 </para>
41518 <informaltable frame="all">
41519 <tgroup cols="4" colsep="0" rowsep="0">
41520 <colspec colwidth="8*" align="left"/>
41521 <colspec colwidth="6*" align="center"/>
41522 <colspec colwidth="6*" align="center"/>
41523 <colspec colwidth="6*" align="right"/>
41524 <tbody>
41525 <row>
41526 <entry><option>quota_warn_message</option></entry>
41527 <entry>Use: <emphasis>appendfile</emphasis></entry>
41528 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
41529 <entry>Default: <emphasis>see below</emphasis></entry>
41530 </row>
41531 </tbody>
41532 </tgroup>
41533 </informaltable>
41534 <para>
41535 See below for the use of this option. If it is not set when
41536 <option>quota_warn_threshold</option> is set, it defaults to
41537 </para>
41538 <literallayout class="monospaced">
41539 quota_warn_message = "\
41540   To: $local_part@$domain\n\
41541   Subject: Your mailbox\n\n\
41542   This message is automatically created \
41543   by mail delivery software.\n\n\
41544   The size of your mailbox has exceeded \
41545   a warning threshold that is\n\
41546   set by the system administrator.\n"
41547 </literallayout>
41548 <para>
41549 <indexterm role="option">
41550 <primary><option>quota_warn_threshold</option></primary>
41551 </indexterm>
41552 </para>
41553 <informaltable frame="all">
41554 <tgroup cols="4" colsep="0" rowsep="0">
41555 <colspec colwidth="8*" align="left"/>
41556 <colspec colwidth="6*" align="center"/>
41557 <colspec colwidth="6*" align="center"/>
41558 <colspec colwidth="6*" align="right"/>
41559 <tbody>
41560 <row>
41561 <entry><option>quota_warn_threshold</option></entry>
41562 <entry>Use: <emphasis>appendfile</emphasis></entry>
41563 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
41564 <entry>Default: <emphasis>0</emphasis></entry>
41565 </row>
41566 </tbody>
41567 </tgroup>
41568 </informaltable>
41569 <para>
41570 <indexterm role="concept">
41571 <primary>quota</primary>
41572 <secondary>warning threshold</secondary>
41573 </indexterm>
41574 <indexterm role="concept">
41575 <primary>mailbox</primary>
41576 <secondary>size warning</secondary>
41577 </indexterm>
41578 <indexterm role="concept">
41579 <primary>size</primary>
41580 <secondary>of mailbox</secondary>
41581 </indexterm>
41582 This option is expanded in the same way as <option>quota</option> (see above). If the
41583 resulting value is greater than zero, and delivery of the message causes the
41584 size of the file or total space in the directory tree to cross the given
41585 threshold, a warning message is sent. If <option>quota</option> is also set, the threshold
41586 may be specified as a percentage of it by following the value with a percent
41587 sign. For example:
41588 </para>
41589 <literallayout class="monospaced">
41590 quota = 10M
41591 quota_warn_threshold = 75%
41592 </literallayout>
41593 <para>
41594 If <option>quota</option> is not set, a setting of <option>quota_warn_threshold</option> that ends with a
41595 percent sign is ignored.
41596 </para>
41597 <para>
41598 The warning message itself is specified by the <option>quota_warn_message</option> option,
41599 and it must start with a <emphasis>To:</emphasis> header line containing the recipient(s) of the
41600 warning message. These do not necessarily have to include the recipient(s) of
41601 the original message. A <emphasis>Subject:</emphasis> line should also normally be supplied. You
41602 can include any other header lines that you want. If you do not include a
41603 <emphasis>From:</emphasis> line, the default is:
41604 </para>
41605 <literallayout class="monospaced">
41606 From: Mail Delivery System &lt;mailer-daemon@$qualify_domain_sender&gt;
41607 </literallayout>
41608 <para>
41609 <indexterm role="option">
41610 <primary><option>errors_reply_to</option></primary>
41611 </indexterm>
41612 If you supply a <emphasis>Reply-To:</emphasis> line, it overrides the global <option>errors_reply_to</option>
41613 option.
41614 </para>
41615 <para>
41616 The <option>quota</option> option does not have to be set in order to use this option; they
41617 are independent of one another except when the threshold is specified as a
41618 percentage.
41619 </para>
41620 <para>
41621 <indexterm role="option">
41622 <primary><option>use_bsmtp</option></primary>
41623 </indexterm>
41624 </para>
41625 <informaltable frame="all">
41626 <tgroup cols="4" colsep="0" rowsep="0">
41627 <colspec colwidth="8*" align="left"/>
41628 <colspec colwidth="6*" align="center"/>
41629 <colspec colwidth="6*" align="center"/>
41630 <colspec colwidth="6*" align="right"/>
41631 <tbody>
41632 <row>
41633 <entry><option>use_bsmtp</option></entry>
41634 <entry>Use: <emphasis>appendfile</emphasis></entry>
41635 <entry>Type: <emphasis>boolean</emphasis></entry>
41636 <entry>Default: <emphasis>false</emphasis></entry>
41637 </row>
41638 </tbody>
41639 </tgroup>
41640 </informaltable>
41641 <para>
41642 <indexterm role="concept">
41643 <primary>envelope sender</primary>
41644 </indexterm>
41645 If this option is set true, <command>appendfile</command> writes messages in <quote>batch SMTP</quote>
41646 format, with the envelope sender and recipient(s) included as SMTP commands. If
41647 you want to include a leading HELO command with such messages, you can do
41648 so by setting the <option>message_prefix</option> option. See section <xref linkend="SECTbatchSMTP"/>
41649 for details of batch SMTP.
41650 </para>
41651 <para>
41652 <indexterm role="option">
41653 <primary><option>use_crlf</option></primary>
41654 </indexterm>
41655 </para>
41656 <informaltable frame="all">
41657 <tgroup cols="4" colsep="0" rowsep="0">
41658 <colspec colwidth="8*" align="left"/>
41659 <colspec colwidth="6*" align="center"/>
41660 <colspec colwidth="6*" align="center"/>
41661 <colspec colwidth="6*" align="right"/>
41662 <tbody>
41663 <row>
41664 <entry><option>use_crlf</option></entry>
41665 <entry>Use: <emphasis>appendfile</emphasis></entry>
41666 <entry>Type: <emphasis>boolean</emphasis></entry>
41667 <entry>Default: <emphasis>false</emphasis></entry>
41668 </row>
41669 </tbody>
41670 </tgroup>
41671 </informaltable>
41672 <para>
41673 <indexterm role="concept">
41674 <primary>carriage return</primary>
41675 </indexterm>
41676 <indexterm role="concept">
41677 <primary>linefeed</primary>
41678 </indexterm>
41679 This option causes lines to be terminated with the two-character CRLF sequence
41680 (carriage return, linefeed) instead of just a linefeed character. In the case
41681 of batched SMTP, the byte sequence written to the file is then an exact image
41682 of what would be sent down a real SMTP connection.
41683 </para>
41684 <para>
41685 <emphasis role="bold">Note:</emphasis> The contents of the <option>message_prefix</option> and <option>message_suffix</option> options
41686 (which are used to supply the traditional <quote>From&nbsp;</quote> and blank line separators
41687 in Berkeley-style mailboxes) are written verbatim, so must contain their own
41688 carriage return characters if these are needed. In cases where these options
41689 have non-empty defaults, the values end with a single linefeed, so they must be
41690 changed to end with <literal>\r\n</literal> if <option>use_crlf</option> is set.
41691 </para>
41692 <para>
41693 <indexterm role="option">
41694 <primary><option>use_fcntl_lock</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>use_fcntl_lock</option></entry>
41706 <entry>Use: <emphasis>appendfile</emphasis></entry>
41707 <entry>Type: <emphasis>boolean</emphasis></entry>
41708 <entry>Default: <emphasis>see below</emphasis></entry>
41709 </row>
41710 </tbody>
41711 </tgroup>
41712 </informaltable>
41713 <para>
41714 This option controls the use of the <function>fcntl()</function> function to lock a file for
41715 exclusive use when a message is being appended. It is set by default unless
41716 <option>use_flock_lock</option> is set. Otherwise, it should be turned off only if you know
41717 that all your MUAs use lock file locking. When both <option>use_fcntl_lock</option> and
41718 <option>use_flock_lock</option> are unset, <option>use_lockfile</option> must be set.
41719 </para>
41720 <para>
41721 <indexterm role="option">
41722 <primary><option>use_flock_lock</option></primary>
41723 </indexterm>
41724 </para>
41725 <informaltable frame="all">
41726 <tgroup cols="4" colsep="0" rowsep="0">
41727 <colspec colwidth="8*" align="left"/>
41728 <colspec colwidth="6*" align="center"/>
41729 <colspec colwidth="6*" align="center"/>
41730 <colspec colwidth="6*" align="right"/>
41731 <tbody>
41732 <row>
41733 <entry><option>use_flock_lock</option></entry>
41734 <entry>Use: <emphasis>appendfile</emphasis></entry>
41735 <entry>Type: <emphasis>boolean</emphasis></entry>
41736 <entry>Default: <emphasis>false</emphasis></entry>
41737 </row>
41738 </tbody>
41739 </tgroup>
41740 </informaltable>
41741 <para>
41742 This option is provided to support the use of <function>flock()</function> for file locking, for
41743 the few situations where it is needed. Most modern operating systems support
41744 <function>fcntl()</function> and <function>lockf()</function> locking, and these two functions interwork with
41745 each other. Exim uses <function>fcntl()</function> locking by default.
41746 </para>
41747 <para>
41748 This option is required only if you are using an operating system where
41749 <function>flock()</function> is used by programs that access mailboxes (typically MUAs), and
41750 where <function>flock()</function> does not correctly interwork with <function>fcntl()</function>. You can use
41751 both <function>fcntl()</function> and <function>flock()</function> locking simultaneously if you want.
41752 </para>
41753 <para>
41754 <indexterm role="concept">
41755 <primary>Solaris</primary>
41756 <secondary><function>flock()</function> support</secondary>
41757 </indexterm>
41758 Not all operating systems provide <function>flock()</function>. Some versions of Solaris do not
41759 have it (and some, I think, provide a not quite right version built on top of
41760 <function>lockf()</function>). If the OS does not have <function>flock()</function>, Exim will be built without
41761 the ability to use it, and any attempt to do so will cause a configuration
41762 error.
41763 </para>
41764 <para>
41765 <emphasis role="bold">Warning</emphasis>: <function>flock()</function> locks do not work on NFS files (unless <function>flock()</function>
41766 is just being mapped onto <function>fcntl()</function> by the OS).
41767 </para>
41768 <para>
41769 <indexterm role="option">
41770 <primary><option>use_lockfile</option></primary>
41771 </indexterm>
41772 </para>
41773 <informaltable frame="all">
41774 <tgroup cols="4" colsep="0" rowsep="0">
41775 <colspec colwidth="8*" align="left"/>
41776 <colspec colwidth="6*" align="center"/>
41777 <colspec colwidth="6*" align="center"/>
41778 <colspec colwidth="6*" align="right"/>
41779 <tbody>
41780 <row>
41781 <entry><option>use_lockfile</option></entry>
41782 <entry>Use: <emphasis>appendfile</emphasis></entry>
41783 <entry>Type: <emphasis>boolean</emphasis></entry>
41784 <entry>Default: <emphasis>see below</emphasis></entry>
41785 </row>
41786 </tbody>
41787 </tgroup>
41788 </informaltable>
41789 <para>
41790 If this option is turned off, Exim does not attempt to create a lock file when
41791 appending to a mailbox file. In this situation, the only locking is by
41792 <function>fcntl()</function>. You should only turn <option>use_lockfile</option> off if you are absolutely
41793 sure that every MUA that is ever going to look at your users&#x2019; mailboxes uses
41794 <function>fcntl()</function> rather than a lock file, and even then only when you are not
41795 delivering over NFS from more than one host.
41796 </para>
41797 <para>
41798 <indexterm role="concept">
41799 <primary>NFS</primary>
41800 <secondary>lock file</secondary>
41801 </indexterm>
41802 In order to append to an NFS file safely from more than one host, it is
41803 necessary to take out a lock <emphasis>before</emphasis> opening the file, and the lock file
41804 achieves this. Otherwise, even with <function>fcntl()</function> locking, there is a risk of
41805 file corruption.
41806 </para>
41807 <para>
41808 The <option>use_lockfile</option> option is set by default unless <option>use_mbx_lock</option> is set.
41809 It is not possible to turn both <option>use_lockfile</option> and <option>use_fcntl_lock</option> off,
41810 except when <option>mbx_format</option> is set.
41811 </para>
41812 <para>
41813 <indexterm role="option">
41814 <primary><option>use_mbx_lock</option></primary>
41815 </indexterm>
41816 </para>
41817 <informaltable frame="all">
41818 <tgroup cols="4" colsep="0" rowsep="0">
41819 <colspec colwidth="8*" align="left"/>
41820 <colspec colwidth="6*" align="center"/>
41821 <colspec colwidth="6*" align="center"/>
41822 <colspec colwidth="6*" align="right"/>
41823 <tbody>
41824 <row>
41825 <entry><option>use_mbx_lock</option></entry>
41826 <entry>Use: <emphasis>appendfile</emphasis></entry>
41827 <entry>Type: <emphasis>boolean</emphasis></entry>
41828 <entry>Default: <emphasis>see below</emphasis></entry>
41829 </row>
41830 </tbody>
41831 </tgroup>
41832 </informaltable>
41833 <para>
41834 This option is available only if Exim has been compiled with SUPPORT_MBX
41835 set in <filename>Local/Makefile</filename>. Setting the option specifies that special MBX
41836 locking rules be used. It is set by default if <option>mbx_format</option> is set and none
41837 of the locking options are mentioned in the configuration. The locking rules
41838 are the same as are used by the <emphasis>c-client</emphasis> library that underlies Pine and
41839 the IMAP4 and POP daemons that come with it (see the discussion below). The
41840 rules allow for shared access to the mailbox. However, this kind of locking
41841 does not work when the mailbox is NFS mounted.
41842 </para>
41843 <para>
41844 You can set <option>use_mbx_lock</option> with either (or both) of <option>use_fcntl_lock</option> and
41845 <option>use_flock_lock</option> to control what kind of locking is used in implementing the
41846 MBX locking rules. The default is to use <function>fcntl()</function> if <option>use_mbx_lock</option> is set
41847 without <option>use_fcntl_lock</option> or <option>use_flock_lock</option>.
41848 </para>
41849 </section>
41850 <section id="SECTopappend">
41851 <title>Operational details for appending</title>
41852 <para>
41853 <indexterm role="concept">
41854 <primary>appending to a file</primary>
41855 </indexterm>
41856 <indexterm role="concept">
41857 <primary>file</primary>
41858 <secondary>appending</secondary>
41859 </indexterm>
41860 Before appending to a file, the following preparations are made:
41861 </para>
41862 <itemizedlist>
41863 <listitem>
41864 <para>
41865 If the name of the file is <filename>/dev/null</filename>, no action is taken, and a success
41866 return is given.
41867 </para>
41868 </listitem>
41869 <listitem>
41870 <para>
41871 <indexterm role="concept">
41872 <primary>directory creation</primary>
41873 </indexterm>
41874 If any directories on the file&#x2019;s path are missing, Exim creates them if the
41875 <option>create_directory</option> option is set. A created directory&#x2019;s mode is given by the
41876 <option>directory_mode</option> option.
41877 </para>
41878 </listitem>
41879 <listitem>
41880 <para>
41881 If <option>file_format</option> is set, the format of an existing file is checked. If this
41882 indicates that a different transport should be used, control is passed to that
41883 transport.
41884 </para>
41885 </listitem>
41886 <listitem>
41887 <para>
41888 <indexterm role="concept">
41889 <primary>file</primary>
41890 <secondary>locking</secondary>
41891 </indexterm>
41892 <indexterm role="concept">
41893 <primary>locking files</primary>
41894 </indexterm>
41895 <indexterm role="concept">
41896 <primary>NFS</primary>
41897 <secondary>lock file</secondary>
41898 </indexterm>
41899 If <option>use_lockfile</option> is set, a lock file is built in a way that will work
41900 reliably over NFS, as follows:
41901 </para>
41902 <orderedlist numeration="arabic">
41903 <listitem>
41904 <para>
41905 Create a <quote>hitching post</quote> file whose name is that of the lock file with the
41906 current time, primary host name, and process id added, by opening for writing
41907 as a new file. If this fails with an access error, delivery is deferred.
41908 </para>
41909 </listitem>
41910 <listitem>
41911 <para>
41912 Close the hitching post file, and hard link it to the lock file name.
41913 </para>
41914 </listitem>
41915 <listitem>
41916 <para>
41917 If the call to <function>link()</function> succeeds, creation of the lock file has succeeded.
41918 Unlink the hitching post name.
41919 </para>
41920 </listitem>
41921 <listitem>
41922 <para>
41923 Otherwise, use <function>stat()</function> to get information about the hitching post file, and
41924 then unlink hitching post name. If the number of links is exactly two, creation
41925 of the lock file succeeded but something (for example, an NFS server crash and
41926 restart) caused this fact not to be communicated to the <function>link()</function> call.
41927 </para>
41928 </listitem>
41929 <listitem>
41930 <para>
41931 If creation of the lock file failed, wait for <option>lock_interval</option> and try again,
41932 up to <option>lock_retries</option> times. However, since any program that writes to a
41933 mailbox should complete its task very quickly, it is reasonable to time out old
41934 lock files that are normally the result of user agent and system crashes. If an
41935 existing lock file is older than <option>lockfile_timeout</option> Exim attempts to unlink
41936 it before trying again.
41937 </para>
41938 </listitem>
41939 </orderedlist>
41940 </listitem>
41941 <listitem>
41942 <para>
41943 A call is made to <function>lstat()</function> to discover whether the main file exists, and if
41944 so, what its characteristics are. If <function>lstat()</function> fails for any reason other
41945 than non-existence, delivery is deferred.
41946 </para>
41947 </listitem>
41948 <listitem>
41949 <para>
41950 <indexterm role="concept">
41951 <primary>symbolic link</primary>
41952 <secondary>to mailbox</secondary>
41953 </indexterm>
41954 <indexterm role="concept">
41955 <primary>mailbox</primary>
41956 <secondary>symbolic link</secondary>
41957 </indexterm>
41958 If the file does exist and is a symbolic link, delivery is deferred, unless the
41959 <option>allow_symlink</option> option is set, in which case the ownership of the link is
41960 checked, and then <function>stat()</function> is called to find out about the real file, which
41961 is then subjected to the checks below. The check on the top-level link
41962 ownership prevents one user creating a link for another&#x2019;s mailbox in a sticky
41963 directory, though allowing symbolic links in this case is definitely not a good
41964 idea. If there is a chain of symbolic links, the intermediate ones are not
41965 checked.
41966 </para>
41967 </listitem>
41968 <listitem>
41969 <para>
41970 If the file already exists but is not a regular file, or if the file&#x2019;s owner
41971 and group (if the group is being checked &ndash; see <option>check_group</option> above) are
41972 different from the user and group under which the delivery is running,
41973 delivery is deferred.
41974 </para>
41975 </listitem>
41976 <listitem>
41977 <para>
41978 If the file&#x2019;s permissions are more generous than specified, they are reduced.
41979 If they are insufficient, delivery is deferred, unless <option>mode_fail_narrower</option>
41980 is set false, in which case the delivery is tried using the existing
41981 permissions.
41982 </para>
41983 </listitem>
41984 <listitem>
41985 <para>
41986 The file&#x2019;s inode number is saved, and the file is then opened for appending.
41987 If this fails because the file has vanished, <command>appendfile</command> behaves as if it
41988 hadn&#x2019;t existed (see below). For any other failures, delivery is deferred.
41989 </para>
41990 </listitem>
41991 <listitem>
41992 <para>
41993 If the file is opened successfully, check that the inode number hasn&#x2019;t
41994 changed, that it is still a regular file, and that the owner and permissions
41995 have not changed. If anything is wrong, defer delivery and freeze the message.
41996 </para>
41997 </listitem>
41998 <listitem>
41999 <para>
42000 If the file did not exist originally, defer delivery if the <option>file_must_exist</option>
42001 option is set. Otherwise, check that the file is being created in a permitted
42002 directory if the <option>create_file</option> option is set (deferring on failure), and then
42003 open for writing as a new file, with the O_EXCL and O_CREAT options,
42004 except when dealing with a symbolic link (the <option>allow_symlink</option> option must be
42005 set). In this case, which can happen if the link points to a non-existent file,
42006 the file is opened for writing using O_CREAT but not O_EXCL, because
42007 that prevents link following.
42008 </para>
42009 </listitem>
42010 <listitem>
42011 <para>
42012 <indexterm role="concept">
42013 <primary>loop</primary>
42014 <secondary>while file testing</secondary>
42015 </indexterm>
42016 If opening fails because the file exists, obey the tests given above for
42017 existing files. However, to avoid looping in a situation where the file is
42018 being continuously created and destroyed, the exists/not-exists loop is broken
42019 after 10 repetitions, and the message is then frozen.
42020 </para>
42021 </listitem>
42022 <listitem>
42023 <para>
42024 If opening fails with any other error, defer delivery.
42025 </para>
42026 </listitem>
42027 <listitem>
42028 <para>
42029 <indexterm role="concept">
42030 <primary>file</primary>
42031 <secondary>locking</secondary>
42032 </indexterm>
42033 <indexterm role="concept">
42034 <primary>locking files</primary>
42035 </indexterm>
42036 Once the file is open, unless both <option>use_fcntl_lock</option> and <option>use_flock_lock</option>
42037 are false, it is locked using <function>fcntl()</function> or <function>flock()</function> or both. If
42038 <option>use_mbx_lock</option> is false, an exclusive lock is requested in each case.
42039 However, if <option>use_mbx_lock</option> is true, Exim takes out a shared lock on the open
42040 file, and an exclusive lock on the file whose name is
42041 </para>
42042 <literallayout class="monospaced">
42043 /tmp/.&lt;device-number&gt;.&lt;inode-number&gt;
42044 </literallayout>
42045 <para>
42046 using the device and inode numbers of the open mailbox file, in accordance with
42047 the MBX locking rules. This file is created with a mode that is specified by
42048 the <option>lockfile_mode</option> option.
42049 </para>
42050 <para>
42051 If Exim fails to lock the file, there are two possible courses of action,
42052 depending on the value of the locking timeout. This is obtained from
42053 <option>lock_fcntl_timeout</option> or <option>lock_flock_timeout</option>, as appropriate.
42054 </para>
42055 <para>
42056 If the timeout value is zero, the file is closed, Exim waits for
42057 <option>lock_interval</option>, and then goes back and re-opens the file as above and tries
42058 to lock it again. This happens up to <option>lock_retries</option> times, after which the
42059 delivery is deferred.
42060 </para>
42061 <para>
42062 If the timeout has a value greater than zero, blocking calls to <function>fcntl()</function> or
42063 <function>flock()</function> are used (with the given timeout), so there has already been some
42064 waiting involved by the time locking fails. Nevertheless, Exim does not give up
42065 immediately. It retries up to
42066 </para>
42067 <literallayout class="monospaced">
42068 (lock_retries * lock_interval) / &lt;timeout&gt;
42069 </literallayout>
42070 <para>
42071 times (rounded up).
42072 </para>
42073 </listitem>
42074 </itemizedlist>
42075 <para>
42076 At the end of delivery, Exim closes the file (which releases the <function>fcntl()</function>
42077 and/or <function>flock()</function> locks) and then deletes the lock file if one was created.
42078 </para>
42079 </section>
42080 <section id="SECTopdir">
42081 <title>Operational details for delivery to a new file</title>
42082 <para>
42083 <indexterm role="concept">
42084 <primary>delivery</primary>
42085 <secondary>to single file</secondary>
42086 </indexterm>
42087 <indexterm role="concept">
42088 <primary><quote>From</quote> line</primary>
42089 </indexterm>
42090 When the <option>directory</option> option is set instead of <option>file</option>, each message is
42091 delivered into a newly-created file or set of files. When <command>appendfile</command> is
42092 activated directly from a <command>redirect</command> router, neither <option>file</option> nor
42093 <option>directory</option> is normally set, because the path for delivery is supplied by the
42094 router. (See for example, the <command>address_file</command> transport in the default
42095 configuration.) In this case, delivery is to a new file if either the path name
42096 ends in <literal>/</literal>, or the <option>maildir_format</option> or <option>mailstore_format</option> option is set.
42097 </para>
42098 <para>
42099 No locking is required while writing the message to a new file, so the various
42100 locking options of the transport are ignored. The <quote>From</quote> line that by default
42101 separates messages in a single file is not normally needed, nor is the escaping
42102 of message lines that start with <quote>From</quote>, and there is no need to ensure a
42103 newline at the end of each message. Consequently, the default values for
42104 <option>check_string</option>, <option>message_prefix</option>, and <option>message_suffix</option> are all unset when
42105 any of <option>directory</option>, <option>maildir_format</option>, or <option>mailstore_format</option> is set.
42106 </para>
42107 <para>
42108 If Exim is required to check a <option>quota</option> setting, it adds up the sizes of all
42109 the files in the delivery directory by default. However, you can specify a
42110 different directory by setting <option>quota_directory</option>. Also, for maildir
42111 deliveries (see below) the <filename>maildirfolder</filename> convention is honoured.
42112 </para>
42113 <para>
42114 <indexterm role="concept">
42115 <primary>maildir format</primary>
42116 </indexterm>
42117 <indexterm role="concept">
42118 <primary>mailstore format</primary>
42119 </indexterm>
42120 There are three different ways in which delivery to individual files can be
42121 done, controlled by the settings of the <option>maildir_format</option> and
42122 <option>mailstore_format</option> options. Note that code to support maildir or mailstore
42123 formats is not included in the binary unless SUPPORT_MAILDIR or
42124 SUPPORT_MAILSTORE, respectively, is set in <filename>Local/Makefile</filename>.
42125 </para>
42126 <para>
42127 <indexterm role="concept">
42128 <primary>directory creation</primary>
42129 </indexterm>
42130 In all three cases an attempt is made to create the directory and any necessary
42131 sub-directories if they do not exist, provided that the <option>create_directory</option>
42132 option is set (the default). The location of a created directory can be
42133 constrained by setting <option>create_file</option>. A created directory&#x2019;s mode is given by
42134 the <option>directory_mode</option> option. If creation fails, or if the
42135 <option>create_directory</option> option is not set when creation is required, delivery is
42136 deferred.
42137 </para>
42138 </section>
42139 <section id="SECTmaildirdelivery">
42140 <title>Maildir delivery</title>
42141 <para>
42142 <indexterm role="concept">
42143 <primary>maildir format</primary>
42144 <secondary>description of</secondary>
42145 </indexterm>
42146 If the <option>maildir_format</option> option is true, Exim delivers each message by writing
42147 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
42148 directory that is defined by the <option>directory</option> option (the <quote>delivery
42149 directory</quote>). If the delivery is successful, the file is renamed into the
42150 <filename>new</filename> subdirectory.
42151 </para>
42152 <para>
42153 In the file name, &lt;<emphasis>stime</emphasis>&gt; is the current time of day in seconds, and
42154 &lt;<emphasis>mtime</emphasis>&gt; is the microsecond fraction of the time. After a maildir delivery,
42155 Exim checks that the time-of-day clock has moved on by at least one microsecond
42156 before terminating the delivery process. This guarantees uniqueness for the
42157 file name. However, as a precaution, Exim calls <function>stat()</function> for the file before
42158 opening it. If any response other than ENOENT (does not exist) is given,
42159 Exim waits 2 seconds and tries again, up to <option>maildir_retries</option> times.
42160 </para>
42161 <para>
42162 Before Exim carries out a maildir delivery, it ensures that subdirectories
42163 called <filename>new</filename>, <filename>cur</filename>, and <filename>tmp</filename> exist in the delivery directory. If they
42164 do not exist, Exim tries to create them and any superior directories in their
42165 path, subject to the <option>create_directory</option> and <option>create_file</option> options. If the
42166 <option>maildirfolder_create_regex</option> option is set, and the regular expression it
42167 contains matches the delivery directory, Exim also ensures that a file called
42168 <filename>maildirfolder</filename> exists in the delivery directory. If a missing directory or
42169 <filename>maildirfolder</filename> file cannot be created, delivery is deferred.
42170 </para>
42171 <para>
42172 These features make it possible to use Exim to create all the necessary files
42173 and directories in a maildir mailbox, including subdirectories for maildir++
42174 folders. Consider this example:
42175 </para>
42176 <literallayout class="monospaced">
42177 maildir_format = true
42178 directory = /var/mail/$local_part\
42179            ${if eq{$local_part_suffix}{}{}\
42180            {/.${substr_1:$local_part_suffix}}}
42181 maildirfolder_create_regex = /\.[^/]+$
42182 </literallayout>
42183 <para>
42184 If <varname>$local_part_suffix</varname> is empty (there was no suffix for the local part),
42185 delivery is into a toplevel maildir with a name like <filename>/var/mail/pimbo</filename> (for
42186 the user called <emphasis>pimbo</emphasis>). The pattern in <option>maildirfolder_create_regex</option> does
42187 not match this name, so Exim will not look for or create the file
42188 <filename>/var/mail/pimbo/maildirfolder</filename>, though it will create
42189 <filename>/var/mail/pimbo/{cur,new,tmp}</filename> if necessary.
42190 </para>
42191 <para>
42192 However, if <varname>$local_part_suffix</varname> contains <literal>-eximusers</literal> (for example),
42193 delivery is into the maildir++ folder <filename>/var/mail/pimbo/.eximusers</filename>, which
42194 does match <option>maildirfolder_create_regex</option>. In this case, Exim will create
42195 <filename>/var/mail/pimbo/.eximusers/maildirfolder</filename> as well as the three maildir
42196 directories <filename>/var/mail/pimbo/.eximusers/{cur,new,tmp}</filename>.
42197 </para>
42198 <para>
42199 <emphasis role="bold">Warning:</emphasis> Take care when setting <option>maildirfolder_create_regex</option> that it does
42200 not inadvertently match the toplevel maildir directory, because a
42201 <filename>maildirfolder</filename> file at top level would completely break quota calculations.
42202 </para>
42203 <para>
42204 <indexterm role="concept">
42205 <primary>quota</primary>
42206 <secondary>in maildir delivery</secondary>
42207 </indexterm>
42208 <indexterm role="concept">
42209 <primary>maildir++</primary>
42210 </indexterm>
42211 If Exim is required to check a <option>quota</option> setting before a maildir delivery, and
42212 <option>quota_directory</option> is not set, it looks for a file called <filename>maildirfolder</filename> in
42213 the maildir directory (alongside <filename>new</filename>, <filename>cur</filename>, <filename>tmp</filename>). If this exists,
42214 Exim assumes the directory is a maildir++ folder directory, which is one level
42215 down from the user&#x2019;s top level mailbox directory. This causes it to start at
42216 the parent directory instead of the current directory when calculating the
42217 amount of space used.
42218 </para>
42219 <para>
42220 One problem with delivering into a multi-file mailbox is that it is
42221 computationally expensive to compute the size of the mailbox for quota
42222 checking. Various approaches have been taken to reduce the amount of work
42223 needed. The next two sections describe two of them. A third alternative is to
42224 use some external process for maintaining the size data, and use the expansion
42225 of the <option>mailbox_size</option> option as a way of importing it into Exim.
42226 </para>
42227 </section>
42228 <section id="SECID135">
42229 <title>Using tags to record message sizes</title>
42230 <para>
42231 If <option>maildir_tag</option> is set, the string is expanded for each delivery.
42232 When the maildir file is renamed into the <filename>new</filename> sub-directory, the
42233 tag is added to its name. However, if adding the tag takes the length of the
42234 name to the point where the test <function>stat()</function> call fails with ENAMETOOLONG,
42235 the tag is dropped and the maildir file is created with no tag.
42236 </para>
42237 <para>
42238 <indexterm role="variable">
42239 <primary><varname>$message_size</varname></primary>
42240 </indexterm>
42241 Tags can be used to encode the size of files in their names; see
42242 <option>quota_size_regex</option> above for an example. The expansion of <option>maildir_tag</option>
42243 happens after the message has been written. The value of the <varname>$message_size</varname>
42244 variable is set to the number of bytes actually written. If the expansion is
42245 forced to fail, the tag is ignored, but a non-forced failure causes delivery to
42246 be deferred. The expanded tag may contain any printing characters except <quote>/</quote>.
42247 Non-printing characters in the string are ignored; if the resulting string is
42248 empty, it is ignored. If it starts with an alphanumeric character, a leading
42249 colon is inserted; this default has not proven to be the path that popular
42250 maildir implementations have chosen (but changing it in Exim would break
42251 backwards compatibility).
42252 </para>
42253 <para>
42254 For one common implementation, you might set:
42255 </para>
42256 <literallayout class="monospaced">
42257 maildir_tag = ,S=${message_size}
42258 </literallayout>
42259 <para>
42260 but you should check the documentation of the other software to be sure.
42261 </para>
42262 <para>
42263 It is advisable to also set <option>quota_size_regex</option> when setting <option>maildir_tag</option>
42264 as this allows Exim to extract the size from your tag, instead of having to
42265 <function>stat()</function> each message file.
42266 </para>
42267 </section>
42268 <section id="SECID136">
42269 <title>Using a maildirsize file</title>
42270 <para>
42271 <indexterm role="concept">
42272 <primary>quota</primary>
42273 <secondary>in maildir delivery</secondary>
42274 </indexterm>
42275 <indexterm role="concept">
42276 <primary>maildir format</primary>
42277 <secondary><filename>maildirsize</filename> file</secondary>
42278 </indexterm>
42279 If <option>maildir_use_size_file</option> is true, Exim implements the maildir++ rules for
42280 storing quota and message size information in a file called <filename>maildirsize</filename>
42281 within the toplevel maildir directory. If this file does not exist, Exim
42282 creates it, setting the quota from the <option>quota</option> option of the transport. If
42283 the maildir directory itself does not exist, it is created before any attempt
42284 to write a <filename>maildirsize</filename> file.
42285 </para>
42286 <para>
42287 The <filename>maildirsize</filename> file is used to hold information about the sizes of
42288 messages in the maildir, thus speeding up quota calculations. The quota value
42289 in the file is just a cache; if the quota is changed in the transport, the new
42290 value overrides the cached value when the next message is delivered. The cache
42291 is maintained for the benefit of other programs that access the maildir and
42292 need to know the quota.
42293 </para>
42294 <para>
42295 If the <option>quota</option> option in the transport is unset or zero, the <filename>maildirsize</filename>
42296 file is maintained (with a zero quota setting), but no quota is imposed.
42297 </para>
42298 <para>
42299 A regular expression is available for controlling which directories in the
42300 maildir participate in quota calculations when a <filename>maildirsizefile</filename> is in use.
42301 See the description of the <option>maildir_quota_directory_regex</option> option above for
42302 details.
42303 </para>
42304 </section>
42305 <section id="SECID137">
42306 <title>Mailstore delivery</title>
42307 <para>
42308 <indexterm role="concept">
42309 <primary>mailstore format</primary>
42310 <secondary>description of</secondary>
42311 </indexterm>
42312 If the <option>mailstore_format</option> option is true, each message is written as two
42313 files in the given directory. A unique base name is constructed from the
42314 message id and the current delivery process, and the files that are written use
42315 this base name plus the suffixes <filename>.env</filename> and <filename>.msg</filename>. The <filename>.env</filename> file
42316 contains the message&#x2019;s envelope, and the <filename>.msg</filename> file contains the message
42317 itself. The base name is placed in the variable <varname>$mailstore_basename</varname>.
42318 </para>
42319 <para>
42320 During delivery, the envelope is first written to a file with the suffix
42321 <filename>.tmp</filename>. The <filename>.msg</filename> file is then written, and when it is complete, the
42322 <filename>.tmp</filename> file is renamed as the <filename>.env</filename> file. Programs that access messages in
42323 mailstore format should wait for the presence of both a <filename>.msg</filename> and a <filename>.env</filename>
42324 file before accessing either of them. An alternative approach is to wait for
42325 the absence of a <filename>.tmp</filename> file.
42326 </para>
42327 <para>
42328 The envelope file starts with any text defined by the <option>mailstore_prefix</option>
42329 option, expanded and terminated by a newline if there isn&#x2019;t one. Then follows
42330 the sender address on one line, then all the recipient addresses, one per line.
42331 There can be more than one recipient only if the <option>batch_max</option> option is set
42332 greater than one. Finally, <option>mailstore_suffix</option> is expanded and the result
42333 appended to the file, followed by a newline if it does not end with one.
42334 </para>
42335 <para>
42336 If expansion of <option>mailstore_prefix</option> or <option>mailstore_suffix</option> ends with a forced
42337 failure, it is ignored. Other expansion errors are treated as serious
42338 configuration errors, and delivery is deferred. The variable
42339 <varname>$mailstore_basename</varname> is available for use during these expansions.
42340 </para>
42341 </section>
42342 <section id="SECID138">
42343 <title>Non-special new file delivery</title>
42344 <para>
42345 If neither <option>maildir_format</option> nor <option>mailstore_format</option> is set, a single new
42346 file is created directly in the named directory. For example, when delivering
42347 messages into files in batched SMTP format for later delivery to some host (see
42348 section <xref linkend="SECTbatchSMTP"/>), a setting such as
42349 </para>
42350 <literallayout class="monospaced">
42351 directory = /var/bsmtp/$host
42352 </literallayout>
42353 <para>
42354 might be used. A message is written to a file with a temporary name, which is
42355 then renamed when the delivery is complete. The final name is obtained by
42356 expanding the contents of the <option>directory_file</option> option.
42357 <indexterm role="concept" startref="IIDapptra1" class="endofrange"/>
42358 <indexterm role="concept" startref="IIDapptra2" class="endofrange"/>
42359 </para>
42360 </section>
42361 </chapter>
42362
42363 <chapter id="CHID8">
42364 <title>The autoreply transport</title>
42365 <para>
42366 <indexterm role="concept" id="IIDauttra1" class="startofrange">
42367 <primary>transports</primary>
42368 <secondary><command>autoreply</command></secondary>
42369 </indexterm>
42370 <indexterm role="concept" id="IIDauttra2" class="startofrange">
42371 <primary><command>autoreply</command> transport</primary>
42372 </indexterm>
42373 The <command>autoreply</command> transport is not a true transport in that it does not cause
42374 the message to be transmitted. Instead, it generates a new mail message as an
42375 automatic reply to the incoming message. <emphasis>References:</emphasis> and
42376 <emphasis>Auto-Submitted:</emphasis> header lines are included. These are constructed according
42377 to the rules in RFCs 2822 and 3834, respectively.
42378 </para>
42379 <para>
42380 If the router that passes the message to this transport does not have the
42381 <option>unseen</option> option set, the original message (for the current recipient) is not
42382 delivered anywhere. However, when the <option>unseen</option> option is set on the router
42383 that passes the message to this transport, routing of the address continues, so
42384 another router can set up a normal message delivery.
42385 </para>
42386 <para>
42387 The <command>autoreply</command> transport is usually run as the result of mail filtering, a
42388 <quote>vacation</quote> message being the standard example. However, it can also be run
42389 directly from a router like any other transport. To reduce the possibility of
42390 message cascades, messages created by the <command>autoreply</command> transport always have
42391 empty envelope sender addresses, like bounce messages.
42392 </para>
42393 <para>
42394 The parameters of the message to be sent can be specified in the configuration
42395 by options described below. However, these are used only when the address
42396 passed to the transport does not contain its own reply information. When the
42397 transport is run as a consequence of a
42398 <option>mail</option>
42399 or <option>vacation</option> command in a filter file, the parameters of the message are
42400 supplied by the filter, and passed with the address. The transport&#x2019;s options
42401 that define the message are then ignored (so they are not usually set in this
42402 case). The message is specified entirely by the filter or by the transport; it
42403 is never built from a mixture of options. However, the <option>file_optional</option>,
42404 <option>mode</option>, and <option>return_message</option> options apply in all cases.
42405 </para>
42406 <para>
42407 <command>Autoreply</command> is implemented as a local transport. When used as a result of a
42408 command in a user&#x2019;s filter file, <command>autoreply</command> normally runs under the uid and
42409 gid of the user, and with appropriate current and home directories (see chapter
42410 <xref linkend="CHAPenvironment"/>).
42411 </para>
42412 <para>
42413 There is a subtle difference between routing a message to a <command>pipe</command> transport
42414 that generates some text to be returned to the sender, and routing it to an
42415 <command>autoreply</command> transport. This difference is noticeable only if more than one
42416 address from the same message is so handled. In the case of a pipe, the
42417 separate outputs from the different addresses are gathered up and returned to
42418 the sender in a single message, whereas if <command>autoreply</command> is used, a separate
42419 message is generated for each address that is passed to it.
42420 </para>
42421 <para>
42422 Non-printing characters are not permitted in the header lines generated for the
42423 message that <command>autoreply</command> creates, with the exception of newlines that are
42424 immediately followed by white space. If any non-printing characters are found,
42425 the transport defers.
42426 Whether characters with the top bit set count as printing characters or not is
42427 controlled by the <option>print_topbitchars</option> global option.
42428 </para>
42429 <para>
42430 If any of the generic options for manipulating headers (for example,
42431 <option>headers_add</option>) are set on an <command>autoreply</command> transport, they apply to the copy
42432 of the original message that is included in the generated message when
42433 <option>return_message</option> is set. They do not apply to the generated message itself.
42434 </para>
42435 <para>
42436 <indexterm role="variable">
42437 <primary><varname>$sender_address</varname></primary>
42438 </indexterm>
42439 If the <command>autoreply</command> transport receives return code 2 from Exim when it submits
42440 the message, indicating that there were no recipients, it does not treat this
42441 as an error. This means that autoreplies sent to <varname>$sender_address</varname> when this
42442 is empty (because the incoming message is a bounce message) do not cause
42443 problems. They are just discarded.
42444 </para>
42445 <section id="SECID139">
42446 <title>Private options for autoreply</title>
42447 <para>
42448 <indexterm role="concept">
42449 <primary>options</primary>
42450 <secondary><command>autoreply</command> transport</secondary>
42451 </indexterm>
42452 </para>
42453 <para>
42454 <indexterm role="option">
42455 <primary><option>bcc</option></primary>
42456 </indexterm>
42457 </para>
42458 <informaltable frame="all">
42459 <tgroup cols="4" colsep="0" rowsep="0">
42460 <colspec colwidth="8*" align="left"/>
42461 <colspec colwidth="6*" align="center"/>
42462 <colspec colwidth="6*" align="center"/>
42463 <colspec colwidth="6*" align="right"/>
42464 <tbody>
42465 <row>
42466 <entry><option>bcc</option></entry>
42467 <entry>Use: <emphasis>autoreply</emphasis></entry>
42468 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
42469 <entry>Default: <emphasis>unset</emphasis></entry>
42470 </row>
42471 </tbody>
42472 </tgroup>
42473 </informaltable>
42474 <para>
42475 This specifies the addresses that are to receive <quote>blind carbon copies</quote> of the
42476 message when the message is specified by the transport.
42477 </para>
42478 <para>
42479 <indexterm role="option">
42480 <primary><option>cc</option></primary>
42481 </indexterm>
42482 </para>
42483 <informaltable frame="all">
42484 <tgroup cols="4" colsep="0" rowsep="0">
42485 <colspec colwidth="8*" align="left"/>
42486 <colspec colwidth="6*" align="center"/>
42487 <colspec colwidth="6*" align="center"/>
42488 <colspec colwidth="6*" align="right"/>
42489 <tbody>
42490 <row>
42491 <entry><option>cc</option></entry>
42492 <entry>Use: <emphasis>autoreply</emphasis></entry>
42493 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
42494 <entry>Default: <emphasis>unset</emphasis></entry>
42495 </row>
42496 </tbody>
42497 </tgroup>
42498 </informaltable>
42499 <para>
42500 This specifies recipients of the message and the contents of the <emphasis>Cc:</emphasis> header
42501 when the message is specified by the transport.
42502 </para>
42503 <para>
42504 <indexterm role="option">
42505 <primary><option>file</option></primary>
42506 </indexterm>
42507 </para>
42508 <informaltable frame="all">
42509 <tgroup cols="4" colsep="0" rowsep="0">
42510 <colspec colwidth="8*" align="left"/>
42511 <colspec colwidth="6*" align="center"/>
42512 <colspec colwidth="6*" align="center"/>
42513 <colspec colwidth="6*" align="right"/>
42514 <tbody>
42515 <row>
42516 <entry><option>file</option></entry>
42517 <entry>Use: <emphasis>autoreply</emphasis></entry>
42518 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
42519 <entry>Default: <emphasis>unset</emphasis></entry>
42520 </row>
42521 </tbody>
42522 </tgroup>
42523 </informaltable>
42524 <para>
42525 The contents of the file are sent as the body of the message when the message
42526 is specified by the transport. If both <option>file</option> and <option>text</option> are set, the text
42527 string comes first.
42528 </para>
42529 <para>
42530 <indexterm role="option">
42531 <primary><option>file_expand</option></primary>
42532 </indexterm>
42533 </para>
42534 <informaltable frame="all">
42535 <tgroup cols="4" colsep="0" rowsep="0">
42536 <colspec colwidth="8*" align="left"/>
42537 <colspec colwidth="6*" align="center"/>
42538 <colspec colwidth="6*" align="center"/>
42539 <colspec colwidth="6*" align="right"/>
42540 <tbody>
42541 <row>
42542 <entry><option>file_expand</option></entry>
42543 <entry>Use: <emphasis>autoreply</emphasis></entry>
42544 <entry>Type: <emphasis>boolean</emphasis></entry>
42545 <entry>Default: <emphasis>false</emphasis></entry>
42546 </row>
42547 </tbody>
42548 </tgroup>
42549 </informaltable>
42550 <para>
42551 If this is set, the contents of the file named by the <option>file</option> option are
42552 subjected to string expansion as they are added to the message.
42553 </para>
42554 <para>
42555 <indexterm role="option">
42556 <primary><option>file_optional</option></primary>
42557 </indexterm>
42558 </para>
42559 <informaltable frame="all">
42560 <tgroup cols="4" colsep="0" rowsep="0">
42561 <colspec colwidth="8*" align="left"/>
42562 <colspec colwidth="6*" align="center"/>
42563 <colspec colwidth="6*" align="center"/>
42564 <colspec colwidth="6*" align="right"/>
42565 <tbody>
42566 <row>
42567 <entry><option>file_optional</option></entry>
42568 <entry>Use: <emphasis>autoreply</emphasis></entry>
42569 <entry>Type: <emphasis>boolean</emphasis></entry>
42570 <entry>Default: <emphasis>false</emphasis></entry>
42571 </row>
42572 </tbody>
42573 </tgroup>
42574 </informaltable>
42575 <para>
42576 If this option is true, no error is generated if the file named by the <option>file</option>
42577 option or passed with the address does not exist or cannot be read.
42578 </para>
42579 <para>
42580 <indexterm role="option">
42581 <primary><option>from</option></primary>
42582 </indexterm>
42583 </para>
42584 <informaltable frame="all">
42585 <tgroup cols="4" colsep="0" rowsep="0">
42586 <colspec colwidth="8*" align="left"/>
42587 <colspec colwidth="6*" align="center"/>
42588 <colspec colwidth="6*" align="center"/>
42589 <colspec colwidth="6*" align="right"/>
42590 <tbody>
42591 <row>
42592 <entry><option>from</option></entry>
42593 <entry>Use: <emphasis>autoreply</emphasis></entry>
42594 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
42595 <entry>Default: <emphasis>unset</emphasis></entry>
42596 </row>
42597 </tbody>
42598 </tgroup>
42599 </informaltable>
42600 <para>
42601 This specifies the contents of the <emphasis>From:</emphasis> header when the message is
42602 specified by the transport.
42603 </para>
42604 <para>
42605 <indexterm role="option">
42606 <primary><option>headers</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>headers</option></entry>
42618 <entry>Use: <emphasis>autoreply</emphasis></entry>
42619 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
42620 <entry>Default: <emphasis>unset</emphasis></entry>
42621 </row>
42622 </tbody>
42623 </tgroup>
42624 </informaltable>
42625 <para>
42626 This specifies additional RFC 2822 headers that are to be added to the message
42627 when the message is specified by the transport. Several can be given by using
42628 <quote>\n</quote> to separate them. There is no check on the format.
42629 </para>
42630 <para>
42631 <indexterm role="option">
42632 <primary><option>log</option></primary>
42633 </indexterm>
42634 </para>
42635 <informaltable frame="all">
42636 <tgroup cols="4" colsep="0" rowsep="0">
42637 <colspec colwidth="8*" align="left"/>
42638 <colspec colwidth="6*" align="center"/>
42639 <colspec colwidth="6*" align="center"/>
42640 <colspec colwidth="6*" align="right"/>
42641 <tbody>
42642 <row>
42643 <entry><option>log</option></entry>
42644 <entry>Use: <emphasis>autoreply</emphasis></entry>
42645 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
42646 <entry>Default: <emphasis>unset</emphasis></entry>
42647 </row>
42648 </tbody>
42649 </tgroup>
42650 </informaltable>
42651 <para>
42652 This option names a file in which a record of every message sent is logged when
42653 the message is specified by the transport.
42654 </para>
42655 <para>
42656 <indexterm role="option">
42657 <primary><option>mode</option></primary>
42658 </indexterm>
42659 </para>
42660 <informaltable frame="all">
42661 <tgroup cols="4" colsep="0" rowsep="0">
42662 <colspec colwidth="8*" align="left"/>
42663 <colspec colwidth="6*" align="center"/>
42664 <colspec colwidth="6*" align="center"/>
42665 <colspec colwidth="6*" align="right"/>
42666 <tbody>
42667 <row>
42668 <entry><option>mode</option></entry>
42669 <entry>Use: <emphasis>autoreply</emphasis></entry>
42670 <entry>Type: <emphasis>octal integer</emphasis></entry>
42671 <entry>Default: <emphasis>0600</emphasis></entry>
42672 </row>
42673 </tbody>
42674 </tgroup>
42675 </informaltable>
42676 <para>
42677 If either the log file or the <quote>once</quote> file has to be created, this mode is
42678 used.
42679 </para>
42680 <para>
42681 <indexterm role="option">
42682 <primary><option>never_mail</option></primary>
42683 </indexterm>
42684 </para>
42685 <informaltable frame="all">
42686 <tgroup cols="4" colsep="0" rowsep="0">
42687 <colspec colwidth="8*" align="left"/>
42688 <colspec colwidth="6*" align="center"/>
42689 <colspec colwidth="6*" align="center"/>
42690 <colspec colwidth="6*" align="right"/>
42691 <tbody>
42692 <row>
42693 <entry><option>never_mail</option></entry>
42694 <entry>Use: <emphasis>autoreply</emphasis></entry>
42695 <entry>Type: <emphasis>address list</emphasis>&dagger;<emphasis></emphasis></entry>
42696 <entry>Default: <emphasis>unset</emphasis></entry>
42697 </row>
42698 </tbody>
42699 </tgroup>
42700 </informaltable>
42701 <para>
42702 If any run of the transport creates a message with a recipient that matches any
42703 item in the list, that recipient is quietly discarded. If all recipients are
42704 discarded, no message is created. This applies both when the recipients are
42705 generated by a filter and when they are specified in the transport.
42706 </para>
42707 <para>
42708 <indexterm role="option">
42709 <primary><option>once</option></primary>
42710 </indexterm>
42711 </para>
42712 <informaltable frame="all">
42713 <tgroup cols="4" colsep="0" rowsep="0">
42714 <colspec colwidth="8*" align="left"/>
42715 <colspec colwidth="6*" align="center"/>
42716 <colspec colwidth="6*" align="center"/>
42717 <colspec colwidth="6*" align="right"/>
42718 <tbody>
42719 <row>
42720 <entry><option>once</option></entry>
42721 <entry>Use: <emphasis>autoreply</emphasis></entry>
42722 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
42723 <entry>Default: <emphasis>unset</emphasis></entry>
42724 </row>
42725 </tbody>
42726 </tgroup>
42727 </informaltable>
42728 <para>
42729 This option names a file or DBM database in which a record of each <emphasis>To:</emphasis>
42730 recipient is kept when the message is specified by the transport. <emphasis role="bold">Note</emphasis>:
42731 This does not apply to <emphasis>Cc:</emphasis> or <emphasis>Bcc:</emphasis> recipients.
42732 </para>
42733 <para>
42734 If <option>once</option> is unset, or is set to an empty string, the message is always sent.
42735 By default, if <option>once</option> is set to a non-empty file name, the message
42736 is not sent if a potential recipient is already listed in the database.
42737 However, if the <option>once_repeat</option> option specifies a time greater than zero, the
42738 message is sent if that much time has elapsed since a message was last sent to
42739 this recipient. A setting of zero time for <option>once_repeat</option> (the default)
42740 prevents a message from being sent a second time &ndash; in this case, zero means
42741 infinity.
42742 </para>
42743 <para>
42744 If <option>once_file_size</option> is zero, a DBM database is used to remember recipients,
42745 and it is allowed to grow as large as necessary. If <option>once_file_size</option> is set
42746 greater than zero, it changes the way Exim implements the <option>once</option> option.
42747 Instead of using a DBM file to record every recipient it sends to, it uses a
42748 regular file, whose size will never get larger than the given value.
42749 </para>
42750 <para>
42751 In the file, Exim keeps a linear list of recipient addresses and the times at
42752 which they were sent messages. If the file is full when a new address needs to
42753 be added, the oldest address is dropped. If <option>once_repeat</option> is not set, this
42754 means that a given recipient may receive multiple messages, but at
42755 unpredictable intervals that depend on the rate of turnover of addresses in the
42756 file. If <option>once_repeat</option> is set, it specifies a maximum time between repeats.
42757 </para>
42758 <para>
42759 <indexterm role="option">
42760 <primary><option>once_file_size</option></primary>
42761 </indexterm>
42762 </para>
42763 <informaltable frame="all">
42764 <tgroup cols="4" colsep="0" rowsep="0">
42765 <colspec colwidth="8*" align="left"/>
42766 <colspec colwidth="6*" align="center"/>
42767 <colspec colwidth="6*" align="center"/>
42768 <colspec colwidth="6*" align="right"/>
42769 <tbody>
42770 <row>
42771 <entry><option>once_file_size</option></entry>
42772 <entry>Use: <emphasis>autoreply</emphasis></entry>
42773 <entry>Type: <emphasis>integer</emphasis></entry>
42774 <entry>Default: <emphasis>0</emphasis></entry>
42775 </row>
42776 </tbody>
42777 </tgroup>
42778 </informaltable>
42779 <para>
42780 See <option>once</option> above.
42781 </para>
42782 <para>
42783 <indexterm role="option">
42784 <primary><option>once_repeat</option></primary>
42785 </indexterm>
42786 </para>
42787 <informaltable frame="all">
42788 <tgroup cols="4" colsep="0" rowsep="0">
42789 <colspec colwidth="8*" align="left"/>
42790 <colspec colwidth="6*" align="center"/>
42791 <colspec colwidth="6*" align="center"/>
42792 <colspec colwidth="6*" align="right"/>
42793 <tbody>
42794 <row>
42795 <entry><option>once_repeat</option></entry>
42796 <entry>Use: <emphasis>autoreply</emphasis></entry>
42797 <entry>Type: <emphasis>time</emphasis>&dagger;<emphasis></emphasis></entry>
42798 <entry>Default: <emphasis>0s</emphasis></entry>
42799 </row>
42800 </tbody>
42801 </tgroup>
42802 </informaltable>
42803 <para>
42804 See <option>once</option> above.
42805 After expansion, the value of this option must be a valid time value.
42806 </para>
42807 <para>
42808 <indexterm role="option">
42809 <primary><option>reply_to</option></primary>
42810 </indexterm>
42811 </para>
42812 <informaltable frame="all">
42813 <tgroup cols="4" colsep="0" rowsep="0">
42814 <colspec colwidth="8*" align="left"/>
42815 <colspec colwidth="6*" align="center"/>
42816 <colspec colwidth="6*" align="center"/>
42817 <colspec colwidth="6*" align="right"/>
42818 <tbody>
42819 <row>
42820 <entry><option>reply_to</option></entry>
42821 <entry>Use: <emphasis>autoreply</emphasis></entry>
42822 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
42823 <entry>Default: <emphasis>unset</emphasis></entry>
42824 </row>
42825 </tbody>
42826 </tgroup>
42827 </informaltable>
42828 <para>
42829 This specifies the contents of the <emphasis>Reply-To:</emphasis> header when the message is
42830 specified by the transport.
42831 </para>
42832 <para>
42833 <indexterm role="option">
42834 <primary><option>return_message</option></primary>
42835 </indexterm>
42836 </para>
42837 <informaltable frame="all">
42838 <tgroup cols="4" colsep="0" rowsep="0">
42839 <colspec colwidth="8*" align="left"/>
42840 <colspec colwidth="6*" align="center"/>
42841 <colspec colwidth="6*" align="center"/>
42842 <colspec colwidth="6*" align="right"/>
42843 <tbody>
42844 <row>
42845 <entry><option>return_message</option></entry>
42846 <entry>Use: <emphasis>autoreply</emphasis></entry>
42847 <entry>Type: <emphasis>boolean</emphasis></entry>
42848 <entry>Default: <emphasis>false</emphasis></entry>
42849 </row>
42850 </tbody>
42851 </tgroup>
42852 </informaltable>
42853 <para>
42854 If this is set, a copy of the original message is returned with the new
42855 message, subject to the maximum size set in the <option>return_size_limit</option> global
42856 configuration option.
42857 </para>
42858 <para>
42859 <indexterm role="option">
42860 <primary><option>subject</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>subject</option></entry>
42872 <entry>Use: <emphasis>autoreply</emphasis></entry>
42873 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
42874 <entry>Default: <emphasis>unset</emphasis></entry>
42875 </row>
42876 </tbody>
42877 </tgroup>
42878 </informaltable>
42879 <para>
42880 This specifies the contents of the <emphasis>Subject:</emphasis> header when the message is
42881 specified by the transport. It is tempting to quote the original subject in
42882 automatic responses. For example:
42883 </para>
42884 <literallayout class="monospaced">
42885 subject = Re: $h_subject:
42886 </literallayout>
42887 <para>
42888 There is a danger in doing this, however. It may allow a third party to
42889 subscribe your users to an opt-in mailing list, provided that the list accepts
42890 bounce messages as subscription confirmations. Well-managed lists require a
42891 non-bounce message to confirm a subscription, so the danger is relatively
42892 small.
42893 </para>
42894 <para>
42895 <indexterm role="option">
42896 <primary><option>text</option></primary>
42897 </indexterm>
42898 </para>
42899 <informaltable frame="all">
42900 <tgroup cols="4" colsep="0" rowsep="0">
42901 <colspec colwidth="8*" align="left"/>
42902 <colspec colwidth="6*" align="center"/>
42903 <colspec colwidth="6*" align="center"/>
42904 <colspec colwidth="6*" align="right"/>
42905 <tbody>
42906 <row>
42907 <entry><option>text</option></entry>
42908 <entry>Use: <emphasis>autoreply</emphasis></entry>
42909 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
42910 <entry>Default: <emphasis>unset</emphasis></entry>
42911 </row>
42912 </tbody>
42913 </tgroup>
42914 </informaltable>
42915 <para>
42916 This specifies a single string to be used as the body of the message when the
42917 message is specified by the transport. If both <option>text</option> and <option>file</option> are set,
42918 the text comes first.
42919 </para>
42920 <para>
42921 <indexterm role="option">
42922 <primary><option>to</option></primary>
42923 </indexterm>
42924 </para>
42925 <informaltable frame="all">
42926 <tgroup cols="4" colsep="0" rowsep="0">
42927 <colspec colwidth="8*" align="left"/>
42928 <colspec colwidth="6*" align="center"/>
42929 <colspec colwidth="6*" align="center"/>
42930 <colspec colwidth="6*" align="right"/>
42931 <tbody>
42932 <row>
42933 <entry><option>to</option></entry>
42934 <entry>Use: <emphasis>autoreply</emphasis></entry>
42935 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
42936 <entry>Default: <emphasis>unset</emphasis></entry>
42937 </row>
42938 </tbody>
42939 </tgroup>
42940 </informaltable>
42941 <para>
42942 This specifies recipients of the message and the contents of the <emphasis>To:</emphasis> header
42943 when the message is specified by the transport.
42944 <indexterm role="concept" startref="IIDauttra1" class="endofrange"/>
42945 <indexterm role="concept" startref="IIDauttra2" class="endofrange"/>
42946 </para>
42947 </section>
42948 </chapter>
42949
42950 <chapter id="CHAPLMTP">
42951 <title>The lmtp transport</title>
42952 <para>
42953 <indexterm role="concept">
42954 <primary>transports</primary>
42955 <secondary><command>lmtp</command></secondary>
42956 </indexterm>
42957 <indexterm role="concept">
42958 <primary><command>lmtp</command> transport</primary>
42959 </indexterm>
42960 <indexterm role="concept">
42961 <primary>LMTP</primary>
42962 <secondary>over a pipe</secondary>
42963 </indexterm>
42964 <indexterm role="concept">
42965 <primary>LMTP</primary>
42966 <secondary>over a socket</secondary>
42967 </indexterm>
42968 The <command>lmtp</command> transport runs the LMTP protocol (RFC 2033) over a pipe to a
42969 specified command
42970 or by interacting with a Unix domain socket.
42971 This transport is something of a cross between the <command>pipe</command> and <command>smtp</command>
42972 transports. Exim also has support for using LMTP over TCP/IP; this is
42973 implemented as an option for the <command>smtp</command> transport. Because LMTP is expected
42974 to be of minority interest, the default build-time configure in <filename>src/EDITME</filename>
42975 has it commented out. You need to ensure that
42976 </para>
42977 <literallayout class="monospaced">
42978 TRANSPORT_LMTP=yes
42979 </literallayout>
42980 <para>
42981 <indexterm role="concept">
42982 <primary>options</primary>
42983 <secondary><command>lmtp</command> transport</secondary>
42984 </indexterm>
42985 is present in your <filename>Local/Makefile</filename> in order to have the <command>lmtp</command> transport
42986 included in the Exim binary. The private options of the <command>lmtp</command> transport are
42987 as follows:
42988 </para>
42989 <para>
42990 <indexterm role="option">
42991 <primary><option>batch_id</option></primary>
42992 </indexterm>
42993 </para>
42994 <informaltable frame="all">
42995 <tgroup cols="4" colsep="0" rowsep="0">
42996 <colspec colwidth="8*" align="left"/>
42997 <colspec colwidth="6*" align="center"/>
42998 <colspec colwidth="6*" align="center"/>
42999 <colspec colwidth="6*" align="right"/>
43000 <tbody>
43001 <row>
43002 <entry><option>batch_id</option></entry>
43003 <entry>Use: <emphasis>lmtp</emphasis></entry>
43004 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
43005 <entry>Default: <emphasis>unset</emphasis></entry>
43006 </row>
43007 </tbody>
43008 </tgroup>
43009 </informaltable>
43010 <para>
43011 See the description of local delivery batching in chapter <xref linkend="CHAPbatching"/>.
43012 </para>
43013 <para>
43014 <indexterm role="option">
43015 <primary><option>batch_max</option></primary>
43016 </indexterm>
43017 </para>
43018 <informaltable frame="all">
43019 <tgroup cols="4" colsep="0" rowsep="0">
43020 <colspec colwidth="8*" align="left"/>
43021 <colspec colwidth="6*" align="center"/>
43022 <colspec colwidth="6*" align="center"/>
43023 <colspec colwidth="6*" align="right"/>
43024 <tbody>
43025 <row>
43026 <entry><option>batch_max</option></entry>
43027 <entry>Use: <emphasis>lmtp</emphasis></entry>
43028 <entry>Type: <emphasis>integer</emphasis></entry>
43029 <entry>Default: <emphasis>1</emphasis></entry>
43030 </row>
43031 </tbody>
43032 </tgroup>
43033 </informaltable>
43034 <para>
43035 This limits the number of addresses that can be handled in a single delivery.
43036 Most LMTP servers can handle several addresses at once, so it is normally a
43037 good idea to increase this value. See the description of local delivery
43038 batching in chapter <xref linkend="CHAPbatching"/>.
43039 </para>
43040 <para>
43041 <indexterm role="option">
43042 <primary><option>command</option></primary>
43043 </indexterm>
43044 </para>
43045 <informaltable frame="all">
43046 <tgroup cols="4" colsep="0" rowsep="0">
43047 <colspec colwidth="8*" align="left"/>
43048 <colspec colwidth="6*" align="center"/>
43049 <colspec colwidth="6*" align="center"/>
43050 <colspec colwidth="6*" align="right"/>
43051 <tbody>
43052 <row>
43053 <entry><option>command</option></entry>
43054 <entry>Use: <emphasis>lmtp</emphasis></entry>
43055 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
43056 <entry>Default: <emphasis>unset</emphasis></entry>
43057 </row>
43058 </tbody>
43059 </tgroup>
43060 </informaltable>
43061 <para>
43062 This option must be set if <option>socket</option> is not set. The string is a command which
43063 is run in a separate process. It is split up into a command name and list of
43064 arguments, each of which is separately expanded (so expansion cannot change the
43065 number of arguments). The command is run directly, not via a shell. The message
43066 is passed to the new process using the standard input and output to operate the
43067 LMTP protocol.
43068 </para>
43069 <para>
43070 <indexterm role="option">
43071 <primary><option>ignore_quota</option></primary>
43072 </indexterm>
43073 </para>
43074 <informaltable frame="all">
43075 <tgroup cols="4" colsep="0" rowsep="0">
43076 <colspec colwidth="8*" align="left"/>
43077 <colspec colwidth="6*" align="center"/>
43078 <colspec colwidth="6*" align="center"/>
43079 <colspec colwidth="6*" align="right"/>
43080 <tbody>
43081 <row>
43082 <entry><option>ignore_quota</option></entry>
43083 <entry>Use: <emphasis>lmtp</emphasis></entry>
43084 <entry>Type: <emphasis>boolean</emphasis></entry>
43085 <entry>Default: <emphasis>false</emphasis></entry>
43086 </row>
43087 </tbody>
43088 </tgroup>
43089 </informaltable>
43090 <para>
43091 <indexterm role="concept">
43092 <primary>LMTP</primary>
43093 <secondary>ignoring quota errors</secondary>
43094 </indexterm>
43095 If this option is set true, the string <literal>IGNOREQUOTA</literal> is added to RCPT
43096 commands, provided that the LMTP server has advertised support for IGNOREQUOTA
43097 in its response to the LHLO command.
43098 </para>
43099 <para>
43100 <indexterm role="option">
43101 <primary><option>socket</option></primary>
43102 </indexterm>
43103 </para>
43104 <informaltable frame="all">
43105 <tgroup cols="4" colsep="0" rowsep="0">
43106 <colspec colwidth="8*" align="left"/>
43107 <colspec colwidth="6*" align="center"/>
43108 <colspec colwidth="6*" align="center"/>
43109 <colspec colwidth="6*" align="right"/>
43110 <tbody>
43111 <row>
43112 <entry><option>socket</option></entry>
43113 <entry>Use: <emphasis>lmtp</emphasis></entry>
43114 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
43115 <entry>Default: <emphasis>unset</emphasis></entry>
43116 </row>
43117 </tbody>
43118 </tgroup>
43119 </informaltable>
43120 <para>
43121 This option must be set if <option>command</option> is not set. The result of expansion must
43122 be the name of a Unix domain socket. The transport connects to the socket and
43123 delivers the message to it using the LMTP protocol.
43124 </para>
43125 <para>
43126 <indexterm role="option">
43127 <primary><option>timeout</option></primary>
43128 </indexterm>
43129 </para>
43130 <informaltable frame="all">
43131 <tgroup cols="4" colsep="0" rowsep="0">
43132 <colspec colwidth="8*" align="left"/>
43133 <colspec colwidth="6*" align="center"/>
43134 <colspec colwidth="6*" align="center"/>
43135 <colspec colwidth="6*" align="right"/>
43136 <tbody>
43137 <row>
43138 <entry><option>timeout</option></entry>
43139 <entry>Use: <emphasis>lmtp</emphasis></entry>
43140 <entry>Type: <emphasis>time</emphasis></entry>
43141 <entry>Default: <emphasis>5m</emphasis></entry>
43142 </row>
43143 </tbody>
43144 </tgroup>
43145 </informaltable>
43146 <para>
43147 The transport is aborted if the created process or Unix domain socket does not
43148 respond to LMTP commands or message input within this timeout. Delivery
43149 is deferred, and will be tried again later. Here is an example of a typical
43150 LMTP transport:
43151 </para>
43152 <literallayout class="monospaced">
43153 lmtp:
43154   driver = lmtp
43155   command = /some/local/lmtp/delivery/program
43156   batch_max = 20
43157   user = exim
43158 </literallayout>
43159 <para>
43160 This delivers up to 20 addresses at a time, in a mixture of domains if
43161 necessary, running as the user <emphasis>exim</emphasis>.
43162 </para>
43163 </chapter>
43164
43165 <chapter id="CHAPpipetransport">
43166 <title>The pipe transport</title>
43167 <para>
43168 <indexterm role="concept" id="IIDpiptra1" class="startofrange">
43169 <primary>transports</primary>
43170 <secondary><command>pipe</command></secondary>
43171 </indexterm>
43172 <indexterm role="concept" id="IIDpiptra2" class="startofrange">
43173 <primary><command>pipe</command> transport</primary>
43174 </indexterm>
43175 The <command>pipe</command> transport is used to deliver messages via a pipe to a command
43176 running in another process. One example is the use of <command>pipe</command> as a
43177 pseudo-remote transport for passing messages to some other delivery mechanism
43178 (such as UUCP). Another is the use by individual users to automatically process
43179 their incoming messages. The <command>pipe</command> transport can be used in one of the
43180 following ways:
43181 </para>
43182 <itemizedlist>
43183 <listitem>
43184 <para>
43185 <indexterm role="variable">
43186 <primary><varname>$local_part</varname></primary>
43187 </indexterm>
43188 A router routes one address to a transport in the normal way, and the
43189 transport is configured as a <command>pipe</command> transport. In this case, <varname>$local_part</varname>
43190 contains the local part of the address (as usual), and the command that is run
43191 is specified by the <option>command</option> option on the transport.
43192 </para>
43193 </listitem>
43194 <listitem>
43195 <para>
43196 <indexterm role="variable">
43197 <primary><varname>$pipe_addresses</varname></primary>
43198 </indexterm>
43199 If the <option>batch_max</option> option is set greater than 1 (the default is 1), the
43200 transport can handle more than one address in a single run. In this case, when
43201 more than one address is routed to the transport, <varname>$local_part</varname> is not set
43202 (because it is not unique). However, the pseudo-variable <varname>$pipe_addresses</varname>
43203 (described in section <xref linkend="SECThowcommandrun"/> below) contains all the addresses
43204 that are routed to the transport.
43205 </para>
43206 </listitem>
43207 <listitem>
43208 <para>
43209 <indexterm role="variable">
43210 <primary><varname>$address_pipe</varname></primary>
43211 </indexterm>
43212 A router redirects an address directly to a pipe command (for example, from an
43213 alias or forward file). In this case, <varname>$address_pipe</varname> contains the text of the
43214 pipe command, and the <option>command</option> option on the transport is ignored unless
43215 <option>force_command</option> is set. If only one address is being transported
43216 (<option>batch_max</option> is not greater than one, or only one address was redirected to
43217 this pipe command), <varname>$local_part</varname> contains the local part that was redirected.
43218 </para>
43219 </listitem>
43220 </itemizedlist>
43221 <para>
43222 The <command>pipe</command> transport is a non-interactive delivery method. Exim can also
43223 deliver messages over pipes using the LMTP interactive protocol. This is
43224 implemented by the <command>lmtp</command> transport.
43225 </para>
43226 <para>
43227 In the case when <command>pipe</command> is run as a consequence of an entry in a local user&#x2019;s
43228 <filename>.forward</filename> file, the command runs under the uid and gid of that user. In
43229 other cases, the uid and gid have to be specified explicitly, either on the
43230 transport or on the router that handles the address. Current and <quote>home</quote>
43231 directories are also controllable. See chapter <xref linkend="CHAPenvironment"/> for
43232 details of the local delivery environment and chapter <xref linkend="CHAPbatching"/>
43233 for a discussion of local delivery batching.
43234 </para>
43235 <section id="SECID140">
43236 <title>Concurrent delivery</title>
43237 <para>
43238 If two messages arrive at almost the same time, and both are routed to a pipe
43239 delivery, the two pipe transports may be run concurrently. You must ensure that
43240 any pipe commands you set up are robust against this happening. If the commands
43241 write to a file, the <option>exim_lock</option> utility might be of use.
43242 </para>
43243 </section>
43244 <section id="SECID141">
43245 <title>Returned status and data</title>
43246 <para>
43247 <indexterm role="concept">
43248 <primary><command>pipe</command> transport</primary>
43249 <secondary>returned data</secondary>
43250 </indexterm>
43251 If the command exits with a non-zero return code, the delivery is deemed to
43252 have failed, unless either the <option>ignore_status</option> option is set (in which case
43253 the return code is treated as zero), or the return code is one of those listed
43254 in the <option>temp_errors</option> option, which are interpreted as meaning <quote>try again
43255 later</quote>. In this case, delivery is deferred. Details of a permanent failure are
43256 logged, but are not included in the bounce message, which merely contains
43257 <quote>local delivery failed</quote>.
43258 </para>
43259 <para>
43260 If the command exits on a signal and the <option>freeze_signal</option> option is set then
43261 the message will be frozen in the queue. If that option is not set, a bounce
43262 will be sent as normal.
43263 </para>
43264 <para>
43265 If the return code is greater than 128 and the command being run is a shell
43266 script, it normally means that the script was terminated by a signal whose
43267 value is the return code minus 128. The <option>freeze_signal</option> option does not
43268 apply in this case.
43269 </para>
43270 <para>
43271 If Exim is unable to run the command (that is, if <function>execve()</function> fails), the
43272 return code is set to 127. This is the value that a shell returns if it is
43273 asked to run a non-existent command. The wording for the log line suggests that
43274 a non-existent command may be the problem.
43275 </para>
43276 <para>
43277 The <option>return_output</option> option can affect the result of a pipe delivery. If it is
43278 set and the command produces any output on its standard output or standard
43279 error streams, the command is considered to have failed, even if it gave a zero
43280 return code or if <option>ignore_status</option> is set. The output from the command is
43281 included as part of the bounce message. The <option>return_fail_output</option> option is
43282 similar, except that output is returned only when the command exits with a
43283 failure return code, that is, a value other than zero or a code that matches
43284 <option>temp_errors</option>.
43285 </para>
43286 </section>
43287 <section id="SECThowcommandrun">
43288 <title>How the command is run</title>
43289 <para>
43290 <indexterm role="concept">
43291 <primary><command>pipe</command> transport</primary>
43292 <secondary>path for command</secondary>
43293 </indexterm>
43294 The command line is (by default) broken down into a command name and arguments
43295 by the <command>pipe</command> transport itself. The <option>allow_commands</option> and
43296 <option>restrict_to_path</option> options can be used to restrict the commands that may be
43297 run.
43298 </para>
43299 <para>
43300 <indexterm role="concept">
43301 <primary>quoting</primary>
43302 <secondary>in pipe command</secondary>
43303 </indexterm>
43304 Unquoted arguments are delimited by white space. If an argument appears in
43305 double quotes, backslash is interpreted as an escape character in the usual
43306 way. If an argument appears in single quotes, no escaping is done.
43307 </para>
43308 <para>
43309 String expansion is applied to the command line except when it comes from a
43310 traditional <filename>.forward</filename> file (commands from a filter file are expanded). The
43311 expansion is applied to each argument in turn rather than to the whole line.
43312 For this reason, any string expansion item that contains white space must be
43313 quoted so as to be contained within a single argument. A setting such as
43314 </para>
43315 <literallayout class="monospaced">
43316 command = /some/path ${if eq{$local_part}{postmaster}{xx}{yy}}
43317 </literallayout>
43318 <para>
43319 will not work, because the expansion item gets split between several
43320 arguments. You have to write
43321 </para>
43322 <literallayout class="monospaced">
43323 command = /some/path "${if eq{$local_part}{postmaster}{xx}{yy}}"
43324 </literallayout>
43325 <para>
43326 to ensure that it is all in one argument. The expansion is done in this way,
43327 argument by argument, so that the number of arguments cannot be changed as a
43328 result of expansion, and quotes or backslashes in inserted variables do not
43329 interact with external quoting. However, this leads to problems if you want to
43330 generate multiple arguments (or the command name plus arguments) from a single
43331 expansion. In this situation, the simplest solution is to use a shell. For
43332 example:
43333 </para>
43334 <literallayout class="monospaced">
43335 command = /bin/sh -c ${lookup{$local_part}lsearch{/some/file}}
43336 </literallayout>
43337 <para>
43338 <indexterm role="concept">
43339 <primary>transport</primary>
43340 <secondary>filter</secondary>
43341 </indexterm>
43342 <indexterm role="concept">
43343 <primary>filter</primary>
43344 <secondary>transport filter</secondary>
43345 </indexterm>
43346 <indexterm role="variable">
43347 <primary><varname>$pipe_addresses</varname></primary>
43348 </indexterm>
43349 Special handling takes place when an argument consists of precisely the text
43350 <literal>$pipe_addresses</literal>. This is not a general expansion variable; the only
43351 place this string is recognized is when it appears as an argument for a pipe or
43352 transport filter command. It causes each address that is being handled to be
43353 inserted in the argument list at that point <emphasis>as a separate argument</emphasis>. This
43354 avoids any problems with spaces or shell metacharacters, and is of use when a
43355 <command>pipe</command> transport is handling groups of addresses in a batch.
43356 </para>
43357 <para>
43358 If <option>force_command</option> is enabled on the transport, Special handling takes place
43359 for an argument that consists of precisely the text <literal>$address_pipe</literal>.  It
43360 is handled similarly to <varname>$pipe_addresses</varname> above.  It is expanded and each
43361 argument is inserted in the argument list at that point
43362 <emphasis>as a separate argument</emphasis>.  The <literal>$address_pipe</literal> item does not need to be
43363 the only item in the argument; in fact, if it were then <option>force_command</option>
43364 should behave as a no-op.  Rather, it should be used to adjust the command
43365 run while preserving the argument vector separation.
43366 </para>
43367 <para>
43368 After splitting up into arguments and expansion, the resulting command is run
43369 in a subprocess directly from the transport, <emphasis>not</emphasis> under a shell. The
43370 message that is being delivered is supplied on the standard input, and the
43371 standard output and standard error are both connected to a single pipe that is
43372 read by Exim. The <option>max_output</option> option controls how much output the command
43373 may produce, and the <option>return_output</option> and <option>return_fail_output</option> options
43374 control what is done with it.
43375 </para>
43376 <para>
43377 Not running the command under a shell (by default) lessens the security risks
43378 in cases when a command from a user&#x2019;s filter file is built out of data that was
43379 taken from an incoming message. If a shell is required, it can of course be
43380 explicitly specified as the command to be run. However, there are circumstances
43381 where existing commands (for example, in <filename>.forward</filename> files) expect to be run
43382 under a shell and cannot easily be modified. To allow for these cases, there is
43383 an option called <option>use_shell</option>, which changes the way the <command>pipe</command> transport
43384 works. Instead of breaking up the command line as just described, it expands it
43385 as a single string and passes the result to <filename>/bin/sh</filename>. The
43386 <option>restrict_to_path</option> option and the <varname>$pipe_addresses</varname> facility cannot be used
43387 with <option>use_shell</option>, and the whole mechanism is inherently less secure.
43388 </para>
43389 </section>
43390 <section id="SECTpipeenv">
43391 <title>Environment variables</title>
43392 <para>
43393 <indexterm role="concept">
43394 <primary><command>pipe</command> transport</primary>
43395 <secondary>environment for command</secondary>
43396 </indexterm>
43397 <indexterm role="concept">
43398 <primary>environment for pipe transport</primary>
43399 </indexterm>
43400 The environment variables listed below are set up when the command is invoked.
43401 This list is a compromise for maximum compatibility with other MTAs. Note that
43402 the <option>environment</option> option can be used to add additional variables to this
43403 environment.
43404 </para>
43405 <literallayout>
43406 <literal>DOMAIN            </literal>   the domain of the address
43407 <literal>HOME              </literal>   the home directory, if set
43408 <literal>HOST              </literal>   the host name when called from a router (see below)
43409 <literal>LOCAL_PART        </literal>   see below
43410 <literal>LOCAL_PART_PREFIX </literal>   see below
43411 <literal>LOCAL_PART_SUFFIX </literal>   see below
43412 <literal>LOGNAME           </literal>   see below
43413 <literal>MESSAGE_ID        </literal>   Exim&#x2019;s local ID for the message
43414 <literal>PATH              </literal>   as specified by the <option>path</option> option below
43415 <literal>QUALIFY_DOMAIN    </literal>   the sender qualification domain
43416 <literal>RECIPIENT         </literal>   the complete recipient address
43417 <literal>SENDER            </literal>   the sender of the message (empty if a bounce)
43418 <literal>SHELL             </literal>   <literal>/bin/sh</literal>
43419 <literal>TZ                </literal>   the value of the <option>timezone</option> option, if set
43420 <literal>USER              </literal>   see below
43421 </literallayout>
43422 <para>
43423 When a <command>pipe</command> transport is called directly from (for example) an <command>accept</command>
43424 router, LOCAL_PART is set to the local part of the address. When it is
43425 called as a result of a forward or alias expansion, LOCAL_PART is set to
43426 the local part of the address that was expanded. In both cases, any affixes are
43427 removed from the local part, and made available in LOCAL_PART_PREFIX and
43428 LOCAL_PART_SUFFIX, respectively. LOGNAME and USER are set to the
43429 same value as LOCAL_PART for compatibility with other MTAs.
43430 </para>
43431 <para>
43432 <indexterm role="concept">
43433 <primary>HOST</primary>
43434 </indexterm>
43435 HOST is set only when a <command>pipe</command> transport is called from a router that
43436 associates hosts with an address, typically when using <command>pipe</command> as a
43437 pseudo-remote transport. HOST is set to the first host name specified by
43438 the router.
43439 </para>
43440 <para>
43441 <indexterm role="concept">
43442 <primary>HOME</primary>
43443 </indexterm>
43444 If the transport&#x2019;s generic <option>home_directory</option> option is set, its value is used
43445 for the HOME environment variable. Otherwise, a home directory may be set
43446 by the router&#x2019;s <option>transport_home_directory</option> option, which defaults to the
43447 user&#x2019;s home directory if <option>check_local_user</option> is set.
43448 </para>
43449 </section>
43450 <section id="SECID142">
43451 <title>Private options for pipe</title>
43452 <para>
43453 <indexterm role="concept">
43454 <primary>options</primary>
43455 <secondary><command>pipe</command> transport</secondary>
43456 </indexterm>
43457 </para>
43458 <para>
43459 <indexterm role="option">
43460 <primary><option>allow_commands</option></primary>
43461 </indexterm>
43462 </para>
43463 <informaltable frame="all">
43464 <tgroup cols="4" colsep="0" rowsep="0">
43465 <colspec colwidth="8*" align="left"/>
43466 <colspec colwidth="6*" align="center"/>
43467 <colspec colwidth="6*" align="center"/>
43468 <colspec colwidth="6*" align="right"/>
43469 <tbody>
43470 <row>
43471 <entry><option>allow_commands</option></entry>
43472 <entry>Use: <emphasis>pipe</emphasis></entry>
43473 <entry>Type: <emphasis>string list</emphasis>&dagger;<emphasis></emphasis></entry>
43474 <entry>Default: <emphasis>unset</emphasis></entry>
43475 </row>
43476 </tbody>
43477 </tgroup>
43478 </informaltable>
43479 <para>
43480 <indexterm role="concept">
43481 <primary><command>pipe</command> transport</primary>
43482 <secondary>permitted commands</secondary>
43483 </indexterm>
43484 The string is expanded, and is then interpreted as a colon-separated list of
43485 permitted commands. If <option>restrict_to_path</option> is not set, the only commands
43486 permitted are those in the <option>allow_commands</option> list. They need not be absolute
43487 paths; the <option>path</option> option is still used for relative paths. If
43488 <option>restrict_to_path</option> is set with <option>allow_commands</option>, the command must either be
43489 in the <option>allow_commands</option> list, or a name without any slashes that is found on
43490 the path. In other words, if neither <option>allow_commands</option> nor
43491 <option>restrict_to_path</option> is set, there is no restriction on the command, but
43492 otherwise only commands that are permitted by one or the other are allowed. For
43493 example, if
43494 </para>
43495 <literallayout class="monospaced">
43496 allow_commands = /usr/bin/vacation
43497 </literallayout>
43498 <para>
43499 and <option>restrict_to_path</option> is not set, the only permitted command is
43500 <filename>/usr/bin/vacation</filename>. The <option>allow_commands</option> option may not be set if
43501 <option>use_shell</option> is set.
43502 </para>
43503 <para>
43504 <indexterm role="option">
43505 <primary><option>batch_id</option></primary>
43506 </indexterm>
43507 </para>
43508 <informaltable frame="all">
43509 <tgroup cols="4" colsep="0" rowsep="0">
43510 <colspec colwidth="8*" align="left"/>
43511 <colspec colwidth="6*" align="center"/>
43512 <colspec colwidth="6*" align="center"/>
43513 <colspec colwidth="6*" align="right"/>
43514 <tbody>
43515 <row>
43516 <entry><option>batch_id</option></entry>
43517 <entry>Use: <emphasis>pipe</emphasis></entry>
43518 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
43519 <entry>Default: <emphasis>unset</emphasis></entry>
43520 </row>
43521 </tbody>
43522 </tgroup>
43523 </informaltable>
43524 <para>
43525 See the description of local delivery batching in chapter <xref linkend="CHAPbatching"/>.
43526 </para>
43527 <para>
43528 <indexterm role="option">
43529 <primary><option>batch_max</option></primary>
43530 </indexterm>
43531 </para>
43532 <informaltable frame="all">
43533 <tgroup cols="4" colsep="0" rowsep="0">
43534 <colspec colwidth="8*" align="left"/>
43535 <colspec colwidth="6*" align="center"/>
43536 <colspec colwidth="6*" align="center"/>
43537 <colspec colwidth="6*" align="right"/>
43538 <tbody>
43539 <row>
43540 <entry><option>batch_max</option></entry>
43541 <entry>Use: <emphasis>pipe</emphasis></entry>
43542 <entry>Type: <emphasis>integer</emphasis></entry>
43543 <entry>Default: <emphasis>1</emphasis></entry>
43544 </row>
43545 </tbody>
43546 </tgroup>
43547 </informaltable>
43548 <para>
43549 This limits the number of addresses that can be handled in a single delivery.
43550 See the description of local delivery batching in chapter <xref linkend="CHAPbatching"/>.
43551 </para>
43552 <para>
43553 <indexterm role="option">
43554 <primary><option>check_string</option></primary>
43555 </indexterm>
43556 </para>
43557 <informaltable frame="all">
43558 <tgroup cols="4" colsep="0" rowsep="0">
43559 <colspec colwidth="8*" align="left"/>
43560 <colspec colwidth="6*" align="center"/>
43561 <colspec colwidth="6*" align="center"/>
43562 <colspec colwidth="6*" align="right"/>
43563 <tbody>
43564 <row>
43565 <entry><option>check_string</option></entry>
43566 <entry>Use: <emphasis>pipe</emphasis></entry>
43567 <entry>Type: <emphasis>string</emphasis></entry>
43568 <entry>Default: <emphasis>unset</emphasis></entry>
43569 </row>
43570 </tbody>
43571 </tgroup>
43572 </informaltable>
43573 <para>
43574 As <command>pipe</command> writes the message, the start of each line is tested for matching
43575 <option>check_string</option>, and if it does, the initial matching characters are replaced
43576 by the contents of <option>escape_string</option>, provided both are set. The value of
43577 <option>check_string</option> is a literal string, not a regular expression, and the case of
43578 any letters it contains is significant. When <option>use_bsmtp</option> is set, the contents
43579 of <option>check_string</option> and <option>escape_string</option> are forced to values that implement
43580 the SMTP escaping protocol. Any settings made in the configuration file are
43581 ignored.
43582 </para>
43583 <para>
43584 <indexterm role="option">
43585 <primary><option>command</option></primary>
43586 </indexterm>
43587 </para>
43588 <informaltable frame="all">
43589 <tgroup cols="4" colsep="0" rowsep="0">
43590 <colspec colwidth="8*" align="left"/>
43591 <colspec colwidth="6*" align="center"/>
43592 <colspec colwidth="6*" align="center"/>
43593 <colspec colwidth="6*" align="right"/>
43594 <tbody>
43595 <row>
43596 <entry><option>command</option></entry>
43597 <entry>Use: <emphasis>pipe</emphasis></entry>
43598 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
43599 <entry>Default: <emphasis>unset</emphasis></entry>
43600 </row>
43601 </tbody>
43602 </tgroup>
43603 </informaltable>
43604 <para>
43605 This option need not be set when <command>pipe</command> is being used to deliver to pipes
43606 obtained directly from address redirections. In other cases, the option must be
43607 set, to provide a command to be run. It need not yield an absolute path (see
43608 the <option>path</option> option below). The command is split up into separate arguments by
43609 Exim, and each argument is separately expanded, as described in section
43610 <xref linkend="SECThowcommandrun"/> above.
43611 </para>
43612 <para>
43613 <indexterm role="option">
43614 <primary><option>environment</option></primary>
43615 </indexterm>
43616 </para>
43617 <informaltable frame="all">
43618 <tgroup cols="4" colsep="0" rowsep="0">
43619 <colspec colwidth="8*" align="left"/>
43620 <colspec colwidth="6*" align="center"/>
43621 <colspec colwidth="6*" align="center"/>
43622 <colspec colwidth="6*" align="right"/>
43623 <tbody>
43624 <row>
43625 <entry><option>environment</option></entry>
43626 <entry>Use: <emphasis>pipe</emphasis></entry>
43627 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
43628 <entry>Default: <emphasis>unset</emphasis></entry>
43629 </row>
43630 </tbody>
43631 </tgroup>
43632 </informaltable>
43633 <para>
43634 <indexterm role="concept">
43635 <primary><command>pipe</command> transport</primary>
43636 <secondary>environment for command</secondary>
43637 </indexterm>
43638 <indexterm role="concept">
43639 <primary>environment for <command>pipe</command> transport</primary>
43640 </indexterm>
43641 This option is used to add additional variables to the environment in which the
43642 command runs (see section <xref linkend="SECTpipeenv"/> for the default list). Its value is
43643 a string which is expanded, and then interpreted as a colon-separated list of
43644 environment settings of the form &lt;<emphasis>name</emphasis>&gt;=&lt;<emphasis>value</emphasis>&gt;.
43645 </para>
43646 <para>
43647 <indexterm role="option">
43648 <primary><option>escape_string</option></primary>
43649 </indexterm>
43650 </para>
43651 <informaltable frame="all">
43652 <tgroup cols="4" colsep="0" rowsep="0">
43653 <colspec colwidth="8*" align="left"/>
43654 <colspec colwidth="6*" align="center"/>
43655 <colspec colwidth="6*" align="center"/>
43656 <colspec colwidth="6*" align="right"/>
43657 <tbody>
43658 <row>
43659 <entry><option>escape_string</option></entry>
43660 <entry>Use: <emphasis>pipe</emphasis></entry>
43661 <entry>Type: <emphasis>string</emphasis></entry>
43662 <entry>Default: <emphasis>unset</emphasis></entry>
43663 </row>
43664 </tbody>
43665 </tgroup>
43666 </informaltable>
43667 <para>
43668 See <option>check_string</option> above.
43669 </para>
43670 <para>
43671 <indexterm role="option">
43672 <primary><option>freeze_exec_fail</option></primary>
43673 </indexterm>
43674 </para>
43675 <informaltable frame="all">
43676 <tgroup cols="4" colsep="0" rowsep="0">
43677 <colspec colwidth="8*" align="left"/>
43678 <colspec colwidth="6*" align="center"/>
43679 <colspec colwidth="6*" align="center"/>
43680 <colspec colwidth="6*" align="right"/>
43681 <tbody>
43682 <row>
43683 <entry><option>freeze_exec_fail</option></entry>
43684 <entry>Use: <emphasis>pipe</emphasis></entry>
43685 <entry>Type: <emphasis>boolean</emphasis></entry>
43686 <entry>Default: <emphasis>false</emphasis></entry>
43687 </row>
43688 </tbody>
43689 </tgroup>
43690 </informaltable>
43691 <para>
43692 <indexterm role="concept">
43693 <primary>exec failure</primary>
43694 </indexterm>
43695 <indexterm role="concept">
43696 <primary>failure of exec</primary>
43697 </indexterm>
43698 <indexterm role="concept">
43699 <primary><command>pipe</command> transport</primary>
43700 <secondary>failure of exec</secondary>
43701 </indexterm>
43702 Failure to exec the command in a pipe transport is by default treated like
43703 any other failure while running the command. However, if <option>freeze_exec_fail</option>
43704 is set, failure to exec is treated specially, and causes the message to be
43705 frozen, whatever the setting of <option>ignore_status</option>.
43706 </para>
43707 <para>
43708 <indexterm role="option">
43709 <primary><option>freeze_signal</option></primary>
43710 </indexterm>
43711 </para>
43712 <informaltable frame="all">
43713 <tgroup cols="4" colsep="0" rowsep="0">
43714 <colspec colwidth="8*" align="left"/>
43715 <colspec colwidth="6*" align="center"/>
43716 <colspec colwidth="6*" align="center"/>
43717 <colspec colwidth="6*" align="right"/>
43718 <tbody>
43719 <row>
43720 <entry><option>freeze_signal</option></entry>
43721 <entry>Use: <emphasis>pipe</emphasis></entry>
43722 <entry>Type: <emphasis>boolean</emphasis></entry>
43723 <entry>Default: <emphasis>false</emphasis></entry>
43724 </row>
43725 </tbody>
43726 </tgroup>
43727 </informaltable>
43728 <para>
43729 <indexterm role="concept">
43730 <primary>signal exit</primary>
43731 </indexterm>
43732 <indexterm role="concept">
43733 <primary><command>pipe</command> transport</primary>
43734 <secondary>,</secondary>
43735 </indexterm>
43736 Normally if the process run by a command in a pipe transport exits on a signal,
43737 a bounce message is sent. If <option>freeze_signal</option> is set, the message will be
43738 frozen in Exim&#x2019;s queue instead.
43739 </para>
43740 <para>
43741 <indexterm role="option">
43742 <primary><option>force_command</option></primary>
43743 </indexterm>
43744 </para>
43745 <informaltable frame="all">
43746 <tgroup cols="4" colsep="0" rowsep="0">
43747 <colspec colwidth="8*" align="left"/>
43748 <colspec colwidth="6*" align="center"/>
43749 <colspec colwidth="6*" align="center"/>
43750 <colspec colwidth="6*" align="right"/>
43751 <tbody>
43752 <row>
43753 <entry><option>force_command</option></entry>
43754 <entry>Use: <emphasis>pipe</emphasis></entry>
43755 <entry>Type: <emphasis>boolean</emphasis></entry>
43756 <entry>Default: <emphasis>false</emphasis></entry>
43757 </row>
43758 </tbody>
43759 </tgroup>
43760 </informaltable>
43761 <para>
43762 <indexterm role="concept">
43763 <primary>force command</primary>
43764 </indexterm>
43765 <indexterm role="concept">
43766 <primary><command>pipe</command> transport</primary>
43767 <secondary>,</secondary>
43768 </indexterm>
43769 Normally when a router redirects an address directly to a pipe command
43770 the <option>command</option> option on the transport is ignored.  If <option>force_command</option>
43771 is set, the <option>command</option> option will used. This is especially
43772 useful for forcing a wrapper or additional argument to be added to the
43773 command. For example:
43774 </para>
43775 <literallayout class="monospaced">
43776 command = /usr/bin/remote_exec myhost -- $address_pipe
43777 force_command
43778 </literallayout>
43779 <para>
43780 Note that <varname>$address_pipe</varname> is handled specially in <option>command</option> when
43781 <option>force_command</option> is set, expanding out to the original argument vector as
43782 separate items, similarly to a Unix shell <literal>"$@"</literal> construct.
43783 </para>
43784 <para>
43785 <indexterm role="option">
43786 <primary><option>ignore_status</option></primary>
43787 </indexterm>
43788 </para>
43789 <informaltable frame="all">
43790 <tgroup cols="4" colsep="0" rowsep="0">
43791 <colspec colwidth="8*" align="left"/>
43792 <colspec colwidth="6*" align="center"/>
43793 <colspec colwidth="6*" align="center"/>
43794 <colspec colwidth="6*" align="right"/>
43795 <tbody>
43796 <row>
43797 <entry><option>ignore_status</option></entry>
43798 <entry>Use: <emphasis>pipe</emphasis></entry>
43799 <entry>Type: <emphasis>boolean</emphasis></entry>
43800 <entry>Default: <emphasis>false</emphasis></entry>
43801 </row>
43802 </tbody>
43803 </tgroup>
43804 </informaltable>
43805 <para>
43806 If this option is true, the status returned by the subprocess that is set up to
43807 run the command is ignored, and Exim behaves as if zero had been returned.
43808 Otherwise, a non-zero status or termination by signal causes an error return
43809 from the transport unless the status value is one of those listed in
43810 <option>temp_errors</option>; these cause the delivery to be deferred and tried again later.
43811 </para>
43812 <para>
43813 <emphasis role="bold">Note</emphasis>: This option does not apply to timeouts, which do not return a status.
43814 See the <option>timeout_defer</option> option for how timeouts are handled.
43815 </para>
43816 <para>
43817 <indexterm role="option">
43818 <primary><option>log_defer_output</option></primary>
43819 </indexterm>
43820 </para>
43821 <informaltable frame="all">
43822 <tgroup cols="4" colsep="0" rowsep="0">
43823 <colspec colwidth="8*" align="left"/>
43824 <colspec colwidth="6*" align="center"/>
43825 <colspec colwidth="6*" align="center"/>
43826 <colspec colwidth="6*" align="right"/>
43827 <tbody>
43828 <row>
43829 <entry><option>log_defer_output</option></entry>
43830 <entry>Use: <emphasis>pipe</emphasis></entry>
43831 <entry>Type: <emphasis>boolean</emphasis></entry>
43832 <entry>Default: <emphasis>false</emphasis></entry>
43833 </row>
43834 </tbody>
43835 </tgroup>
43836 </informaltable>
43837 <para>
43838 <indexterm role="concept">
43839 <primary><command>pipe</command> transport</primary>
43840 <secondary>logging output</secondary>
43841 </indexterm>
43842 If this option is set, and the status returned by the command is
43843 one of the codes listed in <option>temp_errors</option> (that is, delivery was deferred),
43844 and any output was produced, the first line of it is written to the main log.
43845 </para>
43846 <para>
43847 <indexterm role="option">
43848 <primary><option>log_fail_output</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>log_fail_output</option></entry>
43860 <entry>Use: <emphasis>pipe</emphasis></entry>
43861 <entry>Type: <emphasis>boolean</emphasis></entry>
43862 <entry>Default: <emphasis>false</emphasis></entry>
43863 </row>
43864 </tbody>
43865 </tgroup>
43866 </informaltable>
43867 <para>
43868 If this option is set, and the command returns any output, and also ends with a
43869 return code that is neither zero nor one of the return codes listed in
43870 <option>temp_errors</option> (that is, the delivery failed), the first line of output is
43871 written to the main log. This option and <option>log_output</option> are mutually exclusive.
43872 Only one of them may be set.
43873 </para>
43874 <para>
43875 <indexterm role="option">
43876 <primary><option>log_output</option></primary>
43877 </indexterm>
43878 </para>
43879 <informaltable frame="all">
43880 <tgroup cols="4" colsep="0" rowsep="0">
43881 <colspec colwidth="8*" align="left"/>
43882 <colspec colwidth="6*" align="center"/>
43883 <colspec colwidth="6*" align="center"/>
43884 <colspec colwidth="6*" align="right"/>
43885 <tbody>
43886 <row>
43887 <entry><option>log_output</option></entry>
43888 <entry>Use: <emphasis>pipe</emphasis></entry>
43889 <entry>Type: <emphasis>boolean</emphasis></entry>
43890 <entry>Default: <emphasis>false</emphasis></entry>
43891 </row>
43892 </tbody>
43893 </tgroup>
43894 </informaltable>
43895 <para>
43896 If this option is set and the command returns any output, the first line of
43897 output is written to the main log, whatever the return code. This option and
43898 <option>log_fail_output</option> are mutually exclusive. Only one of them may be set.
43899 </para>
43900 <para>
43901 <indexterm role="option">
43902 <primary><option>max_output</option></primary>
43903 </indexterm>
43904 </para>
43905 <informaltable frame="all">
43906 <tgroup cols="4" colsep="0" rowsep="0">
43907 <colspec colwidth="8*" align="left"/>
43908 <colspec colwidth="6*" align="center"/>
43909 <colspec colwidth="6*" align="center"/>
43910 <colspec colwidth="6*" align="right"/>
43911 <tbody>
43912 <row>
43913 <entry><option>max_output</option></entry>
43914 <entry>Use: <emphasis>pipe</emphasis></entry>
43915 <entry>Type: <emphasis>integer</emphasis></entry>
43916 <entry>Default: <emphasis>20K</emphasis></entry>
43917 </row>
43918 </tbody>
43919 </tgroup>
43920 </informaltable>
43921 <para>
43922 This specifies the maximum amount of output that the command may produce on its
43923 standard output and standard error file combined. If the limit is exceeded, the
43924 process running the command is killed. This is intended as a safety measure to
43925 catch runaway processes. The limit is applied independently of the settings of
43926 the options that control what is done with such output (for example,
43927 <option>return_output</option>). Because of buffering effects, the amount of output may
43928 exceed the limit by a small amount before Exim notices.
43929 </para>
43930 <para>
43931 <indexterm role="option">
43932 <primary><option>message_prefix</option></primary>
43933 </indexterm>
43934 </para>
43935 <informaltable frame="all">
43936 <tgroup cols="4" colsep="0" rowsep="0">
43937 <colspec colwidth="8*" align="left"/>
43938 <colspec colwidth="6*" align="center"/>
43939 <colspec colwidth="6*" align="center"/>
43940 <colspec colwidth="6*" align="right"/>
43941 <tbody>
43942 <row>
43943 <entry><option>message_prefix</option></entry>
43944 <entry>Use: <emphasis>pipe</emphasis></entry>
43945 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
43946 <entry>Default: <emphasis>see below</emphasis></entry>
43947 </row>
43948 </tbody>
43949 </tgroup>
43950 </informaltable>
43951 <para>
43952 The string specified here is expanded and output at the start of every message.
43953 The default is unset if <option>use_bsmtp</option> is set. Otherwise it is
43954 </para>
43955 <literallayout class="monospaced">
43956 message_prefix = \
43957   From ${if def:return_path{$return_path}{MAILER-DAEMON}}\
43958   ${tod_bsdinbox}\n
43959 </literallayout>
43960 <para>
43961 <indexterm role="concept">
43962 <primary>Cyrus</primary>
43963 </indexterm>
43964 <indexterm role="concept">
43965 <primary><option>tmail</option></primary>
43966 </indexterm>
43967 <indexterm role="concept">
43968 <primary><quote>From</quote> line</primary>
43969 </indexterm>
43970 This is required by the commonly used <filename>/usr/bin/vacation</filename> program.
43971 However, it must <emphasis>not</emphasis> be present if delivery is to the Cyrus IMAP server,
43972 or to the <option>tmail</option> local delivery agent. The prefix can be suppressed by
43973 setting
43974 </para>
43975 <literallayout class="monospaced">
43976 message_prefix =
43977 </literallayout>
43978 <para>
43979 <emphasis role="bold">Note:</emphasis> If you set <option>use_crlf</option> true, you must change any occurrences of
43980 <literal>\n</literal> to <literal>\r\n</literal> in <option>message_prefix</option>.
43981 </para>
43982 <para>
43983 <indexterm role="option">
43984 <primary><option>message_suffix</option></primary>
43985 </indexterm>
43986 </para>
43987 <informaltable frame="all">
43988 <tgroup cols="4" colsep="0" rowsep="0">
43989 <colspec colwidth="8*" align="left"/>
43990 <colspec colwidth="6*" align="center"/>
43991 <colspec colwidth="6*" align="center"/>
43992 <colspec colwidth="6*" align="right"/>
43993 <tbody>
43994 <row>
43995 <entry><option>message_suffix</option></entry>
43996 <entry>Use: <emphasis>pipe</emphasis></entry>
43997 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
43998 <entry>Default: <emphasis>see below</emphasis></entry>
43999 </row>
44000 </tbody>
44001 </tgroup>
44002 </informaltable>
44003 <para>
44004 The string specified here is expanded and output at the end of every message.
44005 The default is unset if <option>use_bsmtp</option> is set. Otherwise it is a single newline.
44006 The suffix can be suppressed by setting
44007 </para>
44008 <literallayout class="monospaced">
44009 message_suffix =
44010 </literallayout>
44011 <para>
44012 <emphasis role="bold">Note:</emphasis> If you set <option>use_crlf</option> true, you must change any occurrences of
44013 <literal>\n</literal> to <literal>\r\n</literal> in <option>message_suffix</option>.
44014 </para>
44015 <para>
44016 <indexterm role="option">
44017 <primary><option>path</option></primary>
44018 </indexterm>
44019 </para>
44020 <informaltable frame="all">
44021 <tgroup cols="4" colsep="0" rowsep="0">
44022 <colspec colwidth="8*" align="left"/>
44023 <colspec colwidth="6*" align="center"/>
44024 <colspec colwidth="6*" align="center"/>
44025 <colspec colwidth="6*" align="right"/>
44026 <tbody>
44027 <row>
44028 <entry><option>path</option></entry>
44029 <entry>Use: <emphasis>pipe</emphasis></entry>
44030 <entry>Type: <emphasis>string</emphasis></entry>
44031 <entry>Default: <emphasis>see below</emphasis></entry>
44032 </row>
44033 </tbody>
44034 </tgroup>
44035 </informaltable>
44036 <para>
44037 This option specifies the string that is set up in the PATH environment
44038 variable of the subprocess. The default is:
44039 </para>
44040 <literallayout class="monospaced">
44041 /bin:/usr/bin
44042 </literallayout>
44043 <para>
44044 If the <option>command</option> option does not yield an absolute path name, the command is
44045 sought in the PATH directories, in the usual way. <emphasis role="bold">Warning</emphasis>: This does not
44046 apply to a command specified as a transport filter.
44047 </para>
44048 <para>
44049 <indexterm role="option">
44050 <primary><option>permit_coredump</option></primary>
44051 </indexterm>
44052 </para>
44053 <informaltable frame="all">
44054 <tgroup cols="4" colsep="0" rowsep="0">
44055 <colspec colwidth="8*" align="left"/>
44056 <colspec colwidth="6*" align="center"/>
44057 <colspec colwidth="6*" align="center"/>
44058 <colspec colwidth="6*" align="right"/>
44059 <tbody>
44060 <row>
44061 <entry><option>permit_coredump</option></entry>
44062 <entry>Use: <emphasis>pipe</emphasis></entry>
44063 <entry>Type: <emphasis>boolean</emphasis></entry>
44064 <entry>Default: <emphasis>false</emphasis></entry>
44065 </row>
44066 </tbody>
44067 </tgroup>
44068 </informaltable>
44069 <para>
44070 Normally Exim inhibits core-dumps during delivery.  If you have a need to get
44071 a core-dump of a pipe command, enable this command.  This enables core-dumps
44072 during delivery and affects both the Exim binary and the pipe command run.
44073 It is recommended that this option remain off unless and until you have a need
44074 for it and that this only be enabled when needed, as the risk of excessive
44075 resource consumption can be quite high.  Note also that Exim is typically
44076 installed as a setuid binary and most operating systems will inhibit coredumps
44077 of these by default, so further OS-specific action may be required.
44078 </para>
44079 <para>
44080 <indexterm role="option">
44081 <primary><option>pipe_as_creator</option></primary>
44082 </indexterm>
44083 </para>
44084 <informaltable frame="all">
44085 <tgroup cols="4" colsep="0" rowsep="0">
44086 <colspec colwidth="8*" align="left"/>
44087 <colspec colwidth="6*" align="center"/>
44088 <colspec colwidth="6*" align="center"/>
44089 <colspec colwidth="6*" align="right"/>
44090 <tbody>
44091 <row>
44092 <entry><option>pipe_as_creator</option></entry>
44093 <entry>Use: <emphasis>pipe</emphasis></entry>
44094 <entry>Type: <emphasis>boolean</emphasis></entry>
44095 <entry>Default: <emphasis>false</emphasis></entry>
44096 </row>
44097 </tbody>
44098 </tgroup>
44099 </informaltable>
44100 <para>
44101 <indexterm role="concept">
44102 <primary>uid (user id)</primary>
44103 <secondary>local delivery</secondary>
44104 </indexterm>
44105 If the generic <option>user</option> option is not set and this option is true, the delivery
44106 process is run under the uid that was in force when Exim was originally called
44107 to accept the message. If the group id is not otherwise set (via the generic
44108 <option>group</option> option), the gid that was in force when Exim was originally called to
44109 accept the message is used.
44110 </para>
44111 <para>
44112 <indexterm role="option">
44113 <primary><option>restrict_to_path</option></primary>
44114 </indexterm>
44115 </para>
44116 <informaltable frame="all">
44117 <tgroup cols="4" colsep="0" rowsep="0">
44118 <colspec colwidth="8*" align="left"/>
44119 <colspec colwidth="6*" align="center"/>
44120 <colspec colwidth="6*" align="center"/>
44121 <colspec colwidth="6*" align="right"/>
44122 <tbody>
44123 <row>
44124 <entry><option>restrict_to_path</option></entry>
44125 <entry>Use: <emphasis>pipe</emphasis></entry>
44126 <entry>Type: <emphasis>boolean</emphasis></entry>
44127 <entry>Default: <emphasis>false</emphasis></entry>
44128 </row>
44129 </tbody>
44130 </tgroup>
44131 </informaltable>
44132 <para>
44133 When this option is set, any command name not listed in <option>allow_commands</option> must
44134 contain no slashes. The command is searched for only in the directories listed
44135 in the <option>path</option> option. This option is intended for use in the case when a pipe
44136 command has been generated from a user&#x2019;s <filename>.forward</filename> file. This is usually
44137 handled by a <command>pipe</command> transport called <option>address_pipe</option>.
44138 </para>
44139 <para>
44140 <indexterm role="option">
44141 <primary><option>return_fail_output</option></primary>
44142 </indexterm>
44143 </para>
44144 <informaltable frame="all">
44145 <tgroup cols="4" colsep="0" rowsep="0">
44146 <colspec colwidth="8*" align="left"/>
44147 <colspec colwidth="6*" align="center"/>
44148 <colspec colwidth="6*" align="center"/>
44149 <colspec colwidth="6*" align="right"/>
44150 <tbody>
44151 <row>
44152 <entry><option>return_fail_output</option></entry>
44153 <entry>Use: <emphasis>pipe</emphasis></entry>
44154 <entry>Type: <emphasis>boolean</emphasis></entry>
44155 <entry>Default: <emphasis>false</emphasis></entry>
44156 </row>
44157 </tbody>
44158 </tgroup>
44159 </informaltable>
44160 <para>
44161 If this option is true, and the command produced any output and ended with a
44162 return code other than zero or one of the codes listed in <option>temp_errors</option> (that
44163 is, the delivery failed), the output is returned in the bounce message.
44164 However, if the message has a null sender (that is, it is itself a bounce
44165 message), output from the command is discarded. This option and
44166 <option>return_output</option> are mutually exclusive. Only one of them may be set.
44167 </para>
44168 <para>
44169 <indexterm role="option">
44170 <primary><option>return_output</option></primary>
44171 </indexterm>
44172 </para>
44173 <informaltable frame="all">
44174 <tgroup cols="4" colsep="0" rowsep="0">
44175 <colspec colwidth="8*" align="left"/>
44176 <colspec colwidth="6*" align="center"/>
44177 <colspec colwidth="6*" align="center"/>
44178 <colspec colwidth="6*" align="right"/>
44179 <tbody>
44180 <row>
44181 <entry><option>return_output</option></entry>
44182 <entry>Use: <emphasis>pipe</emphasis></entry>
44183 <entry>Type: <emphasis>boolean</emphasis></entry>
44184 <entry>Default: <emphasis>false</emphasis></entry>
44185 </row>
44186 </tbody>
44187 </tgroup>
44188 </informaltable>
44189 <para>
44190 If this option is true, and the command produced any output, the delivery is
44191 deemed to have failed whatever the return code from the command, and the output
44192 is returned in the bounce message. Otherwise, the output is just discarded.
44193 However, if the message has a null sender (that is, it is a bounce message),
44194 output from the command is always discarded, whatever the setting of this
44195 option. This option and <option>return_fail_output</option> are mutually exclusive. Only one
44196 of them may be set.
44197 </para>
44198 <para>
44199 <indexterm role="option">
44200 <primary><option>temp_errors</option></primary>
44201 </indexterm>
44202 </para>
44203 <informaltable frame="all">
44204 <tgroup cols="4" colsep="0" rowsep="0">
44205 <colspec colwidth="8*" align="left"/>
44206 <colspec colwidth="6*" align="center"/>
44207 <colspec colwidth="6*" align="center"/>
44208 <colspec colwidth="6*" align="right"/>
44209 <tbody>
44210 <row>
44211 <entry><option>temp_errors</option></entry>
44212 <entry>Use: <emphasis>pipe</emphasis></entry>
44213 <entry>Type: <emphasis>string list</emphasis></entry>
44214 <entry>Default: <emphasis>see below</emphasis></entry>
44215 </row>
44216 </tbody>
44217 </tgroup>
44218 </informaltable>
44219 <para>
44220 <indexterm role="concept">
44221 <primary><command>pipe</command> transport</primary>
44222 <secondary>temporary failure</secondary>
44223 </indexterm>
44224 This option contains either a colon-separated list of numbers, or a single
44225 asterisk. If <option>ignore_status</option> is false
44226 and <option>return_output</option> is not set,
44227 and the command exits with a non-zero return code, the failure is treated as
44228 temporary and the delivery is deferred if the return code matches one of the
44229 numbers, or if the setting is a single asterisk. Otherwise, non-zero return
44230 codes are treated as permanent errors. The default setting contains the codes
44231 defined by EX_TEMPFAIL and EX_CANTCREAT in <filename>sysexits.h</filename>. If Exim is
44232 compiled on a system that does not define these macros, it assumes values of 75
44233 and 73, respectively.
44234 </para>
44235 <para>
44236 <indexterm role="option">
44237 <primary><option>timeout</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>timeout</option></entry>
44249 <entry>Use: <emphasis>pipe</emphasis></entry>
44250 <entry>Type: <emphasis>time</emphasis></entry>
44251 <entry>Default: <emphasis>1h</emphasis></entry>
44252 </row>
44253 </tbody>
44254 </tgroup>
44255 </informaltable>
44256 <para>
44257 If the command fails to complete within this time, it is killed. This normally
44258 causes the delivery to fail (but see <option>timeout_defer</option>). A zero time interval
44259 specifies no timeout. In order to ensure that any subprocesses created by the
44260 command are also killed, Exim makes the initial process a process group leader,
44261 and kills the whole process group on a timeout. However, this can be defeated
44262 if one of the processes starts a new process group.
44263 </para>
44264 <para>
44265 <indexterm role="option">
44266 <primary><option>timeout_defer</option></primary>
44267 </indexterm>
44268 </para>
44269 <informaltable frame="all">
44270 <tgroup cols="4" colsep="0" rowsep="0">
44271 <colspec colwidth="8*" align="left"/>
44272 <colspec colwidth="6*" align="center"/>
44273 <colspec colwidth="6*" align="center"/>
44274 <colspec colwidth="6*" align="right"/>
44275 <tbody>
44276 <row>
44277 <entry><option>timeout_defer</option></entry>
44278 <entry>Use: <emphasis>pipe</emphasis></entry>
44279 <entry>Type: <emphasis>boolean</emphasis></entry>
44280 <entry>Default: <emphasis>false</emphasis></entry>
44281 </row>
44282 </tbody>
44283 </tgroup>
44284 </informaltable>
44285 <para>
44286 A timeout in a <command>pipe</command> transport, either in the command that the transport
44287 runs, or in a transport filter that is associated with it, is by default
44288 treated as a hard error, and the delivery fails. However, if <option>timeout_defer</option>
44289 is set true, both kinds of timeout become temporary errors, causing the
44290 delivery to be deferred.
44291 </para>
44292 <para>
44293 <indexterm role="option">
44294 <primary><option>umask</option></primary>
44295 </indexterm>
44296 </para>
44297 <informaltable frame="all">
44298 <tgroup cols="4" colsep="0" rowsep="0">
44299 <colspec colwidth="8*" align="left"/>
44300 <colspec colwidth="6*" align="center"/>
44301 <colspec colwidth="6*" align="center"/>
44302 <colspec colwidth="6*" align="right"/>
44303 <tbody>
44304 <row>
44305 <entry><option>umask</option></entry>
44306 <entry>Use: <emphasis>pipe</emphasis></entry>
44307 <entry>Type: <emphasis>octal integer</emphasis></entry>
44308 <entry>Default: <emphasis>022</emphasis></entry>
44309 </row>
44310 </tbody>
44311 </tgroup>
44312 </informaltable>
44313 <para>
44314 This specifies the umask setting for the subprocess that runs the command.
44315 </para>
44316 <para>
44317 <indexterm role="option">
44318 <primary><option>use_bsmtp</option></primary>
44319 </indexterm>
44320 </para>
44321 <informaltable frame="all">
44322 <tgroup cols="4" colsep="0" rowsep="0">
44323 <colspec colwidth="8*" align="left"/>
44324 <colspec colwidth="6*" align="center"/>
44325 <colspec colwidth="6*" align="center"/>
44326 <colspec colwidth="6*" align="right"/>
44327 <tbody>
44328 <row>
44329 <entry><option>use_bsmtp</option></entry>
44330 <entry>Use: <emphasis>pipe</emphasis></entry>
44331 <entry>Type: <emphasis>boolean</emphasis></entry>
44332 <entry>Default: <emphasis>false</emphasis></entry>
44333 </row>
44334 </tbody>
44335 </tgroup>
44336 </informaltable>
44337 <para>
44338 <indexterm role="concept">
44339 <primary>envelope sender</primary>
44340 </indexterm>
44341 If this option is set true, the <command>pipe</command> transport writes messages in <quote>batch
44342 SMTP</quote> format, with the envelope sender and recipient(s) included as SMTP
44343 commands. If you want to include a leading HELO command with such messages,
44344 you can do so by setting the <option>message_prefix</option> option. See section
44345 <xref linkend="SECTbatchSMTP"/> for details of batch SMTP.
44346 </para>
44347 <para>
44348 <indexterm role="option">
44349 <primary><option>use_classresources</option></primary>
44350 </indexterm>
44351 </para>
44352 <informaltable frame="all">
44353 <tgroup cols="4" colsep="0" rowsep="0">
44354 <colspec colwidth="8*" align="left"/>
44355 <colspec colwidth="6*" align="center"/>
44356 <colspec colwidth="6*" align="center"/>
44357 <colspec colwidth="6*" align="right"/>
44358 <tbody>
44359 <row>
44360 <entry><option>use_classresources</option></entry>
44361 <entry>Use: <emphasis>pipe</emphasis></entry>
44362 <entry>Type: <emphasis>boolean</emphasis></entry>
44363 <entry>Default: <emphasis>false</emphasis></entry>
44364 </row>
44365 </tbody>
44366 </tgroup>
44367 </informaltable>
44368 <para>
44369 <indexterm role="concept">
44370 <primary>class resources (BSD)</primary>
44371 </indexterm>
44372 This option is available only when Exim is running on FreeBSD, NetBSD, or
44373 BSD/OS. If it is set true, the <function>setclassresources()</function> function is used to set
44374 resource limits when a <command>pipe</command> transport is run to perform a delivery. The
44375 limits for the uid under which the pipe is to run are obtained from the login
44376 class database.
44377 </para>
44378 <para>
44379 <indexterm role="option">
44380 <primary><option>use_crlf</option></primary>
44381 </indexterm>
44382 </para>
44383 <informaltable frame="all">
44384 <tgroup cols="4" colsep="0" rowsep="0">
44385 <colspec colwidth="8*" align="left"/>
44386 <colspec colwidth="6*" align="center"/>
44387 <colspec colwidth="6*" align="center"/>
44388 <colspec colwidth="6*" align="right"/>
44389 <tbody>
44390 <row>
44391 <entry><option>use_crlf</option></entry>
44392 <entry>Use: <emphasis>pipe</emphasis></entry>
44393 <entry>Type: <emphasis>boolean</emphasis></entry>
44394 <entry>Default: <emphasis>false</emphasis></entry>
44395 </row>
44396 </tbody>
44397 </tgroup>
44398 </informaltable>
44399 <para>
44400 <indexterm role="concept">
44401 <primary>carriage return</primary>
44402 </indexterm>
44403 <indexterm role="concept">
44404 <primary>linefeed</primary>
44405 </indexterm>
44406 This option causes lines to be terminated with the two-character CRLF sequence
44407 (carriage return, linefeed) instead of just a linefeed character. In the case
44408 of batched SMTP, the byte sequence written to the pipe is then an exact image
44409 of what would be sent down a real SMTP connection.
44410 </para>
44411 <para>
44412 The contents of the <option>message_prefix</option> and <option>message_suffix</option> options are
44413 written verbatim, so must contain their own carriage return characters if these
44414 are needed. When <option>use_bsmtp</option> is not set, the default values for both
44415 <option>message_prefix</option> and <option>message_suffix</option> end with a single linefeed, so their
44416 values must be changed to end with <literal>\r\n</literal> if <option>use_crlf</option> is set.
44417 </para>
44418 <para>
44419 <indexterm role="option">
44420 <primary><option>use_shell</option></primary>
44421 </indexterm>
44422 </para>
44423 <informaltable frame="all">
44424 <tgroup cols="4" colsep="0" rowsep="0">
44425 <colspec colwidth="8*" align="left"/>
44426 <colspec colwidth="6*" align="center"/>
44427 <colspec colwidth="6*" align="center"/>
44428 <colspec colwidth="6*" align="right"/>
44429 <tbody>
44430 <row>
44431 <entry><option>use_shell</option></entry>
44432 <entry>Use: <emphasis>pipe</emphasis></entry>
44433 <entry>Type: <emphasis>boolean</emphasis></entry>
44434 <entry>Default: <emphasis>false</emphasis></entry>
44435 </row>
44436 </tbody>
44437 </tgroup>
44438 </informaltable>
44439 <para>
44440 <indexterm role="variable">
44441 <primary><varname>$pipe_addresses</varname></primary>
44442 </indexterm>
44443 If this option is set, it causes the command to be passed to <filename>/bin/sh</filename>
44444 instead of being run directly from the transport, as described in section
44445 <xref linkend="SECThowcommandrun"/>. This is less secure, but is needed in some situations
44446 where the command is expected to be run under a shell and cannot easily be
44447 modified. The <option>allow_commands</option> and <option>restrict_to_path</option> options, and the
44448 <literal>$pipe_addresses</literal> facility are incompatible with <option>use_shell</option>. The
44449 command is expanded as a single string, and handed to <filename>/bin/sh</filename> as data for
44450 its <option>-c</option> option.
44451 </para>
44452 </section>
44453 <section id="SECID143">
44454 <title>Using an external local delivery agent</title>
44455 <para>
44456 <indexterm role="concept">
44457 <primary>local delivery</primary>
44458 <secondary>using an external agent</secondary>
44459 </indexterm>
44460 <indexterm role="concept">
44461 <primary><emphasis>procmail</emphasis></primary>
44462 </indexterm>
44463 <indexterm role="concept">
44464 <primary>external local delivery</primary>
44465 </indexterm>
44466 <indexterm role="concept">
44467 <primary>delivery</primary>
44468 <secondary><emphasis>procmail</emphasis></secondary>
44469 </indexterm>
44470 <indexterm role="concept">
44471 <primary>delivery</primary>
44472 <secondary>by external agent</secondary>
44473 </indexterm>
44474 The <command>pipe</command> transport can be used to pass all messages that require local
44475 delivery to a separate local delivery agent such as <option>procmail</option>. When doing
44476 this, care must be taken to ensure that the pipe is run under an appropriate
44477 uid and gid. In some configurations one wants this to be a uid that is trusted
44478 by the delivery agent to supply the correct sender of the message. It may be
44479 necessary to recompile or reconfigure the delivery agent so that it trusts an
44480 appropriate user. The following is an example transport and router
44481 configuration for <option>procmail</option>:
44482 </para>
44483 <literallayout class="monospaced">
44484 # transport
44485 procmail_pipe:
44486   driver = pipe
44487   command = /usr/local/bin/procmail -d $local_part
44488   return_path_add
44489   delivery_date_add
44490   envelope_to_add
44491   check_string = "From "
44492   escape_string = "&gt;From "
44493   umask = 077
44494   user = $local_part
44495   group = mail
44496
44497 # router
44498 procmail:
44499   driver = accept
44500   check_local_user
44501   transport = procmail_pipe
44502 </literallayout>
44503 <para>
44504 In this example, the pipe is run as the local user, but with the group set to
44505 <emphasis>mail</emphasis>. An alternative is to run the pipe as a specific user such as <emphasis>mail</emphasis>
44506 or <emphasis>exim</emphasis>, but in this case you must arrange for <option>procmail</option> to trust that
44507 user to supply a correct sender address. If you do not specify either a
44508 <option>group</option> or a <option>user</option> option, the pipe command is run as the local user. The
44509 home directory is the user&#x2019;s home directory by default.
44510 </para>
44511 <para>
44512 <emphasis role="bold">Note</emphasis>: The command that the pipe transport runs does <emphasis>not</emphasis> begin with
44513 </para>
44514 <literallayout class="monospaced">
44515 IFS=" "
44516 </literallayout>
44517 <para>
44518 as shown in some <option>procmail</option> documentation, because Exim does not by default
44519 use a shell to run pipe commands.
44520 </para>
44521 <para>
44522 <indexterm role="concept">
44523 <primary>Cyrus</primary>
44524 </indexterm>
44525 The next example shows a transport and a router for a system where local
44526 deliveries are handled by the Cyrus IMAP server.
44527 </para>
44528 <literallayout class="monospaced">
44529 # transport
44530 local_delivery_cyrus:
44531   driver = pipe
44532   command = /usr/cyrus/bin/deliver \
44533             -m ${substr_1:$local_part_suffix} -- $local_part
44534   user = cyrus
44535   group = mail
44536   return_output
44537   log_output
44538   message_prefix =
44539   message_suffix =
44540
44541 # router
44542 local_user_cyrus:
44543   driver = accept
44544   check_local_user
44545   local_part_suffix = .*
44546   transport = local_delivery_cyrus
44547 </literallayout>
44548 <para>
44549 Note the unsetting of <option>message_prefix</option> and <option>message_suffix</option>, and the use of
44550 <option>return_output</option> to cause any text written by Cyrus to be returned to the
44551 sender.
44552 <indexterm role="concept" startref="IIDpiptra1" class="endofrange"/>
44553 <indexterm role="concept" startref="IIDpiptra2" class="endofrange"/>
44554 </para>
44555 </section>
44556 </chapter>
44557
44558 <chapter id="CHAPsmtptrans">
44559 <title>The smtp transport</title>
44560 <para>
44561 <indexterm role="concept" id="IIDsmttra1" class="startofrange">
44562 <primary>transports</primary>
44563 <secondary><command>smtp</command></secondary>
44564 </indexterm>
44565 <indexterm role="concept" id="IIDsmttra2" class="startofrange">
44566 <primary><command>smtp</command> transport</primary>
44567 </indexterm>
44568 The <command>smtp</command> transport delivers messages over TCP/IP connections using the SMTP
44569 or LMTP protocol. The list of hosts to try can either be taken from the address
44570 that is being processed (having been set up by the router), or specified
44571 explicitly for the transport. Timeout and retry processing (see chapter
44572 <xref linkend="CHAPretry"/>) is applied to each IP address independently.
44573 </para>
44574 <section id="SECID144">
44575 <title>Multiple messages on a single connection</title>
44576 <para>
44577 The sending of multiple messages over a single TCP/IP connection can arise in
44578 two ways:
44579 </para>
44580 <itemizedlist>
44581 <listitem>
44582 <para>
44583 If a message contains more than <option>max_rcpt</option> (see below) addresses that are
44584 routed to the same host, more than one copy of the message has to be sent to
44585 that host. In this situation, multiple copies may be sent in a single run of
44586 the <command>smtp</command> transport over a single TCP/IP connection. (What Exim actually
44587 does when it has too many addresses to send in one message also depends on the
44588 value of the global <option>remote_max_parallel</option> option. Details are given in
44589 section <xref linkend="SECToutSMTPTCP"/>.)
44590 </para>
44591 </listitem>
44592 <listitem>
44593 <para>
44594 <indexterm role="concept">
44595 <primary>hints database</primary>
44596 <secondary>remembering routing</secondary>
44597 </indexterm>
44598 When a message has been successfully delivered over a TCP/IP connection, Exim
44599 looks in its hints database to see if there are any other messages awaiting a
44600 connection to the same host. If there are, a new delivery process is started
44601 for one of them, and the current TCP/IP connection is passed on to it. The new
44602 process may in turn send multiple copies and possibly create yet another
44603 process.
44604 </para>
44605 </listitem>
44606 </itemizedlist>
44607 <para>
44608 For each copy sent over the same TCP/IP connection, a sequence counter is
44609 incremented, and if it ever gets to the value of <option>connection_max_messages</option>,
44610 no further messages are sent over that connection.
44611 </para>
44612 </section>
44613 <section id="SECID145">
44614 <title>Use of the $host and $host_address variables</title>
44615 <para>
44616 <indexterm role="variable">
44617 <primary><varname>$host</varname></primary>
44618 </indexterm>
44619 <indexterm role="variable">
44620 <primary><varname>$host_address</varname></primary>
44621 </indexterm>
44622 At the start of a run of the <command>smtp</command> transport, the values of <varname>$host</varname> and
44623 <varname>$host_address</varname> are the name and IP address of the first host on the host list
44624 passed by the router. However, when the transport is about to connect to a
44625 specific host, and while it is connected to that host, <varname>$host</varname> and
44626 <varname>$host_address</varname> are set to the values for that host. These are the values
44627 that are in force when the <option>helo_data</option>, <option>hosts_try_auth</option>, <option>interface</option>,
44628 <option>serialize_hosts</option>, and the various TLS options are expanded.
44629 </para>
44630 </section>
44631 <section id="usecippeer">
44632 <title>Use of $tls_cipher and $tls_peerdn</title>
44633 <para>
44634 <indexterm role="variable">
44635 <primary><varname>$tls_bits</varname></primary>
44636 </indexterm>
44637 <indexterm role="variable">
44638 <primary><varname>$tls_cipher</varname></primary>
44639 </indexterm>
44640 <indexterm role="variable">
44641 <primary><varname>$tls_peerdn</varname></primary>
44642 </indexterm>
44643 <indexterm role="variable">
44644 <primary><varname>$tls_sni</varname></primary>
44645 </indexterm>
44646 At the start of a run of the <command>smtp</command> transport, the values of <varname>$tls_bits</varname>,
44647 <varname>$tls_cipher</varname>, <varname>$tls_peerdn</varname> and <varname>$tls_sni</varname>
44648 are the values that were set when the message was received.
44649 These are the values that are used for options that are expanded before any
44650 SMTP connections are made. Just before each connection is made, these four
44651 variables are emptied. If TLS is subsequently started, they are set to the
44652 appropriate values for the outgoing connection, and these are the values that
44653 are in force when any authenticators are run and when the
44654 <option>authenticated_sender</option> option is expanded.
44655 </para>
44656 <para>
44657 These variables are deprecated in favour of <varname>$tls_in_cipher</varname> et. al.
44658 and will be removed in a future release.
44659 </para>
44660 </section>
44661 <section id="SECID146">
44662 <title>Private options for smtp</title>
44663 <para>
44664 <indexterm role="concept">
44665 <primary>options</primary>
44666 <secondary><command>smtp</command> transport</secondary>
44667 </indexterm>
44668 The private options of the <command>smtp</command> transport are as follows:
44669 </para>
44670 <para>
44671 <indexterm role="option">
44672 <primary><option>address_retry_include_sender</option></primary>
44673 </indexterm>
44674 </para>
44675 <informaltable frame="all">
44676 <tgroup cols="4" colsep="0" rowsep="0">
44677 <colspec colwidth="8*" align="left"/>
44678 <colspec colwidth="6*" align="center"/>
44679 <colspec colwidth="6*" align="center"/>
44680 <colspec colwidth="6*" align="right"/>
44681 <tbody>
44682 <row>
44683 <entry><option>address_retry_include_sender</option></entry>
44684 <entry>Use: <emphasis>smtp</emphasis></entry>
44685 <entry>Type: <emphasis>boolean</emphasis></entry>
44686 <entry>Default: <emphasis>true</emphasis></entry>
44687 </row>
44688 </tbody>
44689 </tgroup>
44690 </informaltable>
44691 <para>
44692 <indexterm role="concept">
44693 <primary>4<emphasis>xx</emphasis> responses</primary>
44694 <secondary>retrying after</secondary>
44695 </indexterm>
44696 When an address is delayed because of a 4<emphasis>xx</emphasis> response to a RCPT command, it
44697 is the combination of sender and recipient that is delayed in subsequent queue
44698 runs until the retry time is reached. You can delay the recipient without
44699 reference to the sender (which is what earlier versions of Exim did), by
44700 setting <option>address_retry_include_sender</option> false. However, this can lead to
44701 problems with servers that regularly issue 4<emphasis>xx</emphasis> responses to RCPT commands.
44702 </para>
44703 <para>
44704 <indexterm role="option">
44705 <primary><option>allow_localhost</option></primary>
44706 </indexterm>
44707 </para>
44708 <informaltable frame="all">
44709 <tgroup cols="4" colsep="0" rowsep="0">
44710 <colspec colwidth="8*" align="left"/>
44711 <colspec colwidth="6*" align="center"/>
44712 <colspec colwidth="6*" align="center"/>
44713 <colspec colwidth="6*" align="right"/>
44714 <tbody>
44715 <row>
44716 <entry><option>allow_localhost</option></entry>
44717 <entry>Use: <emphasis>smtp</emphasis></entry>
44718 <entry>Type: <emphasis>boolean</emphasis></entry>
44719 <entry>Default: <emphasis>false</emphasis></entry>
44720 </row>
44721 </tbody>
44722 </tgroup>
44723 </informaltable>
44724 <para>
44725 <indexterm role="concept">
44726 <primary>local host</primary>
44727 <secondary>sending to</secondary>
44728 </indexterm>
44729 <indexterm role="concept">
44730 <primary>fallback</primary>
44731 <secondary>hosts specified on transport</secondary>
44732 </indexterm>
44733 When a host specified in <option>hosts</option> or <option>fallback_hosts</option> (see below) turns out
44734 to be the local host, or is listed in <option>hosts_treat_as_local</option>, delivery is
44735 deferred by default. However, if <option>allow_localhost</option> is set, Exim goes on to do
44736 the delivery anyway. This should be used only in special cases when the
44737 configuration ensures that no looping will result (for example, a differently
44738 configured Exim is listening on the port to which the message is sent).
44739 </para>
44740 <para>
44741 <indexterm role="option">
44742 <primary><option>authenticated_sender</option></primary>
44743 </indexterm>
44744 </para>
44745 <informaltable frame="all">
44746 <tgroup cols="4" colsep="0" rowsep="0">
44747 <colspec colwidth="8*" align="left"/>
44748 <colspec colwidth="6*" align="center"/>
44749 <colspec colwidth="6*" align="center"/>
44750 <colspec colwidth="6*" align="right"/>
44751 <tbody>
44752 <row>
44753 <entry><option>authenticated_sender</option></entry>
44754 <entry>Use: <emphasis>smtp</emphasis></entry>
44755 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
44756 <entry>Default: <emphasis>unset</emphasis></entry>
44757 </row>
44758 </tbody>
44759 </tgroup>
44760 </informaltable>
44761 <para>
44762 <indexterm role="concept">
44763 <primary>Cyrus</primary>
44764 </indexterm>
44765 When Exim has authenticated as a client, or if <option>authenticated_sender_force</option>
44766 is true, this option sets a value for the AUTH= item on outgoing MAIL commands,
44767 overriding any existing authenticated sender value. If the string expansion is
44768 forced to fail, the option is ignored. Other expansion failures cause delivery
44769 to be deferred. If the result of expansion is an empty string, that is also
44770 ignored.
44771 </para>
44772 <para>
44773 The expansion happens after the outgoing connection has been made and TLS
44774 started, if required. This means that the <varname>$host</varname>, <varname>$host_address</varname>,
44775 <varname>$tls_out_cipher</varname>, and <varname>$tls_out_peerdn</varname> variables are set according to the
44776 particular connection.
44777 </para>
44778 <para>
44779 If the SMTP session is not authenticated, the expansion of
44780 <option>authenticated_sender</option> still happens (and can cause the delivery to be
44781 deferred if it fails), but no AUTH= item is added to MAIL commands
44782 unless <option>authenticated_sender_force</option> is true.
44783 </para>
44784 <para>
44785 This option allows you to use the <command>smtp</command> transport in LMTP mode to
44786 deliver mail to Cyrus IMAP and provide the proper local part as the
44787 <quote>authenticated sender</quote>, via a setting such as:
44788 </para>
44789 <literallayout class="monospaced">
44790 authenticated_sender = $local_part
44791 </literallayout>
44792 <para>
44793 This removes the need for IMAP subfolders to be assigned special ACLs to
44794 allow direct delivery to those subfolders.
44795 </para>
44796 <para>
44797 Because of expected uses such as that just described for Cyrus (when no
44798 domain is involved), there is no checking on the syntax of the provided
44799 value.
44800 </para>
44801 <para>
44802 <indexterm role="option">
44803 <primary><option>authenticated_sender_force</option></primary>
44804 </indexterm>
44805 </para>
44806 <informaltable frame="all">
44807 <tgroup cols="4" colsep="0" rowsep="0">
44808 <colspec colwidth="8*" align="left"/>
44809 <colspec colwidth="6*" align="center"/>
44810 <colspec colwidth="6*" align="center"/>
44811 <colspec colwidth="6*" align="right"/>
44812 <tbody>
44813 <row>
44814 <entry><option>authenticated_sender_force</option></entry>
44815 <entry>Use: <emphasis>smtp</emphasis></entry>
44816 <entry>Type: <emphasis>boolean</emphasis></entry>
44817 <entry>Default: <emphasis>false</emphasis></entry>
44818 </row>
44819 </tbody>
44820 </tgroup>
44821 </informaltable>
44822 <para>
44823 If this option is set true, the <option>authenticated_sender</option> option&#x2019;s value
44824 is used for the AUTH= item on outgoing MAIL commands, even if Exim has not
44825 authenticated as a client.
44826 </para>
44827 <para>
44828 <indexterm role="option">
44829 <primary><option>command_timeout</option></primary>
44830 </indexterm>
44831 </para>
44832 <informaltable frame="all">
44833 <tgroup cols="4" colsep="0" rowsep="0">
44834 <colspec colwidth="8*" align="left"/>
44835 <colspec colwidth="6*" align="center"/>
44836 <colspec colwidth="6*" align="center"/>
44837 <colspec colwidth="6*" align="right"/>
44838 <tbody>
44839 <row>
44840 <entry><option>command_timeout</option></entry>
44841 <entry>Use: <emphasis>smtp</emphasis></entry>
44842 <entry>Type: <emphasis>time</emphasis></entry>
44843 <entry>Default: <emphasis>5m</emphasis></entry>
44844 </row>
44845 </tbody>
44846 </tgroup>
44847 </informaltable>
44848 <para>
44849 This sets a timeout for receiving a response to an SMTP command that has been
44850 sent out. It is also used when waiting for the initial banner line from the
44851 remote host. Its value must not be zero.
44852 </para>
44853 <para>
44854 <indexterm role="option">
44855 <primary><option>connect_timeout</option></primary>
44856 </indexterm>
44857 </para>
44858 <informaltable frame="all">
44859 <tgroup cols="4" colsep="0" rowsep="0">
44860 <colspec colwidth="8*" align="left"/>
44861 <colspec colwidth="6*" align="center"/>
44862 <colspec colwidth="6*" align="center"/>
44863 <colspec colwidth="6*" align="right"/>
44864 <tbody>
44865 <row>
44866 <entry><option>connect_timeout</option></entry>
44867 <entry>Use: <emphasis>smtp</emphasis></entry>
44868 <entry>Type: <emphasis>time</emphasis></entry>
44869 <entry>Default: <emphasis>5m</emphasis></entry>
44870 </row>
44871 </tbody>
44872 </tgroup>
44873 </informaltable>
44874 <para>
44875 This sets a timeout for the <function>connect()</function> function, which sets up a TCP/IP call
44876 to a remote host. A setting of zero allows the system timeout (typically
44877 several minutes) to act. To have any effect, the value of this option must be
44878 less than the system timeout. However, it has been observed that on some
44879 systems there is no system timeout, which is why the default value for this
44880 option is 5 minutes, a value recommended by RFC 1123.
44881 </para>
44882 <para>
44883 <indexterm role="option">
44884 <primary><option>connection_max_messages</option></primary>
44885 </indexterm>
44886 </para>
44887 <informaltable frame="all">
44888 <tgroup cols="4" colsep="0" rowsep="0">
44889 <colspec colwidth="8*" align="left"/>
44890 <colspec colwidth="6*" align="center"/>
44891 <colspec colwidth="6*" align="center"/>
44892 <colspec colwidth="6*" align="right"/>
44893 <tbody>
44894 <row>
44895 <entry><option>connection_max_messages</option></entry>
44896 <entry>Use: <emphasis>smtp</emphasis></entry>
44897 <entry>Type: <emphasis>integer</emphasis></entry>
44898 <entry>Default: <emphasis>500</emphasis></entry>
44899 </row>
44900 </tbody>
44901 </tgroup>
44902 </informaltable>
44903 <para>
44904 <indexterm role="concept">
44905 <primary>SMTP</primary>
44906 <secondary>passed connection</secondary>
44907 </indexterm>
44908 <indexterm role="concept">
44909 <primary>SMTP</primary>
44910 <secondary>multiple deliveries</secondary>
44911 </indexterm>
44912 <indexterm role="concept">
44913 <primary>multiple SMTP deliveries</primary>
44914 </indexterm>
44915 This controls the maximum number of separate message deliveries that are sent
44916 over a single TCP/IP connection. If the value is zero, there is no limit.
44917 For testing purposes, this value can be overridden by the <option>-oB</option> command line
44918 option.
44919 </para>
44920 <para>
44921 <indexterm role="option">
44922 <primary><option>data_timeout</option></primary>
44923 </indexterm>
44924 </para>
44925 <informaltable frame="all">
44926 <tgroup cols="4" colsep="0" rowsep="0">
44927 <colspec colwidth="8*" align="left"/>
44928 <colspec colwidth="6*" align="center"/>
44929 <colspec colwidth="6*" align="center"/>
44930 <colspec colwidth="6*" align="right"/>
44931 <tbody>
44932 <row>
44933 <entry><option>data_timeout</option></entry>
44934 <entry>Use: <emphasis>smtp</emphasis></entry>
44935 <entry>Type: <emphasis>time</emphasis></entry>
44936 <entry>Default: <emphasis>5m</emphasis></entry>
44937 </row>
44938 </tbody>
44939 </tgroup>
44940 </informaltable>
44941 <para>
44942 This sets a timeout for the transmission of each block in the data portion of
44943 the message. As a result, the overall timeout for a message depends on the size
44944 of the message. Its value must not be zero. See also <option>final_timeout</option>.
44945 </para>
44946 <para>
44947 <indexterm role="option">
44948 <primary><option>delay_after_cutoff</option></primary>
44949 </indexterm>
44950 </para>
44951 <informaltable frame="all">
44952 <tgroup cols="4" colsep="0" rowsep="0">
44953 <colspec colwidth="8*" align="left"/>
44954 <colspec colwidth="6*" align="center"/>
44955 <colspec colwidth="6*" align="center"/>
44956 <colspec colwidth="6*" align="right"/>
44957 <tbody>
44958 <row>
44959 <entry><option>delay_after_cutoff</option></entry>
44960 <entry>Use: <emphasis>smtp</emphasis></entry>
44961 <entry>Type: <emphasis>boolean</emphasis></entry>
44962 <entry>Default: <emphasis>true</emphasis></entry>
44963 </row>
44964 </tbody>
44965 </tgroup>
44966 </informaltable>
44967 <para>
44968 This option controls what happens when all remote IP addresses for a given
44969 domain have been inaccessible for so long that they have passed their retry
44970 cutoff times.
44971 </para>
44972 <para>
44973 In the default state, if the next retry time has not been reached for any of
44974 them, the address is bounced without trying any deliveries. In other words,
44975 Exim delays retrying an IP address after the final cutoff time until a new
44976 retry time is reached, and can therefore bounce an address without ever trying
44977 a delivery, when machines have been down for a long time. Some people are
44978 unhappy at this prospect, so...
44979 </para>
44980 <para>
44981 If <option>delay_after_cutoff</option> is set false, Exim behaves differently. If all IP
44982 addresses are past their final cutoff time, Exim tries to deliver to those
44983 IP addresses that have not been tried since the message arrived. If there are
44984 none, of if they all fail, the address is bounced. In other words, it does not
44985 delay when a new message arrives, but immediately tries those expired IP
44986 addresses that haven&#x2019;t been tried since the message arrived. If there is a
44987 continuous stream of messages for the dead hosts, unsetting
44988 <option>delay_after_cutoff</option> means that there will be many more attempts to deliver
44989 to them.
44990 </para>
44991 <para>
44992 <indexterm role="option">
44993 <primary><option>dns_qualify_single</option></primary>
44994 </indexterm>
44995 </para>
44996 <informaltable frame="all">
44997 <tgroup cols="4" colsep="0" rowsep="0">
44998 <colspec colwidth="8*" align="left"/>
44999 <colspec colwidth="6*" align="center"/>
45000 <colspec colwidth="6*" align="center"/>
45001 <colspec colwidth="6*" align="right"/>
45002 <tbody>
45003 <row>
45004 <entry><option>dns_qualify_single</option></entry>
45005 <entry>Use: <emphasis>smtp</emphasis></entry>
45006 <entry>Type: <emphasis>boolean</emphasis></entry>
45007 <entry>Default: <emphasis>true</emphasis></entry>
45008 </row>
45009 </tbody>
45010 </tgroup>
45011 </informaltable>
45012 <para>
45013 If the <option>hosts</option> or <option>fallback_hosts</option> option is being used,
45014 and the <option>gethostbyname</option> option is false,
45015 the RES_DEFNAMES resolver option is set. See the <option>qualify_single</option> option
45016 in chapter <xref linkend="CHAPdnslookup"/> for more details.
45017 </para>
45018 <para>
45019 <indexterm role="option">
45020 <primary><option>dns_search_parents</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>dns_search_parents</option></entry>
45032 <entry>Use: <emphasis>smtp</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 the <option>hosts</option> or <option>fallback_hosts</option> option is being used, and the
45041 <option>gethostbyname</option> option is false, the RES_DNSRCH resolver option is set.
45042 See the <option>search_parents</option> option in chapter <xref linkend="CHAPdnslookup"/> for more
45043 details.
45044 </para>
45045 <para>
45046 <indexterm role="option">
45047 <primary><option>dnssec_request_domains</option></primary>
45048 </indexterm>
45049 </para>
45050 <informaltable frame="all">
45051 <tgroup cols="4" colsep="0" rowsep="0">
45052 <colspec colwidth="8*" align="left"/>
45053 <colspec colwidth="6*" align="center"/>
45054 <colspec colwidth="6*" align="center"/>
45055 <colspec colwidth="6*" align="right"/>
45056 <tbody>
45057 <row>
45058 <entry><option>dnssec_request_domains</option></entry>
45059 <entry>Use: <emphasis>smtp</emphasis></entry>
45060 <entry>Type: <emphasis>domain list</emphasis>&dagger;<emphasis></emphasis></entry>
45061 <entry>Default: <emphasis>unset</emphasis></entry>
45062 </row>
45063 </tbody>
45064 </tgroup>
45065 </informaltable>
45066 <para>
45067 <indexterm role="concept">
45068 <primary>MX record</primary>
45069 <secondary>security</secondary>
45070 </indexterm>
45071 <indexterm role="concept">
45072 <primary>DNSSEC</primary>
45073 <secondary>MX lookup</secondary>
45074 </indexterm>
45075 <indexterm role="concept">
45076 <primary>security</primary>
45077 <secondary>MX lookup</secondary>
45078 </indexterm>
45079 <indexterm role="concept">
45080 <primary>DNS</primary>
45081 <secondary>DNSSEC</secondary>
45082 </indexterm>
45083 DNS lookups for domains matching <option>dnssec_request_domains</option> will be done with
45084 the dnssec request bit set.
45085 This applies to all of the SRV, MX, AAAA, A lookup sequence.
45086 </para>
45087 <para>
45088 <indexterm role="option">
45089 <primary><option>dnssec_require_domains</option></primary>
45090 </indexterm>
45091 </para>
45092 <informaltable frame="all">
45093 <tgroup cols="4" colsep="0" rowsep="0">
45094 <colspec colwidth="8*" align="left"/>
45095 <colspec colwidth="6*" align="center"/>
45096 <colspec colwidth="6*" align="center"/>
45097 <colspec colwidth="6*" align="right"/>
45098 <tbody>
45099 <row>
45100 <entry><option>dnssec_require_domains</option></entry>
45101 <entry>Use: <emphasis>smtp</emphasis></entry>
45102 <entry>Type: <emphasis>domain list</emphasis>&dagger;<emphasis></emphasis></entry>
45103 <entry>Default: <emphasis>unset</emphasis></entry>
45104 </row>
45105 </tbody>
45106 </tgroup>
45107 </informaltable>
45108 <para>
45109 <indexterm role="concept">
45110 <primary>MX record</primary>
45111 <secondary>security</secondary>
45112 </indexterm>
45113 <indexterm role="concept">
45114 <primary>DNSSEC</primary>
45115 <secondary>MX lookup</secondary>
45116 </indexterm>
45117 <indexterm role="concept">
45118 <primary>security</primary>
45119 <secondary>MX lookup</secondary>
45120 </indexterm>
45121 <indexterm role="concept">
45122 <primary>DNS</primary>
45123 <secondary>DNSSEC</secondary>
45124 </indexterm>
45125 DNS lookups for domains matching <option>dnssec_request_domains</option> will be done with
45126 the dnssec request bit set.  Any returns not having the Authenticated Data bit
45127 (AD bit) set will be ignored and logged as a host-lookup failure.
45128 This applies to all of the SRV, MX, AAAA, A lookup sequence.
45129 </para>
45130 <para>
45131 <indexterm role="option">
45132 <primary><option>dscp</option></primary>
45133 </indexterm>
45134 </para>
45135 <informaltable frame="all">
45136 <tgroup cols="4" colsep="0" rowsep="0">
45137 <colspec colwidth="8*" align="left"/>
45138 <colspec colwidth="6*" align="center"/>
45139 <colspec colwidth="6*" align="center"/>
45140 <colspec colwidth="6*" align="right"/>
45141 <tbody>
45142 <row>
45143 <entry><option>dscp</option></entry>
45144 <entry>Use: <emphasis>smtp</emphasis></entry>
45145 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
45146 <entry>Default: <emphasis>unset</emphasis></entry>
45147 </row>
45148 </tbody>
45149 </tgroup>
45150 </informaltable>
45151 <para>
45152 <indexterm role="concept">
45153 <primary>DCSP</primary>
45154 <secondary>outbound</secondary>
45155 </indexterm>
45156 This option causes the DSCP value associated with a socket to be set to one
45157 of a number of fixed strings or to numeric value.
45158 The <option>-bI:dscp</option> option may be used to ask Exim which names it knows of.
45159 Common values include <literal>throughput</literal>, <literal>mincost</literal>, and on newer systems
45160 <literal>ef</literal>, <literal>af41</literal>, etc.  Numeric values may be in the range 0 to 0x3F.
45161 </para>
45162 <para>
45163 The outbound packets from Exim will be marked with this value in the header
45164 (for IPv4, the TOS field; for IPv6, the TCLASS field); there is no guarantee
45165 that these values will have any effect, not be stripped by networking
45166 equipment, or do much of anything without cooperation with your Network
45167 Engineer and those of all network operators between the source and destination.
45168 </para>
45169 <para>
45170 <indexterm role="option">
45171 <primary><option>fallback_hosts</option></primary>
45172 </indexterm>
45173 </para>
45174 <informaltable frame="all">
45175 <tgroup cols="4" colsep="0" rowsep="0">
45176 <colspec colwidth="8*" align="left"/>
45177 <colspec colwidth="6*" align="center"/>
45178 <colspec colwidth="6*" align="center"/>
45179 <colspec colwidth="6*" align="right"/>
45180 <tbody>
45181 <row>
45182 <entry><option>fallback_hosts</option></entry>
45183 <entry>Use: <emphasis>smtp</emphasis></entry>
45184 <entry>Type: <emphasis>string list</emphasis></entry>
45185 <entry>Default: <emphasis>unset</emphasis></entry>
45186 </row>
45187 </tbody>
45188 </tgroup>
45189 </informaltable>
45190 <para>
45191 <indexterm role="concept">
45192 <primary>fallback</primary>
45193 <secondary>hosts specified on transport</secondary>
45194 </indexterm>
45195 String expansion is not applied to this option. The argument must be a
45196 colon-separated list of host names or IP addresses, optionally also including
45197 port numbers, though the separator can be changed, as described in section
45198 <xref linkend="SECTlistconstruct"/>. Each individual item in the list is the same as an
45199 item in a <option>route_list</option> setting for the <command>manualroute</command> router, as described
45200 in section <xref linkend="SECTformatonehostitem"/>.
45201 </para>
45202 <para>
45203 Fallback hosts can also be specified on routers, which associate them with the
45204 addresses they process. As for the <option>hosts</option> option without <option>hosts_override</option>,
45205 <option>fallback_hosts</option> specified on the transport is used only if the address does
45206 not have its own associated fallback host list. Unlike <option>hosts</option>, a setting of
45207 <option>fallback_hosts</option> on an address is not overridden by <option>hosts_override</option>.
45208 However, <option>hosts_randomize</option> does apply to fallback host lists.
45209 </para>
45210 <para>
45211 If Exim is unable to deliver to any of the hosts for a particular address, and
45212 the errors are not permanent rejections, the address is put on a separate
45213 transport queue with its host list replaced by the fallback hosts, unless the
45214 address was routed via MX records and the current host was in the original MX
45215 list. In that situation, the fallback host list is not used.
45216 </para>
45217 <para>
45218 Once normal deliveries are complete, the fallback queue is delivered by
45219 re-running the same transports with the new host lists. If several failing
45220 addresses have the same fallback hosts (and <option>max_rcpt</option> permits it), a single
45221 copy of the message is sent.
45222 </para>
45223 <para>
45224 The resolution of the host names on the fallback list is controlled by the
45225 <option>gethostbyname</option> option, as for the <option>hosts</option> option. Fallback hosts apply
45226 both to cases when the host list comes with the address and when it is taken
45227 from <option>hosts</option>. This option provides a <quote>use a smart host only if delivery
45228 fails</quote> facility.
45229 </para>
45230 <para>
45231 <indexterm role="option">
45232 <primary><option>final_timeout</option></primary>
45233 </indexterm>
45234 </para>
45235 <informaltable frame="all">
45236 <tgroup cols="4" colsep="0" rowsep="0">
45237 <colspec colwidth="8*" align="left"/>
45238 <colspec colwidth="6*" align="center"/>
45239 <colspec colwidth="6*" align="center"/>
45240 <colspec colwidth="6*" align="right"/>
45241 <tbody>
45242 <row>
45243 <entry><option>final_timeout</option></entry>
45244 <entry>Use: <emphasis>smtp</emphasis></entry>
45245 <entry>Type: <emphasis>time</emphasis></entry>
45246 <entry>Default: <emphasis>10m</emphasis></entry>
45247 </row>
45248 </tbody>
45249 </tgroup>
45250 </informaltable>
45251 <para>
45252 This is the timeout that applies while waiting for the response to the final
45253 line containing just <quote>.</quote> that terminates a message. Its value must not be
45254 zero.
45255 </para>
45256 <para>
45257 <indexterm role="option">
45258 <primary><option>gethostbyname</option></primary>
45259 </indexterm>
45260 </para>
45261 <informaltable frame="all">
45262 <tgroup cols="4" colsep="0" rowsep="0">
45263 <colspec colwidth="8*" align="left"/>
45264 <colspec colwidth="6*" align="center"/>
45265 <colspec colwidth="6*" align="center"/>
45266 <colspec colwidth="6*" align="right"/>
45267 <tbody>
45268 <row>
45269 <entry><option>gethostbyname</option></entry>
45270 <entry>Use: <emphasis>smtp</emphasis></entry>
45271 <entry>Type: <emphasis>boolean</emphasis></entry>
45272 <entry>Default: <emphasis>false</emphasis></entry>
45273 </row>
45274 </tbody>
45275 </tgroup>
45276 </informaltable>
45277 <para>
45278 If this option is true when the <option>hosts</option> and/or <option>fallback_hosts</option> options are
45279 being used, names are looked up using <function>gethostbyname()</function>
45280 (or <function>getipnodebyname()</function> when available)
45281 instead of using the DNS. Of course, that function may in fact use the DNS, but
45282 it may also consult other sources of information such as <filename>/etc/hosts</filename>.
45283 </para>
45284 <para>
45285 <indexterm role="option">
45286 <primary><option>gnutls_compat_mode</option></primary>
45287 </indexterm>
45288 </para>
45289 <informaltable frame="all">
45290 <tgroup cols="4" colsep="0" rowsep="0">
45291 <colspec colwidth="8*" align="left"/>
45292 <colspec colwidth="6*" align="center"/>
45293 <colspec colwidth="6*" align="center"/>
45294 <colspec colwidth="6*" align="right"/>
45295 <tbody>
45296 <row>
45297 <entry><option>gnutls_compat_mode</option></entry>
45298 <entry>Use: <emphasis>smtp</emphasis></entry>
45299 <entry>Type: <emphasis>boolean</emphasis></entry>
45300 <entry>Default: <emphasis>unset</emphasis></entry>
45301 </row>
45302 </tbody>
45303 </tgroup>
45304 </informaltable>
45305 <para>
45306 This option controls whether GnuTLS is used in compatibility mode in an Exim
45307 server. This reduces security slightly, but improves interworking with older
45308 implementations of TLS.
45309 </para>
45310 <para>
45311 <indexterm role="option">
45312 <primary><option>helo_data</option></primary>
45313 </indexterm>
45314 </para>
45315 <informaltable frame="all">
45316 <tgroup cols="4" colsep="0" rowsep="0">
45317 <colspec colwidth="8*" align="left"/>
45318 <colspec colwidth="6*" align="center"/>
45319 <colspec colwidth="6*" align="center"/>
45320 <colspec colwidth="6*" align="right"/>
45321 <tbody>
45322 <row>
45323 <entry><option>helo_data</option></entry>
45324 <entry>Use: <emphasis>smtp</emphasis></entry>
45325 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
45326 <entry>Default: <emphasis>see below</emphasis></entry>
45327 </row>
45328 </tbody>
45329 </tgroup>
45330 </informaltable>
45331 <para>
45332 <indexterm role="concept">
45333 <primary>HELO</primary>
45334 <secondary>argument, setting</secondary>
45335 </indexterm>
45336 <indexterm role="concept">
45337 <primary>EHLO</primary>
45338 <secondary>argument, setting</secondary>
45339 </indexterm>
45340 <indexterm role="concept">
45341 <primary>LHLO argument setting</primary>
45342 </indexterm>
45343 The value of this option is expanded after a connection to a another host has
45344 been set up. The result is used as the argument for the EHLO, HELO, or LHLO
45345 command that starts the outgoing SMTP or LMTP session. The default value of the
45346 option is:
45347 </para>
45348 <literallayout class="monospaced">
45349 $primary_hostname
45350 </literallayout>
45351 <para>
45352 During the expansion, the variables <varname>$host</varname> and <varname>$host_address</varname> are set to
45353 the identity of the remote host, and the variables <varname>$sending_ip_address</varname> and
45354 <varname>$sending_port</varname> are set to the local IP address and port number that are being
45355 used. These variables can be used to generate different values for different
45356 servers or different local IP addresses. For example, if you want the string
45357 that is used for <option>helo_data</option> to be obtained by a DNS lookup of the outgoing
45358 interface address, you could use this:
45359 </para>
45360 <literallayout class="monospaced">
45361 helo_data = ${lookup dnsdb{ptr=$sending_ip_address}{$value}\
45362   {$primary_hostname}}
45363 </literallayout>
45364 <para>
45365 The use of <option>helo_data</option> applies both to sending messages and when doing
45366 callouts.
45367 </para>
45368 <para>
45369 <indexterm role="option">
45370 <primary><option>hosts</option></primary>
45371 </indexterm>
45372 </para>
45373 <informaltable frame="all">
45374 <tgroup cols="4" colsep="0" rowsep="0">
45375 <colspec colwidth="8*" align="left"/>
45376 <colspec colwidth="6*" align="center"/>
45377 <colspec colwidth="6*" align="center"/>
45378 <colspec colwidth="6*" align="right"/>
45379 <tbody>
45380 <row>
45381 <entry><option>hosts</option></entry>
45382 <entry>Use: <emphasis>smtp</emphasis></entry>
45383 <entry>Type: <emphasis>string list</emphasis>&dagger;<emphasis></emphasis></entry>
45384 <entry>Default: <emphasis>unset</emphasis></entry>
45385 </row>
45386 </tbody>
45387 </tgroup>
45388 </informaltable>
45389 <para>
45390 Hosts are associated with an address by a router such as <command>dnslookup</command>, which
45391 finds the hosts by looking up the address domain in the DNS, or by
45392 <command>manualroute</command>, which has lists of hosts in its configuration. However,
45393 email addresses can be passed to the <command>smtp</command> transport by any router, and not
45394 all of them can provide an associated list of hosts.
45395 </para>
45396 <para>
45397 The <option>hosts</option> option specifies a list of hosts to be used if the address being
45398 processed does not have any hosts associated with it. The hosts specified by
45399 <option>hosts</option> are also used, whether or not the address has its own hosts, if
45400 <option>hosts_override</option> is set.
45401 </para>
45402 <para>
45403 The string is first expanded, before being interpreted as a colon-separated
45404 list of host names or IP addresses, possibly including port numbers. The
45405 separator may be changed to something other than colon, as described in section
45406 <xref linkend="SECTlistconstruct"/>. Each individual item in the list is the same as an
45407 item in a <option>route_list</option> setting for the <command>manualroute</command> router, as described
45408 in section <xref linkend="SECTformatonehostitem"/>. However, note that the <literal>/MX</literal> facility
45409 of the <command>manualroute</command> router is not available here.
45410 </para>
45411 <para>
45412 If the expansion fails, delivery is deferred. Unless the failure was caused by
45413 the inability to complete a lookup, the error is logged to the panic log as
45414 well as the main log. Host names are looked up either by searching directly for
45415 address records in the DNS or by calling <function>gethostbyname()</function> (or
45416 <function>getipnodebyname()</function> when available), depending on the setting of the
45417 <option>gethostbyname</option> option. When Exim is compiled with IPv6 support, if a host
45418 that is looked up in the DNS has both IPv4 and IPv6 addresses, both types of
45419 address are used.
45420 </para>
45421 <para>
45422 During delivery, the hosts are tried in order, subject to their retry status,
45423 unless <option>hosts_randomize</option> is set.
45424 </para>
45425 <para>
45426 <indexterm role="option">
45427 <primary><option>hosts_avoid_esmtp</option></primary>
45428 </indexterm>
45429 </para>
45430 <informaltable frame="all">
45431 <tgroup cols="4" colsep="0" rowsep="0">
45432 <colspec colwidth="8*" align="left"/>
45433 <colspec colwidth="6*" align="center"/>
45434 <colspec colwidth="6*" align="center"/>
45435 <colspec colwidth="6*" align="right"/>
45436 <tbody>
45437 <row>
45438 <entry><option>hosts_avoid_esmtp</option></entry>
45439 <entry>Use: <emphasis>smtp</emphasis></entry>
45440 <entry>Type: <emphasis>host list</emphasis>&dagger;<emphasis></emphasis></entry>
45441 <entry>Default: <emphasis>unset</emphasis></entry>
45442 </row>
45443 </tbody>
45444 </tgroup>
45445 </informaltable>
45446 <para>
45447 <indexterm role="concept">
45448 <primary>ESMTP, avoiding use of</primary>
45449 </indexterm>
45450 <indexterm role="concept">
45451 <primary>HELO</primary>
45452 <secondary>forcing use of</secondary>
45453 </indexterm>
45454 <indexterm role="concept">
45455 <primary>EHLO</primary>
45456 <secondary>avoiding use of</secondary>
45457 </indexterm>
45458 <indexterm role="concept">
45459 <primary>PIPELINING</primary>
45460 <secondary>avoiding the use of</secondary>
45461 </indexterm>
45462 This option is for use with broken hosts that announce ESMTP facilities (for
45463 example, PIPELINING) and then fail to implement them properly. When a host
45464 matches <option>hosts_avoid_esmtp</option>, Exim sends HELO rather than EHLO at the
45465 start of the SMTP session. This means that it cannot use any of the ESMTP
45466 facilities such as AUTH, PIPELINING, SIZE, and STARTTLS.
45467 </para>
45468 <para>
45469 <indexterm role="option">
45470 <primary><option>hosts_avoid_pipelining</option></primary>
45471 </indexterm>
45472 </para>
45473 <informaltable frame="all">
45474 <tgroup cols="4" colsep="0" rowsep="0">
45475 <colspec colwidth="8*" align="left"/>
45476 <colspec colwidth="6*" align="center"/>
45477 <colspec colwidth="6*" align="center"/>
45478 <colspec colwidth="6*" align="right"/>
45479 <tbody>
45480 <row>
45481 <entry><option>hosts_avoid_pipelining</option></entry>
45482 <entry>Use: <emphasis>smtp</emphasis></entry>
45483 <entry>Type: <emphasis>host list</emphasis>&dagger;<emphasis></emphasis></entry>
45484 <entry>Default: <emphasis>unset</emphasis></entry>
45485 </row>
45486 </tbody>
45487 </tgroup>
45488 </informaltable>
45489 <para>
45490 <indexterm role="concept">
45491 <primary>PIPELINING</primary>
45492 <secondary>avoiding the use of</secondary>
45493 </indexterm>
45494 Exim will not use the SMTP PIPELINING extension when delivering to any host
45495 that matches this list, even if the server host advertises PIPELINING support.
45496 </para>
45497 <para>
45498 <indexterm role="option">
45499 <primary><option>hosts_avoid_tls</option></primary>
45500 </indexterm>
45501 </para>
45502 <informaltable frame="all">
45503 <tgroup cols="4" colsep="0" rowsep="0">
45504 <colspec colwidth="8*" align="left"/>
45505 <colspec colwidth="6*" align="center"/>
45506 <colspec colwidth="6*" align="center"/>
45507 <colspec colwidth="6*" align="right"/>
45508 <tbody>
45509 <row>
45510 <entry><option>hosts_avoid_tls</option></entry>
45511 <entry>Use: <emphasis>smtp</emphasis></entry>
45512 <entry>Type: <emphasis>host list</emphasis>&dagger;<emphasis></emphasis></entry>
45513 <entry>Default: <emphasis>unset</emphasis></entry>
45514 </row>
45515 </tbody>
45516 </tgroup>
45517 </informaltable>
45518 <para>
45519 <indexterm role="concept">
45520 <primary>TLS</primary>
45521 <secondary>avoiding for certain hosts</secondary>
45522 </indexterm>
45523 Exim will not try to start a TLS session when delivering to any host that
45524 matches this list. See chapter <xref linkend="CHAPTLS"/> for details of TLS.
45525 </para>
45526 <para revisionflag="changed">
45527 <indexterm role="option">
45528 <primary><option>hosts_verify_avoid_tls</option></primary>
45529 </indexterm>
45530 </para>
45531 <informaltable frame="all" revisionflag="changed">
45532 <tgroup cols="4" colsep="0" rowsep="0">
45533 <colspec colwidth="8*" align="left"/>
45534 <colspec colwidth="6*" align="center"/>
45535 <colspec colwidth="6*" align="center"/>
45536 <colspec colwidth="6*" align="right"/>
45537 <tbody>
45538 <row>
45539 <entry><option>hosts_verify_avoid_tls</option></entry>
45540 <entry>Use: <emphasis>smtp</emphasis></entry>
45541 <entry>Type: <emphasis>host list</emphasis>&dagger;<emphasis></emphasis></entry>
45542 <entry>Default: <emphasis>unset</emphasis></entry>
45543 </row>
45544 </tbody>
45545 </tgroup>
45546 </informaltable>
45547 <para revisionflag="changed">
45548 <indexterm role="concept">
45549 <primary>TLS</primary>
45550 <secondary>avoiding for certain hosts</secondary>
45551 </indexterm>
45552 Exim will not try to start a TLS session for a verify callout,
45553 or when delivering in cutthrough mode,
45554 to any host that matches this list.
45555 </para>
45556 <para>
45557 <indexterm role="option">
45558 <primary><option>hosts_max_try</option></primary>
45559 </indexterm>
45560 </para>
45561 <informaltable frame="all">
45562 <tgroup cols="4" colsep="0" rowsep="0">
45563 <colspec colwidth="8*" align="left"/>
45564 <colspec colwidth="6*" align="center"/>
45565 <colspec colwidth="6*" align="center"/>
45566 <colspec colwidth="6*" align="right"/>
45567 <tbody>
45568 <row>
45569 <entry><option>hosts_max_try</option></entry>
45570 <entry>Use: <emphasis>smtp</emphasis></entry>
45571 <entry>Type: <emphasis>integer</emphasis></entry>
45572 <entry>Default: <emphasis>5</emphasis></entry>
45573 </row>
45574 </tbody>
45575 </tgroup>
45576 </informaltable>
45577 <para>
45578 <indexterm role="concept">
45579 <primary>host</primary>
45580 <secondary>maximum number to try</secondary>
45581 </indexterm>
45582 <indexterm role="concept">
45583 <primary>limit</primary>
45584 <secondary>number of hosts tried</secondary>
45585 </indexterm>
45586 <indexterm role="concept">
45587 <primary>limit</primary>
45588 <secondary>number of MX tried</secondary>
45589 </indexterm>
45590 <indexterm role="concept">
45591 <primary>MX record</primary>
45592 <secondary>maximum tried</secondary>
45593 </indexterm>
45594 This option limits the number of IP addresses that are tried for any one
45595 delivery in cases where there are temporary delivery errors. Section
45596 <xref linkend="SECTvalhosmax"/> describes in detail how the value of this option is used.
45597 </para>
45598 <para>
45599 <indexterm role="option">
45600 <primary><option>hosts_max_try_hardlimit</option></primary>
45601 </indexterm>
45602 </para>
45603 <informaltable frame="all">
45604 <tgroup cols="4" colsep="0" rowsep="0">
45605 <colspec colwidth="8*" align="left"/>
45606 <colspec colwidth="6*" align="center"/>
45607 <colspec colwidth="6*" align="center"/>
45608 <colspec colwidth="6*" align="right"/>
45609 <tbody>
45610 <row>
45611 <entry><option>hosts_max_try_hardlimit</option></entry>
45612 <entry>Use: <emphasis>smtp</emphasis></entry>
45613 <entry>Type: <emphasis>integer</emphasis></entry>
45614 <entry>Default: <emphasis>50</emphasis></entry>
45615 </row>
45616 </tbody>
45617 </tgroup>
45618 </informaltable>
45619 <para>
45620 This is an additional check on the maximum number of IP addresses that Exim
45621 tries for any one delivery. Section <xref linkend="SECTvalhosmax"/> describes its use and
45622 why it exists.
45623 </para>
45624 <para>
45625 <indexterm role="option">
45626 <primary><option>hosts_nopass_tls</option></primary>
45627 </indexterm>
45628 </para>
45629 <informaltable frame="all">
45630 <tgroup cols="4" colsep="0" rowsep="0">
45631 <colspec colwidth="8*" align="left"/>
45632 <colspec colwidth="6*" align="center"/>
45633 <colspec colwidth="6*" align="center"/>
45634 <colspec colwidth="6*" align="right"/>
45635 <tbody>
45636 <row>
45637 <entry><option>hosts_nopass_tls</option></entry>
45638 <entry>Use: <emphasis>smtp</emphasis></entry>
45639 <entry>Type: <emphasis>host list</emphasis>&dagger;<emphasis></emphasis></entry>
45640 <entry>Default: <emphasis>unset</emphasis></entry>
45641 </row>
45642 </tbody>
45643 </tgroup>
45644 </informaltable>
45645 <para>
45646 <indexterm role="concept">
45647 <primary>TLS</primary>
45648 <secondary>passing connection</secondary>
45649 </indexterm>
45650 <indexterm role="concept">
45651 <primary>multiple SMTP deliveries</primary>
45652 </indexterm>
45653 <indexterm role="concept">
45654 <primary>TLS</primary>
45655 <secondary>multiple message deliveries</secondary>
45656 </indexterm>
45657 For any host that matches this list, a connection on which a TLS session has
45658 been started will not be passed to a new delivery process for sending another
45659 message on the same connection. See section <xref linkend="SECTmulmessam"/> for an
45660 explanation of when this might be needed.
45661 </para>
45662 <para>
45663 <indexterm role="option">
45664 <primary><option>hosts_override</option></primary>
45665 </indexterm>
45666 </para>
45667 <informaltable frame="all">
45668 <tgroup cols="4" colsep="0" rowsep="0">
45669 <colspec colwidth="8*" align="left"/>
45670 <colspec colwidth="6*" align="center"/>
45671 <colspec colwidth="6*" align="center"/>
45672 <colspec colwidth="6*" align="right"/>
45673 <tbody>
45674 <row>
45675 <entry><option>hosts_override</option></entry>
45676 <entry>Use: <emphasis>smtp</emphasis></entry>
45677 <entry>Type: <emphasis>boolean</emphasis></entry>
45678 <entry>Default: <emphasis>false</emphasis></entry>
45679 </row>
45680 </tbody>
45681 </tgroup>
45682 </informaltable>
45683 <para>
45684 If this option is set and the <option>hosts</option> option is also set, any hosts that are
45685 attached to the address are ignored, and instead the hosts specified by the
45686 <option>hosts</option> option are always used. This option does not apply to
45687 <option>fallback_hosts</option>.
45688 </para>
45689 <para>
45690 <indexterm role="option">
45691 <primary><option>hosts_randomize</option></primary>
45692 </indexterm>
45693 </para>
45694 <informaltable frame="all">
45695 <tgroup cols="4" colsep="0" rowsep="0">
45696 <colspec colwidth="8*" align="left"/>
45697 <colspec colwidth="6*" align="center"/>
45698 <colspec colwidth="6*" align="center"/>
45699 <colspec colwidth="6*" align="right"/>
45700 <tbody>
45701 <row>
45702 <entry><option>hosts_randomize</option></entry>
45703 <entry>Use: <emphasis>smtp</emphasis></entry>
45704 <entry>Type: <emphasis>boolean</emphasis></entry>
45705 <entry>Default: <emphasis>false</emphasis></entry>
45706 </row>
45707 </tbody>
45708 </tgroup>
45709 </informaltable>
45710 <para>
45711 <indexterm role="concept">
45712 <primary>randomized host list</primary>
45713 </indexterm>
45714 <indexterm role="concept">
45715 <primary>host</primary>
45716 <secondary>list of; randomized</secondary>
45717 </indexterm>
45718 <indexterm role="concept">
45719 <primary>fallback</primary>
45720 <secondary>randomized hosts</secondary>
45721 </indexterm>
45722 If this option is set, and either the list of hosts is taken from the
45723 <option>hosts</option> or the <option>fallback_hosts</option> option, or the hosts supplied by the router
45724 were not obtained from MX records (this includes fallback hosts from the
45725 router), and were not randomized by the router, the order of trying the hosts
45726 is randomized each time the transport runs. Randomizing the order of a host
45727 list can be used to do crude load sharing.
45728 </para>
45729 <para>
45730 When <option>hosts_randomize</option> is true, a host list may be split into groups whose
45731 order is separately randomized. This makes it possible to set up MX-like
45732 behaviour. The boundaries between groups are indicated by an item that is just
45733 <literal>+</literal> in the host list. For example:
45734 </para>
45735 <literallayout class="monospaced">
45736 hosts = host1:host2:host3:+:host4:host5
45737 </literallayout>
45738 <para>
45739 The order of the first three hosts and the order of the last two hosts is
45740 randomized for each use, but the first three always end up before the last two.
45741 If <option>hosts_randomize</option> is not set, a <literal>+</literal> item in the list is ignored.
45742 </para>
45743 <para>
45744 <indexterm role="option">
45745 <primary><option>hosts_require_auth</option></primary>
45746 </indexterm>
45747 </para>
45748 <informaltable frame="all">
45749 <tgroup cols="4" colsep="0" rowsep="0">
45750 <colspec colwidth="8*" align="left"/>
45751 <colspec colwidth="6*" align="center"/>
45752 <colspec colwidth="6*" align="center"/>
45753 <colspec colwidth="6*" align="right"/>
45754 <tbody>
45755 <row>
45756 <entry><option>hosts_require_auth</option></entry>
45757 <entry>Use: <emphasis>smtp</emphasis></entry>
45758 <entry>Type: <emphasis>host list</emphasis>&dagger;<emphasis></emphasis></entry>
45759 <entry>Default: <emphasis>unset</emphasis></entry>
45760 </row>
45761 </tbody>
45762 </tgroup>
45763 </informaltable>
45764 <para>
45765 <indexterm role="concept">
45766 <primary>authentication</primary>
45767 <secondary>required by client</secondary>
45768 </indexterm>
45769 This option provides a list of servers for which authentication must succeed
45770 before Exim will try to transfer a message. If authentication fails for
45771 servers which are not in this list, Exim tries to send unauthenticated. If
45772 authentication fails for one of these servers, delivery is deferred. This
45773 temporary error is detectable in the retry rules, so it can be turned into a
45774 hard failure if required. See also <option>hosts_try_auth</option>, and chapter
45775 <xref linkend="CHAPSMTPAUTH"/> for details of authentication.
45776 </para>
45777 <para>
45778 <indexterm role="option">
45779 <primary><option>hosts_request_ocsp</option></primary>
45780 </indexterm>
45781 </para>
45782 <informaltable frame="all">
45783 <tgroup cols="4" colsep="0" rowsep="0">
45784 <colspec colwidth="8*" align="left"/>
45785 <colspec colwidth="6*" align="center"/>
45786 <colspec colwidth="6*" align="center"/>
45787 <colspec colwidth="6*" align="right"/>
45788 <tbody>
45789 <row>
45790 <entry><option>hosts_request_ocsp</option></entry>
45791 <entry>Use: <emphasis>smtp</emphasis></entry>
45792 <entry>Type: <emphasis>host list</emphasis>&dagger;<emphasis></emphasis></entry>
45793 <entry>Default: <emphasis>*</emphasis></entry>
45794 </row>
45795 </tbody>
45796 </tgroup>
45797 </informaltable>
45798 <para>
45799 <indexterm role="concept">
45800 <primary>TLS</primary>
45801 <secondary>requiring for certain servers</secondary>
45802 </indexterm>
45803 Exim will request a Certificate Status on a
45804 TLS session for any host that matches this list.
45805 <option>tls_verify_certificates</option> should also be set for the transport.
45806 </para>
45807 <para>
45808 <indexterm role="option">
45809 <primary><option>hosts_require_ocsp</option></primary>
45810 </indexterm>
45811 </para>
45812 <informaltable frame="all">
45813 <tgroup cols="4" colsep="0" rowsep="0">
45814 <colspec colwidth="8*" align="left"/>
45815 <colspec colwidth="6*" align="center"/>
45816 <colspec colwidth="6*" align="center"/>
45817 <colspec colwidth="6*" align="right"/>
45818 <tbody>
45819 <row>
45820 <entry><option>hosts_require_ocsp</option></entry>
45821 <entry>Use: <emphasis>smtp</emphasis></entry>
45822 <entry>Type: <emphasis>host list</emphasis>&dagger;<emphasis></emphasis></entry>
45823 <entry>Default: <emphasis>unset</emphasis></entry>
45824 </row>
45825 </tbody>
45826 </tgroup>
45827 </informaltable>
45828 <para>
45829 <indexterm role="concept">
45830 <primary>TLS</primary>
45831 <secondary>requiring for certain servers</secondary>
45832 </indexterm>
45833 Exim will request, and check for a valid Certificate Status being given, on a
45834 TLS session for any host that matches this list.
45835 <option>tls_verify_certificates</option> should also be set for the transport.
45836 </para>
45837 <para>
45838 <indexterm role="option">
45839 <primary><option>hosts_require_tls</option></primary>
45840 </indexterm>
45841 </para>
45842 <informaltable frame="all">
45843 <tgroup cols="4" colsep="0" rowsep="0">
45844 <colspec colwidth="8*" align="left"/>
45845 <colspec colwidth="6*" align="center"/>
45846 <colspec colwidth="6*" align="center"/>
45847 <colspec colwidth="6*" align="right"/>
45848 <tbody>
45849 <row>
45850 <entry><option>hosts_require_tls</option></entry>
45851 <entry>Use: <emphasis>smtp</emphasis></entry>
45852 <entry>Type: <emphasis>host list</emphasis>&dagger;<emphasis></emphasis></entry>
45853 <entry>Default: <emphasis>unset</emphasis></entry>
45854 </row>
45855 </tbody>
45856 </tgroup>
45857 </informaltable>
45858 <para>
45859 <indexterm role="concept">
45860 <primary>TLS</primary>
45861 <secondary>requiring for certain servers</secondary>
45862 </indexterm>
45863 Exim will insist on using a TLS session when delivering to any host that
45864 matches this list. See chapter <xref linkend="CHAPTLS"/> for details of TLS.
45865 <emphasis role="bold">Note</emphasis>: This option affects outgoing mail only. To insist on TLS for
45866 incoming messages, use an appropriate ACL.
45867 </para>
45868 <para>
45869 <indexterm role="option">
45870 <primary><option>hosts_try_auth</option></primary>
45871 </indexterm>
45872 </para>
45873 <informaltable frame="all">
45874 <tgroup cols="4" colsep="0" rowsep="0">
45875 <colspec colwidth="8*" align="left"/>
45876 <colspec colwidth="6*" align="center"/>
45877 <colspec colwidth="6*" align="center"/>
45878 <colspec colwidth="6*" align="right"/>
45879 <tbody>
45880 <row>
45881 <entry><option>hosts_try_auth</option></entry>
45882 <entry>Use: <emphasis>smtp</emphasis></entry>
45883 <entry>Type: <emphasis>host list</emphasis>&dagger;<emphasis></emphasis></entry>
45884 <entry>Default: <emphasis>unset</emphasis></entry>
45885 </row>
45886 </tbody>
45887 </tgroup>
45888 </informaltable>
45889 <para>
45890 <indexterm role="concept">
45891 <primary>authentication</primary>
45892 <secondary>optional in client</secondary>
45893 </indexterm>
45894 This option provides a list of servers to which, provided they announce
45895 authentication support, Exim will attempt to authenticate as a client when it
45896 connects. If authentication fails, Exim will try to transfer the message
45897 unauthenticated. See also <option>hosts_require_auth</option>, and chapter
45898 <xref linkend="CHAPSMTPAUTH"/> for details of authentication.
45899 </para>
45900 <para revisionflag="changed">
45901 <indexterm role="option">
45902 <primary><option>hosts_try_prdr</option></primary>
45903 </indexterm>
45904 </para>
45905 <informaltable frame="all" revisionflag="changed">
45906 <tgroup cols="4" colsep="0" rowsep="0">
45907 <colspec colwidth="8*" align="left"/>
45908 <colspec colwidth="6*" align="center"/>
45909 <colspec colwidth="6*" align="center"/>
45910 <colspec colwidth="6*" align="right"/>
45911 <tbody>
45912 <row>
45913 <entry><option>hosts_try_prdr</option></entry>
45914 <entry>Use: <emphasis>smtp</emphasis></entry>
45915 <entry>Type: <emphasis>host list</emphasis>&dagger;<emphasis></emphasis></entry>
45916 <entry>Default: <emphasis>*</emphasis></entry>
45917 </row>
45918 </tbody>
45919 </tgroup>
45920 </informaltable>
45921 <para revisionflag="changed">
45922 <indexterm role="concept">
45923 <primary>PRDR</primary>
45924 <secondary>enabling, optional in client</secondary>
45925 </indexterm>
45926 This option provides a list of servers to which, provided they announce
45927 PRDR support, Exim will attempt to negotiate PRDR
45928 for multi-recipient messages.
45929 The option can usually be left as default.
45930 </para>
45931 <para>
45932 <indexterm role="option">
45933 <primary><option>interface</option></primary>
45934 </indexterm>
45935 </para>
45936 <informaltable frame="all">
45937 <tgroup cols="4" colsep="0" rowsep="0">
45938 <colspec colwidth="8*" align="left"/>
45939 <colspec colwidth="6*" align="center"/>
45940 <colspec colwidth="6*" align="center"/>
45941 <colspec colwidth="6*" align="right"/>
45942 <tbody>
45943 <row>
45944 <entry><option>interface</option></entry>
45945 <entry>Use: <emphasis>smtp</emphasis></entry>
45946 <entry>Type: <emphasis>string list</emphasis>&dagger;<emphasis></emphasis></entry>
45947 <entry>Default: <emphasis>unset</emphasis></entry>
45948 </row>
45949 </tbody>
45950 </tgroup>
45951 </informaltable>
45952 <para>
45953 <indexterm role="concept">
45954 <primary>bind IP address</primary>
45955 </indexterm>
45956 <indexterm role="concept">
45957 <primary>IP address</primary>
45958 <secondary>binding</secondary>
45959 </indexterm>
45960 <indexterm role="variable">
45961 <primary><varname>$host</varname></primary>
45962 </indexterm>
45963 <indexterm role="variable">
45964 <primary><varname>$host_address</varname></primary>
45965 </indexterm>
45966 This option specifies which interface to bind to when making an outgoing SMTP
45967 call. The value is an IP address, not an interface name such as
45968 <literal>eth0</literal>. Do not confuse this with the interface address that was used when a
45969 message was received, which is in <varname>$received_ip_address</varname>, formerly known as
45970 <varname>$interface_address</varname>. The name was changed to minimize confusion with the
45971 outgoing interface address. There is no variable that contains an outgoing
45972 interface address because, unless it is set by this option, its value is
45973 unknown.
45974 </para>
45975 <para>
45976 During the expansion of the <option>interface</option> option the variables <varname>$host</varname> and
45977 <varname>$host_address</varname> refer to the host to which a connection is about to be made
45978 during the expansion of the string. Forced expansion failure, or an empty
45979 string result causes the option to be ignored. Otherwise, after expansion, the
45980 string must be a list of IP addresses, colon-separated by default, but the
45981 separator can be changed in the usual way. For example:
45982 </para>
45983 <literallayout class="monospaced">
45984 interface = &lt;; 192.168.123.123 ; 3ffe:ffff:836f::fe86:a061
45985 </literallayout>
45986 <para>
45987 The first interface of the correct type (IPv4 or IPv6) is used for the outgoing
45988 connection. If none of them are the correct type, the option is ignored. If
45989 <option>interface</option> is not set, or is ignored, the system&#x2019;s IP functions choose which
45990 interface to use if the host has more than one.
45991 </para>
45992 <para>
45993 <indexterm role="option">
45994 <primary><option>keepalive</option></primary>
45995 </indexterm>
45996 </para>
45997 <informaltable frame="all">
45998 <tgroup cols="4" colsep="0" rowsep="0">
45999 <colspec colwidth="8*" align="left"/>
46000 <colspec colwidth="6*" align="center"/>
46001 <colspec colwidth="6*" align="center"/>
46002 <colspec colwidth="6*" align="right"/>
46003 <tbody>
46004 <row>
46005 <entry><option>keepalive</option></entry>
46006 <entry>Use: <emphasis>smtp</emphasis></entry>
46007 <entry>Type: <emphasis>boolean</emphasis></entry>
46008 <entry>Default: <emphasis>true</emphasis></entry>
46009 </row>
46010 </tbody>
46011 </tgroup>
46012 </informaltable>
46013 <para>
46014 <indexterm role="concept">
46015 <primary>keepalive</primary>
46016 <secondary>on outgoing connection</secondary>
46017 </indexterm>
46018 This option controls the setting of SO_KEEPALIVE on outgoing TCP/IP socket
46019 connections. When set, it causes the kernel to probe idle connections
46020 periodically, by sending packets with <quote>old</quote> sequence numbers. The other end
46021 of the connection should send a acknowledgment if the connection is still okay
46022 or a reset if the connection has been aborted. The reason for doing this is
46023 that it has the beneficial effect of freeing up certain types of connection
46024 that can get stuck when the remote host is disconnected without tidying up the
46025 TCP/IP call properly. The keepalive mechanism takes several hours to detect
46026 unreachable hosts.
46027 </para>
46028 <para>
46029 <indexterm role="option">
46030 <primary><option>lmtp_ignore_quota</option></primary>
46031 </indexterm>
46032 </para>
46033 <informaltable frame="all">
46034 <tgroup cols="4" colsep="0" rowsep="0">
46035 <colspec colwidth="8*" align="left"/>
46036 <colspec colwidth="6*" align="center"/>
46037 <colspec colwidth="6*" align="center"/>
46038 <colspec colwidth="6*" align="right"/>
46039 <tbody>
46040 <row>
46041 <entry><option>lmtp_ignore_quota</option></entry>
46042 <entry>Use: <emphasis>smtp</emphasis></entry>
46043 <entry>Type: <emphasis>boolean</emphasis></entry>
46044 <entry>Default: <emphasis>false</emphasis></entry>
46045 </row>
46046 </tbody>
46047 </tgroup>
46048 </informaltable>
46049 <para>
46050 <indexterm role="concept">
46051 <primary>LMTP</primary>
46052 <secondary>ignoring quota errors</secondary>
46053 </indexterm>
46054 If this option is set true when the <option>protocol</option> option is set to <quote>lmtp</quote>, the
46055 string <literal>IGNOREQUOTA</literal> is added to RCPT commands, provided that the LMTP server
46056 has advertised support for IGNOREQUOTA in its response to the LHLO command.
46057 </para>
46058 <para>
46059 <indexterm role="option">
46060 <primary><option>max_rcpt</option></primary>
46061 </indexterm>
46062 </para>
46063 <informaltable frame="all">
46064 <tgroup cols="4" colsep="0" rowsep="0">
46065 <colspec colwidth="8*" align="left"/>
46066 <colspec colwidth="6*" align="center"/>
46067 <colspec colwidth="6*" align="center"/>
46068 <colspec colwidth="6*" align="right"/>
46069 <tbody>
46070 <row>
46071 <entry><option>max_rcpt</option></entry>
46072 <entry>Use: <emphasis>smtp</emphasis></entry>
46073 <entry>Type: <emphasis>integer</emphasis></entry>
46074 <entry>Default: <emphasis>100</emphasis></entry>
46075 </row>
46076 </tbody>
46077 </tgroup>
46078 </informaltable>
46079 <para>
46080 <indexterm role="concept">
46081 <primary>RCPT</primary>
46082 <secondary>maximum number of outgoing</secondary>
46083 </indexterm>
46084 This option limits the number of RCPT commands that are sent in a single
46085 SMTP message transaction. Each set of addresses is treated independently, and
46086 so can cause parallel connections to the same host if <option>remote_max_parallel</option>
46087 permits this.
46088 </para>
46089 <para>
46090 <indexterm role="option">
46091 <primary><option>multi_domain</option></primary>
46092 </indexterm>
46093 </para>
46094 <informaltable frame="all">
46095 <tgroup cols="4" colsep="0" rowsep="0">
46096 <colspec colwidth="8*" align="left"/>
46097 <colspec colwidth="6*" align="center"/>
46098 <colspec colwidth="6*" align="center"/>
46099 <colspec colwidth="6*" align="right"/>
46100 <tbody>
46101 <row>
46102 <entry><option>multi_domain</option></entry>
46103 <entry>Use: <emphasis>smtp</emphasis></entry>
46104 <entry>Type: <emphasis>boolean</emphasis>&dagger;<emphasis></emphasis></entry>
46105 <entry>Default: <emphasis>true</emphasis></entry>
46106 </row>
46107 </tbody>
46108 </tgroup>
46109 </informaltable>
46110 <para>
46111 <indexterm role="variable">
46112 <primary><varname>$domain</varname></primary>
46113 </indexterm>
46114 When this option is set, the <command>smtp</command> transport can handle a number of
46115 addresses containing a mixture of different domains provided they all resolve
46116 to the same list of hosts. Turning the option off restricts the transport to
46117 handling only one domain at a time. This is useful if you want to use
46118 <varname>$domain</varname> in an expansion for the transport, because it is set only when there
46119 is a single domain involved in a remote delivery.
46120 </para>
46121 <para revisionflag="changed">
46122 It is expanded per-address and can depend on any of
46123 <varname>$address_data</varname>, <varname>$domain_data</varname>, <varname>$local_part_data</varname>,
46124 <varname>$host</varname>, <varname>$host_address</varname> and <varname>$host_port</varname>.
46125 </para>
46126 <para>
46127 <indexterm role="option">
46128 <primary><option>port</option></primary>
46129 </indexterm>
46130 </para>
46131 <informaltable frame="all">
46132 <tgroup cols="4" colsep="0" rowsep="0">
46133 <colspec colwidth="8*" align="left"/>
46134 <colspec colwidth="6*" align="center"/>
46135 <colspec colwidth="6*" align="center"/>
46136 <colspec colwidth="6*" align="right"/>
46137 <tbody>
46138 <row>
46139 <entry><option>port</option></entry>
46140 <entry>Use: <emphasis>smtp</emphasis></entry>
46141 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
46142 <entry>Default: <emphasis>see below</emphasis></entry>
46143 </row>
46144 </tbody>
46145 </tgroup>
46146 </informaltable>
46147 <para>
46148 <indexterm role="concept">
46149 <primary>port</primary>
46150 <secondary>sending TCP/IP</secondary>
46151 </indexterm>
46152 <indexterm role="concept">
46153 <primary>TCP/IP</primary>
46154 <secondary>setting outgoing port</secondary>
46155 </indexterm>
46156 This option specifies the TCP/IP port on the server to which Exim connects.
46157 <emphasis role="bold">Note:</emphasis> Do not confuse this with the port that was used when a message was
46158 received, which is in <varname>$received_port</varname>, formerly known as <varname>$interface_port</varname>.
46159 The name was changed to minimize confusion with the outgoing port. There is no
46160 variable that contains an outgoing port.
46161 </para>
46162 <para>
46163 If the value of this option begins with a digit it is taken as a port number;
46164 otherwise it is looked up using <function>getservbyname()</function>. The default value is
46165 normally <quote>smtp</quote>, but if <option>protocol</option> is set to <quote>lmtp</quote>, the default is
46166 <quote>lmtp</quote>. If the expansion fails, or if a port number cannot be found, delivery
46167 is deferred.
46168 </para>
46169 <para>
46170 <indexterm role="option">
46171 <primary><option>protocol</option></primary>
46172 </indexterm>
46173 </para>
46174 <informaltable frame="all">
46175 <tgroup cols="4" colsep="0" rowsep="0">
46176 <colspec colwidth="8*" align="left"/>
46177 <colspec colwidth="6*" align="center"/>
46178 <colspec colwidth="6*" align="center"/>
46179 <colspec colwidth="6*" align="right"/>
46180 <tbody>
46181 <row>
46182 <entry><option>protocol</option></entry>
46183 <entry>Use: <emphasis>smtp</emphasis></entry>
46184 <entry>Type: <emphasis>string</emphasis></entry>
46185 <entry>Default: <emphasis>smtp</emphasis></entry>
46186 </row>
46187 </tbody>
46188 </tgroup>
46189 </informaltable>
46190 <para>
46191 <indexterm role="concept">
46192 <primary>LMTP</primary>
46193 <secondary>over TCP/IP</secondary>
46194 </indexterm>
46195 <indexterm role="concept">
46196 <primary>ssmtp protocol</primary>
46197 <secondary>outbound</secondary>
46198 </indexterm>
46199 <indexterm role="concept">
46200 <primary>TLS</primary>
46201 <secondary>SSL-on-connect outbound</secondary>
46202 </indexterm>
46203 <indexterm role="variable">
46204 <primary><varname>$port</varname></primary>
46205 </indexterm>
46206 If this option is set to <quote>lmtp</quote> instead of <quote>smtp</quote>, the default value for
46207 the <option>port</option> option changes to <quote>lmtp</quote>, and the transport operates the LMTP
46208 protocol (RFC 2033) instead of SMTP. This protocol is sometimes used for local
46209 deliveries into closed message stores. Exim also has support for running LMTP
46210 over a pipe to a local process &ndash; see chapter <xref linkend="CHAPLMTP"/>.
46211 </para>
46212 <para>
46213 If this option is set to <quote>smtps</quote>, the default value for the <option>port</option> option
46214 changes to <quote>smtps</quote>, and the transport initiates TLS immediately after
46215 connecting, as an outbound SSL-on-connect, instead of using STARTTLS to upgrade.
46216 The Internet standards bodies strongly discourage use of this mode.
46217 </para>
46218 <para>
46219 <indexterm role="option">
46220 <primary><option>retry_include_ip_address</option></primary>
46221 </indexterm>
46222 </para>
46223 <informaltable frame="all">
46224 <tgroup cols="4" colsep="0" rowsep="0">
46225 <colspec colwidth="8*" align="left"/>
46226 <colspec colwidth="6*" align="center"/>
46227 <colspec colwidth="6*" align="center"/>
46228 <colspec colwidth="6*" align="right"/>
46229 <tbody>
46230 <row>
46231 <entry><option>retry_include_ip_address</option></entry>
46232 <entry>Use: <emphasis>smtp</emphasis></entry>
46233 <entry>Type: <emphasis>boolean</emphasis>&dagger;<emphasis></emphasis></entry>
46234 <entry>Default: <emphasis>true</emphasis></entry>
46235 </row>
46236 </tbody>
46237 </tgroup>
46238 </informaltable>
46239 <para>
46240 Exim normally includes both the host name and the IP address in the key it
46241 constructs for indexing retry data after a temporary delivery failure. This
46242 means that when one of several IP addresses for a host is failing, it gets
46243 tried periodically (controlled by the retry rules), but use of the other IP
46244 addresses is not affected.
46245 </para>
46246 <para>
46247 However, in some dialup environments hosts are assigned a different IP address
46248 each time they connect. In this situation the use of the IP address as part of
46249 the retry key leads to undesirable behaviour. Setting this option false causes
46250 Exim to use only the host name.
46251 </para>
46252 <para revisionflag="changed">
46253 Since it is expanded it can be made to depend on the host or domain.
46254 </para>
46255 <para>
46256 <indexterm role="option">
46257 <primary><option>serialize_hosts</option></primary>
46258 </indexterm>
46259 </para>
46260 <informaltable frame="all">
46261 <tgroup cols="4" colsep="0" rowsep="0">
46262 <colspec colwidth="8*" align="left"/>
46263 <colspec colwidth="6*" align="center"/>
46264 <colspec colwidth="6*" align="center"/>
46265 <colspec colwidth="6*" align="right"/>
46266 <tbody>
46267 <row>
46268 <entry><option>serialize_hosts</option></entry>
46269 <entry>Use: <emphasis>smtp</emphasis></entry>
46270 <entry>Type: <emphasis>host list</emphasis>&dagger;<emphasis></emphasis></entry>
46271 <entry>Default: <emphasis>unset</emphasis></entry>
46272 </row>
46273 </tbody>
46274 </tgroup>
46275 </informaltable>
46276 <para>
46277 <indexterm role="concept">
46278 <primary>serializing connections</primary>
46279 </indexterm>
46280 <indexterm role="concept">
46281 <primary>host</primary>
46282 <secondary>serializing connections</secondary>
46283 </indexterm>
46284 Because Exim operates in a distributed manner, if several messages for the same
46285 host arrive at around the same time, more than one simultaneous connection to
46286 the remote host can occur. This is not usually a problem except when there is a
46287 slow link between the hosts. In that situation it may be helpful to restrict
46288 Exim to one connection at a time. This can be done by setting
46289 <option>serialize_hosts</option> to match the relevant hosts.
46290 </para>
46291 <para>
46292 <indexterm role="concept">
46293 <primary>hints database</primary>
46294 <secondary>serializing deliveries to a host</secondary>
46295 </indexterm>
46296 Exim implements serialization by means of a hints database in which a record is
46297 written whenever a process connects to one of the restricted hosts. The record
46298 is deleted when the connection is completed. Obviously there is scope for
46299 records to get left lying around if there is a system or program crash. To
46300 guard against this, Exim ignores any records that are more than six hours old.
46301 </para>
46302 <para>
46303 If you set up this kind of serialization, you should also arrange to delete the
46304 relevant hints database whenever your system reboots. The names of the files
46305 start with <filename>misc</filename> and they are kept in the <filename>spool/db</filename> directory. There
46306 may be one or two files, depending on the type of DBM in use. The same files
46307 are used for ETRN serialization.
46308 </para>
46309 <para>
46310 <indexterm role="option">
46311 <primary><option>size_addition</option></primary>
46312 </indexterm>
46313 </para>
46314 <informaltable frame="all">
46315 <tgroup cols="4" colsep="0" rowsep="0">
46316 <colspec colwidth="8*" align="left"/>
46317 <colspec colwidth="6*" align="center"/>
46318 <colspec colwidth="6*" align="center"/>
46319 <colspec colwidth="6*" align="right"/>
46320 <tbody>
46321 <row>
46322 <entry><option>size_addition</option></entry>
46323 <entry>Use: <emphasis>smtp</emphasis></entry>
46324 <entry>Type: <emphasis>integer</emphasis></entry>
46325 <entry>Default: <emphasis>1024</emphasis></entry>
46326 </row>
46327 </tbody>
46328 </tgroup>
46329 </informaltable>
46330 <para>
46331 <indexterm role="concept">
46332 <primary>SMTP</primary>
46333 <secondary>SIZE</secondary>
46334 </indexterm>
46335 <indexterm role="concept">
46336 <primary>message</primary>
46337 <secondary>size issue for transport filter</secondary>
46338 </indexterm>
46339 <indexterm role="concept">
46340 <primary>size</primary>
46341 <secondary>of message</secondary>
46342 </indexterm>
46343 <indexterm role="concept">
46344 <primary>transport</primary>
46345 <secondary>filter</secondary>
46346 </indexterm>
46347 <indexterm role="concept">
46348 <primary>filter</primary>
46349 <secondary>transport filter</secondary>
46350 </indexterm>
46351 If a remote SMTP server indicates that it supports the SIZE option of the
46352 MAIL command, Exim uses this to pass over the message size at the start of
46353 an SMTP transaction. It adds the value of <option>size_addition</option> to the value it
46354 sends, to allow for headers and other text that may be added during delivery by
46355 configuration options or in a transport filter. It may be necessary to increase
46356 this if a lot of text is added to messages.
46357 </para>
46358 <para>
46359 Alternatively, if the value of <option>size_addition</option> is set negative, it disables
46360 the use of the SIZE option altogether.
46361 </para>
46362 <para>
46363 <indexterm role="option">
46364 <primary><option>tls_certificate</option></primary>
46365 </indexterm>
46366 </para>
46367 <informaltable frame="all">
46368 <tgroup cols="4" colsep="0" rowsep="0">
46369 <colspec colwidth="8*" align="left"/>
46370 <colspec colwidth="6*" align="center"/>
46371 <colspec colwidth="6*" align="center"/>
46372 <colspec colwidth="6*" align="right"/>
46373 <tbody>
46374 <row>
46375 <entry><option>tls_certificate</option></entry>
46376 <entry>Use: <emphasis>smtp</emphasis></entry>
46377 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
46378 <entry>Default: <emphasis>unset</emphasis></entry>
46379 </row>
46380 </tbody>
46381 </tgroup>
46382 </informaltable>
46383 <para>
46384 <indexterm role="concept">
46385 <primary>TLS</primary>
46386 <secondary>client certificate, location of</secondary>
46387 </indexterm>
46388 <indexterm role="concept">
46389 <primary>certificate</primary>
46390 <secondary>client, location of</secondary>
46391 </indexterm>
46392 <indexterm role="variable">
46393 <primary><varname>$host</varname></primary>
46394 </indexterm>
46395 <indexterm role="variable">
46396 <primary><varname>$host_address</varname></primary>
46397 </indexterm>
46398 The value of this option must be the absolute path to a file which contains the
46399 client&#x2019;s certificate, for possible use when sending a message over an encrypted
46400 connection. The values of <varname>$host</varname> and <varname>$host_address</varname> are set to the name and
46401 address of the server during the expansion. See chapter <xref linkend="CHAPTLS"/> for
46402 details of TLS.
46403 </para>
46404 <para>
46405 <emphasis role="bold">Note</emphasis>: This option must be set if you want Exim to be able to use a TLS
46406 certificate when sending messages as a client. The global option of the same
46407 name specifies the certificate for Exim as a server; it is not automatically
46408 assumed that the same certificate should be used when Exim is operating as a
46409 client.
46410 </para>
46411 <para>
46412 <indexterm role="option">
46413 <primary><option>tls_crl</option></primary>
46414 </indexterm>
46415 </para>
46416 <informaltable frame="all">
46417 <tgroup cols="4" colsep="0" rowsep="0">
46418 <colspec colwidth="8*" align="left"/>
46419 <colspec colwidth="6*" align="center"/>
46420 <colspec colwidth="6*" align="center"/>
46421 <colspec colwidth="6*" align="right"/>
46422 <tbody>
46423 <row>
46424 <entry><option>tls_crl</option></entry>
46425 <entry>Use: <emphasis>smtp</emphasis></entry>
46426 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
46427 <entry>Default: <emphasis>unset</emphasis></entry>
46428 </row>
46429 </tbody>
46430 </tgroup>
46431 </informaltable>
46432 <para>
46433 <indexterm role="concept">
46434 <primary>TLS</primary>
46435 <secondary>client certificate revocation list</secondary>
46436 </indexterm>
46437 <indexterm role="concept">
46438 <primary>certificate</primary>
46439 <secondary>revocation list for client</secondary>
46440 </indexterm>
46441 This option specifies a certificate revocation list. The expanded value must
46442 be the name of a file that contains a CRL in PEM format.
46443 </para>
46444 <para>
46445 <indexterm role="option">
46446 <primary><option>tls_dh_min_bits</option></primary>
46447 </indexterm>
46448 </para>
46449 <informaltable frame="all">
46450 <tgroup cols="4" colsep="0" rowsep="0">
46451 <colspec colwidth="8*" align="left"/>
46452 <colspec colwidth="6*" align="center"/>
46453 <colspec colwidth="6*" align="center"/>
46454 <colspec colwidth="6*" align="right"/>
46455 <tbody>
46456 <row>
46457 <entry><option>tls_dh_min_bits</option></entry>
46458 <entry>Use: <emphasis>smtp</emphasis></entry>
46459 <entry>Type: <emphasis>integer</emphasis></entry>
46460 <entry>Default: <emphasis>1024</emphasis></entry>
46461 </row>
46462 </tbody>
46463 </tgroup>
46464 </informaltable>
46465 <para>
46466 <indexterm role="concept">
46467 <primary>TLS</primary>
46468 <secondary>Diffie-Hellman minimum acceptable size</secondary>
46469 </indexterm>
46470 When establishing a TLS session, if a ciphersuite which uses Diffie-Hellman
46471 key agreement is negotiated, the server will provide a large prime number
46472 for use.  This option establishes the minimum acceptable size of that number.
46473 If the parameter offered by the server is too small, then the TLS handshake
46474 will fail.
46475 </para>
46476 <para>
46477 Only supported when using GnuTLS.
46478 </para>
46479 <para>
46480 <indexterm role="option">
46481 <primary><option>tls_privatekey</option></primary>
46482 </indexterm>
46483 </para>
46484 <informaltable frame="all">
46485 <tgroup cols="4" colsep="0" rowsep="0">
46486 <colspec colwidth="8*" align="left"/>
46487 <colspec colwidth="6*" align="center"/>
46488 <colspec colwidth="6*" align="center"/>
46489 <colspec colwidth="6*" align="right"/>
46490 <tbody>
46491 <row>
46492 <entry><option>tls_privatekey</option></entry>
46493 <entry>Use: <emphasis>smtp</emphasis></entry>
46494 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
46495 <entry>Default: <emphasis>unset</emphasis></entry>
46496 </row>
46497 </tbody>
46498 </tgroup>
46499 </informaltable>
46500 <para>
46501 <indexterm role="concept">
46502 <primary>TLS</primary>
46503 <secondary>client private key, location of</secondary>
46504 </indexterm>
46505 <indexterm role="variable">
46506 <primary><varname>$host</varname></primary>
46507 </indexterm>
46508 <indexterm role="variable">
46509 <primary><varname>$host_address</varname></primary>
46510 </indexterm>
46511 The value of this option must be the absolute path to a file which contains the
46512 client&#x2019;s private key. This is used when sending a message over an encrypted
46513 connection using a client certificate. The values of <varname>$host</varname> and
46514 <varname>$host_address</varname> are set to the name and address of the server during the
46515 expansion. If this option is unset, or the expansion is forced to fail, or the
46516 result is an empty string, the private key is assumed to be in the same file as
46517 the certificate. See chapter <xref linkend="CHAPTLS"/> for details of TLS.
46518 </para>
46519 <para>
46520 <indexterm role="option">
46521 <primary><option>tls_require_ciphers</option></primary>
46522 </indexterm>
46523 </para>
46524 <informaltable frame="all">
46525 <tgroup cols="4" colsep="0" rowsep="0">
46526 <colspec colwidth="8*" align="left"/>
46527 <colspec colwidth="6*" align="center"/>
46528 <colspec colwidth="6*" align="center"/>
46529 <colspec colwidth="6*" align="right"/>
46530 <tbody>
46531 <row>
46532 <entry><option>tls_require_ciphers</option></entry>
46533 <entry>Use: <emphasis>smtp</emphasis></entry>
46534 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
46535 <entry>Default: <emphasis>unset</emphasis></entry>
46536 </row>
46537 </tbody>
46538 </tgroup>
46539 </informaltable>
46540 <para>
46541 <indexterm role="concept">
46542 <primary>TLS</primary>
46543 <secondary>requiring specific ciphers</secondary>
46544 </indexterm>
46545 <indexterm role="concept">
46546 <primary>cipher</primary>
46547 <secondary>requiring specific</secondary>
46548 </indexterm>
46549 <indexterm role="variable">
46550 <primary><varname>$host</varname></primary>
46551 </indexterm>
46552 <indexterm role="variable">
46553 <primary><varname>$host_address</varname></primary>
46554 </indexterm>
46555 The value of this option must be a list of permitted cipher suites, for use
46556 when setting up an outgoing encrypted connection. (There is a global option of
46557 the same name for controlling incoming connections.) The values of <varname>$host</varname> and
46558 <varname>$host_address</varname> are set to the name and address of the server during the
46559 expansion. See chapter <xref linkend="CHAPTLS"/> for details of TLS; note that this option
46560 is used in different ways by OpenSSL and GnuTLS (see sections
46561 <xref linkend="SECTreqciphssl"/> and <xref linkend="SECTreqciphgnu"/>). For GnuTLS, the order of the
46562 ciphers is a preference order.
46563 </para>
46564 <para>
46565 <indexterm role="option">
46566 <primary><option>tls_sni</option></primary>
46567 </indexterm>
46568 </para>
46569 <informaltable frame="all">
46570 <tgroup cols="4" colsep="0" rowsep="0">
46571 <colspec colwidth="8*" align="left"/>
46572 <colspec colwidth="6*" align="center"/>
46573 <colspec colwidth="6*" align="center"/>
46574 <colspec colwidth="6*" align="right"/>
46575 <tbody>
46576 <row>
46577 <entry><option>tls_sni</option></entry>
46578 <entry>Use: <emphasis>smtp</emphasis></entry>
46579 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
46580 <entry>Default: <emphasis>unset</emphasis></entry>
46581 </row>
46582 </tbody>
46583 </tgroup>
46584 </informaltable>
46585 <para>
46586 <indexterm role="concept">
46587 <primary>TLS</primary>
46588 <secondary>Server Name Indication</secondary>
46589 </indexterm>
46590 <indexterm role="variable">
46591 <primary><varname>$tls_sni</varname></primary>
46592 </indexterm>
46593 If this option is set then it sets the $tls_out_sni variable and causes any
46594 TLS session to pass this value as the Server Name Indication extension to
46595 the remote side, which can be used by the remote side to select an appropriate
46596 certificate and private key for the session.
46597 </para>
46598 <para>
46599 See <xref linkend="SECTtlssni"/> for more information.
46600 </para>
46601 <para>
46602 Note that for OpenSSL, this feature requires a build of OpenSSL that supports
46603 TLS extensions.
46604 </para>
46605 <para>
46606 <indexterm role="option">
46607 <primary><option>tls_tempfail_tryclear</option></primary>
46608 </indexterm>
46609 </para>
46610 <informaltable frame="all">
46611 <tgroup cols="4" colsep="0" rowsep="0">
46612 <colspec colwidth="8*" align="left"/>
46613 <colspec colwidth="6*" align="center"/>
46614 <colspec colwidth="6*" align="center"/>
46615 <colspec colwidth="6*" align="right"/>
46616 <tbody>
46617 <row>
46618 <entry><option>tls_tempfail_tryclear</option></entry>
46619 <entry>Use: <emphasis>smtp</emphasis></entry>
46620 <entry>Type: <emphasis>boolean</emphasis></entry>
46621 <entry>Default: <emphasis>true</emphasis></entry>
46622 </row>
46623 </tbody>
46624 </tgroup>
46625 </informaltable>
46626 <para>
46627 <indexterm role="concept">
46628 <primary>4<emphasis>xx</emphasis> responses</primary>
46629 <secondary>to STARTTLS</secondary>
46630 </indexterm>
46631 When the server host is not in <option>hosts_require_tls</option>, and there is a problem in
46632 setting up a TLS session, this option determines whether or not Exim should try
46633 to deliver the message unencrypted. If it is set false, delivery to the
46634 current host is deferred; if there are other hosts, they are tried. If this
46635 option is set true, Exim attempts to deliver unencrypted after a 4<emphasis>xx</emphasis>
46636 response to STARTTLS. Also, if STARTTLS is accepted, but the subsequent
46637 TLS negotiation fails, Exim closes the current connection (because it is in an
46638 unknown state), opens a new one to the same host, and then tries the delivery
46639 in clear.
46640 </para>
46641 <para revisionflag="changed">
46642 <indexterm role="option">
46643 <primary><option>tls_try_verify_hosts</option></primary>
46644 </indexterm>
46645 </para>
46646 <informaltable frame="all" revisionflag="changed">
46647 <tgroup cols="4" colsep="0" rowsep="0">
46648 <colspec colwidth="8*" align="left"/>
46649 <colspec colwidth="6*" align="center"/>
46650 <colspec colwidth="6*" align="center"/>
46651 <colspec colwidth="6*" align="right"/>
46652 <tbody>
46653 <row>
46654 <entry><option>tls_try_verify_hosts</option></entry>
46655 <entry>Use: <emphasis>smtp</emphasis></entry>
46656 <entry>Type: <emphasis>host list</emphasis>&dagger;<emphasis></emphasis></entry>
46657 <entry>Default: <emphasis>*</emphasis></entry>
46658 </row>
46659 </tbody>
46660 </tgroup>
46661 </informaltable>
46662 <para>
46663 <indexterm role="concept">
46664 <primary>TLS</primary>
46665 <secondary>server certificate verification</secondary>
46666 </indexterm>
46667 <indexterm role="concept">
46668 <primary>certificate</primary>
46669 <secondary>verification of server</secondary>
46670 </indexterm>
46671 This option gives a list of hosts for which, on encrypted connections,
46672 certificate verification will be tried but need not succeed.
46673 The <option>tls_verify_certificates</option> option must also be set.
46674 Note that unless the host is in this list
46675 TLS connections will be denied to hosts using self-signed certificates
46676 when <option>tls_verify_certificates</option> is matched.
46677 The <varname>$tls_out_certificate_verified</varname> variable is set when
46678 certificate verification succeeds.
46679 </para>
46680 <para revisionflag="changed">
46681 <indexterm role="option">
46682 <primary><option>tls_verify_cert_hostnames</option></primary>
46683 </indexterm>
46684 </para>
46685 <informaltable frame="all" revisionflag="changed">
46686 <tgroup cols="4" colsep="0" rowsep="0">
46687 <colspec colwidth="8*" align="left"/>
46688 <colspec colwidth="6*" align="center"/>
46689 <colspec colwidth="6*" align="center"/>
46690 <colspec colwidth="6*" align="right"/>
46691 <tbody>
46692 <row>
46693 <entry><option>tls_verify_cert_hostnames</option></entry>
46694 <entry>Use: <emphasis>smtp</emphasis></entry>
46695 <entry>Type: <emphasis>host list</emphasis>&dagger;<emphasis></emphasis></entry>
46696 <entry>Default: <emphasis>*</emphasis></entry>
46697 </row>
46698 </tbody>
46699 </tgroup>
46700 </informaltable>
46701 <para revisionflag="changed">
46702 <indexterm role="concept">
46703 <primary>TLS</primary>
46704 <secondary>server certificate hostname verification</secondary>
46705 </indexterm>
46706 <indexterm role="concept">
46707 <primary>certificate</primary>
46708 <secondary>verification of server</secondary>
46709 </indexterm>
46710 This option give a list of hosts for which,
46711 while verifying the server certificate,
46712 checks will be included on the host name
46713 (note that this will generally be the result of a DNS MX lookup)
46714 versus Subject and Subject-Alternate-Name fields.  Wildcard names are permitted
46715 limited to being the initial component of a 3-or-more component FQDN.
46716 </para>
46717 <para revisionflag="changed">
46718 There is no equivalent checking on client certificates.
46719 </para>
46720 <para revisionflag="changed">
46721 <indexterm role="option">
46722 <primary><option>tls_verify_certificates</option></primary>
46723 </indexterm>
46724 </para>
46725 <informaltable frame="all" revisionflag="changed">
46726 <tgroup cols="4" colsep="0" rowsep="0">
46727 <colspec colwidth="8*" align="left"/>
46728 <colspec colwidth="6*" align="center"/>
46729 <colspec colwidth="6*" align="center"/>
46730 <colspec colwidth="6*" align="right"/>
46731 <tbody>
46732 <row>
46733 <entry><option>tls_verify_certificates</option></entry>
46734 <entry>Use: <emphasis>smtp</emphasis></entry>
46735 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
46736 <entry>Default: <emphasis>system</emphasis></entry>
46737 </row>
46738 </tbody>
46739 </tgroup>
46740 </informaltable>
46741 <para revisionflag="changed">
46742 <indexterm role="concept">
46743 <primary>TLS</primary>
46744 <secondary>server certificate verification</secondary>
46745 </indexterm>
46746 <indexterm role="concept">
46747 <primary>certificate</primary>
46748 <secondary>verification of server</secondary>
46749 </indexterm>
46750 <indexterm role="variable">
46751 <primary><varname>$host</varname></primary>
46752 </indexterm>
46753 <indexterm role="variable">
46754 <primary><varname>$host_address</varname></primary>
46755 </indexterm>
46756 The value of this option must be either the
46757 word "system"
46758 or the absolute path to
46759 a file or directory containing permitted certificates for servers,
46760 for use when setting up an encrypted connection.
46761 </para>
46762 <para revisionflag="changed">
46763 The "system" value for the option will use a location compiled into the SSL library.
46764 This is not available for GnuTLS versions preceding 3.0.20; a value of "system"
46765 is taken as empty and an explicit location
46766 must be specified.
46767 </para>
46768 <para revisionflag="changed">
46769 The use of a directory for the option value is not available for GnuTLS versions
46770 preceding 3.3.6 and a single file must be used.
46771 </para>
46772 <para>
46773 With OpenSSL the certificates specified
46774 explicitly
46775 either by file or directory
46776 are added to those given by the system default location.
46777 </para>
46778 <para>
46779 The values of <varname>$host</varname> and
46780 <varname>$host_address</varname> are set to the name and address of the server during the
46781 expansion of this option. See chapter <xref linkend="CHAPTLS"/> for details of TLS.
46782 </para>
46783 <para>
46784 For back-compatibility,
46785 if neither tls_verify_hosts nor tls_try_verify_hosts are set
46786 (a single-colon empty list counts as being set)
46787 and certificate verification fails the TLS connection is closed.
46788 </para>
46789 <para>
46790 <indexterm role="option">
46791 <primary><option>tls_verify_hosts</option></primary>
46792 </indexterm>
46793 </para>
46794 <informaltable frame="all">
46795 <tgroup cols="4" colsep="0" rowsep="0">
46796 <colspec colwidth="8*" align="left"/>
46797 <colspec colwidth="6*" align="center"/>
46798 <colspec colwidth="6*" align="center"/>
46799 <colspec colwidth="6*" align="right"/>
46800 <tbody>
46801 <row>
46802 <entry><option>tls_verify_hosts</option></entry>
46803 <entry>Use: <emphasis>smtp</emphasis></entry>
46804 <entry>Type: <emphasis>host list</emphasis>&dagger;<emphasis></emphasis></entry>
46805 <entry>Default: <emphasis>unset</emphasis></entry>
46806 </row>
46807 </tbody>
46808 </tgroup>
46809 </informaltable>
46810 <para>
46811 <indexterm role="concept">
46812 <primary>TLS</primary>
46813 <secondary>server certificate verification</secondary>
46814 </indexterm>
46815 <indexterm role="concept">
46816 <primary>certificate</primary>
46817 <secondary>verification of server</secondary>
46818 </indexterm>
46819 This option gives a list of hosts for which. on encrypted connections,
46820 certificate verification must succeed.
46821 The <option>tls_verify_certificates</option> option must also be set.
46822 If both this option and <option>tls_try_verify_hosts</option> are unset
46823 operation is as if this option selected all hosts.
46824 </para>
46825 </section>
46826 <section id="SECTvalhosmax">
46827 <title>How the limits for the number of hosts to try are used</title>
46828 <para>
46829 <indexterm role="concept">
46830 <primary>host</primary>
46831 <secondary>maximum number to try</secondary>
46832 </indexterm>
46833 <indexterm role="concept">
46834 <primary>limit</primary>
46835 <secondary>hosts; maximum number tried</secondary>
46836 </indexterm>
46837 There are two options that are concerned with the number of hosts that are
46838 tried when an SMTP delivery takes place. They are <option>hosts_max_try</option> and
46839 <option>hosts_max_try_hardlimit</option>.
46840 </para>
46841 <para>
46842 The <option>hosts_max_try</option> option limits the number of hosts that are tried
46843 for a single delivery. However, despite the term <quote>host</quote> in its name, the
46844 option actually applies to each IP address independently. In other words, a
46845 multihomed host is treated as several independent hosts, just as it is for
46846 retrying.
46847 </para>
46848 <para>
46849 Many of the larger ISPs have multiple MX records which often point to
46850 multihomed hosts. As a result, a list of a dozen or more IP addresses may be
46851 created as a result of routing one of these domains.
46852 </para>
46853 <para>
46854 Trying every single IP address on such a long list does not seem sensible; if
46855 several at the top of the list fail, it is reasonable to assume there is some
46856 problem that is likely to affect all of them. Roughly speaking, the value of
46857 <option>hosts_max_try</option> is the maximum number that are tried before deferring the
46858 delivery. However, the logic cannot be quite that simple.
46859 </para>
46860 <para>
46861 Firstly, IP addresses that are skipped because their retry times have not
46862 arrived do not count, and in addition, addresses that are past their retry
46863 limits are also not counted, even when they are tried. This means that when
46864 some IP addresses are past their retry limits, more than the value of
46865 <option>hosts_max_retry</option> may be tried. The reason for this behaviour is to ensure
46866 that all IP addresses are considered before timing out an email address (but
46867 see below for an exception).
46868 </para>
46869 <para>
46870 Secondly, when the <option>hosts_max_try</option> limit is reached, Exim looks down the host
46871 list to see if there is a subsequent host with a different (higher valued) MX.
46872 If there is, that host is considered next, and the current IP address is used
46873 but not counted. This behaviour helps in the case of a domain with a retry rule
46874 that hardly ever delays any hosts, as is now explained:
46875 </para>
46876 <para>
46877 Consider the case of a long list of hosts with one MX value, and a few with a
46878 higher MX value. If <option>hosts_max_try</option> is small (the default is 5) only a few
46879 hosts at the top of the list are tried at first. With the default retry rule,
46880 which specifies increasing retry times, the higher MX hosts are eventually
46881 tried when those at the top of the list are skipped because they have not
46882 reached their retry times.
46883 </para>
46884 <para>
46885 However, it is common practice to put a fixed short retry time on domains for
46886 large ISPs, on the grounds that their servers are rarely down for very long.
46887 Unfortunately, these are exactly the domains that tend to resolve to long lists
46888 of hosts. The short retry time means that the lowest MX hosts are tried every
46889 time. The attempts may be in a different order because of random sorting, but
46890 without the special MX check, the higher MX hosts would never be tried until
46891 all the lower MX hosts had timed out (which might be several days), because
46892 there are always some lower MX hosts that have reached their retry times. With
46893 the special check, Exim considers at least one IP address from each MX value at
46894 every delivery attempt, even if the <option>hosts_max_try</option> limit has already been
46895 reached.
46896 </para>
46897 <para>
46898 The above logic means that <option>hosts_max_try</option> is not a hard limit, and in
46899 particular, Exim normally eventually tries all the IP addresses before timing
46900 out an email address. When <option>hosts_max_try</option> was implemented, this seemed a
46901 reasonable thing to do. Recently, however, some lunatic DNS configurations have
46902 been set up with hundreds of IP addresses for some domains. It can
46903 take a very long time indeed for an address to time out in these cases.
46904 </para>
46905 <para>
46906 The <option>hosts_max_try_hardlimit</option> option was added to help with this problem.
46907 Exim never tries more than this number of IP addresses; if it hits this limit
46908 and they are all timed out, the email address is bounced, even though not all
46909 possible IP addresses have been tried.
46910 <indexterm role="concept" startref="IIDsmttra1" class="endofrange"/>
46911 <indexterm role="concept" startref="IIDsmttra2" class="endofrange"/>
46912 </para>
46913 </section>
46914 </chapter>
46915
46916 <chapter id="CHAPrewrite">
46917 <title>Address rewriting</title>
46918 <para>
46919 <indexterm role="concept" id="IIDaddrew" class="startofrange">
46920 <primary>rewriting</primary>
46921 <secondary>addresses</secondary>
46922 </indexterm>
46923 There are some circumstances in which Exim automatically rewrites domains in
46924 addresses. The two most common are when an address is given without a domain
46925 (referred to as an <quote>unqualified address</quote>) or when an address contains an
46926 abbreviated domain that is expanded by DNS lookup.
46927 </para>
46928 <para>
46929 Unqualified envelope addresses are accepted only for locally submitted
46930 messages, or for messages that are received from hosts matching
46931 <option>sender_unqualified_hosts</option> or <option>recipient_unqualified_hosts</option>, as
46932 appropriate. Unqualified addresses in header lines are qualified if they are in
46933 locally submitted messages, or messages from hosts that are permitted to send
46934 unqualified envelope addresses. Otherwise, unqualified addresses in header
46935 lines are neither qualified nor rewritten.
46936 </para>
46937 <para>
46938 One situation in which Exim does <emphasis>not</emphasis> automatically rewrite a domain is
46939 when it is the name of a CNAME record in the DNS. The older RFCs suggest that
46940 such a domain should be rewritten using the <quote>canonical</quote> name, and some MTAs
46941 do this. The new RFCs do not contain this suggestion.
46942 </para>
46943 <section id="SECID147">
46944 <title>Explicitly configured address rewriting</title>
46945 <para>
46946 This chapter describes the rewriting rules that can be used in the
46947 main rewrite section of the configuration file, and also in the generic
46948 <option>headers_rewrite</option> option that can be set on any transport.
46949 </para>
46950 <para>
46951 Some people believe that configured address rewriting is a Mortal Sin.
46952 Others believe that life is not possible without it. Exim provides the
46953 facility; you do not have to use it.
46954 </para>
46955 <para>
46956 The main rewriting rules that appear in the <quote>rewrite</quote> section of the
46957 configuration file are applied to addresses in incoming messages, both envelope
46958 addresses and addresses in header lines. Each rule specifies the types of
46959 address to which it applies.
46960 </para>
46961 <para>
46962 Whether or not addresses in header lines are rewritten depends on the origin of
46963 the headers and the type of rewriting. Global rewriting, that is, rewriting
46964 rules from the rewrite section of the configuration file, is applied only to
46965 those headers that were received with the message. Header lines that are added
46966 by ACLs or by a system filter or by individual routers or transports (which
46967 are specific to individual recipient addresses) are not rewritten by the global
46968 rules.
46969 </para>
46970 <para>
46971 Rewriting at transport time, by means of the <option>headers_rewrite</option> option,
46972 applies all headers except those added by routers and transports. That is, as
46973 well as the headers that were received with the message, it also applies to
46974 headers that were added by an ACL or a system filter.
46975 </para>
46976 <para>
46977 In general, rewriting addresses from your own system or domain has some
46978 legitimacy. Rewriting other addresses should be done only with great care and
46979 in special circumstances. The author of Exim believes that rewriting should be
46980 used sparingly, and mainly for <quote>regularizing</quote> addresses in your own domains.
46981 Although it can sometimes be used as a routing tool, this is very strongly
46982 discouraged.
46983 </para>
46984 <para>
46985 There are two commonly encountered circumstances where rewriting is used, as
46986 illustrated by these examples:
46987 </para>
46988 <itemizedlist>
46989 <listitem>
46990 <para>
46991 The company whose domain is <emphasis>hitch.fict.example</emphasis> has a number of hosts that
46992 exchange mail with each other behind a firewall, but there is only a single
46993 gateway to the outer world. The gateway rewrites <emphasis>*.hitch.fict.example</emphasis> as
46994 <emphasis>hitch.fict.example</emphasis> when sending mail off-site.
46995 </para>
46996 </listitem>
46997 <listitem>
46998 <para>
46999 A host rewrites the local parts of its own users so that, for example,
47000 <emphasis>fp42@hitch.fict.example</emphasis> becomes <emphasis>Ford.Prefect@hitch.fict.example</emphasis>.
47001 </para>
47002 </listitem>
47003 </itemizedlist>
47004 </section>
47005 <section id="SECID148">
47006 <title>When does rewriting happen?</title>
47007 <para>
47008 <indexterm role="concept">
47009 <primary>rewriting</primary>
47010 <secondary>timing of</secondary>
47011 </indexterm>
47012 <indexterm role="concept">
47013 <primary>access control lists (ACLs)</primary>
47014 <secondary>rewriting addresses in</secondary>
47015 </indexterm>
47016 Configured address rewriting can take place at several different stages of a
47017 message&#x2019;s processing.
47018 </para>
47019 <para>
47020 <indexterm role="variable">
47021 <primary><varname>$sender_address</varname></primary>
47022 </indexterm>
47023 At the start of an ACL for MAIL, the sender address may have been rewritten
47024 by a special SMTP-time rewrite rule (see section <xref linkend="SECTrewriteS"/>), but no
47025 ordinary rewrite rules have yet been applied. If, however, the sender address
47026 is verified in the ACL, it is rewritten before verification, and remains
47027 rewritten thereafter. The subsequent value of <varname>$sender_address</varname> is the
47028 rewritten address. This also applies if sender verification happens in a
47029 RCPT ACL. Otherwise, when the sender address is not verified, it is
47030 rewritten as soon as a message&#x2019;s header lines have been received.
47031 </para>
47032 <para>
47033 <indexterm role="variable">
47034 <primary><varname>$domain</varname></primary>
47035 </indexterm>
47036 <indexterm role="variable">
47037 <primary><varname>$local_part</varname></primary>
47038 </indexterm>
47039 Similarly, at the start of an ACL for RCPT, the current recipient&#x2019;s address
47040 may have been rewritten by a special SMTP-time rewrite rule, but no ordinary
47041 rewrite rules have yet been applied to it. However, the behaviour is different
47042 from the sender address when a recipient is verified. The address is rewritten
47043 for the verification, but the rewriting is not remembered at this stage. The
47044 value of <varname>$local_part</varname> and <varname>$domain</varname> after verification are always the same
47045 as they were before (that is, they contain the unrewritten &ndash; except for
47046 SMTP-time rewriting &ndash; address).
47047 </para>
47048 <para>
47049 As soon as a message&#x2019;s header lines have been received, all the envelope
47050 recipient addresses are permanently rewritten, and rewriting is also applied to
47051 the addresses in the header lines (if configured). This happens before adding
47052 any header lines that were specified in MAIL or RCPT ACLs, and
47053 <indexterm role="concept">
47054 <primary><function>local_scan()</function> function</primary>
47055 <secondary>address rewriting; timing of</secondary>
47056 </indexterm>
47057 before the DATA ACL and <function>local_scan()</function> functions are run.
47058 </para>
47059 <para>
47060 When an address is being routed, either for delivery or for verification,
47061 rewriting is applied immediately to child addresses that are generated by
47062 redirection, unless <option>no_rewrite</option> is set on the router.
47063 </para>
47064 <para>
47065 <indexterm role="concept">
47066 <primary>envelope sender</primary>
47067 <secondary>rewriting at transport time</secondary>
47068 </indexterm>
47069 <indexterm role="concept">
47070 <primary>rewriting</primary>
47071 <secondary>at transport time</secondary>
47072 </indexterm>
47073 <indexterm role="concept">
47074 <primary>header lines</primary>
47075 <secondary>rewriting at transport time</secondary>
47076 </indexterm>
47077 At transport time, additional rewriting of addresses in header lines can be
47078 specified by setting the generic <option>headers_rewrite</option> option on a transport.
47079 This option contains rules that are identical in form to those in the rewrite
47080 section of the configuration file. They are applied to the original message
47081 header lines and any that were added by ACLs or a system filter. They are not
47082 applied to header lines that are added by routers or the transport.
47083 </para>
47084 <para>
47085 The outgoing envelope sender can be rewritten by means of the <option>return_path</option>
47086 transport option. However, it is not possible to rewrite envelope recipients at
47087 transport time.
47088 </para>
47089 </section>
47090 <section id="SECID149">
47091 <title>Testing the rewriting rules that apply on input</title>
47092 <para>
47093 <indexterm role="concept">
47094 <primary>rewriting</primary>
47095 <secondary>testing</secondary>
47096 </indexterm>
47097 <indexterm role="concept">
47098 <primary>testing</primary>
47099 <secondary>rewriting</secondary>
47100 </indexterm>
47101 Exim&#x2019;s input rewriting configuration appears in a part of the run time
47102 configuration file headed by <quote>begin rewrite</quote>. It can be tested by the
47103 <option>-brw</option> command line option. This takes an address (which can be a full RFC
47104 2822 address) as its argument. The output is a list of how the address would be
47105 transformed by the rewriting rules for each of the different places it might
47106 appear in an incoming message, that is, for each different header and for the
47107 envelope sender and recipient fields. For example,
47108 </para>
47109 <literallayout class="monospaced">
47110 exim -brw ph10@exim.workshop.example
47111 </literallayout>
47112 <para>
47113 might produce the output
47114 </para>
47115 <literallayout class="monospaced">
47116 sender: Philip.Hazel@exim.workshop.example
47117 from: Philip.Hazel@exim.workshop.example
47118 to: ph10@exim.workshop.example
47119 cc: ph10@exim.workshop.example
47120 bcc: ph10@exim.workshop.example
47121 reply-to: Philip.Hazel@exim.workshop.example
47122 env-from: Philip.Hazel@exim.workshop.example
47123 env-to: ph10@exim.workshop.example
47124 </literallayout>
47125 <para>
47126 which shows that rewriting has been set up for that address when used in any of
47127 the source fields, but not when it appears as a recipient address. At the
47128 present time, there is no equivalent way of testing rewriting rules that are
47129 set for a particular transport.
47130 </para>
47131 </section>
47132 <section id="SECID150">
47133 <title>Rewriting rules</title>
47134 <para>
47135 <indexterm role="concept">
47136 <primary>rewriting</primary>
47137 <secondary>rules</secondary>
47138 </indexterm>
47139 The rewrite section of the configuration file consists of lines of rewriting
47140 rules in the form
47141 </para>
47142 <literallayout>
47143 &lt;<emphasis>source pattern</emphasis>&gt;  &lt;<emphasis>replacement</emphasis>&gt;  &lt;<emphasis>flags</emphasis>&gt;
47144 </literallayout>
47145 <para>
47146 Rewriting rules that are specified for the <option>headers_rewrite</option> generic
47147 transport option are given as a colon-separated list. Each item in the list
47148 takes the same form as a line in the main rewriting configuration (except that
47149 any colons must be doubled, of course).
47150 </para>
47151 <para>
47152 The formats of source patterns and replacement strings are described below.
47153 Each is terminated by white space, unless enclosed in double quotes, in which
47154 case normal quoting conventions apply inside the quotes. The flags are single
47155 characters which may appear in any order. Spaces and tabs between them are
47156 ignored.
47157 </para>
47158 <para>
47159 For each address that could potentially be rewritten, the rules are scanned in
47160 order, and replacements for the address from earlier rules can themselves be
47161 replaced by later rules (but see the <quote>q</quote> and <quote>R</quote> flags).
47162 </para>
47163 <para>
47164 The order in which addresses are rewritten is undefined, may change between
47165 releases, and must not be relied on, with one exception: when a message is
47166 received, the envelope sender is always rewritten first, before any header
47167 lines are rewritten. For example, the replacement string for a rewrite of an
47168 address in <emphasis>To:</emphasis> must not assume that the message&#x2019;s address in <emphasis>From:</emphasis> has
47169 (or has not) already been rewritten. However, a rewrite of <emphasis>From:</emphasis> may assume
47170 that the envelope sender has already been rewritten.
47171 </para>
47172 <para>
47173 <indexterm role="variable">
47174 <primary><varname>$domain</varname></primary>
47175 </indexterm>
47176 <indexterm role="variable">
47177 <primary><varname>$local_part</varname></primary>
47178 </indexterm>
47179 The variables <varname>$local_part</varname> and <varname>$domain</varname> can be used in the replacement
47180 string to refer to the address that is being rewritten. Note that lookup-driven
47181 rewriting can be done by a rule of the form
47182 </para>
47183 <literallayout class="monospaced">
47184 *@*   ${lookup ...
47185 </literallayout>
47186 <para>
47187 where the lookup key uses <varname>$1</varname> and <varname>$2</varname> or <varname>$local_part</varname> and <varname>$domain</varname> to
47188 refer to the address that is being rewritten.
47189 </para>
47190 </section>
47191 <section id="SECID151">
47192 <title>Rewriting patterns</title>
47193 <para>
47194 <indexterm role="concept">
47195 <primary>rewriting</primary>
47196 <secondary>patterns</secondary>
47197 </indexterm>
47198 <indexterm role="concept">
47199 <primary>address list</primary>
47200 <secondary>in a rewriting pattern</secondary>
47201 </indexterm>
47202 The source pattern in a rewriting rule is any item which may appear in an
47203 address list (see section <xref linkend="SECTaddresslist"/>). It is in fact processed as a
47204 single-item address list, which means that it is expanded before being tested
47205 against the address. As always, if you use a regular expression as a pattern,
47206 you must take care to escape dollar and backslash characters, or use the <literal>\N</literal>
47207 facility to suppress string expansion within the regular expression.
47208 </para>
47209 <para>
47210 Domains in patterns should be given in lower case. Local parts in patterns are
47211 case-sensitive. If you want to do case-insensitive matching of local parts, you
47212 can use a regular expression that starts with <literal>^(?i)</literal>.
47213 </para>
47214 <para>
47215 <indexterm role="concept">
47216 <primary>numerical variables (<varname>$1</varname> <varname>$2</varname> etc)</primary>
47217 <secondary>in rewriting rules</secondary>
47218 </indexterm>
47219 After matching, the numerical variables <varname>$1</varname>, <varname>$2</varname>, etc. may be set,
47220 depending on the type of match which occurred. These can be used in the
47221 replacement string to insert portions of the incoming address. <varname>$0</varname> always
47222 refers to the complete incoming address. When a regular expression is used, the
47223 numerical variables are set from its capturing subexpressions. For other types
47224 of pattern they are set as follows:
47225 </para>
47226 <itemizedlist>
47227 <listitem>
47228 <para>
47229 If a local part or domain starts with an asterisk, the numerical variables
47230 refer to the character strings matched by asterisks, with <varname>$1</varname> associated with
47231 the first asterisk, and <varname>$2</varname> with the second, if present. For example, if the
47232 pattern
47233 </para>
47234 <literallayout class="monospaced">
47235 *queen@*.fict.example
47236 </literallayout>
47237 <para>
47238 is matched against the address <emphasis>hearts-queen@wonderland.fict.example</emphasis> then
47239 </para>
47240 <literallayout class="monospaced">
47241 $0 = hearts-queen@wonderland.fict.example
47242 $1 = hearts-
47243 $2 = wonderland
47244 </literallayout>
47245 <para>
47246 Note that if the local part does not start with an asterisk, but the domain
47247 does, it is <varname>$1</varname> that contains the wild part of the domain.
47248 </para>
47249 </listitem>
47250 <listitem>
47251 <para>
47252 If the domain part of the pattern is a partial lookup, the wild and fixed parts
47253 of the domain are placed in the next available numerical variables. Suppose,
47254 for example, that the address <emphasis>foo@bar.baz.example</emphasis> is processed by a
47255 rewriting rule of the form
47256 </para>
47257 <literallayout>
47258 <literal>*@partial-dbm;/some/dbm/file</literal>    &lt;<emphasis>replacement string</emphasis>&gt;
47259 </literallayout>
47260 <para>
47261 and the key in the file that matches the domain is <literal>*.baz.example</literal>. Then
47262 </para>
47263 <literallayout class="monospaced">
47264 $1 = foo
47265 $2 = bar
47266 $3 = baz.example
47267 </literallayout>
47268 <para>
47269 If the address <emphasis>foo@baz.example</emphasis> is looked up, this matches the same
47270 wildcard file entry, and in this case <varname>$2</varname> is set to the empty string, but
47271 <varname>$3</varname> is still set to <emphasis>baz.example</emphasis>. If a non-wild key is matched in a
47272 partial lookup, <varname>$2</varname> is again set to the empty string and <varname>$3</varname> is set to the
47273 whole domain. For non-partial domain lookups, no numerical variables are set.
47274 </para>
47275 </listitem>
47276 </itemizedlist>
47277 </section>
47278 <section id="SECID152">
47279 <title>Rewriting replacements</title>
47280 <para>
47281 <indexterm role="concept">
47282 <primary>rewriting</primary>
47283 <secondary>replacements</secondary>
47284 </indexterm>
47285 If the replacement string for a rule is a single asterisk, addresses that
47286 match the pattern and the flags are <emphasis>not</emphasis> rewritten, and no subsequent
47287 rewriting rules are scanned. For example,
47288 </para>
47289 <literallayout class="monospaced">
47290 hatta@lookingglass.fict.example  *  f
47291 </literallayout>
47292 <para>
47293 specifies that <emphasis>hatta@lookingglass.fict.example</emphasis> is never to be rewritten in
47294 <emphasis>From:</emphasis> headers.
47295 </para>
47296 <para>
47297 <indexterm role="variable">
47298 <primary><varname>$domain</varname></primary>
47299 </indexterm>
47300 <indexterm role="variable">
47301 <primary><varname>$local_part</varname></primary>
47302 </indexterm>
47303 If the replacement string is not a single asterisk, it is expanded, and must
47304 yield a fully qualified address. Within the expansion, the variables
47305 <varname>$local_part</varname> and <varname>$domain</varname> refer to the address that is being rewritten.
47306 Any letters they contain retain their original case &ndash; they are not lower
47307 cased. The numerical variables are set up according to the type of pattern that
47308 matched the address, as described above. If the expansion is forced to fail by
47309 the presence of <quote>fail</quote> in a conditional or lookup item, rewriting by the
47310 current rule is abandoned, but subsequent rules may take effect. Any other
47311 expansion failure causes the entire rewriting operation to be abandoned, and an
47312 entry written to the panic log.
47313 </para>
47314 </section>
47315 <section id="SECID153">
47316 <title>Rewriting flags</title>
47317 <para>
47318 There are three different kinds of flag that may appear on rewriting rules:
47319 </para>
47320 <itemizedlist>
47321 <listitem>
47322 <para>
47323 Flags that specify which headers and envelope addresses to rewrite: E, F, T, b,
47324 c, f, h, r, s, t.
47325 </para>
47326 </listitem>
47327 <listitem>
47328 <para>
47329 A flag that specifies rewriting at SMTP time: S.
47330 </para>
47331 </listitem>
47332 <listitem>
47333 <para>
47334 Flags that control the rewriting process: Q, q, R, w.
47335 </para>
47336 </listitem>
47337 </itemizedlist>
47338 <para>
47339 For rules that are part of the <option>headers_rewrite</option> generic transport option,
47340 E, F, T, and S are not permitted.
47341 </para>
47342 </section>
47343 <section id="SECID154">
47344 <title>Flags specifying which headers and envelope addresses to rewrite</title>
47345 <para>
47346 <indexterm role="concept">
47347 <primary>rewriting</primary>
47348 <secondary>flags</secondary>
47349 </indexterm>
47350 If none of the following flag letters, nor the <quote>S</quote> flag (see section
47351 <xref linkend="SECTrewriteS"/>) are present, a main rewriting rule applies to all headers
47352 and to both the sender and recipient fields of the envelope, whereas a
47353 transport-time rewriting rule just applies to all headers. Otherwise, the
47354 rewriting rule is skipped unless the relevant addresses are being processed.
47355 </para>
47356 <literallayout>
47357 <literal>E</literal>       rewrite all envelope fields
47358 <literal>F</literal>       rewrite the envelope From field
47359 <literal>T</literal>       rewrite the envelope To field
47360 <literal>b</literal>       rewrite the <emphasis>Bcc:</emphasis> header
47361 <literal>c</literal>       rewrite the <emphasis>Cc:</emphasis> header
47362 <literal>f</literal>       rewrite the <emphasis>From:</emphasis> header
47363 <literal>h</literal>       rewrite all headers
47364 <literal>r</literal>       rewrite the <emphasis>Reply-To:</emphasis> header
47365 <literal>s</literal>       rewrite the <emphasis>Sender:</emphasis> header
47366 <literal>t</literal>       rewrite the <emphasis>To:</emphasis> header
47367 </literallayout>
47368 <para>
47369 "All headers" means all of the headers listed above that can be selected
47370 individually, plus their <emphasis>Resent-</emphasis> versions. It does not include
47371 other headers such as <emphasis>Subject:</emphasis> etc.
47372 </para>
47373 <para>
47374 You should be particularly careful about rewriting <emphasis>Sender:</emphasis> headers, and
47375 restrict this to special known cases in your own domains.
47376 </para>
47377 </section>
47378 <section id="SECTrewriteS">
47379 <title>The SMTP-time rewriting flag</title>
47380 <para>
47381 <indexterm role="concept">
47382 <primary>SMTP</primary>
47383 <secondary>rewriting malformed addresses</secondary>
47384 </indexterm>
47385 <indexterm role="concept">
47386 <primary>RCPT</primary>
47387 <secondary>rewriting argument of</secondary>
47388 </indexterm>
47389 <indexterm role="concept">
47390 <primary>MAIL</primary>
47391 <secondary>rewriting argument of</secondary>
47392 </indexterm>
47393 The rewrite flag <quote>S</quote> specifies a rewrite of incoming envelope addresses at
47394 SMTP time, as soon as an address is received in a MAIL or RCPT command, and
47395 before any other processing; even before syntax checking. The pattern is
47396 required to be a regular expression, and it is matched against the whole of the
47397 data for the command, including any surrounding angle brackets.
47398 </para>
47399 <para>
47400 <indexterm role="variable">
47401 <primary><varname>$domain</varname></primary>
47402 </indexterm>
47403 <indexterm role="variable">
47404 <primary><varname>$local_part</varname></primary>
47405 </indexterm>
47406 This form of rewrite rule allows for the handling of addresses that are not
47407 compliant with RFCs 2821 and 2822 (for example, <quote>bang paths</quote> in batched SMTP
47408 input). Because the input is not required to be a syntactically valid address,
47409 the variables <varname>$local_part</varname> and <varname>$domain</varname> are not available during the
47410 expansion of the replacement string. The result of rewriting replaces the
47411 original address in the MAIL or RCPT command.
47412 </para>
47413 </section>
47414 <section id="SECID155">
47415 <title>Flags controlling the rewriting process</title>
47416 <para>
47417 There are four flags which control the way the rewriting process works. These
47418 take effect only when a rule is invoked, that is, when the address is of the
47419 correct type (matches the flags) and matches the pattern:
47420 </para>
47421 <itemizedlist>
47422 <listitem>
47423 <para>
47424 If the <quote>Q</quote> flag is set on a rule, the rewritten address is permitted to be an
47425 unqualified local part. It is qualified with <option>qualify_recipient</option>. In the
47426 absence of <quote>Q</quote> the rewritten address must always include a domain.
47427 </para>
47428 </listitem>
47429 <listitem>
47430 <para>
47431 If the <quote>q</quote> flag is set on a rule, no further rewriting rules are considered,
47432 even if no rewriting actually takes place because of a <quote>fail</quote> in the
47433 expansion. The <quote>q</quote> flag is not effective if the address is of the wrong type
47434 (does not match the flags) or does not match the pattern.
47435 </para>
47436 </listitem>
47437 <listitem>
47438 <para>
47439 The <quote>R</quote> flag causes a successful rewriting rule to be re-applied to the new
47440 address, up to ten times. It can be combined with the <quote>q</quote> flag, to stop
47441 rewriting once it fails to match (after at least one successful rewrite).
47442 </para>
47443 </listitem>
47444 <listitem>
47445 <para>
47446 <indexterm role="concept">
47447 <primary>rewriting</primary>
47448 <secondary>whole addresses</secondary>
47449 </indexterm>
47450 When an address in a header is rewritten, the rewriting normally applies only
47451 to the working part of the address, with any comments and RFC 2822 <quote>phrase</quote>
47452 left unchanged. For example, rewriting might change
47453 </para>
47454 <literallayout class="monospaced">
47455 From: Ford Prefect &lt;fp42@restaurant.hitch.fict.example&gt;
47456 </literallayout>
47457 <para>
47458 into
47459 </para>
47460 <literallayout class="monospaced">
47461 From: Ford Prefect &lt;prefectf@hitch.fict.example&gt;
47462 </literallayout>
47463 <para>
47464 <indexterm role="concept">
47465 <primary>RFC 2047</primary>
47466 </indexterm>
47467 Sometimes there is a need to replace the whole address item, and this can be
47468 done by adding the flag letter <quote>w</quote> to a rule. If this is set on a rule that
47469 causes an address in a header line to be rewritten, the entire address is
47470 replaced, not just the working part. The replacement must be a complete RFC
47471 2822 address, including the angle brackets if necessary. If text outside angle
47472 brackets contains a character whose value is greater than 126 or less than 32
47473 (except for tab), the text is encoded according to RFC 2047. The character set
47474 is taken from <option>headers_charset</option>, which defaults to ISO-8859-1.
47475 </para>
47476 <para>
47477 When the <quote>w</quote> flag is set on a rule that causes an envelope address to be
47478 rewritten, all but the working part of the replacement address is discarded.
47479 </para>
47480 </listitem>
47481 </itemizedlist>
47482 </section>
47483 <section id="SECID156">
47484 <title>Rewriting examples</title>
47485 <para>
47486 Here is an example of the two common rewriting paradigms:
47487 </para>
47488 <literallayout class="monospaced">
47489 *@*.hitch.fict.example  $1@hitch.fict.example
47490 *@hitch.fict.example    ${lookup{$1}dbm{/etc/realnames}\
47491                      {$value}fail}@hitch.fict.example bctfrF
47492 </literallayout>
47493 <para>
47494 Note the use of <quote>fail</quote> in the lookup expansion in the second rule, forcing
47495 the string expansion to fail if the lookup does not succeed. In this context it
47496 has the effect of leaving the original address unchanged, but Exim goes on to
47497 consider subsequent rewriting rules, if any, because the <quote>q</quote> flag is not
47498 present in that rule. An alternative to <quote>fail</quote> would be to supply <varname>$1</varname>
47499 explicitly, which would cause the rewritten address to be the same as before,
47500 at the cost of a small bit of processing. Not supplying either of these is an
47501 error, since the rewritten address would then contain no local part.
47502 </para>
47503 <para>
47504 The first example above replaces the domain with a superior, more general
47505 domain. This may not be desirable for certain local parts. If the rule
47506 </para>
47507 <literallayout class="monospaced">
47508 root@*.hitch.fict.example  *
47509 </literallayout>
47510 <para>
47511 were inserted before the first rule, rewriting would be suppressed for the
47512 local part <emphasis>root</emphasis> at any domain ending in <emphasis>hitch.fict.example</emphasis>.
47513 </para>
47514 <para>
47515 Rewriting can be made conditional on a number of tests, by making use of
47516 <varname>${if</varname> in the expansion item. For example, to apply a rewriting rule only to
47517 messages that originate outside the local host:
47518 </para>
47519 <literallayout class="monospaced">
47520 *@*.hitch.fict.example  "${if !eq {$sender_host_address}{}\
47521                          {$1@hitch.fict.example}fail}"
47522 </literallayout>
47523 <para>
47524 The replacement string is quoted in this example because it contains white
47525 space.
47526 </para>
47527 <para>
47528 <indexterm role="concept">
47529 <primary>rewriting</primary>
47530 <secondary>bang paths</secondary>
47531 </indexterm>
47532 <indexterm role="concept">
47533 <primary>bang paths</primary>
47534 <secondary>rewriting</secondary>
47535 </indexterm>
47536 Exim does not handle addresses in the form of <quote>bang paths</quote>. If it sees such
47537 an address it treats it as an unqualified local part which it qualifies with
47538 the local qualification domain (if the source of the message is local or if the
47539 remote host is permitted to send unqualified addresses). Rewriting can
47540 sometimes be used to handle simple bang paths with a fixed number of
47541 components. For example, the rule
47542 </para>
47543 <literallayout class="monospaced">
47544 \N^([^!]+)!(.*)@your.domain.example$\N   $2@$1
47545 </literallayout>
47546 <para>
47547 rewrites a two-component bang path <emphasis>host.name!user</emphasis> as the domain address
47548 <emphasis>user@host.name</emphasis>. However, there is a security implication in using this as
47549 a global rewriting rule for envelope addresses. It can provide a backdoor
47550 method for using your system as a relay, because the incoming addresses appear
47551 to be local. If the bang path addresses are received via SMTP, it is safer to
47552 use the <quote>S</quote> flag to rewrite them as they are received, so that relay checking
47553 can be done on the rewritten addresses.
47554 <indexterm role="concept" startref="IIDaddrew" class="endofrange"/>
47555 </para>
47556 </section>
47557 </chapter>
47558
47559 <chapter id="CHAPretry">
47560 <title>Retry configuration</title>
47561 <para>
47562 <indexterm role="concept" id="IIDretconf1" class="startofrange">
47563 <primary>retry</primary>
47564 <secondary>configuration, description of</secondary>
47565 </indexterm>
47566 <indexterm role="concept" id="IIDregconf2" class="startofrange">
47567 <primary>configuration file</primary>
47568 <secondary>retry section</secondary>
47569 </indexterm>
47570 The <quote>retry</quote> section of the runtime configuration file contains a list of
47571 retry rules that control how often Exim tries to deliver messages that cannot
47572 be delivered at the first attempt. If there are no retry rules (the section is
47573 empty or not present), there are no retries. In this situation, temporary
47574 errors are treated as permanent. The default configuration contains a single,
47575 general-purpose retry rule (see section <xref linkend="SECID57"/>). The <option>-brt</option> command
47576 line option can be used to test which retry rule will be used for a given
47577 address, domain and error.
47578 </para>
47579 <para>
47580 The most common cause of retries is temporary failure to deliver to a remote
47581 host because the host is down, or inaccessible because of a network problem.
47582 Exim&#x2019;s retry processing in this case is applied on a per-host (strictly, per IP
47583 address) basis, not on a per-message basis. Thus, if one message has recently
47584 been delayed, delivery of a new message to the same host is not immediately
47585 tried, but waits for the host&#x2019;s retry time to arrive. If the <option>retry_defer</option>
47586 log selector is set, the message
47587 <indexterm role="concept">
47588 <primary>retry</primary>
47589 <secondary>time not reached</secondary>
47590 </indexterm>
47591 <quote>retry time not reached</quote> is written to the main log whenever a delivery is
47592 skipped for this reason. Section <xref linkend="SECToutSMTPerr"/> contains more details of
47593 the handling of errors during remote deliveries.
47594 </para>
47595 <para>
47596 Retry processing applies to routing as well as to delivering, except as covered
47597 in the next paragraph. The retry rules do not distinguish between these
47598 actions. It is not possible, for example, to specify different behaviour for
47599 failures to route the domain <emphasis>snark.fict.example</emphasis> and failures to deliver to
47600 the host <emphasis>snark.fict.example</emphasis>. I didn&#x2019;t think anyone would ever need this
47601 added complication, so did not implement it. However, although they share the
47602 same retry rule, the actual retry times for routing and transporting a given
47603 domain are maintained independently.
47604 </para>
47605 <para>
47606 When a delivery is not part of a queue run (typically an immediate delivery on
47607 receipt of a message), the routers are always run, and local deliveries are
47608 always attempted, even if retry times are set for them. This makes for better
47609 behaviour if one particular message is causing problems (for example, causing
47610 quota overflow, or provoking an error in a filter file). If such a delivery
47611 suffers a temporary failure, the retry data is updated as normal, and
47612 subsequent delivery attempts from queue runs occur only when the retry time for
47613 the local address is reached.
47614 </para>
47615 <section id="SECID157">
47616 <title>Changing retry rules</title>
47617 <para>
47618 If you change the retry rules in your configuration, you should consider
47619 whether or not to delete the retry data that is stored in Exim&#x2019;s spool area in
47620 files with names like <filename>db/retry</filename>. Deleting any of Exim&#x2019;s hints files is
47621 always safe; that is why they are called <quote>hints</quote>.
47622 </para>
47623 <para>
47624 The hints retry data contains suggested retry times based on the previous
47625 rules. In the case of a long-running problem with a remote host, it might
47626 record the fact that the host has timed out. If your new rules increase the
47627 timeout time for such a host, you should definitely remove the old retry data
47628 and let Exim recreate it, based on the new rules. Otherwise Exim might bounce
47629 messages that it should now be retaining.
47630 </para>
47631 </section>
47632 <section id="SECID158">
47633 <title>Format of retry rules</title>
47634 <para>
47635 <indexterm role="concept">
47636 <primary>retry</primary>
47637 <secondary>rules</secondary>
47638 </indexterm>
47639 Each retry rule occupies one line and consists of three or four parts,
47640 separated by white space: a pattern, an error name, an optional list of sender
47641 addresses, and a list of retry parameters. The pattern and sender lists must be
47642 enclosed in double quotes if they contain white space. The rules are searched
47643 in order until one is found where the pattern, error name, and sender list (if
47644 present) match the failing host or address, the error that occurred, and the
47645 message&#x2019;s sender, respectively.
47646 </para>
47647 <para>
47648 The pattern is any single item that may appear in an address list (see section
47649 <xref linkend="SECTaddresslist"/>). It is in fact processed as a one-item address list,
47650 which means that it is expanded before being tested against the address that
47651 has been delayed. A negated address list item is permitted. Address
47652 list processing treats a plain domain name as if it were preceded by <quote>*@</quote>,
47653 which makes it possible for many retry rules to start with just a domain. For
47654 example,
47655 </para>
47656 <literallayout class="monospaced">
47657 lookingglass.fict.example        *  F,24h,30m;
47658 </literallayout>
47659 <para>
47660 provides a rule for any address in the <emphasis>lookingglass.fict.example</emphasis> domain,
47661 whereas
47662 </para>
47663 <literallayout class="monospaced">
47664 alice@lookingglass.fict.example  *  F,24h,30m;
47665 </literallayout>
47666 <para>
47667 applies only to temporary failures involving the local part <option>alice</option>.
47668 In practice, almost all rules start with a domain name pattern without a local
47669 part.
47670 </para>
47671 <para>
47672 <indexterm role="concept">
47673 <primary>regular expressions</primary>
47674 <secondary>in retry rules</secondary>
47675 </indexterm>
47676 <emphasis role="bold">Warning</emphasis>: If you use a regular expression in a retry rule pattern, it
47677 must match a complete address, not just a domain, because that is how regular
47678 expressions work in address lists.
47679 </para>
47680 <literallayout>
47681 <literal>^\Nxyz\d+\.abc\.example$\N        *  G,1h,10m,2</literal>     <option>Wrong</option>
47682 <literal>^\N[^@]+@xyz\d+\.abc\.example$\N  *  G,1h,10m,2</literal>     <option>Right</option>
47683 </literallayout>
47684 </section>
47685 <section id="SECID159">
47686 <title>Choosing which retry rule to use for address errors</title>
47687 <para>
47688 When Exim is looking for a retry rule after a routing attempt has failed (for
47689 example, after a DNS timeout), each line in the retry configuration is tested
47690 against the complete address only if <option>retry_use_local_part</option> is set for the
47691 router. Otherwise, only the domain is used, except when matching against a
47692 regular expression, when the local part of the address is replaced with <quote>*</quote>.
47693 A domain on its own can match a domain pattern, or a pattern that starts with
47694 <quote>*@</quote>. By default, <option>retry_use_local_part</option> is true for routers where
47695 <option>check_local_user</option> is true, and false for other routers.
47696 </para>
47697 <para>
47698 Similarly, when Exim is looking for a retry rule after a local delivery has
47699 failed (for example, after a mailbox full error), each line in the retry
47700 configuration is tested against the complete address only if
47701 <option>retry_use_local_part</option> is set for the transport (it defaults true for all
47702 local transports).
47703 </para>
47704 <para>
47705 <indexterm role="concept">
47706 <primary>4<emphasis>xx</emphasis> responses</primary>
47707 <secondary>retry rules for</secondary>
47708 </indexterm>
47709 However, when Exim is looking for a retry rule after a remote delivery attempt
47710 suffers an address error (a 4<emphasis>xx</emphasis> SMTP response for a recipient address), the
47711 whole address is always used as the key when searching the retry rules. The
47712 rule that is found is used to create a retry time for the combination of the
47713 failing address and the message&#x2019;s sender. It is the combination of sender and
47714 recipient that is delayed in subsequent queue runs until its retry time is
47715 reached. You can delay the recipient without regard to the sender by setting
47716 <option>address_retry_include_sender</option> false in the <command>smtp</command> transport but this can
47717 lead to problems with servers that regularly issue 4<emphasis>xx</emphasis> responses to RCPT
47718 commands.
47719 </para>
47720 </section>
47721 <section id="SECID160">
47722 <title>Choosing which retry rule to use for host and message errors</title>
47723 <para>
47724 For a temporary error that is not related to an individual address (for
47725 example, a connection timeout), each line in the retry configuration is checked
47726 twice. First, the name of the remote host is used as a domain name (preceded by
47727 <quote>*@</quote> when matching a regular expression). If this does not match the line,
47728 the domain from the email address is tried in a similar fashion. For example,
47729 suppose the MX records for <emphasis>a.b.c.example</emphasis> are
47730 </para>
47731 <literallayout class="monospaced">
47732 a.b.c.example  MX  5  x.y.z.example
47733                MX  6  p.q.r.example
47734                MX  7  m.n.o.example
47735 </literallayout>
47736 <para>
47737 and the retry rules are
47738 </para>
47739 <literallayout class="monospaced">
47740 p.q.r.example    *      F,24h,30m;
47741 a.b.c.example    *      F,4d,45m;
47742 </literallayout>
47743 <para>
47744 and a delivery to the host <emphasis>x.y.z.example</emphasis> suffers a connection failure. The
47745 first rule matches neither the host nor the domain, so Exim looks at the second
47746 rule. This does not match the host, but it does match the domain, so it is used
47747 to calculate the retry time for the host <emphasis>x.y.z.example</emphasis>. Meanwhile, Exim
47748 tries to deliver to <emphasis>p.q.r.example</emphasis>. If this also suffers a host error, the
47749 first retry rule is used, because it matches the host.
47750 </para>
47751 <para>
47752 In other words, temporary failures to deliver to host <emphasis>p.q.r.example</emphasis> use the
47753 first rule to determine retry times, but for all the other hosts for the domain
47754 <emphasis>a.b.c.example</emphasis>, the second rule is used. The second rule is also used if
47755 routing to <emphasis>a.b.c.example</emphasis> suffers a temporary failure.
47756 </para>
47757 <para>
47758 <emphasis role="bold">Note</emphasis>: The host name is used when matching the patterns, not its IP address.
47759 However, if a message is routed directly to an IP address without the use of a
47760 host name, for example, if a <command>manualroute</command> router contains a setting such as:
47761 </para>
47762 <literallayout class="monospaced">
47763 route_list = *.a.example  192.168.34.23
47764 </literallayout>
47765 <para>
47766 then the <quote>host name</quote> that is used when searching for a retry rule is the
47767 textual form of the IP address.
47768 </para>
47769 </section>
47770 <section id="SECID161">
47771 <title>Retry rules for specific errors</title>
47772 <para>
47773 <indexterm role="concept">
47774 <primary>retry</primary>
47775 <secondary>specific errors; specifying</secondary>
47776 </indexterm>
47777 The second field in a retry rule is the name of a particular error, or an
47778 asterisk, which matches any error. The errors that can be tested for are:
47779 </para>
47780 <variablelist>
47781 <varlistentry>
47782 <term><option>auth_failed</option></term>
47783 <listitem>
47784 <para>
47785 Authentication failed when trying to send to a host in the
47786 <option>hosts_require_auth</option> list in an <command>smtp</command> transport.
47787 </para>
47788 </listitem></varlistentry>
47789 <varlistentry>
47790 <term><option>data_4xx</option></term>
47791 <listitem>
47792 <para>
47793 A 4<emphasis>xx</emphasis> error was received for an outgoing DATA command, either immediately
47794 after the command, or after sending the message&#x2019;s data.
47795 </para>
47796 </listitem></varlistentry>
47797 <varlistentry>
47798 <term><option>mail_4xx</option></term>
47799 <listitem>
47800 <para>
47801 A 4<emphasis>xx</emphasis> error was received for an outgoing MAIL command.
47802 </para>
47803 </listitem></varlistentry>
47804 <varlistentry>
47805 <term><option>rcpt_4xx</option></term>
47806 <listitem>
47807 <para>
47808 A 4<emphasis>xx</emphasis> error was received for an outgoing RCPT command.
47809 </para>
47810 </listitem></varlistentry>
47811 </variablelist>
47812 <para>
47813 For the three 4<emphasis>xx</emphasis> errors, either the first or both of the x&#x2019;s can be given
47814 as specific digits, for example: <literal>mail_45x</literal> or <literal>rcpt_436</literal>. For example, to
47815 recognize 452 errors given to RCPT commands for addresses in a certain domain,
47816 and have retries every ten minutes with a one-hour timeout, you could set up a
47817 retry rule of this form:
47818 </para>
47819 <literallayout class="monospaced">
47820 the.domain.name  rcpt_452   F,1h,10m
47821 </literallayout>
47822 <para>
47823 These errors apply to both outgoing SMTP (the <command>smtp</command> transport) and outgoing
47824 LMTP (either the <command>lmtp</command> transport, or the <command>smtp</command> transport in LMTP mode).
47825 </para>
47826 <variablelist>
47827 <varlistentry>
47828 <term><option>lost_connection</option></term>
47829 <listitem>
47830 <para>
47831 A server unexpectedly closed the SMTP connection. There may, of course,
47832 legitimate reasons for this (host died, network died), but if it repeats a lot
47833 for the same host, it indicates something odd.
47834 </para>
47835 </listitem></varlistentry>
47836 <varlistentry revisionflag="changed">
47837 <term><option>lookup</option></term>
47838 <listitem>
47839 <para revisionflag="changed">
47840 A DNS lookup for a host failed.
47841 Note that a <option>dnslookup</option> router will need to have matched
47842 its <option>fail_defer_domains</option> option for this retry type to be usable.
47843 Also note that a <option>manualroute</option> router will probably need
47844 its <option>host_find_failed</option> option set to <option>defer</option>.
47845 </para>
47846 </listitem></varlistentry>
47847 <varlistentry>
47848 <term><option>refused_MX</option></term>
47849 <listitem>
47850 <para>
47851 A connection to a host obtained from an MX record was refused.
47852 </para>
47853 </listitem></varlistentry>
47854 <varlistentry>
47855 <term><option>refused_A</option></term>
47856 <listitem>
47857 <para>
47858 A connection to a host not obtained from an MX record was refused.
47859 </para>
47860 </listitem></varlistentry>
47861 <varlistentry>
47862 <term><option>refused</option></term>
47863 <listitem>
47864 <para>
47865 A connection was refused.
47866 </para>
47867 </listitem></varlistentry>
47868 <varlistentry>
47869 <term><option>timeout_connect_MX</option></term>
47870 <listitem>
47871 <para>
47872 A connection attempt to a host obtained from an MX record timed out.
47873 </para>
47874 </listitem></varlistentry>
47875 <varlistentry>
47876 <term><option>timeout_connect_A</option></term>
47877 <listitem>
47878 <para>
47879 A connection attempt to a host not obtained from an MX record timed out.
47880 </para>
47881 </listitem></varlistentry>
47882 <varlistentry>
47883 <term><option>timeout_connect</option></term>
47884 <listitem>
47885 <para>
47886 A connection attempt timed out.
47887 </para>
47888 </listitem></varlistentry>
47889 <varlistentry>
47890 <term><option>timeout_MX</option></term>
47891 <listitem>
47892 <para>
47893 There was a timeout while connecting or during an SMTP session with a host
47894 obtained from an MX record.
47895 </para>
47896 </listitem></varlistentry>
47897 <varlistentry>
47898 <term><option>timeout_A</option></term>
47899 <listitem>
47900 <para>
47901 There was a timeout while connecting or during an SMTP session with a host not
47902 obtained from an MX record.
47903 </para>
47904 </listitem></varlistentry>
47905 <varlistentry>
47906 <term><option>timeout</option></term>
47907 <listitem>
47908 <para>
47909 There was a timeout while connecting or during an SMTP session.
47910 </para>
47911 </listitem></varlistentry>
47912 <varlistentry>
47913 <term><option>tls_required</option></term>
47914 <listitem>
47915 <para>
47916 The server was required to use TLS (it matched <option>hosts_require_tls</option> in the
47917 <command>smtp</command> transport), but either did not offer TLS, or it responded with 4<emphasis>xx</emphasis>
47918 to STARTTLS, or there was a problem setting up the TLS connection.
47919 </para>
47920 </listitem></varlistentry>
47921 <varlistentry>
47922 <term><option>quota</option></term>
47923 <listitem>
47924 <para>
47925 A mailbox quota was exceeded in a local delivery by the <command>appendfile</command>
47926 transport.
47927 </para>
47928 </listitem></varlistentry>
47929 <varlistentry>
47930 <term><option>quota_</option>&lt;<emphasis>time</emphasis>&gt;</term>
47931 <listitem>
47932 <para>
47933 <indexterm role="concept">
47934 <primary>quota</primary>
47935 <secondary>error testing in retry rule</secondary>
47936 </indexterm>
47937 <indexterm role="concept">
47938 <primary>retry</primary>
47939 <secondary>quota error testing</secondary>
47940 </indexterm>
47941 A mailbox quota was exceeded in a local delivery by the <command>appendfile</command>
47942 transport, and the mailbox has not been accessed for &lt;<emphasis>time</emphasis>&gt;. For example,
47943 <emphasis>quota_4d</emphasis> applies to a quota error when the mailbox has not been accessed
47944 for four days.
47945 </para>
47946 </listitem></varlistentry>
47947 </variablelist>
47948 <para>
47949 <indexterm role="concept">
47950 <primary>mailbox</primary>
47951 <secondary>time of last read</secondary>
47952 </indexterm>
47953 The idea of <option>quota_</option>&lt;<emphasis>time</emphasis>&gt; is to make it possible to have shorter
47954 timeouts when the mailbox is full and is not being read by its owner. Ideally,
47955 it should be based on the last time that the user accessed the mailbox.
47956 However, it is not always possible to determine this. Exim uses the following
47957 heuristic rules:
47958 </para>
47959 <itemizedlist>
47960 <listitem>
47961 <para>
47962 If the mailbox is a single file, the time of last access (the <quote>atime</quote>) is
47963 used. As no new messages are being delivered (because the mailbox is over
47964 quota), Exim does not access the file, so this is the time of last user access.
47965 </para>
47966 </listitem>
47967 <listitem>
47968 <para>
47969 <indexterm role="concept">
47970 <primary>maildir format</primary>
47971 <secondary>time of last read</secondary>
47972 </indexterm>
47973 For a maildir delivery, the time of last modification of the <filename>new</filename>
47974 subdirectory is used. As the mailbox is over quota, no new files are created in
47975 the <filename>new</filename> subdirectory, because no new messages are being delivered. Any
47976 change to the <filename>new</filename> subdirectory is therefore assumed to be the result of an
47977 MUA moving a new message to the <filename>cur</filename> directory when it is first read. The
47978 time that is used is therefore the last time that the user read a new message.
47979 </para>
47980 </listitem>
47981 <listitem>
47982 <para>
47983 For other kinds of multi-file mailbox, the time of last access cannot be
47984 obtained, so a retry rule that uses this type of error field is never matched.
47985 </para>
47986 </listitem>
47987 </itemizedlist>
47988 <para>
47989 The quota errors apply both to system-enforced quotas and to Exim&#x2019;s own quota
47990 mechanism in the <command>appendfile</command> transport. The <emphasis>quota</emphasis> error also applies
47991 when a local delivery is deferred because a partition is full (the ENOSPC
47992 error).
47993 </para>
47994 </section>
47995 <section id="SECID162">
47996 <title>Retry rules for specified senders</title>
47997 <para>
47998 <indexterm role="concept">
47999 <primary>retry</primary>
48000 <secondary>rules; sender-specific</secondary>
48001 </indexterm>
48002 You can specify retry rules that apply only when the failing message has a
48003 specific sender. In particular, this can be used to define retry rules that
48004 apply only to bounce messages. The third item in a retry rule can be of this
48005 form:
48006 </para>
48007 <literallayout>
48008 <literal>senders=</literal>&lt;<emphasis>address list</emphasis>&gt;
48009 </literallayout>
48010 <para>
48011 The retry timings themselves are then the fourth item. For example:
48012 </para>
48013 <literallayout class="monospaced">
48014 *   rcpt_4xx   senders=:   F,1h,30m
48015 </literallayout>
48016 <para>
48017 matches recipient 4<emphasis>xx</emphasis> errors for bounce messages sent to any address at any
48018 host. If the address list contains white space, it must be enclosed in quotes.
48019 For example:
48020 </para>
48021 <literallayout class="monospaced">
48022 a.domain  rcpt_452  senders="xb.dom : yc.dom"  G,8h,10m,1.5
48023 </literallayout>
48024 <para>
48025 <emphasis role="bold">Warning</emphasis>: This facility can be unhelpful if it is used for host errors
48026 (which do not depend on the recipient). The reason is that the sender is used
48027 only to match the retry rule. Once the rule has been found for a host error,
48028 its contents are used to set a retry time for the host, and this will apply to
48029 all messages, not just those with specific senders.
48030 </para>
48031 <para>
48032 When testing retry rules using <option>-brt</option>, you can supply a sender using the
48033 <option>-f</option> command line option, like this:
48034 </para>
48035 <literallayout class="monospaced">
48036 exim -f "" -brt user@dom.ain
48037 </literallayout>
48038 <para>
48039 If you do not set <option>-f</option> with <option>-brt</option>, a retry rule that contains a senders
48040 list is never matched.
48041 </para>
48042 </section>
48043 <section id="SECID163">
48044 <title>Retry parameters</title>
48045 <para>
48046 <indexterm role="concept">
48047 <primary>retry</primary>
48048 <secondary>parameters in rules</secondary>
48049 </indexterm>
48050 The third (or fourth, if a senders list is present) field in a retry rule is a
48051 sequence of retry parameter sets, separated by semicolons. Each set consists of
48052 </para>
48053 <literallayout>
48054 &lt;<emphasis>letter</emphasis>&gt;,&lt;<emphasis>cutoff time</emphasis>&gt;,&lt;<emphasis>arguments</emphasis>&gt;
48055 </literallayout>
48056 <para>
48057 The letter identifies the algorithm for computing a new retry time; the cutoff
48058 time is the time beyond which this algorithm no longer applies, and the
48059 arguments vary the algorithm&#x2019;s action. The cutoff time is measured from the
48060 time that the first failure for the domain (combined with the local part if
48061 relevant) was detected, not from the time the message was received.
48062 </para>
48063 <para>
48064 <indexterm role="concept">
48065 <primary>retry</primary>
48066 <secondary>algorithms</secondary>
48067 </indexterm>
48068 <indexterm role="concept">
48069 <primary>retry</primary>
48070 <secondary>fixed intervals</secondary>
48071 </indexterm>
48072 <indexterm role="concept">
48073 <primary>retry</primary>
48074 <secondary>increasing intervals</secondary>
48075 </indexterm>
48076 <indexterm role="concept">
48077 <primary>retry</primary>
48078 <secondary>random intervals</secondary>
48079 </indexterm>
48080 The available algorithms are:
48081 </para>
48082 <itemizedlist>
48083 <listitem>
48084 <para>
48085 <emphasis>F</emphasis>: retry at fixed intervals. There is a single time parameter specifying
48086 the interval.
48087 </para>
48088 </listitem>
48089 <listitem>
48090 <para>
48091 <emphasis>G</emphasis>: retry at geometrically increasing intervals. The first argument
48092 specifies a starting value for the interval, and the second a multiplier, which
48093 is used to increase the size of the interval at each retry.
48094 </para>
48095 </listitem>
48096 <listitem>
48097 <para>
48098 <emphasis>H</emphasis>: retry at randomized intervals. The arguments are as for <emphasis>G</emphasis>. For each
48099 retry, the previous interval is multiplied by the factor in order to get a
48100 maximum for the next interval. The minimum interval is the first argument of
48101 the parameter, and an actual interval is chosen randomly between them. Such a
48102 rule has been found to be helpful in cluster configurations when all the
48103 members of the cluster restart at once, and may therefore synchronize their
48104 queue processing times.
48105 </para>
48106 </listitem>
48107 </itemizedlist>
48108 <para>
48109 When computing the next retry time, the algorithm definitions are scanned in
48110 order until one whose cutoff time has not yet passed is reached. This is then
48111 used to compute a new retry time that is later than the current time. In the
48112 case of fixed interval retries, this simply means adding the interval to the
48113 current time. For geometrically increasing intervals, retry intervals are
48114 computed from the rule&#x2019;s parameters until one that is greater than the previous
48115 interval is found. The main configuration variable
48116 <indexterm role="concept">
48117 <primary>limit</primary>
48118 <secondary>retry interval</secondary>
48119 </indexterm>
48120 <indexterm role="concept">
48121 <primary>retry</primary>
48122 <secondary>interval, maximum</secondary>
48123 </indexterm>
48124 <indexterm role="option">
48125 <primary><option>retry_interval_max</option></primary>
48126 </indexterm>
48127 <option>retry_interval_max</option> limits the maximum interval between retries. It
48128 cannot be set greater than <literal>24h</literal>, which is its default value.
48129 </para>
48130 <para>
48131 A single remote domain may have a number of hosts associated with it, and each
48132 host may have more than one IP address. Retry algorithms are selected on the
48133 basis of the domain name, but are applied to each IP address independently. If,
48134 for example, a host has two IP addresses and one is unusable, Exim will
48135 generate retry times for it and will not try to use it until its next retry
48136 time comes. Thus the good IP address is likely to be tried first most of the
48137 time.
48138 </para>
48139 <para>
48140 <indexterm role="concept">
48141 <primary>hints database</primary>
48142 <secondary>use for retrying</secondary>
48143 </indexterm>
48144 Retry times are hints rather than promises. Exim does not make any attempt to
48145 run deliveries exactly at the computed times. Instead, a queue runner process
48146 starts delivery processes for delayed messages periodically, and these attempt
48147 new deliveries only for those addresses that have passed their next retry time.
48148 If a new message arrives for a deferred address, an immediate delivery attempt
48149 occurs only if the address has passed its retry time. In the absence of new
48150 messages, the minimum time between retries is the interval between queue runner
48151 processes. There is not much point in setting retry times of five minutes if
48152 your queue runners happen only once an hour, unless there are a significant
48153 number of incoming messages (which might be the case on a system that is
48154 sending everything to a smart host, for example).
48155 </para>
48156 <para>
48157 The data in the retry hints database can be inspected by using the
48158 <emphasis>exim_dumpdb</emphasis> or <emphasis>exim_fixdb</emphasis> utility programs (see chapter
48159 <xref linkend="CHAPutils"/>). The latter utility can also be used to change the data. The
48160 <emphasis>exinext</emphasis> utility script can be used to find out what the next retry times
48161 are for the hosts associated with a particular mail domain, and also for local
48162 deliveries that have been deferred.
48163 </para>
48164 </section>
48165 <section id="SECID164">
48166 <title>Retry rule examples</title>
48167 <para>
48168 Here are some example retry rules:
48169 </para>
48170 <literallayout class="monospaced">
48171 alice@wonderland.fict.example quota_5d  F,7d,3h
48172 wonderland.fict.example       quota_5d
48173 wonderland.fict.example       *         F,1h,15m; G,2d,1h,2;
48174 lookingglass.fict.example     *         F,24h,30m;
48175 *                 refused_A   F,2h,20m;
48176 *                 *           F,2h,15m; G,16h,1h,1.5; F,5d,8h
48177 </literallayout>
48178 <para>
48179 The first rule sets up special handling for mail to
48180 <emphasis>alice@wonderland.fict.example</emphasis> when there is an over-quota error and the
48181 mailbox has not been read for at least 5 days. Retries continue every three
48182 hours for 7 days. The second rule handles over-quota errors for all other local
48183 parts at <emphasis>wonderland.fict.example</emphasis>; the absence of a local part has the same
48184 effect as supplying <quote>*@</quote>. As no retry algorithms are supplied, messages that
48185 fail are bounced immediately if the mailbox has not been read for at least 5
48186 days.
48187 </para>
48188 <para>
48189 The third rule handles all other errors at <emphasis>wonderland.fict.example</emphasis>; retries
48190 happen every 15 minutes for an hour, then with geometrically increasing
48191 intervals until two days have passed since a delivery first failed. After the
48192 first hour there is a delay of one hour, then two hours, then four hours, and
48193 so on (this is a rather extreme example).
48194 </para>
48195 <para>
48196 The fourth rule controls retries for the domain <emphasis>lookingglass.fict.example</emphasis>.
48197 They happen every 30 minutes for 24 hours only. The remaining two rules handle
48198 all other domains, with special action for connection refusal from hosts that
48199 were not obtained from an MX record.
48200 </para>
48201 <para>
48202 The final rule in a retry configuration should always have asterisks in the
48203 first two fields so as to provide a general catch-all for any addresses that do
48204 not have their own special handling. This example tries every 15 minutes for 2
48205 hours, then with intervals starting at one hour and increasing by a factor of
48206 1.5 up to 16 hours, then every 8 hours up to 5 days.
48207 </para>
48208 </section>
48209 <section id="SECID165">
48210 <title>Timeout of retry data</title>
48211 <para>
48212 <indexterm role="concept">
48213 <primary>timeout</primary>
48214 <secondary>of retry data</secondary>
48215 </indexterm>
48216 <indexterm role="option">
48217 <primary><option>retry_data_expire</option></primary>
48218 </indexterm>
48219 <indexterm role="concept">
48220 <primary>hints database</primary>
48221 <secondary>data expiry</secondary>
48222 </indexterm>
48223 <indexterm role="concept">
48224 <primary>retry</primary>
48225 <secondary>timeout of data</secondary>
48226 </indexterm>
48227 Exim timestamps the data that it writes to its retry hints database. When it
48228 consults the data during a delivery it ignores any that is older than the value
48229 set in <option>retry_data_expire</option> (default 7 days). If, for example, a host hasn&#x2019;t
48230 been tried for 7 days, Exim will try to deliver to it immediately a message
48231 arrives, and if that fails, it will calculate a retry time as if it were
48232 failing for the first time.
48233 </para>
48234 <para>
48235 This improves the behaviour for messages routed to rarely-used hosts such as MX
48236 backups. If such a host was down at one time, and happens to be down again when
48237 Exim tries a month later, using the old retry data would imply that it had been
48238 down all the time, which is not a justified assumption.
48239 </para>
48240 <para>
48241 If a host really is permanently dead, this behaviour causes a burst of retries
48242 every now and again, but only if messages routed to it are rare. If there is a
48243 message at least once every 7 days the retry data never expires.
48244 </para>
48245 </section>
48246 <section id="SECID166">
48247 <title>Long-term failures</title>
48248 <para>
48249 <indexterm role="concept">
48250 <primary>delivery failure, long-term</primary>
48251 </indexterm>
48252 <indexterm role="concept">
48253 <primary>retry</primary>
48254 <secondary>after long-term failure</secondary>
48255 </indexterm>
48256 Special processing happens when an email address has been failing for so long
48257 that the cutoff time for the last algorithm is reached. For example, using the
48258 default retry rule:
48259 </para>
48260 <literallayout class="monospaced">
48261 * * F,2h,15m; G,16h,1h,1.5; F,4d,6h
48262 </literallayout>
48263 <para>
48264 the cutoff time is four days. Reaching the retry cutoff is independent of how
48265 long any specific message has been failing; it is the length of continuous
48266 failure for the recipient address that counts.
48267 </para>
48268 <para>
48269 When the cutoff time is reached for a local delivery, or for all the IP
48270 addresses associated with a remote delivery, a subsequent delivery failure
48271 causes Exim to give up on the address, and a bounce message is generated.
48272 In order to cater for new messages that use the failing address, a next retry
48273 time is still computed from the final algorithm, and is used as follows:
48274 </para>
48275 <para>
48276 For local deliveries, one delivery attempt is always made for any subsequent
48277 messages. If this delivery fails, the address fails immediately. The
48278 post-cutoff retry time is not used.
48279 </para>
48280 <para>
48281 If the delivery is remote, there are two possibilities, controlled by the
48282 <indexterm role="option">
48283 <primary><option>delay_after_cutoff</option></primary>
48284 </indexterm>
48285 <option>delay_after_cutoff</option> option of the <command>smtp</command> transport. The option is true by
48286 default. Until the post-cutoff retry time for one of the IP addresses is
48287 reached, the failing email address is bounced immediately, without a delivery
48288 attempt taking place. After that time, one new delivery attempt is made to
48289 those IP addresses that are past their retry times, and if that still fails,
48290 the address is bounced and new retry times are computed.
48291 </para>
48292 <para>
48293 In other words, when all the hosts for a given email address have been failing
48294 for a long time, Exim bounces rather then defers until one of the hosts&#x2019; retry
48295 times is reached. Then it tries once, and bounces if that attempt fails. This
48296 behaviour ensures that few resources are wasted in repeatedly trying to deliver
48297 to a broken destination, but if the host does recover, Exim will eventually
48298 notice.
48299 </para>
48300 <para>
48301 If <option>delay_after_cutoff</option> is set false, Exim behaves differently. If all IP
48302 addresses are past their final cutoff time, Exim tries to deliver to those IP
48303 addresses that have not been tried since the message arrived. If there are
48304 no suitable IP addresses, or if they all fail, the address is bounced. In other
48305 words, it does not delay when a new message arrives, but tries the expired
48306 addresses immediately, unless they have been tried since the message arrived.
48307 If there is a continuous stream of messages for the failing domains, setting
48308 <option>delay_after_cutoff</option> false means that there will be many more attempts to
48309 deliver to permanently failing IP addresses than when <option>delay_after_cutoff</option> is
48310 true.
48311 </para>
48312 </section>
48313 <section id="SECID167">
48314 <title>Deliveries that work intermittently</title>
48315 <para>
48316 <indexterm role="concept">
48317 <primary>retry</primary>
48318 <secondary>intermittently working deliveries</secondary>
48319 </indexterm>
48320 Some additional logic is needed to cope with cases where a host is
48321 intermittently available, or when a message has some attribute that prevents
48322 its delivery when others to the same address get through. In this situation,
48323 because some messages are successfully delivered, the <quote>retry clock</quote> for the
48324 host or address keeps getting reset by the successful deliveries, and so
48325 failing messages remain on the queue for ever because the cutoff time is never
48326 reached.
48327 </para>
48328 <para>
48329 Two exceptional actions are applied to prevent this happening. The first
48330 applies to errors that are related to a message rather than a remote host.
48331 Section <xref linkend="SECToutSMTPerr"/> has a discussion of the different kinds of error;
48332 examples of message-related errors are 4<emphasis>xx</emphasis> responses to MAIL or DATA
48333 commands, and quota failures. For this type of error, if a message&#x2019;s arrival
48334 time is earlier than the <quote>first failed</quote> time for the error, the earlier time
48335 is used when scanning the retry rules to decide when to try next and when to
48336 time out the address.
48337 </para>
48338 <para>
48339 The exceptional second action applies in all cases. If a message has been on
48340 the queue for longer than the cutoff time of any applicable retry rule for a
48341 given address, a delivery is attempted for that address, even if it is not yet
48342 time, and if this delivery fails, the address is timed out. A new retry time is
48343 not computed in this case, so that other messages for the same address are
48344 considered immediately.
48345 <indexterm role="concept" startref="IIDretconf1" class="endofrange"/>
48346 <indexterm role="concept" startref="IIDregconf2" class="endofrange"/>
48347 </para>
48348 </section>
48349 </chapter>
48350
48351 <chapter id="CHAPSMTPAUTH">
48352 <title>SMTP authentication</title>
48353 <para>
48354 <indexterm role="concept" id="IIDauthconf1" class="startofrange">
48355 <primary>SMTP</primary>
48356 <secondary>authentication configuration</secondary>
48357 </indexterm>
48358 <indexterm role="concept" id="IIDauthconf2" class="startofrange">
48359 <primary>authentication</primary>
48360 </indexterm>
48361 The <quote>authenticators</quote> section of Exim&#x2019;s run time configuration is concerned
48362 with SMTP authentication. This facility is an extension to the SMTP protocol,
48363 described in RFC 2554, which allows a client SMTP host to authenticate itself
48364 to a server. This is a common way for a server to recognize clients that are
48365 permitted to use it as a relay. SMTP authentication is not of relevance to the
48366 transfer of mail between servers that have no managerial connection with each
48367 other.
48368 </para>
48369 <para>
48370 <indexterm role="concept">
48371 <primary>AUTH</primary>
48372 <secondary>description of</secondary>
48373 </indexterm>
48374 Very briefly, the way SMTP authentication works is as follows:
48375 </para>
48376 <itemizedlist>
48377 <listitem>
48378 <para>
48379 The server advertises a number of authentication <emphasis>mechanisms</emphasis> in response to
48380 the client&#x2019;s EHLO command.
48381 </para>
48382 </listitem>
48383 <listitem>
48384 <para>
48385 The client issues an AUTH command, naming a specific mechanism. The command
48386 may, optionally, contain some authentication data.
48387 </para>
48388 </listitem>
48389 <listitem>
48390 <para>
48391 The server may issue one or more <emphasis>challenges</emphasis>, to which the client must send
48392 appropriate responses. In simple authentication mechanisms, the challenges are
48393 just prompts for user names and passwords. The server does not have to issue
48394 any challenges &ndash; in some mechanisms the relevant data may all be transmitted
48395 with the AUTH command.
48396 </para>
48397 </listitem>
48398 <listitem>
48399 <para>
48400 The server either accepts or denies authentication.
48401 </para>
48402 </listitem>
48403 <listitem>
48404 <para>
48405 If authentication succeeds, the client may optionally make use of the AUTH
48406 option on the MAIL command to pass an authenticated sender in subsequent
48407 mail transactions. Authentication lasts for the remainder of the SMTP
48408 connection.
48409 </para>
48410 </listitem>
48411 <listitem>
48412 <para>
48413 If authentication fails, the client may give up, or it may try a different
48414 authentication mechanism, or it may try transferring mail over the
48415 unauthenticated connection.
48416 </para>
48417 </listitem>
48418 </itemizedlist>
48419 <para>
48420 If you are setting up a client, and want to know which authentication
48421 mechanisms the server supports, you can use Telnet to connect to port 25 (the
48422 SMTP port) on the server, and issue an EHLO command. The response to this
48423 includes the list of supported mechanisms. For example:
48424 </para>
48425 <literallayout>
48426 <literal>$ </literal><emphasis role="bold"><literal>telnet server.example 25</literal></emphasis>
48427 <literal>Trying 192.168.34.25...</literal>
48428 <literal>Connected to server.example.</literal>
48429 <literal>Escape character is &#x0027;^]&#x0027;.</literal>
48430 <literal>220 server.example ESMTP Exim 4.20 ...</literal>
48431 <emphasis role="bold"><literal>ehlo client.example</literal></emphasis>
48432 <literal>250-server.example Hello client.example [10.8.4.5]</literal>
48433 <literal>250-SIZE 52428800</literal>
48434 <literal>250-PIPELINING</literal>
48435 <literal>250-AUTH PLAIN</literal>
48436 <literal>250 HELP</literal>
48437 </literallayout>
48438 <para>
48439 The second-last line of this example output shows that the server supports
48440 authentication using the PLAIN mechanism. In Exim, the different authentication
48441 mechanisms are configured by specifying <emphasis>authenticator</emphasis> drivers. Like the
48442 routers and transports, which authenticators are included in the binary is
48443 controlled by build-time definitions. The following are currently available,
48444 included by setting
48445 </para>
48446 <literallayout class="monospaced">
48447 AUTH_CRAM_MD5=yes
48448 AUTH_CYRUS_SASL=yes
48449 AUTH_DOVECOT=yes
48450 AUTH_GSASL=yes
48451 AUTH_HEIMDAL_GSSAPI=yes
48452 AUTH_PLAINTEXT=yes
48453 AUTH_SPA=yes
48454 AUTH_TLS=yes
48455 </literallayout>
48456 <para>
48457 in <filename>Local/Makefile</filename>, respectively. The first of these supports the CRAM-MD5
48458 authentication mechanism (RFC 2195), and the second provides an interface to
48459 the Cyrus SASL authentication library.
48460 The third is an interface to Dovecot&#x2019;s authentication system, delegating the
48461 work via a socket interface.
48462 The fourth provides an interface to the GNU SASL authentication library, which
48463 provides mechanisms but typically not data sources.
48464 The fifth provides direct access to Heimdal GSSAPI, geared for Kerberos, but
48465 supporting setting a server keytab.
48466 The sixth can be configured to support
48467 the PLAIN authentication mechanism (RFC 2595) or the LOGIN mechanism, which is
48468 not formally documented, but used by several MUAs. The seventh authenticator
48469 supports Microsoft&#x2019;s <emphasis>Secure Password Authentication</emphasis> mechanism.
48470 </para>
48471 <para revisionflag="changed">
48472 The eighth is an Exim authenticator but not an SMTP one;
48473 instead it can use information from a TLS negotiation.
48474 </para>
48475 <para>
48476 The authenticators are configured using the same syntax as other drivers (see
48477 section <xref linkend="SECTfordricon"/>). If no authenticators are required, no
48478 authentication section need be present in the configuration file. Each
48479 authenticator can in principle have both server and client functions. When Exim
48480 is receiving SMTP mail, it is acting as a server; when it is sending out
48481 messages over SMTP, it is acting as a client. Authenticator configuration
48482 options are provided for use in both these circumstances.
48483 </para>
48484 <para>
48485 To make it clear which options apply to which situation, the prefixes
48486 <option>server_</option> and <option>client_</option> are used on option names that are specific to
48487 either the server or the client function, respectively. Server and client
48488 functions are disabled if none of their options are set. If an authenticator is
48489 to be used for both server and client functions, a single definition, using
48490 both sets of options, is required. For example:
48491 </para>
48492 <literallayout class="monospaced">
48493 cram:
48494   driver = cram_md5
48495   public_name = CRAM-MD5
48496   server_secret = ${if eq{$auth1}{ph10}{secret1}fail}
48497   client_name = ph10
48498   client_secret = secret2
48499 </literallayout>
48500 <para>
48501 The <option>server_</option> option is used when Exim is acting as a server, and the
48502 <option>client_</option> options when it is acting as a client.
48503 </para>
48504 <para>
48505 Descriptions of the individual authenticators are given in subsequent chapters.
48506 The remainder of this chapter covers the generic options for the
48507 authenticators, followed by general discussion of the way authentication works
48508 in Exim.
48509 </para>
48510 <para>
48511 <emphasis role="bold">Beware:</emphasis> the meaning of <varname>$auth1</varname>, <varname>$auth2</varname>, ... varies on a per-driver and
48512 per-mechanism basis.  Please read carefully to determine which variables hold
48513 account labels such as usercodes and which hold passwords or other
48514 authenticating data.
48515 </para>
48516 <para>
48517 Note that some mechanisms support two different identifiers for accounts: the
48518 <emphasis>authentication id</emphasis> and the <emphasis>authorization id</emphasis>.  The contractions <emphasis>authn</emphasis>
48519 and <emphasis>authz</emphasis> are commonly encountered.  The American spelling is standard here.
48520 Conceptually, authentication data such as passwords are tied to the identifier
48521 used to authenticate; servers may have rules to permit one user to act as a
48522 second user, so that after login the session is treated as though that second
48523 user had logged in.  That second user is the <emphasis>authorization id</emphasis>.  A robust
48524 configuration might confirm that the <emphasis>authz</emphasis> field is empty or matches the
48525 <emphasis>authn</emphasis> field.  Often this is just ignored.  The <emphasis>authn</emphasis> can be considered
48526 as verified data, the <emphasis>authz</emphasis> as an unverified request which the server might
48527 choose to honour.
48528 </para>
48529 <para>
48530 A <emphasis>realm</emphasis> is a text string, typically a domain name, presented by a server
48531 to a client to help it select an account and credentials to use.  In some
48532 mechanisms, the client and server provably agree on the realm, but clients
48533 typically can not treat the realm as secure data to be blindly trusted.
48534 </para>
48535 <section id="SECID168">
48536 <title>Generic options for authenticators</title>
48537 <para>
48538 <indexterm role="concept">
48539 <primary>authentication</primary>
48540 <secondary>generic options</secondary>
48541 </indexterm>
48542 <indexterm role="concept">
48543 <primary>options</primary>
48544 <secondary>generic; for authenticators</secondary>
48545 </indexterm>
48546 </para>
48547 <para>
48548 <indexterm role="option">
48549 <primary><option>client_condition</option></primary>
48550 </indexterm>
48551 </para>
48552 <informaltable frame="all">
48553 <tgroup cols="4" colsep="0" rowsep="0">
48554 <colspec colwidth="8*" align="left"/>
48555 <colspec colwidth="6*" align="center"/>
48556 <colspec colwidth="6*" align="center"/>
48557 <colspec colwidth="6*" align="right"/>
48558 <tbody>
48559 <row>
48560 <entry><option>client_condition</option></entry>
48561 <entry>Use: <emphasis>authenticators</emphasis></entry>
48562 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
48563 <entry>Default: <emphasis>unset</emphasis></entry>
48564 </row>
48565 </tbody>
48566 </tgroup>
48567 </informaltable>
48568 <para>
48569 When Exim is authenticating as a client, it skips any authenticator whose
48570 <option>client_condition</option> expansion yields <quote>0</quote>, <quote>no</quote>, or <quote>false</quote>. This can be
48571 used, for example, to skip plain text authenticators when the connection is not
48572 encrypted by a setting such as:
48573 </para>
48574 <literallayout class="monospaced">
48575 client_condition = ${if !eq{$tls_out_cipher}{}}
48576 </literallayout>
48577 <para>
48578 <indexterm role="option">
48579 <primary><option>client_set_id</option></primary>
48580 </indexterm>
48581 </para>
48582 <informaltable frame="all">
48583 <tgroup cols="4" colsep="0" rowsep="0">
48584 <colspec colwidth="8*" align="left"/>
48585 <colspec colwidth="6*" align="center"/>
48586 <colspec colwidth="6*" align="center"/>
48587 <colspec colwidth="6*" align="right"/>
48588 <tbody>
48589 <row>
48590 <entry><option>client_set_id</option></entry>
48591 <entry>Use: <emphasis>authenticators</emphasis></entry>
48592 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
48593 <entry>Default: <emphasis>unset</emphasis></entry>
48594 </row>
48595 </tbody>
48596 </tgroup>
48597 </informaltable>
48598 <para>
48599 When client authentication succeeds, this condition is expanded; the
48600 result is used in the log lines for outbound messages.
48601 Typically it will be the user name used for authentication.
48602 </para>
48603 <para>
48604 <indexterm role="option">
48605 <primary><option>driver</option></primary>
48606 </indexterm>
48607 </para>
48608 <informaltable frame="all">
48609 <tgroup cols="4" colsep="0" rowsep="0">
48610 <colspec colwidth="8*" align="left"/>
48611 <colspec colwidth="6*" align="center"/>
48612 <colspec colwidth="6*" align="center"/>
48613 <colspec colwidth="6*" align="right"/>
48614 <tbody>
48615 <row>
48616 <entry><option>driver</option></entry>
48617 <entry>Use: <emphasis>authenticators</emphasis></entry>
48618 <entry>Type: <emphasis>string</emphasis></entry>
48619 <entry>Default: <emphasis>unset</emphasis></entry>
48620 </row>
48621 </tbody>
48622 </tgroup>
48623 </informaltable>
48624 <para>
48625 This option must always be set. It specifies which of the available
48626 authenticators is to be used.
48627 </para>
48628 <para>
48629 <indexterm role="option">
48630 <primary><option>public_name</option></primary>
48631 </indexterm>
48632 </para>
48633 <informaltable frame="all">
48634 <tgroup cols="4" colsep="0" rowsep="0">
48635 <colspec colwidth="8*" align="left"/>
48636 <colspec colwidth="6*" align="center"/>
48637 <colspec colwidth="6*" align="center"/>
48638 <colspec colwidth="6*" align="right"/>
48639 <tbody>
48640 <row>
48641 <entry><option>public_name</option></entry>
48642 <entry>Use: <emphasis>authenticators</emphasis></entry>
48643 <entry>Type: <emphasis>string</emphasis></entry>
48644 <entry>Default: <emphasis>unset</emphasis></entry>
48645 </row>
48646 </tbody>
48647 </tgroup>
48648 </informaltable>
48649 <para>
48650 This option specifies the name of the authentication mechanism that the driver
48651 implements, and by which it is known to the outside world. These names should
48652 contain only upper case letters, digits, underscores, and hyphens (RFC 2222),
48653 but Exim in fact matches them caselessly. If <option>public_name</option> is not set, it
48654 defaults to the driver&#x2019;s instance name.
48655 </para>
48656 <para>
48657 <indexterm role="option">
48658 <primary><option>server_advertise_condition</option></primary>
48659 </indexterm>
48660 </para>
48661 <informaltable frame="all">
48662 <tgroup cols="4" colsep="0" rowsep="0">
48663 <colspec colwidth="8*" align="left"/>
48664 <colspec colwidth="6*" align="center"/>
48665 <colspec colwidth="6*" align="center"/>
48666 <colspec colwidth="6*" align="right"/>
48667 <tbody>
48668 <row>
48669 <entry><option>server_advertise_condition</option></entry>
48670 <entry>Use: <emphasis>authenticators</emphasis></entry>
48671 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
48672 <entry>Default: <emphasis>unset</emphasis></entry>
48673 </row>
48674 </tbody>
48675 </tgroup>
48676 </informaltable>
48677 <para>
48678 When a server is about to advertise an authentication mechanism, the condition
48679 is expanded. If it yields the empty string, <quote>0</quote>, <quote>no</quote>, or <quote>false</quote>, the
48680 mechanism is not advertised.
48681 If the expansion fails, the mechanism is not advertised. If the failure was not
48682 forced, and was not caused by a lookup defer, the incident is logged.
48683 See section <xref linkend="SECTauthexiser"/> below for further discussion.
48684 </para>
48685 <para>
48686 <indexterm role="option">
48687 <primary><option>server_condition</option></primary>
48688 </indexterm>
48689 </para>
48690 <informaltable frame="all">
48691 <tgroup cols="4" colsep="0" rowsep="0">
48692 <colspec colwidth="8*" align="left"/>
48693 <colspec colwidth="6*" align="center"/>
48694 <colspec colwidth="6*" align="center"/>
48695 <colspec colwidth="6*" align="right"/>
48696 <tbody>
48697 <row>
48698 <entry><option>server_condition</option></entry>
48699 <entry>Use: <emphasis>authenticators</emphasis></entry>
48700 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
48701 <entry>Default: <emphasis>unset</emphasis></entry>
48702 </row>
48703 </tbody>
48704 </tgroup>
48705 </informaltable>
48706 <para>
48707 This option must be set for a <option>plaintext</option> server authenticator, where it
48708 is used directly to control authentication. See section <xref linkend="SECTplainserver"/>
48709 for details.
48710 </para>
48711 <para>
48712 For the <command>gsasl</command> authenticator, this option is required for various
48713 mechanisms; see chapter <xref linkend="CHAPgsasl"/> for details.
48714 </para>
48715 <para>
48716 For the other authenticators, <option>server_condition</option> can be used as an additional
48717 authentication or authorization mechanism that is applied after the other
48718 authenticator conditions succeed. If it is set, it is expanded when the
48719 authenticator would otherwise return a success code. If the expansion is forced
48720 to fail, authentication fails. Any other expansion failure causes a temporary
48721 error code to be returned. If the result of a successful expansion is an empty
48722 string, <quote>0</quote>, <quote>no</quote>, or <quote>false</quote>, authentication fails. If the result of the
48723 expansion is <quote>1</quote>, <quote>yes</quote>, or <quote>true</quote>, authentication succeeds. For any
48724 other result, a temporary error code is returned, with the expanded string as
48725 the error text.
48726 </para>
48727 <para>
48728 <indexterm role="option">
48729 <primary><option>server_debug_print</option></primary>
48730 </indexterm>
48731 </para>
48732 <informaltable frame="all">
48733 <tgroup cols="4" colsep="0" rowsep="0">
48734 <colspec colwidth="8*" align="left"/>
48735 <colspec colwidth="6*" align="center"/>
48736 <colspec colwidth="6*" align="center"/>
48737 <colspec colwidth="6*" align="right"/>
48738 <tbody>
48739 <row>
48740 <entry><option>server_debug_print</option></entry>
48741 <entry>Use: <emphasis>authenticators</emphasis></entry>
48742 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
48743 <entry>Default: <emphasis>unset</emphasis></entry>
48744 </row>
48745 </tbody>
48746 </tgroup>
48747 </informaltable>
48748 <para>
48749 If this option is set and authentication debugging is enabled (see the <option>-d</option>
48750 command line option), the string is expanded and included in the debugging
48751 output when the authenticator is run as a server. This can help with checking
48752 out the values of variables.
48753 If expansion of the string fails, the error message is written to the debugging
48754 output, and Exim carries on processing.
48755 </para>
48756 <para>
48757 <indexterm role="option">
48758 <primary><option>server_set_id</option></primary>
48759 </indexterm>
48760 </para>
48761 <informaltable frame="all">
48762 <tgroup cols="4" colsep="0" rowsep="0">
48763 <colspec colwidth="8*" align="left"/>
48764 <colspec colwidth="6*" align="center"/>
48765 <colspec colwidth="6*" align="center"/>
48766 <colspec colwidth="6*" align="right"/>
48767 <tbody>
48768 <row>
48769 <entry><option>server_set_id</option></entry>
48770 <entry>Use: <emphasis>authenticators</emphasis></entry>
48771 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
48772 <entry>Default: <emphasis>unset</emphasis></entry>
48773 </row>
48774 </tbody>
48775 </tgroup>
48776 </informaltable>
48777 <para>
48778 <indexterm role="variable">
48779 <primary><varname>$authenticated_id</varname></primary>
48780 </indexterm>
48781 When an Exim server successfully authenticates a client, this string is
48782 expanded using data from the authentication, and preserved for any incoming
48783 messages in the variable <varname>$authenticated_id</varname>. It is also included in the log
48784 lines for incoming messages. For example, a user/password authenticator
48785 configuration might preserve the user name that was used to authenticate, and
48786 refer to it subsequently during delivery of the message.
48787 If expansion fails, the option is ignored.
48788 </para>
48789 <para>
48790 <indexterm role="option">
48791 <primary><option>server_mail_auth_condition</option></primary>
48792 </indexterm>
48793 </para>
48794 <informaltable frame="all">
48795 <tgroup cols="4" colsep="0" rowsep="0">
48796 <colspec colwidth="8*" align="left"/>
48797 <colspec colwidth="6*" align="center"/>
48798 <colspec colwidth="6*" align="center"/>
48799 <colspec colwidth="6*" align="right"/>
48800 <tbody>
48801 <row>
48802 <entry><option>server_mail_auth_condition</option></entry>
48803 <entry>Use: <emphasis>authenticators</emphasis></entry>
48804 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
48805 <entry>Default: <emphasis>unset</emphasis></entry>
48806 </row>
48807 </tbody>
48808 </tgroup>
48809 </informaltable>
48810 <para>
48811 This option allows a server to discard authenticated sender addresses supplied
48812 as part of MAIL commands in SMTP connections that are authenticated by the
48813 driver on which <option>server_mail_auth_condition</option> is set. The option is not used
48814 as part of the authentication process; instead its (unexpanded) value is
48815 remembered for later use.
48816 How it is used is described in the following section.
48817 </para>
48818 </section>
48819 <section id="SECTauthparamail">
48820 <title>The AUTH parameter on MAIL commands</title>
48821 <para>
48822 <indexterm role="concept">
48823 <primary>authentication</primary>
48824 <secondary>sender; authenticated</secondary>
48825 </indexterm>
48826 <indexterm role="concept">
48827 <primary>AUTH</primary>
48828 <secondary>on MAIL command</secondary>
48829 </indexterm>
48830 When a client supplied an AUTH= item on a MAIL command, Exim applies
48831 the following checks before accepting it as the authenticated sender of the
48832 message:
48833 </para>
48834 <itemizedlist>
48835 <listitem>
48836 <para>
48837 If the connection is not using extended SMTP (that is, HELO was used rather
48838 than EHLO), the use of AUTH= is a syntax error.
48839 </para>
48840 </listitem>
48841 <listitem>
48842 <para>
48843 If the value of the AUTH= parameter is <quote>&lt;&gt;</quote>, it is ignored.
48844 </para>
48845 </listitem>
48846 <listitem>
48847 <para>
48848 <indexterm role="variable">
48849 <primary><varname>$authenticated_sender</varname></primary>
48850 </indexterm>
48851 If <option>acl_smtp_mailauth</option> is defined, the ACL it specifies is run. While it is
48852 running, the value of <varname>$authenticated_sender</varname> is set to the value obtained
48853 from the AUTH= parameter. If the ACL does not yield <quote>accept</quote>, the value of
48854 <varname>$authenticated_sender</varname> is deleted. The <option>acl_smtp_mailauth</option> ACL may not
48855 return <quote>drop</quote> or <quote>discard</quote>. If it defers, a temporary error code (451) is
48856 given for the MAIL command.
48857 </para>
48858 </listitem>
48859 <listitem>
48860 <para>
48861 If <option>acl_smtp_mailauth</option> is not defined, the value of the AUTH= parameter
48862 is accepted and placed in <varname>$authenticated_sender</varname> only if the client has
48863 authenticated.
48864 </para>
48865 </listitem>
48866 <listitem>
48867 <para>
48868 If the AUTH= value was accepted by either of the two previous rules, and
48869 the client has authenticated, and the authenticator has a setting for the
48870 <option>server_mail_auth_condition</option>, the condition is checked at this point. The
48871 valued that was saved from the authenticator is expanded. If the expansion
48872 fails, or yields an empty string, <quote>0</quote>, <quote>no</quote>, or <quote>false</quote>, the value of
48873 <varname>$authenticated_sender</varname> is deleted. If the expansion yields any other value,
48874 the value of <varname>$authenticated_sender</varname> is retained and passed on with the
48875 message.
48876 </para>
48877 </listitem>
48878 </itemizedlist>
48879 <para>
48880 When <varname>$authenticated_sender</varname> is set for a message, it is passed on to other
48881 hosts to which Exim authenticates as a client. Do not confuse this value with
48882 <varname>$authenticated_id</varname>, which is a string obtained from the authentication
48883 process, and which is not usually a complete email address.
48884 </para>
48885 <para>
48886 <indexterm role="variable">
48887 <primary><varname>$sender_address</varname></primary>
48888 </indexterm>
48889 Whenever an AUTH= value is ignored, the incident is logged. The ACL for
48890 MAIL, if defined, is run after AUTH= is accepted or ignored. It can
48891 therefore make use of <varname>$authenticated_sender</varname>. The converse is not true: the
48892 value of <varname>$sender_address</varname> is not yet set up when the <option>acl_smtp_mailauth</option>
48893 ACL is run.
48894 </para>
48895 </section>
48896 <section id="SECTauthexiser">
48897 <title>Authentication on an Exim server</title>
48898 <para>
48899 <indexterm role="concept">
48900 <primary>authentication</primary>
48901 <secondary>on an Exim server</secondary>
48902 </indexterm>
48903 When Exim receives an EHLO command, it advertises the public names of those
48904 authenticators that are configured as servers, subject to the following
48905 conditions:
48906 </para>
48907 <itemizedlist>
48908 <listitem>
48909 <para>
48910 The client host must match <option>auth_advertise_hosts</option> (default *).
48911 </para>
48912 </listitem>
48913 <listitem>
48914 <para>
48915 It the <option>server_advertise_condition</option> option is set, its expansion must not
48916 yield the empty string, <quote>0</quote>, <quote>no</quote>, or <quote>false</quote>.
48917 </para>
48918 </listitem>
48919 </itemizedlist>
48920 <para>
48921 The order in which the authenticators are defined controls the order in which
48922 the mechanisms are advertised.
48923 </para>
48924 <para>
48925 Some mail clients (for example, some versions of Netscape) require the user to
48926 provide a name and password for authentication whenever AUTH is advertised,
48927 even though authentication may not in fact be needed (for example, Exim may be
48928 set up to allow unconditional relaying from the client by an IP address check).
48929 You can make such clients more friendly by not advertising AUTH to them.
48930 For example, if clients on the 10.9.8.0/24 network are permitted (by the ACL
48931 that runs for RCPT) to relay without authentication, you should set
48932 </para>
48933 <literallayout class="monospaced">
48934 auth_advertise_hosts = ! 10.9.8.0/24
48935 </literallayout>
48936 <para>
48937 so that no authentication mechanisms are advertised to them.
48938 </para>
48939 <para>
48940 The <option>server_advertise_condition</option> controls the advertisement of individual
48941 authentication mechanisms. For example, it can be used to restrict the
48942 advertisement of a particular mechanism to encrypted connections, by a setting
48943 such as:
48944 </para>
48945 <literallayout class="monospaced">
48946 server_advertise_condition = ${if eq{$tls_in_cipher}{}{no}{yes}}
48947 </literallayout>
48948 <para>
48949 <indexterm role="variable">
48950 <primary><varname>$tls_in_cipher</varname></primary>
48951 </indexterm>
48952 If the session is encrypted, <varname>$tls_in_cipher</varname> is not empty, and so the expansion
48953 yields <quote>yes</quote>, which allows the advertisement to happen.
48954 </para>
48955 <para>
48956 When an Exim server receives an AUTH command from a client, it rejects it
48957 immediately if AUTH was not advertised in response to an earlier EHLO
48958 command. This is the case if
48959 </para>
48960 <itemizedlist>
48961 <listitem>
48962 <para>
48963 The client host does not match <option>auth_advertise_hosts</option>; or
48964 </para>
48965 </listitem>
48966 <listitem>
48967 <para>
48968 No authenticators are configured with server options; or
48969 </para>
48970 </listitem>
48971 <listitem>
48972 <para>
48973 Expansion of <option>server_advertise_condition</option> blocked the advertising of all the
48974 server authenticators.
48975 </para>
48976 </listitem>
48977 </itemizedlist>
48978 <para>
48979 Otherwise, Exim runs the ACL specified by <option>acl_smtp_auth</option> in order
48980 to decide whether to accept the command. If <option>acl_smtp_auth</option> is not set,
48981 AUTH is accepted from any client host.
48982 </para>
48983 <para>
48984 If AUTH is not rejected by the ACL, Exim searches its configuration for a
48985 server authentication mechanism that was advertised in response to EHLO and
48986 that matches the one named in the AUTH command. If it finds one, it runs
48987 the appropriate authentication protocol, and authentication either succeeds or
48988 fails. If there is no matching advertised mechanism, the AUTH command is
48989 rejected with a 504 error.
48990 </para>
48991 <para>
48992 <indexterm role="variable">
48993 <primary><varname>$received_protocol</varname></primary>
48994 </indexterm>
48995 <indexterm role="variable">
48996 <primary><varname>$sender_host_authenticated</varname></primary>
48997 </indexterm>
48998 When a message is received from an authenticated host, the value of
48999 <varname>$received_protocol</varname> is set to <quote>esmtpa</quote> or <quote>esmtpsa</quote> instead of <quote>esmtp</quote>
49000 or <quote>esmtps</quote>, and <varname>$sender_host_authenticated</varname> contains the name (not the
49001 public name) of the authenticator driver that successfully authenticated the
49002 client from which the message was received. This variable is empty if there was
49003 no successful authentication.
49004 </para>
49005 </section>
49006 <section id="SECID169">
49007 <title>Testing server authentication</title>
49008 <para>
49009 <indexterm role="concept">
49010 <primary>authentication</primary>
49011 <secondary>testing a server</secondary>
49012 </indexterm>
49013 <indexterm role="concept">
49014 <primary>AUTH</primary>
49015 <secondary>testing a server</secondary>
49016 </indexterm>
49017 <indexterm role="concept">
49018 <primary>base64 encoding</primary>
49019 <secondary>creating authentication test data</secondary>
49020 </indexterm>
49021 Exim&#x2019;s <option>-bh</option> option can be useful for testing server authentication
49022 configurations. The data for the AUTH command has to be sent using base64
49023 encoding. A quick way to produce such data for testing is the following Perl
49024 script:
49025 </para>
49026 <literallayout class="monospaced">
49027 use MIME::Base64;
49028 printf ("%s", encode_base64(eval "\"$ARGV[0]\""));
49029 </literallayout>
49030 <para>
49031 <indexterm role="concept">
49032 <primary>binary zero</primary>
49033 <secondary>in authentication data</secondary>
49034 </indexterm>
49035 This interprets its argument as a Perl string, and then encodes it. The
49036 interpretation as a Perl string allows binary zeros, which are required for
49037 some kinds of authentication, to be included in the data. For example, a
49038 command line to run this script on such data might be
49039 </para>
49040 <literallayout class="monospaced">
49041 encode '\0user\0password'
49042 </literallayout>
49043 <para>
49044 Note the use of single quotes to prevent the shell interpreting the
49045 backslashes, so that they can be interpreted by Perl to specify characters
49046 whose code value is zero.
49047 </para>
49048 <para>
49049 <emphasis role="bold">Warning 1</emphasis>: If either of the user or password strings starts with an octal
49050 digit, you must use three zeros instead of one after the leading backslash. If
49051 you do not, the octal digit that starts your string will be incorrectly
49052 interpreted as part of the code for the first character.
49053 </para>
49054 <para>
49055 <emphasis role="bold">Warning 2</emphasis>: If there are characters in the strings that Perl interprets
49056 specially, you must use a Perl escape to prevent them being misinterpreted. For
49057 example, a command such as
49058 </para>
49059 <literallayout class="monospaced">
49060 encode '\0user@domain.com\0pas$$word'
49061 </literallayout>
49062 <para>
49063 gives an incorrect answer because of the unescaped <quote>@</quote> and <quote>$</quote> characters.
49064 </para>
49065 <para>
49066 If you have the <option>mimencode</option> command installed, another way to do produce
49067 base64-encoded strings is to run the command
49068 </para>
49069 <literallayout class="monospaced">
49070 echo -e -n `\0user\0password' | mimencode
49071 </literallayout>
49072 <para>
49073 The <option>-e</option> option of <option>echo</option> enables the interpretation of backslash escapes
49074 in the argument, and the <option>-n</option> option specifies no newline at the end of its
49075 output. However, not all versions of <option>echo</option> recognize these options, so you
49076 should check your version before relying on this suggestion.
49077 </para>
49078 </section>
49079 <section id="SECID170">
49080 <title>Authentication by an Exim client</title>
49081 <para>
49082 <indexterm role="concept">
49083 <primary>authentication</primary>
49084 <secondary>on an Exim client</secondary>
49085 </indexterm>
49086 The <command>smtp</command> transport has two options called <option>hosts_require_auth</option> and
49087 <option>hosts_try_auth</option>. When the <command>smtp</command> transport connects to a server that
49088 announces support for authentication, and the host matches an entry in either
49089 of these options, Exim (as a client) tries to authenticate as follows:
49090 </para>
49091 <itemizedlist>
49092 <listitem>
49093 <para>
49094 For each authenticator that is configured as a client, in the order in which
49095 they are defined in the configuration, it searches the authentication
49096 mechanisms announced by the server for one whose name matches the public name
49097 of the authenticator.
49098 </para>
49099 </listitem>
49100 <listitem>
49101 <para>
49102 <indexterm role="variable">
49103 <primary><varname>$host</varname></primary>
49104 </indexterm>
49105 <indexterm role="variable">
49106 <primary><varname>$host_address</varname></primary>
49107 </indexterm>
49108 When it finds one that matches, it runs the authenticator&#x2019;s client code. The
49109 variables <varname>$host</varname> and <varname>$host_address</varname> are available for any string expansions
49110 that the client might do. They are set to the server&#x2019;s name and IP address. If
49111 any expansion is forced to fail, the authentication attempt is abandoned, and
49112 Exim moves on to the next authenticator. Otherwise an expansion failure causes
49113 delivery to be deferred.
49114 </para>
49115 </listitem>
49116 <listitem>
49117 <para>
49118 If the result of the authentication attempt is a temporary error or a timeout,
49119 Exim abandons trying to send the message to the host for the moment. It will
49120 try again later. If there are any backup hosts available, they are tried in the
49121 usual way.
49122 </para>
49123 </listitem>
49124 <listitem>
49125 <para>
49126 If the response to authentication is a permanent error (5<emphasis>xx</emphasis> code), Exim
49127 carries on searching the list of authenticators and tries another one if
49128 possible. If all authentication attempts give permanent errors, or if there are
49129 no attempts because no mechanisms match (or option expansions force failure),
49130 what happens depends on whether the host matches <option>hosts_require_auth</option> or
49131 <option>hosts_try_auth</option>. In the first case, a temporary error is generated, and
49132 delivery is deferred. The error can be detected in the retry rules, and thereby
49133 turned into a permanent error if you wish. In the second case, Exim tries to
49134 deliver the message unauthenticated.
49135 </para>
49136 </listitem>
49137 </itemizedlist>
49138 <para>
49139 <indexterm role="concept">
49140 <primary>AUTH</primary>
49141 <secondary>on MAIL command</secondary>
49142 </indexterm>
49143 When Exim has authenticated itself to a remote server, it adds the AUTH
49144 parameter to the MAIL commands it sends, if it has an authenticated sender for
49145 the message. If the message came from a remote host, the authenticated sender
49146 is the one that was receiving on an incoming MAIL command, provided that the
49147 incoming connection was authenticated and the <option>server_mail_auth</option> condition
49148 allowed the authenticated sender to be retained. If a local process calls Exim
49149 to send a message, the sender address that is built from the login name and
49150 <option>qualify_domain</option> is treated as authenticated. However, if the
49151 <option>authenticated_sender</option> option is set on the <command>smtp</command> transport, it overrides
49152 the authenticated sender that was received with the message.
49153 <indexterm role="concept" startref="IIDauthconf1" class="endofrange"/>
49154 <indexterm role="concept" startref="IIDauthconf2" class="endofrange"/>
49155 </para>
49156 </section>
49157 </chapter>
49158
49159 <chapter id="CHAPplaintext">
49160 <title>The plaintext authenticator</title>
49161 <para>
49162 <indexterm role="concept" id="IIDplaiauth1" class="startofrange">
49163 <primary><command>plaintext</command> authenticator</primary>
49164 </indexterm>
49165 <indexterm role="concept" id="IIDplaiauth2" class="startofrange">
49166 <primary>authenticators</primary>
49167 <secondary><command>plaintext</command></secondary>
49168 </indexterm>
49169 The <command>plaintext</command> authenticator can be configured to support the PLAIN and
49170 LOGIN authentication mechanisms, both of which transfer authentication data as
49171 plain (unencrypted) text (though base64 encoded). The use of plain text is a
49172 security risk; you are strongly advised to insist on the use of SMTP encryption
49173 (see chapter <xref linkend="CHAPTLS"/>) if you use the PLAIN or LOGIN mechanisms. If you do
49174 use unencrypted plain text, you should not use the same passwords for SMTP
49175 connections as you do for login accounts.
49176 </para>
49177 <section id="SECID171">
49178 <title>Plaintext options</title>
49179 <para>
49180 <indexterm role="concept">
49181 <primary>options</primary>
49182 <secondary><command>plaintext</command> authenticator (server)</secondary>
49183 </indexterm>
49184 When configured as a server, <command>plaintext</command> uses the following options:
49185 </para>
49186 <para>
49187 <indexterm role="option">
49188 <primary><option>server_condition</option></primary>
49189 </indexterm>
49190 </para>
49191 <informaltable frame="all">
49192 <tgroup cols="4" colsep="0" rowsep="0">
49193 <colspec colwidth="8*" align="left"/>
49194 <colspec colwidth="6*" align="center"/>
49195 <colspec colwidth="6*" align="center"/>
49196 <colspec colwidth="6*" align="right"/>
49197 <tbody>
49198 <row>
49199 <entry><option>server_condition</option></entry>
49200 <entry>Use: <emphasis>authenticators</emphasis></entry>
49201 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
49202 <entry>Default: <emphasis>unset</emphasis></entry>
49203 </row>
49204 </tbody>
49205 </tgroup>
49206 </informaltable>
49207 <para>
49208 This is actually a global authentication option, but it must be set in order to
49209 configure the <command>plaintext</command> driver as a server. Its use is described below.
49210 </para>
49211 <para>
49212 <indexterm role="option">
49213 <primary><option>server_prompts</option></primary>
49214 </indexterm>
49215 </para>
49216 <informaltable frame="all">
49217 <tgroup cols="4" colsep="0" rowsep="0">
49218 <colspec colwidth="8*" align="left"/>
49219 <colspec colwidth="6*" align="center"/>
49220 <colspec colwidth="6*" align="center"/>
49221 <colspec colwidth="6*" align="right"/>
49222 <tbody>
49223 <row>
49224 <entry><option>server_prompts</option></entry>
49225 <entry>Use: <emphasis>plaintext</emphasis></entry>
49226 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
49227 <entry>Default: <emphasis>unset</emphasis></entry>
49228 </row>
49229 </tbody>
49230 </tgroup>
49231 </informaltable>
49232 <para>
49233 The contents of this option, after expansion, must be a colon-separated list of
49234 prompt strings. If expansion fails, a temporary authentication rejection is
49235 given.
49236 </para>
49237 </section>
49238 <section id="SECTplainserver">
49239 <title>Using plaintext in a server</title>
49240 <para>
49241 <indexterm role="concept">
49242 <primary>AUTH</primary>
49243 <secondary>in <command>plaintext</command> authenticator</secondary>
49244 </indexterm>
49245 <indexterm role="concept">
49246 <primary>binary zero</primary>
49247 <secondary>in <command>plaintext</command> authenticator</secondary>
49248 </indexterm>
49249 <indexterm role="concept">
49250 <primary>numerical variables (<varname>$1</varname> <varname>$2</varname> etc)</primary>
49251 <secondary>in <command>plaintext</command> authenticator</secondary>
49252 </indexterm>
49253 <indexterm role="variable">
49254 <primary><varname>$auth1</varname>, <varname>$auth2</varname>, etc</primary>
49255 </indexterm>
49256 <indexterm role="concept">
49257 <primary>base64 encoding</primary>
49258 <secondary>in <command>plaintext</command> authenticator</secondary>
49259 </indexterm>
49260 </para>
49261 <para>
49262 When running as a server, <command>plaintext</command> performs the authentication test by
49263 expanding a string. The data sent by the client with the AUTH command, or in
49264 response to subsequent prompts, is base64 encoded, and so may contain any byte
49265 values when decoded. If any data is supplied with the command, it is treated as
49266 a list of strings, separated by NULs (binary zeros), the first three of which
49267 are placed in the expansion variables <varname>$auth1</varname>, <varname>$auth2</varname>, and <varname>$auth3</varname>
49268 (neither LOGIN nor PLAIN uses more than three strings).
49269 </para>
49270 <para>
49271 For compatibility with previous releases of Exim, the values are also placed in
49272 the expansion variables <varname>$1</varname>, <varname>$2</varname>, and <varname>$3</varname>. However, the use of these
49273 variables for this purpose is now deprecated, as it can lead to confusion in
49274 string expansions that also use them for other things.
49275 </para>
49276 <para>
49277 If there are more strings in <option>server_prompts</option> than the number of strings
49278 supplied with the AUTH command, the remaining prompts are used to obtain more
49279 data. Each response from the client may be a list of NUL-separated strings.
49280 </para>
49281 <para>
49282 <indexterm role="variable">
49283 <primary><varname>$authenticated_id</varname></primary>
49284 </indexterm>
49285 Once a sufficient number of data strings have been received,
49286 <option>server_condition</option> is expanded. If the expansion is forced to fail,
49287 authentication fails. Any other expansion failure causes a temporary error code
49288 to be returned. If the result of a successful expansion is an empty string,
49289 <quote>0</quote>, <quote>no</quote>, or <quote>false</quote>, authentication fails. If the result of the
49290 expansion is <quote>1</quote>, <quote>yes</quote>, or <quote>true</quote>, authentication succeeds and the
49291 generic <option>server_set_id</option> option is expanded and saved in <varname>$authenticated_id</varname>.
49292 For any other result, a temporary error code is returned, with the expanded
49293 string as the error text
49294 </para>
49295 <para>
49296 <emphasis role="bold">Warning</emphasis>: If you use a lookup in the expansion to find the user&#x2019;s
49297 password, be sure to make the authentication fail if the user is unknown.
49298 There are good and bad examples at the end of the next section.
49299 </para>
49300 </section>
49301 <section id="SECID172">
49302 <title>The PLAIN authentication mechanism</title>
49303 <para>
49304 <indexterm role="concept">
49305 <primary>PLAIN authentication mechanism</primary>
49306 </indexterm>
49307 <indexterm role="concept">
49308 <primary>authentication</primary>
49309 <secondary>PLAIN mechanism</secondary>
49310 </indexterm>
49311 <indexterm role="concept">
49312 <primary>binary zero</primary>
49313 <secondary>in <command>plaintext</command> authenticator</secondary>
49314 </indexterm>
49315 The PLAIN authentication mechanism (RFC 2595) specifies that three strings be
49316 sent as one item of data (that is, one combined string containing two NUL
49317 separators). The data is sent either as part of the AUTH command, or
49318 subsequently in response to an empty prompt from the server.
49319 </para>
49320 <para>
49321 The second and third strings are a user name and a corresponding password.
49322 Using a single fixed user name and password as an example, this could be
49323 configured as follows:
49324 </para>
49325 <literallayout class="monospaced">
49326 fixed_plain:
49327   driver = plaintext
49328   public_name = PLAIN
49329   server_prompts = :
49330   server_condition = \
49331     ${if and {{eq{$auth2}{username}}{eq{$auth3}{mysecret}}}}
49332   server_set_id = $auth2
49333 </literallayout>
49334 <para>
49335 Note that the default result strings from <option>if</option> (<quote>true</quote> or an empty string)
49336 are exactly what we want here, so they need not be specified. Obviously, if the
49337 password contains expansion-significant characters such as dollar, backslash,
49338 or closing brace, they have to be escaped.
49339 </para>
49340 <para>
49341 The <option>server_prompts</option> setting specifies a single, empty prompt (empty items at
49342 the end of a string list are ignored). If all the data comes as part of the
49343 AUTH command, as is commonly the case, the prompt is not used. This
49344 authenticator is advertised in the response to EHLO as
49345 </para>
49346 <literallayout class="monospaced">
49347 250-AUTH PLAIN
49348 </literallayout>
49349 <para>
49350 and a client host can authenticate itself by sending the command
49351 </para>
49352 <literallayout class="monospaced">
49353 AUTH PLAIN AHVzZXJuYW1lAG15c2VjcmV0
49354 </literallayout>
49355 <para>
49356 As this contains three strings (more than the number of prompts), no further
49357 data is required from the client. Alternatively, the client may just send
49358 </para>
49359 <literallayout class="monospaced">
49360 AUTH PLAIN
49361 </literallayout>
49362 <para>
49363 to initiate authentication, in which case the server replies with an empty
49364 prompt. The client must respond with the combined data string.
49365 </para>
49366 <para>
49367 The data string is base64 encoded, as required by the RFC. This example,
49368 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;
49369 represents a zero byte. This is split up into three strings, the first of which
49370 is empty. The <option>server_condition</option> option in the authenticator checks that the
49371 second two are <literal>username</literal> and <literal>mysecret</literal> respectively.
49372 </para>
49373 <para>
49374 Having just one fixed user name and password, as in this example, is not very
49375 realistic, though for a small organization with only a handful of
49376 authenticating clients it could make sense.
49377 </para>
49378 <para>
49379 A more sophisticated instance of this authenticator could use the user name in
49380 <varname>$auth2</varname> to look up a password in a file or database, and maybe do an encrypted
49381 comparison (see <option>crypteq</option> in chapter <xref linkend="CHAPexpand"/>). Here is a example of
49382 this approach, where the passwords are looked up in a DBM file. <emphasis role="bold">Warning</emphasis>:
49383 This is an incorrect example:
49384 </para>
49385 <literallayout class="monospaced">
49386 server_condition = \
49387   ${if eq{$auth3}{${lookup{$auth2}dbm{/etc/authpwd}}}}
49388 </literallayout>
49389 <para>
49390 The expansion uses the user name (<varname>$auth2</varname>) as the key to look up a password,
49391 which it then compares to the supplied password (<varname>$auth3</varname>). Why is this example
49392 incorrect? It works fine for existing users, but consider what happens if a
49393 non-existent user name is given. The lookup fails, but as no success/failure
49394 strings are given for the lookup, it yields an empty string. Thus, to defeat
49395 the authentication, all a client has to do is to supply a non-existent user
49396 name and an empty password. The correct way of writing this test is:
49397 </para>
49398 <literallayout class="monospaced">
49399 server_condition = ${lookup{$auth2}dbm{/etc/authpwd}\
49400   {${if eq{$value}{$auth3}}} {false}}
49401 </literallayout>
49402 <para>
49403 In this case, if the lookup succeeds, the result is checked; if the lookup
49404 fails, <quote>false</quote> is returned and authentication fails. If <option>crypteq</option> is being
49405 used instead of <option>eq</option>, the first example is in fact safe, because <option>crypteq</option>
49406 always fails if its second argument is empty. However, the second way of
49407 writing the test makes the logic clearer.
49408 </para>
49409 </section>
49410 <section id="SECID173">
49411 <title>The LOGIN authentication mechanism</title>
49412 <para>
49413 <indexterm role="concept">
49414 <primary>LOGIN authentication mechanism</primary>
49415 </indexterm>
49416 <indexterm role="concept">
49417 <primary>authentication</primary>
49418 <secondary>LOGIN mechanism</secondary>
49419 </indexterm>
49420 The LOGIN authentication mechanism is not documented in any RFC, but is in use
49421 in a number of programs. No data is sent with the AUTH command. Instead, a
49422 user name and password are supplied separately, in response to prompts. The
49423 plaintext authenticator can be configured to support this as in this example:
49424 </para>
49425 <literallayout class="monospaced">
49426 fixed_login:
49427   driver = plaintext
49428   public_name = LOGIN
49429   server_prompts = User Name : Password
49430   server_condition = \
49431     ${if and {{eq{$auth1}{username}}{eq{$auth2}{mysecret}}}}
49432   server_set_id = $auth1
49433 </literallayout>
49434 <para>
49435 Because of the way plaintext operates, this authenticator accepts data supplied
49436 with the AUTH command (in contravention of the specification of LOGIN), but
49437 if the client does not supply it (as is the case for LOGIN clients), the prompt
49438 strings are used to obtain two data items.
49439 </para>
49440 <para>
49441 Some clients are very particular about the precise text of the prompts. For
49442 example, Outlook Express is reported to recognize only <quote>Username:</quote> and
49443 <quote>Password:</quote>. Here is an example of a LOGIN authenticator that uses those
49444 strings. It uses the <option>ldapauth</option> expansion condition to check the user
49445 name and password by binding to an LDAP server:
49446 </para>
49447 <literallayout class="monospaced">
49448 login:
49449   driver = plaintext
49450   public_name = LOGIN
49451   server_prompts = Username:: : Password::
49452   server_condition = ${if and{{ \
49453     !eq{}{$auth1} }{ \
49454     ldapauth{\
49455       user="uid=${quote_ldap_dn:$auth1},ou=people,o=example.org" \
49456       pass=${quote:$auth2} \
49457       ldap://ldap.example.org/} }} }
49458   server_set_id = uid=$auth1,ou=people,o=example.org
49459 </literallayout>
49460 <para>
49461 We have to check that the username is not empty before using it, because LDAP
49462 does not permit empty DN components. We must also use the <option>quote_ldap_dn</option>
49463 operator to correctly quote the DN for authentication. However, the basic
49464 <option>quote</option> operator, rather than any of the LDAP quoting operators, is the
49465 correct one to use for the password, because quoting is needed only to make
49466 the password conform to the Exim syntax. At the LDAP level, the password is an
49467 uninterpreted string.
49468 </para>
49469 </section>
49470 <section id="SECID174">
49471 <title>Support for different kinds of authentication</title>
49472 <para>
49473 A number of string expansion features are provided for the purpose of
49474 interfacing to different ways of user authentication. These include checking
49475 traditionally encrypted passwords from <filename>/etc/passwd</filename> (or equivalent), PAM,
49476 Radius, <option>ldapauth</option>, <emphasis>pwcheck</emphasis>, and <emphasis>saslauthd</emphasis>. For details see section
49477 <xref linkend="SECTexpcond"/>.
49478 </para>
49479 </section>
49480 <section id="SECID175">
49481 <title>Using plaintext in a client</title>
49482 <para>
49483 <indexterm role="concept">
49484 <primary>options</primary>
49485 <secondary><command>plaintext</command> authenticator (client)</secondary>
49486 </indexterm>
49487 The <command>plaintext</command> authenticator has two client options:
49488 </para>
49489 <para>
49490 <indexterm role="option">
49491 <primary><option>client_ignore_invalid_base64</option></primary>
49492 </indexterm>
49493 </para>
49494 <informaltable frame="all">
49495 <tgroup cols="4" colsep="0" rowsep="0">
49496 <colspec colwidth="8*" align="left"/>
49497 <colspec colwidth="6*" align="center"/>
49498 <colspec colwidth="6*" align="center"/>
49499 <colspec colwidth="6*" align="right"/>
49500 <tbody>
49501 <row>
49502 <entry><option>client_ignore_invalid_base64</option></entry>
49503 <entry>Use: <emphasis>plaintext</emphasis></entry>
49504 <entry>Type: <emphasis>boolean</emphasis></entry>
49505 <entry>Default: <emphasis>false</emphasis></entry>
49506 </row>
49507 </tbody>
49508 </tgroup>
49509 </informaltable>
49510 <para>
49511 If the client receives a server prompt that is not a valid base64 string,
49512 authentication is abandoned by default. However, if this option is set true,
49513 the error in the challenge is ignored and the client sends the response as
49514 usual.
49515 </para>
49516 <para>
49517 <indexterm role="option">
49518 <primary><option>client_send</option></primary>
49519 </indexterm>
49520 </para>
49521 <informaltable frame="all">
49522 <tgroup cols="4" colsep="0" rowsep="0">
49523 <colspec colwidth="8*" align="left"/>
49524 <colspec colwidth="6*" align="center"/>
49525 <colspec colwidth="6*" align="center"/>
49526 <colspec colwidth="6*" align="right"/>
49527 <tbody>
49528 <row>
49529 <entry><option>client_send</option></entry>
49530 <entry>Use: <emphasis>plaintext</emphasis></entry>
49531 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
49532 <entry>Default: <emphasis>unset</emphasis></entry>
49533 </row>
49534 </tbody>
49535 </tgroup>
49536 </informaltable>
49537 <para>
49538 The string is a colon-separated list of authentication data strings. Each
49539 string is independently expanded before being sent to the server. The first
49540 string is sent with the AUTH command; any more strings are sent in response
49541 to prompts from the server. Before each string is expanded, the value of the
49542 most recent prompt is placed in the next <varname>$auth</varname>&lt;<emphasis>n</emphasis>&gt; variable, starting
49543 with <varname>$auth1</varname> for the first prompt. Up to three prompts are stored in this
49544 way. Thus, the prompt that is received in response to sending the first string
49545 (with the AUTH command) can be used in the expansion of the second string, and
49546 so on. If an invalid base64 string is received when
49547 <option>client_ignore_invalid_base64</option> is set, an empty string is put in the
49548 <varname>$auth</varname>&lt;<emphasis>n</emphasis>&gt; variable.
49549 </para>
49550 <para>
49551 <emphasis role="bold">Note</emphasis>: You cannot use expansion to create multiple strings, because
49552 splitting takes priority and happens first.
49553 </para>
49554 <para>
49555 Because the PLAIN authentication mechanism requires NUL (binary zero) bytes in
49556 the data, further processing is applied to each string before it is sent. If
49557 there are any single circumflex characters in the string, they are converted to
49558 NULs. Should an actual circumflex be required as data, it must be doubled in
49559 the string.
49560 </para>
49561 <para>
49562 This is an example of a client configuration that implements the PLAIN
49563 authentication mechanism with a fixed user name and password:
49564 </para>
49565 <literallayout class="monospaced">
49566 fixed_plain:
49567   driver = plaintext
49568   public_name = PLAIN
49569   client_send = ^username^mysecret
49570 </literallayout>
49571 <para>
49572 The lack of colons means that the entire text is sent with the AUTH
49573 command, with the circumflex characters converted to NULs. A similar example
49574 that uses the LOGIN mechanism is:
49575 </para>
49576 <literallayout class="monospaced">
49577 fixed_login:
49578   driver = plaintext
49579   public_name = LOGIN
49580   client_send = : username : mysecret
49581 </literallayout>
49582 <para>
49583 The initial colon means that the first string is empty, so no data is sent with
49584 the AUTH command itself. The remaining strings are sent in response to
49585 prompts.
49586 <indexterm role="concept" startref="IIDplaiauth1" class="endofrange"/>
49587 <indexterm role="concept" startref="IIDplaiauth2" class="endofrange"/>
49588 </para>
49589 </section>
49590 </chapter>
49591
49592 <chapter id="CHID9">
49593 <title>The cram_md5 authenticator</title>
49594 <para>
49595 <indexterm role="concept" id="IIDcramauth1" class="startofrange">
49596 <primary><command>cram_md5</command> authenticator</primary>
49597 </indexterm>
49598 <indexterm role="concept" id="IIDcramauth2" class="startofrange">
49599 <primary>authenticators</primary>
49600 <secondary><command>cram_md5</command></secondary>
49601 </indexterm>
49602 <indexterm role="concept">
49603 <primary>CRAM-MD5 authentication mechanism</primary>
49604 </indexterm>
49605 <indexterm role="concept">
49606 <primary>authentication</primary>
49607 <secondary>CRAM-MD5 mechanism</secondary>
49608 </indexterm>
49609 The CRAM-MD5 authentication mechanism is described in RFC 2195. The server
49610 sends a challenge string to the client, and the response consists of a user
49611 name and the CRAM-MD5 digest of the challenge string combined with a secret
49612 string (password) which is known to both server and client. Thus, the secret
49613 is not sent over the network as plain text, which makes this authenticator more
49614 secure than <command>plaintext</command>. However, the downside is that the secret has to be
49615 available in plain text at either end.
49616 </para>
49617 <section id="SECID176">
49618 <title>Using cram_md5 as a server</title>
49619 <para>
49620 <indexterm role="concept">
49621 <primary>options</primary>
49622 <secondary><command>cram_md5</command> authenticator (server)</secondary>
49623 </indexterm>
49624 This authenticator has one server option, which must be set to configure the
49625 authenticator as a server:
49626 </para>
49627 <para>
49628 <indexterm role="option">
49629 <primary><option>server_secret</option></primary>
49630 </indexterm>
49631 </para>
49632 <informaltable frame="all">
49633 <tgroup cols="4" colsep="0" rowsep="0">
49634 <colspec colwidth="8*" align="left"/>
49635 <colspec colwidth="6*" align="center"/>
49636 <colspec colwidth="6*" align="center"/>
49637 <colspec colwidth="6*" align="right"/>
49638 <tbody>
49639 <row>
49640 <entry><option>server_secret</option></entry>
49641 <entry>Use: <emphasis>cram_md5</emphasis></entry>
49642 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
49643 <entry>Default: <emphasis>unset</emphasis></entry>
49644 </row>
49645 </tbody>
49646 </tgroup>
49647 </informaltable>
49648 <para>
49649 <indexterm role="concept">
49650 <primary>numerical variables (<varname>$1</varname> <varname>$2</varname> etc)</primary>
49651 <secondary>in <command>cram_md5</command> authenticator</secondary>
49652 </indexterm>
49653 When the server receives the client&#x2019;s response, the user name is placed in
49654 the expansion variable <varname>$auth1</varname>, and <option>server_secret</option> is expanded to
49655 obtain the password for that user. The server then computes the CRAM-MD5 digest
49656 that the client should have sent, and checks that it received the correct
49657 string. If the expansion of <option>server_secret</option> is forced to fail, authentication
49658 fails. If the expansion fails for some other reason, a temporary error code is
49659 returned to the client.
49660 </para>
49661 <para>
49662 For compatibility with previous releases of Exim, the user name is also placed
49663 in <varname>$1</varname>. However, the use of this variables for this purpose is now
49664 deprecated, as it can lead to confusion in string expansions that also use
49665 numeric variables for other things.
49666 </para>
49667 <para>
49668 For example, the following authenticator checks that the user name given by the
49669 client is <quote>ph10</quote>, and if so, uses <quote>secret</quote> as the password. For any other
49670 user name, authentication fails.
49671 </para>
49672 <literallayout class="monospaced">
49673 fixed_cram:
49674   driver = cram_md5
49675   public_name = CRAM-MD5
49676   server_secret = ${if eq{$auth1}{ph10}{secret}fail}
49677   server_set_id = $auth1
49678 </literallayout>
49679 <para>
49680 <indexterm role="variable">
49681 <primary><varname>$authenticated_id</varname></primary>
49682 </indexterm>
49683 If authentication succeeds, the setting of <option>server_set_id</option> preserves the user
49684 name in <varname>$authenticated_id</varname>. A more typical configuration might look up the
49685 secret string in a file, using the user name as the key. For example:
49686 </para>
49687 <literallayout class="monospaced">
49688 lookup_cram:
49689   driver = cram_md5
49690   public_name = CRAM-MD5
49691   server_secret = ${lookup{$auth1}lsearch{/etc/authpwd}\
49692                   {$value}fail}
49693   server_set_id = $auth1
49694 </literallayout>
49695 <para>
49696 Note that this expansion explicitly forces failure if the lookup fails
49697 because <varname>$auth1</varname> contains an unknown user name.
49698 </para>
49699 <para>
49700 As another example, if you wish to re-use a Cyrus SASL sasldb2 file without
49701 using the relevant libraries, you need to know the realm to specify in the
49702 lookup and then ask for the <quote>userPassword</quote> attribute for that user in that
49703 realm, with:
49704 </para>
49705 <literallayout class="monospaced">
49706 cyrusless_crammd5:
49707   driver = cram_md5
49708   public_name = CRAM-MD5
49709   server_secret = ${lookup{$auth1:mail.example.org:userPassword}\
49710                   dbmjz{/etc/sasldb2}{$value}fail}
49711   server_set_id = $auth1
49712 </literallayout>
49713 </section>
49714 <section id="SECID177">
49715 <title>Using cram_md5 as a client</title>
49716 <para>
49717 <indexterm role="concept">
49718 <primary>options</primary>
49719 <secondary><command>cram_md5</command> authenticator (client)</secondary>
49720 </indexterm>
49721 When used as a client, the <command>cram_md5</command> authenticator has two options:
49722 </para>
49723 <para>
49724 <indexterm role="option">
49725 <primary><option>client_name</option></primary>
49726 </indexterm>
49727 </para>
49728 <informaltable frame="all">
49729 <tgroup cols="4" colsep="0" rowsep="0">
49730 <colspec colwidth="8*" align="left"/>
49731 <colspec colwidth="6*" align="center"/>
49732 <colspec colwidth="6*" align="center"/>
49733 <colspec colwidth="6*" align="right"/>
49734 <tbody>
49735 <row>
49736 <entry><option>client_name</option></entry>
49737 <entry>Use: <emphasis>cram_md5</emphasis></entry>
49738 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
49739 <entry>Default: <emphasis>the primary host name</emphasis></entry>
49740 </row>
49741 </tbody>
49742 </tgroup>
49743 </informaltable>
49744 <para>
49745 This string is expanded, and the result used as the user name data when
49746 computing the response to the server&#x2019;s challenge.
49747 </para>
49748 <para>
49749 <indexterm role="option">
49750 <primary><option>client_secret</option></primary>
49751 </indexterm>
49752 </para>
49753 <informaltable frame="all">
49754 <tgroup cols="4" colsep="0" rowsep="0">
49755 <colspec colwidth="8*" align="left"/>
49756 <colspec colwidth="6*" align="center"/>
49757 <colspec colwidth="6*" align="center"/>
49758 <colspec colwidth="6*" align="right"/>
49759 <tbody>
49760 <row>
49761 <entry><option>client_secret</option></entry>
49762 <entry>Use: <emphasis>cram_md5</emphasis></entry>
49763 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
49764 <entry>Default: <emphasis>unset</emphasis></entry>
49765 </row>
49766 </tbody>
49767 </tgroup>
49768 </informaltable>
49769 <para>
49770 This option must be set for the authenticator to work as a client. Its value is
49771 expanded and the result used as the secret string when computing the response.
49772 </para>
49773 <para>
49774 <indexterm role="variable">
49775 <primary><varname>$host</varname></primary>
49776 </indexterm>
49777 <indexterm role="variable">
49778 <primary><varname>$host_address</varname></primary>
49779 </indexterm>
49780 Different user names and secrets can be used for different servers by referring
49781 to <varname>$host</varname> or <varname>$host_address</varname> in the options. Forced failure of either
49782 expansion string is treated as an indication that this authenticator is not
49783 prepared to handle this case. Exim moves on to the next configured client
49784 authenticator. Any other expansion failure causes Exim to give up trying to
49785 send the message to the current server.
49786 </para>
49787 <para>
49788 A simple example configuration of a <command>cram_md5</command> authenticator, using fixed
49789 strings, is:
49790 </para>
49791 <literallayout class="monospaced">
49792 fixed_cram:
49793   driver = cram_md5
49794   public_name = CRAM-MD5
49795   client_name = ph10
49796   client_secret = secret
49797 </literallayout>
49798 <para>
49799 <indexterm role="concept" startref="IIDcramauth1" class="endofrange"/>
49800 <indexterm role="concept" startref="IIDcramauth2" class="endofrange"/>
49801 </para>
49802 </section>
49803 </chapter>
49804
49805 <chapter id="CHID10">
49806 <title>The cyrus_sasl authenticator</title>
49807 <para>
49808 <indexterm role="concept" id="IIDcyrauth1" class="startofrange">
49809 <primary><command>cyrus_sasl</command> authenticator</primary>
49810 </indexterm>
49811 <indexterm role="concept" id="IIDcyrauth2" class="startofrange">
49812 <primary>authenticators</primary>
49813 <secondary><command>cyrus_sasl</command></secondary>
49814 </indexterm>
49815 <indexterm role="concept">
49816 <primary>Cyrus</primary>
49817 <secondary>SASL library</secondary>
49818 </indexterm>
49819 <indexterm role="concept">
49820 <primary>Kerberos</primary>
49821 </indexterm>
49822 The code for this authenticator was provided by Matthew Byng-Maddick of A L
49823 Digital Ltd (<emphasis role="bold"><ulink url="http://www.aldigital.co.uk">http://www.aldigital.co.uk</ulink></emphasis>).
49824 </para>
49825 <para>
49826 The <command>cyrus_sasl</command> authenticator provides server support for the Cyrus SASL
49827 library implementation of the RFC 2222 (<quote>Simple Authentication and Security
49828 Layer</quote>). This library supports a number of authentication mechanisms,
49829 including PLAIN and LOGIN, but also several others that Exim does not support
49830 directly. In particular, there is support for Kerberos authentication.
49831 </para>
49832 <para>
49833 The <command>cyrus_sasl</command> authenticator provides a gatewaying mechanism directly to
49834 the Cyrus interface, so if your Cyrus library can do, for example, CRAM-MD5,
49835 then so can the <command>cyrus_sasl</command> authenticator. By default it uses the public
49836 name of the driver to determine which mechanism to support.
49837 </para>
49838 <para>
49839 Where access to some kind of secret file is required, for example in GSSAPI
49840 or CRAM-MD5, it is worth noting that the authenticator runs as the Exim
49841 user, and that the Cyrus SASL library has no way of escalating privileges
49842 by default. You may also find you need to set environment variables,
49843 depending on the driver you are using.
49844 </para>
49845 <para>
49846 The application name provided by Exim is <quote>exim</quote>, so various SASL options may
49847 be set in <filename>exim.conf</filename> in your SASL directory. If you are using GSSAPI for
49848 Kerberos, note that because of limitations in the GSSAPI interface,
49849 changing the server keytab might need to be communicated down to the Kerberos
49850 layer independently. The mechanism for doing so is dependent upon the Kerberos
49851 implementation.
49852 </para>
49853 <para>
49854 For example, for older releases of Heimdal, the environment variable KRB5_KTNAME
49855 may be set to point to an alternative keytab file. Exim will pass this
49856 variable through from its own inherited environment when started as root or the
49857 Exim user. The keytab file needs to be readable by the Exim user.
49858 With newer releases of Heimdal, a setuid Exim may cause Heimdal to discard the
49859 environment variable.  In practice, for those releases, the Cyrus authenticator
49860 is not a suitable interface for GSSAPI (Kerberos) support.  Instead, consider
49861 the <command>heimdal_gssapi</command> authenticator, described in chapter <xref linkend="CHAPheimdalgss"/>
49862 </para>
49863 <section id="SECID178">
49864 <title>Using cyrus_sasl as a server</title>
49865 <para>
49866 The <command>cyrus_sasl</command> authenticator has four private options. It puts the username
49867 (on a successful authentication) into <varname>$auth1</varname>. For compatibility with
49868 previous releases of Exim, the username is also placed in <varname>$1</varname>. However, the
49869 use of this variable for this purpose is now deprecated, as it can lead to
49870 confusion in string expansions that also use numeric variables for other
49871 things.
49872 </para>
49873 <para>
49874 <indexterm role="option">
49875 <primary><option>server_hostname</option></primary>
49876 </indexterm>
49877 </para>
49878 <informaltable frame="all">
49879 <tgroup cols="4" colsep="0" rowsep="0">
49880 <colspec colwidth="8*" align="left"/>
49881 <colspec colwidth="6*" align="center"/>
49882 <colspec colwidth="6*" align="center"/>
49883 <colspec colwidth="6*" align="right"/>
49884 <tbody>
49885 <row>
49886 <entry><option>server_hostname</option></entry>
49887 <entry>Use: <emphasis>cyrus_sasl</emphasis></entry>
49888 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
49889 <entry>Default: <emphasis>see below</emphasis></entry>
49890 </row>
49891 </tbody>
49892 </tgroup>
49893 </informaltable>
49894 <para>
49895 This option selects the hostname that is used when communicating with the
49896 library. The default value is <literal>$primary_hostname</literal>. It is up to the underlying
49897 SASL plug-in what it does with this data.
49898 </para>
49899 <para>
49900 <indexterm role="option">
49901 <primary><option>server_mech</option></primary>
49902 </indexterm>
49903 </para>
49904 <informaltable frame="all">
49905 <tgroup cols="4" colsep="0" rowsep="0">
49906 <colspec colwidth="8*" align="left"/>
49907 <colspec colwidth="6*" align="center"/>
49908 <colspec colwidth="6*" align="center"/>
49909 <colspec colwidth="6*" align="right"/>
49910 <tbody>
49911 <row>
49912 <entry><option>server_mech</option></entry>
49913 <entry>Use: <emphasis>cyrus_sasl</emphasis></entry>
49914 <entry>Type: <emphasis>string</emphasis></entry>
49915 <entry>Default: <emphasis>see below</emphasis></entry>
49916 </row>
49917 </tbody>
49918 </tgroup>
49919 </informaltable>
49920 <para>
49921 This option selects the authentication mechanism this driver should use. The
49922 default is the value of the generic <option>public_name</option> option. This option allows
49923 you to use a different underlying mechanism from the advertised name. For
49924 example:
49925 </para>
49926 <literallayout class="monospaced">
49927 sasl:
49928   driver = cyrus_sasl
49929   public_name = X-ANYTHING
49930   server_mech = CRAM-MD5
49931   server_set_id = $auth1
49932 </literallayout>
49933 <para>
49934 <indexterm role="option">
49935 <primary><option>server_realm</option></primary>
49936 </indexterm>
49937 </para>
49938 <informaltable frame="all">
49939 <tgroup cols="4" colsep="0" rowsep="0">
49940 <colspec colwidth="8*" align="left"/>
49941 <colspec colwidth="6*" align="center"/>
49942 <colspec colwidth="6*" align="center"/>
49943 <colspec colwidth="6*" align="right"/>
49944 <tbody>
49945 <row>
49946 <entry><option>server_realm</option></entry>
49947 <entry>Use: <emphasis>cyrus_sasl</emphasis></entry>
49948 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
49949 <entry>Default: <emphasis>unset</emphasis></entry>
49950 </row>
49951 </tbody>
49952 </tgroup>
49953 </informaltable>
49954 <para>
49955 This specifies the SASL realm that the server claims to be in.
49956 </para>
49957 <para>
49958 <indexterm role="option">
49959 <primary><option>server_service</option></primary>
49960 </indexterm>
49961 </para>
49962 <informaltable frame="all">
49963 <tgroup cols="4" colsep="0" rowsep="0">
49964 <colspec colwidth="8*" align="left"/>
49965 <colspec colwidth="6*" align="center"/>
49966 <colspec colwidth="6*" align="center"/>
49967 <colspec colwidth="6*" align="right"/>
49968 <tbody>
49969 <row>
49970 <entry><option>server_service</option></entry>
49971 <entry>Use: <emphasis>cyrus_sasl</emphasis></entry>
49972 <entry>Type: <emphasis>string</emphasis></entry>
49973 <entry>Default: <emphasis><literal>smtp</literal></emphasis></entry>
49974 </row>
49975 </tbody>
49976 </tgroup>
49977 </informaltable>
49978 <para>
49979 This is the SASL service that the server claims to implement.
49980 </para>
49981 <para>
49982 For straightforward cases, you do not need to set any of the authenticator&#x2019;s
49983 private options. All you need to do is to specify an appropriate mechanism as
49984 the public name. Thus, if you have a SASL library that supports CRAM-MD5 and
49985 PLAIN, you could have two authenticators as follows:
49986 </para>
49987 <literallayout class="monospaced">
49988 sasl_cram_md5:
49989   driver = cyrus_sasl
49990   public_name = CRAM-MD5
49991   server_set_id = $auth1
49992
49993 sasl_plain:
49994   driver = cyrus_sasl
49995   public_name = PLAIN
49996   server_set_id = $auth2
49997 </literallayout>
49998 <para>
49999 Cyrus SASL does implement the LOGIN authentication method, even though it is
50000 not a standard method. It is disabled by default in the source distribution,
50001 but it is present in many binary distributions.
50002 <indexterm role="concept" startref="IIDcyrauth1" class="endofrange"/>
50003 <indexterm role="concept" startref="IIDcyrauth2" class="endofrange"/>
50004 </para>
50005 </section>
50006 </chapter>
50007
50008 <chapter id="CHAPdovecot">
50009 <title>The dovecot authenticator</title>
50010 <para>
50011 <indexterm role="concept" id="IIDdcotauth1" class="startofrange">
50012 <primary><command>dovecot</command> authenticator</primary>
50013 </indexterm>
50014 <indexterm role="concept" id="IIDdcotauth2" class="startofrange">
50015 <primary>authenticators</primary>
50016 <secondary><command>dovecot</command></secondary>
50017 </indexterm>
50018 This authenticator is an interface to the authentication facility of the
50019 Dovecot POP/IMAP server, which can support a number of authentication methods.
50020 Note that Dovecot must be configured to use auth-client not auth-userdb.
50021 If you are using Dovecot to authenticate POP/IMAP clients, it might be helpful
50022 to use the same mechanisms for SMTP authentication. This is a server
50023 authenticator only. There is only one option:
50024 </para>
50025 <para>
50026 <indexterm role="option">
50027 <primary><option>server_socket</option></primary>
50028 </indexterm>
50029 </para>
50030 <informaltable frame="all">
50031 <tgroup cols="4" colsep="0" rowsep="0">
50032 <colspec colwidth="8*" align="left"/>
50033 <colspec colwidth="6*" align="center"/>
50034 <colspec colwidth="6*" align="center"/>
50035 <colspec colwidth="6*" align="right"/>
50036 <tbody>
50037 <row>
50038 <entry><option>server_socket</option></entry>
50039 <entry>Use: <emphasis>dovecot</emphasis></entry>
50040 <entry>Type: <emphasis>string</emphasis></entry>
50041 <entry>Default: <emphasis>unset</emphasis></entry>
50042 </row>
50043 </tbody>
50044 </tgroup>
50045 </informaltable>
50046 <para>
50047 This option must specify the socket that is the interface to Dovecot
50048 authentication. The <option>public_name</option> option must specify an authentication
50049 mechanism that Dovecot is configured to support. You can have several
50050 authenticators for different mechanisms. For example:
50051 </para>
50052 <literallayout class="monospaced">
50053 dovecot_plain:
50054   driver = dovecot
50055   public_name = PLAIN
50056   server_socket = /var/run/dovecot/auth-client
50057   server_set_id = $auth1
50058
50059 dovecot_ntlm:
50060   driver = dovecot
50061   public_name = NTLM
50062   server_socket = /var/run/dovecot/auth-client
50063   server_set_id = $auth1
50064 </literallayout>
50065 <para>
50066 If the SMTP connection is encrypted, or if <varname>$sender_host_address</varname> is equal to
50067 <varname>$received_ip_address</varname> (that is, the connection is local), the <quote>secured</quote>
50068 option is passed in the Dovecot authentication command. If, for a TLS
50069 connection, a client certificate has been verified, the <quote>valid-client-cert</quote>
50070 option is passed. When authentication succeeds, the identity of the user
50071 who authenticated is placed in <varname>$auth1</varname>.
50072 <indexterm role="concept" startref="IIDdcotauth1" class="endofrange"/>
50073 <indexterm role="concept" startref="IIDdcotauth2" class="endofrange"/>
50074 </para>
50075 </chapter>
50076
50077 <chapter id="CHAPgsasl">
50078 <title>The gsasl authenticator</title>
50079 <para>
50080 <indexterm role="concept" id="IIDgsaslauth1" class="startofrange">
50081 <primary><command>gsasl</command> authenticator</primary>
50082 </indexterm>
50083 <indexterm role="concept" id="IIDgsaslauth2" class="startofrange">
50084 <primary>authenticators</primary>
50085 <secondary><command>gsasl</command></secondary>
50086 </indexterm>
50087 <indexterm role="concept">
50088 <primary>authentication</primary>
50089 <secondary>GNU SASL</secondary>
50090 </indexterm>
50091 <indexterm role="concept">
50092 <primary>authentication</primary>
50093 <secondary>SASL</secondary>
50094 </indexterm>
50095 <indexterm role="concept">
50096 <primary>authentication</primary>
50097 <secondary>EXTERNAL</secondary>
50098 </indexterm>
50099 <indexterm role="concept">
50100 <primary>authentication</primary>
50101 <secondary>ANONYMOUS</secondary>
50102 </indexterm>
50103 <indexterm role="concept">
50104 <primary>authentication</primary>
50105 <secondary>PLAIN</secondary>
50106 </indexterm>
50107 <indexterm role="concept">
50108 <primary>authentication</primary>
50109 <secondary>LOGIN</secondary>
50110 </indexterm>
50111 <indexterm role="concept">
50112 <primary>authentication</primary>
50113 <secondary>DIGEST-MD5</secondary>
50114 </indexterm>
50115 <indexterm role="concept">
50116 <primary>authentication</primary>
50117 <secondary>CRAM-MD5</secondary>
50118 </indexterm>
50119 <indexterm role="concept">
50120 <primary>authentication</primary>
50121 <secondary>SCRAM-SHA-1</secondary>
50122 </indexterm>
50123 The <command>gsasl</command> authenticator provides server integration for the GNU SASL
50124 library and the mechanisms it provides.  This is new as of the 4.80 release
50125 and there are a few areas where the library does not let Exim smoothly
50126 scale to handle future authentication mechanisms, so no guarantee can be
50127 made that any particular new authentication mechanism will be supported
50128 without code changes in Exim.
50129 </para>
50130 <para>
50131 <indexterm role="option">
50132 <primary><option>server_channelbinding</option></primary>
50133 </indexterm>
50134 </para>
50135 <informaltable frame="all">
50136 <tgroup cols="4" colsep="0" rowsep="0">
50137 <colspec colwidth="8*" align="left"/>
50138 <colspec colwidth="6*" align="center"/>
50139 <colspec colwidth="6*" align="center"/>
50140 <colspec colwidth="6*" align="right"/>
50141 <tbody>
50142 <row>
50143 <entry><option>server_channelbinding</option></entry>
50144 <entry>Use: <emphasis>gsasl</emphasis></entry>
50145 <entry>Type: <emphasis>boolean</emphasis></entry>
50146 <entry>Default: <emphasis>false</emphasis></entry>
50147 </row>
50148 </tbody>
50149 </tgroup>
50150 </informaltable>
50151 <para>
50152 Some authentication mechanisms are able to use external context at both ends
50153 of the session to bind the authentication to that context, and fail the
50154 authentication process if that context differs.  Specifically, some TLS
50155 ciphersuites can provide identifying information about the cryptographic
50156 context.
50157 </para>
50158 <para>
50159 This means that certificate identity and verification becomes a non-issue,
50160 as a man-in-the-middle attack will cause the correct client and server to
50161 see different identifiers and authentication will fail.
50162 </para>
50163 <para>
50164 This is currently only supported when using the GnuTLS library.  This is
50165 only usable by mechanisms which support "channel binding"; at time of
50166 writing, that&#x2019;s the SCRAM family.
50167 </para>
50168 <para>
50169 This defaults off to ensure smooth upgrade across Exim releases, in case
50170 this option causes some clients to start failing.  Some future release
50171 of Exim may switch the default to be true.
50172 </para>
50173 <para>
50174 <indexterm role="option">
50175 <primary><option>server_hostname</option></primary>
50176 </indexterm>
50177 </para>
50178 <informaltable frame="all">
50179 <tgroup cols="4" colsep="0" rowsep="0">
50180 <colspec colwidth="8*" align="left"/>
50181 <colspec colwidth="6*" align="center"/>
50182 <colspec colwidth="6*" align="center"/>
50183 <colspec colwidth="6*" align="right"/>
50184 <tbody>
50185 <row>
50186 <entry><option>server_hostname</option></entry>
50187 <entry>Use: <emphasis>gsasl</emphasis></entry>
50188 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
50189 <entry>Default: <emphasis>see below</emphasis></entry>
50190 </row>
50191 </tbody>
50192 </tgroup>
50193 </informaltable>
50194 <para>
50195 This option selects the hostname that is used when communicating with the
50196 library. The default value is <literal>$primary_hostname</literal>.
50197 Some mechanisms will use this data.
50198 </para>
50199 <para>
50200 <indexterm role="option">
50201 <primary><option>server_mech</option></primary>
50202 </indexterm>
50203 </para>
50204 <informaltable frame="all">
50205 <tgroup cols="4" colsep="0" rowsep="0">
50206 <colspec colwidth="8*" align="left"/>
50207 <colspec colwidth="6*" align="center"/>
50208 <colspec colwidth="6*" align="center"/>
50209 <colspec colwidth="6*" align="right"/>
50210 <tbody>
50211 <row>
50212 <entry><option>server_mech</option></entry>
50213 <entry>Use: <emphasis>gsasl</emphasis></entry>
50214 <entry>Type: <emphasis>string</emphasis></entry>
50215 <entry>Default: <emphasis>see below</emphasis></entry>
50216 </row>
50217 </tbody>
50218 </tgroup>
50219 </informaltable>
50220 <para>
50221 This option selects the authentication mechanism this driver should use. The
50222 default is the value of the generic <option>public_name</option> option. This option allows
50223 you to use a different underlying mechanism from the advertised name. For
50224 example:
50225 </para>
50226 <literallayout class="monospaced">
50227 sasl:
50228   driver = gsasl
50229   public_name = X-ANYTHING
50230   server_mech = CRAM-MD5
50231   server_set_id = $auth1
50232 </literallayout>
50233 <para>
50234 <indexterm role="option">
50235 <primary><option>server_password</option></primary>
50236 </indexterm>
50237 </para>
50238 <informaltable frame="all">
50239 <tgroup cols="4" colsep="0" rowsep="0">
50240 <colspec colwidth="8*" align="left"/>
50241 <colspec colwidth="6*" align="center"/>
50242 <colspec colwidth="6*" align="center"/>
50243 <colspec colwidth="6*" align="right"/>
50244 <tbody>
50245 <row>
50246 <entry><option>server_password</option></entry>
50247 <entry>Use: <emphasis>gsasl</emphasis></entry>
50248 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
50249 <entry>Default: <emphasis>unset</emphasis></entry>
50250 </row>
50251 </tbody>
50252 </tgroup>
50253 </informaltable>
50254 <para>
50255 Various mechanisms need access to the cleartext password on the server, so
50256 that proof-of-possession can be demonstrated on the wire, without sending
50257 the password itself.
50258 </para>
50259 <para>
50260 The data available for lookup varies per mechanism.
50261 In all cases, <varname>$auth1</varname> is set to the <emphasis>authentication id</emphasis>.
50262 The <varname>$auth2</varname> variable will always be the <emphasis>authorization id</emphasis> (<emphasis>authz</emphasis>)
50263 if available, else the empty string.
50264 The <varname>$auth3</varname> variable will always be the <emphasis>realm</emphasis> if available,
50265 else the empty string.
50266 </para>
50267 <para>
50268 A forced failure will cause authentication to defer.
50269 </para>
50270 <para>
50271 If using this option, it may make sense to set the <option>server_condition</option>
50272 option to be simply "true".
50273 </para>
50274 <para>
50275 <indexterm role="option">
50276 <primary><option>server_realm</option></primary>
50277 </indexterm>
50278 </para>
50279 <informaltable frame="all">
50280 <tgroup cols="4" colsep="0" rowsep="0">
50281 <colspec colwidth="8*" align="left"/>
50282 <colspec colwidth="6*" align="center"/>
50283 <colspec colwidth="6*" align="center"/>
50284 <colspec colwidth="6*" align="right"/>
50285 <tbody>
50286 <row>
50287 <entry><option>server_realm</option></entry>
50288 <entry>Use: <emphasis>gsasl</emphasis></entry>
50289 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
50290 <entry>Default: <emphasis>unset</emphasis></entry>
50291 </row>
50292 </tbody>
50293 </tgroup>
50294 </informaltable>
50295 <para>
50296 This specifies the SASL realm that the server claims to be in.
50297 Some mechanisms will use this data.
50298 </para>
50299 <para>
50300 <indexterm role="option">
50301 <primary><option>server_scram_iter</option></primary>
50302 </indexterm>
50303 </para>
50304 <informaltable frame="all">
50305 <tgroup cols="4" colsep="0" rowsep="0">
50306 <colspec colwidth="8*" align="left"/>
50307 <colspec colwidth="6*" align="center"/>
50308 <colspec colwidth="6*" align="center"/>
50309 <colspec colwidth="6*" align="right"/>
50310 <tbody>
50311 <row>
50312 <entry><option>server_scram_iter</option></entry>
50313 <entry>Use: <emphasis>gsasl</emphasis></entry>
50314 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
50315 <entry>Default: <emphasis>unset</emphasis></entry>
50316 </row>
50317 </tbody>
50318 </tgroup>
50319 </informaltable>
50320 <para>
50321 This option provides data for the SCRAM family of mechanisms.
50322 <varname>$auth1</varname> is not available at evaluation time.
50323 (This may change, as we receive feedback on use)
50324 </para>
50325 <para>
50326 <indexterm role="option">
50327 <primary><option>server_scram_salt</option></primary>
50328 </indexterm>
50329 </para>
50330 <informaltable frame="all">
50331 <tgroup cols="4" colsep="0" rowsep="0">
50332 <colspec colwidth="8*" align="left"/>
50333 <colspec colwidth="6*" align="center"/>
50334 <colspec colwidth="6*" align="center"/>
50335 <colspec colwidth="6*" align="right"/>
50336 <tbody>
50337 <row>
50338 <entry><option>server_scram_salt</option></entry>
50339 <entry>Use: <emphasis>gsasl</emphasis></entry>
50340 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
50341 <entry>Default: <emphasis>unset</emphasis></entry>
50342 </row>
50343 </tbody>
50344 </tgroup>
50345 </informaltable>
50346 <para>
50347 This option provides data for the SCRAM family of mechanisms.
50348 <varname>$auth1</varname> is not available at evaluation time.
50349 (This may change, as we receive feedback on use)
50350 </para>
50351 <para>
50352 <indexterm role="option">
50353 <primary><option>server_service</option></primary>
50354 </indexterm>
50355 </para>
50356 <informaltable frame="all">
50357 <tgroup cols="4" colsep="0" rowsep="0">
50358 <colspec colwidth="8*" align="left"/>
50359 <colspec colwidth="6*" align="center"/>
50360 <colspec colwidth="6*" align="center"/>
50361 <colspec colwidth="6*" align="right"/>
50362 <tbody>
50363 <row>
50364 <entry><option>server_service</option></entry>
50365 <entry>Use: <emphasis>gsasl</emphasis></entry>
50366 <entry>Type: <emphasis>string</emphasis></entry>
50367 <entry>Default: <emphasis><literal>smtp</literal></emphasis></entry>
50368 </row>
50369 </tbody>
50370 </tgroup>
50371 </informaltable>
50372 <para>
50373 This is the SASL service that the server claims to implement.
50374 Some mechanisms will use this data.
50375 </para>
50376 <section id="SECTgsaslauthvar">
50377 <title><command>gsasl</command> auth variables</title>
50378 <para>
50379 <indexterm role="variable">
50380 <primary><varname>$auth1</varname>, <varname>$auth2</varname>, etc</primary>
50381 </indexterm>
50382 These may be set when evaluating specific options, as detailed above.
50383 They will also be set when evaluating <option>server_condition</option>.
50384 </para>
50385 <para>
50386 Unless otherwise stated below, the <command>gsasl</command> integration will use the following
50387 meanings for these variables:
50388 </para>
50389 <itemizedlist>
50390 <listitem>
50391 <para>
50392 <indexterm role="variable">
50393 <primary><varname>$auth1</varname></primary>
50394 </indexterm>
50395 <varname>$auth1</varname>: the <emphasis>authentication id</emphasis>
50396 </para>
50397 </listitem>
50398 <listitem>
50399 <para>
50400 <indexterm role="variable">
50401 <primary><varname>$auth2</varname></primary>
50402 </indexterm>
50403 <varname>$auth2</varname>: the <emphasis>authorization id</emphasis>
50404 </para>
50405 </listitem>
50406 <listitem>
50407 <para>
50408 <indexterm role="variable">
50409 <primary><varname>$auth3</varname></primary>
50410 </indexterm>
50411 <varname>$auth3</varname>: the <emphasis>realm</emphasis>
50412 </para>
50413 </listitem>
50414 </itemizedlist>
50415 <para>
50416 On a per-mechanism basis:
50417 </para>
50418 <itemizedlist>
50419 <listitem>
50420 <para>
50421 <indexterm role="concept">
50422 <primary>authentication</primary>
50423 <secondary>EXTERNAL</secondary>
50424 </indexterm>
50425 EXTERNAL: only <varname>$auth1</varname> is set, to the possibly empty <emphasis>authorization id</emphasis>;
50426 the <option>server_condition</option> option must be present.
50427 </para>
50428 </listitem>
50429 <listitem>
50430 <para>
50431 <indexterm role="concept">
50432 <primary>authentication</primary>
50433 <secondary>ANONYMOUS</secondary>
50434 </indexterm>
50435 ANONYMOUS: only <varname>$auth1</varname> is set, to the possibly empty <emphasis>anonymous token</emphasis>;
50436 the <option>server_condition</option> option must be present.
50437 </para>
50438 </listitem>
50439 <listitem>
50440 <para>
50441 <indexterm role="concept">
50442 <primary>authentication</primary>
50443 <secondary>GSSAPI</secondary>
50444 </indexterm>
50445 GSSAPI: <varname>$auth1</varname> will be set to the <emphasis>GSSAPI Display Name</emphasis>;
50446 <varname>$auth2</varname> will be set to the <emphasis>authorization id</emphasis>,
50447 the <option>server_condition</option> option must be present.
50448 </para>
50449 </listitem>
50450 </itemizedlist>
50451 <para>
50452 An <emphasis>anonymous token</emphasis> is something passed along as an unauthenticated
50453 identifier; this is analogous to FTP anonymous authentication passing an
50454 email address, or software-identifier@, as the "password".
50455 </para>
50456 <para>
50457 An example showing the password having the realm specified in the callback
50458 and demonstrating a Cyrus SASL to GSASL migration approach is:
50459 </para>
50460 <literallayout class="monospaced">
50461 gsasl_cyrusless_crammd5:
50462   driver = gsasl
50463   public_name = CRAM-MD5
50464   server_realm = imap.example.org
50465   server_password = ${lookup{$auth1:$auth3:userPassword}\
50466                     dbmjz{/etc/sasldb2}{$value}fail}
50467   server_set_id = ${quote:$auth1}
50468   server_condition = yes
50469 </literallayout>
50470 </section>
50471 </chapter>
50472
50473 <chapter id="CHAPheimdalgss">
50474 <title>The heimdal_gssapi authenticator</title>
50475 <para>
50476 <indexterm role="concept" id="IIDheimdalgssauth1" class="startofrange">
50477 <primary><command>heimdal_gssapi</command> authenticator</primary>
50478 </indexterm>
50479 <indexterm role="concept" id="IIDheimdalgssauth2" class="startofrange">
50480 <primary>authenticators</primary>
50481 <secondary><command>heimdal_gssapi</command></secondary>
50482 </indexterm>
50483 <indexterm role="concept">
50484 <primary>authentication</primary>
50485 <secondary>GSSAPI</secondary>
50486 </indexterm>
50487 <indexterm role="concept">
50488 <primary>authentication</primary>
50489 <secondary>Kerberos</secondary>
50490 </indexterm>
50491 The <command>heimdal_gssapi</command> authenticator provides server integration for the
50492 Heimdal GSSAPI/Kerberos library, permitting Exim to set a keytab pathname
50493 reliably.
50494 </para>
50495 <para>
50496 <indexterm role="option">
50497 <primary><option>server_hostname</option></primary>
50498 </indexterm>
50499 </para>
50500 <informaltable frame="all">
50501 <tgroup cols="4" colsep="0" rowsep="0">
50502 <colspec colwidth="8*" align="left"/>
50503 <colspec colwidth="6*" align="center"/>
50504 <colspec colwidth="6*" align="center"/>
50505 <colspec colwidth="6*" align="right"/>
50506 <tbody>
50507 <row>
50508 <entry><option>server_hostname</option></entry>
50509 <entry>Use: <emphasis>heimdal_gssapi</emphasis></entry>
50510 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
50511 <entry>Default: <emphasis>see below</emphasis></entry>
50512 </row>
50513 </tbody>
50514 </tgroup>
50515 </informaltable>
50516 <para>
50517 This option selects the hostname that is used, with <option>server_service</option>,
50518 for constructing the GSS server name, as a <emphasis>GSS_C_NT_HOSTBASED_SERVICE</emphasis>
50519 identifier.  The default value is <literal>$primary_hostname</literal>.
50520 </para>
50521 <para>
50522 <indexterm role="option">
50523 <primary><option>server_keytab</option></primary>
50524 </indexterm>
50525 </para>
50526 <informaltable frame="all">
50527 <tgroup cols="4" colsep="0" rowsep="0">
50528 <colspec colwidth="8*" align="left"/>
50529 <colspec colwidth="6*" align="center"/>
50530 <colspec colwidth="6*" align="center"/>
50531 <colspec colwidth="6*" align="right"/>
50532 <tbody>
50533 <row>
50534 <entry><option>server_keytab</option></entry>
50535 <entry>Use: <emphasis>heimdal_gssapi</emphasis></entry>
50536 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
50537 <entry>Default: <emphasis>unset</emphasis></entry>
50538 </row>
50539 </tbody>
50540 </tgroup>
50541 </informaltable>
50542 <para>
50543 If set, then Heimdal will not use the system default keytab (typically
50544 <filename>/etc/krb5.keytab</filename>) but instead the pathname given in this option.
50545 The value should be a pathname, with no <quote>file:</quote> prefix.
50546 </para>
50547 <para>
50548 <indexterm role="option">
50549 <primary><option>server_service</option></primary>
50550 </indexterm>
50551 </para>
50552 <informaltable frame="all">
50553 <tgroup cols="4" colsep="0" rowsep="0">
50554 <colspec colwidth="8*" align="left"/>
50555 <colspec colwidth="6*" align="center"/>
50556 <colspec colwidth="6*" align="center"/>
50557 <colspec colwidth="6*" align="right"/>
50558 <tbody>
50559 <row>
50560 <entry><option>server_service</option></entry>
50561 <entry>Use: <emphasis>heimdal_gssapi</emphasis></entry>
50562 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
50563 <entry>Default: <emphasis>smtp</emphasis></entry>
50564 </row>
50565 </tbody>
50566 </tgroup>
50567 </informaltable>
50568 <para>
50569 This option specifies the service identifier used, in conjunction with
50570 <option>server_hostname</option>, for building the identifier for finding credentials
50571 from the keytab.
50572 </para>
50573 <section id="SECTheimdalgssauthvar">
50574 <title><command>heimdal_gssapi</command> auth variables</title>
50575 <para>
50576 Beware that these variables will typically include a realm, thus will appear
50577 to be roughly like an email address already.  The <emphasis>authzid</emphasis> in <varname>$auth2</varname> is
50578 not verified, so a malicious client can set it to anything.
50579 </para>
50580 <para>
50581 The <varname>$auth1</varname> field should be safely trustable as a value from the Key
50582 Distribution Center.  Note that these are not quite email addresses.
50583 Each identifier is for a role, and so the left-hand-side may include a
50584 role suffix.  For instance, <quote>joe/admin@EXAMPLE.ORG</quote>.
50585 </para>
50586 <para>
50587 <indexterm role="variable">
50588 <primary><varname>$auth1</varname>, <varname>$auth2</varname>, etc</primary>
50589 </indexterm>
50590 </para>
50591 <itemizedlist>
50592 <listitem>
50593 <para>
50594 <indexterm role="variable">
50595 <primary><varname>$auth1</varname></primary>
50596 </indexterm>
50597 <varname>$auth1</varname>: the <emphasis>authentication id</emphasis>, set to the GSS Display Name.
50598 </para>
50599 </listitem>
50600 <listitem>
50601 <para>
50602 <indexterm role="variable">
50603 <primary><varname>$auth2</varname></primary>
50604 </indexterm>
50605 <varname>$auth2</varname>: the <emphasis>authorization id</emphasis>, sent within SASL encapsulation after
50606 authentication.  If that was empty, this will also be set to the
50607 GSS Display Name.
50608 </para>
50609 </listitem>
50610 </itemizedlist>
50611 </section>
50612 </chapter>
50613
50614 <chapter id="CHAPspa">
50615 <title>The spa authenticator</title>
50616 <para>
50617 <indexterm role="concept" id="IIDspaauth1" class="startofrange">
50618 <primary><command>spa</command> authenticator</primary>
50619 </indexterm>
50620 <indexterm role="concept" id="IIDspaauth2" class="startofrange">
50621 <primary>authenticators</primary>
50622 <secondary><command>spa</command></secondary>
50623 </indexterm>
50624 <indexterm role="concept">
50625 <primary>authentication</primary>
50626 <secondary>Microsoft Secure Password</secondary>
50627 </indexterm>
50628 <indexterm role="concept">
50629 <primary>authentication</primary>
50630 <secondary>NTLM</secondary>
50631 </indexterm>
50632 <indexterm role="concept">
50633 <primary>Microsoft Secure Password Authentication</primary>
50634 </indexterm>
50635 <indexterm role="concept">
50636 <primary>NTLM authentication</primary>
50637 </indexterm>
50638 The <command>spa</command> authenticator provides client support for Microsoft&#x2019;s <emphasis>Secure
50639 Password Authentication</emphasis> mechanism,
50640 which is also sometimes known as NTLM (NT LanMan). The code for client side of
50641 this authenticator was contributed by Marc Prud&#x2019;hommeaux, and much of it is
50642 taken from the Samba project (<emphasis role="bold"><ulink url="http://www.samba.org">http://www.samba.org</ulink></emphasis>). The code for the
50643 server side was subsequently contributed by Tom Kistner. The mechanism works as
50644 follows:
50645 </para>
50646 <itemizedlist>
50647 <listitem>
50648 <para>
50649 After the AUTH command has been accepted, the client sends an SPA
50650 authentication request based on the user name and optional domain.
50651 </para>
50652 </listitem>
50653 <listitem>
50654 <para>
50655 The server sends back a challenge.
50656 </para>
50657 </listitem>
50658 <listitem>
50659 <para>
50660 The client builds a challenge response which makes use of the user&#x2019;s password
50661 and sends it to the server, which then accepts or rejects it.
50662 </para>
50663 </listitem>
50664 </itemizedlist>
50665 <para>
50666 Encryption is used to protect the password in transit.
50667 </para>
50668 <section id="SECID179">
50669 <title>Using spa as a server</title>
50670 <para>
50671 <indexterm role="concept">
50672 <primary>options</primary>
50673 <secondary><command>spa</command> authenticator (server)</secondary>
50674 </indexterm>
50675 The <command>spa</command> authenticator has just one server option:
50676 </para>
50677 <para>
50678 <indexterm role="option">
50679 <primary><option>server_password</option></primary>
50680 </indexterm>
50681 </para>
50682 <informaltable frame="all">
50683 <tgroup cols="4" colsep="0" rowsep="0">
50684 <colspec colwidth="8*" align="left"/>
50685 <colspec colwidth="6*" align="center"/>
50686 <colspec colwidth="6*" align="center"/>
50687 <colspec colwidth="6*" align="right"/>
50688 <tbody>
50689 <row>
50690 <entry><option>server_password</option></entry>
50691 <entry>Use: <emphasis>spa</emphasis></entry>
50692 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
50693 <entry>Default: <emphasis>unset</emphasis></entry>
50694 </row>
50695 </tbody>
50696 </tgroup>
50697 </informaltable>
50698 <para>
50699 <indexterm role="concept">
50700 <primary>numerical variables (<varname>$1</varname> <varname>$2</varname> etc)</primary>
50701 <secondary>in <command>spa</command> authenticator</secondary>
50702 </indexterm>
50703 This option is expanded, and the result must be the cleartext password for the
50704 authenticating user, whose name is at this point in <varname>$auth1</varname>. For
50705 compatibility with previous releases of Exim, the user name is also placed in
50706 <varname>$1</varname>. However, the use of this variable for this purpose is now deprecated, as
50707 it can lead to confusion in string expansions that also use numeric variables
50708 for other things. For example:
50709 </para>
50710 <literallayout class="monospaced">
50711 spa:
50712   driver = spa
50713   public_name = NTLM
50714   server_password = \
50715     ${lookup{$auth1}lsearch{/etc/exim/spa_clearpass}{$value}fail}
50716 </literallayout>
50717 <para>
50718 If the expansion is forced to fail, authentication fails. Any other expansion
50719 failure causes a temporary error code to be returned.
50720 </para>
50721 </section>
50722 <section id="SECID180">
50723 <title>Using spa as a client</title>
50724 <para>
50725 <indexterm role="concept">
50726 <primary>options</primary>
50727 <secondary><command>spa</command> authenticator (client)</secondary>
50728 </indexterm>
50729 The <command>spa</command> authenticator has the following client options:
50730 </para>
50731 <para>
50732 <indexterm role="option">
50733 <primary><option>client_domain</option></primary>
50734 </indexterm>
50735 </para>
50736 <informaltable frame="all">
50737 <tgroup cols="4" colsep="0" rowsep="0">
50738 <colspec colwidth="8*" align="left"/>
50739 <colspec colwidth="6*" align="center"/>
50740 <colspec colwidth="6*" align="center"/>
50741 <colspec colwidth="6*" align="right"/>
50742 <tbody>
50743 <row>
50744 <entry><option>client_domain</option></entry>
50745 <entry>Use: <emphasis>spa</emphasis></entry>
50746 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
50747 <entry>Default: <emphasis>unset</emphasis></entry>
50748 </row>
50749 </tbody>
50750 </tgroup>
50751 </informaltable>
50752 <para>
50753 This option specifies an optional domain for the authentication.
50754 </para>
50755 <para>
50756 <indexterm role="option">
50757 <primary><option>client_password</option></primary>
50758 </indexterm>
50759 </para>
50760 <informaltable frame="all">
50761 <tgroup cols="4" colsep="0" rowsep="0">
50762 <colspec colwidth="8*" align="left"/>
50763 <colspec colwidth="6*" align="center"/>
50764 <colspec colwidth="6*" align="center"/>
50765 <colspec colwidth="6*" align="right"/>
50766 <tbody>
50767 <row>
50768 <entry><option>client_password</option></entry>
50769 <entry>Use: <emphasis>spa</emphasis></entry>
50770 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
50771 <entry>Default: <emphasis>unset</emphasis></entry>
50772 </row>
50773 </tbody>
50774 </tgroup>
50775 </informaltable>
50776 <para>
50777 This option specifies the user&#x2019;s password, and must be set.
50778 </para>
50779 <para>
50780 <indexterm role="option">
50781 <primary><option>client_username</option></primary>
50782 </indexterm>
50783 </para>
50784 <informaltable frame="all">
50785 <tgroup cols="4" colsep="0" rowsep="0">
50786 <colspec colwidth="8*" align="left"/>
50787 <colspec colwidth="6*" align="center"/>
50788 <colspec colwidth="6*" align="center"/>
50789 <colspec colwidth="6*" align="right"/>
50790 <tbody>
50791 <row>
50792 <entry><option>client_username</option></entry>
50793 <entry>Use: <emphasis>spa</emphasis></entry>
50794 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
50795 <entry>Default: <emphasis>unset</emphasis></entry>
50796 </row>
50797 </tbody>
50798 </tgroup>
50799 </informaltable>
50800 <para>
50801 This option specifies the user name, and must be set. Here is an example of a
50802 configuration of this authenticator for use with the mail servers at
50803 <emphasis>msn.com</emphasis>:
50804 </para>
50805 <literallayout class="monospaced">
50806 msn:
50807   driver = spa
50808   public_name = MSN
50809   client_username = msn/msn_username
50810   client_password = msn_plaintext_password
50811   client_domain = DOMAIN_OR_UNSET
50812 </literallayout>
50813 <para>
50814 <indexterm role="concept" startref="IIDspaauth1" class="endofrange"/>
50815 <indexterm role="concept" startref="IIDspaauth2" class="endofrange"/>
50816 </para>
50817 </section>
50818 </chapter>
50819
50820 <chapter id="CHAPtlsauth" revisionflag="changed">
50821 <title>The tls authenticator</title>
50822 <para revisionflag="changed">
50823 <indexterm role="concept" id="IIDtlsauth1" class="startofrange">
50824 <primary><command>tls</command> authenticator</primary>
50825 </indexterm>
50826 <indexterm role="concept" id="IIDtlsauth2" class="startofrange">
50827 <primary>authenticators</primary>
50828 <secondary><command>tls</command></secondary>
50829 </indexterm>
50830 <indexterm role="concept">
50831 <primary>authentication</primary>
50832 <secondary>Client Certificate</secondary>
50833 </indexterm>
50834 <indexterm role="concept">
50835 <primary>authentication</primary>
50836 <secondary>X509</secondary>
50837 </indexterm>
50838 <indexterm role="concept">
50839 <primary>Certificate-based authentication</primary>
50840 </indexterm>
50841 The <command>tls</command> authenticator provides server support for
50842 authentication based on client certificates.
50843 </para>
50844 <para revisionflag="changed">
50845 It is not an SMTP authentication mechanism and is not
50846 advertised by the server as part of the SMTP EHLO response.
50847 It is an Exim authenticator in the sense that it affects
50848 the protocol element of the log line, can be tested for
50849 by the <option>authenticated</option> ACL condition, and can set
50850 the <varname>$authenticated_id</varname> variable.
50851 </para>
50852 <para revisionflag="changed">
50853 The client must present a verifiable certificate,
50854 for which it must have been requested via the
50855 <option>tls_verify_hosts</option> or <option>tls_try_verify_hosts</option> main options
50856 (see <xref linkend="CHAPTLS"/>).
50857 </para>
50858 <para revisionflag="changed">
50859 If an authenticator of this type is configured it is
50860 run before any SMTP-level communication is done,
50861 and can authenticate the connection.
50862 If it does, SMTP authentication is not offered.
50863 </para>
50864 <para revisionflag="changed">
50865 A maximum of one authenticator of this type may be present.
50866 </para>
50867 <para revisionflag="changed">
50868 <indexterm role="concept">
50869 <primary>options</primary>
50870 <secondary><command>tls</command> authenticator (server)</secondary>
50871 </indexterm>
50872 The <command>tls</command> authenticator has three server options:
50873 </para>
50874 <para revisionflag="changed">
50875 <indexterm role="option">
50876 <primary><option>server_param1</option></primary>
50877 </indexterm>
50878 </para>
50879 <informaltable frame="all" revisionflag="changed">
50880 <tgroup cols="4" colsep="0" rowsep="0">
50881 <colspec colwidth="8*" align="left"/>
50882 <colspec colwidth="6*" align="center"/>
50883 <colspec colwidth="6*" align="center"/>
50884 <colspec colwidth="6*" align="right"/>
50885 <tbody>
50886 <row>
50887 <entry><option>server_param1</option></entry>
50888 <entry>Use: <emphasis>tls</emphasis></entry>
50889 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
50890 <entry>Default: <emphasis>unset</emphasis></entry>
50891 </row>
50892 </tbody>
50893 </tgroup>
50894 </informaltable>
50895 <para revisionflag="changed">
50896 <indexterm role="concept">
50897 <primary>variables (<varname>$auth1</varname> <varname>$auth2</varname> etc)</primary>
50898 <secondary>in <command>tls</command> authenticator</secondary>
50899 </indexterm>
50900 This option is expanded after the TLS negotiation and
50901 the result is placed in <varname>$auth1</varname>.
50902 If the expansion is forced to fail, authentication fails. Any other expansion
50903 failure causes a temporary error code to be returned.
50904 </para>
50905 <para revisionflag="changed">
50906 <indexterm role="option">
50907 <primary><option>server_param2</option></primary>
50908 </indexterm>
50909 </para>
50910 <informaltable frame="all" revisionflag="changed">
50911 <tgroup cols="4" colsep="0" rowsep="0">
50912 <colspec colwidth="8*" align="left"/>
50913 <colspec colwidth="6*" align="center"/>
50914 <colspec colwidth="6*" align="center"/>
50915 <colspec colwidth="6*" align="right"/>
50916 <tbody>
50917 <row>
50918 <entry><option>server_param2</option></entry>
50919 <entry>Use: <emphasis>tls</emphasis></entry>
50920 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
50921 <entry>Default: <emphasis>unset</emphasis></entry>
50922 </row>
50923 </tbody>
50924 </tgroup>
50925 </informaltable>
50926 <para revisionflag="changed">
50927 <indexterm role="option">
50928 <primary><option>server_param3</option></primary>
50929 </indexterm>
50930 </para>
50931 <informaltable frame="all" revisionflag="changed">
50932 <tgroup cols="4" colsep="0" rowsep="0">
50933 <colspec colwidth="8*" align="left"/>
50934 <colspec colwidth="6*" align="center"/>
50935 <colspec colwidth="6*" align="center"/>
50936 <colspec colwidth="6*" align="right"/>
50937 <tbody>
50938 <row>
50939 <entry><option>server_param3</option></entry>
50940 <entry>Use: <emphasis>tls</emphasis></entry>
50941 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
50942 <entry>Default: <emphasis>unset</emphasis></entry>
50943 </row>
50944 </tbody>
50945 </tgroup>
50946 </informaltable>
50947 <para revisionflag="changed">
50948 As above, for <varname>$auth2</varname> and <varname>$auth3</varname>.
50949 </para>
50950 <para revisionflag="changed">
50951 <option>server_param1</option> may also be spelled <option>server_param</option>.
50952 </para>
50953 <para revisionflag="changed">
50954 Example:
50955 </para>
50956 <literallayout class="monospaced" revisionflag="changed">
50957 tls:
50958   driver = tls
50959   server_param1 =     ${certextract {subj_altname,mail,&gt;:} \
50960                                     {$tls_in_peercert}}
50961   server_condition =  ${if forany {$auth1} \
50962                             {!= {0} \
50963                                 {${lookup ldap{ldap:///\
50964                          mailname=${quote_ldap_dn:${lc:$item}},\
50965                          ou=users,LDAP_DC?mailid} {$value}{0} \
50966                        }    }   } }
50967   server_set_id =     ${if = {1}{${listcount:$auth1}} {$auth1}{}}
50968 </literallayout>
50969 <para revisionflag="changed">
50970 <indexterm role="concept" startref="IIDtlsauth1" class="endofrange"/>
50971 <indexterm role="concept" startref="IIDtlsauth2" class="endofrange"/>
50972 </para>
50973 <para>
50974 Note that because authentication is traditionally an SMTP operation,
50975 the <option>authenticated</option> ACL condition cannot be used in
50976 a connect- or helo-ACL.
50977 </para>
50978 </chapter>
50979
50980 <chapter id="CHAPTLS">
50981 <title>Encrypted SMTP connections using TLS/SSL</title>
50982 <titleabbrev>Encrypted SMTP connections</titleabbrev>
50983 <para>
50984 <indexterm role="concept" id="IIDencsmtp1" class="startofrange">
50985 <primary>encryption</primary>
50986 <secondary>on SMTP connection</secondary>
50987 </indexterm>
50988 <indexterm role="concept" id="IIDencsmtp2" class="startofrange">
50989 <primary>SMTP</primary>
50990 <secondary>encryption</secondary>
50991 </indexterm>
50992 <indexterm role="concept">
50993 <primary>TLS</primary>
50994 <secondary>on SMTP connection</secondary>
50995 </indexterm>
50996 <indexterm role="concept">
50997 <primary>OpenSSL</primary>
50998 </indexterm>
50999 <indexterm role="concept">
51000 <primary>GnuTLS</primary>
51001 </indexterm>
51002 Support for TLS (Transport Layer Security), formerly known as SSL (Secure
51003 Sockets Layer), is implemented by making use of the OpenSSL library or the
51004 GnuTLS library (Exim requires GnuTLS release 1.0 or later). There is no
51005 cryptographic code in the Exim distribution itself for implementing TLS. In
51006 order to use this feature you must install OpenSSL or GnuTLS, and then build a
51007 version of Exim that includes TLS support (see section <xref linkend="SECTinctlsssl"/>).
51008 You also need to understand the basic concepts of encryption at a managerial
51009 level, and in particular, the way that public keys, private keys, and
51010 certificates are used.
51011 </para>
51012 <para>
51013 RFC 3207 defines how SMTP connections can make use of encryption. Once a
51014 connection is established, the client issues a STARTTLS command. If the
51015 server accepts this, the client and the server negotiate an encryption
51016 mechanism. If the negotiation succeeds, the data that subsequently passes
51017 between them is encrypted.
51018 </para>
51019 <para>
51020 Exim&#x2019;s ACLs can detect whether the current SMTP session is encrypted or not,
51021 and if so, what cipher suite is in use, whether the client supplied a
51022 certificate, and whether or not that certificate was verified. This makes it
51023 possible for an Exim server to deny or accept certain commands based on the
51024 encryption state.
51025 </para>
51026 <para>
51027 <emphasis role="bold">Warning</emphasis>: Certain types of firewall and certain anti-virus products can
51028 disrupt TLS connections. You need to turn off SMTP scanning for these products
51029 in order to get TLS to work.
51030 </para>
51031 <section id="SECID284">
51032 <title>Support for the legacy <quote>ssmtp</quote> (aka <quote>smtps</quote>) protocol</title>
51033 <para>
51034 <indexterm role="concept">
51035 <primary>ssmtp protocol</primary>
51036 </indexterm>
51037 <indexterm role="concept">
51038 <primary>smtps protocol</primary>
51039 </indexterm>
51040 <indexterm role="concept">
51041 <primary>SMTP</primary>
51042 <secondary>ssmtp protocol</secondary>
51043 </indexterm>
51044 <indexterm role="concept">
51045 <primary>SMTP</primary>
51046 <secondary>smtps protocol</secondary>
51047 </indexterm>
51048 Early implementations of encrypted SMTP used a different TCP port from normal
51049 SMTP, and expected an encryption negotiation to start immediately, instead of
51050 waiting for a STARTTLS command from the client using the standard SMTP
51051 port. The protocol was called <quote>ssmtp</quote> or <quote>smtps</quote>, and port 465 was
51052 allocated for this purpose.
51053 </para>
51054 <para>
51055 This approach was abandoned when encrypted SMTP was standardized, but there are
51056 still some legacy clients that use it. Exim supports these clients by means of
51057 the <option>tls_on_connect_ports</option> global option. Its value must be a list of port
51058 numbers; the most common use is expected to be:
51059 </para>
51060 <literallayout class="monospaced">
51061 tls_on_connect_ports = 465
51062 </literallayout>
51063 <para>
51064 The port numbers specified by this option apply to all SMTP connections, both
51065 via the daemon and via <emphasis>inetd</emphasis>. You still need to specify all the ports that
51066 the daemon uses (by setting <option>daemon_smtp_ports</option> or <option>local_interfaces</option> or
51067 the <option>-oX</option> command line option) because <option>tls_on_connect_ports</option> does not add
51068 an extra port &ndash; rather, it specifies different behaviour on a port that is
51069 defined elsewhere.
51070 </para>
51071 <para>
51072 There is also a <option>-tls-on-connect</option> command line option. This overrides
51073 <option>tls_on_connect_ports</option>; it forces the legacy behaviour for all ports.
51074 </para>
51075 </section>
51076 <section id="SECTopenvsgnu">
51077 <title>OpenSSL vs GnuTLS</title>
51078 <para>
51079 <indexterm role="concept">
51080 <primary>TLS</primary>
51081 <secondary>OpenSSL <emphasis>vs</emphasis> GnuTLS</secondary>
51082 </indexterm>
51083 The first TLS support in Exim was implemented using OpenSSL. Support for GnuTLS
51084 followed later, when the first versions of GnuTLS were released. To build Exim
51085 to use GnuTLS, you need to set
51086 </para>
51087 <literallayout class="monospaced">
51088 USE_GNUTLS=yes
51089 </literallayout>
51090 <para>
51091 in Local/Makefile, in addition to
51092 </para>
51093 <literallayout class="monospaced">
51094 SUPPORT_TLS=yes
51095 </literallayout>
51096 <para>
51097 You must also set TLS_LIBS and TLS_INCLUDE appropriately, so that the
51098 include files and libraries for GnuTLS can be found.
51099 </para>
51100 <para>
51101 There are some differences in usage when using GnuTLS instead of OpenSSL:
51102 </para>
51103 <itemizedlist>
51104 <listitem>
51105 <para>
51106 The <option>tls_verify_certificates</option> option
51107 cannot be the path of a directory
51108 for GnuTLS versions before 3.3.6
51109 (for later versions, or OpenSSL, it can be either).
51110 </para>
51111 </listitem>
51112 <listitem>
51113 <para>
51114 The default value for <option>tls_dhparam</option> differs for historical reasons.
51115 </para>
51116 </listitem>
51117 <listitem>
51118 <para>
51119 <indexterm role="variable">
51120 <primary><varname>$tls_in_peerdn</varname></primary>
51121 </indexterm>
51122 <indexterm role="variable">
51123 <primary><varname>$tls_out_peerdn</varname></primary>
51124 </indexterm>
51125 Distinguished Name (DN) strings reported by the OpenSSL library use a slash for
51126 separating fields; GnuTLS uses commas, in accordance with RFC 2253. This
51127 affects the value of the <varname>$tls_in_peerdn</varname> and <varname>$tls_out_peerdn</varname> variables.
51128 </para>
51129 </listitem>
51130 <listitem>
51131 <para>
51132 OpenSSL identifies cipher suites using hyphens as separators, for example:
51133 DES-CBC3-SHA. GnuTLS historically used underscores, for example:
51134 RSA_ARCFOUR_SHA. What is more, OpenSSL complains if underscores are present
51135 in a cipher list. To make life simpler, Exim changes underscores to hyphens
51136 for OpenSSL and passes the string unchanged to GnuTLS (expecting the library
51137 to handle its own older variants) when processing lists of cipher suites in the
51138 <option>tls_require_ciphers</option> options (the global option and the <command>smtp</command> transport
51139 option).
51140 </para>
51141 </listitem>
51142 <listitem>
51143 <para>
51144 The <option>tls_require_ciphers</option> options operate differently, as described in the
51145 sections <xref linkend="SECTreqciphssl"/> and <xref linkend="SECTreqciphgnu"/>.
51146 </para>
51147 </listitem>
51148 <listitem>
51149 <para>
51150 The <option>tls_dh_min_bits</option> SMTP transport option is only honoured by GnuTLS.
51151 When using OpenSSL, this option is ignored.
51152 (If an API is found to let OpenSSL be configured in this way,
51153 let the Exim Maintainers know and we&#x2019;ll likely use it).
51154 </para>
51155 </listitem>
51156 <listitem>
51157 <para>
51158 Some other recently added features may only be available in one or the other.
51159 This should be documented with the feature.  If the documentation does not
51160 explicitly state that the feature is infeasible in the other TLS
51161 implementation, then patches are welcome.
51162 </para>
51163 </listitem>
51164 </itemizedlist>
51165 </section>
51166 <section id="SECTgnutlsparam">
51167 <title>GnuTLS parameter computation</title>
51168 <para>
51169 This section only applies if <option>tls_dhparam</option> is set to <literal>historic</literal> or to
51170 an explicit path; if the latter, then the text about generation still applies,
51171 but not the chosen filename.
51172 By default, as of Exim 4.80 a hard-coded D-H prime is used.
51173 See the documentation of <option>tls_dhparam</option> for more information.
51174 </para>
51175 <para>
51176 GnuTLS uses D-H parameters that may take a substantial amount of time
51177 to compute. It is unreasonable to re-compute them for every TLS session.
51178 Therefore, Exim keeps this data in a file in its spool directory, called
51179 <filename>gnutls-params-NNNN</filename> for some value of NNNN, corresponding to the number
51180 of bits requested.
51181 The file is owned by the Exim user and is readable only by
51182 its owner. Every Exim process that start up GnuTLS reads the D-H
51183 parameters from this file. If the file does not exist, the first Exim process
51184 that needs it computes the data and writes it to a temporary file which is
51185 renamed once it is complete. It does not matter if several Exim processes do
51186 this simultaneously (apart from wasting a few resources). Once a file is in
51187 place, new Exim processes immediately start using it.
51188 </para>
51189 <para>
51190 For maximum security, the parameters that are stored in this file should be
51191 recalculated periodically, the frequency depending on your paranoia level.
51192 If you are avoiding using the fixed D-H primes published in RFCs, then you
51193 are concerned about some advanced attacks and will wish to do this; if you do
51194 not regenerate then you might as well stick to the standard primes.
51195 </para>
51196 <para>
51197 Arranging this is easy in principle; just delete the file when you want new
51198 values to be computed. However, there may be a problem. The calculation of new
51199 parameters needs random numbers, and these are obtained from <filename>/dev/random</filename>.
51200 If the system is not very active, <filename>/dev/random</filename> may delay returning data
51201 until enough randomness (entropy) is available. This may cause Exim to hang for
51202 a substantial amount of time, causing timeouts on incoming connections.
51203 </para>
51204 <para>
51205 The solution is to generate the parameters externally to Exim. They are stored
51206 in <filename>gnutls-params-N</filename> in PEM format, which means that they can be
51207 generated externally using the <command>certtool</command> command that is part of GnuTLS.
51208 </para>
51209 <para>
51210 To replace the parameters with new ones, instead of deleting the file
51211 and letting Exim re-create it, you can generate new parameters using
51212 <command>certtool</command> and, when this has been done, replace Exim&#x2019;s cache file by
51213 renaming. The relevant commands are something like this:
51214 </para>
51215 <literallayout class="monospaced">
51216 # ls
51217 [ look for file; assume gnutls-params-2236 is the most recent ]
51218 # rm -f new-params
51219 # touch new-params
51220 # chown exim:exim new-params
51221 # chmod 0600 new-params
51222 # certtool --generate-dh-params --bits 2236 &gt;&gt;new-params
51223 # openssl dhparam -noout -text -in new-params | head
51224 [ check the first line, make sure it's not more than 2236;
51225   if it is, then go back to the start ("rm") and repeat
51226   until the size generated is at most the size requested ]
51227 # chmod 0400 new-params
51228 # mv new-params gnutls-params-2236
51229 </literallayout>
51230 <para>
51231 If Exim never has to generate the parameters itself, the possibility of
51232 stalling is removed.
51233 </para>
51234 <para>
51235 The filename changed in Exim 4.80, to gain the -bits suffix.  The value which
51236 Exim will choose depends upon the version of GnuTLS in use.  For older GnuTLS,
51237 the value remains hard-coded in Exim as 1024.  As of GnuTLS 2.12.x, there is
51238 a way for Exim to ask for the "normal" number of bits for D-H public-key usage,
51239 and Exim does so.  This attempt to remove Exim from TLS policy decisions
51240 failed, as GnuTLS 2.12 returns a value higher than the current hard-coded limit
51241 of the NSS library.  Thus Exim gains the <option>tls_dh_max_bits</option> global option,
51242 which applies to all D-H usage, client or server.  If the value returned by
51243 GnuTLS is greater than <option>tls_dh_max_bits</option> then the value will be clamped down
51244 to <option>tls_dh_max_bits</option>.  The default value has been set at the current NSS
51245 limit, which is still much higher than Exim historically used.
51246 </para>
51247 <para>
51248 The filename and bits used will change as the GnuTLS maintainers change the
51249 value for their parameter <literal>GNUTLS_SEC_PARAM_NORMAL</literal>, as clamped by
51250 <option>tls_dh_max_bits</option>.  At the time of writing (mid 2012), GnuTLS 2.12 recommends
51251 2432 bits, while NSS is limited to 2236 bits.
51252 </para>
51253 <para>
51254 In fact, the requested value will be *lower* than <option>tls_dh_max_bits</option>, to
51255 increase the chance of the generated prime actually being within acceptable
51256 bounds, as GnuTLS has been observed to overshoot.  Note the check step in the
51257 procedure above.  There is no sane procedure available to Exim to double-check
51258 the size of the generated prime, so it might still be too large.
51259 </para>
51260 </section>
51261 <section id="SECTreqciphssl">
51262 <title>Requiring specific ciphers in OpenSSL</title>
51263 <para>
51264 <indexterm role="concept">
51265 <primary>TLS</primary>
51266 <secondary>requiring specific ciphers (OpenSSL)</secondary>
51267 </indexterm>
51268 <indexterm role="option">
51269 <primary><option>tls_require_ciphers</option></primary>
51270 <secondary>OpenSSL</secondary>
51271 </indexterm>
51272 There is a function in the OpenSSL library that can be passed a list of cipher
51273 suites before the cipher negotiation takes place. This specifies which ciphers
51274 are acceptable. The list is colon separated and may contain names like
51275 DES-CBC3-SHA. Exim passes the expanded value of <option>tls_require_ciphers</option>
51276 directly to this function call.
51277 Many systems will install the OpenSSL manual-pages, so you may have
51278 <emphasis>ciphers(1)</emphasis> available to you.
51279 The following quotation from the OpenSSL
51280 documentation specifies what forms of item are allowed in the cipher string:
51281 </para>
51282 <itemizedlist>
51283 <listitem>
51284 <para>
51285 It can consist of a single cipher suite such as RC4-SHA.
51286 </para>
51287 </listitem>
51288 <listitem>
51289 <para>
51290 It can represent a list of cipher suites containing a certain algorithm,
51291 or cipher suites of a certain type. For example SHA1 represents all
51292 ciphers suites using the digest algorithm SHA1 and SSLv3 represents all
51293 SSL v3 algorithms.
51294 </para>
51295 </listitem>
51296 <listitem>
51297 <para>
51298 Lists of cipher suites can be combined in a single cipher string using
51299 the + character. This is used as a logical and operation. For example
51300 SHA1+DES represents all cipher suites containing the SHA1 and the DES
51301 algorithms.
51302 </para>
51303 </listitem>
51304 </itemizedlist>
51305 <para>
51306 Each cipher string can be optionally preceded by one of the characters <literal>!</literal>,
51307 <literal>-</literal> or <literal>+</literal>.
51308 </para>
51309 <itemizedlist>
51310 <listitem>
51311 <para>
51312 If <literal>!</literal> is used, the ciphers are permanently deleted from the list. The
51313 ciphers deleted can never reappear in the list even if they are explicitly
51314 stated.
51315 </para>
51316 </listitem>
51317 <listitem>
51318 <para>
51319 If <literal>-</literal> is used, the ciphers are deleted from the list, but some or all
51320 of the ciphers can be added again by later options.
51321 </para>
51322 </listitem>
51323 <listitem>
51324 <para>
51325 If <literal>+</literal> is used, the ciphers are moved to the end of the list. This
51326 option does not add any new ciphers; it just moves matching existing ones.
51327 </para>
51328 </listitem>
51329 </itemizedlist>
51330 <para>
51331 If none of these characters is present, the string is interpreted as
51332 a list of ciphers to be appended to the current preference list. If the list
51333 includes any ciphers already present they will be ignored: that is, they will
51334 not be moved to the end of the list.
51335 </para>
51336 <para>
51337 The OpenSSL <emphasis>ciphers(1)</emphasis> command may be used to test the results of a given
51338 string:
51339 </para>
51340 <literallayout class="monospaced">
51341 # note single-quotes to get ! past any shell history expansion
51342 $ openssl ciphers 'HIGH:!MD5:!SHA1'
51343 </literallayout>
51344 <para>
51345 This example will let the library defaults be permitted on the MX port, where
51346 there&#x2019;s probably no identity verification anyway, but ups the ante on the
51347 submission ports where the administrator might have some influence on the
51348 choice of clients used:
51349 </para>
51350 <literallayout class="monospaced">
51351 # OpenSSL variant; see man ciphers(1)
51352 tls_require_ciphers = ${if =={$received_port}{25}\
51353                            {DEFAULT}\
51354                            {HIGH:!MD5:!SHA1}}
51355 </literallayout>
51356 </section>
51357 <section id="SECTreqciphgnu">
51358 <title>Requiring specific ciphers or other parameters in GnuTLS</title>
51359 <para>
51360 <indexterm role="concept">
51361 <primary>GnuTLS</primary>
51362 <secondary>specifying parameters for</secondary>
51363 </indexterm>
51364 <indexterm role="concept">
51365 <primary>TLS</primary>
51366 <secondary>specifying ciphers (GnuTLS)</secondary>
51367 </indexterm>
51368 <indexterm role="concept">
51369 <primary>TLS</primary>
51370 <secondary>specifying key exchange methods (GnuTLS)</secondary>
51371 </indexterm>
51372 <indexterm role="concept">
51373 <primary>TLS</primary>
51374 <secondary>specifying MAC algorithms (GnuTLS)</secondary>
51375 </indexterm>
51376 <indexterm role="concept">
51377 <primary>TLS</primary>
51378 <secondary>specifying protocols (GnuTLS)</secondary>
51379 </indexterm>
51380 <indexterm role="concept">
51381 <primary>TLS</primary>
51382 <secondary>specifying priority string (GnuTLS)</secondary>
51383 </indexterm>
51384 <indexterm role="option">
51385 <primary><option>tls_require_ciphers</option></primary>
51386 <secondary>GnuTLS</secondary>
51387 </indexterm>
51388 The GnuTLS library allows the caller to provide a "priority string", documented
51389 as part of the <function>gnutls_priority_init</function> function.  This is very similar to the
51390 ciphersuite specification in OpenSSL.
51391 </para>
51392 <para>
51393 The <option>tls_require_ciphers</option> option is treated as the GnuTLS priority string
51394 and controls both protocols and ciphers.
51395 </para>
51396 <para>
51397 The <option>tls_require_ciphers</option> option is available both as an global option,
51398 controlling how Exim behaves as a server, and also as an option of the
51399 <command>smtp</command> transport, controlling how Exim behaves as a client.  In both cases
51400 the value is string expanded.  The resulting string is not an Exim list and
51401 the string is given to the GnuTLS library, so that Exim does not need to be
51402 aware of future feature enhancements of GnuTLS.
51403 </para>
51404 <para>
51405 Documentation of the strings accepted may be found in the GnuTLS manual, under
51406 "Priority strings".  This is online as
51407 <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>,
51408 but beware that this relates to GnuTLS 3, which may be newer than the version
51409 installed on your system.  If you are using GnuTLS 3,
51410 <emphasis role="bold"><ulink url="http://www.gnutls.org/manual/gnutls.html#Listing-the-ciphersuites-in-a-priority-string">then the example code</ulink></emphasis>
51411 on that site can be used to test a given string.
51412 </para>
51413 <para>
51414 For example:
51415 </para>
51416 <literallayout class="monospaced">
51417 # Disable older versions of protocols
51418 tls_require_ciphers = NORMAL:%LATEST_RECORD_VERSION:-VERS-SSL3.0
51419 </literallayout>
51420 <para>
51421 Prior to Exim 4.80, an older API of GnuTLS was used, and Exim supported three
51422 additional options, "<option>gnutls_require_kx</option>", "<option>gnutls_require_mac</option>" and
51423 "<option>gnutls_require_protocols</option>".  <option>tls_require_ciphers</option> was an Exim list.
51424 </para>
51425 <para>
51426 This example will let the library defaults be permitted on the MX port, where
51427 there&#x2019;s probably no identity verification anyway, and lowers security further
51428 by increasing compatibility; but this ups the ante on the submission ports
51429 where the administrator might have some influence on the choice of clients
51430 used:
51431 </para>
51432 <literallayout class="monospaced">
51433 # GnuTLS variant
51434 tls_require_ciphers = ${if =={$received_port}{25}\
51435                            {NORMAL:%COMPAT}\
51436                            {SECURE128}}
51437 </literallayout>
51438 </section>
51439 <section id="SECID182">
51440 <title>Configuring an Exim server to use TLS</title>
51441 <para>
51442 <indexterm role="concept">
51443 <primary>TLS</primary>
51444 <secondary>configuring an Exim server</secondary>
51445 </indexterm>
51446 When Exim has been built with TLS support, it advertises the availability of
51447 the STARTTLS command to client hosts that match <option>tls_advertise_hosts</option>,
51448 but not to any others. The default value of this option is unset, which means
51449 that STARTTLS is not advertised at all. This default is chosen because you
51450 need to set some other options in order to make TLS available, and also it is
51451 sensible for systems that want to use TLS only as a client.
51452 </para>
51453 <para>
51454 If a client issues a STARTTLS command and there is some configuration
51455 problem in the server, the command is rejected with a 454 error. If the client
51456 persists in trying to issue SMTP commands, all except QUIT are rejected
51457 with the error
51458 </para>
51459 <literallayout class="monospaced">
51460 554 Security failure
51461 </literallayout>
51462 <para>
51463 If a STARTTLS command is issued within an existing TLS session, it is
51464 rejected with a 554 error code.
51465 </para>
51466 <para>
51467 To enable TLS operations on a server, you must set <option>tls_advertise_hosts</option> to
51468 match some hosts. You can, of course, set it to * to match all hosts.
51469 However, this is not all you need to do. TLS sessions to a server won&#x2019;t work
51470 without some further configuration at the server end.
51471 </para>
51472 <para>
51473 It is rumoured that all existing clients that support TLS/SSL use RSA
51474 encryption. To make this work you need to set, in the server,
51475 </para>
51476 <literallayout class="monospaced">
51477 tls_certificate = /some/file/name
51478 tls_privatekey = /some/file/name
51479 </literallayout>
51480 <para>
51481 These options are, in fact, expanded strings, so you can make them depend on
51482 the identity of the client that is connected if you wish. The first file
51483 contains the server&#x2019;s X509 certificate, and the second contains the private key
51484 that goes with it. These files need to be
51485 PEM format and readable by the Exim user, and must
51486 always be given as full path names.
51487 The key must not be password-protected.
51488 They can be the same file if both the
51489 certificate and the key are contained within it. If <option>tls_privatekey</option> is not
51490 set, or if its expansion is forced to fail or results in an empty string, this
51491 is assumed to be the case. The certificate file may also contain intermediate
51492 certificates that need to be sent to the client to enable it to authenticate
51493 the server&#x2019;s certificate.
51494 </para>
51495 <para>
51496 If you do not understand about certificates and keys, please try to find a
51497 source of this background information, which is not Exim-specific. (There are a
51498 few comments below in section <xref linkend="SECTcerandall"/>.)
51499 </para>
51500 <para>
51501 <emphasis role="bold">Note</emphasis>: These options do not apply when Exim is operating as a client &ndash;
51502 they apply only in the case of a server. If you need to use a certificate in an
51503 Exim client, you must set the options of the same names in an <command>smtp</command>
51504 transport.
51505 </para>
51506 <para>
51507 With just these options, an Exim server will be able to use TLS. It does not
51508 require the client to have a certificate (but see below for how to insist on
51509 this). There is one other option that may be needed in other situations. If
51510 </para>
51511 <literallayout class="monospaced">
51512 tls_dhparam = /some/file/name
51513 </literallayout>
51514 <para>
51515 is set, the SSL library is initialized for the use of Diffie-Hellman ciphers
51516 with the parameters contained in the file.
51517 Set this to <literal>none</literal> to disable use of DH entirely, by making no prime
51518 available:
51519 </para>
51520 <literallayout class="monospaced">
51521 tls_dhparam = none
51522 </literallayout>
51523 <para>
51524 This may also be set to a string identifying a standard prime to be used for
51525 DH; if it is set to <literal>default</literal> or, for OpenSSL, is unset, then the prime
51526 used is <literal>ike23</literal>.  There are a few standard primes available, see the
51527 documentation for <option>tls_dhparam</option> for the complete list.
51528 </para>
51529 <para>
51530 See the command
51531 </para>
51532 <literallayout class="monospaced">
51533 openssl dhparam
51534 </literallayout>
51535 <para>
51536 for a way of generating file data.
51537 </para>
51538 <para>
51539 The strings supplied for these three options are expanded every time a client
51540 host connects. It is therefore possible to use different certificates and keys
51541 for different hosts, if you so wish, by making use of the client&#x2019;s IP address
51542 in <varname>$sender_host_address</varname> to control the expansion. If a string expansion is
51543 forced to fail, Exim behaves as if the option is not set.
51544 </para>
51545 <para>
51546 <indexterm role="concept">
51547 <primary>cipher</primary>
51548 <secondary>logging</secondary>
51549 </indexterm>
51550 <indexterm role="concept">
51551 <primary>log</primary>
51552 <secondary>TLS cipher</secondary>
51553 </indexterm>
51554 <indexterm role="variable">
51555 <primary><varname>$tls_in_cipher</varname></primary>
51556 </indexterm>
51557 The variable <varname>$tls_in_cipher</varname> is set to the cipher suite that was negotiated for
51558 an incoming TLS connection. It is included in the <emphasis>Received:</emphasis> header of an
51559 incoming message (by default &ndash; you can, of course, change this), and it is
51560 also included in the log line that records a message&#x2019;s arrival, keyed by
51561 <quote>X=</quote>, unless the <option>tls_cipher</option> log selector is turned off. The <option>encrypted</option>
51562 condition can be used to test for specific cipher suites in ACLs.
51563 </para>
51564 <para>
51565 Once TLS has been established, the ACLs that run for subsequent SMTP commands
51566 can check the name of the cipher suite and vary their actions accordingly. The
51567 cipher suite names vary, depending on which TLS library is being used. For
51568 example, OpenSSL uses the name DES-CBC3-SHA for the cipher suite which in other
51569 contexts is known as TLS_RSA_WITH_3DES_EDE_CBC_SHA. Check the OpenSSL or GnuTLS
51570 documentation for more details.
51571 </para>
51572 <para>
51573 For outgoing SMTP deliveries, <varname>$tls_out_cipher</varname> is used and logged
51574 (again depending on the <option>tls_cipher</option> log selector).
51575 </para>
51576 </section>
51577 <section id="SECID183">
51578 <title>Requesting and verifying client certificates</title>
51579 <para>
51580 <indexterm role="concept">
51581 <primary>certificate</primary>
51582 <secondary>verification of client</secondary>
51583 </indexterm>
51584 <indexterm role="concept">
51585 <primary>TLS</primary>
51586 <secondary>client certificate verification</secondary>
51587 </indexterm>
51588 If you want an Exim server to request a certificate when negotiating a TLS
51589 session with a client, you must set either <option>tls_verify_hosts</option> or
51590 <option>tls_try_verify_hosts</option>. You can, of course, set either of them to * to
51591 apply to all TLS connections. For any host that matches one of these options,
51592 Exim requests a certificate as part of the setup of the TLS session. The
51593 contents of the certificate are verified by comparing it with a list of
51594 expected certificates.
51595 </para>
51596 <para revisionflag="changed">
51597 These may be the system default set (depending on library version),
51598 </para>
51599 <para>
51600 an explicit file or,
51601 depending on library version, a directory, identified by
51602 <option>tls_verify_certificates</option>.
51603 </para>
51604 <para>
51605 A file can contain multiple certificates, concatenated end to end. If a
51606 directory is used
51607 (OpenSSL only),
51608 each certificate must be in a separate file, with a name (or a symbolic link)
51609 of the form &lt;<emphasis>hash</emphasis>&gt;.0, where &lt;<emphasis>hash</emphasis>&gt; is a hash value constructed from the
51610 certificate. You can compute the relevant hash by running the command
51611 </para>
51612 <literallayout class="monospaced">
51613 openssl x509 -hash -noout -in /cert/file
51614 </literallayout>
51615 <para>
51616 where <filename>/cert/file</filename> contains a single certificate.
51617 </para>
51618 <para>
51619 The difference between <option>tls_verify_hosts</option> and <option>tls_try_verify_hosts</option> is
51620 what happens if the client does not supply a certificate, or if the certificate
51621 does not match any of the certificates in the collection named by
51622 <option>tls_verify_certificates</option>. If the client matches <option>tls_verify_hosts</option>, the
51623 attempt to set up a TLS session is aborted, and the incoming connection is
51624 dropped. If the client matches <option>tls_try_verify_hosts</option>, the (encrypted) SMTP
51625 session continues. ACLs that run for subsequent SMTP commands can detect the
51626 fact that no certificate was verified, and vary their actions accordingly. For
51627 example, you can insist on a certificate before accepting a message for
51628 relaying, but not when the message is destined for local delivery.
51629 </para>
51630 <para>
51631 <indexterm role="variable">
51632 <primary><varname>$tls_in_peerdn</varname></primary>
51633 </indexterm>
51634 When a client supplies a certificate (whether it verifies or not), the value of
51635 the Distinguished Name of the certificate is made available in the variable
51636 <varname>$tls_in_peerdn</varname> during subsequent processing of the message.
51637 </para>
51638 <para>
51639 <indexterm role="concept">
51640 <primary>log</primary>
51641 <secondary>distinguished name</secondary>
51642 </indexterm>
51643 Because it is often a long text string, it is not included in the log line or
51644 <emphasis>Received:</emphasis> header by default. You can arrange for it to be logged, keyed by
51645 <quote>DN=</quote>, by setting the <option>tls_peerdn</option> log selector, and you can use
51646 <option>received_header_text</option> to change the <emphasis>Received:</emphasis> header. When no
51647 certificate is supplied, <varname>$tls_in_peerdn</varname> is empty.
51648 </para>
51649 </section>
51650 <section id="SECID184">
51651 <title>Revoked certificates</title>
51652 <para>
51653 <indexterm role="concept">
51654 <primary>TLS</primary>
51655 <secondary>revoked certificates</secondary>
51656 </indexterm>
51657 <indexterm role="concept">
51658 <primary>revocation list</primary>
51659 </indexterm>
51660 <indexterm role="concept">
51661 <primary>certificate</primary>
51662 <secondary>revocation list</secondary>
51663 </indexterm>
51664 <indexterm role="concept">
51665 <primary>OCSP</primary>
51666 <secondary>stapling</secondary>
51667 </indexterm>
51668 Certificate issuing authorities issue Certificate Revocation Lists (CRLs) when
51669 certificates are revoked. If you have such a list, you can pass it to an Exim
51670 server using the global option called <option>tls_crl</option> and to an Exim client using
51671 an identically named option for the <command>smtp</command> transport. In each case, the value
51672 of the option is expanded and must then be the name of a file that contains a
51673 CRL in PEM format.
51674 The downside is that clients have to periodically re-download a potentially huge
51675 file from every certificate authority they know of.
51676 </para>
51677 <para>
51678 The way with most moving parts at query time is Online Certificate
51679 Status Protocol (OCSP), where the client verifies the certificate
51680 against an OCSP server run by the CA.  This lets the CA track all
51681 usage of the certs.  It requires running software with access to the
51682 private key of the CA, to sign the responses to the OCSP queries.  OCSP
51683 is based on HTTP and can be proxied accordingly.
51684 </para>
51685 <para>
51686 The only widespread OCSP server implementation (known to this writer)
51687 comes as part of OpenSSL and aborts on an invalid request, such as
51688 connecting to the port and then disconnecting.  This requires
51689 re-entering the passphrase each time some random client does this.
51690 </para>
51691 <para>
51692 The third way is OCSP Stapling; in this, the server using a certificate
51693 issued by the CA periodically requests an OCSP proof of validity from
51694 the OCSP server, then serves it up inline as part of the TLS
51695 negotiation.   This approach adds no extra round trips, does not let the
51696 CA track users, scales well with number of certs issued by the CA and is
51697 resilient to temporary OCSP server failures, as long as the server
51698 starts retrying to fetch an OCSP proof some time before its current
51699 proof expires.  The downside is that it requires server support.
51700 </para>
51701 <para>
51702 Unless Exim is built with the support disabled,
51703 or with GnuTLS earlier than version 3.1.3,
51704 support for OCSP stapling is included.
51705 </para>
51706 <para>
51707 There is a global option called <option>tls_ocsp_file</option>.
51708 The file specified therein is expected to be in DER format, and contain
51709 an OCSP proof.  Exim will serve it as part of the TLS handshake.  This
51710 option will be re-expanded for SNI, if the <option>tls_certificate</option> option
51711 contains <literal>tls_in_sni</literal>, as per other TLS options.
51712 </para>
51713 <para>
51714 Exim does not at this time implement any support for fetching a new OCSP
51715 proof.  The burden is on the administrator to handle this, outside of
51716 Exim.  The file specified should be replaced atomically, so that the
51717 contents are always valid.  Exim will expand the <option>tls_ocsp_file</option> option
51718 on each connection, so a new file will be handled transparently on the
51719 next connection.
51720 </para>
51721 <para>
51722 When built with OpenSSL Exim will check for a valid next update timestamp
51723 in the OCSP proof; if not present, or if the proof has expired, it will be
51724 ignored.
51725 </para>
51726 <para>
51727 For the client to be able to verify the stapled OCSP the server must
51728 also supply, in its stapled information, any intermediate
51729 certificates for the chain leading to the OCSP proof from the signer
51730 of the server certificate.  There may be zero or one such. These
51731 intermediate certificates should be added to the server OCSP stapling
51732 file named by <option>tls_ocsp_file</option>.
51733 </para>
51734 <para>
51735 Note that the proof only covers the terminal server certificate,
51736 not any of the chain from CA to it.
51737 </para>
51738 <para>
51739 There is no current way to staple a proof for a client certificate.
51740 </para>
51741 <literallayout class="monospaced">
51742   A helper script "ocsp_fetch.pl" for fetching a proof from a CA
51743   OCSP server is supplied.  The server URL may be included in the
51744   server certificate, if the CA is helpful.
51745
51746   One failure mode seen was the OCSP Signer cert expiring before the end
51747   of validity of the OCSP proof. The checking done by Exim/OpenSSL
51748   noted this as invalid overall, but the re-fetch script did not.
51749 </literallayout>
51750 </section>
51751 <section id="SECID185">
51752 <title>Configuring an Exim client to use TLS</title>
51753 <para>
51754 <indexterm role="concept">
51755 <primary>cipher</primary>
51756 <secondary>logging</secondary>
51757 </indexterm>
51758 <indexterm role="concept">
51759 <primary>log</primary>
51760 <secondary>TLS cipher</secondary>
51761 </indexterm>
51762 <indexterm role="concept">
51763 <primary>log</primary>
51764 <secondary>distinguished name</secondary>
51765 </indexterm>
51766 <indexterm role="concept">
51767 <primary>TLS</primary>
51768 <secondary>configuring an Exim client</secondary>
51769 </indexterm>
51770 The <option>tls_cipher</option> and <option>tls_peerdn</option> log selectors apply to outgoing SMTP
51771 deliveries as well as to incoming, the latter one causing logging of the
51772 server certificate&#x2019;s DN. The remaining client configuration for TLS is all
51773 within the <command>smtp</command> transport.
51774 </para>
51775 <para>
51776 It is not necessary to set any options to have TLS work in the <command>smtp</command>
51777 transport. If Exim is built with TLS support, and TLS is advertised by a
51778 server, the <command>smtp</command> transport always tries to start a TLS session. However,
51779 this can be prevented by setting <option>hosts_avoid_tls</option> (an option of the
51780 transport) to a list of server hosts for which TLS should not be used.
51781 </para>
51782 <para>
51783 If you do not want Exim to attempt to send messages unencrypted when an attempt
51784 to set up an encrypted connection fails in any way, you can set
51785 <option>hosts_require_tls</option> to a list of hosts for which encryption is mandatory. For
51786 those hosts, delivery is always deferred if an encrypted connection cannot be
51787 set up. If there are any other hosts for the address, they are tried in the
51788 usual way.
51789 </para>
51790 <para>
51791 When the server host is not in <option>hosts_require_tls</option>, Exim may try to deliver
51792 the message unencrypted. It always does this if the response to STARTTLS is
51793 a 5<emphasis>xx</emphasis> code. For a temporary error code, or for a failure to negotiate a TLS
51794 session after a success response code, what happens is controlled by the
51795 <option>tls_tempfail_tryclear</option> option of the <command>smtp</command> transport. If it is false,
51796 delivery to this host is deferred, and other hosts (if available) are tried. If
51797 it is true, Exim attempts to deliver unencrypted after a 4<emphasis>xx</emphasis> response to
51798 STARTTLS, and if STARTTLS is accepted, but the subsequent TLS
51799 negotiation fails, Exim closes the current connection (because it is in an
51800 unknown state), opens a new one to the same host, and then tries the delivery
51801 unencrypted.
51802 </para>
51803 <para>
51804 The <option>tls_certificate</option> and <option>tls_privatekey</option> options of the <command>smtp</command>
51805 transport provide the client with a certificate, which is passed to the server
51806 if it requests it. If the server is Exim, it will request a certificate only if
51807 <option>tls_verify_hosts</option> or <option>tls_try_verify_hosts</option> matches the client.
51808 </para>
51809 <para>
51810 If the <option>tls_verify_certificates</option> option is set on the <command>smtp</command> transport, it
51811 specifies a collection of expected server certificates.
51812 </para>
51813 <para revisionflag="changed">
51814 These may be the system default set (depending on library version),
51815 </para>
51816 <para>
51817 a file or,
51818 depending on library version, a directory,
51819 must name a file or,
51820 for OpenSSL only (not GnuTLS), a directory.
51821 The client verifies the server&#x2019;s certificate
51822 against this collection, taking into account any revoked certificates that are
51823 in the list defined by <option>tls_crl</option>.
51824 Failure to verify fails the TLS connection unless either of the
51825 <option>tls_verify_hosts</option> or <option>tls_try_verify_hosts</option> options are set.
51826 </para>
51827 <para>
51828 The <option>tls_verify_hosts</option> and <option>tls_try_verify_hosts</option> options restrict
51829 certificate verification to the listed servers.  Verification either must
51830 or need not succeed respectively.
51831 </para>
51832 <para>
51833 The <command>smtp</command> transport has two OCSP-related options:
51834 <option>hosts_require_ocsp</option>; a host-list for which a Certificate Status
51835 is requested and required for the connection to proceed.  The default
51836 value is empty.
51837 <option>hosts_request_ocsp</option>; a host-list for which (additionally)
51838 a Certificate Status is requested (but not necessarily verified).  The default
51839 value is "*" meaning that requests are made unless configured
51840 otherwise.
51841 </para>
51842 <para>
51843 The host(s) should also be in <option>hosts_require_tls</option>, and
51844 <option>tls_verify_certificates</option> configured for the transport,
51845 for OCSP to be relevant.
51846 </para>
51847 <para>
51848 If
51849 <option>tls_require_ciphers</option> is set on the <command>smtp</command> transport, it must contain a
51850 list of permitted cipher suites. If either of these checks fails, delivery to
51851 the current host is abandoned, and the <command>smtp</command> transport tries to deliver to
51852 alternative hosts, if any.
51853 </para>
51854 <para>
51855  <emphasis role="bold">Note</emphasis>:
51856 These options must be set in the <command>smtp</command> transport for Exim to use TLS when it
51857 is operating as a client. Exim does not assume that a server certificate (set
51858 by the global options of the same name) should also be used when operating as a
51859 client.
51860 </para>
51861 <para>
51862 <indexterm role="variable">
51863 <primary><varname>$host</varname></primary>
51864 </indexterm>
51865 <indexterm role="variable">
51866 <primary><varname>$host_address</varname></primary>
51867 </indexterm>
51868 All the TLS options in the <command>smtp</command> transport are expanded before use, with
51869 <varname>$host</varname> and <varname>$host_address</varname> containing the name and address of the server to
51870 which the client is connected. Forced failure of an expansion causes Exim to
51871 behave as if the relevant option were unset.
51872 </para>
51873 <para>
51874 <indexterm role="variable">
51875 <primary><varname>$tls_out_bits</varname></primary>
51876 </indexterm>
51877 <indexterm role="variable">
51878 <primary><varname>$tls_out_cipher</varname></primary>
51879 </indexterm>
51880 <indexterm role="variable">
51881 <primary><varname>$tls_out_peerdn</varname></primary>
51882 </indexterm>
51883 <indexterm role="variable">
51884 <primary><varname>$tls_out_sni</varname></primary>
51885 </indexterm>
51886 Before an SMTP connection is established, the
51887 <varname>$tls_out_bits</varname>, <varname>$tls_out_cipher</varname>, <varname>$tls_out_peerdn</varname> and <varname>$tls_out_sni</varname>
51888 variables are emptied. (Until the first connection, they contain the values
51889 that were set when the message was received.) If STARTTLS is subsequently
51890 successfully obeyed, these variables are set to the relevant values for the
51891 outgoing connection.
51892 </para>
51893 </section>
51894 <section id="SECTtlssni">
51895 <title>Use of TLS Server Name Indication</title>
51896 <para>
51897 <indexterm role="concept">
51898 <primary>TLS</primary>
51899 <secondary>Server Name Indication</secondary>
51900 </indexterm>
51901 <indexterm role="variable">
51902 <primary><varname>$tls_in_sni</varname></primary>
51903 </indexterm>
51904 <indexterm role="option">
51905 <primary><option>tls_in_sni</option></primary>
51906 </indexterm>
51907 With TLS1.0 or above, there is an extension mechanism by which extra
51908 information can be included at various points in the protocol.  One of these
51909 extensions, documented in RFC 6066 (and before that RFC 4366) is
51910 <quote>Server Name Indication</quote>, commonly <quote>SNI</quote>.  This extension is sent by the
51911 client in the initial handshake, so that the server can examine the servername
51912 within and possibly choose to use different certificates and keys (and more)
51913 for this session.
51914 </para>
51915 <para>
51916 This is analogous to HTTP&#x2019;s <quote>Host:</quote> header, and is the main mechanism by
51917 which HTTPS-enabled web-sites can be virtual-hosted, many sites to one IP
51918 address.
51919 </para>
51920 <para>
51921 With SMTP to MX, there are the same problems here as in choosing the identity
51922 against which to validate a certificate: you can&#x2019;t rely on insecure DNS to
51923 provide the identity which you then cryptographically verify.  So this will
51924 be of limited use in that environment.
51925 </para>
51926 <para>
51927 With SMTP to Submission, there is a well-defined hostname which clients are
51928 connecting to and can validate certificates against.  Thus clients <emphasis role="bold">can</emphasis>
51929 choose to include this information in the TLS negotiation.  If this becomes
51930 wide-spread, then hosters can choose to present different certificates to
51931 different clients.  Or even negotiate different cipher suites.
51932 </para>
51933 <para>
51934 The <option>tls_sni</option> option on an SMTP transport is an expanded string; the result,
51935 if not empty, will be sent on a TLS session as part of the handshake.  There&#x2019;s
51936 nothing more to it.  Choosing a sensible value not derived insecurely is the
51937 only point of caution.  The <varname>$tls_out_sni</varname> variable will be set to this string
51938 for the lifetime of the client connection (including during authentication).
51939 </para>
51940 <para>
51941 Except during SMTP client sessions, if <varname>$tls_in_sni</varname> is set then it is a string
51942 received from a client.
51943 It can be logged with the <option>log_selector</option> item <literal>+tls_sni</literal>.
51944 </para>
51945 <para>
51946 If the string <literal>tls_in_sni</literal> appears in the main section&#x2019;s <option>tls_certificate</option>
51947 option (prior to expansion) then the following options will be re-expanded
51948 during TLS session handshake, to permit alternative values to be chosen:
51949 </para>
51950 <itemizedlist>
51951 <listitem>
51952 <para>
51953 <indexterm role="variable">
51954 <primary><option>tls_certificate</option></primary>
51955 </indexterm>
51956 <option>tls_certificate</option>
51957 </para>
51958 </listitem>
51959 <listitem>
51960 <para>
51961 <indexterm role="variable">
51962 <primary><option>tls_crl</option></primary>
51963 </indexterm>
51964 <option>tls_crl</option>
51965 </para>
51966 </listitem>
51967 <listitem>
51968 <para>
51969 <indexterm role="variable">
51970 <primary><option>tls_privatekey</option></primary>
51971 </indexterm>
51972 <option>tls_privatekey</option>
51973 </para>
51974 </listitem>
51975 <listitem>
51976 <para>
51977 <indexterm role="variable">
51978 <primary><option>tls_verify_certificates</option></primary>
51979 </indexterm>
51980 <option>tls_verify_certificates</option>
51981 </para>
51982 </listitem>
51983 <listitem>
51984 <para>
51985 <indexterm role="variable">
51986 <primary><option>tls_ocsp_file</option></primary>
51987 </indexterm>
51988 <option>tls_ocsp_file</option>
51989 </para>
51990 </listitem>
51991 </itemizedlist>
51992 <para>
51993 Great care should be taken to deal with matters of case, various injection
51994 attacks in the string (<literal>../</literal> or SQL), and ensuring that a valid filename
51995 can always be referenced; it is important to remember that <varname>$tls_sni</varname> is
51996 arbitrary unverified data provided prior to authentication.
51997 </para>
51998 <para>
51999 The Exim developers are proceeding cautiously and so far no other TLS options
52000 are re-expanded.
52001 </para>
52002 <para>
52003 When Exim is built against OpenSSL, OpenSSL must have been built with support
52004 for TLS Extensions.  This holds true for OpenSSL 1.0.0+ and 0.9.8+ with
52005 enable-tlsext in EXTRACONFIGURE.  If you invoke <command>openssl s_client -h</command> and
52006 see <literal>-servername</literal> in the output, then OpenSSL has support.
52007 </para>
52008 <para>
52009 When Exim is built against GnuTLS, SNI support is available as of GnuTLS
52010 0.5.10.  (Its presence predates the current API which Exim uses, so if Exim
52011 built, then you have SNI support).
52012 </para>
52013 </section>
52014 <section id="SECTmulmessam">
52015 <title>Multiple messages on the same encrypted TCP/IP connection</title>
52016 <para>
52017 <indexterm role="concept">
52018 <primary>multiple SMTP deliveries with TLS</primary>
52019 </indexterm>
52020 <indexterm role="concept">
52021 <primary>TLS</primary>
52022 <secondary>multiple message deliveries</secondary>
52023 </indexterm>
52024 Exim sends multiple messages down the same TCP/IP connection by starting up
52025 an entirely new delivery process for each message, passing the socket from
52026 one process to the next. This implementation does not fit well with the use
52027 of TLS, because there is quite a lot of state information associated with a TLS
52028 connection, not just a socket identification. Passing all the state information
52029 to a new process is not feasible. Consequently, Exim shuts down an existing TLS
52030 session before passing the socket to a new process. The new process may then
52031 try to start a new TLS session, and if successful, may try to re-authenticate
52032 if AUTH is in use, before sending the next message.
52033 </para>
52034 <para>
52035 The RFC is not clear as to whether or not an SMTP session continues in clear
52036 after TLS has been shut down, or whether TLS may be restarted again later, as
52037 just described. However, if the server is Exim, this shutdown and
52038 reinitialization works. It is not known which (if any) other servers operate
52039 successfully if the client closes a TLS session and continues with unencrypted
52040 SMTP, but there are certainly some that do not work. For such servers, Exim
52041 should not pass the socket to another process, because the failure of the
52042 subsequent attempt to use it would cause Exim to record a temporary host error,
52043 and delay other deliveries to that host.
52044 </para>
52045 <para>
52046 To test for this case, Exim sends an EHLO command to the server after
52047 closing down the TLS session. If this fails in any way, the connection is
52048 closed instead of being passed to a new delivery process, but no retry
52049 information is recorded.
52050 </para>
52051 <para>
52052 There is also a manual override; you can set <option>hosts_nopass_tls</option> on the
52053 <command>smtp</command> transport to match those hosts for which Exim should not pass
52054 connections to new processes if TLS has been used.
52055 </para>
52056 </section>
52057 <section id="SECTcerandall">
52058 <title>Certificates and all that</title>
52059 <para>
52060 <indexterm role="concept">
52061 <primary>certificate</primary>
52062 <secondary>references to discussion</secondary>
52063 </indexterm>
52064 In order to understand fully how TLS works, you need to know about
52065 certificates, certificate signing, and certificate authorities. This is not the
52066 place to give a tutorial, especially as I do not know very much about it
52067 myself. Some helpful introduction can be found in the FAQ for the SSL addition
52068 to Apache, currently at
52069 </para>
52070 <literallayout>
52071 <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>
52072 </literallayout>
52073 <para>
52074 Other parts of the <emphasis>modssl</emphasis> documentation are also helpful, and have
52075 links to further files.
52076 Eric Rescorla&#x2019;s book, <emphasis>SSL and TLS</emphasis>, published by Addison-Wesley (ISBN
52077 0-201-61598-3), contains both introductory and more in-depth descriptions.
52078 Some sample programs taken from the book are available from
52079 </para>
52080 <literallayout>
52081 <emphasis role="bold"><ulink url="http://www.rtfm.com/openssl-examples/">http://www.rtfm.com/openssl-examples/</ulink></emphasis>
52082 </literallayout>
52083 </section>
52084 <section id="SECID186">
52085 <title>Certificate chains</title>
52086 <para>
52087 The file named by <option>tls_certificate</option> may contain more than one
52088 certificate. This is useful in the case where the certificate that is being
52089 sent is validated by an intermediate certificate which the other end does
52090 not have. Multiple certificates must be in the correct order in the file.
52091 First the host&#x2019;s certificate itself, then the first intermediate
52092 certificate to validate the issuer of the host certificate, then the next
52093 intermediate certificate to validate the issuer of the first intermediate
52094 certificate, and so on, until finally (optionally) the root certificate.
52095 The root certificate must already be trusted by the recipient for
52096 validation to succeed, of course, but if it&#x2019;s not preinstalled, sending the
52097 root certificate along with the rest makes it available for the user to
52098 install if the receiving end is a client MUA that can interact with a user.
52099 </para>
52100 <para>
52101 Note that certificates using MD5 are unlikely to work on today&#x2019;s Internet;
52102 even if your libraries allow loading them for use in Exim when acting as a
52103 server, increasingly clients will not accept such certificates.  The error
52104 diagnostics in such a case can be frustratingly vague.
52105 </para>
52106 </section>
52107 <section id="SECID187">
52108 <title>Self-signed certificates</title>
52109 <para>
52110 <indexterm role="concept">
52111 <primary>certificate</primary>
52112 <secondary>self-signed</secondary>
52113 </indexterm>
52114 You can create a self-signed certificate using the <emphasis>req</emphasis> command provided
52115 with OpenSSL, like this:
52116 </para>
52117 <literallayout class="monospaced">
52118 openssl req -x509 -newkey rsa:1024 -keyout file1 -out file2 \
52119             -days 9999 -nodes
52120 </literallayout>
52121 <para>
52122 <filename>file1</filename> and <filename>file2</filename> can be the same file; the key and the certificate are
52123 delimited and so can be identified independently. The <option>-days</option> option
52124 specifies a period for which the certificate is valid. The <option>-nodes</option> option is
52125 important: if you do not set it, the key is encrypted with a passphrase
52126 that you are prompted for, and any use that is made of the key causes more
52127 prompting for the passphrase. This is not helpful if you are going to use
52128 this certificate and key in an MTA, where prompting is not possible.
52129 </para>
52130 <para>
52131 NB: we are now past the point where 9999 days takes us past the 32-bit Unix
52132 epoch.  If your system uses unsigned time_t (most do) and is 32-bit, then
52133 the above command might produce a date in the past.  Think carefully about
52134 the lifetime of the systems you&#x2019;re deploying, and either reduce the duration
52135 of the certificate or reconsider your platform deployment.  (At time of
52136 writing, reducing the duration is the most likely choice, but the inexorable
52137 progression of time takes us steadily towards an era where this will not
52138 be a sensible resolution).
52139 </para>
52140 <para>
52141 A self-signed certificate made in this way is sufficient for testing, and
52142 may be adequate for all your requirements if you are mainly interested in
52143 encrypting transfers, and not in secure identification.
52144 </para>
52145 <para>
52146 However, many clients require that the certificate presented by the server be a
52147 user (also called <quote>leaf</quote> or <quote>site</quote>) certificate, and not a self-signed
52148 certificate. In this situation, the self-signed certificate described above
52149 must be installed on the client host as a trusted root <emphasis>certification
52150 authority</emphasis> (CA), and the certificate used by Exim must be a user certificate
52151 signed with that self-signed certificate.
52152 </para>
52153 <para>
52154 For information on creating self-signed CA certificates and using them to sign
52155 user certificates, see the <emphasis>General implementation overview</emphasis> chapter of the
52156 Open-source PKI book, available online at
52157 <emphasis role="bold"><ulink url="http://ospkibook.sourceforge.net/">http://ospkibook.sourceforge.net/</ulink></emphasis>.
52158 <indexterm role="concept" startref="IIDencsmtp1" class="endofrange"/>
52159 <indexterm role="concept" startref="IIDencsmtp2" class="endofrange"/>
52160 </para>
52161 </section>
52162 </chapter>
52163
52164 <chapter id="CHAPACL">
52165 <title>Access control lists</title>
52166 <para>
52167 <indexterm role="concept" id="IIDacl" class="startofrange">
52168 <primary>access control lists (ACLs)</primary>
52169 <secondary>description</secondary>
52170 </indexterm>
52171 <indexterm role="concept">
52172 <primary>control of incoming mail</primary>
52173 </indexterm>
52174 <indexterm role="concept">
52175 <primary>message</primary>
52176 <secondary>controlling incoming</secondary>
52177 </indexterm>
52178 <indexterm role="concept">
52179 <primary>policy control</primary>
52180 <secondary>access control lists</secondary>
52181 </indexterm>
52182 Access Control Lists (ACLs) are defined in a separate section of the run time
52183 configuration file, headed by <quote>begin acl</quote>. Each ACL definition starts with a
52184 name, terminated by a colon. Here is a complete ACL section that contains just
52185 one very small ACL:
52186 </para>
52187 <literallayout class="monospaced">
52188 begin acl
52189 small_acl:
52190   accept   hosts = one.host.only
52191 </literallayout>
52192 <para>
52193 You can have as many lists as you like in the ACL section, and the order in
52194 which they appear does not matter. The lists are self-terminating.
52195 </para>
52196 <para>
52197 The majority of ACLs are used to control Exim&#x2019;s behaviour when it receives
52198 certain SMTP commands. This applies both to incoming TCP/IP connections, and
52199 when a local process submits a message using SMTP by specifying the <option>-bs</option>
52200 option. The most common use is for controlling which recipients are accepted
52201 in incoming messages. In addition, you can define an ACL that is used to check
52202 local non-SMTP messages. The default configuration file contains an example of
52203 a realistic ACL for checking RCPT commands. This is discussed in chapter
52204 <xref linkend="CHAPdefconfil"/>.
52205 </para>
52206 <section id="SECID188">
52207 <title>Testing ACLs</title>
52208 <para>
52209 The <option>-bh</option> command line option provides a way of testing your ACL
52210 configuration locally by running a fake SMTP session with which you interact.
52211 The host <emphasis>relay-test.mail-abuse.org</emphasis> provides a service for checking your
52212 relaying configuration (see section <xref linkend="SECTcheralcon"/> for more details).
52213 </para>
52214 </section>
52215 <section id="SECID189">
52216 <title>Specifying when ACLs are used</title>
52217 <para>
52218 <indexterm role="concept">
52219 <primary>access control lists (ACLs)</primary>
52220 <secondary>options for specifying</secondary>
52221 </indexterm>
52222 In order to cause an ACL to be used, you have to name it in one of the relevant
52223 options in the main part of the configuration. These options are:
52224 <indexterm role="concept">
52225 <primary>AUTH</primary>
52226 <secondary>ACL for</secondary>
52227 </indexterm>
52228 <indexterm role="concept">
52229 <primary>DATA</primary>
52230 <secondary>ACLs for</secondary>
52231 </indexterm>
52232 <indexterm role="concept">
52233 <primary>ETRN</primary>
52234 <secondary>ACL for</secondary>
52235 </indexterm>
52236 <indexterm role="concept">
52237 <primary>EXPN</primary>
52238 <secondary>ACL for</secondary>
52239 </indexterm>
52240 <indexterm role="concept">
52241 <primary>HELO</primary>
52242 <secondary>ACL for</secondary>
52243 </indexterm>
52244 <indexterm role="concept">
52245 <primary>EHLO</primary>
52246 <secondary>ACL for</secondary>
52247 </indexterm>
52248 <indexterm role="concept">
52249 <primary>DKIM</primary>
52250 <secondary>ACL for</secondary>
52251 </indexterm>
52252 <indexterm role="concept">
52253 <primary>MAIL</primary>
52254 <secondary>ACL for</secondary>
52255 </indexterm>
52256 <indexterm role="concept">
52257 <primary>QUIT, ACL for</primary>
52258 </indexterm>
52259 <indexterm role="concept">
52260 <primary>RCPT</primary>
52261 <secondary>ACL for</secondary>
52262 </indexterm>
52263 <indexterm role="concept">
52264 <primary>STARTTLS, ACL for</primary>
52265 </indexterm>
52266 <indexterm role="concept">
52267 <primary>VRFY</primary>
52268 <secondary>ACL for</secondary>
52269 </indexterm>
52270 <indexterm role="concept">
52271 <primary>SMTP</primary>
52272 <secondary>connection, ACL for</secondary>
52273 </indexterm>
52274 <indexterm role="concept">
52275 <primary>non-SMTP messages</primary>
52276 <secondary>ACLs for</secondary>
52277 </indexterm>
52278 <indexterm role="concept">
52279 <primary>MIME content scanning</primary>
52280 <secondary>ACL for</secondary>
52281 </indexterm>
52282 <indexterm role="concept">
52283 <primary>PRDR</primary>
52284 <secondary>ACL for</secondary>
52285 </indexterm>
52286 </para>
52287 <informaltable frame="none">
52288 <tgroup cols="2" colsep="0" rowsep="0">
52289 <colspec colwidth="140pt" align="left"/>
52290 <colspec colwidth="254pt" align="left"/>
52291 <tbody>
52292 <row>
52293 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<option>acl_not_smtp</option></entry>
52294 <entry>ACL for non-SMTP messages</entry>
52295 </row>
52296 <row>
52297 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<option>acl_not_smtp_mime</option></entry>
52298 <entry>ACL for non-SMTP MIME parts</entry>
52299 </row>
52300 <row>
52301 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<option>acl_not_smtp_start</option></entry>
52302 <entry>ACL at start of non-SMTP message</entry>
52303 </row>
52304 <row>
52305 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<option>acl_smtp_auth</option></entry>
52306 <entry>ACL for AUTH</entry>
52307 </row>
52308 <row>
52309 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<option>acl_smtp_connect</option></entry>
52310 <entry>ACL for start of SMTP connection</entry>
52311 </row>
52312 <row>
52313 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<option>acl_smtp_data</option></entry>
52314 <entry>ACL after DATA is complete</entry>
52315 </row>
52316 <row>
52317 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<option>acl_smtp_data_prdr</option></entry>
52318 <entry>ACL for each recipient, after DATA is complete</entry>
52319 </row>
52320 <row>
52321 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<option>acl_smtp_dkim</option></entry>
52322 <entry>ACL for each DKIM signer</entry>
52323 </row>
52324 <row>
52325 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<option>acl_smtp_etrn</option></entry>
52326 <entry>ACL for ETRN</entry>
52327 </row>
52328 <row>
52329 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<option>acl_smtp_expn</option></entry>
52330 <entry>ACL for EXPN</entry>
52331 </row>
52332 <row>
52333 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<option>acl_smtp_helo</option></entry>
52334 <entry>ACL for HELO or EHLO</entry>
52335 </row>
52336 <row>
52337 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<option>acl_smtp_mail</option></entry>
52338 <entry>ACL for MAIL</entry>
52339 </row>
52340 <row>
52341 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<option>acl_smtp_mailauth</option></entry>
52342 <entry>ACL for the AUTH parameter of MAIL</entry>
52343 </row>
52344 <row>
52345 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<option>acl_smtp_mime</option></entry>
52346 <entry>ACL for content-scanning MIME parts</entry>
52347 </row>
52348 <row>
52349 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<option>acl_smtp_notquit</option></entry>
52350 <entry>ACL for non-QUIT terminations</entry>
52351 </row>
52352 <row>
52353 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<option>acl_smtp_predata</option></entry>
52354 <entry>ACL at start of DATA command</entry>
52355 </row>
52356 <row>
52357 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<option>acl_smtp_quit</option></entry>
52358 <entry>ACL for QUIT</entry>
52359 </row>
52360 <row>
52361 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<option>acl_smtp_rcpt</option></entry>
52362 <entry>ACL for RCPT</entry>
52363 </row>
52364 <row>
52365 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<option>acl_smtp_starttls</option></entry>
52366 <entry>ACL for STARTTLS</entry>
52367 </row>
52368 <row>
52369 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<option>acl_smtp_vrfy</option></entry>
52370 <entry>ACL for VRFY</entry>
52371 </row>
52372 </tbody>
52373 </tgroup>
52374 </informaltable>
52375 <para>
52376 For example, if you set
52377 </para>
52378 <literallayout class="monospaced">
52379 acl_smtp_rcpt = small_acl
52380 </literallayout>
52381 <para>
52382 the little ACL defined above is used whenever Exim receives a RCPT command
52383 in an SMTP dialogue. The majority of policy tests on incoming messages can be
52384 done when RCPT commands arrive. A rejection of RCPT should cause the
52385 sending MTA to give up on the recipient address contained in the RCPT
52386 command, whereas rejection at other times may cause the client MTA to keep on
52387 trying to deliver the message. It is therefore recommended that you do as much
52388 testing as possible at RCPT time.
52389 </para>
52390 </section>
52391 <section id="SECID190">
52392 <title>The non-SMTP ACLs</title>
52393 <para>
52394 <indexterm role="concept">
52395 <primary>non-SMTP messages</primary>
52396 <secondary>ACLs for</secondary>
52397 </indexterm>
52398 The non-SMTP ACLs apply to all non-interactive incoming messages, that is, they
52399 apply to batched SMTP as well as to non-SMTP messages. (Batched SMTP is not
52400 really SMTP.) Many of the ACL conditions (for example, host tests, and tests on
52401 the state of the SMTP connection such as encryption and authentication) are not
52402 relevant and are forbidden in these ACLs. However, the sender and recipients
52403 are known, so the <option>senders</option> and <option>sender_domains</option> conditions and the
52404 <varname>$sender_address</varname> and <varname>$recipients</varname> variables can be used. Variables such as
52405 <varname>$authenticated_sender</varname> are also available. You can specify added header lines
52406 in any of these ACLs.
52407 </para>
52408 <para>
52409 The <option>acl_not_smtp_start</option> ACL is run right at the start of receiving a
52410 non-SMTP message, before any of the message has been read. (This is the
52411 analogue of the <option>acl_smtp_predata</option> ACL for SMTP input.) In the case of
52412 batched SMTP input, it runs after the DATA command has been reached. The
52413 result of this ACL is ignored; it cannot be used to reject a message. If you
52414 really need to, you could set a value in an ACL variable here and reject based
52415 on that in the <option>acl_not_smtp</option> ACL. However, this ACL can be used to set
52416 controls, and in particular, it can be used to set
52417 </para>
52418 <literallayout class="monospaced">
52419 control = suppress_local_fixups
52420 </literallayout>
52421 <para>
52422 This cannot be used in the other non-SMTP ACLs because by the time they are
52423 run, it is too late.
52424 </para>
52425 <para>
52426 The <option>acl_not_smtp_mime</option> ACL is available only when Exim is compiled with the
52427 content-scanning extension. For details, see chapter <xref linkend="CHAPexiscan"/>.
52428 </para>
52429 <para>
52430 The <option>acl_not_smtp</option> ACL is run just before the <function>local_scan()</function> function. Any
52431 kind of rejection is treated as permanent, because there is no way of sending a
52432 temporary error for these kinds of message.
52433 </para>
52434 </section>
52435 <section id="SECID191">
52436 <title>The SMTP connect ACL</title>
52437 <para>
52438 <indexterm role="concept">
52439 <primary>SMTP</primary>
52440 <secondary>connection, ACL for</secondary>
52441 </indexterm>
52442 <indexterm role="option">
52443 <primary><option>smtp_banner</option></primary>
52444 </indexterm>
52445 The ACL test specified by <option>acl_smtp_connect</option> happens at the start of an SMTP
52446 session, after the test specified by <option>host_reject_connection</option> (which is now
52447 an anomaly) and any TCP Wrappers testing (if configured). If the connection is
52448 accepted by an <option>accept</option> verb that has a <option>message</option> modifier, the contents of
52449 the message override the banner message that is otherwise specified by the
52450 <option>smtp_banner</option> option.
52451 </para>
52452 </section>
52453 <section id="SECID192">
52454 <title>The EHLO/HELO ACL</title>
52455 <para>
52456 <indexterm role="concept">
52457 <primary>EHLO</primary>
52458 <secondary>ACL for</secondary>
52459 </indexterm>
52460 <indexterm role="concept">
52461 <primary>HELO</primary>
52462 <secondary>ACL for</secondary>
52463 </indexterm>
52464 The ACL test specified by <option>acl_smtp_helo</option> happens when the client issues an
52465 EHLO or HELO command, after the tests specified by <option>helo_accept_junk_hosts</option>,
52466 <option>helo_allow_chars</option>, <option>helo_verify_hosts</option>, and <option>helo_try_verify_hosts</option>.
52467 Note that a client may issue more than one EHLO or HELO command in an SMTP
52468 session, and indeed is required to issue a new EHLO or HELO after successfully
52469 setting up encryption following a STARTTLS command.
52470 </para>
52471 <para>
52472 If the command is accepted by an <option>accept</option> verb that has a <option>message</option>
52473 modifier, the message may not contain more than one line (it will be truncated
52474 at the first newline and a panic logged if it does). Such a message cannot
52475 affect the EHLO options that are listed on the second and subsequent lines of
52476 an EHLO response.
52477 </para>
52478 </section>
52479 <section id="SECID193">
52480 <title>The DATA ACLs</title>
52481 <para>
52482 <indexterm role="concept">
52483 <primary>DATA</primary>
52484 <secondary>ACLs for</secondary>
52485 </indexterm>
52486 Two ACLs are associated with the DATA command, because it is two-stage
52487 command, with two responses being sent to the client.
52488 When the DATA command is received, the ACL defined by <option>acl_smtp_predata</option>
52489 is obeyed. This gives you control after all the RCPT commands, but before
52490 the message itself is received. It offers the opportunity to give a negative
52491 response to the DATA command before the data is transmitted. Header lines
52492 added by MAIL or RCPT ACLs are not visible at this time, but any that
52493 are defined here are visible when the <option>acl_smtp_data</option> ACL is run.
52494 </para>
52495 <para>
52496 You cannot test the contents of the message, for example, to verify addresses
52497 in the headers, at RCPT time or when the DATA command is received. Such
52498 tests have to appear in the ACL that is run after the message itself has been
52499 received, before the final response to the DATA command is sent. This is
52500 the ACL specified by <option>acl_smtp_data</option>, which is the second ACL that is
52501 associated with the DATA command.
52502 </para>
52503 <para>
52504 For both of these ACLs, it is not possible to reject individual recipients. An
52505 error response rejects the entire message. Unfortunately, it is known that some
52506 MTAs do not treat hard (5<emphasis>xx</emphasis>) responses to the DATA command (either
52507 before or after the data) correctly &ndash; they keep the message on their queues
52508 and try again later, but that is their problem, though it does waste some of
52509 your resources.
52510 </para>
52511 <para>
52512 The <option>acl_smtp_data</option> ACL is run after
52513 the <option>acl_smtp_data_prdr</option>,
52514 the <option>acl_smtp_dkim</option>
52515 and the <option>acl_smtp_mime</option> ACLs.
52516 </para>
52517 </section>
52518 <section id="SECTDKIMACL">
52519 <title>The SMTP DKIM ACL</title>
52520 <para>
52521 The <option>acl_smtp_dkim</option> ACL is available only when Exim is compiled with DKIM support
52522 enabled (which is the default).
52523 </para>
52524 <para>
52525 The ACL test specified by <option>acl_smtp_dkim</option> happens after a message has been
52526 received, and is executed for each DKIM signature found in a message.  If not
52527 otherwise specified, the default action is to accept.
52528 </para>
52529 <para>
52530 This ACL is evaluated before <option>acl_smtp_mime</option> and <option>acl_smtp_data</option>.
52531 </para>
52532 <para>
52533 For details on the operation of DKIM, see chapter <xref linkend="CHAPdkim"/>.
52534 </para>
52535 </section>
52536 <section id="SECID194">
52537 <title>The SMTP MIME ACL</title>
52538 <para>
52539 The <option>acl_smtp_mime</option> option is available only when Exim is compiled with the
52540 content-scanning extension. For details, see chapter <xref linkend="CHAPexiscan"/>.
52541 </para>
52542 <para>
52543 This ACL is evaluated after <option>acl_smtp_dkim</option> but before <option>acl_smtp_data</option>.
52544 </para>
52545 </section>
52546 <section id="SECTPRDRACL">
52547 <title>The SMTP PRDR ACL</title>
52548 <para>
52549 <indexterm role="concept">
52550 <primary>PRDR</primary>
52551 <secondary>ACL for</secondary>
52552 </indexterm>
52553 <indexterm role="option">
52554 <primary><option>prdr_enable</option></primary>
52555 </indexterm>
52556 The <option>acl_smtp_data_prdr</option> ACL is available only when Exim is compiled
52557 with PRDR support enabled (which is the default).
52558 It becomes active only when the PRDR feature is negotiated between
52559 client and server for a message, and more than one recipient
52560 has been accepted.
52561 </para>
52562 <para>
52563 The ACL test specified by <option>acl_smtp_data_prdr</option> happens after a message
52564 has been received, and is executed once for each recipient of the message
52565 with <varname>$local_part</varname> and <varname>$domain</varname> valid.
52566 The test may accept, defer or deny for individual recipients.
52567 The <option>acl_smtp_data</option> will still be called after this ACL and
52568 can reject the message overall, even if this ACL has accepted it
52569 for some or all recipients.
52570 </para>
52571 <para>
52572 PRDR may be used to support per-user content filtering.  Without it
52573 one must defer any recipient after the first that has a different
52574 content-filter configuration.  With PRDR, the RCPT-time check
52575 for this can be disabled when the MAIL-time $smtp_command included
52576 "PRDR".  Any required difference in behaviour of the main DATA-time
52577 ACL should however depend on the PRDR-time ACL having run, as Exim
52578 will avoid doing so in some situations (e.g.  single-recipient mails).
52579 </para>
52580 <para>
52581 See also the <option>prdr_enable</option> global option
52582 and the <option>hosts_try_prdr</option> smtp transport option.
52583 </para>
52584 <para>
52585 This ACL is evaluated after <option>acl_smtp_dkim</option> but before <option>acl_smtp_data</option>.
52586 If the ACL is not defined, processing completes as if
52587 the feature was not requested by the client.
52588 </para>
52589 </section>
52590 <section id="SECTQUITACL">
52591 <title>The QUIT ACL</title>
52592 <para>
52593 <indexterm role="concept">
52594 <primary>QUIT, ACL for</primary>
52595 </indexterm>
52596 The ACL for the SMTP QUIT command is anomalous, in that the outcome of the ACL
52597 does not affect the response code to QUIT, which is always 221. Thus, the ACL
52598 does not in fact control any access.
52599 </para>
52600 <para revisionflag="changed">
52601 For this reason, it may only accept
52602 or warn as its final result.
52603 </para>
52604 <para>
52605 This ACL can be used for tasks such as custom logging at the end of an SMTP
52606 session. For example, you can use ACL variables in other ACLs to count
52607 messages, recipients, etc., and log the totals at QUIT time using one or
52608 more <option>logwrite</option> modifiers on a <option>warn</option> verb.
52609 </para>
52610 <para>
52611 <emphasis role="bold">Warning</emphasis>: Only the <varname>$acl_c</varname><emphasis>x</emphasis> variables can be used for this, because
52612 the <varname>$acl_m</varname><emphasis>x</emphasis> variables are reset at the end of each incoming message.
52613 </para>
52614 <para>
52615 You do not need to have a final <option>accept</option>, but if you do, you can use a
52616 <option>message</option> modifier to specify custom text that is sent as part of the 221
52617 response to QUIT.
52618 </para>
52619 <para>
52620 This ACL is run only for a <quote>normal</quote> QUIT. For certain kinds of disastrous
52621 failure (for example, failure to open a log file, or when Exim is bombing out
52622 because it has detected an unrecoverable error), all SMTP commands from the
52623 client are given temporary error responses until QUIT is received or the
52624 connection is closed. In these special cases, the QUIT ACL does not run.
52625 </para>
52626 </section>
52627 <section id="SECTNOTQUITACL">
52628 <title>The not-QUIT ACL</title>
52629 <para>
52630 <indexterm role="variable">
52631 <primary><varname>$acl_smtp_notquit</varname></primary>
52632 </indexterm>
52633 The not-QUIT ACL, specified by <option>acl_smtp_notquit</option>, is run in most cases when
52634 an SMTP session ends without sending QUIT. However, when Exim itself is in bad
52635 trouble, such as being unable to write to its log files, this ACL is not run,
52636 because it might try to do things (such as write to log files) that make the
52637 situation even worse.
52638 </para>
52639 <para>
52640 Like the QUIT ACL, this ACL is provided to make it possible to do customized
52641 logging or to gather statistics, and its outcome is ignored. The <option>delay</option>
52642 modifier is forbidden in this ACL, and the only permitted verbs are <option>accept</option>
52643 and <option>warn</option>.
52644 </para>
52645 <para>
52646 <indexterm role="variable">
52647 <primary><varname>$smtp_notquit_reason</varname></primary>
52648 </indexterm>
52649 When the not-QUIT ACL is running, the variable <varname>$smtp_notquit_reason</varname> is set
52650 to a string that indicates the reason for the termination of the SMTP
52651 connection. The possible values are:
52652 </para>
52653 <informaltable frame="none">
52654 <tgroup cols="2" colsep="0" rowsep="0">
52655 <colspec colwidth="196pt" align="left"/>
52656 <colspec colwidth="254pt" align="left"/>
52657 <tbody>
52658 <row>
52659 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<literal>acl-drop</literal></entry>
52660 <entry>Another ACL issued a <option>drop</option> command</entry>
52661 </row>
52662 <row>
52663 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<literal>bad-commands</literal></entry>
52664 <entry>Too many unknown or non-mail commands</entry>
52665 </row>
52666 <row>
52667 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<literal>command-timeout</literal></entry>
52668 <entry>Timeout while reading SMTP commands</entry>
52669 </row>
52670 <row>
52671 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<literal>connection-lost</literal></entry>
52672 <entry>The SMTP connection has been lost</entry>
52673 </row>
52674 <row>
52675 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<literal>data-timeout</literal></entry>
52676 <entry>Timeout while reading message data</entry>
52677 </row>
52678 <row>
52679 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<literal>local-scan-error</literal></entry>
52680 <entry>The <function>local_scan()</function> function crashed</entry>
52681 </row>
52682 <row>
52683 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<literal>local-scan-timeout</literal></entry>
52684 <entry>The <function>local_scan()</function> function timed out</entry>
52685 </row>
52686 <row>
52687 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<literal>signal-exit</literal></entry>
52688 <entry>SIGTERM or SIGINT</entry>
52689 </row>
52690 <row>
52691 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<literal>synchronization-error</literal></entry>
52692 <entry>SMTP synchronization error</entry>
52693 </row>
52694 <row>
52695 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<literal>tls-failed</literal></entry>
52696 <entry>TLS failed to start</entry>
52697 </row>
52698 </tbody>
52699 </tgroup>
52700 </informaltable>
52701 <para>
52702 In most cases when an SMTP connection is closed without having received QUIT,
52703 Exim sends an SMTP response message before actually closing the connection.
52704 With the exception of the <literal>acl-drop</literal> case, the default message can be
52705 overridden by the <option>message</option> modifier in the not-QUIT ACL. In the case of a
52706 <option>drop</option> verb in another ACL, it is the message from the other ACL that is
52707 used.
52708 </para>
52709 </section>
52710 <section id="SECID195">
52711 <title>Finding an ACL to use</title>
52712 <para>
52713 <indexterm role="concept">
52714 <primary>access control lists (ACLs)</primary>
52715 <secondary>finding which to use</secondary>
52716 </indexterm>
52717 The value of an <option>acl_smtp_</option><emphasis>xxx</emphasis> option is expanded before use, so
52718 you can use different ACLs in different circumstances. For example,
52719 </para>
52720 <literallayout class="monospaced">
52721 acl_smtp_rcpt = ${if ={25}{$interface_port} \
52722                      {acl_check_rcpt} {acl_check_rcpt_submit} }
52723 </literallayout>
52724 <para>
52725 In the default configuration file there are some example settings for
52726 providing an RFC 4409 message submission service on port 587 and a
52727 non-standard <quote>smtps</quote> service on port 465. You can use a string
52728 expansion like this to choose an ACL for MUAs on these ports which is
52729 more appropriate for this purpose than the default ACL on port 25.
52730 </para>
52731 <para>
52732 The expanded string does not have to be the name of an ACL in the
52733 configuration file; there are other possibilities. Having expanded the
52734 string, Exim searches for an ACL as follows:
52735 </para>
52736 <itemizedlist>
52737 <listitem>
52738 <para>
52739 If the string begins with a slash, Exim uses it as a file name, and reads its
52740 contents as an ACL. The lines are processed in the same way as lines in the
52741 Exim configuration file. In particular, continuation lines are supported, blank
52742 lines are ignored, as are lines whose first non-whitespace character is <quote>#</quote>.
52743 If the file does not exist or cannot be read, an error occurs (typically
52744 causing a temporary failure of whatever caused the ACL to be run). For example:
52745 </para>
52746 <literallayout class="monospaced">
52747 acl_smtp_data = /etc/acls/\
52748   ${lookup{$sender_host_address}lsearch\
52749   {/etc/acllist}{$value}{default}}
52750 </literallayout>
52751 <para>
52752 This looks up an ACL file to use on the basis of the host&#x2019;s IP address, falling
52753 back to a default if the lookup fails. If an ACL is successfully read from a
52754 file, it is retained in memory for the duration of the Exim process, so that it
52755 can be re-used without having to re-read the file.
52756 </para>
52757 </listitem>
52758 <listitem>
52759 <para>
52760 If the string does not start with a slash, and does not contain any spaces,
52761 Exim searches the ACL section of the configuration for an ACL whose name
52762 matches the string.
52763 </para>
52764 </listitem>
52765 <listitem>
52766 <para>
52767 If no named ACL is found, or if the string contains spaces, Exim parses
52768 the string as an inline ACL. This can save typing in cases where you just
52769 want to have something like
52770 </para>
52771 <literallayout class="monospaced">
52772 acl_smtp_vrfy = accept
52773 </literallayout>
52774 <para>
52775 in order to allow free use of the VRFY command. Such a string may contain
52776 newlines; it is processed in the same way as an ACL that is read from a file.
52777 </para>
52778 </listitem>
52779 </itemizedlist>
52780 </section>
52781 <section id="SECID196">
52782 <title>ACL return codes</title>
52783 <para>
52784 <indexterm role="concept">
52785 <primary>access control lists (ACLs)</primary>
52786 <secondary>return codes</secondary>
52787 </indexterm>
52788 Except for the QUIT ACL, which does not affect the SMTP return code (see
52789 section <xref linkend="SECTQUITACL"/> above), the result of running an ACL is either
52790 <quote>accept</quote> or <quote>deny</quote>, or, if some test cannot be completed (for example, if a
52791 database is down), <quote>defer</quote>. These results cause 2<emphasis>xx</emphasis>, 5<emphasis>xx</emphasis>, and 4<emphasis>xx</emphasis>
52792 return codes, respectively, to be used in the SMTP dialogue. A fourth return,
52793 <quote>error</quote>, occurs when there is an error such as invalid syntax in the ACL.
52794 This also causes a 4<emphasis>xx</emphasis> return code.
52795 </para>
52796 <para>
52797 For the non-SMTP ACL, <quote>defer</quote> and <quote>error</quote> are treated in the same way as
52798 <quote>deny</quote>, because there is no mechanism for passing temporary errors to the
52799 submitters of non-SMTP messages.
52800 </para>
52801 <para>
52802 ACLs that are relevant to message reception may also return <quote>discard</quote>. This
52803 has the effect of <quote>accept</quote>, but causes either the entire message or an
52804 individual recipient address to be discarded. In other words, it is a
52805 blackholing facility. Use it with care.
52806 </para>
52807 <para>
52808 If the ACL for MAIL returns <quote>discard</quote>, all recipients are discarded, and no
52809 ACL is run for subsequent RCPT commands. The effect of <quote>discard</quote> in a
52810 RCPT ACL is to discard just the one recipient address. If there are no
52811 recipients left when the message&#x2019;s data is received, the DATA ACL is not
52812 run. A <quote>discard</quote> return from the DATA or the non-SMTP ACL discards all the
52813 remaining recipients. The <quote>discard</quote> return is not permitted for the
52814 <option>acl_smtp_predata</option> ACL.
52815 </para>
52816 <para>
52817 <indexterm role="concept">
52818 <primary><function>local_scan()</function> function</primary>
52819 <secondary>when all recipients discarded</secondary>
52820 </indexterm>
52821 The <function>local_scan()</function> function is always run, even if there are no remaining
52822 recipients; it may create new recipients.
52823 </para>
52824 </section>
52825 <section id="SECID197">
52826 <title>Unset ACL options</title>
52827 <para>
52828 <indexterm role="concept">
52829 <primary>access control lists (ACLs)</primary>
52830 <secondary>unset options</secondary>
52831 </indexterm>
52832 The default actions when any of the <option>acl_</option><emphasis>xxx</emphasis> options are unset are not
52833 all the same. <emphasis role="bold">Note</emphasis>: These defaults apply only when the relevant ACL is
52834 not defined at all. For any defined ACL, the default action when control
52835 reaches the end of the ACL statements is <quote>deny</quote>.
52836 </para>
52837 <para>
52838 For <option>acl_smtp_quit</option> and <option>acl_not_smtp_start</option> there is no default because
52839 these two are ACLs that are used only for their side effects. They cannot be
52840 used to accept or reject anything.
52841 </para>
52842 <para>
52843 For <option>acl_not_smtp</option>, <option>acl_smtp_auth</option>, <option>acl_smtp_connect</option>,
52844 <option>acl_smtp_data</option>, <option>acl_smtp_helo</option>, <option>acl_smtp_mail</option>, <option>acl_smtp_mailauth</option>,
52845 <option>acl_smtp_mime</option>, <option>acl_smtp_predata</option>, and <option>acl_smtp_starttls</option>, the action
52846 when the ACL is not defined is <quote>accept</quote>.
52847 </para>
52848 <para>
52849 For the others (<option>acl_smtp_etrn</option>, <option>acl_smtp_expn</option>, <option>acl_smtp_rcpt</option>, and
52850 <option>acl_smtp_vrfy</option>), the action when the ACL is not defined is <quote>deny</quote>.
52851 This means that <option>acl_smtp_rcpt</option> must be defined in order to receive any
52852 messages over an SMTP connection. For an example, see the ACL in the default
52853 configuration file.
52854 </para>
52855 </section>
52856 <section id="SECID198">
52857 <title>Data for message ACLs</title>
52858 <para>
52859 <indexterm role="concept">
52860 <primary>access control lists (ACLs)</primary>
52861 <secondary>data for message ACL</secondary>
52862 </indexterm>
52863 <indexterm role="variable">
52864 <primary><varname>$domain</varname></primary>
52865 </indexterm>
52866 <indexterm role="variable">
52867 <primary><varname>$local_part</varname></primary>
52868 </indexterm>
52869 <indexterm role="variable">
52870 <primary><varname>$sender_address</varname></primary>
52871 </indexterm>
52872 <indexterm role="variable">
52873 <primary><varname>$sender_host_address</varname></primary>
52874 </indexterm>
52875 <indexterm role="variable">
52876 <primary><varname>$smtp_command</varname></primary>
52877 </indexterm>
52878 When a MAIL or RCPT ACL, or either of the DATA ACLs, is running, the variables
52879 that contain information about the host and the message&#x2019;s sender (for example,
52880 <varname>$sender_host_address</varname> and <varname>$sender_address</varname>) are set, and can be used in ACL
52881 statements. In the case of RCPT (but not MAIL or DATA), <varname>$domain</varname> and
52882 <varname>$local_part</varname> are set from the argument address. The entire SMTP command
52883 is available in <varname>$smtp_command</varname>.
52884 </para>
52885 <para>
52886 When an ACL for the AUTH parameter of MAIL is running, the variables that
52887 contain information about the host are set, but <varname>$sender_address</varname> is not yet
52888 set. Section <xref linkend="SECTauthparamail"/> contains a discussion of this parameter and
52889 how it is used.
52890 </para>
52891 <para>
52892 <indexterm role="variable">
52893 <primary><varname>$message_size</varname></primary>
52894 </indexterm>
52895 The <varname>$message_size</varname> variable is set to the value of the SIZE parameter on
52896 the MAIL command at MAIL, RCPT and pre-data time, or to -1 if
52897 that parameter is not given. The value is updated to the true message size by
52898 the time the final DATA ACL is run (after the message data has been
52899 received).
52900 </para>
52901 <para>
52902 <indexterm role="variable">
52903 <primary><varname>$rcpt_count</varname></primary>
52904 </indexterm>
52905 <indexterm role="variable">
52906 <primary><varname>$recipients_count</varname></primary>
52907 </indexterm>
52908 The <varname>$rcpt_count</varname> variable increases by one for each RCPT command received.
52909 The <varname>$recipients_count</varname> variable increases by one each time a RCPT command is
52910 accepted, so while an ACL for RCPT is being processed, it contains the number
52911 of previously accepted recipients. At DATA time (for both the DATA ACLs),
52912 <varname>$rcpt_count</varname> contains the total number of RCPT commands, and
52913 <varname>$recipients_count</varname> contains the total number of accepted recipients.
52914 </para>
52915 </section>
52916 <section id="SECTdatfornon">
52917 <title>Data for non-message ACLs</title>
52918 <para>
52919 <indexterm role="concept">
52920 <primary>access control lists (ACLs)</primary>
52921 <secondary>data for non-message ACL</secondary>
52922 </indexterm>
52923 <indexterm role="variable">
52924 <primary><varname>$smtp_command_argument</varname></primary>
52925 </indexterm>
52926 <indexterm role="variable">
52927 <primary><varname>$smtp_command</varname></primary>
52928 </indexterm>
52929 When an ACL is being run for AUTH, EHLO, ETRN, EXPN, HELO, STARTTLS, or VRFY,
52930 the remainder of the SMTP command line is placed in <varname>$smtp_command_argument</varname>,
52931 and the entire SMTP command is available in <varname>$smtp_command</varname>.
52932 These variables can be tested using a <option>condition</option> condition. For example,
52933 here is an ACL for use with AUTH, which insists that either the session is
52934 encrypted, or the CRAM-MD5 authentication method is used. In other words, it
52935 does not permit authentication methods that use cleartext passwords on
52936 unencrypted connections.
52937 </para>
52938 <literallayout class="monospaced">
52939 acl_check_auth:
52940   accept encrypted = *
52941   accept condition = ${if eq{${uc:$smtp_command_argument}}\
52942                      {CRAM-MD5}}
52943   deny   message   = TLS encryption or CRAM-MD5 required
52944 </literallayout>
52945 <para>
52946 (Another way of applying this restriction is to arrange for the authenticators
52947 that use cleartext passwords not to be advertised when the connection is not
52948 encrypted. You can use the generic <option>server_advertise_condition</option> authenticator
52949 option to do this.)
52950 </para>
52951 </section>
52952 <section id="SECID199">
52953 <title>Format of an ACL</title>
52954 <para>
52955 <indexterm role="concept">
52956 <primary>access control lists (ACLs)</primary>
52957 <secondary>format of</secondary>
52958 </indexterm>
52959 <indexterm role="concept">
52960 <primary>access control lists (ACLs)</primary>
52961 <secondary>verbs, definition of</secondary>
52962 </indexterm>
52963 An individual ACL consists of a number of statements. Each statement starts
52964 with a verb, optionally followed by a number of conditions and <quote>modifiers</quote>.
52965 Modifiers can change the way the verb operates, define error and log messages,
52966 set variables, insert delays, and vary the processing of accepted messages.
52967 </para>
52968 <para>
52969 If all the conditions are met, the verb is obeyed. The same condition may be
52970 used (with different arguments) more than once in the same statement. This
52971 provides a means of specifying an <quote>and</quote> conjunction between conditions. For
52972 example:
52973 </para>
52974 <literallayout class="monospaced">
52975 deny  dnslists = list1.example
52976 dnslists = list2.example
52977 </literallayout>
52978 <para>
52979 If there are no conditions, the verb is always obeyed. Exim stops evaluating
52980 the conditions and modifiers when it reaches a condition that fails. What
52981 happens then depends on the verb (and in one case, on a special modifier). Not
52982 all the conditions make sense at every testing point. For example, you cannot
52983 test a sender address in the ACL that is run for a VRFY command.
52984 </para>
52985 </section>
52986 <section id="SECID200">
52987 <title>ACL verbs</title>
52988 <para>
52989 The ACL verbs are as follows:
52990 </para>
52991 <itemizedlist>
52992 <listitem>
52993 <para>
52994 <indexterm role="concept">
52995 <primary><option>accept</option> ACL verb</primary>
52996 </indexterm>
52997 <option>accept</option>: If all the conditions are met, the ACL returns <quote>accept</quote>. If any
52998 of the conditions are not met, what happens depends on whether <option>endpass</option>
52999 appears among the conditions (for syntax see below). If the failing condition
53000 is before <option>endpass</option>, control is passed to the next ACL statement; if it is
53001 after <option>endpass</option>, the ACL returns <quote>deny</quote>. Consider this statement, used to
53002 check a RCPT command:
53003 </para>
53004 <literallayout class="monospaced">
53005 accept domains = +local_domains
53006 endpass
53007 verify = recipient
53008 </literallayout>
53009 <para>
53010 If the recipient domain does not match the <option>domains</option> condition, control
53011 passes to the next statement. If it does match, the recipient is verified, and
53012 the command is accepted if verification succeeds. However, if verification
53013 fails, the ACL yields <quote>deny</quote>, because the failing condition is after
53014 <option>endpass</option>.
53015 </para>
53016 <para>
53017 The <option>endpass</option> feature has turned out to be confusing to many people, so its
53018 use is not recommended nowadays. It is always possible to rewrite an ACL so
53019 that <option>endpass</option> is not needed, and it is no longer used in the default
53020 configuration.
53021 </para>
53022 <para>
53023 <indexterm role="concept">
53024 <primary><option>message</option> ACL modifier</primary>
53025 <secondary>with <option>accept</option></secondary>
53026 </indexterm>
53027 If a <option>message</option> modifier appears on an <option>accept</option> statement, its action
53028 depends on whether or not <option>endpass</option> is present. In the absence of <option>endpass</option>
53029 (when an <option>accept</option> verb either accepts or passes control to the next
53030 statement), <option>message</option> can be used to vary the message that is sent when an
53031 SMTP command is accepted. For example, in a RCPT ACL you could have:
53032 </para>
53033 <literallayout>
53034 <literal>accept  </literal>&lt;<emphasis>some conditions</emphasis>&gt;
53035 <literal>        message = OK, I will allow you through today</literal>
53036 </literallayout>
53037 <para>
53038 You can specify an SMTP response code, optionally followed by an <quote>extended
53039 response code</quote> at the start of the message, but the first digit must be the
53040 same as would be sent by default, which is 2 for an <option>accept</option> verb.
53041 </para>
53042 <para>
53043 If <option>endpass</option> is present in an <option>accept</option> statement, <option>message</option> specifies
53044 an error message that is used when access is denied. This behaviour is retained
53045 for backward compatibility, but current <quote>best practice</quote> is to avoid the use
53046 of <option>endpass</option>.
53047 </para>
53048 </listitem>
53049 <listitem>
53050 <para>
53051 <indexterm role="concept">
53052 <primary><option>defer</option> ACL verb</primary>
53053 </indexterm>
53054 <option>defer</option>: If all the conditions are true, the ACL returns <quote>defer</quote> which, in
53055 an SMTP session, causes a 4<emphasis>xx</emphasis> response to be given. For a non-SMTP ACL,
53056 <option>defer</option> is the same as <option>deny</option>, because there is no way of sending a
53057 temporary error. For a RCPT command, <option>defer</option> is much the same as using a
53058 <command>redirect</command> router and <literal>:defer:</literal> while verifying, but the <option>defer</option> verb can
53059 be used in any ACL, and even for a recipient it might be a simpler approach.
53060 </para>
53061 </listitem>
53062 <listitem>
53063 <para>
53064 <indexterm role="concept">
53065 <primary><option>deny</option> ACL verb</primary>
53066 </indexterm>
53067 <option>deny</option>: If all the conditions are met, the ACL returns <quote>deny</quote>. If any of
53068 the conditions are not met, control is passed to the next ACL statement. For
53069 example,
53070 </para>
53071 <literallayout class="monospaced">
53072 deny dnslists = blackholes.mail-abuse.org
53073 </literallayout>
53074 <para>
53075 rejects commands from hosts that are on a DNS black list.
53076 </para>
53077 </listitem>
53078 <listitem>
53079 <para>
53080 <indexterm role="concept">
53081 <primary><option>discard</option> ACL verb</primary>
53082 </indexterm>
53083 <option>discard</option>: This verb behaves like <option>accept</option>, except that it returns
53084 <quote>discard</quote> from the ACL instead of <quote>accept</quote>. It is permitted only on ACLs
53085 that are concerned with receiving messages. When all the conditions are true,
53086 the sending entity receives a <quote>success</quote> response. However, <option>discard</option> causes
53087 recipients to be discarded. If it is used in an ACL for RCPT, just the one
53088 recipient is discarded; if used for MAIL, DATA or in the non-SMTP ACL, all the
53089 message&#x2019;s recipients are discarded. Recipients that are discarded before DATA
53090 do not appear in the log line when the <option>received_recipients</option> log selector is set.
53091 </para>
53092 <para>
53093 If the <option>log_message</option> modifier is set when <option>discard</option> operates,
53094 its contents are added to the line that is automatically written to the log.
53095 The <option>message</option> modifier operates exactly as it does for <option>accept</option>.
53096 </para>
53097 </listitem>
53098 <listitem>
53099 <para>
53100 <indexterm role="concept">
53101 <primary><option>drop</option> ACL verb</primary>
53102 </indexterm>
53103 <option>drop</option>: This verb behaves like <option>deny</option>, except that an SMTP connection is
53104 forcibly closed after the 5<emphasis>xx</emphasis> error message has been sent. For example:
53105 </para>
53106 <literallayout class="monospaced">
53107 drop   message   = I don't take more than 20 RCPTs
53108        condition = ${if &gt; {$rcpt_count}{20}}
53109 </literallayout>
53110 <para>
53111 There is no difference between <option>deny</option> and <option>drop</option> for the connect-time ACL.
53112 The connection is always dropped after sending a 550 response.
53113 </para>
53114 </listitem>
53115 <listitem>
53116 <para>
53117 <indexterm role="concept">
53118 <primary><option>require</option> ACL verb</primary>
53119 </indexterm>
53120 <option>require</option>: If all the conditions are met, control is passed to the next ACL
53121 statement. If any of the conditions are not met, the ACL returns <quote>deny</quote>. For
53122 example, when checking a RCPT command,
53123 </para>
53124 <literallayout class="monospaced">
53125 require message = Sender did not verify
53126         verify  = sender
53127 </literallayout>
53128 <para>
53129 passes control to subsequent statements only if the message&#x2019;s sender can be
53130 verified. Otherwise, it rejects the command. Note the positioning of the
53131 <option>message</option> modifier, before the <option>verify</option> condition. The reason for this is
53132 discussed in section <xref linkend="SECTcondmodproc"/>.
53133 </para>
53134 </listitem>
53135 <listitem>
53136 <para>
53137 <indexterm role="concept">
53138 <primary><option>warn</option> ACL verb</primary>
53139 </indexterm>
53140 <option>warn</option>: If all the conditions are true, a line specified by the
53141 <option>log_message</option> modifier is written to Exim&#x2019;s main log. Control always passes
53142 to the next ACL statement. If any condition is false, the log line is not
53143 written. If an identical log line is requested several times in the same
53144 message, only one copy is actually written to the log. If you want to force
53145 duplicates to be written, use the <option>logwrite</option> modifier instead.
53146 </para>
53147 <para>
53148 If <option>log_message</option> is not present, a <option>warn</option> verb just checks its conditions
53149 and obeys any <quote>immediate</quote> modifiers (such as <option>control</option>, <option>set</option>,
53150 <option>logwrite</option>, <option>add_header</option>, and <option>remove_header</option>) that appear before the
53151 first failing condition. There is more about adding header lines in section
53152 <xref linkend="SECTaddheadacl"/>.
53153 </para>
53154 <para>
53155 If any condition on a <option>warn</option> statement cannot be completed (that is, there is
53156 some sort of defer), the log line specified by <option>log_message</option> is not written.
53157 This does not include the case of a forced failure from a lookup, which
53158 is considered to be a successful completion. After a defer, no further
53159 conditions or modifiers in the <option>warn</option> statement are processed. The incident
53160 is logged, and the ACL continues to be processed, from the next statement
53161 onwards.
53162 </para>
53163 <para>
53164 <indexterm role="variable">
53165 <primary><varname>$acl_verify_message</varname></primary>
53166 </indexterm>
53167 When one of the <option>warn</option> conditions is an address verification that fails, the
53168 text of the verification failure message is in <varname>$acl_verify_message</varname>. If you
53169 want this logged, you must set it up explicitly. For example:
53170 </para>
53171 <literallayout class="monospaced">
53172 warn   !verify = sender
53173        log_message = sender verify failed: $acl_verify_message
53174 </literallayout>
53175 </listitem>
53176 </itemizedlist>
53177 <para>
53178 At the end of each ACL there is an implicit unconditional <option>deny</option>.
53179 </para>
53180 <para>
53181 As you can see from the examples above, the conditions and modifiers are
53182 written one to a line, with the first one on the same line as the verb, and
53183 subsequent ones on following lines. If you have a very long condition, you can
53184 continue it onto several physical lines by the usual backslash continuation
53185 mechanism. It is conventional to align the conditions vertically.
53186 </para>
53187 </section>
53188 <section id="SECTaclvariables">
53189 <title>ACL variables</title>
53190 <para>
53191 <indexterm role="concept">
53192 <primary>access control lists (ACLs)</primary>
53193 <secondary>variables</secondary>
53194 </indexterm>
53195 There are some special variables that can be set during ACL processing. They
53196 can be used to pass information between different ACLs, different invocations
53197 of the same ACL in the same SMTP connection, and between ACLs and the routers,
53198 transports, and filters that are used to deliver a message. The names of these
53199 variables must begin with <varname>$acl_c</varname> or <varname>$acl_m</varname>, followed either by a digit or
53200 an underscore, but the remainder of the name can be any sequence of
53201 alphanumeric characters and underscores that you choose. There is no limit on
53202 the number of ACL variables. The two sets act as follows:
53203 </para>
53204 <itemizedlist>
53205 <listitem>
53206 <para>
53207 The values of those variables whose names begin with <varname>$acl_c</varname> persist
53208 throughout an SMTP connection. They are never reset. Thus, a value that is set
53209 while receiving one message is still available when receiving the next message
53210 on the same SMTP connection.
53211 </para>
53212 </listitem>
53213 <listitem>
53214 <para>
53215 The values of those variables whose names begin with <varname>$acl_m</varname> persist only
53216 while a message is being received. They are reset afterwards. They are also
53217 reset by MAIL, RSET, EHLO, HELO, and after starting up a TLS session.
53218 </para>
53219 </listitem>
53220 </itemizedlist>
53221 <para>
53222 When a message is accepted, the current values of all the ACL variables are
53223 preserved with the message and are subsequently made available at delivery
53224 time. The ACL variables are set by a modifier called <option>set</option>. For example:
53225 </para>
53226 <literallayout class="monospaced">
53227 accept hosts = whatever
53228        set acl_m4 = some value
53229 accept authenticated = *
53230        set acl_c_auth = yes
53231 </literallayout>
53232 <para>
53233 <emphasis role="bold">Note</emphasis>: A leading dollar sign is not used when naming a variable that is to
53234 be set. If you want to set a variable without taking any action, you can use a
53235 <option>warn</option> verb without any other modifiers or conditions.
53236 </para>
53237 <para>
53238 <indexterm role="option">
53239 <primary><option>strict_acl_vars</option></primary>
53240 </indexterm>
53241 What happens if a syntactically valid but undefined ACL variable is
53242 referenced depends on the setting of the <option>strict_acl_vars</option> option. If it is
53243 false (the default), an empty string is substituted; if it is true, an
53244 error is generated.
53245 </para>
53246 <para>
53247 Versions of Exim before 4.64 have a limited set of numbered variables, but
53248 their names are compatible, so there is no problem with upgrading.
53249 </para>
53250 </section>
53251 <section id="SECTcondmodproc">
53252 <title>Condition and modifier processing</title>
53253 <para>
53254 <indexterm role="concept">
53255 <primary>access control lists (ACLs)</primary>
53256 <secondary>conditions; processing</secondary>
53257 </indexterm>
53258 <indexterm role="concept">
53259 <primary>access control lists (ACLs)</primary>
53260 <secondary>modifiers; processing</secondary>
53261 </indexterm>
53262 An exclamation mark preceding a condition negates its result. For example:
53263 </para>
53264 <literallayout class="monospaced">
53265 deny   domains = *.dom.example
53266       !verify  = recipient
53267 </literallayout>
53268 <para>
53269 causes the ACL to return <quote>deny</quote> if the recipient domain ends in
53270 <emphasis>dom.example</emphasis> and the recipient address cannot be verified. Sometimes
53271 negation can be used on the right-hand side of a condition. For example, these
53272 two statements are equivalent:
53273 </para>
53274 <literallayout class="monospaced">
53275 deny  hosts = !192.168.3.4
53276 deny !hosts =  192.168.3.4
53277 </literallayout>
53278 <para>
53279 However, for many conditions (<option>verify</option> being a good example), only left-hand
53280 side negation of the whole condition is possible.
53281 </para>
53282 <para>
53283 The arguments of conditions and modifiers are expanded. A forced failure
53284 of an expansion causes a condition to be ignored, that is, it behaves as if the
53285 condition is true. Consider these two statements:
53286 </para>
53287 <literallayout class="monospaced">
53288 accept  senders = ${lookup{$host_name}lsearch\
53289                   {/some/file}{$value}fail}
53290 accept  senders = ${lookup{$host_name}lsearch\
53291                   {/some/file}{$value}{}}
53292 </literallayout>
53293 <para>
53294 Each attempts to look up a list of acceptable senders. If the lookup succeeds,
53295 the returned list is searched, but if the lookup fails the behaviour is
53296 different in the two cases. The <option>fail</option> in the first statement causes the
53297 condition to be ignored, leaving no further conditions. The <option>accept</option> verb
53298 therefore succeeds. The second statement, however, generates an empty list when
53299 the lookup fails. No sender can match an empty list, so the condition fails,
53300 and therefore the <option>accept</option> also fails.
53301 </para>
53302 <para>
53303 ACL modifiers appear mixed in with conditions in ACL statements. Some of them
53304 specify actions that are taken as the conditions for a statement are checked;
53305 others specify text for messages that are used when access is denied or a
53306 warning is generated. The <option>control</option> modifier affects the way an incoming
53307 message is handled.
53308 </para>
53309 <para>
53310 The positioning of the modifiers in an ACL statement is important, because the
53311 processing of a verb ceases as soon as its outcome is known. Only those
53312 modifiers that have already been encountered will take effect. For example,
53313 consider this use of the <option>message</option> modifier:
53314 </para>
53315 <literallayout class="monospaced">
53316 require message = Can't verify sender
53317         verify  = sender
53318         message = Can't verify recipient
53319         verify  = recipient
53320         message = This message cannot be used
53321 </literallayout>
53322 <para>
53323 If sender verification fails, Exim knows that the result of the statement is
53324 <quote>deny</quote>, so it goes no further. The first <option>message</option> modifier has been seen,
53325 so its text is used as the error message. If sender verification succeeds, but
53326 recipient verification fails, the second message is used. If recipient
53327 verification succeeds, the third message becomes <quote>current</quote>, but is never used
53328 because there are no more conditions to cause failure.
53329 </para>
53330 <para>
53331 For the <option>deny</option> verb, on the other hand, it is always the last <option>message</option>
53332 modifier that is used, because all the conditions must be true for rejection to
53333 happen. Specifying more than one <option>message</option> modifier does not make sense, and
53334 the message can even be specified after all the conditions. For example:
53335 </para>
53336 <literallayout class="monospaced">
53337 deny   hosts = ...
53338       !senders = *@my.domain.example
53339        message = Invalid sender from client host
53340 </literallayout>
53341 <para>
53342 The <quote>deny</quote> result does not happen until the end of the statement is reached,
53343 by which time Exim has set up the message.
53344 </para>
53345 </section>
53346 <section id="SECTACLmodi">
53347 <title>ACL modifiers</title>
53348 <para>
53349 <indexterm role="concept">
53350 <primary>access control lists (ACLs)</primary>
53351 <secondary>modifiers; list of</secondary>
53352 </indexterm>
53353 The ACL modifiers are as follows:
53354 </para>
53355 <variablelist>
53356 <varlistentry>
53357 <term><emphasis role="bold">add_header</emphasis>&nbsp;=&nbsp;&lt;<emphasis>text</emphasis>&gt;</term>
53358 <listitem>
53359 <para>
53360 This modifier specifies one or more header lines that are to be added to an
53361 incoming message, assuming, of course, that the message is ultimately
53362 accepted. For details, see section <xref linkend="SECTaddheadacl"/>.
53363 </para>
53364 </listitem></varlistentry>
53365 <varlistentry>
53366 <term><emphasis role="bold">continue</emphasis>&nbsp;=&nbsp;&lt;<emphasis>text</emphasis>&gt;</term>
53367 <listitem>
53368 <para>
53369 <indexterm role="concept">
53370 <primary><option>continue</option> ACL modifier</primary>
53371 </indexterm>
53372 <indexterm role="concept">
53373 <primary>database</primary>
53374 <secondary>updating in ACL</secondary>
53375 </indexterm>
53376 This modifier does nothing of itself, and processing of the ACL always
53377 continues with the next condition or modifier. The value of <option>continue</option> is in
53378 the side effects of expanding its argument. Typically this could be used to
53379 update a database. It is really just a syntactic tidiness, to avoid having to
53380 write rather ugly lines like this:
53381 </para>
53382 <literallayout>
53383 <literal>condition = ${if eq{0}{</literal>&lt;<emphasis>some expansion</emphasis>&gt;<literal>}{true}{true}}</literal>
53384 </literallayout>
53385 <para>
53386 Instead, all you need is
53387 </para>
53388 <literallayout>
53389 <literal>continue = </literal>&lt;<emphasis>some expansion</emphasis>&gt;
53390 </literallayout>
53391 </listitem></varlistentry>
53392 <varlistentry>
53393 <term><emphasis role="bold">control</emphasis>&nbsp;=&nbsp;&lt;<emphasis>text</emphasis>&gt;</term>
53394 <listitem>
53395 <para>
53396 <indexterm role="concept">
53397 <primary><option>control</option> ACL modifier</primary>
53398 </indexterm>
53399 This modifier affects the subsequent processing of the SMTP connection or of an
53400 incoming message that is accepted. The effect of the first type of control
53401 lasts for the duration of the connection, whereas the effect of the second type
53402 lasts only until the current message has been received. The message-specific
53403 controls always apply to the whole message, not to individual recipients,
53404 even if the <option>control</option> modifier appears in a RCPT ACL.
53405 </para>
53406 <para>
53407 As there are now quite a few controls that can be applied, they are described
53408 separately in section <xref linkend="SECTcontrols"/>. The <option>control</option> modifier can be used
53409 in several different ways. For example:
53410 </para>
53411 <itemizedlist>
53412 <listitem>
53413 <para>
53414 It can be at the end of an <option>accept</option> statement:
53415 </para>
53416 <literallayout class="monospaced">
53417     accept  ...some conditions
53418             control = queue_only
53419 </literallayout>
53420 <para>
53421 In this case, the control is applied when this statement yields <quote>accept</quote>, in
53422 other words, when the conditions are all true.
53423 </para>
53424 </listitem>
53425 <listitem>
53426 <para>
53427 It can be in the middle of an <option>accept</option> statement:
53428 </para>
53429 <literallayout class="monospaced">
53430     accept  ...some conditions...
53431             control = queue_only
53432             ...some more conditions...
53433 </literallayout>
53434 <para>
53435 If the first set of conditions are true, the control is applied, even if the
53436 statement does not accept because one of the second set of conditions is false.
53437 In this case, some subsequent statement must yield <quote>accept</quote> for the control
53438 to be relevant.
53439 </para>
53440 </listitem>
53441 <listitem>
53442 <para>
53443 It can be used with <option>warn</option> to apply the control, leaving the
53444 decision about accepting or denying to a subsequent verb. For
53445 example:
53446 </para>
53447 <literallayout class="monospaced">
53448     warn    ...some conditions...
53449             control = freeze
53450     accept  ...
53451 </literallayout>
53452 <para>
53453 This example of <option>warn</option> does not contain <option>message</option>, <option>log_message</option>, or
53454 <option>logwrite</option>, so it does not add anything to the message and does not write a
53455 log entry.
53456 </para>
53457 </listitem>
53458 <listitem>
53459 <para>
53460 If you want to apply a control unconditionally, you can use it with a
53461 <option>require</option> verb. For example:
53462 </para>
53463 <literallayout class="monospaced">
53464     require  control = no_multiline_responses
53465 </literallayout>
53466 </listitem>
53467 </itemizedlist>
53468 </listitem></varlistentry>
53469 <varlistentry>
53470 <term><emphasis role="bold">delay</emphasis>&nbsp;=&nbsp;&lt;<emphasis>time</emphasis>&gt;</term>
53471 <listitem>
53472 <para>
53473 <indexterm role="concept">
53474 <primary><option>delay</option> ACL modifier</primary>
53475 </indexterm>
53476 <indexterm role="option">
53477 <primary><option>-bh</option></primary>
53478 </indexterm>
53479 This modifier may appear in any ACL except notquit. It causes Exim to wait for
53480 the time interval before proceeding. However, when testing Exim using the
53481 <option>-bh</option> option, the delay is not actually imposed (an appropriate message is
53482 output instead). The time is given in the usual Exim notation, and the delay
53483 happens as soon as the modifier is processed. In an SMTP session, pending
53484 output is flushed before the delay is imposed.
53485 </para>
53486 <para>
53487 Like <option>control</option>, <option>delay</option> can be used with <option>accept</option> or <option>deny</option>, for
53488 example:
53489 </para>
53490 <literallayout class="monospaced">
53491 deny    ...some conditions...
53492         delay = 30s
53493 </literallayout>
53494 <para>
53495 The delay happens if all the conditions are true, before the statement returns
53496 <quote>deny</quote>. Compare this with:
53497 </para>
53498 <literallayout class="monospaced">
53499 deny    delay = 30s
53500         ...some conditions...
53501 </literallayout>
53502 <para>
53503 which waits for 30s before processing the conditions. The <option>delay</option> modifier
53504 can also be used with <option>warn</option> and together with <option>control</option>:
53505 </para>
53506 <literallayout class="monospaced">
53507 warn    ...some conditions...
53508         delay = 2m
53509         control = freeze
53510 accept  ...
53511 </literallayout>
53512 <para>
53513 If <option>delay</option> is encountered when the SMTP PIPELINING extension is in use,
53514 responses to several commands are no longer buffered and sent in one packet (as
53515 they would normally be) because all output is flushed before imposing the
53516 delay. This optimization is disabled so that a number of small delays do not
53517 appear to the client as one large aggregated delay that might provoke an
53518 unwanted timeout. You can, however, disable output flushing for <option>delay</option> by
53519 using a <option>control</option> modifier to set <option>no_delay_flush</option>.
53520 </para>
53521 </listitem></varlistentry>
53522 <varlistentry>
53523 <term><emphasis role="bold">endpass</emphasis></term>
53524 <listitem>
53525 <para>
53526 <indexterm role="concept">
53527 <primary><option>endpass</option> ACL modifier</primary>
53528 </indexterm>
53529 This modifier, which has no argument, is recognized only in <option>accept</option> and
53530 <option>discard</option> statements. It marks the boundary between the conditions whose
53531 failure causes control to pass to the next statement, and the conditions whose
53532 failure causes the ACL to return <quote>deny</quote>. This concept has proved to be
53533 confusing to some people, so the use of <option>endpass</option> is no longer recommended as
53534 <quote>best practice</quote>. See the description of <option>accept</option> above for more details.
53535 </para>
53536 </listitem></varlistentry>
53537 <varlistentry>
53538 <term><emphasis role="bold">log_message</emphasis>&nbsp;=&nbsp;&lt;<emphasis>text</emphasis>&gt;</term>
53539 <listitem>
53540 <para>
53541 <indexterm role="concept">
53542 <primary><option>log_message</option> ACL modifier</primary>
53543 </indexterm>
53544 This modifier sets up a message that is used as part of the log message if the
53545 ACL denies access or a <option>warn</option> statement&#x2019;s conditions are true. For example:
53546 </para>
53547 <literallayout class="monospaced">
53548 require log_message = wrong cipher suite $tls_in_cipher
53549         encrypted   = DES-CBC3-SHA
53550 </literallayout>
53551 <para>
53552 <option>log_message</option> is also used when recipients are discarded by <option>discard</option>. For
53553 example:
53554 </para>
53555 <literallayout>
53556 <literal>discard </literal>&lt;<emphasis>some conditions</emphasis>&gt;
53557 <literal>        log_message = Discarded $local_part@$domain because...</literal>
53558 </literallayout>
53559 <para>
53560 When access is denied, <option>log_message</option> adds to any underlying error message
53561 that may exist because of a condition failure. For example, while verifying a
53562 recipient address, a <emphasis>:fail:</emphasis> redirection might have already set up a
53563 message.
53564 </para>
53565 <para>
53566 The message may be defined before the conditions to which it applies, because
53567 the string expansion does not happen until Exim decides that access is to be
53568 denied. This means that any variables that are set by the condition are
53569 available for inclusion in the message. For example, the <varname>$dnslist_</varname>&lt;<emphasis>xxx</emphasis>&gt;
53570 variables are set after a DNS black list lookup succeeds. If the expansion of
53571 <option>log_message</option> fails, or if the result is an empty string, the modifier is
53572 ignored.
53573 </para>
53574 <para>
53575 <indexterm role="variable">
53576 <primary><varname>$acl_verify_message</varname></primary>
53577 </indexterm>
53578 If you want to use a <option>warn</option> statement to log the result of an address
53579 verification, you can use <varname>$acl_verify_message</varname> to include the verification
53580 error message.
53581 </para>
53582 <para>
53583 If <option>log_message</option> is used with a <option>warn</option> statement, <quote>Warning:</quote> is added to
53584 the start of the logged message. If the same warning log message is requested
53585 more than once while receiving  a single email message, only one copy is
53586 actually logged. If you want to log multiple copies, use <option>logwrite</option> instead
53587 of <option>log_message</option>. In the absence of <option>log_message</option> and <option>logwrite</option>, nothing
53588 is logged for a successful <option>warn</option> statement.
53589 </para>
53590 <para>
53591 If <option>log_message</option> is not present and there is no underlying error message (for
53592 example, from the failure of address verification), but <option>message</option> is present,
53593 the <option>message</option> text is used for logging rejections. However, if any text for
53594 logging contains newlines, only the first line is logged. In the absence of
53595 both <option>log_message</option> and <option>message</option>, a default built-in message is used for
53596 logging rejections.
53597 </para>
53598 </listitem></varlistentry>
53599 <varlistentry>
53600 <term><emphasis role="bold">log_reject_target</emphasis>&nbsp;=&nbsp;&lt;<emphasis>log name list</emphasis>&gt;</term>
53601 <listitem>
53602 <para>
53603 <indexterm role="concept">
53604 <primary><option>log_reject_target</option> ACL modifier</primary>
53605 </indexterm>
53606 <indexterm role="concept">
53607 <primary>logging in ACL</primary>
53608 <secondary>specifying which log</secondary>
53609 </indexterm>
53610 This modifier makes it possible to specify which logs are used for messages
53611 about ACL rejections. Its argument is a colon-separated list of words that can
53612 be <quote>main</quote>, <quote>reject</quote>, or <quote>panic</quote>. The default is <literal>main:reject</literal>. The list
53613 may be empty, in which case a rejection is not logged at all. For example, this
53614 ACL fragment writes no logging information when access is denied:
53615 </para>
53616 <literallayout>
53617 <literal>deny </literal>&lt;<emphasis>some conditions</emphasis>&gt;
53618 <literal>     log_reject_target =</literal>
53619 </literallayout>
53620 <para>
53621 This modifier can be used in SMTP and non-SMTP ACLs. It applies to both
53622 permanent and temporary rejections. Its effect lasts for the rest of the
53623 current ACL.
53624 </para>
53625 </listitem></varlistentry>
53626 <varlistentry>
53627 <term><emphasis role="bold">logwrite</emphasis>&nbsp;=&nbsp;&lt;<emphasis>text</emphasis>&gt;</term>
53628 <listitem>
53629 <para>
53630 <indexterm role="concept">
53631 <primary><option>logwrite</option> ACL modifier</primary>
53632 </indexterm>
53633 <indexterm role="concept">
53634 <primary>logging in ACL</primary>
53635 <secondary>immediate</secondary>
53636 </indexterm>
53637 This modifier writes a message to a log file as soon as it is encountered when
53638 processing an ACL. (Compare <option>log_message</option>, which, except in the case of
53639 <option>warn</option> and <option>discard</option>, is used only if the ACL statement denies
53640 access.) The <option>logwrite</option> modifier can be used to log special incidents in
53641 ACLs. For example:
53642 </para>
53643 <literallayout>
53644 <literal>accept </literal>&lt;<emphasis>some special conditions</emphasis>&gt;
53645 <literal>       control  = freeze</literal>
53646 <literal>       logwrite = froze message because ...</literal>
53647 </literallayout>
53648 <para>
53649 By default, the message is written to the main log. However, it may begin
53650 with a colon, followed by a comma-separated list of log names, and then
53651 another colon, to specify exactly which logs are to be written. For
53652 example:
53653 </para>
53654 <literallayout class="monospaced">
53655 logwrite = :main,reject: text for main and reject logs
53656 logwrite = :panic: text for panic log only
53657 </literallayout>
53658 </listitem></varlistentry>
53659 <varlistentry>
53660 <term><emphasis role="bold">message</emphasis>&nbsp;=&nbsp;&lt;<emphasis>text</emphasis>&gt;</term>
53661 <listitem>
53662 <para>
53663 <indexterm role="concept">
53664 <primary><option>message</option> ACL modifier</primary>
53665 </indexterm>
53666 This modifier sets up a text string that is expanded and used as a response
53667 message when an ACL statement terminates the ACL with an <quote>accept</quote>, <quote>deny</quote>,
53668 or <quote>defer</quote> response. (In the case of the <option>accept</option> and <option>discard</option> verbs,
53669 there is some complication if <option>endpass</option> is involved; see the description of
53670 <option>accept</option> for details.)
53671 </para>
53672 <para>
53673 The expansion of the message happens at the time Exim decides that the ACL is
53674 to end, not at the time it processes <option>message</option>. If the expansion fails, or
53675 generates an empty string, the modifier is ignored. Here is an example where
53676 <option>message</option> must be specified first, because the ACL ends with a rejection if
53677 the <option>hosts</option> condition fails:
53678 </para>
53679 <literallayout class="monospaced">
53680 require  message = Host not recognized
53681          hosts = 10.0.0.0/8
53682 </literallayout>
53683 <para>
53684 (Once a condition has failed, no further conditions or modifiers are
53685 processed.)
53686 </para>
53687 <para>
53688 <indexterm role="concept">
53689 <primary>SMTP</primary>
53690 <secondary>error codes</secondary>
53691 </indexterm>
53692 <indexterm role="option">
53693 <primary><option>smtp_banner</option></primary>
53694 </indexterm>
53695 For ACLs that are triggered by SMTP commands, the message is returned as part
53696 of the SMTP response. The use of <option>message</option> with <option>accept</option> (or <option>discard</option>)
53697 is meaningful only for SMTP, as no message is returned when a non-SMTP message
53698 is accepted. In the case of the connect ACL, accepting with a message modifier
53699 overrides the value of <option>smtp_banner</option>. For the EHLO/HELO ACL, a customized
53700 accept message may not contain more than one line (otherwise it will be
53701 truncated at the first newline and a panic logged), and it cannot affect the
53702 EHLO options.
53703 </para>
53704 <para>
53705 When SMTP is involved, the message may begin with an overriding response code,
53706 consisting of three digits optionally followed by an <quote>extended response code</quote>
53707 of the form <emphasis>n.n.n</emphasis>, each code being followed by a space. For example:
53708 </para>
53709 <literallayout class="monospaced">
53710 deny  message = 599 1.2.3 Host not welcome
53711       hosts = 192.168.34.0/24
53712 </literallayout>
53713 <para>
53714 The first digit of the supplied response code must be the same as would be sent
53715 by default. A panic occurs if it is not. Exim uses a 550 code when it denies
53716 access, but for the predata ACL, note that the default success code is 354, not
53717 2<emphasis>xx</emphasis>.
53718 </para>
53719 <para>
53720 Notwithstanding the previous paragraph, for the QUIT ACL, unlike the others,
53721 the message modifier cannot override the 221 response code.
53722 </para>
53723 <para>
53724 The text in a <option>message</option> modifier is literal; any quotes are taken as
53725 literals, but because the string is expanded, backslash escapes are processed
53726 anyway. If the message contains newlines, this gives rise to a multi-line SMTP
53727 response.
53728 </para>
53729 <para>
53730 <indexterm role="variable">
53731 <primary><varname>$acl_verify_message</varname></primary>
53732 </indexterm>
53733 For ACLs that are called by an <option>acl =</option> ACL condition, the message is
53734 stored in <varname>$acl_verify_message</varname>, from which the calling ACL may use it.
53735 </para>
53736 <para>
53737 If <option>message</option> is used on a statement that verifies an address, the message
53738 specified overrides any message that is generated by the verification process.
53739 However, the original message is available in the variable
53740 <varname>$acl_verify_message</varname>, so you can incorporate it into your message if you
53741 wish. In particular, if you want the text from <option>:fail:</option> items in <command>redirect</command>
53742 routers to be passed back as part of the SMTP response, you should either not
53743 use a <option>message</option> modifier, or make use of <varname>$acl_verify_message</varname>.
53744 </para>
53745 <para>
53746 For compatibility with previous releases of Exim, a <option>message</option> modifier that
53747 is used with a <option>warn</option> verb behaves in a similar way to the <option>add_header</option>
53748 modifier, but this usage is now deprecated. However, <option>message</option> acts only when
53749 all the conditions are true, wherever it appears in an ACL command, whereas
53750 <option>add_header</option> acts as soon as it is encountered. If <option>message</option> is used with
53751 <option>warn</option> in an ACL that is not concerned with receiving a message, it has no
53752 effect.
53753 </para>
53754 </listitem></varlistentry>
53755 <varlistentry>
53756 <term><emphasis role="bold">remove_header</emphasis>&nbsp;=&nbsp;&lt;<emphasis>text</emphasis>&gt;</term>
53757 <listitem>
53758 <para>
53759 This modifier specifies one or more header names in a colon-separated list
53760  that are to be removed from an incoming message, assuming, of course, that
53761 the message is ultimately accepted. For details, see section <xref linkend="SECTremoveheadacl"/>.
53762 </para>
53763 </listitem></varlistentry>
53764 <varlistentry>
53765 <term><emphasis role="bold">set</emphasis>&nbsp;&lt;<emphasis>acl_name</emphasis>&gt;&nbsp;=&nbsp;&lt;<emphasis>value</emphasis>&gt;</term>
53766 <listitem>
53767 <para>
53768 <indexterm role="concept">
53769 <primary><option>set</option> ACL modifier</primary>
53770 </indexterm>
53771 This modifier puts a value into one of the ACL variables (see section
53772 <xref linkend="SECTaclvariables"/>).
53773 </para>
53774 </listitem></varlistentry>
53775 <varlistentry>
53776 <term><emphasis role="bold">udpsend</emphasis>&nbsp;=&nbsp;&lt;<emphasis>parameters</emphasis>&gt;</term>
53777 <listitem>
53778 <para>
53779 This modifier sends a UDP packet, for purposes such as statistics
53780 collection or behaviour monitoring. The parameters are expanded, and
53781 the result of the expansion must be a colon-separated list consisting
53782 of a destination server, port number, and the packet contents. The
53783 server can be specified as a host name or IPv4 or IPv6 address. The
53784 separator can be changed with the usual angle bracket syntax. For
53785 example, you might want to collect information on which hosts connect
53786 when:
53787 </para>
53788 <literallayout class="monospaced">
53789 udpsend = &lt;; 2001:dB8::dead:beef ; 1234 ;\
53790              $tod_zulu $sender_host_address
53791 </literallayout>
53792 </listitem></varlistentry>
53793 </variablelist>
53794 </section>
53795 <section id="SECTcontrols">
53796 <title>Use of the control modifier</title>
53797 <para>
53798 <indexterm role="concept">
53799 <primary><option>control</option> ACL modifier</primary>
53800 </indexterm>
53801 The <option>control</option> modifier supports the following settings:
53802 </para>
53803 <variablelist>
53804 <varlistentry>
53805 <term><emphasis role="bold">control&nbsp;=&nbsp;allow_auth_unadvertised</emphasis></term>
53806 <listitem>
53807 <para>
53808 This modifier allows a client host to use the SMTP AUTH command even when it
53809 has not been advertised in response to EHLO. Furthermore, because there are
53810 apparently some really broken clients that do this, Exim will accept AUTH after
53811 HELO (rather than EHLO) when this control is set. It should be used only if you
53812 really need it, and you should limit its use to those broken clients that do
53813 not work without it. For example:
53814 </para>
53815 <literallayout class="monospaced">
53816 warn hosts   = 192.168.34.25
53817      control = allow_auth_unadvertised
53818 </literallayout>
53819 <para>
53820 Normally, when an Exim server receives an AUTH command, it checks the name of
53821 the authentication mechanism that is given in the command to ensure that it
53822 matches an advertised mechanism. When this control is set, the check that a
53823 mechanism has been advertised is bypassed. Any configured mechanism can be used
53824 by the client. This control is permitted only in the connection and HELO ACLs.
53825 </para>
53826 </listitem></varlistentry>
53827 <varlistentry>
53828 <term><emphasis role="bold">control&nbsp;=&nbsp;caseful_local_part</emphasis></term>
53829 <term><emphasis role="bold">control&nbsp;=&nbsp;caselower_local_part</emphasis></term>
53830 <listitem>
53831 <para>
53832 <indexterm role="concept">
53833 <primary>access control lists (ACLs)</primary>
53834 <secondary>case of local part in</secondary>
53835 </indexterm>
53836 <indexterm role="concept">
53837 <primary>case of local parts</primary>
53838 </indexterm>
53839 <indexterm role="variable">
53840 <primary><varname>$local_part</varname></primary>
53841 </indexterm>
53842 These two controls are permitted only in the ACL specified by <option>acl_smtp_rcpt</option>
53843 (that is, during RCPT processing). By default, the contents of <varname>$local_part</varname>
53844 are lower cased before ACL processing. If <quote>caseful_local_part</quote> is specified,
53845 any uppercase letters in the original local part are restored in <varname>$local_part</varname>
53846 for the rest of the ACL, or until a control that sets <quote>caselower_local_part</quote>
53847 is encountered.
53848 </para>
53849 <para>
53850 These controls affect only the current recipient. Moreover, they apply only to
53851 local part handling that takes place directly in the ACL (for example, as a key
53852 in lookups). If a test to verify the recipient is obeyed, the case-related
53853 handling of the local part during the verification is controlled by the router
53854 configuration (see the <option>caseful_local_part</option> generic router option).
53855 </para>
53856 <para>
53857 This facility could be used, for example, to add a spam score to local parts
53858 containing upper case letters. For example, using <varname>$acl_m4</varname> to accumulate the
53859 spam score:
53860 </para>
53861 <literallayout class="monospaced">
53862 warn  control = caseful_local_part
53863       set acl_m4 = ${eval:\
53864                      $acl_m4 + \
53865                      ${if match{$local_part}{[A-Z]}{1}{0}}\
53866                     }
53867       control = caselower_local_part
53868 </literallayout>
53869 <para>
53870 Notice that we put back the lower cased version afterwards, assuming that
53871 is what is wanted for subsequent tests.
53872 </para>
53873 </listitem></varlistentry>
53874 <varlistentry>
53875 <term><emphasis role="bold">control&nbsp;=&nbsp;cutthrough_delivery</emphasis></term>
53876 <listitem>
53877 <para>
53878 <indexterm role="concept">
53879 <primary>access control lists (ACLs)</primary>
53880 <secondary>cutthrough routing</secondary>
53881 </indexterm>
53882 <indexterm role="concept">
53883 <primary>cutthrough</primary>
53884 <secondary>requesting</secondary>
53885 </indexterm>
53886 This option requests delivery be attempted while the item is being received.
53887 </para>
53888 <para>
53889 The option is usable in the RCPT ACL.
53890 If enabled for a message received via smtp and routed to an smtp transport,
53891 </para>
53892 <para revisionflag="changed">
53893 and only one transport, interface, destination host and port combination
53894 is used for all recipients of the message,
53895 </para>
53896 <para>
53897 then the delivery connection is made while the receiving connection is open
53898 and data is copied from one to the other.
53899 </para>
53900 <para>
53901 An attempt to set this option for any recipient but the first
53902 for a mail will be quietly ignored.
53903 If a recipient-verify callout connection is subsequently
53904 requested in the same ACL it is held open and used for
53905 </para>
53906 <para revisionflag="changed">
53907 any subsequent recipients and the data,
53908 </para>
53909 <para>
53910 otherwise one is made after the initial RCPT ACL completes.
53911 </para>
53912 <para>
53913 Note that routers are used in verify mode,
53914 and cannot depend on content of received headers.
53915 Note also that headers cannot be
53916 modified by any of the post-data ACLs (DATA, MIME and DKIM).
53917 Headers may be modified by routers (subject to the above) and transports.
53918 </para>
53919 <para>
53920 Cutthrough delivery is not supported via transport-filters or when DKIM signing
53921 of outgoing messages is done, because it sends data to the ultimate destination
53922 before the entire message has been received from the source.
53923 </para>
53924 <para revisionflag="changed">
53925 It is not supported for messages received with the SMTP PRDR option in use.
53926 </para>
53927 <para>
53928 Should the ultimate destination system positively accept or reject the mail,
53929 a corresponding indication is given to the source system and nothing is queued.
53930 If there is a temporary error the item is queued for later delivery in the
53931 usual fashion. If the item is successfully delivered in cutthrough mode
53932 the delivery log lines are tagged with "&gt;&gt;" rather than "=&gt;" and appear
53933 before the acceptance "&lt;=" line.
53934 </para>
53935 <para>
53936 Delivery in this mode avoids the generation of a bounce mail to a
53937 (possibly faked)
53938 sender when the destination system is doing content-scan based rejection.
53939 </para>
53940 </listitem></varlistentry>
53941 <varlistentry>
53942 <term><emphasis role="bold">control&nbsp;=&nbsp;debug/</emphasis>&lt;<emphasis>options</emphasis>&gt;</term>
53943 <listitem>
53944 <para>
53945 <indexterm role="concept">
53946 <primary>access control lists (ACLs)</primary>
53947 <secondary>enabling debug logging</secondary>
53948 </indexterm>
53949 <indexterm role="concept">
53950 <primary>debugging</primary>
53951 <secondary>enabling from an ACL</secondary>
53952 </indexterm>
53953 This control turns on debug logging, almost as though Exim had been invoked
53954 with <literal>-d</literal>, with the output going to a new logfile, by default called
53955 <emphasis>debuglog</emphasis>.  The filename can be adjusted with the <emphasis>tag</emphasis> option, which
53956 may access any variables already defined.  The logging may be adjusted with
53957 the <emphasis>opts</emphasis> option, which takes the same values as the <literal>-d</literal> command-line
53958 option.  Some examples (which depend on variables that don&#x2019;t exist in all
53959 contexts):
53960 </para>
53961 <literallayout class="monospaced">
53962       control = debug
53963       control = debug/tag=.$sender_host_address
53964       control = debug/opts=+expand+acl
53965       control = debug/tag=.$message_exim_id/opts=+expand
53966 </literallayout>
53967 </listitem></varlistentry>
53968 <varlistentry>
53969 <term><emphasis role="bold">control&nbsp;=&nbsp;dkim_disable_verify</emphasis></term>
53970 <listitem>
53971 <para>
53972 <indexterm role="concept">
53973 <primary>disable DKIM verify</primary>
53974 </indexterm>
53975 <indexterm role="concept">
53976 <primary>DKIM</primary>
53977 <secondary>disable verify</secondary>
53978 </indexterm>
53979 This control turns off DKIM verification processing entirely.  For details on
53980 the operation and configuration of DKIM, see chapter <xref linkend="CHAPdkim"/>.
53981 </para>
53982 </listitem></varlistentry>
53983 <varlistentry>
53984 <term><emphasis role="bold">control&nbsp;=&nbsp;dscp/</emphasis>&lt;<emphasis>value</emphasis>&gt;</term>
53985 <listitem>
53986 <para>
53987 <indexterm role="concept">
53988 <primary>access control lists (ACLs)</primary>
53989 <secondary>setting DSCP value</secondary>
53990 </indexterm>
53991 <indexterm role="concept">
53992 <primary>DSCP</primary>
53993 <secondary>inbound</secondary>
53994 </indexterm>
53995 This option causes the DSCP value associated with the socket for the inbound
53996 connection to be adjusted to a given value, given as one of a number of fixed
53997 strings or to numeric value.
53998 The <option>-bI:dscp</option> option may be used to ask Exim which names it knows of.
53999 Common values include <literal>throughput</literal>, <literal>mincost</literal>, and on newer systems
54000 <literal>ef</literal>, <literal>af41</literal>, etc.  Numeric values may be in the range 0 to 0x3F.
54001 </para>
54002 <para>
54003 The outbound packets from Exim will be marked with this value in the header
54004 (for IPv4, the TOS field; for IPv6, the TCLASS field); there is no guarantee
54005 that these values will have any effect, not be stripped by networking
54006 equipment, or do much of anything without cooperation with your Network
54007 Engineer and those of all network operators between the source and destination.
54008 </para>
54009 </listitem></varlistentry>
54010 <varlistentry>
54011 <term><emphasis role="bold">control&nbsp;=&nbsp;enforce_sync</emphasis></term>
54012 <term><emphasis role="bold">control&nbsp;=&nbsp;no_enforce_sync</emphasis></term>
54013 <listitem>
54014 <para>
54015 <indexterm role="concept">
54016 <primary>SMTP</primary>
54017 <secondary>synchronization checking</secondary>
54018 </indexterm>
54019 <indexterm role="concept">
54020 <primary>synchronization checking in SMTP</primary>
54021 </indexterm>
54022 These controls make it possible to be selective about when SMTP synchronization
54023 is enforced. The global option <option>smtp_enforce_sync</option> specifies the initial
54024 state of the switch (it is true by default). See the description of this option
54025 in chapter <xref linkend="CHAPmainconfig"/> for details of SMTP synchronization checking.
54026 </para>
54027 <para>
54028 The effect of these two controls lasts for the remainder of the SMTP
54029 connection. They can appear in any ACL except the one for the non-SMTP
54030 messages. The most straightforward place to put them is in the ACL defined by
54031 <option>acl_smtp_connect</option>, which is run at the start of an incoming SMTP connection,
54032 before the first synchronization check. The expected use is to turn off the
54033 synchronization checks for badly-behaved hosts that you nevertheless need to
54034 work with.
54035 </para>
54036 </listitem></varlistentry>
54037 <varlistentry>
54038 <term><emphasis role="bold">control&nbsp;=&nbsp;fakedefer/</emphasis>&lt;<emphasis>message</emphasis>&gt;</term>
54039 <listitem>
54040 <para>
54041 <indexterm role="concept">
54042 <primary>fake defer</primary>
54043 </indexterm>
54044 <indexterm role="concept">
54045 <primary>defer, fake</primary>
54046 </indexterm>
54047 This control works in exactly the same way as <option>fakereject</option> (described below)
54048 except that it causes an SMTP 450 response after the message data instead of a
54049 550 response. You must take care when using <option>fakedefer</option> because it causes the
54050 messages to be duplicated when the sender retries. Therefore, you should not
54051 use <option>fakedefer</option> if the message is to be delivered normally.
54052 </para>
54053 </listitem></varlistentry>
54054 <varlistentry>
54055 <term><emphasis role="bold">control&nbsp;=&nbsp;fakereject/</emphasis>&lt;<emphasis>message</emphasis>&gt;</term>
54056 <listitem>
54057 <para>
54058 <indexterm role="concept">
54059 <primary>fake rejection</primary>
54060 </indexterm>
54061 <indexterm role="concept">
54062 <primary>rejection, fake</primary>
54063 </indexterm>
54064 This control is permitted only for the MAIL, RCPT, and DATA ACLs, in other
54065 words, only when an SMTP message is being received. If Exim accepts the
54066 message, instead the final 250 response, a 550 rejection message is sent.
54067 However, Exim proceeds to deliver the message as normal. The control applies
54068 only to the current message, not to any subsequent ones that may be received in
54069 the same SMTP connection.
54070 </para>
54071 <para>
54072 The text for the 550 response is taken from the <option>control</option> modifier. If no
54073 message is supplied, the following is used:
54074 </para>
54075 <literallayout class="monospaced">
54076 550-Your message has been rejected but is being
54077 550-kept for evaluation.
54078 550-If it was a legitimate message, it may still be
54079 550 delivered to the target recipient(s).
54080 </literallayout>
54081 <para>
54082 This facility should be used with extreme caution.
54083 </para>
54084 </listitem></varlistentry>
54085 <varlistentry>
54086 <term><emphasis role="bold">control&nbsp;=&nbsp;freeze</emphasis></term>
54087 <listitem>
54088 <para>
54089 <indexterm role="concept">
54090 <primary>frozen messages</primary>
54091 <secondary>forcing in ACL</secondary>
54092 </indexterm>
54093 This control is permitted only for the MAIL, RCPT, DATA, and non-SMTP ACLs, in
54094 other words, only when a message is being received. If the message is accepted,
54095 it is placed on Exim&#x2019;s queue and frozen. The control applies only to the
54096 current message, not to any subsequent ones that may be received in the same
54097 SMTP connection.
54098 </para>
54099 <para>
54100 This modifier can optionally be followed by <literal>/no_tell</literal>. If the global option
54101 <option>freeze_tell</option> is set, it is ignored for the current message (that is, nobody
54102 is told about the freezing), provided all the <emphasis role="bold">control=freeze</emphasis> modifiers that
54103 are obeyed for the current message have the <literal>/no_tell</literal> option.
54104 </para>
54105 </listitem></varlistentry>
54106 <varlistentry>
54107 <term><emphasis role="bold">control&nbsp;=&nbsp;no_delay_flush</emphasis></term>
54108 <listitem>
54109 <para>
54110 <indexterm role="concept">
54111 <primary>SMTP</primary>
54112 <secondary>output flushing, disabling for delay</secondary>
54113 </indexterm>
54114 Exim normally flushes SMTP output before implementing a delay in an ACL, to
54115 avoid unexpected timeouts in clients when the SMTP PIPELINING extension is in
54116 use. This control, as long as it is encountered before the <option>delay</option> modifier,
54117 disables such output flushing.
54118 </para>
54119 </listitem></varlistentry>
54120 <varlistentry>
54121 <term><emphasis role="bold">control&nbsp;=&nbsp;no_callout_flush</emphasis></term>
54122 <listitem>
54123 <para>
54124 <indexterm role="concept">
54125 <primary>SMTP</primary>
54126 <secondary>output flushing, disabling for callout</secondary>
54127 </indexterm>
54128 Exim normally flushes SMTP output before performing a callout in an ACL, to
54129 avoid unexpected timeouts in clients when the SMTP PIPELINING extension is in
54130 use. This control, as long as it is encountered before the <option>verify</option> condition
54131 that causes the callout, disables such output flushing.
54132 </para>
54133 </listitem></varlistentry>
54134 <varlistentry>
54135 <term><emphasis role="bold">control&nbsp;=&nbsp;no_mbox_unspool</emphasis></term>
54136 <listitem>
54137 <para>
54138 This control is available when Exim is compiled with the content scanning
54139 extension. Content scanning may require a copy of the current message, or parts
54140 of it, to be written in <quote>mbox format</quote> to a spool file, for passing to a virus
54141 or spam scanner. Normally, such copies are deleted when they are no longer
54142 needed. If this control is set, the copies are not deleted. The control applies
54143 only to the current message, not to any subsequent ones that may be received in
54144 the same SMTP connection. It is provided for debugging purposes and is unlikely
54145 to be useful in production.
54146 </para>
54147 </listitem></varlistentry>
54148 <varlistentry>
54149 <term><emphasis role="bold">control&nbsp;=&nbsp;no_multiline_responses</emphasis></term>
54150 <listitem>
54151 <para>
54152 <indexterm role="concept">
54153 <primary>multiline responses, suppressing</primary>
54154 </indexterm>
54155 This control is permitted for any ACL except the one for non-SMTP messages.
54156 It seems that there are broken clients in use that cannot handle multiline
54157 SMTP responses, despite the fact that RFC 821 defined them over 20 years ago.
54158 </para>
54159 <para>
54160 If this control is set, multiline SMTP responses from ACL rejections are
54161 suppressed. One way of doing this would have been to put out these responses as
54162 one long line. However, RFC 2821 specifies a maximum of 512 bytes per response
54163 (<quote>use multiline responses for more</quote> it says &ndash; ha!), and some of the
54164 responses might get close to that. So this facility, which is after all only a
54165 sop to broken clients, is implemented by doing two very easy things:
54166 </para>
54167 <itemizedlist>
54168 <listitem>
54169 <para>
54170 Extra information that is normally output as part of a rejection caused by
54171 sender verification failure is omitted. Only the final line (typically <quote>sender
54172 verification failed</quote>) is sent.
54173 </para>
54174 </listitem>
54175 <listitem>
54176 <para>
54177 If a <option>message</option> modifier supplies a multiline response, only the first
54178 line is output.
54179 </para>
54180 </listitem>
54181 </itemizedlist>
54182 <para>
54183 The setting of the switch can, of course, be made conditional on the
54184 calling host. Its effect lasts until the end of the SMTP connection.
54185 </para>
54186 </listitem></varlistentry>
54187 <varlistentry>
54188 <term><emphasis role="bold">control&nbsp;=&nbsp;no_pipelining</emphasis></term>
54189 <listitem>
54190 <para>
54191 <indexterm role="concept">
54192 <primary>PIPELINING</primary>
54193 <secondary>suppressing advertising</secondary>
54194 </indexterm>
54195 This control turns off the advertising of the PIPELINING extension to SMTP in
54196 the current session. To be useful, it must be obeyed before Exim sends its
54197 response to an EHLO command. Therefore, it should normally appear in an ACL
54198 controlled by <option>acl_smtp_connect</option> or <option>acl_smtp_helo</option>. See also
54199 <option>pipelining_advertise_hosts</option>.
54200 </para>
54201 </listitem></varlistentry>
54202 <varlistentry>
54203 <term><emphasis role="bold">control&nbsp;=&nbsp;queue_only</emphasis></term>
54204 <listitem>
54205 <para>
54206 <indexterm role="option">
54207 <primary><option>queue_only</option></primary>
54208 </indexterm>
54209 <indexterm role="concept">
54210 <primary>queueing incoming messages</primary>
54211 </indexterm>
54212 This control is permitted only for the MAIL, RCPT, DATA, and non-SMTP ACLs, in
54213 other words, only when a message is being received. If the message is accepted,
54214 it is placed on Exim&#x2019;s queue and left there for delivery by a subsequent queue
54215 runner. No immediate delivery process is started. In other words, it has the
54216 effect as the <option>queue_only</option> global option. However, the control applies only
54217 to the current message, not to any subsequent ones that may be received in the
54218 same SMTP connection.
54219 </para>
54220 </listitem></varlistentry>
54221 <varlistentry>
54222 <term><emphasis role="bold">control&nbsp;=&nbsp;submission/</emphasis>&lt;<emphasis>options</emphasis>&gt;</term>
54223 <listitem>
54224 <para>
54225 <indexterm role="concept">
54226 <primary>message</primary>
54227 <secondary>submission</secondary>
54228 </indexterm>
54229 <indexterm role="concept">
54230 <primary>submission mode</primary>
54231 </indexterm>
54232 This control is permitted only for the MAIL, RCPT, and start of data ACLs (the
54233 latter is the one defined by <option>acl_smtp_predata</option>). Setting it tells Exim that
54234 the current message is a submission from a local MUA. In this case, Exim
54235 operates in <quote>submission mode</quote>, and applies certain fixups to the message if
54236 necessary. For example, it adds a <emphasis>Date:</emphasis> header line if one is not present.
54237 This control is not permitted in the <option>acl_smtp_data</option> ACL, because that is too
54238 late (the message has already been created).
54239 </para>
54240 <para>
54241 Chapter <xref linkend="CHAPmsgproc"/> describes the processing that Exim applies to
54242 messages. Section <xref linkend="SECTsubmodnon"/> covers the processing that happens in
54243 submission mode; the available options for this control are described there.
54244 The control applies only to the current message, not to any subsequent ones
54245 that may be received in the same SMTP connection.
54246 </para>
54247 </listitem></varlistentry>
54248 <varlistentry>
54249 <term><emphasis role="bold">control&nbsp;=&nbsp;suppress_local_fixups</emphasis></term>
54250 <listitem>
54251 <para>
54252 <indexterm role="concept">
54253 <primary>submission fixups, suppressing</primary>
54254 </indexterm>
54255 This control applies to locally submitted (non TCP/IP) messages, and is the
54256 complement of <literal>control = submission</literal>. It disables the fixups that are
54257 normally applied to locally-submitted messages. Specifically:
54258 </para>
54259 <itemizedlist>
54260 <listitem>
54261 <para>
54262 Any <emphasis>Sender:</emphasis> header line is left alone (in this respect, it is a
54263 dynamic version of <option>local_sender_retain</option>).
54264 </para>
54265 </listitem>
54266 <listitem>
54267 <para>
54268 No <emphasis>Message-ID:</emphasis>, <emphasis>From:</emphasis>, or <emphasis>Date:</emphasis> header lines are added.
54269 </para>
54270 </listitem>
54271 <listitem>
54272 <para>
54273 There is no check that <emphasis>From:</emphasis> corresponds to the actual sender.
54274 </para>
54275 </listitem>
54276 </itemizedlist>
54277 <para>
54278 This control may be useful when a remotely-originated message is accepted,
54279 passed to some scanning program, and then re-submitted for delivery. It can be
54280 used only in the <option>acl_smtp_mail</option>, <option>acl_smtp_rcpt</option>, <option>acl_smtp_predata</option>,
54281 and <option>acl_not_smtp_start</option> ACLs, because it has to be set before the message&#x2019;s
54282 data is read.
54283 </para>
54284 <para>
54285 <emphasis role="bold">Note:</emphasis> This control applies only to the current message, not to any others
54286 that are being submitted at the same time using <option>-bs</option> or <option>-bS</option>.
54287 </para>
54288 </listitem></varlistentry>
54289 </variablelist>
54290 </section>
54291 <section id="SECTsummesfix">
54292 <title>Summary of message fixup control</title>
54293 <para>
54294 All four possibilities for message fixups can be specified:
54295 </para>
54296 <itemizedlist>
54297 <listitem>
54298 <para>
54299 Locally submitted, fixups applied: the default.
54300 </para>
54301 </listitem>
54302 <listitem>
54303 <para>
54304 Locally submitted, no fixups applied: use
54305 <literal>control = suppress_local_fixups</literal>.
54306 </para>
54307 </listitem>
54308 <listitem>
54309 <para>
54310 Remotely submitted, no fixups applied: the default.
54311 </para>
54312 </listitem>
54313 <listitem>
54314 <para>
54315 Remotely submitted, fixups applied: use <literal>control = submission</literal>.
54316 </para>
54317 </listitem>
54318 </itemizedlist>
54319 </section>
54320 <section id="SECTaddheadacl">
54321 <title>Adding header lines in ACLs</title>
54322 <para>
54323 <indexterm role="concept">
54324 <primary>header lines</primary>
54325 <secondary>adding in an ACL</secondary>
54326 </indexterm>
54327 <indexterm role="concept">
54328 <primary>header lines</primary>
54329 <secondary>position of added lines</secondary>
54330 </indexterm>
54331 <indexterm role="concept">
54332 <primary><option>add_header</option> ACL modifier</primary>
54333 </indexterm>
54334 The <option>add_header</option> modifier can be used to add one or more extra header lines
54335 to an incoming message, as in this example:
54336 </para>
54337 <literallayout class="monospaced">
54338 warn dnslists = sbl.spamhaus.org : \
54339                 dialup.mail-abuse.org
54340      add_header = X-blacklisted-at: $dnslist_domain
54341 </literallayout>
54342 <para>
54343 The <option>add_header</option> modifier is permitted in the MAIL, RCPT, PREDATA, DATA,
54344 MIME, DKIM, and non-SMTP ACLs (in other words, those that are concerned with
54345 receiving a message). The message must ultimately be accepted for
54346 <option>add_header</option> to have any significant effect. You can use <option>add_header</option> with
54347 any ACL verb, including <option>deny</option> (though this is potentially useful only in a
54348 RCPT ACL).
54349 </para>
54350 <para>
54351 Headers will not be added to the message if the modifier is used in
54352 DATA, MIME or DKIM ACLs for messages delivered by cutthrough routing.
54353 </para>
54354 <para>
54355 Leading and trailing newlines are removed from
54356 the data for the <option>add_header</option> modifier; if it then
54357 contains one or more newlines that
54358 are not followed by a space or a tab, it is assumed to contain multiple header
54359 lines. Each one is checked for valid syntax; <literal>X-ACL-Warn:</literal> is added to the
54360 front of any line that is not a valid header line.
54361 </para>
54362 <para>
54363 Added header lines are accumulated during the MAIL, RCPT, and predata ACLs.
54364 They are added to the message before processing the DATA and MIME ACLs.
54365 However, if an identical header line is requested more than once, only one copy
54366 is actually added to the message. Further header lines may be accumulated
54367 during the DATA and MIME ACLs, after which they are added to the message, again
54368 with duplicates suppressed. Thus, it is possible to add two identical header
54369 lines to an SMTP message, but only if one is added before DATA and one after.
54370 In the case of non-SMTP messages, new headers are accumulated during the
54371 non-SMTP ACLs, and are added to the message after all the ACLs have run. If a
54372 message is rejected after DATA or by the non-SMTP ACL, all added header lines
54373 are included in the entry that is written to the reject log.
54374 </para>
54375 <para>
54376 <indexterm role="concept">
54377 <primary>header lines</primary>
54378 <secondary>added; visibility of</secondary>
54379 </indexterm>
54380 Header lines are not visible in string expansions
54381 of message headers
54382 until they are added to the
54383 message. It follows that header lines defined in the MAIL, RCPT, and predata
54384 ACLs are not visible until the DATA ACL and MIME ACLs are run. Similarly,
54385 header lines that are added by the DATA or MIME ACLs are not visible in those
54386 ACLs. Because of this restriction, you cannot use header lines as a way of
54387 passing data between (for example) the MAIL and RCPT ACLs. If you want to do
54388 this, you can use ACL variables, as described in section
54389 <xref linkend="SECTaclvariables"/>.
54390 </para>
54391 <para>
54392 The list of headers yet to be added is given by the <option>$headers_added</option> variable.
54393 </para>
54394 <para>
54395 The <option>add_header</option> modifier acts immediately as it is encountered during the
54396 processing of an ACL. Notice the difference between these two cases:
54397 </para>
54398 <literallayout>
54399 <literal>accept add_header = ADDED: some text</literal>
54400 <literal>       </literal>&lt;<emphasis>some condition</emphasis>&gt;
54401
54402 <literal>accept </literal>&lt;<emphasis>some condition</emphasis>&gt;
54403 <literal>       add_header = ADDED: some text</literal>
54404 </literallayout>
54405 <para>
54406 In the first case, the header line is always added, whether or not the
54407 condition is true. In the second case, the header line is added only if the
54408 condition is true. Multiple occurrences of <option>add_header</option> may occur in the same
54409 ACL statement. All those that are encountered before a condition fails are
54410 honoured.
54411 </para>
54412 <para>
54413 <indexterm role="concept">
54414 <primary><option>warn</option> ACL verb</primary>
54415 </indexterm>
54416 For compatibility with previous versions of Exim, a <option>message</option> modifier for a
54417 <option>warn</option> verb acts in the same way as <option>add_header</option>, except that it takes
54418 effect only if all the conditions are true, even if it appears before some of
54419 them. Furthermore, only the last occurrence of <option>message</option> is honoured. This
54420 usage of <option>message</option> is now deprecated. If both <option>add_header</option> and <option>message</option>
54421 are present on a <option>warn</option> verb, both are processed according to their
54422 specifications.
54423 </para>
54424 <para>
54425 By default, new header lines are added to a message at the end of the existing
54426 header lines. However, you can specify that any particular header line should
54427 be added right at the start (before all the <emphasis>Received:</emphasis> lines), immediately
54428 after the first block of <emphasis>Received:</emphasis> lines, or immediately before any line
54429 that is not a <emphasis>Received:</emphasis> or <emphasis>Resent-something:</emphasis> header.
54430 </para>
54431 <para>
54432 This is done by specifying <quote>:at_start:</quote>, <quote>:after_received:</quote>, or
54433 <quote>:at_start_rfc:</quote> (or, for completeness, <quote>:at_end:</quote>) before the text of the
54434 header line, respectively. (Header text cannot start with a colon, as there has
54435 to be a header name first.) For example:
54436 </para>
54437 <literallayout class="monospaced">
54438 warn add_header = \
54439        :after_received:X-My-Header: something or other...
54440 </literallayout>
54441 <para>
54442 If more than one header line is supplied in a single <option>add_header</option> modifier,
54443 each one is treated independently and can therefore be placed differently. If
54444 you add more than one line at the start, or after the Received: block, they end
54445 up in reverse order.
54446 </para>
54447 <para>
54448 <emphasis role="bold">Warning</emphasis>: This facility currently applies only to header lines that are
54449 added in an ACL. It does NOT work for header lines that are added in a
54450 system filter or in a router or transport.
54451 </para>
54452 </section>
54453 <section id="SECTremoveheadacl">
54454 <title>Removing header lines in ACLs</title>
54455 <para>
54456 <indexterm role="concept">
54457 <primary>header lines</primary>
54458 <secondary>removing in an ACL</secondary>
54459 </indexterm>
54460 <indexterm role="concept">
54461 <primary>header lines</primary>
54462 <secondary>position of removed lines</secondary>
54463 </indexterm>
54464 <indexterm role="concept">
54465 <primary><option>remove_header</option> ACL modifier</primary>
54466 </indexterm>
54467 The <option>remove_header</option> modifier can be used to remove one or more header lines
54468 from an incoming message, as in this example:
54469 </para>
54470 <literallayout class="monospaced">
54471 warn   message        = Remove internal headers
54472        remove_header  = x-route-mail1 : x-route-mail2
54473 </literallayout>
54474 <para>
54475 The <option>remove_header</option> modifier is permitted in the MAIL, RCPT, PREDATA, DATA,
54476 MIME, DKIM, and non-SMTP ACLs (in other words, those that are concerned with
54477 receiving a message). The message must ultimately be accepted for
54478 <option>remove_header</option> to have any significant effect. You can use <option>remove_header</option>
54479 with any ACL verb, including <option>deny</option>, though this is really not useful for
54480 any verb that doesn&#x2019;t result in a delivered message.
54481 </para>
54482 <para>
54483 Headers will not be removed to the message if the modifier is used in
54484 DATA, MIME or DKIM ACLs for messages delivered by cutthrough routing.
54485 </para>
54486 <para>
54487 More than one header can be removed at the same time by using a colon separated
54488 list of header names. The header matching is case insensitive. Wildcards are
54489 not permitted, nor is list expansion performed, so you cannot use hostlists to
54490 create a list of headers, however both connection and message variable expansion
54491 are performed (<option>$acl_c_*</option> and <option>$acl_m_*</option>), illustrated in this example:
54492 </para>
54493 <literallayout class="monospaced">
54494 warn   hosts           = +internal_hosts
54495        set acl_c_ihdrs = x-route-mail1 : x-route-mail2
54496 warn   message         = Remove internal headers
54497        remove_header   = $acl_c_ihdrs
54498 </literallayout>
54499 <para>
54500 Removed header lines are accumulated during the MAIL, RCPT, and predata ACLs.
54501 They are removed from the message before processing the DATA and MIME ACLs.
54502 There is no harm in attempting to remove the same header twice nor is removing
54503 a non-existent header. Further header lines to be removed may be accumulated
54504 during the DATA and MIME ACLs, after which they are removed from the message,
54505 if present. In the case of non-SMTP messages, headers to be removed are
54506 accumulated during the non-SMTP ACLs, and are removed from the message after
54507 all the ACLs have run. If a message is rejected after DATA or by the non-SMTP
54508 ACL, there really is no effect because there is no logging of what headers
54509 would have been removed.
54510 </para>
54511 <para>
54512 <indexterm role="concept">
54513 <primary>header lines</primary>
54514 <secondary>removed; visibility of</secondary>
54515 </indexterm>
54516 Header lines are not visible in string expansions until the DATA phase when it
54517 is received. Any header lines removed in the MAIL, RCPT, and predata ACLs are
54518 not visible in the DATA ACL and MIME ACLs. Similarly, header lines that are
54519 removed by the DATA or MIME ACLs are still visible in those ACLs. Because of
54520 this restriction, you cannot use header lines as a way of controlling data
54521 passed between (for example) the MAIL and RCPT ACLs. If you want to do this,
54522 you should instead use ACL variables, as described in section
54523 <xref linkend="SECTaclvariables"/>.
54524 </para>
54525 <para>
54526 The <option>remove_header</option> modifier acts immediately as it is encountered during the
54527 processing of an ACL. Notice the difference between these two cases:
54528 </para>
54529 <literallayout>
54530 <literal>accept remove_header = X-Internal</literal>
54531 <literal>       </literal>&lt;<emphasis>some condition</emphasis>&gt;
54532
54533 <literal>accept </literal>&lt;<emphasis>some condition</emphasis>&gt;
54534 <literal>       remove_header = X-Internal</literal>
54535 </literallayout>
54536 <para>
54537 In the first case, the header line is always removed, whether or not the
54538 condition is true. In the second case, the header line is removed only if the
54539 condition is true. Multiple occurrences of <option>remove_header</option> may occur in the
54540 same ACL statement. All those that are encountered before a condition fails
54541 are honoured.
54542 </para>
54543 <para>
54544 <emphasis role="bold">Warning</emphasis>: This facility currently applies only to header lines that are
54545 present during ACL processing. It does NOT remove header lines that are added
54546 in a system filter or in a router or transport.
54547 </para>
54548 </section>
54549 <section id="SECTaclconditions">
54550 <title>ACL conditions</title>
54551 <para>
54552 <indexterm role="concept">
54553 <primary>access control lists (ACLs)</primary>
54554 <secondary>conditions; list of</secondary>
54555 </indexterm>
54556 Some of the conditions listed in this section are available only when Exim is
54557 compiled with the content-scanning extension. They are included here briefly
54558 for completeness. More detailed descriptions can be found in the discussion on
54559 content scanning in chapter <xref linkend="CHAPexiscan"/>.
54560 </para>
54561 <para>
54562 Not all conditions are relevant in all circumstances. For example, testing
54563 senders and recipients does not make sense in an ACL that is being run as the
54564 result of the arrival of an ETRN command, and checks on message headers can be
54565 done only in the ACLs specified by <option>acl_smtp_data</option> and <option>acl_not_smtp</option>. You
54566 can use the same condition (with different parameters) more than once in the
54567 same ACL statement. This provides a way of specifying an <quote>and</quote> conjunction.
54568 The conditions are as follows:
54569 </para>
54570 <variablelist>
54571 <varlistentry>
54572 <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>
54573 <listitem>
54574 <para>
54575 <indexterm role="concept">
54576 <primary>access control lists (ACLs)</primary>
54577 <secondary>nested</secondary>
54578 </indexterm>
54579 <indexterm role="concept">
54580 <primary>access control lists (ACLs)</primary>
54581 <secondary>indirect</secondary>
54582 </indexterm>
54583 <indexterm role="concept">
54584 <primary>access control lists (ACLs)</primary>
54585 <secondary>arguments</secondary>
54586 </indexterm>
54587 <indexterm role="concept">
54588 <primary><option>acl</option> ACL condition</primary>
54589 </indexterm>
54590 The possible values of the argument are the same as for the
54591 <option>acl_smtp_</option><emphasis>xxx</emphasis> options. The named or inline ACL is run. If it returns
54592 <quote>accept</quote> the condition is true; if it returns <quote>deny</quote> the condition is
54593 false. If it returns <quote>defer</quote>, the current ACL returns <quote>defer</quote> unless the
54594 condition is on a <option>warn</option> verb. In that case, a <quote>defer</quote> return makes the
54595 condition false. This means that further processing of the <option>warn</option> verb
54596 ceases, but processing of the ACL continues.
54597 </para>
54598 <para>
54599 If the argument is a named ACL, up to nine space-separated optional values
54600 can be appended; they appear within the called ACL in $acl_arg1 to $acl_arg9,
54601 and $acl_narg is set to the count of values.
54602 Previous values of these variables are restored after the call returns.
54603 The name and values are expanded separately.
54604 Note that spaces in complex expansions which are used as arguments
54605 will act as argument separators.
54606 </para>
54607 <para>
54608 If the nested <option>acl</option> returns <quote>drop</quote> and the outer condition denies access,
54609 the connection is dropped. If it returns <quote>discard</quote>, the verb must be
54610 <option>accept</option> or <option>discard</option>, and the action is taken immediately &ndash; no further
54611 conditions are tested.
54612 </para>
54613 <para>
54614 ACLs may be nested up to 20 deep; the limit exists purely to catch runaway
54615 loops. This condition allows you to use different ACLs in different
54616 circumstances. For example, different ACLs can be used to handle RCPT commands
54617 for different local users or different local domains.
54618 </para>
54619 </listitem></varlistentry>
54620 <varlistentry>
54621 <term><emphasis role="bold">authenticated&nbsp;=&nbsp;</emphasis>&lt;<emphasis>string&nbsp;list</emphasis>&gt;</term>
54622 <listitem>
54623 <para>
54624 <indexterm role="concept">
54625 <primary><option>authenticated</option> ACL condition</primary>
54626 </indexterm>
54627 <indexterm role="concept">
54628 <primary>authentication</primary>
54629 <secondary>ACL checking</secondary>
54630 </indexterm>
54631 <indexterm role="concept">
54632 <primary>access control lists (ACLs)</primary>
54633 <secondary>testing for authentication</secondary>
54634 </indexterm>
54635 If the SMTP connection is not authenticated, the condition is false. Otherwise,
54636 the name of the authenticator is tested against the list. To test for
54637 authentication by any authenticator, you can set
54638 </para>
54639 <literallayout class="monospaced">
54640 authenticated = *
54641 </literallayout>
54642 </listitem></varlistentry>
54643 <varlistentry>
54644 <term><emphasis role="bold">condition&nbsp;=&nbsp;</emphasis>&lt;<emphasis>string</emphasis>&gt;</term>
54645 <listitem>
54646 <para>
54647 <indexterm role="concept">
54648 <primary><option>condition</option> ACL condition</primary>
54649 </indexterm>
54650 <indexterm role="concept">
54651 <primary>customizing</primary>
54652 <secondary>ACL condition</secondary>
54653 </indexterm>
54654 <indexterm role="concept">
54655 <primary>access control lists (ACLs)</primary>
54656 <secondary>customized test</secondary>
54657 </indexterm>
54658 <indexterm role="concept">
54659 <primary>access control lists (ACLs)</primary>
54660 <secondary>testing, customized</secondary>
54661 </indexterm>
54662 This feature allows you to make up custom conditions. If the result of
54663 expanding the string is an empty string, the number zero, or one of the strings
54664 <quote>no</quote> or <quote>false</quote>, the condition is false. If the result is any non-zero
54665 number, or one of the strings <quote>yes</quote> or <quote>true</quote>, the condition is true. For
54666 any other value, some error is assumed to have occurred, and the ACL returns
54667 <quote>defer</quote>. However, if the expansion is forced to fail, the condition is
54668 ignored. The effect is to treat it as true, whether it is positive or
54669 negative.
54670 </para>
54671 </listitem></varlistentry>
54672 <varlistentry>
54673 <term><emphasis role="bold">decode&nbsp;=&nbsp;</emphasis>&lt;<emphasis>location</emphasis>&gt;</term>
54674 <listitem>
54675 <para>
54676 <indexterm role="concept">
54677 <primary><option>decode</option> ACL condition</primary>
54678 </indexterm>
54679 This condition is available only when Exim is compiled with the
54680 content-scanning extension, and it is allowed only in the ACL defined by
54681 <option>acl_smtp_mime</option>. It causes the current MIME part to be decoded into a file.
54682 If all goes well, the condition is true. It is false only if there are
54683 problems such as a syntax error or a memory shortage. For more details, see
54684 chapter <xref linkend="CHAPexiscan"/>.
54685 </para>
54686 </listitem></varlistentry>
54687 <varlistentry>
54688 <term><emphasis role="bold">demime&nbsp;=&nbsp;</emphasis>&lt;<emphasis>extension&nbsp;list</emphasis>&gt;</term>
54689 <listitem>
54690 <para>
54691 <indexterm role="concept">
54692 <primary><option>demime</option> ACL condition</primary>
54693 </indexterm>
54694 This condition is available only when Exim is compiled with the
54695 content-scanning extension. Its use is described in section
54696 <xref linkend="SECTdemimecond"/>.
54697 </para>
54698 </listitem></varlistentry>
54699 <varlistentry>
54700 <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>
54701 <listitem>
54702 <para>
54703 <indexterm role="concept">
54704 <primary><option>dnslists</option> ACL condition</primary>
54705 </indexterm>
54706 <indexterm role="concept">
54707 <primary>DNS list</primary>
54708 <secondary>in ACL</secondary>
54709 </indexterm>
54710 <indexterm role="concept">
54711 <primary>black list (DNS)</primary>
54712 </indexterm>
54713 <indexterm role="concept">
54714 <primary>access control lists (ACLs)</primary>
54715 <secondary>testing a DNS list</secondary>
54716 </indexterm>
54717 This condition checks for entries in DNS black lists. These are also known as
54718 <quote>RBL lists</quote>, after the original Realtime Blackhole List, but note that the
54719 use of the lists at <emphasis>mail-abuse.org</emphasis> now carries a charge. There are too many
54720 different variants of this condition to describe briefly here. See sections
54721 <xref linkend="SECTmorednslists"/>&ndash;<xref linkend="SECTmorednslistslast"/> for details.
54722 </para>
54723 </listitem></varlistentry>
54724 <varlistentry>
54725 <term><emphasis role="bold">domains&nbsp;=&nbsp;</emphasis>&lt;<emphasis>domain&nbsp;list</emphasis>&gt;</term>
54726 <listitem>
54727 <para>
54728 <indexterm role="concept">
54729 <primary><option>domains</option> ACL condition</primary>
54730 </indexterm>
54731 <indexterm role="concept">
54732 <primary>domain</primary>
54733 <secondary>ACL checking</secondary>
54734 </indexterm>
54735 <indexterm role="concept">
54736 <primary>access control lists (ACLs)</primary>
54737 <secondary>testing a recipient domain</secondary>
54738 </indexterm>
54739 <indexterm role="variable">
54740 <primary><varname>$domain_data</varname></primary>
54741 </indexterm>
54742 This condition is relevant only after a RCPT command. It checks that the domain
54743 of the recipient address is in the domain list. If percent-hack processing is
54744 enabled, it is done before this test is done. If the check succeeds with a
54745 lookup, the result of the lookup is placed in <varname>$domain_data</varname> until the next
54746 <option>domains</option> test.
54747 </para>
54748 <para>
54749 <emphasis role="bold">Note carefully</emphasis> (because many people seem to fall foul of this): you cannot
54750 use <option>domains</option> in a DATA ACL.
54751 </para>
54752 </listitem></varlistentry>
54753 <varlistentry>
54754 <term><emphasis role="bold">encrypted&nbsp;=&nbsp;</emphasis>&lt;<emphasis>string&nbsp;list</emphasis>&gt;</term>
54755 <listitem>
54756 <para>
54757 <indexterm role="concept">
54758 <primary><option>encrypted</option> ACL condition</primary>
54759 </indexterm>
54760 <indexterm role="concept">
54761 <primary>encryption</primary>
54762 <secondary>checking in an ACL</secondary>
54763 </indexterm>
54764 <indexterm role="concept">
54765 <primary>access control lists (ACLs)</primary>
54766 <secondary>testing for encryption</secondary>
54767 </indexterm>
54768 If the SMTP connection is not encrypted, the condition is false. Otherwise, the
54769 name of the cipher suite in use is tested against the list. To test for
54770 encryption without testing for any specific cipher suite(s), set
54771 </para>
54772 <literallayout class="monospaced">
54773 encrypted = *
54774 </literallayout>
54775 </listitem></varlistentry>
54776 <varlistentry>
54777 <term><emphasis role="bold">hosts&nbsp;=&nbsp;</emphasis>&lt;<emphasis>host&nbsp;list</emphasis>&gt;</term>
54778 <listitem>
54779 <para>
54780 <indexterm role="concept">
54781 <primary><option>hosts</option> ACL condition</primary>
54782 </indexterm>
54783 <indexterm role="concept">
54784 <primary>host</primary>
54785 <secondary>ACL checking</secondary>
54786 </indexterm>
54787 <indexterm role="concept">
54788 <primary>access control lists (ACLs)</primary>
54789 <secondary>testing the client host</secondary>
54790 </indexterm>
54791 This condition tests that the calling host matches the host list. If you have
54792 name lookups or wildcarded host names and IP addresses in the same host list,
54793 you should normally put the IP addresses first. For example, you could have:
54794 </para>
54795 <literallayout class="monospaced">
54796 accept hosts = 10.9.8.7 : dbm;/etc/friendly/hosts
54797 </literallayout>
54798 <para>
54799 The lookup in this example uses the host name for its key. This is implied by
54800 the lookup type <quote>dbm</quote>. (For a host address lookup you would use <quote>net-dbm</quote>
54801 and it wouldn&#x2019;t matter which way round you had these two items.)
54802 </para>
54803 <para>
54804 The reason for the problem with host names lies in the left-to-right way that
54805 Exim processes lists. It can test IP addresses without doing any DNS lookups,
54806 but when it reaches an item that requires a host name, it fails if it cannot
54807 find a host name to compare with the pattern. If the above list is given in the
54808 opposite order, the <option>accept</option> statement fails for a host whose name cannot be
54809 found, even if its IP address is 10.9.8.7.
54810 </para>
54811 <para>
54812 If you really do want to do the name check first, and still recognize the IP
54813 address even if the name lookup fails, you can rewrite the ACL like this:
54814 </para>
54815 <literallayout class="monospaced">
54816 accept hosts = dbm;/etc/friendly/hosts
54817 accept hosts = 10.9.8.7
54818 </literallayout>
54819 <para>
54820 The default action on failing to find the host name is to assume that the host
54821 is not in the list, so the first <option>accept</option> statement fails. The second
54822 statement can then check the IP address.
54823 </para>
54824 <para>
54825 <indexterm role="variable">
54826 <primary><varname>$host_data</varname></primary>
54827 </indexterm>
54828 If a <option>hosts</option> condition is satisfied by means of a lookup, the result
54829 of the lookup is made available in the <varname>$host_data</varname> variable. This
54830 allows you, for example, to set up a statement like this:
54831 </para>
54832 <literallayout class="monospaced">
54833 deny  hosts = net-lsearch;/some/file
54834 message = $host_data
54835 </literallayout>
54836 <para>
54837 which gives a custom error message for each denied host.
54838 </para>
54839 </listitem></varlistentry>
54840 <varlistentry>
54841 <term><emphasis role="bold">local_parts&nbsp;=&nbsp;</emphasis>&lt;<emphasis>local&nbsp;part&nbsp;list</emphasis>&gt;</term>
54842 <listitem>
54843 <para>
54844 <indexterm role="concept">
54845 <primary><option>local_parts</option> ACL condition</primary>
54846 </indexterm>
54847 <indexterm role="concept">
54848 <primary>local part</primary>
54849 <secondary>ACL checking</secondary>
54850 </indexterm>
54851 <indexterm role="concept">
54852 <primary>access control lists (ACLs)</primary>
54853 <secondary>testing a local part</secondary>
54854 </indexterm>
54855 <indexterm role="variable">
54856 <primary><varname>$local_part_data</varname></primary>
54857 </indexterm>
54858 This condition is relevant only after a RCPT command. It checks that the local
54859 part of the recipient address is in the list. If percent-hack processing is
54860 enabled, it is done before this test. If the check succeeds with a lookup, the
54861 result of the lookup is placed in <varname>$local_part_data</varname>, which remains set until
54862 the next <option>local_parts</option> test.
54863 </para>
54864 </listitem></varlistentry>
54865 <varlistentry>
54866 <term><emphasis role="bold">malware&nbsp;=&nbsp;</emphasis>&lt;<emphasis>option</emphasis>&gt;</term>
54867 <listitem>
54868 <para>
54869 <indexterm role="concept">
54870 <primary><option>malware</option> ACL condition</primary>
54871 </indexterm>
54872 <indexterm role="concept">
54873 <primary>access control lists (ACLs)</primary>
54874 <secondary>virus scanning</secondary>
54875 </indexterm>
54876 <indexterm role="concept">
54877 <primary>access control lists (ACLs)</primary>
54878 <secondary>scanning for viruses</secondary>
54879 </indexterm>
54880 This condition is available only when Exim is compiled with the
54881 content-scanning extension. It causes the incoming message to be scanned for
54882 viruses. For details, see chapter <xref linkend="CHAPexiscan"/>.
54883 </para>
54884 </listitem></varlistentry>
54885 <varlistentry>
54886 <term><emphasis role="bold">mime_regex&nbsp;=&nbsp;</emphasis>&lt;<emphasis>list&nbsp;of&nbsp;regular&nbsp;expressions</emphasis>&gt;</term>
54887 <listitem>
54888 <para>
54889 <indexterm role="concept">
54890 <primary><option>mime_regex</option> ACL condition</primary>
54891 </indexterm>
54892 <indexterm role="concept">
54893 <primary>access control lists (ACLs)</primary>
54894 <secondary>testing by regex matching</secondary>
54895 </indexterm>
54896 This condition is available only when Exim is compiled with the
54897 content-scanning extension, and it is allowed only in the ACL defined by
54898 <option>acl_smtp_mime</option>. It causes the current MIME part to be scanned for a match
54899 with any of the regular expressions. For details, see chapter
54900 <xref linkend="CHAPexiscan"/>.
54901 </para>
54902 </listitem></varlistentry>
54903 <varlistentry>
54904 <term><emphasis role="bold">ratelimit&nbsp;=&nbsp;</emphasis>&lt;<emphasis>parameters</emphasis>&gt;</term>
54905 <listitem>
54906 <para>
54907 <indexterm role="concept">
54908 <primary>rate limiting</primary>
54909 </indexterm>
54910 This condition can be used to limit the rate at which a user or host submits
54911 messages. Details are given in section <xref linkend="SECTratelimiting"/>.
54912 </para>
54913 </listitem></varlistentry>
54914 <varlistentry>
54915 <term><emphasis role="bold">recipients&nbsp;=&nbsp;</emphasis>&lt;<emphasis>address&nbsp;list</emphasis>&gt;</term>
54916 <listitem>
54917 <para>
54918 <indexterm role="concept">
54919 <primary><option>recipients</option> ACL condition</primary>
54920 </indexterm>
54921 <indexterm role="concept">
54922 <primary>recipient</primary>
54923 <secondary>ACL checking</secondary>
54924 </indexterm>
54925 <indexterm role="concept">
54926 <primary>access control lists (ACLs)</primary>
54927 <secondary>testing a recipient</secondary>
54928 </indexterm>
54929 This condition is relevant only after a RCPT command. It checks the entire
54930 recipient address against a list of recipients.
54931 </para>
54932 </listitem></varlistentry>
54933 <varlistentry>
54934 <term><emphasis role="bold">regex&nbsp;=&nbsp;</emphasis>&lt;<emphasis>list&nbsp;of&nbsp;regular&nbsp;expressions</emphasis>&gt;</term>
54935 <listitem>
54936 <para>
54937 <indexterm role="concept">
54938 <primary><option>regex</option> ACL condition</primary>
54939 </indexterm>
54940 <indexterm role="concept">
54941 <primary>access control lists (ACLs)</primary>
54942 <secondary>testing by regex matching</secondary>
54943 </indexterm>
54944 This condition is available only when Exim is compiled with the
54945 content-scanning extension, and is available only in the DATA, MIME, and
54946 non-SMTP ACLs. It causes the incoming message to be scanned for a match with
54947 any of the regular expressions. For details, see chapter <xref linkend="CHAPexiscan"/>.
54948 </para>
54949 </listitem></varlistentry>
54950 <varlistentry>
54951 <term><emphasis role="bold">sender_domains&nbsp;=&nbsp;</emphasis>&lt;<emphasis>domain&nbsp;list</emphasis>&gt;</term>
54952 <listitem>
54953 <para>
54954 <indexterm role="concept">
54955 <primary><option>sender_domains</option> ACL condition</primary>
54956 </indexterm>
54957 <indexterm role="concept">
54958 <primary>sender</primary>
54959 <secondary>ACL checking</secondary>
54960 </indexterm>
54961 <indexterm role="concept">
54962 <primary>access control lists (ACLs)</primary>
54963 <secondary>testing a sender domain</secondary>
54964 </indexterm>
54965 <indexterm role="variable">
54966 <primary><varname>$domain</varname></primary>
54967 </indexterm>
54968 <indexterm role="variable">
54969 <primary><varname>$sender_address_domain</varname></primary>
54970 </indexterm>
54971 This condition tests the domain of the sender of the message against the given
54972 domain list. <emphasis role="bold">Note</emphasis>: The domain of the sender address is in
54973 <varname>$sender_address_domain</varname>. It is <emphasis>not</emphasis> put in <varname>$domain</varname> during the testing
54974 of this condition. This is an exception to the general rule for testing domain
54975 lists. It is done this way so that, if this condition is used in an ACL for a
54976 RCPT command, the recipient&#x2019;s domain (which is in <varname>$domain</varname>) can be used to
54977 influence the sender checking.
54978 </para>
54979 <para>
54980 <emphasis role="bold">Warning</emphasis>: It is a bad idea to use this condition on its own as a control on
54981 relaying, because sender addresses are easily, and commonly, forged.
54982 </para>
54983 </listitem></varlistentry>
54984 <varlistentry>
54985 <term><emphasis role="bold">senders&nbsp;=&nbsp;</emphasis>&lt;<emphasis>address&nbsp;list</emphasis>&gt;</term>
54986 <listitem>
54987 <para>
54988 <indexterm role="concept">
54989 <primary><option>senders</option> ACL condition</primary>
54990 </indexterm>
54991 <indexterm role="concept">
54992 <primary>sender</primary>
54993 <secondary>ACL checking</secondary>
54994 </indexterm>
54995 <indexterm role="concept">
54996 <primary>access control lists (ACLs)</primary>
54997 <secondary>testing a sender</secondary>
54998 </indexterm>
54999 This condition tests the sender of the message against the given list. To test
55000 for a bounce message, which has an empty sender, set
55001 </para>
55002 <literallayout class="monospaced">
55003 senders = :
55004 </literallayout>
55005 <para>
55006 <emphasis role="bold">Warning</emphasis>: It is a bad idea to use this condition on its own as a control on
55007 relaying, because sender addresses are easily, and commonly, forged.
55008 </para>
55009 </listitem></varlistentry>
55010 <varlistentry>
55011 <term><emphasis role="bold">spam&nbsp;=&nbsp;</emphasis>&lt;<emphasis>username</emphasis>&gt;</term>
55012 <listitem>
55013 <para>
55014 <indexterm role="concept">
55015 <primary><option>spam</option> ACL condition</primary>
55016 </indexterm>
55017 <indexterm role="concept">
55018 <primary>access control lists (ACLs)</primary>
55019 <secondary>scanning for spam</secondary>
55020 </indexterm>
55021 This condition is available only when Exim is compiled with the
55022 content-scanning extension. It causes the incoming message to be scanned by
55023 SpamAssassin. For details, see chapter <xref linkend="CHAPexiscan"/>.
55024 </para>
55025 </listitem></varlistentry>
55026 <varlistentry>
55027 <term><emphasis role="bold">verify&nbsp;=&nbsp;certificate</emphasis></term>
55028 <listitem>
55029 <para>
55030 <indexterm role="concept">
55031 <primary><option>verify</option> ACL condition</primary>
55032 </indexterm>
55033 <indexterm role="concept">
55034 <primary>TLS</primary>
55035 <secondary>client certificate verification</secondary>
55036 </indexterm>
55037 <indexterm role="concept">
55038 <primary>certificate</primary>
55039 <secondary>verification of client</secondary>
55040 </indexterm>
55041 <indexterm role="concept">
55042 <primary>access control lists (ACLs)</primary>
55043 <secondary>certificate verification</secondary>
55044 </indexterm>
55045 <indexterm role="concept">
55046 <primary>access control lists (ACLs)</primary>
55047 <secondary>testing a TLS certificate</secondary>
55048 </indexterm>
55049 This condition is true in an SMTP session if the session is encrypted, and a
55050 certificate was received from the client, and the certificate was verified. The
55051 server requests a certificate only if the client matches <option>tls_verify_hosts</option>
55052 or <option>tls_try_verify_hosts</option> (see chapter <xref linkend="CHAPTLS"/>).
55053 </para>
55054 </listitem></varlistentry>
55055 <varlistentry>
55056 <term><emphasis role="bold">verify&nbsp;=&nbsp;csa</emphasis></term>
55057 <listitem>
55058 <para>
55059 <indexterm role="concept">
55060 <primary>CSA verification</primary>
55061 </indexterm>
55062 This condition checks whether the sending host (the client) is authorized to
55063 send email. Details of how this works are given in section
55064 <xref linkend="SECTverifyCSA"/>.
55065 </para>
55066 </listitem></varlistentry>
55067 <varlistentry>
55068 <term><emphasis role="bold">verify&nbsp;=&nbsp;header_names_ascii</emphasis></term>
55069 <listitem>
55070 <para>
55071 <indexterm role="concept">
55072 <primary><option>verify</option> ACL condition</primary>
55073 </indexterm>
55074 <indexterm role="concept">
55075 <primary>access control lists (ACLs)</primary>
55076 <secondary>verifying header names only ASCII</secondary>
55077 </indexterm>
55078 <indexterm role="concept">
55079 <primary>header lines</primary>
55080 <secondary>verifying header names only ASCII</secondary>
55081 </indexterm>
55082 <indexterm role="concept">
55083 <primary>verifying</primary>
55084 <secondary>header names only ASCII</secondary>
55085 </indexterm>
55086 This condition is relevant only in an ACL that is run after a message has been
55087 received, that is, in an ACL specified by <option>acl_smtp_data</option> or
55088 <option>acl_not_smtp</option>.  It checks all header names (not the content) to make sure
55089 there are no non-ASCII characters, also excluding control characters.  The
55090 allowable characters are decimal ASCII values 33 through 126.
55091 </para>
55092 <para>
55093 Exim itself will handle headers with non-ASCII characters, but it can cause
55094 problems for downstream applications, so this option will allow their
55095 detection and rejection in the DATA ACL&#x2019;s.
55096 </para>
55097 </listitem></varlistentry>
55098 <varlistentry>
55099 <term><emphasis role="bold">verify&nbsp;=&nbsp;header_sender/</emphasis>&lt;<emphasis>options</emphasis>&gt;</term>
55100 <listitem>
55101 <para>
55102 <indexterm role="concept">
55103 <primary><option>verify</option> ACL condition</primary>
55104 </indexterm>
55105 <indexterm role="concept">
55106 <primary>access control lists (ACLs)</primary>
55107 <secondary>verifying sender in the header</secondary>
55108 </indexterm>
55109 <indexterm role="concept">
55110 <primary>header lines</primary>
55111 <secondary>verifying the sender in</secondary>
55112 </indexterm>
55113 <indexterm role="concept">
55114 <primary>sender</primary>
55115 <secondary>verifying in header</secondary>
55116 </indexterm>
55117 <indexterm role="concept">
55118 <primary>verifying</primary>
55119 <secondary>sender in header</secondary>
55120 </indexterm>
55121 This condition is relevant only in an ACL that is run after a message has been
55122 received, that is, in an ACL specified by <option>acl_smtp_data</option> or
55123 <option>acl_not_smtp</option>. It checks that there is a verifiable address in at least one
55124 of the <emphasis>Sender:</emphasis>, <emphasis>Reply-To:</emphasis>, or <emphasis>From:</emphasis> header lines. Such an address
55125 is loosely thought of as a <quote>sender</quote> address (hence the name of the test).
55126 However, an address that appears in one of these headers need not be an address
55127 that accepts bounce messages; only sender addresses in envelopes are required
55128 to accept bounces. Therefore, if you use the callout option on this check, you
55129 might want to arrange for a non-empty address in the MAIL command.
55130 </para>
55131 <para>
55132 Details of address verification and the options are given later, starting at
55133 section <xref linkend="SECTaddressverification"/> (callouts are described in section
55134 <xref linkend="SECTcallver"/>). You can combine this condition with the <option>senders</option>
55135 condition to restrict it to bounce messages only:
55136 </para>
55137 <literallayout class="monospaced">
55138 deny    senders = :
55139         message = A valid sender header is required for bounces
55140        !verify  = header_sender
55141 </literallayout>
55142 </listitem></varlistentry>
55143 <varlistentry>
55144 <term><emphasis role="bold">verify&nbsp;=&nbsp;header_syntax</emphasis></term>
55145 <listitem>
55146 <para>
55147 <indexterm role="concept">
55148 <primary><option>verify</option> ACL condition</primary>
55149 </indexterm>
55150 <indexterm role="concept">
55151 <primary>access control lists (ACLs)</primary>
55152 <secondary>verifying header syntax</secondary>
55153 </indexterm>
55154 <indexterm role="concept">
55155 <primary>header lines</primary>
55156 <secondary>verifying syntax</secondary>
55157 </indexterm>
55158 <indexterm role="concept">
55159 <primary>verifying</primary>
55160 <secondary>header syntax</secondary>
55161 </indexterm>
55162 This condition is relevant only in an ACL that is run after a message has been
55163 received, that is, in an ACL specified by <option>acl_smtp_data</option> or
55164 <option>acl_not_smtp</option>. It checks the syntax of all header lines that can contain
55165 lists of addresses (<emphasis>Sender:</emphasis>, <emphasis>From:</emphasis>, <emphasis>Reply-To:</emphasis>, <emphasis>To:</emphasis>, <emphasis>Cc:</emphasis>,
55166 and <emphasis>Bcc:</emphasis>). Unqualified addresses (local parts without domains) are
55167 permitted only in locally generated messages and from hosts that match
55168 <option>sender_unqualified_hosts</option> or <option>recipient_unqualified_hosts</option>, as
55169 appropriate.
55170 </para>
55171 <para>
55172 Note that this condition is a syntax check only. However, a common spamming
55173 ploy used to be to send syntactically invalid headers such as
55174 </para>
55175 <literallayout class="monospaced">
55176 To: @
55177 </literallayout>
55178 <para>
55179 and this condition can be used to reject such messages, though they are not as
55180 common as they used to be.
55181 </para>
55182 </listitem></varlistentry>
55183 <varlistentry>
55184 <term><emphasis role="bold">verify&nbsp;=&nbsp;helo</emphasis></term>
55185 <listitem>
55186 <para>
55187 <indexterm role="concept">
55188 <primary><option>verify</option> ACL condition</primary>
55189 </indexterm>
55190 <indexterm role="concept">
55191 <primary>access control lists (ACLs)</primary>
55192 <secondary>verifying HELO/EHLO</secondary>
55193 </indexterm>
55194 <indexterm role="concept">
55195 <primary>HELO</primary>
55196 <secondary>verifying</secondary>
55197 </indexterm>
55198 <indexterm role="concept">
55199 <primary>EHLO</primary>
55200 <secondary>verifying</secondary>
55201 </indexterm>
55202 <indexterm role="concept">
55203 <primary>verifying</primary>
55204 <secondary>EHLO</secondary>
55205 </indexterm>
55206 <indexterm role="concept">
55207 <primary>verifying</primary>
55208 <secondary>HELO</secondary>
55209 </indexterm>
55210 This condition is true if a HELO or EHLO command has been received from the
55211 client host, and its contents have been verified. If there has been no previous
55212 attempt to verify the HELO/EHLO contents, it is carried out when this
55213 condition is encountered. See the description of the <option>helo_verify_hosts</option> and
55214 <option>helo_try_verify_hosts</option> options for details of how to request verification
55215 independently of this condition.
55216 </para>
55217 <para>
55218 For SMTP input that does not come over TCP/IP (the <option>-bs</option> command line
55219 option), this condition is always true.
55220 </para>
55221 </listitem></varlistentry>
55222 <varlistentry>
55223 <term><emphasis role="bold">verify&nbsp;=&nbsp;not_blind</emphasis></term>
55224 <listitem>
55225 <para>
55226 <indexterm role="concept">
55227 <primary>verifying</primary>
55228 <secondary>not blind</secondary>
55229 </indexterm>
55230 <indexterm role="concept">
55231 <primary>bcc recipients, verifying none</primary>
55232 </indexterm>
55233 This condition checks that there are no blind (bcc) recipients in the message.
55234 Every envelope recipient must appear either in a <emphasis>To:</emphasis> header line or in a
55235 <emphasis>Cc:</emphasis> header line for this condition to be true. Local parts are checked
55236 case-sensitively; domains are checked case-insensitively. If <emphasis>Resent-To:</emphasis> or
55237 <emphasis>Resent-Cc:</emphasis> header lines exist, they are also checked. This condition can be
55238 used only in a DATA or non-SMTP ACL.
55239 </para>
55240 <para>
55241 There are, of course, many legitimate messages that make use of blind (bcc)
55242 recipients. This check should not be used on its own for blocking messages.
55243 </para>
55244 </listitem></varlistentry>
55245 <varlistentry>
55246 <term><emphasis role="bold">verify&nbsp;=&nbsp;recipient/</emphasis>&lt;<emphasis>options</emphasis>&gt;</term>
55247 <listitem>
55248 <para>
55249 <indexterm role="concept">
55250 <primary><option>verify</option> ACL condition</primary>
55251 </indexterm>
55252 <indexterm role="concept">
55253 <primary>access control lists (ACLs)</primary>
55254 <secondary>verifying recipient</secondary>
55255 </indexterm>
55256 <indexterm role="concept">
55257 <primary>recipient</primary>
55258 <secondary>verifying</secondary>
55259 </indexterm>
55260 <indexterm role="concept">
55261 <primary>verifying</primary>
55262 <secondary>recipient</secondary>
55263 </indexterm>
55264 <indexterm role="variable">
55265 <primary><varname>$address_data</varname></primary>
55266 </indexterm>
55267 This condition is relevant only after a RCPT command. It verifies the current
55268 recipient. Details of address verification are given later, starting at section
55269 <xref linkend="SECTaddressverification"/>. After a recipient has been verified, the value
55270 of <varname>$address_data</varname> is the last value that was set while routing the address.
55271 This applies even if the verification fails. When an address that is being
55272 verified is redirected to a single address, verification continues with the new
55273 address, and in that case, the subsequent value of <varname>$address_data</varname> is the
55274 value for the child address.
55275 </para>
55276 </listitem></varlistentry>
55277 <varlistentry>
55278 <term><emphasis role="bold">verify&nbsp;=&nbsp;reverse_host_lookup/</emphasis>&lt;<emphasis>options</emphasis>&gt;</term>
55279 <listitem>
55280 <para>
55281 <indexterm role="concept">
55282 <primary><option>verify</option> ACL condition</primary>
55283 </indexterm>
55284 <indexterm role="concept">
55285 <primary>access control lists (ACLs)</primary>
55286 <secondary>verifying host reverse lookup</secondary>
55287 </indexterm>
55288 <indexterm role="concept">
55289 <primary>host</primary>
55290 <secondary>verifying reverse lookup</secondary>
55291 </indexterm>
55292 This condition ensures that a verified host name has been looked up from the IP
55293 address of the client host. (This may have happened already if the host name
55294 was needed for checking a host list, or if the host matched <option>host_lookup</option>.)
55295 Verification ensures that the host name obtained from a reverse DNS lookup, or
55296 one of its aliases, does, when it is itself looked up in the DNS, yield the
55297 original IP address.
55298 </para>
55299 <para revisionflag="changed">
55300 There is one possible option, <literal>defer_ok</literal>.  If this is present and a
55301 DNS operation returns a temporary error, the verify condition succeeds.
55302 </para>
55303 <para>
55304 If this condition is used for a locally generated message (that is, when there
55305 is no client host involved), it always succeeds.
55306 </para>
55307 </listitem></varlistentry>
55308 <varlistentry>
55309 <term><emphasis role="bold">verify&nbsp;=&nbsp;sender/</emphasis>&lt;<emphasis>options</emphasis>&gt;</term>
55310 <listitem>
55311 <para>
55312 <indexterm role="concept">
55313 <primary><option>verify</option> ACL condition</primary>
55314 </indexterm>
55315 <indexterm role="concept">
55316 <primary>access control lists (ACLs)</primary>
55317 <secondary>verifying sender</secondary>
55318 </indexterm>
55319 <indexterm role="concept">
55320 <primary>sender</primary>
55321 <secondary>verifying</secondary>
55322 </indexterm>
55323 <indexterm role="concept">
55324 <primary>verifying</primary>
55325 <secondary>sender</secondary>
55326 </indexterm>
55327 This condition is relevant only after a MAIL or RCPT command, or after a
55328 message has been received (the <option>acl_smtp_data</option> or <option>acl_not_smtp</option> ACLs). If
55329 the message&#x2019;s sender is empty (that is, this is a bounce message), the
55330 condition is true. Otherwise, the sender address is verified.
55331 </para>
55332 <para>
55333 <indexterm role="variable">
55334 <primary><varname>$address_data</varname></primary>
55335 </indexterm>
55336 <indexterm role="variable">
55337 <primary><varname>$sender_address_data</varname></primary>
55338 </indexterm>
55339 If there is data in the <varname>$address_data</varname> variable at the end of routing, its
55340 value is placed in <varname>$sender_address_data</varname> at the end of verification. This
55341 value can be used in subsequent conditions and modifiers in the same ACL
55342 statement. It does not persist after the end of the current statement. If you
55343 want to preserve the value for longer, you can save it in an ACL variable.
55344 </para>
55345 <para>
55346 Details of verification are given later, starting at section
55347 <xref linkend="SECTaddressverification"/>. Exim caches the result of sender verification,
55348 to avoid doing it more than once per message.
55349 </para>
55350 </listitem></varlistentry>
55351 <varlistentry>
55352 <term><emphasis role="bold">verify&nbsp;=&nbsp;sender=</emphasis>&lt;<emphasis>address</emphasis>&gt;<emphasis role="bold">/</emphasis>&lt;<emphasis>options</emphasis>&gt;</term>
55353 <listitem>
55354 <para>
55355 <indexterm role="concept">
55356 <primary><option>verify</option> ACL condition</primary>
55357 </indexterm>
55358 This is a variation of the previous option, in which a modified address is
55359 verified as a sender.
55360 </para>
55361 </listitem></varlistentry>
55362 </variablelist>
55363 </section>
55364 <section id="SECTmorednslists">
55365 <title>Using DNS lists</title>
55366 <para>
55367 <indexterm role="concept">
55368 <primary>DNS list</primary>
55369 <secondary>in ACL</secondary>
55370 </indexterm>
55371 <indexterm role="concept">
55372 <primary>black list (DNS)</primary>
55373 </indexterm>
55374 <indexterm role="concept">
55375 <primary>access control lists (ACLs)</primary>
55376 <secondary>testing a DNS list</secondary>
55377 </indexterm>
55378 In its simplest form, the <option>dnslists</option> condition tests whether the calling host
55379 is on at least one of a number of DNS lists by looking up the inverted IP
55380 address in one or more DNS domains. (Note that DNS list domains are not mail
55381 domains, so the <literal>+</literal> syntax for named lists doesn&#x2019;t work - it is used for
55382 special options instead.) For example, if the calling host&#x2019;s IP
55383 address is 192.168.62.43, and the ACL statement is
55384 </para>
55385 <literallayout class="monospaced">
55386 deny dnslists = blackholes.mail-abuse.org : \
55387                 dialups.mail-abuse.org
55388 </literallayout>
55389 <para>
55390 the following records are looked up:
55391 </para>
55392 <literallayout class="monospaced">
55393 43.62.168.192.blackholes.mail-abuse.org
55394 43.62.168.192.dialups.mail-abuse.org
55395 </literallayout>
55396 <para>
55397 As soon as Exim finds an existing DNS record, processing of the list stops.
55398 Thus, multiple entries on the list provide an <quote>or</quote> conjunction. If you want
55399 to test that a host is on more than one list (an <quote>and</quote> conjunction), you can
55400 use two separate conditions:
55401 </para>
55402 <literallayout class="monospaced">
55403 deny dnslists = blackholes.mail-abuse.org
55404      dnslists = dialups.mail-abuse.org
55405 </literallayout>
55406 <para>
55407 If a DNS lookup times out or otherwise fails to give a decisive answer, Exim
55408 behaves as if the host does not match the list item, that is, as if the DNS
55409 record does not exist. If there are further items in the DNS list, they are
55410 processed.
55411 </para>
55412 <para>
55413 This is usually the required action when <option>dnslists</option> is used with <option>deny</option>
55414 (which is the most common usage), because it prevents a DNS failure from
55415 blocking mail. However, you can change this behaviour by putting one of the
55416 following special items in the list:
55417 </para>
55418 <literallayout>
55419 <literal>+include_unknown </literal>   behave as if the item is on the list
55420 <literal>+exclude_unknown </literal>   behave as if the item is not on the list (default)
55421 <literal>+defer_unknown   </literal>   give a temporary error
55422 </literallayout>
55423 <para>
55424 <indexterm role="concept">
55425 <primary><literal>+include_unknown</literal></primary>
55426 </indexterm>
55427 <indexterm role="concept">
55428 <primary><literal>+exclude_unknown</literal></primary>
55429 </indexterm>
55430 <indexterm role="concept">
55431 <primary><literal>+defer_unknown</literal></primary>
55432 </indexterm>
55433 Each of these applies to any subsequent items on the list. For example:
55434 </para>
55435 <literallayout class="monospaced">
55436 deny dnslists = +defer_unknown : foo.bar.example
55437 </literallayout>
55438 <para>
55439 Testing the list of domains stops as soon as a match is found. If you want to
55440 warn for one list and block for another, you can use two different statements:
55441 </para>
55442 <literallayout class="monospaced">
55443 deny  dnslists = blackholes.mail-abuse.org
55444 warn  message  = X-Warn: sending host is on dialups list
55445       dnslists = dialups.mail-abuse.org
55446 </literallayout>
55447 <para>
55448 DNS list lookups are cached by Exim for the duration of the SMTP session,
55449 so a lookup based on the IP address is done at most once for any incoming
55450 connection. Exim does not share information between multiple incoming
55451 connections (but your local name server cache should be active).
55452 </para>
55453 </section>
55454 <section id="SECID201">
55455 <title>Specifying the IP address for a DNS list lookup</title>
55456 <para>
55457 <indexterm role="concept">
55458 <primary>DNS list</primary>
55459 <secondary>keyed by explicit IP address</secondary>
55460 </indexterm>
55461 By default, the IP address that is used in a DNS list lookup is the IP address
55462 of the calling host. However, you can specify another IP address by listing it
55463 after the domain name, introduced by a slash. For example:
55464 </para>
55465 <literallayout class="monospaced">
55466 deny dnslists = black.list.tld/192.168.1.2
55467 </literallayout>
55468 <para>
55469 This feature is not very helpful with explicit IP addresses; it is intended for
55470 use with IP addresses that are looked up, for example, the IP addresses of the
55471 MX hosts or nameservers of an email sender address. For an example, see section
55472 <xref linkend="SECTmulkeyfor"/> below.
55473 </para>
55474 </section>
55475 <section id="SECID202">
55476 <title>DNS lists keyed on domain names</title>
55477 <para>
55478 <indexterm role="concept">
55479 <primary>DNS list</primary>
55480 <secondary>keyed by domain name</secondary>
55481 </indexterm>
55482 There are some lists that are keyed on domain names rather than inverted IP
55483 addresses (see for example the <emphasis>domain based zones</emphasis> link at
55484 <emphasis role="bold"><ulink url="http://www.rfc-ignorant.org/">http://www.rfc-ignorant.org/</ulink></emphasis>). No reversing of components is used
55485 with these lists. You can change the name that is looked up in a DNS list by
55486 listing it after the domain name, introduced by a slash. For example,
55487 </para>
55488 <literallayout class="monospaced">
55489 deny  message  = Sender's domain is listed at $dnslist_domain
55490       dnslists = dsn.rfc-ignorant.org/$sender_address_domain
55491 </literallayout>
55492 <para>
55493 This particular example is useful only in ACLs that are obeyed after the
55494 RCPT or DATA commands, when a sender address is available. If (for
55495 example) the message&#x2019;s sender is <emphasis>user@tld.example</emphasis> the name that is looked
55496 up by this example is
55497 </para>
55498 <literallayout class="monospaced">
55499 tld.example.dsn.rfc-ignorant.org
55500 </literallayout>
55501 <para>
55502 A single <option>dnslists</option> condition can contain entries for both names and IP
55503 addresses. For example:
55504 </para>
55505 <literallayout class="monospaced">
55506 deny dnslists = sbl.spamhaus.org : \
55507                 dsn.rfc-ignorant.org/$sender_address_domain
55508 </literallayout>
55509 <para>
55510 The first item checks the sending host&#x2019;s IP address; the second checks a domain
55511 name. The whole condition is true if either of the DNS lookups succeeds.
55512 </para>
55513 </section>
55514 <section id="SECTmulkeyfor">
55515 <title>Multiple explicit keys for a DNS list</title>
55516 <para>
55517 <indexterm role="concept">
55518 <primary>DNS list</primary>
55519 <secondary>multiple keys for</secondary>
55520 </indexterm>
55521 The syntax described above for looking up explicitly-defined values (either
55522 names or IP addresses) in a DNS blacklist is a simplification. After the domain
55523 name for the DNS list, what follows the slash can in fact be a list of items.
55524 As with all lists in Exim, the default separator is a colon. However, because
55525 this is a sublist within the list of DNS blacklist domains, it is necessary
55526 either to double the separators like this:
55527 </para>
55528 <literallayout class="monospaced">
55529 dnslists = black.list.tld/name.1::name.2
55530 </literallayout>
55531 <para>
55532 or to change the separator character, like this:
55533 </para>
55534 <literallayout class="monospaced">
55535 dnslists = black.list.tld/&lt;;name.1;name.2
55536 </literallayout>
55537 <para>
55538 If an item in the list is an IP address, it is inverted before the DNS
55539 blacklist domain is appended. If it is not an IP address, no inversion
55540 occurs. Consider this condition:
55541 </para>
55542 <literallayout class="monospaced">
55543 dnslists = black.list.tld/&lt;;192.168.1.2;a.domain
55544 </literallayout>
55545 <para>
55546 The DNS lookups that occur are:
55547 </para>
55548 <literallayout class="monospaced">
55549 2.1.168.192.black.list.tld
55550 a.domain.black.list.tld
55551 </literallayout>
55552 <para>
55553 Once a DNS record has been found (that matches a specific IP return
55554 address, if specified &ndash; see section <xref linkend="SECTaddmatcon"/>), no further lookups
55555 are done. If there is a temporary DNS error, the rest of the sublist of domains
55556 or IP addresses is tried. A temporary error for the whole dnslists item occurs
55557 only if no other DNS lookup in this sublist succeeds. In other words, a
55558 successful lookup for any of the items in the sublist overrides a temporary
55559 error for a previous item.
55560 </para>
55561 <para>
55562 The ability to supply a list of items after the slash is in some sense just a
55563 syntactic convenience. These two examples have the same effect:
55564 </para>
55565 <literallayout class="monospaced">
55566 dnslists = black.list.tld/a.domain : black.list.tld/b.domain
55567 dnslists = black.list.tld/a.domain::b.domain
55568 </literallayout>
55569 <para>
55570 However, when the data for the list is obtained from a lookup, the second form
55571 is usually much more convenient. Consider this example:
55572 </para>
55573 <literallayout class="monospaced">
55574 deny message  = The mail servers for the domain \
55575                 $sender_address_domain \
55576                 are listed at $dnslist_domain ($dnslist_value); \
55577                 see $dnslist_text.
55578      dnslists = sbl.spamhaus.org/&lt;|${lookup dnsdb {&gt;|a=&lt;|\
55579                                    ${lookup dnsdb {&gt;|mxh=\
55580                                    $sender_address_domain} }} }
55581 </literallayout>
55582 <para>
55583 Note the use of <literal>&gt;|</literal> in the dnsdb lookup to specify the separator for
55584 multiple DNS records. The inner dnsdb lookup produces a list of MX hosts
55585 and the outer dnsdb lookup finds the IP addresses for these hosts. The result
55586 of expanding the condition might be something like this:
55587 </para>
55588 <literallayout class="monospaced">
55589 dnslists = sbl.spahmaus.org/&lt;|192.168.2.3|192.168.5.6|...
55590 </literallayout>
55591 <para>
55592 Thus, this example checks whether or not the IP addresses of the sender
55593 domain&#x2019;s mail servers are on the Spamhaus black list.
55594 </para>
55595 <para>
55596 The key that was used for a successful DNS list lookup is put into the variable
55597 <varname>$dnslist_matched</varname> (see section <xref linkend="SECID204"/>).
55598 </para>
55599 </section>
55600 <section id="SECID203">
55601 <title>Data returned by DNS lists</title>
55602 <para>
55603 <indexterm role="concept">
55604 <primary>DNS list</primary>
55605 <secondary>data returned from</secondary>
55606 </indexterm>
55607 DNS lists are constructed using address records in the DNS. The original RBL
55608 just used the address 127.0.0.1 on the right hand side of each record, but the
55609 RBL+ list and some other lists use a number of values with different meanings.
55610 The values used on the RBL+ list are:
55611 </para>
55612 <literallayout>
55613 127.1.0.1  RBL
55614 127.1.0.2  DUL
55615 127.1.0.3  DUL and RBL
55616 127.1.0.4  RSS
55617 127.1.0.5  RSS and RBL
55618 127.1.0.6  RSS and DUL
55619 127.1.0.7  RSS and DUL and RBL
55620 </literallayout>
55621 <para>
55622 Section <xref linkend="SECTaddmatcon"/> below describes how you can distinguish between
55623 different values. Some DNS lists may return more than one address record;
55624 see section <xref linkend="SECThanmuldnsrec"/> for details of how they are checked.
55625 </para>
55626 </section>
55627 <section id="SECID204">
55628 <title>Variables set from DNS lists</title>
55629 <para>
55630 <indexterm role="concept">
55631 <primary>expansion</primary>
55632 <secondary>variables, set from DNS list</secondary>
55633 </indexterm>
55634 <indexterm role="concept">
55635 <primary>DNS list</primary>
55636 <secondary>variables set from</secondary>
55637 </indexterm>
55638 <indexterm role="variable">
55639 <primary><varname>$dnslist_domain</varname></primary>
55640 </indexterm>
55641 <indexterm role="variable">
55642 <primary><varname>$dnslist_matched</varname></primary>
55643 </indexterm>
55644 <indexterm role="variable">
55645 <primary><varname>$dnslist_text</varname></primary>
55646 </indexterm>
55647 <indexterm role="variable">
55648 <primary><varname>$dnslist_value</varname></primary>
55649 </indexterm>
55650 When an entry is found in a DNS list, the variable <varname>$dnslist_domain</varname> contains
55651 the name of the overall domain that matched (for example,
55652 <literal>spamhaus.example</literal>), <varname>$dnslist_matched</varname> contains the key within that domain
55653 (for example, <literal>192.168.5.3</literal>), and <varname>$dnslist_value</varname> contains the data from
55654 the DNS record. When the key is an IP address, it is not reversed in
55655 <varname>$dnslist_matched</varname> (though it is, of course, in the actual lookup). In simple
55656 cases, for example:
55657 </para>
55658 <literallayout class="monospaced">
55659 deny dnslists = spamhaus.example
55660 </literallayout>
55661 <para>
55662 the key is also available in another variable (in this case,
55663 <varname>$sender_host_address</varname>). In more complicated cases, however, this is not true.
55664 For example, using a data lookup (as described in section <xref linkend="SECTmulkeyfor"/>)
55665 might generate a dnslists lookup like this:
55666 </para>
55667 <literallayout class="monospaced">
55668 deny dnslists = spamhaus.example/&lt;|192.168.1.2|192.168.6.7|...
55669 </literallayout>
55670 <para>
55671 If this condition succeeds, the value in <varname>$dnslist_matched</varname> might be
55672 <literal>192.168.6.7</literal> (for example).
55673 </para>
55674 <para>
55675 If more than one address record is returned by the DNS lookup, all the IP
55676 addresses are included in <varname>$dnslist_value</varname>, separated by commas and spaces.
55677 The variable <varname>$dnslist_text</varname> contains the contents of any associated TXT
55678 record. For lists such as RBL+ the TXT record for a merged entry is often not
55679 very meaningful. See section <xref linkend="SECTmordetinf"/> for a way of obtaining more
55680 information.
55681 </para>
55682 <para>
55683 You can use the DNS list variables in <option>message</option> or <option>log_message</option> modifiers
55684 &ndash; although these appear before the condition in the ACL, they are not
55685 expanded until after it has failed. For example:
55686 </para>
55687 <literallayout class="monospaced">
55688 deny    hosts = !+local_networks
55689         message = $sender_host_address is listed \
55690                   at $dnslist_domain
55691         dnslists = rbl-plus.mail-abuse.example
55692 </literallayout>
55693 </section>
55694 <section id="SECTaddmatcon">
55695 <title>Additional matching conditions for DNS lists</title>
55696 <para>
55697 <indexterm role="concept">
55698 <primary>DNS list</primary>
55699 <secondary>matching specific returned data</secondary>
55700 </indexterm>
55701 You can add an equals sign and an IP address after a <option>dnslists</option> domain name
55702 in order to restrict its action to DNS records with a matching right hand side.
55703 For example,
55704 </para>
55705 <literallayout class="monospaced">
55706 deny dnslists = rblplus.mail-abuse.org=127.0.0.2
55707 </literallayout>
55708 <para>
55709 rejects only those hosts that yield 127.0.0.2. Without this additional data,
55710 any address record is considered to be a match. For the moment, we assume
55711 that the DNS lookup returns just one record. Section <xref linkend="SECThanmuldnsrec"/>
55712 describes how multiple records are handled.
55713 </para>
55714 <para>
55715 More than one IP address may be given for checking, using a comma as a
55716 separator. These are alternatives &ndash; if any one of them matches, the
55717 <option>dnslists</option> condition is true. For example:
55718 </para>
55719 <literallayout class="monospaced">
55720 deny  dnslists = a.b.c=127.0.0.2,127.0.0.3
55721 </literallayout>
55722 <para>
55723 If you want to specify a constraining address list and also specify names or IP
55724 addresses to be looked up, the constraining address list must be specified
55725 first. For example:
55726 </para>
55727 <literallayout class="monospaced">
55728 deny dnslists = dsn.rfc-ignorant.org\
55729                 =127.0.0.2/$sender_address_domain
55730 </literallayout>
55731 <para>
55732 If the character <literal>&amp;</literal> is used instead of <literal>=</literal>, the comparison for each
55733 listed IP address is done by a bitwise <quote>and</quote> instead of by an equality test.
55734 In other words, the listed addresses are used as bit masks. The comparison is
55735 true if all the bits in the mask are present in the address that is being
55736 tested. For example:
55737 </para>
55738 <literallayout class="monospaced">
55739 dnslists = a.b.c&amp;0.0.0.3
55740 </literallayout>
55741 <para>
55742 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
55743 want to test whether one bit or another bit is present (as opposed to both
55744 being present), you must use multiple values. For example:
55745 </para>
55746 <literallayout class="monospaced">
55747 dnslists = a.b.c&amp;0.0.0.1,0.0.0.2
55748 </literallayout>
55749 <para>
55750 matches if the final component of the address is an odd number or two times
55751 an odd number.
55752 </para>
55753 </section>
55754 <section id="SECID205">
55755 <title>Negated DNS matching conditions</title>
55756 <para>
55757 You can supply a negative list of IP addresses as part of a <option>dnslists</option>
55758 condition. Whereas
55759 </para>
55760 <literallayout class="monospaced">
55761 deny  dnslists = a.b.c=127.0.0.2,127.0.0.3
55762 </literallayout>
55763 <para>
55764 means <quote>deny if the host is in the black list at the domain <emphasis>a.b.c</emphasis> and the
55765 IP address yielded by the list is either 127.0.0.2 or 127.0.0.3</quote>,
55766 </para>
55767 <literallayout class="monospaced">
55768 deny  dnslists = a.b.c!=127.0.0.2,127.0.0.3
55769 </literallayout>
55770 <para>
55771 means <quote>deny if the host is in the black list at the domain <emphasis>a.b.c</emphasis> and the
55772 IP address yielded by the list is not 127.0.0.2 and not 127.0.0.3</quote>. In other
55773 words, the result of the test is inverted if an exclamation mark appears before
55774 the <literal>=</literal> (or the <literal>&amp;</literal>) sign.
55775 </para>
55776 <para>
55777 <emphasis role="bold">Note</emphasis>: This kind of negation is not the same as negation in a domain,
55778 host, or address list (which is why the syntax is different).
55779 </para>
55780 <para>
55781 If you are using just one list, the negation syntax does not gain you much. The
55782 previous example is precisely equivalent to
55783 </para>
55784 <literallayout class="monospaced">
55785 deny  dnslists = a.b.c
55786      !dnslists = a.b.c=127.0.0.2,127.0.0.3
55787 </literallayout>
55788 <para>
55789 However, if you are using multiple lists, the negation syntax is clearer.
55790 Consider this example:
55791 </para>
55792 <literallayout class="monospaced">
55793 deny  dnslists = sbl.spamhaus.org : \
55794                  list.dsbl.org : \
55795                  dnsbl.njabl.org!=127.0.0.3 : \
55796                  relays.ordb.org
55797 </literallayout>
55798 <para>
55799 Using only positive lists, this would have to be:
55800 </para>
55801 <literallayout class="monospaced">
55802 deny  dnslists = sbl.spamhaus.org : \
55803                  list.dsbl.org
55804 deny  dnslists = dnsbl.njabl.org
55805      !dnslists = dnsbl.njabl.org=127.0.0.3
55806 deny  dnslists = relays.ordb.org
55807 </literallayout>
55808 <para>
55809 which is less clear, and harder to maintain.
55810 </para>
55811 </section>
55812 <section id="SECThanmuldnsrec">
55813 <title>Handling multiple DNS records from a DNS list</title>
55814 <para>
55815 A DNS lookup for a <option>dnslists</option> condition may return more than one DNS record,
55816 thereby providing more than one IP address. When an item in a <option>dnslists</option> list
55817 is followed by <literal>=</literal> or <literal>&amp;</literal> and a list of IP addresses, in order to restrict
55818 the match to specific results from the DNS lookup, there are two ways in which
55819 the checking can be handled. For example, consider the condition:
55820 </para>
55821 <literallayout class="monospaced">
55822 dnslists = a.b.c=127.0.0.1
55823 </literallayout>
55824 <para>
55825 What happens if the DNS lookup for the incoming IP address yields both
55826 127.0.0.1 and 127.0.0.2 by means of two separate DNS records? Is the
55827 condition true because at least one given value was found, or is it false
55828 because at least one of the found values was not listed? And how does this
55829 affect negated conditions? Both possibilities are provided for with the help of
55830 additional separators <literal>==</literal> and <literal>=&amp;</literal>.
55831 </para>
55832 <itemizedlist>
55833 <listitem>
55834 <para>
55835 If <literal>=</literal> or <literal>&amp;</literal> is used, the condition is true if any one of the looked up
55836 IP addresses matches one of the listed addresses. For the example above, the
55837 condition is true because 127.0.0.1 matches.
55838 </para>
55839 </listitem>
55840 <listitem>
55841 <para>
55842 If <literal>==</literal> or <literal>=&amp;</literal> is used, the condition is true only if every one of the
55843 looked up IP addresses matches one of the listed addresses. If the condition is
55844 changed to:
55845 </para>
55846 <literallayout class="monospaced">
55847 dnslists = a.b.c==127.0.0.1
55848 </literallayout>
55849 <para>
55850 and the DNS lookup yields both 127.0.0.1 and 127.0.0.2, the condition is
55851 false because 127.0.0.2 is not listed. You would need to have:
55852 </para>
55853 <literallayout class="monospaced">
55854 dnslists = a.b.c==127.0.0.1,127.0.0.2
55855 </literallayout>
55856 <para>
55857 for the condition to be true.
55858 </para>
55859 </listitem>
55860 </itemizedlist>
55861 <para>
55862 When <literal>!</literal> is used to negate IP address matching, it inverts the result, giving
55863 the precise opposite of the behaviour above. Thus:
55864 </para>
55865 <itemizedlist>
55866 <listitem>
55867 <para>
55868 If <literal>!=</literal> or <literal>!&amp;</literal> is used, the condition is true if none of the looked up IP
55869 addresses matches one of the listed addresses. Consider:
55870 </para>
55871 <literallayout class="monospaced">
55872 dnslists = a.b.c!&amp;0.0.0.1
55873 </literallayout>
55874 <para>
55875 If the DNS lookup yields both 127.0.0.1 and 127.0.0.2, the condition is
55876 false because 127.0.0.1 matches.
55877 </para>
55878 </listitem>
55879 <listitem>
55880 <para>
55881 If <literal>!==</literal> or <literal>!=&amp;</literal> is used, the condition is true if there is at least one
55882 looked up IP address that does not match. Consider:
55883 </para>
55884 <literallayout class="monospaced">
55885 dnslists = a.b.c!=&amp;0.0.0.1
55886 </literallayout>
55887 <para>
55888 If the DNS lookup yields both 127.0.0.1 and 127.0.0.2, the condition is
55889 true, because 127.0.0.2 does not match. You would need to have:
55890 </para>
55891 <literallayout class="monospaced">
55892 dnslists = a.b.c!=&amp;0.0.0.1,0.0.0.2
55893 </literallayout>
55894 <para>
55895 for the condition to be false.
55896 </para>
55897 </listitem>
55898 </itemizedlist>
55899 <para>
55900 When the DNS lookup yields only a single IP address, there is no difference
55901 between <literal>=</literal> and <literal>==</literal> and between <literal>&amp;</literal> and <literal>=&amp;</literal>.
55902 </para>
55903 </section>
55904 <section id="SECTmordetinf">
55905 <title>Detailed information from merged DNS lists</title>
55906 <para>
55907 <indexterm role="concept">
55908 <primary>DNS list</primary>
55909 <secondary>information from merged</secondary>
55910 </indexterm>
55911 When the facility for restricting the matching IP values in a DNS list is used,
55912 the text from the TXT record that is set in <varname>$dnslist_text</varname> may not reflect
55913 the true reason for rejection. This happens when lists are merged and the IP
55914 address in the A record is used to distinguish them; unfortunately there is
55915 only one TXT record. One way round this is not to use merged lists, but that
55916 can be inefficient because it requires multiple DNS lookups where one would do
55917 in the vast majority of cases when the host of interest is not on any of the
55918 lists.
55919 </para>
55920 <para>
55921 A less inefficient way of solving this problem is available. If
55922 two domain names, comma-separated, are given, the second is used first to
55923 do an initial check, making use of any IP value restrictions that are set.
55924 If there is a match, the first domain is used, without any IP value
55925 restrictions, to get the TXT record. As a byproduct of this, there is also
55926 a check that the IP being tested is indeed on the first list. The first
55927 domain is the one that is put in <varname>$dnslist_domain</varname>. For example:
55928 </para>
55929 <literallayout class="monospaced">
55930 reject message  = \
55931          rejected because $sender_host_address is blacklisted \
55932          at $dnslist_domain\n$dnslist_text
55933        dnslists = \
55934          sbl.spamhaus.org,sbl-xbl.spamhaus.org=127.0.0.2 : \
55935          dul.dnsbl.sorbs.net,dnsbl.sorbs.net=127.0.0.10
55936 </literallayout>
55937 <para>
55938 For the first blacklist item, this starts by doing a lookup in
55939 <emphasis>sbl-xbl.spamhaus.org</emphasis> and testing for a 127.0.0.2 return. If there is a
55940 match, it then looks in <emphasis>sbl.spamhaus.org</emphasis>, without checking the return
55941 value, and as long as something is found, it looks for the corresponding TXT
55942 record. If there is no match in <emphasis>sbl-xbl.spamhaus.org</emphasis>, nothing more is done.
55943 The second blacklist item is processed similarly.
55944 </para>
55945 <para>
55946 If you are interested in more than one merged list, the same list must be
55947 given several times, but because the results of the DNS lookups are cached,
55948 the DNS calls themselves are not repeated. For example:
55949 </para>
55950 <literallayout class="monospaced">
55951 reject dnslists = \
55952          http.dnsbl.sorbs.net,dnsbl.sorbs.net=127.0.0.2 : \
55953          socks.dnsbl.sorbs.net,dnsbl.sorbs.net=127.0.0.3 : \
55954          misc.dnsbl.sorbs.net,dnsbl.sorbs.net=127.0.0.4 : \
55955          dul.dnsbl.sorbs.net,dnsbl.sorbs.net=127.0.0.10
55956 </literallayout>
55957 <para>
55958 In this case there is one lookup in <emphasis>dnsbl.sorbs.net</emphasis>, and if none of the IP
55959 values matches (or if no record is found), this is the only lookup that is
55960 done. Only if there is a match is one of the more specific lists consulted.
55961 </para>
55962 </section>
55963 <section id="SECTmorednslistslast">
55964 <title>DNS lists and IPv6</title>
55965 <para>
55966 <indexterm role="concept">
55967 <primary>IPv6</primary>
55968 <secondary>DNS black lists</secondary>
55969 </indexterm>
55970 <indexterm role="concept">
55971 <primary>DNS list</primary>
55972 <secondary>IPv6 usage</secondary>
55973 </indexterm>
55974 If Exim is asked to do a dnslist lookup for an IPv6 address, it inverts it
55975 nibble by nibble. For example, if the calling host&#x2019;s IP address is
55976 3ffe:ffff:836f:0a00:000a:0800:200a:c031, Exim might look up
55977 </para>
55978 <literallayout class="monospaced">
55979 1.3.0.c.a.0.0.2.0.0.8.0.a.0.0.0.0.0.a.0.f.6.3.8.
55980   f.f.f.f.e.f.f.3.blackholes.mail-abuse.org
55981 </literallayout>
55982 <para>
55983 (split over two lines here to fit on the page). Unfortunately, some of the DNS
55984 lists contain wildcard records, intended for IPv4, that interact badly with
55985 IPv6. For example, the DNS entry
55986 </para>
55987 <literallayout class="monospaced">
55988 *.3.some.list.example.    A    127.0.0.1
55989 </literallayout>
55990 <para>
55991 is probably intended to put the entire 3.0.0.0/8 IPv4 network on the list.
55992 Unfortunately, it also matches the entire 3::/4 IPv6 network.
55993 </para>
55994 <para>
55995 You can exclude IPv6 addresses from DNS lookups by making use of a suitable
55996 <option>condition</option> condition, as in this example:
55997 </para>
55998 <literallayout class="monospaced">
55999 deny   condition = ${if isip4{$sender_host_address}}
56000        dnslists  = some.list.example
56001 </literallayout>
56002 <para>
56003 If an explicit key is being used for a DNS lookup and it may be an IPv6
56004 address you should specify alternate list separators for both the outer
56005 (DNS list name) list and inner (lookup keys) list:
56006 </para>
56007 <literallayout class="monospaced">
56008        dnslists = &lt;; dnsbl.example.com/&lt;|$acl_m_addrslist
56009 </literallayout>
56010 </section>
56011 <section id="SECTratelimiting">
56012 <title>Rate limiting incoming messages</title>
56013 <para>
56014 <indexterm role="concept">
56015 <primary>rate limiting</primary>
56016 <secondary>client sending</secondary>
56017 </indexterm>
56018 <indexterm role="concept">
56019 <primary>limiting client sending rates</primary>
56020 </indexterm>
56021 <indexterm role="option">
56022 <primary><option>smtp_ratelimit_*</option></primary>
56023 </indexterm>
56024 The <option>ratelimit</option> ACL condition can be used to measure and control the rate at
56025 which clients can send email. This is more powerful than the
56026 <option>smtp_ratelimit_*</option> options, because those options control the rate of
56027 commands in a single SMTP session only, whereas the <option>ratelimit</option> condition
56028 works across all connections (concurrent and sequential) from the same client
56029 host. The syntax of the <option>ratelimit</option> condition is:
56030 </para>
56031 <literallayout>
56032 <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;
56033 </literallayout>
56034 <para>
56035 If the average client sending rate is less than <emphasis>m</emphasis> messages per time
56036 period <emphasis>p</emphasis> then the condition is false; otherwise it is true.
56037 </para>
56038 <para>
56039 As a side-effect, the <option>ratelimit</option> condition sets the expansion variable
56040 <varname>$sender_rate</varname> to the client&#x2019;s computed rate, <varname>$sender_rate_limit</varname> to the
56041 configured value of <emphasis>m</emphasis>, and <varname>$sender_rate_period</varname> to the configured value
56042 of <emphasis>p</emphasis>.
56043 </para>
56044 <para>
56045 The parameter <emphasis>p</emphasis> is the smoothing time constant, in the form of an Exim
56046 time interval, for example, <literal>8h</literal> for eight hours. A larger time constant
56047 means that it takes Exim longer to forget a client&#x2019;s past behaviour. The
56048 parameter <emphasis>m</emphasis> is the maximum number of messages that a client is permitted to
56049 send in each time interval. It also specifies the number of messages permitted
56050 in a fast burst. By increasing both <emphasis>m</emphasis> and <emphasis>p</emphasis> but keeping <emphasis>m/p</emphasis>
56051 constant, you can allow a client to send more messages in a burst without
56052 changing its long-term sending rate limit. Conversely, if <emphasis>m</emphasis> and <emphasis>p</emphasis> are
56053 both small, messages must be sent at an even rate.
56054 </para>
56055 <para>
56056 There is a script in <filename>util/ratelimit.pl</filename> which extracts sending rates from
56057 log files, to assist with choosing appropriate settings for <emphasis>m</emphasis> and <emphasis>p</emphasis>
56058 when deploying the <option>ratelimit</option> ACL condition. The script prints usage
56059 instructions when it is run with no arguments.
56060 </para>
56061 <para>
56062 The key is used to look up the data for calculating the client&#x2019;s average
56063 sending rate. This data is stored in Exim&#x2019;s spool directory, alongside the
56064 retry and other hints databases. The default key is <varname>$sender_host_address</varname>,
56065 which means Exim computes the sending rate of each client host IP address.
56066 By changing the key you can change how Exim identifies clients for the purpose
56067 of ratelimiting. For example, to limit the sending rate of each authenticated
56068 user, independent of the computer they are sending from, set the key to
56069 <varname>$authenticated_id</varname>. You must ensure that the lookup key is meaningful; for
56070 example, <varname>$authenticated_id</varname> is only meaningful if the client has
56071 authenticated (which you can check with the <option>authenticated</option> ACL condition).
56072 </para>
56073 <para>
56074 The lookup key does not have to identify clients: If you want to limit the
56075 rate at which a recipient receives messages, you can use the key
56076 <literal>$local_part@$domain</literal> with the <option>per_rcpt</option> option (see below) in a RCPT
56077 ACL.
56078 </para>
56079 <para>
56080 Each <option>ratelimit</option> condition can have up to four options. A <option>per_*</option> option
56081 specifies what Exim measures the rate of, for example messages or recipients
56082 or bytes. You can adjust the measurement using the <option>unique=</option> and/or
56083 <option>count=</option> options. You can also control when Exim updates the recorded rate
56084 using a <option>strict</option>, <option>leaky</option>, or <option>readonly</option> option. The options are
56085 separated by a slash, like the other parameters. They may appear in any order.
56086 </para>
56087 <para>
56088 Internally, Exim appends the smoothing constant <emphasis>p</emphasis> onto the lookup key with
56089 any options that alter the meaning of the stored data. The limit <emphasis>m</emphasis> is not
56090 stored, so you can alter the configured maximum rate and Exim will still
56091 remember clients&#x2019; past behaviour. If you change the <option>per_*</option> mode or add or
56092 remove the <option>unique=</option> option, the lookup key changes so Exim will forget past
56093 behaviour. The lookup key is not affected by changes to the update mode and
56094 the <option>count=</option> option.
56095 </para>
56096 </section>
56097 <section id="ratoptmea">
56098 <title>Ratelimit options for what is being measured</title>
56099 <para>
56100 <indexterm role="concept">
56101 <primary>rate limiting</primary>
56102 <secondary>per_* options</secondary>
56103 </indexterm>
56104 The <option>per_conn</option> option limits the client&#x2019;s connection rate. It is not
56105 normally used in the <option>acl_not_smtp</option>, <option>acl_not_smtp_mime</option>, or
56106 <option>acl_not_smtp_start</option> ACLs.
56107 </para>
56108 <para>
56109 The <option>per_mail</option> option limits the client&#x2019;s rate of sending messages. This is
56110 the default if none of the <option>per_*</option> options is specified. It can be used in
56111 <option>acl_smtp_mail</option>, <option>acl_smtp_rcpt</option>, <option>acl_smtp_predata</option>, <option>acl_smtp_mime</option>,
56112 <option>acl_smtp_data</option>, or <option>acl_not_smtp</option>.
56113 </para>
56114 <para>
56115 The <option>per_byte</option> option limits the sender&#x2019;s email bandwidth. It can be used in
56116 the same ACLs as the <option>per_mail</option> option, though it is best to use this option
56117 in the <option>acl_smtp_mime</option>, <option>acl_smtp_data</option> or <option>acl_not_smtp</option> ACLs; if it is
56118 used in an earlier ACL, Exim relies on the SIZE parameter given by the client
56119 in its MAIL command, which may be inaccurate or completely missing. You can
56120 follow the limit <emphasis>m</emphasis> in the configuration with K, M, or G to specify limits
56121 in kilobytes, megabytes, or gigabytes, respectively.
56122 </para>
56123 <para>
56124 The <option>per_rcpt</option> option causes Exim to limit the rate at which recipients are
56125 accepted. It can be used in the <option>acl_smtp_rcpt</option>, <option>acl_smtp_predata</option>,
56126 <option>acl_smtp_mime</option>, <option>acl_smtp_data</option>, or <option>acl_smtp_rcpt</option> ACLs. In
56127 <option>acl_smtp_rcpt</option> the rate is updated one recipient at a time; in the other
56128 ACLs the rate is updated with the total (accepted) recipient count in one go. Note that
56129 in either case the rate limiting engine will see a message with many
56130 recipients as a large high-speed burst.
56131 </para>
56132 <para>
56133 The <option>per_addr</option> option is like the <option>per_rcpt</option> option, except it counts the
56134 number of different recipients that the client has sent messages to in the
56135 last time period. That is, if the client repeatedly sends messages to the same
56136 recipient, its measured rate is not increased. This option can only be used in
56137 <option>acl_smtp_rcpt</option>.
56138 </para>
56139 <para>
56140 The <option>per_cmd</option> option causes Exim to recompute the rate every time the
56141 condition is processed. This can be used to limit the rate of any SMTP
56142 command. If it is used in multiple ACLs it can limit the aggregate rate of
56143 multiple different commands.
56144 </para>
56145 <para>
56146 The <option>count=</option> option can be used to alter how much Exim adds to the client&#x2019;s
56147 measured rate. For example, the <option>per_byte</option> option is equivalent to
56148 <literal>per_mail/count=$message_size</literal>. If there is no <option>count=</option> option, Exim
56149 increases the measured rate by one (except for the <option>per_rcpt</option> option in ACLs
56150 other than <option>acl_smtp_rcpt</option>). The count does not have to be an integer.
56151 </para>
56152 <para>
56153 The <option>unique=</option> option is described in section <xref linkend="ratoptuniq"/> below.
56154 </para>
56155 </section>
56156 <section id="ratoptupd">
56157 <title>Ratelimit update modes</title>
56158 <para>
56159 <indexterm role="concept">
56160 <primary>rate limiting</primary>
56161 <secondary>reading data without updating</secondary>
56162 </indexterm>
56163 You can specify one of three options with the <option>ratelimit</option> condition to
56164 control when its database is updated. This section describes the <option>readonly</option>
56165 mode, and the next section describes the <option>strict</option> and <option>leaky</option> modes.
56166 </para>
56167 <para>
56168 If the <option>ratelimit</option> condition is used in <option>readonly</option> mode, Exim looks up a
56169 previously-computed rate to check against the limit.
56170 </para>
56171 <para>
56172 For example, you can test the client&#x2019;s sending rate and deny it access (when
56173 it is too fast) in the connect ACL. If the client passes this check then it
56174 can go on to send a message, in which case its recorded rate will be updated
56175 in the MAIL ACL. Subsequent connections from the same client will check this
56176 new rate.
56177 </para>
56178 <literallayout class="monospaced">
56179 acl_check_connect:
56180  deny ratelimit = 100 / 5m / readonly
56181     log_message = RATE CHECK: $sender_rate/$sender_rate_period \
56182                   (max $sender_rate_limit)
56183 # ...
56184 acl_check_mail:
56185  warn ratelimit = 100 / 5m / strict
56186     log_message = RATE UPDATE: $sender_rate/$sender_rate_period \
56187                   (max $sender_rate_limit)
56188 </literallayout>
56189 <para>
56190 If Exim encounters multiple <option>ratelimit</option> conditions with the same key when
56191 processing a message then it may increase the client&#x2019;s measured rate more than
56192 it should. For example, this will happen if you check the <option>per_rcpt</option> option
56193 in both <option>acl_smtp_rcpt</option> and <option>acl_smtp_data</option>. However it&#x2019;s OK to check the
56194 same <option>ratelimit</option> condition multiple times in the same ACL. You can avoid any
56195 multiple update problems by using the <option>readonly</option> option on later ratelimit
56196 checks.
56197 </para>
56198 <para>
56199 The <option>per_*</option> options described above do not make sense in some ACLs. If you
56200 use a <option>per_*</option> option in an ACL where it is not normally permitted then the
56201 update mode defaults to <option>readonly</option> and you cannot specify the <option>strict</option> or
56202 <option>leaky</option> modes. In other ACLs the default update mode is <option>leaky</option> (see the
56203 next section) so you must specify the <option>readonly</option> option explicitly.
56204 </para>
56205 </section>
56206 <section id="ratoptfast">
56207 <title>Ratelimit options for handling fast clients</title>
56208 <para>
56209 <indexterm role="concept">
56210 <primary>rate limiting</primary>
56211 <secondary>strict and leaky modes</secondary>
56212 </indexterm>
56213 If a client&#x2019;s average rate is greater than the maximum, the rate limiting
56214 engine can react in two possible ways, depending on the presence of the
56215 <option>strict</option> or <option>leaky</option> update modes. This is independent of the other
56216 counter-measures (such as rejecting the message) that may be specified by the
56217 rest of the ACL.
56218 </para>
56219 <para>
56220 The <option>leaky</option> (default) option means that the client&#x2019;s recorded rate is not
56221 updated if it is above the limit. The effect of this is that Exim measures the
56222 client&#x2019;s average rate of successfully sent email, which cannot be greater than
56223 the maximum allowed. If the client is over the limit it may suffer some
56224 counter-measures (as specified in the ACL), but it will still be able to send
56225 email at the configured maximum rate, whatever the rate of its attempts. This
56226 is generally the better choice if you have clients that retry automatically.
56227 For example, it does not prevent a sender with an over-aggressive retry rate
56228 from getting any email through.
56229 </para>
56230 <para>
56231 The <option>strict</option> option means that the client&#x2019;s recorded rate is always
56232 updated. The effect of this is that Exim measures the client&#x2019;s average rate
56233 of attempts to send email, which can be much higher than the maximum it is
56234 actually allowed. If the client is over the limit it may be subjected to
56235 counter-measures by the ACL. It must slow down and allow sufficient time to
56236 pass that its computed rate falls below the maximum before it can send email
56237 again. The time (the number of smoothing periods) it must wait and not
56238 attempt to send mail can be calculated with this formula:
56239 </para>
56240 <literallayout class="monospaced">
56241         ln(peakrate/maxrate)
56242 </literallayout>
56243 </section>
56244 <section id="ratoptuniq">
56245 <title>Limiting the rate of different events</title>
56246 <para>
56247 <indexterm role="concept">
56248 <primary>rate limiting</primary>
56249 <secondary>counting unique events</secondary>
56250 </indexterm>
56251 The <option>ratelimit</option> <option>unique=</option> option controls a mechanism for counting the
56252 rate of different events. For example, the <option>per_addr</option> option uses this
56253 mechanism to count the number of different recipients that the client has
56254 sent messages to in the last time period; it is equivalent to
56255 <literal>per_rcpt/unique=$local_part@$domain</literal>. You could use this feature to
56256 measure the rate that a client uses different sender addresses with the
56257 options <literal>per_mail/unique=$sender_address</literal>.
56258 </para>
56259 <para>
56260 For each <option>ratelimit</option> key Exim stores the set of <option>unique=</option> values that it
56261 has seen for that key. The whole set is thrown away when it is older than the
56262 rate smoothing period <emphasis>p</emphasis>, so each different event is counted at most once
56263 per period. In the <option>leaky</option> update mode, an event that causes the client to
56264 go over the limit is not added to the set, in the same way that the client&#x2019;s
56265 recorded rate is not updated in the same situation.
56266 </para>
56267 <para>
56268 When you combine the <option>unique=</option> and <option>readonly</option> options, the specific
56269 <option>unique=</option> value is ignored, and Exim just retrieves the client&#x2019;s stored
56270 rate.
56271 </para>
56272 <para>
56273 The <option>unique=</option> mechanism needs more space in the ratelimit database than the
56274 other <option>ratelimit</option> options in order to store the event set. The number of
56275 unique values is potentially as large as the rate limit, so the extra space
56276 required increases with larger limits.
56277 </para>
56278 <para>
56279 The uniqueification is not perfect: there is a small probability that Exim
56280 will think a new event has happened before. If the sender&#x2019;s rate is less than
56281 the limit, Exim should be more than 99.9% correct. However in <option>strict</option> mode
56282 the measured rate can go above the limit, in which case Exim may under-count
56283 events by a significant margin. Fortunately, if the rate is high enough (2.7
56284 times the limit) that the false positive rate goes above 9%, then Exim will
56285 throw away the over-full event set before the measured rate falls below the
56286 limit. Therefore the only harm should be that exceptionally high sending rates
56287 are logged incorrectly; any countermeasures you configure will be as effective
56288 as intended.
56289 </para>
56290 </section>
56291 <section id="useratlim">
56292 <title>Using rate limiting</title>
56293 <para>
56294 Exim&#x2019;s other ACL facilities are used to define what counter-measures are taken
56295 when the rate limit is exceeded. This might be anything from logging a warning
56296 (for example, while measuring existing sending rates in order to define
56297 policy), through time delays to slow down fast senders, up to rejecting the
56298 message. For example:
56299 </para>
56300 <literallayout class="monospaced">
56301 # Log all senders' rates
56302 warn ratelimit = 0 / 1h / strict
56303      log_message = Sender rate $sender_rate / $sender_rate_period
56304
56305 # Slow down fast senders; note the need to truncate $sender_rate
56306 # at the decimal point.
56307 warn ratelimit = 100 / 1h / per_rcpt / strict
56308      delay     = ${eval: ${sg{$sender_rate}{[.].*}{}} - \
56309                    $sender_rate_limit }s
56310
56311 # Keep authenticated users under control
56312 deny authenticated = *
56313      ratelimit = 100 / 1d / strict / $authenticated_id
56314
56315 # System-wide rate limit
56316 defer message = Sorry, too busy. Try again later.
56317      ratelimit = 10 / 1s / $primary_hostname
56318
56319 # Restrict incoming rate from each host, with a default
56320 # set using a macro and special cases looked up in a table.
56321 defer message = Sender rate exceeds $sender_rate_limit \
56322                messages per $sender_rate_period
56323      ratelimit = ${lookup {$sender_host_address} \
56324                    cdb {DB/ratelimits.cdb} \
56325                    {$value} {RATELIMIT} }
56326 </literallayout>
56327 <para>
56328 <emphasis role="bold">Warning</emphasis>: If you have a busy server with a lot of <option>ratelimit</option> tests,
56329 especially with the <option>per_rcpt</option> option, you may suffer from a performance
56330 bottleneck caused by locking on the ratelimit hints database. Apart from
56331 making your ACLs less complicated, you can reduce the problem by using a
56332 RAM disk for Exim&#x2019;s hints directory (usually <filename>/var/spool/exim/db/</filename>). However
56333 this means that Exim will lose its hints data after a reboot (including retry
56334 hints, the callout cache, and ratelimit data).
56335 </para>
56336 </section>
56337 <section id="SECTaddressverification">
56338 <title>Address verification</title>
56339 <para>
56340 <indexterm role="concept">
56341 <primary>verifying address</primary>
56342 <secondary>options for</secondary>
56343 </indexterm>
56344 <indexterm role="concept">
56345 <primary>policy control</primary>
56346 <secondary>address verification</secondary>
56347 </indexterm>
56348 Several of the <option>verify</option> conditions described in section
56349 <xref linkend="SECTaclconditions"/> cause addresses to be verified. Section
56350 <xref linkend="SECTsenaddver"/> discusses the reporting of sender verification failures.
56351 The verification conditions can be followed by options that modify the
56352 verification process. The options are separated from the keyword and from each
56353 other by slashes, and some of them contain parameters. For example:
56354 </para>
56355 <literallayout class="monospaced">
56356 verify = sender/callout
56357 verify = recipient/defer_ok/callout=10s,defer_ok
56358 </literallayout>
56359 <para>
56360 The first stage of address verification, which always happens, is to run the
56361 address through the routers, in <quote>verify mode</quote>. Routers can detect the
56362 difference between verification and routing for delivery, and their actions can
56363 be varied by a number of generic options such as <option>verify</option> and <option>verify_only</option>
56364 (see chapter <xref linkend="CHAProutergeneric"/>). If routing fails, verification fails.
56365 The available options are as follows:
56366 </para>
56367 <itemizedlist>
56368 <listitem>
56369 <para>
56370 If the <option>callout</option> option is specified, successful routing to one or more
56371 remote hosts is followed by a <quote>callout</quote> to those hosts as an additional
56372 check. Callouts and their sub-options are discussed in the next section.
56373 </para>
56374 </listitem>
56375 <listitem>
56376 <para>
56377 If there is a defer error while doing verification routing, the ACL
56378 normally returns <quote>defer</quote>. However, if you include <option>defer_ok</option> in the
56379 options, the condition is forced to be true instead. Note that this is a main
56380 verification option as well as a suboption for callouts.
56381 </para>
56382 </listitem>
56383 <listitem>
56384 <para>
56385 The <option>no_details</option> option is covered in section <xref linkend="SECTsenaddver"/>, which
56386 discusses the reporting of sender address verification failures.
56387 </para>
56388 </listitem>
56389 <listitem>
56390 <para>
56391 The <option>success_on_redirect</option> option causes verification always to succeed
56392 immediately after a successful redirection. By default, if a redirection
56393 generates just one address, that address is also verified. See further
56394 discussion in section <xref linkend="SECTredirwhilveri"/>.
56395 </para>
56396 </listitem>
56397 </itemizedlist>
56398 <para>
56399 <indexterm role="concept">
56400 <primary>verifying address</primary>
56401 <secondary>differentiating failures</secondary>
56402 </indexterm>
56403 <indexterm role="variable">
56404 <primary><varname>$recipient_verify_failure</varname></primary>
56405 </indexterm>
56406 <indexterm role="variable">
56407 <primary><varname>$sender_verify_failure</varname></primary>
56408 </indexterm>
56409 <indexterm role="variable">
56410 <primary><varname>$acl_verify_message</varname></primary>
56411 </indexterm>
56412 After an address verification failure, <varname>$acl_verify_message</varname> contains the
56413 error message that is associated with the failure. It can be preserved by
56414 coding like this:
56415 </para>
56416 <literallayout class="monospaced">
56417 warn  !verify = sender
56418        set acl_m0 = $acl_verify_message
56419 </literallayout>
56420 <para>
56421 If you are writing your own custom rejection message or log message when
56422 denying access, you can use this variable to include information about the
56423 verification failure.
56424 </para>
56425 <para>
56426 In addition, <varname>$sender_verify_failure</varname> or <varname>$recipient_verify_failure</varname> (as
56427 appropriate) contains one of the following words:
56428 </para>
56429 <itemizedlist>
56430 <listitem>
56431 <para>
56432 <option>qualify</option>: The address was unqualified (no domain), and the message
56433 was neither local nor came from an exempted host.
56434 </para>
56435 </listitem>
56436 <listitem>
56437 <para>
56438 <option>route</option>: Routing failed.
56439 </para>
56440 </listitem>
56441 <listitem>
56442 <para>
56443 <option>mail</option>: Routing succeeded, and a callout was attempted; rejection
56444 occurred at or before the MAIL command (that is, on initial
56445 connection, HELO, or MAIL).
56446 </para>
56447 </listitem>
56448 <listitem>
56449 <para>
56450 <option>recipient</option>: The RCPT command in a callout was rejected.
56451 </para>
56452 </listitem>
56453 <listitem>
56454 <para>
56455 <option>postmaster</option>: The postmaster check in a callout was rejected.
56456 </para>
56457 </listitem>
56458 </itemizedlist>
56459 <para>
56460 The main use of these variables is expected to be to distinguish between
56461 rejections of MAIL and rejections of RCPT in callouts.
56462 </para>
56463 </section>
56464 <section id="SECTcallver">
56465 <title>Callout verification</title>
56466 <para>
56467 <indexterm role="concept">
56468 <primary>verifying address</primary>
56469 <secondary>by callout</secondary>
56470 </indexterm>
56471 <indexterm role="concept">
56472 <primary>callout</primary>
56473 <secondary>verification</secondary>
56474 </indexterm>
56475 <indexterm role="concept">
56476 <primary>SMTP</primary>
56477 <secondary>callout verification</secondary>
56478 </indexterm>
56479 For non-local addresses, routing verifies the domain, but is unable to do any
56480 checking of the local part. There are situations where some means of verifying
56481 the local part is desirable. One way this can be done is to make an SMTP
56482 <emphasis>callback</emphasis> to a delivery host for the sender address or a <emphasis>callforward</emphasis> to
56483 a subsequent host for a recipient address, to see if the host accepts the
56484 address. We use the term <emphasis>callout</emphasis> to cover both cases. Note that for a
56485 sender address, the callback is not to the client host that is trying to
56486 deliver the message, but to one of the hosts that accepts incoming mail for the
56487 sender&#x2019;s domain.
56488 </para>
56489 <para>
56490 Exim does not do callouts by default. If you want them to happen, you must
56491 request them by setting appropriate options on the <option>verify</option> condition, as
56492 described below. This facility should be used with care, because it can add a
56493 lot of resource usage to the cost of verifying an address. However, Exim does
56494 cache the results of callouts, which helps to reduce the cost. Details of
56495 caching are in section <xref linkend="SECTcallvercache"/>.
56496 </para>
56497 <para>
56498 Recipient callouts are usually used only between hosts that are controlled by
56499 the same administration. For example, a corporate gateway host could use
56500 callouts to check for valid recipients on an internal mailserver. A successful
56501 callout does not guarantee that a real delivery to the address would succeed;
56502 on the other hand, a failing callout does guarantee that a delivery would fail.
56503 </para>
56504 <para>
56505 If the <option>callout</option> option is present on a condition that verifies an address, a
56506 second stage of verification occurs if the address is successfully routed to
56507 one or more remote hosts. The usual case is routing by a <command>dnslookup</command> or a
56508 <command>manualroute</command> router, where the router specifies the hosts. However, if a
56509 router that does not set up hosts routes to an <command>smtp</command> transport with a
56510 <option>hosts</option> setting, the transport&#x2019;s hosts are used. If an <command>smtp</command> transport has
56511 <option>hosts_override</option> set, its hosts are always used, whether or not the router
56512 supplies a host list.
56513 Callouts are only supported on <command>smtp</command> transports.
56514 </para>
56515 <para>
56516 The port that is used is taken from the transport, if it is specified and is a
56517 remote transport. (For routers that do verification only, no transport need be
56518 specified.) Otherwise, the default SMTP port is used. If a remote transport
56519 specifies an outgoing interface, this is used; otherwise the interface is not
56520 specified. Likewise, the text that is used for the HELO command is taken from
56521 the transport&#x2019;s <option>helo_data</option> option; if there is no transport, the value of
56522 <varname>$smtp_active_hostname</varname> is used.
56523 </para>
56524 <para>
56525 For a sender callout check, Exim makes SMTP connections to the remote hosts, to
56526 test whether a bounce message could be delivered to the sender address. The
56527 following SMTP commands are sent:
56528 </para>
56529 <literallayout>
56530 <literal>HELO </literal>&lt;<emphasis>local host name</emphasis>&gt;
56531 <literal>MAIL FROM:&lt;&gt;</literal>
56532 <literal>RCPT TO:</literal>&lt;<emphasis>the address to be tested</emphasis>&gt;
56533 <literal>QUIT</literal>
56534 </literallayout>
56535 <para>
56536 LHLO is used instead of HELO if the transport&#x2019;s <option>protocol</option> option is
56537 set to <quote>lmtp</quote>.
56538 </para>
56539 <para>
56540 The callout may use EHLO, AUTH and/or STARTTLS given appropriate option
56541 settings.
56542 </para>
56543 <para>
56544 A recipient callout check is similar. By default, it also uses an empty address
56545 for the sender. This default is chosen because most hosts do not make use of
56546 the sender address when verifying a recipient. Using the same address means
56547 that a single cache entry can be used for each recipient. Some sites, however,
56548 do make use of the sender address when verifying. These are catered for by the
56549 <option>use_sender</option> and <option>use_postmaster</option> options, described in the next section.
56550 </para>
56551 <para>
56552 If the response to the RCPT command is a 2<emphasis>xx</emphasis> code, the verification
56553 succeeds. If it is 5<emphasis>xx</emphasis>, the verification fails. For any other condition,
56554 Exim tries the next host, if any. If there is a problem with all the remote
56555 hosts, the ACL yields <quote>defer</quote>, unless the <option>defer_ok</option> parameter of the
56556 <option>callout</option> option is given, in which case the condition is forced to succeed.
56557 </para>
56558 <para>
56559 <indexterm role="concept">
56560 <primary>SMTP</primary>
56561 <secondary>output flushing, disabling for callout</secondary>
56562 </indexterm>
56563 A callout may take a little time. For this reason, Exim normally flushes SMTP
56564 output before performing a callout in an ACL, to avoid unexpected timeouts in
56565 clients when the SMTP PIPELINING extension is in use. The flushing can be
56566 disabled by using a <option>control</option> modifier to set <option>no_callout_flush</option>.
56567 </para>
56568 </section>
56569 <section id="CALLaddparcall">
56570 <title>Additional parameters for callouts</title>
56571 <para>
56572 <indexterm role="concept">
56573 <primary>callout</primary>
56574 <secondary>additional parameters for</secondary>
56575 </indexterm>
56576 The <option>callout</option> option can be followed by an equals sign and a number of
56577 optional parameters, separated by commas. For example:
56578 </para>
56579 <literallayout class="monospaced">
56580 verify = recipient/callout=10s,defer_ok
56581 </literallayout>
56582 <para>
56583 The old syntax, which had <option>callout_defer_ok</option> and <option>check_postmaster</option> as
56584 separate verify options, is retained for backwards compatibility, but is now
56585 deprecated. The additional parameters for <option>callout</option> are as follows:
56586 </para>
56587 <variablelist>
56588 <varlistentry>
56589 <term>&lt;<emphasis>a&nbsp;time&nbsp;interval</emphasis>&gt;</term>
56590 <listitem>
56591 <para>
56592 <indexterm role="concept">
56593 <primary>callout</primary>
56594 <secondary>timeout, specifying</secondary>
56595 </indexterm>
56596 This specifies the timeout that applies for the callout attempt to each host.
56597 For example:
56598 </para>
56599 <literallayout class="monospaced">
56600 verify = sender/callout=5s
56601 </literallayout>
56602 <para>
56603 The default is 30 seconds. The timeout is used for each response from the
56604 remote host. It is also used for the initial connection, unless overridden by
56605 the <option>connect</option> parameter.
56606 </para>
56607 </listitem></varlistentry>
56608 <varlistentry>
56609 <term><emphasis role="bold">connect&nbsp;=&nbsp;</emphasis>&lt;<emphasis>time&nbsp;interval</emphasis>&gt;</term>
56610 <listitem>
56611 <para>
56612 <indexterm role="concept">
56613 <primary>callout</primary>
56614 <secondary>connection timeout, specifying</secondary>
56615 </indexterm>
56616 This parameter makes it possible to set a different (usually smaller) timeout
56617 for making the SMTP connection. For example:
56618 </para>
56619 <literallayout class="monospaced">
56620 verify = sender/callout=5s,connect=1s
56621 </literallayout>
56622 <para>
56623 If not specified, this timeout defaults to the general timeout value.
56624 </para>
56625 </listitem></varlistentry>
56626 <varlistentry>
56627 <term><emphasis role="bold">defer_ok</emphasis></term>
56628 <listitem>
56629 <para>
56630 <indexterm role="concept">
56631 <primary>callout</primary>
56632 <secondary>defer, action on</secondary>
56633 </indexterm>
56634 When this parameter is present, failure to contact any host, or any other kind
56635 of temporary error, is treated as success by the ACL. However, the cache is not
56636 updated in this circumstance.
56637 </para>
56638 </listitem></varlistentry>
56639 <varlistentry>
56640 <term><emphasis role="bold">fullpostmaster</emphasis></term>
56641 <listitem>
56642 <para>
56643 <indexterm role="concept">
56644 <primary>callout</primary>
56645 <secondary>full postmaster check</secondary>
56646 </indexterm>
56647 This operates like the <option>postmaster</option> option (see below), but if the check for
56648 <emphasis>postmaster@domain</emphasis> fails, it tries just <emphasis>postmaster</emphasis>, without a domain, in
56649 accordance with the specification in RFC 2821. The RFC states that the
56650 unqualified address <emphasis>postmaster</emphasis> should be accepted.
56651 </para>
56652 </listitem></varlistentry>
56653 <varlistentry>
56654 <term><emphasis role="bold">mailfrom&nbsp;=&nbsp;</emphasis>&lt;<emphasis>email&nbsp;address</emphasis>&gt;</term>
56655 <listitem>
56656 <para>
56657 <indexterm role="concept">
56658 <primary>callout</primary>
56659 <secondary>sender when verifying header</secondary>
56660 </indexterm>
56661 When verifying addresses in header lines using the <option>header_sender</option>
56662 verification option, Exim behaves by default as if the addresses are envelope
56663 sender addresses from a message. Callout verification therefore tests to see
56664 whether a bounce message could be delivered, by using an empty address in the
56665 MAIL command. However, it is arguable that these addresses might never be used
56666 as envelope senders, and could therefore justifiably reject bounce messages
56667 (empty senders). The <option>mailfrom</option> callout parameter allows you to specify what
56668 address to use in the MAIL command. For example:
56669 </para>
56670 <literallayout class="monospaced">
56671 require  verify = header_sender/callout=mailfrom=abcd@x.y.z
56672 </literallayout>
56673 <para>
56674 This parameter is available only for the <option>header_sender</option> verification option.
56675 </para>
56676 </listitem></varlistentry>
56677 <varlistentry>
56678 <term><emphasis role="bold">maxwait&nbsp;=&nbsp;</emphasis>&lt;<emphasis>time&nbsp;interval</emphasis>&gt;</term>
56679 <listitem>
56680 <para>
56681 <indexterm role="concept">
56682 <primary>callout</primary>
56683 <secondary>overall timeout, specifying</secondary>
56684 </indexterm>
56685 This parameter sets an overall timeout for performing a callout verification.
56686 For example:
56687 </para>
56688 <literallayout class="monospaced">
56689 verify = sender/callout=5s,maxwait=30s
56690 </literallayout>
56691 <para>
56692 This timeout defaults to four times the callout timeout for individual SMTP
56693 commands. The overall timeout applies when there is more than one host that can
56694 be tried. The timeout is checked before trying the next host. This prevents
56695 very long delays if there are a large number of hosts and all are timing out
56696 (for example, when network connections are timing out).
56697 </para>
56698 </listitem></varlistentry>
56699 <varlistentry>
56700 <term><emphasis role="bold">no_cache</emphasis></term>
56701 <listitem>
56702 <para>
56703 <indexterm role="concept">
56704 <primary>callout</primary>
56705 <secondary>cache, suppressing</secondary>
56706 </indexterm>
56707 <indexterm role="concept">
56708 <primary>caching callout, suppressing</primary>
56709 </indexterm>
56710 When this parameter is given, the callout cache is neither read nor updated.
56711 </para>
56712 </listitem></varlistentry>
56713 <varlistentry>
56714 <term><emphasis role="bold">postmaster</emphasis></term>
56715 <listitem>
56716 <para>
56717 <indexterm role="concept">
56718 <primary>callout</primary>
56719 <secondary>postmaster; checking</secondary>
56720 </indexterm>
56721 When this parameter is set, a successful callout check is followed by a similar
56722 check for the local part <emphasis>postmaster</emphasis> at the same domain. If this address is
56723 rejected, the callout fails (but see <option>fullpostmaster</option> above). The result of
56724 the postmaster check is recorded in a cache record; if it is a failure, this is
56725 used to fail subsequent callouts for the domain without a connection being
56726 made, until the cache record expires.
56727 </para>
56728 </listitem></varlistentry>
56729 <varlistentry>
56730 <term><emphasis role="bold">postmaster_mailfrom&nbsp;=&nbsp;</emphasis>&lt;<emphasis>email&nbsp;address</emphasis>&gt;</term>
56731 <listitem>
56732 <para>
56733 The postmaster check uses an empty sender in the MAIL command by default.
56734 You can use this parameter to do a postmaster check using a different address.
56735 For example:
56736 </para>
56737 <literallayout class="monospaced">
56738 require  verify = sender/callout=postmaster_mailfrom=abc@x.y.z
56739 </literallayout>
56740 <para>
56741 If both <option>postmaster</option> and <option>postmaster_mailfrom</option> are present, the rightmost
56742 one overrides. The <option>postmaster</option> parameter is equivalent to this example:
56743 </para>
56744 <literallayout class="monospaced">
56745 require  verify = sender/callout=postmaster_mailfrom=
56746 </literallayout>
56747 <para>
56748 <emphasis role="bold">Warning</emphasis>: The caching arrangements for postmaster checking do not take
56749 account of the sender address. It is assumed that either the empty address or
56750 a fixed non-empty address will be used. All that Exim remembers is that the
56751 postmaster check for the domain succeeded or failed.
56752 </para>
56753 </listitem></varlistentry>
56754 <varlistentry>
56755 <term><emphasis role="bold">random</emphasis></term>
56756 <listitem>
56757 <para>
56758 <indexterm role="concept">
56759 <primary>callout</primary>
56760 <secondary><quote>random</quote> check</secondary>
56761 </indexterm>
56762 When this parameter is set, before doing the normal callout check, Exim does a
56763 check for a <quote>random</quote> local part at the same domain. The local part is not
56764 really random &ndash; it is defined by the expansion of the option
56765 <option>callout_random_local_part</option>, which defaults to
56766 </para>
56767 <literallayout class="monospaced">
56768 $primary_hostname-$tod_epoch-testing
56769 </literallayout>
56770 <para>
56771 The idea here is to try to determine whether the remote host accepts all local
56772 parts without checking. If it does, there is no point in doing callouts for
56773 specific local parts. If the <quote>random</quote> check succeeds, the result is saved in
56774 a cache record, and used to force the current and subsequent callout checks to
56775 succeed without a connection being made, until the cache record expires.
56776 </para>
56777 </listitem></varlistentry>
56778 <varlistentry>
56779 <term><emphasis role="bold">use_postmaster</emphasis></term>
56780 <listitem>
56781 <para>
56782 <indexterm role="concept">
56783 <primary>callout</primary>
56784 <secondary>sender for recipient check</secondary>
56785 </indexterm>
56786 This parameter applies to recipient callouts only. For example:
56787 </para>
56788 <literallayout class="monospaced">
56789 deny  !verify = recipient/callout=use_postmaster
56790 </literallayout>
56791 <para>
56792 <indexterm role="variable">
56793 <primary><varname>$qualify_domain</varname></primary>
56794 </indexterm>
56795 It causes a non-empty postmaster address to be used in the MAIL command when
56796 performing the callout for the recipient, and also for a <quote>random</quote> check if
56797 that is configured. The local part of the address is <literal>postmaster</literal> and the
56798 domain is the contents of <varname>$qualify_domain</varname>.
56799 </para>
56800 </listitem></varlistentry>
56801 <varlistentry>
56802 <term><emphasis role="bold">use_sender</emphasis></term>
56803 <listitem>
56804 <para>
56805 This option applies to recipient callouts only. For example:
56806 </para>
56807 <literallayout class="monospaced">
56808 require  verify = recipient/callout=use_sender
56809 </literallayout>
56810 <para>
56811 It causes the message&#x2019;s actual sender address to be used in the MAIL
56812 command when performing the callout, instead of an empty address. There is no
56813 need to use this option unless you know that the called hosts make use of the
56814 sender when checking recipients. If used indiscriminately, it reduces the
56815 usefulness of callout caching.
56816 </para>
56817 </listitem></varlistentry>
56818 </variablelist>
56819 <para>
56820 If you use any of the parameters that set a non-empty sender for the MAIL
56821 command (<option>mailfrom</option>, <option>postmaster_mailfrom</option>, <option>use_postmaster</option>, or
56822 <option>use_sender</option>), you should think about possible loops. Recipient checking is
56823 usually done between two hosts that are under the same management, and the host
56824 that receives the callouts is not normally configured to do callouts itself.
56825 Therefore, it is normally safe to use <option>use_postmaster</option> or <option>use_sender</option> in
56826 these circumstances.
56827 </para>
56828 <para>
56829 However, if you use a non-empty sender address for a callout to an arbitrary
56830 host, there is the likelihood that the remote host will itself initiate a
56831 callout check back to your host. As it is checking what appears to be a message
56832 sender, it is likely to use an empty address in MAIL, thus avoiding a
56833 callout loop. However, to be on the safe side it would be best to set up your
56834 own ACLs so that they do not do sender verification checks when the recipient
56835 is the address you use for header sender or postmaster callout checking.
56836 </para>
56837 <para>
56838 Another issue to think about when using non-empty senders for callouts is
56839 caching. When you set <option>mailfrom</option> or <option>use_sender</option>, the cache record is keyed
56840 by the sender/recipient combination; thus, for any given recipient, many more
56841 actual callouts are performed than when an empty sender or postmaster is used.
56842 </para>
56843 </section>
56844 <section id="SECTcallvercache">
56845 <title>Callout caching</title>
56846 <para>
56847 <indexterm role="concept">
56848 <primary>hints database</primary>
56849 <secondary>callout cache</secondary>
56850 </indexterm>
56851 <indexterm role="concept">
56852 <primary>callout</primary>
56853 <secondary>cache, description of</secondary>
56854 </indexterm>
56855 <indexterm role="concept">
56856 <primary>caching</primary>
56857 <secondary>callout</secondary>
56858 </indexterm>
56859 Exim caches the results of callouts in order to reduce the amount of resources
56860 used, unless you specify the <option>no_cache</option> parameter with the <option>callout</option>
56861 option. A hints database called <quote>callout</quote> is used for the cache. Two
56862 different record types are used: one records the result of a callout check for
56863 a specific address, and the other records information that applies to the
56864 entire domain (for example, that it accepts the local part <emphasis>postmaster</emphasis>).
56865 </para>
56866 <para>
56867 When an original callout fails, a detailed SMTP error message is given about
56868 the failure. However, for subsequent failures use the cache data, this message
56869 is not available.
56870 </para>
56871 <para>
56872 The expiry times for negative and positive address cache records are
56873 independent, and can be set by the global options <option>callout_negative_expire</option>
56874 (default 2h) and <option>callout_positive_expire</option> (default 24h), respectively.
56875 </para>
56876 <para>
56877 If a host gives a negative response to an SMTP connection, or rejects any
56878 commands up to and including
56879 </para>
56880 <literallayout class="monospaced">
56881 MAIL FROM:&lt;&gt;
56882 </literallayout>
56883 <para>
56884 (but not including the MAIL command with a non-empty address),
56885 any callout attempt is bound to fail. Exim remembers such failures in a
56886 domain cache record, which it uses to fail callouts for the domain without
56887 making new connections, until the domain record times out. There are two
56888 separate expiry times for domain cache records:
56889 <option>callout_domain_negative_expire</option> (default 3h) and
56890 <option>callout_domain_positive_expire</option> (default 7d).
56891 </para>
56892 <para>
56893 Domain records expire when the negative expiry time is reached if callouts
56894 cannot be made for the domain, or if the postmaster check failed.
56895 Otherwise, they expire when the positive expiry time is reached. This
56896 ensures that, for example, a host that stops accepting <quote>random</quote> local parts
56897 will eventually be noticed.
56898 </para>
56899 <para>
56900 The callout caching mechanism is based on the domain of the address that is
56901 being tested. If the domain routes to several hosts, it is assumed that their
56902 behaviour will be the same.
56903 </para>
56904 </section>
56905 <section id="SECTsenaddver">
56906 <title>Sender address verification reporting</title>
56907 <para>
56908 <indexterm role="concept">
56909 <primary>verifying</primary>
56910 <secondary>suppressing error details</secondary>
56911 </indexterm>
56912 See section <xref linkend="SECTaddressverification"/> for a general discussion of
56913 verification. When sender verification fails in an ACL, the details of the
56914 failure are given as additional output lines before the 550 response to the
56915 relevant SMTP command (RCPT or DATA). For example, if sender callout is in use,
56916 you might see:
56917 </para>
56918 <literallayout class="monospaced">
56919 MAIL FROM:&lt;xyz@abc.example&gt;
56920 250 OK
56921 RCPT TO:&lt;pqr@def.example&gt;
56922 550-Verification failed for &lt;xyz@abc.example&gt;
56923 550-Called:   192.168.34.43
56924 550-Sent:     RCPT TO:&lt;xyz@abc.example&gt;
56925 550-Response: 550 Unknown local part xyz in &lt;xyz@abc.example&gt;
56926 550 Sender verification failed
56927 </literallayout>
56928 <para>
56929 If more than one RCPT command fails in the same way, the details are given
56930 only for the first of them. However, some administrators do not want to send
56931 out this much information. You can suppress the details by adding
56932 <literal>/no_details</literal> to the ACL statement that requests sender verification. For
56933 example:
56934 </para>
56935 <literallayout class="monospaced">
56936 verify = sender/no_details
56937 </literallayout>
56938 </section>
56939 <section id="SECTredirwhilveri">
56940 <title>Redirection while verifying</title>
56941 <para>
56942 <indexterm role="concept">
56943 <primary>verifying</primary>
56944 <secondary>redirection while</secondary>
56945 </indexterm>
56946 <indexterm role="concept">
56947 <primary>address redirection</primary>
56948 <secondary>while verifying</secondary>
56949 </indexterm>
56950 A dilemma arises when a local address is redirected by aliasing or forwarding
56951 during verification: should the generated addresses themselves be verified,
56952 or should the successful expansion of the original address be enough to verify
56953 it? By default, Exim takes the following pragmatic approach:
56954 </para>
56955 <itemizedlist>
56956 <listitem>
56957 <para>
56958 When an incoming address is redirected to just one child address, verification
56959 continues with the child address, and if that fails to verify, the original
56960 verification also fails.
56961 </para>
56962 </listitem>
56963 <listitem>
56964 <para>
56965 When an incoming address is redirected to more than one child address,
56966 verification does not continue. A success result is returned.
56967 </para>
56968 </listitem>
56969 </itemizedlist>
56970 <para>
56971 This seems the most reasonable behaviour for the common use of aliasing as a
56972 way of redirecting different local parts to the same mailbox. It means, for
56973 example, that a pair of alias entries of the form
56974 </para>
56975 <literallayout class="monospaced">
56976 A.Wol:   aw123
56977 aw123:   :fail: Gone away, no forwarding address
56978 </literallayout>
56979 <para>
56980 work as expected, with both local parts causing verification failure. When a
56981 redirection generates more than one address, the behaviour is more like a
56982 mailing list, where the existence of the alias itself is sufficient for
56983 verification to succeed.
56984 </para>
56985 <para>
56986 It is possible, however, to change the default behaviour so that all successful
56987 redirections count as successful verifications, however many new addresses are
56988 generated. This is specified by the <option>success_on_redirect</option> verification
56989 option. For example:
56990 </para>
56991 <literallayout class="monospaced">
56992 require verify = recipient/success_on_redirect/callout=10s
56993 </literallayout>
56994 <para>
56995 In this example, verification succeeds if a router generates a new address, and
56996 the callout does not occur, because no address was routed to a remote host.
56997 </para>
56998 <para>
56999 When verification is being tested via the <option>-bv</option> option, the treatment of
57000 redirections is as just described, unless the <option>-v</option> or any debugging option is
57001 also specified. In that case, full verification is done for every generated
57002 address and a report is output for each of them.
57003 </para>
57004 </section>
57005 <section id="SECTverifyCSA">
57006 <title>Client SMTP authorization (CSA)</title>
57007 <para>
57008 <indexterm role="concept">
57009 <primary>CSA</primary>
57010 <secondary>verifying</secondary>
57011 </indexterm>
57012 Client SMTP Authorization is a system that allows a site to advertise
57013 which machines are and are not permitted to send email. This is done by placing
57014 special SRV records in the DNS; these are looked up using the client&#x2019;s HELO
57015 domain. At the time of writing, CSA is still an Internet Draft. Client SMTP
57016 Authorization checks in Exim are performed by the ACL condition:
57017 </para>
57018 <literallayout class="monospaced">
57019 verify = csa
57020 </literallayout>
57021 <para>
57022 This fails if the client is not authorized. If there is a DNS problem, or if no
57023 valid CSA SRV record is found, or if the client is authorized, the condition
57024 succeeds. These three cases can be distinguished using the expansion variable
57025 <varname>$csa_status</varname>, which can take one of the values <quote>fail</quote>, <quote>defer</quote>,
57026 <quote>unknown</quote>, or <quote>ok</quote>. The condition does not itself defer because that would
57027 be likely to cause problems for legitimate email.
57028 </para>
57029 <para>
57030 The error messages produced by the CSA code include slightly more
57031 detail. If <varname>$csa_status</varname> is <quote>defer</quote>, this may be because of problems
57032 looking up the CSA SRV record, or problems looking up the CSA target
57033 address record. There are four reasons for <varname>$csa_status</varname> being <quote>fail</quote>:
57034 </para>
57035 <itemizedlist>
57036 <listitem>
57037 <para>
57038 The client&#x2019;s host name is explicitly not authorized.
57039 </para>
57040 </listitem>
57041 <listitem>
57042 <para>
57043 The client&#x2019;s IP address does not match any of the CSA target IP addresses.
57044 </para>
57045 </listitem>
57046 <listitem>
57047 <para>
57048 The client&#x2019;s host name is authorized but it has no valid target IP addresses
57049 (for example, the target&#x2019;s addresses are IPv6 and the client is using IPv4).
57050 </para>
57051 </listitem>
57052 <listitem>
57053 <para>
57054 The client&#x2019;s host name has no CSA SRV record but a parent domain has asserted
57055 that all subdomains must be explicitly authorized.
57056 </para>
57057 </listitem>
57058 </itemizedlist>
57059 <para>
57060 The <option>csa</option> verification condition can take an argument which is the domain to
57061 use for the DNS query. The default is:
57062 </para>
57063 <literallayout class="monospaced">
57064 verify = csa/$sender_helo_name
57065 </literallayout>
57066 <para>
57067 This implementation includes an extension to CSA. If the query domain
57068 is an address literal such as [192.0.2.95], or if it is a bare IP
57069 address, Exim searches for CSA SRV records in the reverse DNS as if
57070 the HELO domain was (for example) <emphasis>95.2.0.192.in-addr.arpa</emphasis>. Therefore it is
57071 meaningful to say:
57072 </para>
57073 <literallayout class="monospaced">
57074 verify = csa/$sender_host_address
57075 </literallayout>
57076 <para>
57077 In fact, this is the check that Exim performs if the client does not say HELO.
57078 This extension can be turned off by setting the main configuration option
57079 <option>dns_csa_use_reverse</option> to be false.
57080 </para>
57081 <para>
57082 If a CSA SRV record is not found for the domain itself, a search
57083 is performed through its parent domains for a record which might be
57084 making assertions about subdomains. The maximum depth of this search is limited
57085 using the main configuration option <option>dns_csa_search_limit</option>, which is 5 by
57086 default. Exim does not look for CSA SRV records in a top level domain, so the
57087 default settings handle HELO domains as long as seven
57088 (<emphasis>hostname.five.four.three.two.one.com</emphasis>). This encompasses the vast majority
57089 of legitimate HELO domains.
57090 </para>
57091 <para>
57092 The <emphasis>dnsdb</emphasis> lookup also has support for CSA. Although <emphasis>dnsdb</emphasis> also supports
57093 direct SRV lookups, this is not sufficient because of the extra parent domain
57094 search behaviour of CSA, and (as with PTR lookups) <emphasis>dnsdb</emphasis> also turns IP
57095 addresses into lookups in the reverse DNS space. The result of a successful
57096 lookup such as:
57097 </para>
57098 <literallayout class="monospaced">
57099 ${lookup dnsdb {csa=$sender_helo_name}}
57100 </literallayout>
57101 <para>
57102 has two space-separated fields: an authorization code and a target host name.
57103 The authorization code can be <quote>Y</quote> for yes, <quote>N</quote> for no, <quote>X</quote> for explicit
57104 authorization required but absent, or <quote>?</quote> for unknown.
57105 </para>
57106 </section>
57107 <section id="SECTverifyPRVS">
57108 <title>Bounce address tag validation</title>
57109 <para>
57110 <indexterm role="concept">
57111 <primary>BATV, verifying</primary>
57112 </indexterm>
57113 Bounce address tag validation (BATV) is a scheme whereby the envelope senders
57114 of outgoing messages have a cryptographic, timestamped <quote>tag</quote> added to them.
57115 Genuine incoming bounce messages should therefore always be addressed to
57116 recipients that have a valid tag. This scheme is a way of detecting unwanted
57117 bounce messages caused by sender address forgeries (often called <quote>collateral
57118 spam</quote>), because the recipients of such messages do not include valid tags.
57119 </para>
57120 <para>
57121 There are two expansion items to help with the implementation of the BATV
57122 <quote>prvs</quote> (private signature) scheme in an Exim configuration. This scheme signs
57123 the original envelope sender address by using a simple key to add a hash of the
57124 address and some time-based randomizing information. The <option>prvs</option> expansion
57125 item creates a signed address, and the <option>prvscheck</option> expansion item checks one.
57126 The syntax of these expansion items is described in section
57127 <xref linkend="SECTexpansionitems"/>.
57128 </para>
57129 <para>
57130 As an example, suppose the secret per-address keys are stored in an MySQL
57131 database. A query to look up the key for an address could be defined as a macro
57132 like this:
57133 </para>
57134 <literallayout class="monospaced">
57135 PRVSCHECK_SQL = ${lookup mysql{SELECT secret FROM batv_prvs \
57136                 WHERE sender='${quote_mysql:$prvscheck_address}'\
57137                 }{$value}}
57138 </literallayout>
57139 <para>
57140 Suppose also that the senders who make use of BATV are defined by an address
57141 list called <option>batv_senders</option>. Then, in the ACL for RCPT commands, you could
57142 use this:
57143 </para>
57144 <literallayout class="monospaced">
57145 # Bounces: drop unsigned addresses for BATV senders
57146 deny message = This address does not send an unsigned reverse path
57147      senders = :
57148      recipients = +batv_senders
57149
57150 # Bounces: In case of prvs-signed address, check signature.
57151 deny message = Invalid reverse path signature.
57152      senders = :
57153      condition  = ${prvscheck {$local_part@$domain}\
57154                   {PRVSCHECK_SQL}{1}}
57155      !condition = $prvscheck_result
57156 </literallayout>
57157 <para>
57158 The first statement rejects recipients for bounce messages that are addressed
57159 to plain BATV sender addresses, because it is known that BATV senders do not
57160 send out messages with plain sender addresses. The second statement rejects
57161 recipients that are prvs-signed, but with invalid signatures (either because
57162 the key is wrong, or the signature has timed out).
57163 </para>
57164 <para>
57165 A non-prvs-signed address is not rejected by the second statement, because the
57166 <option>prvscheck</option> expansion yields an empty string if its first argument is not a
57167 prvs-signed address, thus causing the <option>condition</option> condition to be false. If
57168 the first argument is a syntactically valid prvs-signed address, the yield is
57169 the third string (in this case <quote>1</quote>), whether or not the cryptographic and
57170 timeout checks succeed. The <varname>$prvscheck_result</varname> variable contains the result
57171 of the checks (empty for failure, <quote>1</quote> for success).
57172 </para>
57173 <para>
57174 There is one more issue you must consider when implementing prvs-signing:
57175 you have to ensure that the routers accept prvs-signed addresses and
57176 deliver them correctly. The easiest way to handle this is to use a <command>redirect</command>
57177 router to remove the signature with a configuration along these lines:
57178 </para>
57179 <literallayout class="monospaced">
57180 batv_redirect:
57181   driver = redirect
57182   data = ${prvscheck {$local_part@$domain}{PRVSCHECK_SQL}}
57183 </literallayout>
57184 <para>
57185 This works because, if the third argument of <option>prvscheck</option> is empty, the result
57186 of the expansion of a prvs-signed address is the decoded value of the original
57187 address. This router should probably be the first of your routers that handles
57188 local addresses.
57189 </para>
57190 <para>
57191 To create BATV-signed addresses in the first place, a transport of this form
57192 can be used:
57193 </para>
57194 <literallayout class="monospaced">
57195 external_smtp_batv:
57196   driver = smtp
57197   return_path = ${prvs {$return_path} \
57198                        {${lookup mysql{SELECT \
57199                        secret FROM batv_prvs WHERE \
57200                        sender='${quote_mysql:$sender_address}'} \
57201                        {$value}fail}}}
57202 </literallayout>
57203 <para>
57204 If no key can be found for the existing return path, no signing takes place.
57205 </para>
57206 </section>
57207 <section id="SECTrelaycontrol">
57208 <title>Using an ACL to control relaying</title>
57209 <para>
57210 <indexterm role="concept">
57211 <primary>access control lists (ACLs)</primary>
57212 <secondary>relay control</secondary>
57213 </indexterm>
57214 <indexterm role="concept">
57215 <primary>relaying</primary>
57216 <secondary>control by ACL</secondary>
57217 </indexterm>
57218 <indexterm role="concept">
57219 <primary>policy control</primary>
57220 <secondary>relay control</secondary>
57221 </indexterm>
57222 An MTA is said to <emphasis>relay</emphasis> a message if it receives it from some host and
57223 delivers it directly to another host as a result of a remote address contained
57224 within it. Redirecting a local address via an alias or forward file and then
57225 passing the message on to another host is not relaying,
57226 <indexterm role="concept">
57227 <primary><quote>percent hack</quote></primary>
57228 </indexterm>
57229 but a redirection as a result of the <quote>percent hack</quote> is.
57230 </para>
57231 <para>
57232 Two kinds of relaying exist, which are termed <quote>incoming</quote> and <quote>outgoing</quote>.
57233 A host which is acting as a gateway or an MX backup is concerned with incoming
57234 relaying from arbitrary hosts to a specific set of domains. On the other hand,
57235 a host which is acting as a smart host for a number of clients is concerned
57236 with outgoing relaying from those clients to the Internet at large. Often the
57237 same host is fulfilling both functions,
57238 but in principle these two kinds of relaying are entirely independent. What is
57239 not wanted is the transmission of mail from arbitrary remote hosts through your
57240 system to arbitrary domains.
57241 </para>
57242 <para>
57243 You can implement relay control by means of suitable statements in the ACL that
57244 runs for each RCPT command. For convenience, it is often easiest to use
57245 Exim&#x2019;s named list facility to define the domains and hosts involved. For
57246 example, suppose you want to do the following:
57247 </para>
57248 <itemizedlist>
57249 <listitem>
57250 <para>
57251 Deliver a number of domains to mailboxes on the local host (or process them
57252 locally in some other way). Let&#x2019;s say these are <emphasis>my.dom1.example</emphasis> and
57253 <emphasis>my.dom2.example</emphasis>.
57254 </para>
57255 </listitem>
57256 <listitem>
57257 <para>
57258 Relay mail for a number of other domains for which you are the secondary MX.
57259 These might be <emphasis>friend1.example</emphasis> and <emphasis>friend2.example</emphasis>.
57260 </para>
57261 </listitem>
57262 <listitem>
57263 <para>
57264 Relay mail from the hosts on your local LAN, to whatever domains are involved.
57265 Suppose your LAN is 192.168.45.0/24.
57266 </para>
57267 </listitem>
57268 </itemizedlist>
57269 <para>
57270 In the main part of the configuration, you put the following definitions:
57271 </para>
57272 <literallayout class="monospaced">
57273 domainlist local_domains    = my.dom1.example : my.dom2.example
57274 domainlist relay_to_domains = friend1.example : friend2.example
57275 hostlist   relay_from_hosts = 192.168.45.0/24
57276 </literallayout>
57277 <para>
57278 Now you can use these definitions in the ACL that is run for every RCPT
57279 command:
57280 </para>
57281 <literallayout class="monospaced">
57282 acl_check_rcpt:
57283   accept domains = +local_domains : +relay_to_domains
57284   accept hosts   = +relay_from_hosts
57285 </literallayout>
57286 <para>
57287 The first statement accepts any RCPT command that contains an address in
57288 the local or relay domains. For any other domain, control passes to the second
57289 statement, which accepts the command only if it comes from one of the relay
57290 hosts. In practice, you will probably want to make your ACL more sophisticated
57291 than this, for example, by including sender and recipient verification. The
57292 default configuration includes a more comprehensive example, which is described
57293 in chapter <xref linkend="CHAPdefconfil"/>.
57294 </para>
57295 </section>
57296 <section id="SECTcheralcon">
57297 <title>Checking a relay configuration</title>
57298 <para>
57299 <indexterm role="concept">
57300 <primary>relaying</primary>
57301 <secondary>checking control of</secondary>
57302 </indexterm>
57303 You can check the relay characteristics of your configuration in the same way
57304 that you can test any ACL behaviour for an incoming SMTP connection, by using
57305 the <option>-bh</option> option to run a fake SMTP session with which you interact.
57306 </para>
57307 <para>
57308 For specifically testing for unwanted relaying, the host
57309 <emphasis>relay-test.mail-abuse.org</emphasis> provides a useful service. If you telnet to this
57310 host from the host on which Exim is running, using the normal telnet port, you
57311 will see a normal telnet connection message and then quite a long delay. Be
57312 patient. The remote host is making an SMTP connection back to your host, and
57313 trying a number of common probes to test for open relay vulnerability. The
57314 results of the tests will eventually appear on your terminal.
57315 <indexterm role="concept" startref="IIDacl" class="endofrange"/>
57316 </para>
57317 </section>
57318 </chapter>
57319
57320 <chapter id="CHAPexiscan">
57321 <title>Content scanning at ACL time</title>
57322 <para>
57323 <indexterm role="concept" id="IIDcosca" class="startofrange">
57324 <primary>content scanning</primary>
57325 <secondary>at ACL time</secondary>
57326 </indexterm>
57327 The extension of Exim to include content scanning at ACL time, formerly known
57328 as <quote>exiscan</quote>, was originally implemented as a patch by Tom Kistner. The code
57329 was integrated into the main source for Exim release 4.50, and Tom continues to
57330 maintain it. Most of the wording of this chapter is taken from Tom&#x2019;s
57331 specification.
57332 </para>
57333 <para>
57334 It is also possible to scan the content of messages at other times. The
57335 <function>local_scan()</function> function (see chapter <xref linkend="CHAPlocalscan"/>) allows for content
57336 scanning after all the ACLs have run. A transport filter can be used to scan
57337 messages at delivery time (see the <option>transport_filter</option> option, described in
57338 chapter <xref linkend="CHAPtransportgeneric"/>).
57339 </para>
57340 <para>
57341 If you want to include the ACL-time content-scanning features when you compile
57342 Exim, you need to arrange for WITH_CONTENT_SCAN to be defined in your
57343 <filename>Local/Makefile</filename>. When you do that, the Exim binary is built with:
57344 </para>
57345 <itemizedlist>
57346 <listitem>
57347 <para>
57348 Two additional ACLs (<option>acl_smtp_mime</option> and <option>acl_not_smtp_mime</option>) that are run
57349 for all MIME parts for SMTP and non-SMTP messages, respectively.
57350 </para>
57351 </listitem>
57352 <listitem>
57353 <para>
57354 Additional ACL conditions and modifiers: <option>decode</option>, <option>malware</option>,
57355 <option>mime_regex</option>, <option>regex</option>, and <option>spam</option>. These can be used in the ACL that is
57356 run at the end of message reception (the <option>acl_smtp_data</option> ACL).
57357 </para>
57358 </listitem>
57359 <listitem>
57360 <para>
57361 An additional control feature (<quote>no_mbox_unspool</quote>) that saves spooled copies
57362 of messages, or parts of messages, for debugging purposes.
57363 </para>
57364 </listitem>
57365 <listitem>
57366 <para>
57367 Additional expansion variables that are set in the new ACL and by the new
57368 conditions.
57369 </para>
57370 </listitem>
57371 <listitem>
57372 <para>
57373 Two new main configuration options: <option>av_scanner</option> and <option>spamd_address</option>.
57374 </para>
57375 </listitem>
57376 </itemizedlist>
57377 <para>
57378 There is another content-scanning configuration option for <filename>Local/Makefile</filename>,
57379 called WITH_OLD_DEMIME. If this is set, the old, deprecated <option>demime</option> ACL
57380 condition is compiled, in addition to all the other content-scanning features.
57381 </para>
57382 <para>
57383 Content-scanning is continually evolving, and new features are still being
57384 added. While such features are still unstable and liable to incompatible
57385 changes, they are made available in Exim by setting options whose names begin
57386 EXPERIMENTAL_ in <filename>Local/Makefile</filename>. Such features are not documented in
57387 this manual. You can find out about them by reading the file called
57388 <filename>doc/experimental.txt</filename>.
57389 </para>
57390 <para>
57391 All the content-scanning facilities work on a MBOX copy of the message that is
57392 temporarily created in a file called:
57393 </para>
57394 <literallayout>
57395 &lt;<emphasis>spool_directory</emphasis>&gt;<literal>/scan/</literal>&lt;<emphasis>message_id</emphasis>&gt;/&lt;<emphasis>message_id</emphasis>&gt;<literal>.eml</literal>
57396 </literallayout>
57397 <para>
57398 The <filename>.eml</filename> extension is a friendly hint to virus scanners that they can
57399 expect an MBOX-like structure inside that file. The file is created when the
57400 first content scanning facility is called. Subsequent calls to content
57401 scanning conditions open the same file again. The directory is recursively
57402 removed when the <option>acl_smtp_data</option> ACL has finished running, unless
57403 </para>
57404 <literallayout class="monospaced">
57405 control = no_mbox_unspool
57406 </literallayout>
57407 <para>
57408 has been encountered. When the MIME ACL decodes files, they are put into the
57409 same directory by default.
57410 </para>
57411 <section id="SECTscanvirus">
57412 <title>Scanning for viruses</title>
57413 <para>
57414 <indexterm role="concept">
57415 <primary>virus scanning</primary>
57416 </indexterm>
57417 <indexterm role="concept">
57418 <primary>content scanning</primary>
57419 <secondary>for viruses</secondary>
57420 </indexterm>
57421 <indexterm role="concept">
57422 <primary>content scanning</primary>
57423 <secondary>the <option>malware</option> condition</secondary>
57424 </indexterm>
57425 The <option>malware</option> ACL condition lets you connect virus scanner software to Exim.
57426 It supports a <quote>generic</quote> interface to scanners called via the shell, and
57427 specialized interfaces for <quote>daemon</quote> type virus scanners, which are resident
57428 in memory and thus are much faster.
57429 </para>
57430 <para revisionflag="changed">
57431 A timeout of 2 minutes is applied to a scanner call (by default);
57432 if it expires then a defer action is taken.
57433 </para>
57434 <para>
57435 <indexterm role="option">
57436 <primary><option>av_scanner</option></primary>
57437 </indexterm>
57438 You can set the <option>av_scanner</option> option in the main part of the configuration
57439 to specify which scanner to use, together with any additional options that
57440 are needed. The basic syntax is as follows:
57441 </para>
57442 <literallayout>
57443 <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>
57444 </literallayout>
57445 <para>
57446 If you do not set <option>av_scanner</option>, it defaults to
57447 </para>
57448 <literallayout class="monospaced">
57449 av_scanner = sophie:/var/run/sophie
57450 </literallayout>
57451 <para>
57452 If the value of <option>av_scanner</option> starts with a dollar character, it is expanded
57453 before use.
57454 The usual list-parsing of the content (see <xref linkend="SECTlistconstruct"/>) applies.
57455 The following scanner types are supported in this release:
57456 </para>
57457 <variablelist>
57458 <varlistentry revisionflag="changed">
57459 <term><option>avast</option></term>
57460 <listitem>
57461 <para revisionflag="changed">
57462 <indexterm role="concept">
57463 <primary>virus scanners</primary>
57464 <secondary>avast</secondary>
57465 </indexterm>
57466 This is the scanner daemon of Avast. It has been tested with Avast Core
57467 Security (currently at version 1.1.7).
57468 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
57469 at <emphasis role="bold"><ulink url="http://www.avast.com/linux-server-antivirus">http://www.avast.com/linux-server-antivirus</ulink></emphasis>.
57470 This scanner type takes one option,
57471 which can be either a full path to a UNIX socket,
57472 or host and port specifiers separated by white space.
57473 The host may be a name or an IP address; the port is either a
57474 single number or a pair of numbers with a dash between.
57475 Any further options are given, on separate lines,
57476 to the daemon as options before the main scan command.
57477 For example:
57478 </para>
57479 <literallayout class="monospaced" revisionflag="changed">
57480 av_scanner = avast:/var/run/avast/scan.sock:FLAGS -fullfiles:SENSITIVITY -pup
57481 av_scanner = avast:192.168.2.22 5036
57482 </literallayout>
57483 <para revisionflag="changed">
57484 If you omit the argument, the default path
57485 <filename>/var/run/avast/scan.sock</filename>
57486 is used.
57487 If you use a remote host,
57488 you need to make Exim&#x2019;s spool directory available to it,
57489 as the scanner is passed a file path, not file contents.
57490 For information about available commands and their options you may use
57491 </para>
57492 <literallayout class="monospaced" revisionflag="changed">
57493 $ socat UNIX:/var/run/avast/scan.sock STDIO:
57494     FLAGS
57495     SENSITIVITY
57496     PACK
57497 </literallayout>
57498 </listitem></varlistentry>
57499 <varlistentry>
57500 <term><option>aveserver</option></term>
57501 <listitem>
57502 <para>
57503 <indexterm role="concept">
57504 <primary>virus scanners</primary>
57505 <secondary>Kaspersky</secondary>
57506 </indexterm>
57507 This is the scanner daemon of Kaspersky Version 5. You can get a trial version
57508 at <emphasis role="bold"><ulink url="http://www.kaspersky.com">http://www.kaspersky.com</ulink></emphasis>. This scanner type takes one option,
57509 which is the path to the daemon&#x2019;s UNIX socket. The default is shown in this
57510 example:
57511 </para>
57512 <literallayout class="monospaced">
57513 av_scanner = aveserver:/var/run/aveserver
57514 </literallayout>
57515 </listitem></varlistentry>
57516 <varlistentry>
57517 <term><option>clamd</option></term>
57518 <listitem>
57519 <para>
57520 <indexterm role="concept">
57521 <primary>virus scanners</primary>
57522 <secondary>clamd</secondary>
57523 </indexterm>
57524 This daemon-type scanner is GPL and free. You can get it at
57525 <emphasis role="bold"><ulink url="http://www.clamav.net/">http://www.clamav.net/</ulink></emphasis>. Some older versions of clamd do not seem to
57526 unpack MIME containers, so it used to be recommended to unpack MIME attachments
57527 in the MIME ACL. This is no longer believed to be necessary.
57528 </para>
57529 <para>
57530 The options are a list of server specifiers, which may be
57531 a UNIX socket specification,
57532 a TCP socket specification,
57533 or a (global) option.
57534 </para>
57535 <para>
57536 A socket specification consists of a space-separated list.
57537 For a Unix socket the first element is a full path for the socket,
57538 for a TCP socket the first element is the IP address
57539 and the second a port number,
57540 Any further elements are per-server (non-global) options.
57541 These per-server options are supported:
57542 </para>
57543 <literallayout class="monospaced">
57544 retry=&lt;timespec&gt;  Retry on connect fail
57545 </literallayout>
57546 <para>
57547 The <literal>retry</literal> option specifies a time after which a single retry for
57548 a failed connect is made.  The default is to not retry.
57549 </para>
57550 <para>
57551 If a Unix socket file is specified, only one server is supported.
57552 </para>
57553 <para>
57554 Examples:
57555 </para>
57556 <literallayout class="monospaced">
57557 av_scanner = clamd:/opt/clamd/socket
57558 av_scanner = clamd:192.0.2.3 1234
57559 av_scanner = clamd:192.0.2.3 1234:local
57560 av_scanner = clamd:192.0.2.3 1234 retry=10s
57561 av_scanner = clamd:192.0.2.3 1234 : 192.0.2.4 1234
57562 </literallayout>
57563 <para>
57564 If the value of av_scanner points to a UNIX socket file or contains the
57565 <literal>local</literal>
57566 option, then the ClamAV interface will pass a filename containing the data
57567 to be scanned, which will should normally result in less I/O happening and be
57568 more efficient.  Normally in the TCP case, the data is streamed to ClamAV as
57569 Exim does not assume that there is a common filesystem with the remote host.
57570 There is an option WITH_OLD_CLAMAV_STREAM in <filename>src/EDITME</filename> available, should
57571 you be running a version of ClamAV prior to 0.95.
57572 </para>
57573 <para>
57574 The final example shows that multiple TCP targets can be specified.  Exim will
57575 randomly use one for each incoming email (i.e. it load balances them).  Note
57576 that only TCP targets may be used if specifying a list of scanners; a UNIX
57577 socket cannot be mixed in with TCP targets.  If one of the servers becomes
57578 unavailable, Exim will try the remaining one(s) until it finds one that works.
57579 When a clamd server becomes unreachable, Exim will log a message.  Exim does
57580 not keep track of scanner state between multiple messages, and the scanner
57581 selection is random, so the message will get logged in the mainlog for each
57582 email that the down scanner gets chosen first (message wrapped to be readable):
57583 </para>
57584 <literallayout class="monospaced">
57585 2013-10-09 14:30:39 1VTumd-0000Y8-BQ malware acl condition:
57586    clamd: connection to localhost, port 3310 failed
57587    (Connection refused)
57588 </literallayout>
57589 <para>
57590 If the option is unset, the default is <filename>/tmp/clamd</filename>. Thanks to David Saez for
57591 contributing the code for this scanner.
57592 </para>
57593 </listitem></varlistentry>
57594 <varlistentry>
57595 <term><option>cmdline</option></term>
57596 <listitem>
57597 <para>
57598 <indexterm role="concept">
57599 <primary>virus scanners</primary>
57600 <secondary>command line interface</secondary>
57601 </indexterm>
57602 This is the keyword for the generic command line scanner interface. It can be
57603 used to attach virus scanners that are invoked from the shell. This scanner
57604 type takes 3 mandatory options:
57605 </para>
57606 <orderedlist numeration="arabic">
57607 <listitem>
57608 <para>
57609 The full path and name of the scanner binary, with all command line options,
57610 and a placeholder (<literal>%s</literal>) for the directory to scan.
57611 </para>
57612 </listitem>
57613 <listitem>
57614 <para>
57615 A regular expression to match against the STDOUT and STDERR output of the
57616 virus scanner. If the expression matches, a virus was found. You must make
57617 absolutely sure that this expression matches on <quote>virus found</quote>. This is called
57618 the <quote>trigger</quote> expression.
57619 </para>
57620 </listitem>
57621 <listitem>
57622 <para>
57623 Another regular expression, containing exactly one pair of parentheses, to
57624 match the name of the virus found in the scanners output. This is called the
57625 <quote>name</quote> expression.
57626 </para>
57627 </listitem>
57628 </orderedlist>
57629 <para>
57630 For example, Sophos Sweep reports a virus on a line like this:
57631 </para>
57632 <literallayout class="monospaced">
57633 Virus 'W32/Magistr-B' found in file ./those.bat
57634 </literallayout>
57635 <para>
57636 For the trigger expression, we can match the phrase <quote>found in file</quote>. For the
57637 name expression, we want to extract the W32/Magistr-B string, so we can match
57638 for the single quotes left and right of it. Altogether, this makes the
57639 configuration setting:
57640 </para>
57641 <literallayout class="monospaced">
57642 av_scanner = cmdline:\
57643              /path/to/sweep -ss -all -rec -archive %s:\
57644              found in file:'(.+)'
57645 </literallayout>
57646 </listitem></varlistentry>
57647 <varlistentry>
57648 <term><option>drweb</option></term>
57649 <listitem>
57650 <para>
57651 <indexterm role="concept">
57652 <primary>virus scanners</primary>
57653 <secondary>DrWeb</secondary>
57654 </indexterm>
57655 The DrWeb daemon scanner (<emphasis role="bold"><ulink url="http://www.sald.com/">http://www.sald.com/</ulink></emphasis>) interface
57656 takes one option,
57657 either a full path to a UNIX socket,
57658 or host and port specifiers separated by white space.
57659 The host may be a name or an IP address; the port is either a
57660 single number or a pair of numbers with a dash between.
57661 For example:
57662 </para>
57663 <literallayout class="monospaced">
57664 av_scanner = drweb:/var/run/drwebd.sock
57665 av_scanner = drweb:192.168.2.20 31337
57666 </literallayout>
57667 <para>
57668 If you omit the argument, the default path <filename>/usr/local/drweb/run/drwebd.sock</filename>
57669 is used. Thanks to Alex Miller for contributing the code for this scanner.
57670 </para>
57671 </listitem></varlistentry>
57672 <varlistentry>
57673 <term><option>f-protd</option></term>
57674 <listitem>
57675 <para>
57676 <indexterm role="concept">
57677 <primary>virus scanners</primary>
57678 <secondary>f-protd</secondary>
57679 </indexterm>
57680 The f-protd scanner is accessed via HTTP over TCP.
57681 One argument is taken, being a space-separated hostname and port number
57682 (or port-range).
57683 For example:
57684 </para>
57685 <literallayout class="monospaced">
57686 av_scanner = f-protd:localhost 10200-10204
57687 </literallayout>
57688 <para>
57689 If you omit the argument, the default values show above are used.
57690 </para>
57691 </listitem></varlistentry>
57692 <varlistentry>
57693 <term><option>fsecure</option></term>
57694 <listitem>
57695 <para>
57696 <indexterm role="concept">
57697 <primary>virus scanners</primary>
57698 <secondary>F-Secure</secondary>
57699 </indexterm>
57700 The F-Secure daemon scanner (<emphasis role="bold"><ulink url="http://www.f-secure.com">http://www.f-secure.com</ulink></emphasis>) takes one
57701 argument which is the path to a UNIX socket. For example:
57702 </para>
57703 <literallayout class="monospaced">
57704 av_scanner = fsecure:/path/to/.fsav
57705 </literallayout>
57706 <para>
57707 If no argument is given, the default is <filename>/var/run/.fsav</filename>. Thanks to Johan
57708 Thelmen for contributing the code for this scanner.
57709 </para>
57710 </listitem></varlistentry>
57711 <varlistentry>
57712 <term><option>kavdaemon</option></term>
57713 <listitem>
57714 <para>
57715 <indexterm role="concept">
57716 <primary>virus scanners</primary>
57717 <secondary>Kaspersky</secondary>
57718 </indexterm>
57719 This is the scanner daemon of Kaspersky Version 4. This version of the
57720 Kaspersky scanner is outdated. Please upgrade (see <option>aveserver</option> above). This
57721 scanner type takes one option, which is the path to the daemon&#x2019;s UNIX socket.
57722 For example:
57723 </para>
57724 <literallayout class="monospaced">
57725 av_scanner = kavdaemon:/opt/AVP/AvpCtl
57726 </literallayout>
57727 <para>
57728 The default path is <filename>/var/run/AvpCtl</filename>.
57729 </para>
57730 </listitem></varlistentry>
57731 <varlistentry>
57732 <term><option>mksd</option></term>
57733 <listitem>
57734 <para>
57735 <indexterm role="concept">
57736 <primary>virus scanners</primary>
57737 <secondary>mksd</secondary>
57738 </indexterm>
57739 This is a daemon type scanner that is aimed mainly at Polish users, though some
57740 parts of documentation are now available in English. You can get it at
57741 <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
57742 the maximum number of processes used simultaneously to scan the attachments,
57743 provided that the demime facility is employed and also provided that mksd has
57744 been run with at least the same number of child processes. For example:
57745 </para>
57746 <literallayout class="monospaced">
57747 av_scanner = mksd:2
57748 </literallayout>
57749 <para>
57750 You can safely omit this option (the default value is 1).
57751 </para>
57752 </listitem></varlistentry>
57753 <varlistentry>
57754 <term><option>sock</option></term>
57755 <listitem>
57756 <para>
57757 <indexterm role="concept">
57758 <primary>virus scanners</primary>
57759 <secondary>simple socket-connected</secondary>
57760 </indexterm>
57761 This is a general-purpose way of talking to simple scanner daemons
57762 running on the local machine.
57763 There are four options:
57764 an address (which may be an IP address and port, or the path of a Unix socket),
57765 a commandline to send (may include a single %s which will be replaced with
57766 the path to the mail file to be scanned),
57767 an RE to trigger on from the returned data,
57768 an RE to extract malware_name from the returned data.
57769 For example:
57770 </para>
57771 <literallayout class="monospaced">
57772 av_scanner = sock:127.0.0.1 6001:%s:(SPAM|VIRUS):(.*)\$
57773 </literallayout>
57774 <para>
57775 Default for the socket specifier is <filename>/tmp/malware.sock</filename>.
57776 Default for the commandline is <filename>%s\n</filename>.
57777 Both regular-expressions are required.
57778 </para>
57779 </listitem></varlistentry>
57780 <varlistentry>
57781 <term><option>sophie</option></term>
57782 <listitem>
57783 <para>
57784 <indexterm role="concept">
57785 <primary>virus scanners</primary>
57786 <secondary>Sophos and Sophie</secondary>
57787 </indexterm>
57788 Sophie is a daemon that uses Sophos&#x2019; <option>libsavi</option> library to scan for viruses.
57789 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
57790 for this scanner type is the path to the UNIX socket that Sophie uses for
57791 client communication. For example:
57792 </para>
57793 <literallayout class="monospaced">
57794 av_scanner = sophie:/tmp/sophie
57795 </literallayout>
57796 <para>
57797 The default path is <filename>/var/run/sophie</filename>, so if you are using this, you can omit
57798 the option.
57799 </para>
57800 </listitem></varlistentry>
57801 </variablelist>
57802 <para>
57803 When <option>av_scanner</option> is correctly set, you can use the <option>malware</option> condition in
57804 the DATA ACL. <emphasis role="bold">Note</emphasis>: You cannot use the <option>malware</option> condition in the MIME
57805 ACL.
57806 </para>
57807 <para>
57808 The <option>av_scanner</option> option is expanded each time <option>malware</option> is called. This
57809 makes it possible to use different scanners. See further below for an example.
57810 The <option>malware</option> condition caches its results, so when you use it multiple times
57811 for the same message, the actual scanning process is only carried out once.
57812 However, using expandable items in <option>av_scanner</option> disables this caching, in
57813 which case each use of the <option>malware</option> condition causes a new scan of the
57814 message.
57815 </para>
57816 <para>
57817 The <option>malware</option> condition takes a right-hand argument that is expanded before
57818 </para>
57819 <para revisionflag="changed">
57820 use and taken as a list, slash-separated by default.
57821 </para>
57822 <para>
57823 The first element can then be one of
57824 </para>
57825 <itemizedlist>
57826 <listitem>
57827 <para>
57828 <quote>true</quote>, <quote>*</quote>, or <quote>1</quote>, in which case the message is scanned for viruses.
57829 The condition succeeds if a virus was found, and fail otherwise. This is the
57830 recommended usage.
57831 </para>
57832 </listitem>
57833 <listitem>
57834 <para>
57835 <quote>false</quote> or <quote>0</quote> or an empty string, in which case no scanning is done and
57836 the condition fails immediately.
57837 </para>
57838 </listitem>
57839 <listitem>
57840 <para>
57841 A regular expression, in which case the message is scanned for viruses. The
57842 condition succeeds if a virus is found and its name matches the regular
57843 expression. This allows you to take special actions on certain types of virus.
57844 </para>
57845 <para revisionflag="changed">
57846 Note that <quote>/</quote> characters in the RE must be doubled due to the list-processing,
57847 unless the separator is changed (in the usual way).
57848 </para>
57849 </listitem>
57850 </itemizedlist>
57851 <para>
57852 You can append a <literal>defer_ok</literal> element to the <option>malware</option> argument list to accept
57853 messages even if there is a problem with the virus scanner.
57854 Otherwise, such a problem causes the ACL to defer.
57855 </para>
57856 <para revisionflag="changed">
57857 You can append a <literal>tmo=&lt;val&gt;</literal> element to the <option>malware</option> argument list to
57858 specify a non-default timeout.  The default is two minutes.
57859 For example:
57860 </para>
57861 <literallayout class="monospaced" revisionflag="changed">
57862 malware = * / defer_ok / tmo=10s
57863 </literallayout>
57864 <para revisionflag="changed">
57865 A timeout causes the ACL to defer.
57866 </para>
57867 <para>
57868 <indexterm role="variable">
57869 <primary><varname>$malware_name</varname></primary>
57870 </indexterm>
57871 When a virus is found, the condition sets up an expansion variable called
57872 <varname>$malware_name</varname> that contains the name of the virus. You can use it in a
57873 <option>message</option> modifier that specifies the error returned to the sender, and/or in
57874 logging data.
57875 </para>
57876 <para>
57877 If your virus scanner cannot unpack MIME and TNEF containers itself, you should
57878 use the <option>demime</option> condition (see section <xref linkend="SECTdemimecond"/>) before the
57879 <option>malware</option> condition.
57880 </para>
57881 <para>
57882 Beware the interaction of Exim&#x2019;s <option>message_size_limit</option> with any size limits
57883 imposed by your anti-virus scanner.
57884 </para>
57885 <para>
57886 Here is a very simple scanning example:
57887 </para>
57888 <literallayout class="monospaced">
57889 deny message = This message contains malware ($malware_name)
57890      demime = *
57891      malware = *
57892 </literallayout>
57893 <para>
57894 The next example accepts messages when there is a problem with the scanner:
57895 </para>
57896 <literallayout class="monospaced">
57897 deny message = This message contains malware ($malware_name)
57898      demime = *
57899      malware = */defer_ok
57900 </literallayout>
57901 <para>
57902 The next example shows how to use an ACL variable to scan with both sophie and
57903 aveserver. It assumes you have set:
57904 </para>
57905 <literallayout class="monospaced">
57906 av_scanner = $acl_m0
57907 </literallayout>
57908 <para>
57909 in the main Exim configuration.
57910 </para>
57911 <literallayout class="monospaced">
57912 deny message = This message contains malware ($malware_name)
57913      set acl_m0 = sophie
57914      malware = *
57915
57916 deny message = This message contains malware ($malware_name)
57917      set acl_m0 = aveserver
57918      malware = *
57919 </literallayout>
57920 </section>
57921 <section id="SECTscanspamass">
57922 <title>Scanning with SpamAssassin and Rspamd</title>
57923 <para>
57924 <indexterm role="concept">
57925 <primary>content scanning</primary>
57926 <secondary>for spam</secondary>
57927 </indexterm>
57928 <indexterm role="concept">
57929 <primary>spam scanning</primary>
57930 </indexterm>
57931 <indexterm role="concept">
57932 <primary>SpamAssassin</primary>
57933 </indexterm>
57934 <indexterm role="concept">
57935 <primary>Rspamd</primary>
57936 </indexterm>
57937 The <option>spam</option> ACL condition calls SpamAssassin&#x2019;s <option>spamd</option> daemon to get a spam
57938 score and a report for the message.
57939 </para>
57940 <para revisionflag="changed">
57941 Support is also provided for Rspamd.
57942 </para>
57943 <para revisionflag="changed">
57944 For more information about installation and configuration of SpamAssassin or
57945 Rspamd refer to their respective websites at
57946 <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>
57947 </para>
57948 <para>
57949 SpamAssassin can be installed with CPAN by running:
57950 </para>
57951 <literallayout class="monospaced">
57952 perl -MCPAN -e 'install Mail::SpamAssassin'
57953 </literallayout>
57954 <para>
57955 SpamAssassin has its own set of configuration files. Please review its
57956 documentation to see how you can tweak it. The default installation should work
57957 nicely, however.
57958 </para>
57959 <para>
57960 <indexterm role="option">
57961 <primary><option>spamd_address</option></primary>
57962 </indexterm>
57963 By default, SpamAssassin listens on 127.0.0.1, TCP port 783 and if you
57964 intend to use an instance running on the local host you do not need to set
57965 <option>spamd_address</option>. If you intend to use another host or port for SpamAssassin,
57966 you must set the <option>spamd_address</option> option in the global part of the Exim
57967 configuration as follows (example):
57968 </para>
57969 <literallayout class="monospaced">
57970 spamd_address = 192.168.99.45 387
57971 </literallayout>
57972 <para revisionflag="changed">
57973 To use Rspamd (which by default listens on all local addresses
57974 on TCP port 11333)
57975 you should add <option>variant=rspamd</option> after the address/port pair, for example:
57976 </para>
57977 <literallayout class="monospaced" revisionflag="changed">
57978 spamd_address = 127.0.0.1 11333 variant=rspamd
57979 </literallayout>
57980 <para>
57981 As of version 2.60, <option>SpamAssassin</option> also supports communication over UNIX
57982 sockets. If you want to us these, supply <option>spamd_address</option> with an absolute
57983 file name instead of an address/port pair:
57984 </para>
57985 <literallayout class="monospaced">
57986 spamd_address = /var/run/spamd_socket
57987 </literallayout>
57988 <para>
57989 You can have multiple <option>spamd</option> servers to improve scalability. These can
57990 reside on other hardware reachable over the network. To specify multiple
57991 <option>spamd</option> servers, put multiple address/port pairs in the <option>spamd_address</option>
57992 option, separated with colons (the separator can be changed in the usual way):
57993 </para>
57994 <literallayout class="monospaced">
57995 spamd_address = 192.168.2.10 783 : \
57996                 192.168.2.11 783 : \
57997                 192.168.2.12 783
57998 </literallayout>
57999 <para>
58000 Up to 32 <option>spamd</option> servers are supported.
58001 When a server fails to respond to the connection attempt, all other
58002 servers are tried until one succeeds. If no server responds, the <option>spam</option>
58003 condition defers.
58004 </para>
58005 <para revisionflag="changed">
58006 Unix and TCP socket specifications may be mixed in any order.
58007 Each element of the list is a list itself, space-separated by default
58008 and changeable in the usual way.
58009 </para>
58010 <para revisionflag="changed">
58011 For TCP socket specifications a host name or IP (v4 or v6, but
58012 subject to list-separator quoting rules) address can be used,
58013 and the port can be one or a dash-separated pair.
58014 In the latter case, the range is tried in strict order.
58015 </para>
58016 <para revisionflag="changed">
58017 Elements after the first for Unix sockets, or second for TCP socket,
58018 are options.
58019 The supported option are:
58020 </para>
58021 <literallayout class="monospaced" revisionflag="changed">
58022 pri=&lt;priority&gt;      Selection priority
58023 weight=&lt;value&gt;      Selection bias
58024 time=&lt;start&gt;-&lt;end&gt;  Use only between these times of day
58025 retry=&lt;timespec&gt;    Retry on connect fail
58026 tmo=&lt;timespec&gt;      Connection time limit
58027 variant=rspamd      Use Rspamd rather than SpamAssassin protocol
58028 </literallayout>
58029 <para revisionflag="changed">
58030 The <literal>pri</literal> option specifies a priority for the server within the list,
58031 higher values being tried first.
58032 The default priority is 1.
58033 </para>
58034 <para revisionflag="changed">
58035 The <literal>weight</literal> option specifies a selection bias.
58036 Within a priority set
58037 servers are queried in a random fashion, weighted by this value.
58038 The default value for selection bias is 1.
58039 </para>
58040 <para revisionflag="changed">
58041 Time specifications for the <literal>time</literal> option are &lt;hour&gt;.&lt;minute&gt;.&lt;second&gt;
58042 in the local time zone; each element being one or more digits.
58043 Either the seconds or both minutes and seconds, plus the leading <literal>.</literal>
58044 characters, may be omitted and will be taken as zero.
58045 </para>
58046 <para revisionflag="changed">
58047 Timeout specifications for the <literal>retry</literal> and <literal>tmo</literal> options
58048 are the usual Exim time interval standard, e.g. <literal>20s</literal> or <literal>1m</literal>.
58049 </para>
58050 <para revisionflag="changed">
58051 The <literal>tmo</literal> option specifies an overall timeout for communication.
58052 The default value is two minutes.
58053 </para>
58054 <para revisionflag="changed">
58055 The <literal>retry</literal> option specifies a time after which a single retry for
58056 a failed connect is made.
58057 The default is to not retry.
58058 </para>
58059 <para>
58060 The <option>spamd_address</option> variable is expanded before use if it starts with
58061 a dollar sign. In this case, the expansion may return a string that is
58062 used as the list so that multiple spamd servers can be the result of an
58063 expansion.
58064 </para>
58065 </section>
58066 <section id="SECID206">
58067 <title>Calling SpamAssassin from an Exim ACL</title>
58068 <para>
58069 Here is a simple example of the use of the <option>spam</option> condition in a DATA ACL:
58070 </para>
58071 <literallayout class="monospaced">
58072 deny message = This message was classified as SPAM
58073      spam = joe
58074 </literallayout>
58075 <para>
58076 The right-hand side of the <option>spam</option> condition specifies a name. This is
58077 relevant if you have set up multiple SpamAssassin profiles. If you do not want
58078 to scan using a specific profile, but rather use the SpamAssassin system-wide
58079 default profile, you can scan for an unknown name, or simply use <quote>nobody</quote>.
58080 </para>
58081 <para revisionflag="changed">
58082 Rspamd does not use this setting. However, you must put something on the
58083 right-hand side.
58084 </para>
58085 <para>
58086 The name allows you to use per-domain or per-user antispam profiles in
58087 principle, but this is not straightforward in practice, because a message may
58088 have multiple recipients, not necessarily all in the same domain. Because the
58089 <option>spam</option> condition has to be called from a DATA-time ACL in order to be able to
58090 read the contents of the message, the variables <varname>$local_part</varname> and <varname>$domain</varname>
58091 are not set.
58092 </para>
58093 <para revisionflag="changed">
58094 Careful enforcement of single-recipient messages
58095 (e.g. by responding with defer in the recipient ACL for all recipients
58096 after the first),
58097 or the use of PRDR,
58098 <indexterm role="concept">
58099 <primary>PRDR</primary>
58100 <secondary>use for per-user SpamAssassin profiles</secondary>
58101 </indexterm>
58102 are needed to use this feature.
58103 </para>
58104 <para>
58105 The right-hand side of the <option>spam</option> condition is expanded before being used, so
58106 you can put lookups or conditions there. When the right-hand side evaluates to
58107 <quote>0</quote> or <quote>false</quote>, no scanning is done and the condition fails immediately.
58108 </para>
58109 <para>
58110 Scanning with SpamAssassin uses a lot of resources. If you scan every message,
58111 large ones may cause significant performance degradation. As most spam messages
58112 are quite small, it is recommended that you do not scan the big ones. For
58113 example:
58114 </para>
58115 <literallayout class="monospaced">
58116 deny message = This message was classified as SPAM
58117      condition = ${if &lt; {$message_size}{10K}}
58118      spam = nobody
58119 </literallayout>
58120 <para>
58121 The <option>spam</option> condition returns true if the threshold specified in the user&#x2019;s
58122 SpamAssassin profile has been matched or exceeded. If you want to use the
58123 <option>spam</option> condition for its side effects (see the variables below), you can make
58124 it always return <quote>true</quote> by appending <literal>:true</literal> to the username.
58125 </para>
58126 <para>
58127 <indexterm role="concept">
58128 <primary>spam scanning</primary>
58129 <secondary>returned variables</secondary>
58130 </indexterm>
58131 When the <option>spam</option> condition is run, it sets up a number of expansion
58132 variables.
58133 </para>
58134 <para revisionflag="changed">
58135 Except for <varname>$spam_report</varname>,
58136 </para>
58137 <para>
58138 these variables are saved with the received message so are
58139 available for use at delivery time.
58140 </para>
58141 <variablelist>
58142 <varlistentry>
58143 <term><varname>$spam_score</varname></term>
58144 <listitem>
58145 <para>
58146 The spam score of the message, for example <quote>3.4</quote> or <quote>30.5</quote>. This is useful
58147 for inclusion in log or reject messages.
58148 </para>
58149 </listitem></varlistentry>
58150 <varlistentry>
58151 <term><varname>$spam_score_int</varname></term>
58152 <listitem>
58153 <para>
58154 The spam score of the message, multiplied by ten, as an integer value. For
58155 example <quote>34</quote> or <quote>305</quote>. It may appear to disagree with <varname>$spam_score</varname>
58156 because <varname>$spam_score</varname> is rounded and <varname>$spam_score_int</varname> is truncated.
58157 The integer value is useful for numeric comparisons in conditions.
58158 </para>
58159 </listitem></varlistentry>
58160 <varlistentry>
58161 <term><varname>$spam_bar</varname></term>
58162 <listitem>
58163 <para>
58164 A string consisting of a number of <quote>+</quote> or <quote>-</quote> characters, representing the
58165 integer part of the spam score value. A spam score of 4.4 would have a
58166 <varname>$spam_bar</varname> value of <quote>++++</quote>. This is useful for inclusion in warning
58167 headers, since MUAs can match on such strings.
58168 </para>
58169 </listitem></varlistentry>
58170 <varlistentry>
58171 <term><varname>$spam_report</varname></term>
58172 <listitem>
58173 <para>
58174 A multiline text table, containing the full SpamAssassin report for the
58175 message. Useful for inclusion in headers or reject messages.
58176 </para>
58177 <para revisionflag="changed">
58178 This variable is only usable in a DATA-time ACL.
58179 </para>
58180 </listitem></varlistentry>
58181 <varlistentry revisionflag="changed">
58182 <term><varname>$spam_action</varname></term>
58183 <listitem>
58184 <para revisionflag="changed">
58185 For SpamAssassin either &#x2019;reject&#x2019; or &#x2019;no action&#x2019; depending on the
58186 spam score versus threshold.
58187 For Rspamd, the recommended action.
58188 </para>
58189 </listitem></varlistentry>
58190 </variablelist>
58191 <para>
58192 The <option>spam</option> condition caches its results unless expansion in
58193 spamd_address was used. If you call it again with the same user name, it
58194 does not scan again, but rather returns the same values as before.
58195 </para>
58196 <para>
58197 The <option>spam</option> condition returns DEFER if there is any error while running
58198 the message through SpamAssassin or if the expansion of spamd_address
58199 failed. If you want to treat DEFER as FAIL (to pass on to the next ACL
58200 statement block), append <literal>/defer_ok</literal> to the right-hand side of the
58201 spam condition, like this:
58202 </para>
58203 <literallayout class="monospaced">
58204 deny message = This message was classified as SPAM
58205      spam    = joe/defer_ok
58206 </literallayout>
58207 <para>
58208 This causes messages to be accepted even if there is a problem with <option>spamd</option>.
58209 </para>
58210 <para>
58211 Here is a longer, commented example of the use of the <option>spam</option>
58212 condition:
58213 </para>
58214 <literallayout class="monospaced">
58215 # put headers in all messages (no matter if spam or not)
58216 warn  spam = nobody:true
58217       add_header = X-Spam-Score: $spam_score ($spam_bar)
58218       add_header = X-Spam-Report: $spam_report
58219
58220 # add second subject line with *SPAM* marker when message
58221 # is over threshold
58222 warn  spam = nobody
58223       add_header = Subject: *SPAM* $h_Subject:
58224
58225 # reject spam at high scores (&gt; 12)
58226 deny  message = This message scored $spam_score spam points.
58227       spam = nobody:true
58228       condition = ${if &gt;{$spam_score_int}{120}{1}{0}}
58229 </literallayout>
58230 </section>
58231 <section id="SECTscanmimepart">
58232 <title>Scanning MIME parts</title>
58233 <para>
58234 <indexterm role="concept">
58235 <primary>content scanning</primary>
58236 <secondary>MIME parts</secondary>
58237 </indexterm>
58238 <indexterm role="concept">
58239 <primary>MIME content scanning</primary>
58240 </indexterm>
58241 <indexterm role="option">
58242 <primary><option>acl_smtp_mime</option></primary>
58243 </indexterm>
58244 <indexterm role="option">
58245 <primary><option>acl_not_smtp_mime</option></primary>
58246 </indexterm>
58247 The <option>acl_smtp_mime</option> global option specifies an ACL that is called once for
58248 each MIME part of an SMTP message, including multipart types, in the sequence
58249 of their position in the message. Similarly, the <option>acl_not_smtp_mime</option> option
58250 specifies an ACL that is used for the MIME parts of non-SMTP messages. These
58251 options may both refer to the same ACL if you want the same processing in both
58252 cases.
58253 </para>
58254 <para>
58255 These ACLs are called (possibly many times) just before the <option>acl_smtp_data</option>
58256 ACL in the case of an SMTP message, or just before the <option>acl_not_smtp</option> ACL in
58257 the case of a non-SMTP message. However, a MIME ACL is called only if the
58258 message contains a <emphasis>Content-Type:</emphasis> header line. When a call to a MIME
58259 ACL does not yield <quote>accept</quote>, ACL processing is aborted and the appropriate
58260 result code is sent to the client. In the case of an SMTP message, the
58261 <option>acl_smtp_data</option> ACL is not called when this happens.
58262 </para>
58263 <para>
58264 You cannot use the <option>malware</option> or <option>spam</option> conditions in a MIME ACL; these can
58265 only be used in the DATA or non-SMTP ACLs. However, you can use the <option>regex</option>
58266 condition to match against the raw MIME part. You can also use the
58267 <option>mime_regex</option> condition to match against the decoded MIME part (see section
58268 <xref linkend="SECTscanregex"/>).
58269 </para>
58270 <para>
58271 At the start of a MIME ACL, a number of variables are set from the header
58272 information for the relevant MIME part. These are described below. The contents
58273 of the MIME part are not by default decoded into a disk file except for MIME
58274 parts whose content-type is <quote>message/rfc822</quote>. If you want to decode a MIME
58275 part into a disk file, you can use the <option>decode</option> condition. The general
58276 syntax is:
58277 </para>
58278 <literallayout>
58279 <literal>decode = [/</literal>&lt;<emphasis>path</emphasis>&gt;<literal>/]</literal>&lt;<emphasis>filename</emphasis>&gt;
58280 </literallayout>
58281 <para>
58282 The right hand side is expanded before use. After expansion,
58283 the value can be:
58284 </para>
58285 <orderedlist numeration="arabic">
58286 <listitem>
58287 <para>
58288 <quote>0</quote> or <quote>false</quote>, in which case no decoding is done.
58289 </para>
58290 </listitem>
58291 <listitem>
58292 <para>
58293 The string <quote>default</quote>. In that case, the file is put in the temporary
58294 <quote>default</quote> directory &lt;<emphasis>spool_directory</emphasis>&gt;<filename>/scan/</filename>&lt;<emphasis>message_id</emphasis>&gt;<filename>/</filename> with
58295 a sequential file name consisting of the message id and a sequence number. The
58296 full path and name is available in <varname>$mime_decoded_filename</varname> after decoding.
58297 </para>
58298 </listitem>
58299 <listitem>
58300 <para>
58301 A full path name starting with a slash. If the full name is an existing
58302 directory, it is used as a replacement for the default directory. The filename
58303 is then sequentially assigned. If the path does not exist, it is used as
58304 the full path and file name.
58305 </para>
58306 </listitem>
58307 <listitem>
58308 <para>
58309 If the string does not start with a slash, it is used as the
58310 filename, and the default path is then used.
58311 </para>
58312 </listitem>
58313 </orderedlist>
58314 <para>
58315 The <option>decode</option> condition normally succeeds. It is only false for syntax
58316 errors or unusual circumstances such as memory shortages. You can easily decode
58317 a file with its original, proposed filename using
58318 </para>
58319 <literallayout class="monospaced">
58320 decode = $mime_filename
58321 </literallayout>
58322 <para>
58323 However, you should keep in mind that <varname>$mime_filename</varname> might contain
58324 anything. If you place files outside of the default path, they are not
58325 automatically unlinked.
58326 </para>
58327 <para>
58328 For RFC822 attachments (these are messages attached to messages, with a
58329 content-type of <quote>message/rfc822</quote>), the ACL is called again in the same manner
58330 as for the primary message, only that the <varname>$mime_is_rfc822</varname> expansion
58331 variable is set (see below). Attached messages are always decoded to disk
58332 before being checked, and the files are unlinked once the check is done.
58333 </para>
58334 <para>
58335 The MIME ACL supports the <option>regex</option> and <option>mime_regex</option> conditions. These can be
58336 used to match regular expressions against raw and decoded MIME parts,
58337 respectively. They are described in section <xref linkend="SECTscanregex"/>.
58338 </para>
58339 <para>
58340 <indexterm role="concept">
58341 <primary>MIME content scanning</primary>
58342 <secondary>returned variables</secondary>
58343 </indexterm>
58344 The following list describes all expansion variables that are
58345 available in the MIME ACL:
58346 </para>
58347 <variablelist>
58348 <varlistentry>
58349 <term><varname>$mime_boundary</varname></term>
58350 <listitem>
58351 <para>
58352 If the current part is a multipart (see <varname>$mime_is_multipart</varname>) below, it should
58353 have a boundary string, which is stored in this variable. If the current part
58354 has no boundary parameter in the <emphasis>Content-Type:</emphasis> header, this variable
58355 contains the empty string.
58356 </para>
58357 </listitem></varlistentry>
58358 <varlistentry>
58359 <term><varname>$mime_charset</varname></term>
58360 <listitem>
58361 <para>
58362 This variable contains the character set identifier, if one was found in the
58363 <emphasis>Content-Type:</emphasis> header. Examples for charset identifiers are:
58364 </para>
58365 <literallayout class="monospaced">
58366 us-ascii
58367 gb2312 (Chinese)
58368 iso-8859-1
58369 </literallayout>
58370 <para>
58371 Please note that this value is not normalized, so you should do matches
58372 case-insensitively.
58373 </para>
58374 </listitem></varlistentry>
58375 <varlistentry>
58376 <term><varname>$mime_content_description</varname></term>
58377 <listitem>
58378 <para>
58379 This variable contains the normalized content of the <emphasis>Content-Description:</emphasis>
58380 header. It can contain a human-readable description of the parts content. Some
58381 implementations repeat the filename for attachments here, but they are usually
58382 only used for display purposes.
58383 </para>
58384 </listitem></varlistentry>
58385 <varlistentry>
58386 <term><varname>$mime_content_disposition</varname></term>
58387 <listitem>
58388 <para>
58389 This variable contains the normalized content of the <emphasis>Content-Disposition:</emphasis>
58390 header. You can expect strings like <quote>attachment</quote> or <quote>inline</quote> here.
58391 </para>
58392 </listitem></varlistentry>
58393 <varlistentry>
58394 <term><varname>$mime_content_id</varname></term>
58395 <listitem>
58396 <para>
58397 This variable contains the normalized content of the <emphasis>Content-ID:</emphasis> header.
58398 This is a unique ID that can be used to reference a part from another part.
58399 </para>
58400 </listitem></varlistentry>
58401 <varlistentry>
58402 <term><varname>$mime_content_size</varname></term>
58403 <listitem>
58404 <para>
58405 This variable is set only after the <option>decode</option> modifier (see above) has been
58406 successfully run. It contains the size of the decoded part in kilobytes. The
58407 size is always rounded up to full kilobytes, so only a completely empty part
58408 has a <varname>$mime_content_size</varname> of zero.
58409 </para>
58410 </listitem></varlistentry>
58411 <varlistentry>
58412 <term><varname>$mime_content_transfer_encoding</varname></term>
58413 <listitem>
58414 <para>
58415 This variable contains the normalized content of the
58416 <emphasis>Content-transfer-encoding:</emphasis> header. This is a symbolic name for an encoding
58417 type. Typical values are <quote>base64</quote> and <quote>quoted-printable</quote>.
58418 </para>
58419 </listitem></varlistentry>
58420 <varlistentry>
58421 <term><varname>$mime_content_type</varname></term>
58422 <listitem>
58423 <para>
58424 If the MIME part has a <emphasis>Content-Type:</emphasis> header, this variable contains its
58425 value, lowercased, and without any options (like <quote>name</quote> or <quote>charset</quote>). Here
58426 are some examples of popular MIME types, as they may appear in this variable:
58427 </para>
58428 <literallayout class="monospaced">
58429 text/plain
58430 text/html
58431 application/octet-stream
58432 image/jpeg
58433 audio/midi
58434 </literallayout>
58435 <para>
58436 If the MIME part has no <emphasis>Content-Type:</emphasis> header, this variable contains the
58437 empty string.
58438 </para>
58439 </listitem></varlistentry>
58440 <varlistentry>
58441 <term><varname>$mime_decoded_filename</varname></term>
58442 <listitem>
58443 <para>
58444 This variable is set only after the <option>decode</option> modifier (see above) has been
58445 successfully run. It contains the full path and file name of the file
58446 containing the decoded data.
58447 </para>
58448 </listitem></varlistentry>
58449 </variablelist>
58450 <para>
58451 <indexterm role="concept">
58452 <primary>RFC 2047</primary>
58453 </indexterm>
58454 </para>
58455 <variablelist>
58456 <varlistentry>
58457 <term><varname>$mime_filename</varname></term>
58458 <listitem>
58459 <para>
58460 This is perhaps the most important of the MIME variables. It contains a
58461 proposed filename for an attachment, if one was found in either the
58462 <emphasis>Content-Type:</emphasis> or <emphasis>Content-Disposition:</emphasis> headers. The filename will be
58463 RFC2047
58464 </para>
58465 <para revisionflag="changed">
58466 or RFC2231
58467 </para>
58468 <para>
58469 decoded, but no additional sanity checks are done.
58470  If no filename was
58471 found, this variable contains the empty string.
58472 </para>
58473 </listitem></varlistentry>
58474 <varlistentry>
58475 <term><varname>$mime_is_coverletter</varname></term>
58476 <listitem>
58477 <para>
58478 This variable attempts to differentiate the <quote>cover letter</quote> of an e-mail from
58479 attached data. It can be used to clamp down on flashy or unnecessarily encoded
58480 content in the cover letter, while not restricting attachments at all.
58481 </para>
58482 <para>
58483 The variable contains 1 (true) for a MIME part believed to be part of the
58484 cover letter, and 0 (false) for an attachment. At present, the algorithm is as
58485 follows:
58486 </para>
58487 <orderedlist numeration="arabic">
58488 <listitem>
58489 <para>
58490 The outermost MIME part of a message is always a cover letter.
58491 </para>
58492 </listitem>
58493 <listitem>
58494 <para>
58495 If a multipart/alternative or multipart/related MIME part is a cover letter,
58496 so are all MIME subparts within that multipart.
58497 </para>
58498 </listitem>
58499 <listitem>
58500 <para>
58501 If any other multipart is a cover letter, the first subpart is a cover letter,
58502 and the rest are attachments.
58503 </para>
58504 </listitem>
58505 <listitem>
58506 <para>
58507 All parts contained within an attachment multipart are attachments.
58508 </para>
58509 </listitem>
58510 </orderedlist>
58511 <para>
58512 As an example, the following will ban <quote>HTML mail</quote> (including that sent with
58513 alternative plain text), while allowing HTML files to be attached. HTML
58514 coverletter mail attached to non-HMTL coverletter mail will also be allowed:
58515 </para>
58516 <literallayout class="monospaced">
58517 deny message = HTML mail is not accepted here
58518 !condition = $mime_is_rfc822
58519 condition = $mime_is_coverletter
58520 condition = ${if eq{$mime_content_type}{text/html}{1}{0}}
58521 </literallayout>
58522 </listitem></varlistentry>
58523 <varlistentry>
58524 <term><varname>$mime_is_multipart</varname></term>
58525 <listitem>
58526 <para>
58527 This variable has the value 1 (true) when the current part has the main type
58528 <quote>multipart</quote>, for example <quote>multipart/alternative</quote> or <quote>multipart/mixed</quote>.
58529 Since multipart entities only serve as containers for other parts, you may not
58530 want to carry out specific actions on them.
58531 </para>
58532 </listitem></varlistentry>
58533 <varlistentry>
58534 <term><varname>$mime_is_rfc822</varname></term>
58535 <listitem>
58536 <para>
58537 This variable has the value 1 (true) if the current part is not a part of the
58538 checked message itself, but part of an attached message. Attached message
58539 decoding is fully recursive.
58540 </para>
58541 </listitem></varlistentry>
58542 <varlistentry>
58543 <term><varname>$mime_part_count</varname></term>
58544 <listitem>
58545 <para>
58546 This variable is a counter that is raised for each processed MIME part. It
58547 starts at zero for the very first part (which is usually a multipart). The
58548 counter is per-message, so it is reset when processing RFC822 attachments (see
58549 <varname>$mime_is_rfc822</varname>). The counter stays set after <option>acl_smtp_mime</option> is
58550 complete, so you can use it in the DATA ACL to determine the number of MIME
58551 parts of a message. For non-MIME messages, this variable contains the value -1.
58552 </para>
58553 </listitem></varlistentry>
58554 </variablelist>
58555 </section>
58556 <section id="SECTscanregex">
58557 <title>Scanning with regular expressions</title>
58558 <para>
58559 <indexterm role="concept">
58560 <primary>content scanning</primary>
58561 <secondary>with regular expressions</secondary>
58562 </indexterm>
58563 <indexterm role="concept">
58564 <primary>regular expressions</primary>
58565 <secondary>content scanning with</secondary>
58566 </indexterm>
58567 You can specify your own custom regular expression matches on the full body of
58568 the message, or on individual MIME parts.
58569 </para>
58570 <para>
58571 The <option>regex</option> condition takes one or more regular expressions as arguments and
58572 matches them against the full message (when called in the DATA ACL) or a raw
58573 MIME part (when called in the MIME ACL). The <option>regex</option> condition matches
58574 linewise, with a maximum line length of 32K characters. That means you cannot
58575 have multiline matches with the <option>regex</option> condition.
58576 </para>
58577 <para>
58578 The <option>mime_regex</option> condition can be called only in the MIME ACL. It matches up
58579 to 32K of decoded content (the whole content at once, not linewise). If the
58580 part has not been decoded with the <option>decode</option> modifier earlier in the ACL, it
58581 is decoded automatically when <option>mime_regex</option> is executed (using default path
58582 and filename values). If the decoded data is larger than  32K, only the first
58583 32K characters are checked.
58584 </para>
58585 <para>
58586 The regular expressions are passed as a colon-separated list. To include a
58587 literal colon, you must double it. Since the whole right-hand side string is
58588 expanded before being used, you must also escape dollar signs and backslashes
58589 with more backslashes, or use the <literal>\N</literal> facility to disable expansion.
58590 Here is a simple example that contains two regular expressions:
58591 </para>
58592 <literallayout class="monospaced">
58593 deny message = contains blacklisted regex ($regex_match_string)
58594      regex = [Mm]ortgage : URGENT BUSINESS PROPOSAL
58595 </literallayout>
58596 <para>
58597 The conditions returns true if any one of the regular expressions matches. The
58598 <varname>$regex_match_string</varname> expansion variable is then set up and contains the
58599 matching regular expression.
58600 </para>
58601 <para>
58602 <emphasis role="bold">Warning</emphasis>: With large messages, these conditions can be fairly
58603 CPU-intensive.
58604 </para>
58605 </section>
58606 <section id="SECTdemimecond">
58607 <title>The demime condition</title>
58608 <para>
58609 <indexterm role="concept">
58610 <primary>content scanning</primary>
58611 <secondary>MIME checking</secondary>
58612 </indexterm>
58613 <indexterm role="concept">
58614 <primary>MIME content scanning</primary>
58615 </indexterm>
58616 The <option>demime</option> ACL condition provides MIME unpacking, sanity checking and file
58617 extension blocking. It is usable only in the DATA and non-SMTP ACLs. The
58618 <option>demime</option> condition uses a simpler interface to MIME decoding than the MIME
58619 ACL functionality, but provides no additional facilities. Please note that this
58620 condition is deprecated and kept only for backward compatibility. You must set
58621 the WITH_OLD_DEMIME option in <filename>Local/Makefile</filename> at build time to be able to
58622 use the <option>demime</option> condition.
58623 </para>
58624 <para>
58625 The <option>demime</option> condition unpacks MIME containers in the message. It detects
58626 errors in MIME containers and can match file extensions found in the message
58627 against a list. Using this facility produces files containing the unpacked MIME
58628 parts of the message in the temporary scan directory. If you do antivirus
58629 scanning, it is recommended that you use the <option>demime</option> condition before the
58630 antivirus (<option>malware</option>) condition.
58631 </para>
58632 <para>
58633 On the right-hand side of the <option>demime</option> condition you can pass a
58634 colon-separated list of file extensions that it should match against. For
58635 example:
58636 </para>
58637 <literallayout class="monospaced">
58638 deny message = Found blacklisted file attachment
58639      demime  = vbs:com:bat:pif:prf:lnk
58640 </literallayout>
58641 <para>
58642 If one of the file extensions is found, the condition is true, otherwise it is
58643 false. If there is a temporary error while demimeing (for example, <quote>disk
58644 full</quote>), the condition defers, and the message is temporarily rejected (unless
58645 the condition is on a <option>warn</option> verb).
58646 </para>
58647 <para>
58648 The right-hand side is expanded before being treated as a list, so you can have
58649 conditions and lookups there. If it expands to an empty string, <quote>false</quote>, or
58650 zero (<quote>0</quote>), no demimeing is done and the condition is false.
58651 </para>
58652 <para>
58653 The <option>demime</option> condition set the following variables:
58654 </para>
58655 <variablelist>
58656 <varlistentry>
58657 <term><varname>$demime_errorlevel</varname></term>
58658 <listitem>
58659 <para>
58660 <indexterm role="variable">
58661 <primary><varname>$demime_errorlevel</varname></primary>
58662 </indexterm>
58663 When an error is detected in a MIME container, this variable contains the
58664 severity of the error, as an integer number. The higher the value, the more
58665 severe the error (the current maximum value is 3). If this variable is unset or
58666 zero, no error occurred.
58667 </para>
58668 </listitem></varlistentry>
58669 <varlistentry>
58670 <term><varname>$demime_reason</varname></term>
58671 <listitem>
58672 <para>
58673 <indexterm role="variable">
58674 <primary><varname>$demime_reason</varname></primary>
58675 </indexterm>
58676 When <varname>$demime_errorlevel</varname> is greater than zero, this variable contains a
58677 human-readable text string describing the MIME error that occurred.
58678 </para>
58679 </listitem></varlistentry>
58680 </variablelist>
58681 <variablelist>
58682 <varlistentry>
58683 <term><varname>$found_extension</varname></term>
58684 <listitem>
58685 <para>
58686 <indexterm role="variable">
58687 <primary><varname>$found_extension</varname></primary>
58688 </indexterm>
58689 When the <option>demime</option> condition is true, this variable contains the file
58690 extension it found.
58691 </para>
58692 </listitem></varlistentry>
58693 </variablelist>
58694 <para>
58695 Both <varname>$demime_errorlevel</varname> and <varname>$demime_reason</varname> are set by the first call of
58696 the <option>demime</option> condition, and are not changed on subsequent calls.
58697 </para>
58698 <para>
58699 If you do not want to check for file extensions, but rather use the <option>demime</option>
58700 condition for unpacking or error checking purposes, pass <quote>*</quote> as the
58701 right-hand side value. Here is a more elaborate example of how to use this
58702 facility:
58703 </para>
58704 <literallayout class="monospaced">
58705 # Reject messages with serious MIME container errors
58706 deny  message = Found MIME error ($demime_reason).
58707       demime = *
58708       condition = ${if &gt;{$demime_errorlevel}{2}{1}{0}}
58709
58710 # Reject known virus spreading file extensions.
58711 # Accepting these is pretty much braindead.
58712 deny  message = contains $found_extension file (blacklisted).
58713       demime  = com:vbs:bat:pif:scr
58714
58715 # Freeze .exe and .doc files. Postmaster can
58716 # examine them and eventually thaw them.
58717 deny  log_message = Another $found_extension file.
58718       demime = exe:doc
58719       control = freeze
58720 </literallayout>
58721 <para>
58722 <indexterm role="concept" startref="IIDcosca" class="endofrange"/>
58723 </para>
58724 </section>
58725 </chapter>
58726
58727 <chapter id="CHAPlocalscan">
58728 <title>Adding a local scan function to Exim</title>
58729 <titleabbrev>Local scan function</titleabbrev>
58730 <para>
58731 <indexterm role="concept" id="IIDlosca" class="startofrange">
58732 <primary><function>local_scan()</function> function</primary>
58733 <secondary>description of</secondary>
58734 </indexterm>
58735 <indexterm role="concept">
58736 <primary>customizing</primary>
58737 <secondary>input scan using C function</secondary>
58738 </indexterm>
58739 <indexterm role="concept">
58740 <primary>policy control</primary>
58741 <secondary>by local scan function</secondary>
58742 </indexterm>
58743 In these days of email worms, viruses, and ever-increasing spam, some sites
58744 want to apply a lot of checking to messages before accepting them.
58745 </para>
58746 <para>
58747 The content scanning extension (chapter <xref linkend="CHAPexiscan"/>) has facilities for
58748 passing messages to external virus and spam scanning software. You can also do
58749 a certain amount in Exim itself through string expansions and the <option>condition</option>
58750 condition in the ACL that runs after the SMTP DATA command or the ACL for
58751 non-SMTP messages (see chapter <xref linkend="CHAPACL"/>), but this has its limitations.
58752 </para>
58753 <para>
58754 To allow for further customization to a site&#x2019;s own requirements, there is the
58755 possibility of linking Exim with a private message scanning function, written
58756 in C. If you want to run code that is written in something other than C, you
58757 can of course use a little C stub to call it.
58758 </para>
58759 <para>
58760 The local scan function is run once for every incoming message, at the point
58761 when Exim is just about to accept the message.
58762 It can therefore be used to control non-SMTP messages from local processes as
58763 well as messages arriving via SMTP.
58764 </para>
58765 <para>
58766 Exim applies a timeout to calls of the local scan function, and there is an
58767 option called <option>local_scan_timeout</option> for setting it. The default is 5 minutes.
58768 Zero means <quote>no timeout</quote>.
58769 Exim also sets up signal handlers for SIGSEGV, SIGILL, SIGFPE, and SIGBUS
58770 before calling the local scan function, so that the most common types of crash
58771 are caught. If the timeout is exceeded or one of those signals is caught, the
58772 incoming message is rejected with a temporary error if it is an SMTP message.
58773 For a non-SMTP message, the message is dropped and Exim ends with a non-zero
58774 code. The incident is logged on the main and reject logs.
58775 </para>
58776 <section id="SECID207">
58777 <title>Building Exim to use a local scan function</title>
58778 <para>
58779 <indexterm role="concept">
58780 <primary><function>local_scan()</function> function</primary>
58781 <secondary>building Exim to use</secondary>
58782 </indexterm>
58783 To make use of the local scan function feature, you must tell Exim where your
58784 function is before building Exim, by setting LOCAL_SCAN_SOURCE in your
58785 <filename>Local/Makefile</filename>. A recommended place to put it is in the <filename>Local</filename>
58786 directory, so you might set
58787 </para>
58788 <literallayout class="monospaced">
58789 LOCAL_SCAN_SOURCE=Local/local_scan.c
58790 </literallayout>
58791 <para>
58792 for example. The function must be called <function>local_scan()</function>. It is called by
58793 Exim after it has received a message, when the success return code is about to
58794 be sent. This is after all the ACLs have been run. The return code from your
58795 function controls whether the message is actually accepted or not. There is a
58796 commented template function (that just accepts the message) in the file
58797 _src/local_scan.c_.
58798 </para>
58799 <para>
58800 If you want to make use of Exim&#x2019;s run time configuration file to set options
58801 for your <function>local_scan()</function> function, you must also set
58802 </para>
58803 <literallayout class="monospaced">
58804 LOCAL_SCAN_HAS_OPTIONS=yes
58805 </literallayout>
58806 <para>
58807 in <filename>Local/Makefile</filename> (see section <xref linkend="SECTconoptloc"/> below).
58808 </para>
58809 </section>
58810 <section id="SECTapiforloc">
58811 <title>API for local_scan()</title>
58812 <para>
58813 <indexterm role="concept">
58814 <primary><function>local_scan()</function> function</primary>
58815 <secondary>API description</secondary>
58816 </indexterm>
58817 You must include this line near the start of your code:
58818 </para>
58819 <literallayout class="monospaced">
58820 #include "local_scan.h"
58821 </literallayout>
58822 <para>
58823 This header file defines a number of variables and other values, and the
58824 prototype for the function itself. Exim is coded to use unsigned char values
58825 almost exclusively, and one of the things this header defines is a shorthand
58826 for <literal>unsigned char</literal> called <literal>uschar</literal>.
58827 It also contains the following macro definitions, to simplify casting character
58828 strings and pointers to character strings:
58829 </para>
58830 <literallayout class="monospaced">
58831 #define CS   (char *)
58832 #define CCS  (const char *)
58833 #define CSS  (char **)
58834 #define US   (unsigned char *)
58835 #define CUS  (const unsigned char *)
58836 #define USS  (unsigned char **)
58837 </literallayout>
58838 <para>
58839 The function prototype for <function>local_scan()</function> is:
58840 </para>
58841 <literallayout class="monospaced">
58842 extern int local_scan(int fd, uschar **return_text);
58843 </literallayout>
58844 <para>
58845 The arguments are as follows:
58846 </para>
58847 <itemizedlist>
58848 <listitem>
58849 <para>
58850 <option>fd</option> is a file descriptor for the file that contains the body of the message
58851 (the -D file). The file is open for reading and writing, but updating it is not
58852 recommended. <emphasis role="bold">Warning</emphasis>: You must <emphasis>not</emphasis> close this file descriptor.
58853 </para>
58854 <para>
58855 The descriptor is positioned at character 19 of the file, which is the first
58856 character of the body itself, because the first 19 characters are the message
58857 id followed by <literal>-D</literal> and a newline. If you rewind the file, you should use the
58858 macro SPOOL_DATA_START_OFFSET to reset to the start of the data, just in
58859 case this changes in some future version.
58860 </para>
58861 </listitem>
58862 <listitem>
58863 <para>
58864 <option>return_text</option> is an address which you can use to return a pointer to a text
58865 string at the end of the function. The value it points to on entry is NULL.
58866 </para>
58867 </listitem>
58868 </itemizedlist>
58869 <para>
58870 The function must return an <option>int</option> value which is one of the following macros:
58871 </para>
58872 <variablelist>
58873 <varlistentry>
58874 <term><literal>LOCAL_SCAN_ACCEPT</literal></term>
58875 <listitem>
58876 <para>
58877 <indexterm role="variable">
58878 <primary><varname>$local_scan_data</varname></primary>
58879 </indexterm>
58880 The message is accepted. If you pass back a string of text, it is saved with
58881 the message, and made available in the variable <varname>$local_scan_data</varname>. No
58882 newlines are permitted (if there are any, they are turned into spaces) and the
58883 maximum length of text is 1000 characters.
58884 </para>
58885 </listitem></varlistentry>
58886 <varlistentry>
58887 <term><literal>LOCAL_SCAN_ACCEPT_FREEZE</literal></term>
58888 <listitem>
58889 <para>
58890 This behaves as LOCAL_SCAN_ACCEPT, except that the accepted message is
58891 queued without immediate delivery, and is frozen.
58892 </para>
58893 </listitem></varlistentry>
58894 <varlistentry>
58895 <term><literal>LOCAL_SCAN_ACCEPT_QUEUE</literal></term>
58896 <listitem>
58897 <para>
58898 This behaves as LOCAL_SCAN_ACCEPT, except that the accepted message is
58899 queued without immediate delivery.
58900 </para>
58901 </listitem></varlistentry>
58902 <varlistentry>
58903 <term><literal>LOCAL_SCAN_REJECT</literal></term>
58904 <listitem>
58905 <para>
58906 The message is rejected; the returned text is used as an error message which is
58907 passed back to the sender and which is also logged. Newlines are permitted &ndash;
58908 they cause a multiline response for SMTP rejections, but are converted to
58909 <literal>\n</literal> in log lines. If no message is given, <quote>Administrative prohibition</quote> is
58910 used.
58911 </para>
58912 </listitem></varlistentry>
58913 <varlistentry>
58914 <term><literal>LOCAL_SCAN_TEMPREJECT</literal></term>
58915 <listitem>
58916 <para>
58917 The message is temporarily rejected; the returned text is used as an error
58918 message as for LOCAL_SCAN_REJECT. If no message is given, <quote>Temporary local
58919 problem</quote> is used.
58920 </para>
58921 </listitem></varlistentry>
58922 <varlistentry>
58923 <term><literal>LOCAL_SCAN_REJECT_NOLOGHDR</literal></term>
58924 <listitem>
58925 <para>
58926 This behaves as LOCAL_SCAN_REJECT, except that the header of the rejected
58927 message is not written to the reject log. It has the effect of unsetting the
58928 <option>rejected_header</option> log selector for just this rejection. If
58929 <option>rejected_header</option> is already unset (see the discussion of the
58930 <option>log_selection</option> option in section <xref linkend="SECTlogselector"/>), this code is the
58931 same as LOCAL_SCAN_REJECT.
58932 </para>
58933 </listitem></varlistentry>
58934 <varlistentry>
58935 <term><literal>LOCAL_SCAN_TEMPREJECT_NOLOGHDR</literal></term>
58936 <listitem>
58937 <para>
58938 This code is a variation of LOCAL_SCAN_TEMPREJECT in the same way that
58939 LOCAL_SCAN_REJECT_NOLOGHDR is a variation of LOCAL_SCAN_REJECT.
58940 </para>
58941 </listitem></varlistentry>
58942 </variablelist>
58943 <para>
58944 If the message is not being received by interactive SMTP, rejections are
58945 reported by writing to <option>stderr</option> or by sending an email, as configured by the
58946 <option>-oe</option> command line options.
58947 </para>
58948 </section>
58949 <section id="SECTconoptloc">
58950 <title>Configuration options for local_scan()</title>
58951 <para>
58952 <indexterm role="concept">
58953 <primary><function>local_scan()</function> function</primary>
58954 <secondary>configuration options</secondary>
58955 </indexterm>
58956 It is possible to have option settings in the main configuration file
58957 that set values in static variables in the <function>local_scan()</function> module. If you
58958 want to do this, you must have the line
58959 </para>
58960 <literallayout class="monospaced">
58961 LOCAL_SCAN_HAS_OPTIONS=yes
58962 </literallayout>
58963 <para>
58964 in your <filename>Local/Makefile</filename> when you build Exim. (This line is in
58965 <filename>OS/Makefile-Default</filename>, commented out). Then, in the <function>local_scan()</function> source
58966 file, you must define static variables to hold the option values, and a table
58967 to define them.
58968 </para>
58969 <para>
58970 The table must be a vector called <option>local_scan_options</option>, of type
58971 <literal>optionlist</literal>. Each entry is a triplet, consisting of a name, an option type,
58972 and a pointer to the variable that holds the value. The entries must appear in
58973 alphabetical order. Following <option>local_scan_options</option> you must also define a
58974 variable called <option>local_scan_options_count</option> that contains the number of
58975 entries in the table. Here is a short example, showing two kinds of option:
58976 </para>
58977 <literallayout class="monospaced">
58978 static int my_integer_option = 42;
58979 static uschar *my_string_option = US"a default string";
58980
58981 optionlist local_scan_options[] = {
58982   { "my_integer", opt_int,       &amp;my_integer_option },
58983   { "my_string",  opt_stringptr, &amp;my_string_option }
58984 };
58985
58986 int local_scan_options_count =
58987   sizeof(local_scan_options)/sizeof(optionlist);
58988 </literallayout>
58989 <para>
58990 The values of the variables can now be changed from Exim&#x2019;s runtime
58991 configuration file by including a local scan section as in this example:
58992 </para>
58993 <literallayout class="monospaced">
58994 begin local_scan
58995 my_integer = 99
58996 my_string = some string of text...
58997 </literallayout>
58998 <para>
58999 The available types of option data are as follows:
59000 </para>
59001 <variablelist>
59002 <varlistentry>
59003 <term><emphasis role="bold">opt_bool</emphasis></term>
59004 <listitem>
59005 <para>
59006 This specifies a boolean (true/false) option. The address should point to a
59007 variable of type <literal>BOOL</literal>, which will be set to TRUE or FALSE, which are macros
59008 that are defined as <quote>1</quote> and <quote>0</quote>, respectively. If you want to detect
59009 whether such a variable has been set at all, you can initialize it to
59010 TRUE_UNSET. (BOOL variables are integers underneath, so can hold more than two
59011 values.)
59012 </para>
59013 </listitem></varlistentry>
59014 <varlistentry>
59015 <term><emphasis role="bold">opt_fixed</emphasis></term>
59016 <listitem>
59017 <para>
59018 This specifies a fixed point number, such as is used for load averages.
59019 The address should point to a variable of type <literal>int</literal>. The value is stored
59020 multiplied by 1000, so, for example, 1.4142 is truncated and stored as 1414.
59021 </para>
59022 </listitem></varlistentry>
59023 <varlistentry>
59024 <term><emphasis role="bold">opt_int</emphasis></term>
59025 <listitem>
59026 <para>
59027 This specifies an integer; the address should point to a variable of type
59028 <literal>int</literal>. The value may be specified in any of the integer formats accepted by
59029 Exim.
59030 </para>
59031 </listitem></varlistentry>
59032 <varlistentry>
59033 <term><emphasis role="bold">opt_mkint</emphasis></term>
59034 <listitem>
59035 <para>
59036 This is the same as <option>opt_int</option>, except that when such a value is output in a
59037 <option>-bP</option> listing, if it is an exact number of kilobytes or megabytes, it is
59038 printed with the suffix K or M.
59039 </para>
59040 </listitem></varlistentry>
59041 <varlistentry>
59042 <term><emphasis role="bold">opt_octint</emphasis></term>
59043 <listitem>
59044 <para>
59045 This also specifies an integer, but the value is always interpreted as an
59046 octal integer, whether or not it starts with the digit zero, and it is
59047 always output in octal.
59048 </para>
59049 </listitem></varlistentry>
59050 <varlistentry>
59051 <term><emphasis role="bold">opt_stringptr</emphasis></term>
59052 <listitem>
59053 <para>
59054 This specifies a string value; the address must be a pointer to a
59055 variable that points to a string (for example, of type <literal>uschar *</literal>).
59056 </para>
59057 </listitem></varlistentry>
59058 <varlistentry>
59059 <term><emphasis role="bold">opt_time</emphasis></term>
59060 <listitem>
59061 <para>
59062 This specifies a time interval value. The address must point to a variable of
59063 type <literal>int</literal>. The value that is placed there is a number of seconds.
59064 </para>
59065 </listitem></varlistentry>
59066 </variablelist>
59067 <para>
59068 If the <option>-bP</option> command line option is followed by <literal>local_scan</literal>, Exim prints
59069 out the values of all the <function>local_scan()</function> options.
59070 </para>
59071 </section>
59072 <section id="SECID208">
59073 <title>Available Exim variables</title>
59074 <para>
59075 <indexterm role="concept">
59076 <primary><function>local_scan()</function> function</primary>
59077 <secondary>available Exim variables</secondary>
59078 </indexterm>
59079 The header <filename>local_scan.h</filename> gives you access to a number of C variables. These
59080 are the only ones that are guaranteed to be maintained from release to release.
59081 Note, however, that you can obtain the value of any Exim expansion variable,
59082 including <varname>$recipients</varname>, by calling <emphasis>expand_string()</emphasis>. The exported
59083 C variables are as follows:
59084 </para>
59085 <variablelist>
59086 <varlistentry>
59087 <term><emphasis role="bold">int&nbsp;body_linecount</emphasis></term>
59088 <listitem>
59089 <para>
59090 This variable contains the number of lines in the message&#x2019;s body.
59091 </para>
59092 </listitem></varlistentry>
59093 <varlistentry>
59094 <term><emphasis role="bold">int&nbsp;body_zerocount</emphasis></term>
59095 <listitem>
59096 <para>
59097 This variable contains the number of binary zero bytes in the message&#x2019;s body.
59098 </para>
59099 </listitem></varlistentry>
59100 <varlistentry>
59101 <term><emphasis role="bold">unsigned&nbsp;int&nbsp;debug_selector</emphasis></term>
59102 <listitem>
59103 <para>
59104 This variable is set to zero when no debugging is taking place. Otherwise, it
59105 is a bitmap of debugging selectors. Two bits are identified for use in
59106 <function>local_scan()</function>; they are defined as macros:
59107 </para>
59108 <itemizedlist>
59109 <listitem>
59110 <para>
59111 The <literal>D_v</literal> bit is set when <option>-v</option> was present on the command line. This is a
59112 testing option that is not privileged &ndash; any caller may set it. All the
59113 other selector bits can be set only by admin users.
59114 </para>
59115 </listitem>
59116 <listitem>
59117 <para>
59118 The <literal>D_local_scan</literal> bit is provided for use by <function>local_scan()</function>; it is set
59119 by the <literal>+local_scan</literal> debug selector. It is not included in the default set
59120 of debugging bits.
59121 </para>
59122 </listitem>
59123 </itemizedlist>
59124 <para>
59125 Thus, to write to the debugging output only when <literal>+local_scan</literal> has been
59126 selected, you should use code like this:
59127 </para>
59128 <literallayout class="monospaced">
59129 if ((debug_selector &amp; D_local_scan) != 0)
59130   debug_printf("xxx", ...);
59131 </literallayout>
59132 </listitem></varlistentry>
59133 <varlistentry>
59134 <term><emphasis role="bold">uschar&nbsp;*expand_string_message</emphasis></term>
59135 <listitem>
59136 <para>
59137 After a failing call to <emphasis>expand_string()</emphasis> (returned value NULL), the
59138 variable <option>expand_string_message</option> contains the error message, zero-terminated.
59139 </para>
59140 </listitem></varlistentry>
59141 <varlistentry>
59142 <term><emphasis role="bold">header_line&nbsp;*header_list</emphasis></term>
59143 <listitem>
59144 <para>
59145 A pointer to a chain of header lines. The <option>header_line</option> structure is
59146 discussed below.
59147 </para>
59148 </listitem></varlistentry>
59149 <varlistentry>
59150 <term><emphasis role="bold">header_line&nbsp;*header_last</emphasis></term>
59151 <listitem>
59152 <para>
59153 A pointer to the last of the header lines.
59154 </para>
59155 </listitem></varlistentry>
59156 <varlistentry>
59157 <term><emphasis role="bold">uschar&nbsp;*headers_charset</emphasis></term>
59158 <listitem>
59159 <para>
59160 The value of the <option>headers_charset</option> configuration option.
59161 </para>
59162 </listitem></varlistentry>
59163 <varlistentry>
59164 <term><emphasis role="bold">BOOL&nbsp;host_checking</emphasis></term>
59165 <listitem>
59166 <para>
59167 This variable is TRUE during a host checking session that is initiated by the
59168 <option>-bh</option> command line option.
59169 </para>
59170 </listitem></varlistentry>
59171 <varlistentry>
59172 <term><emphasis role="bold">uschar&nbsp;*interface_address</emphasis></term>
59173 <listitem>
59174 <para>
59175 The IP address of the interface that received the message, as a string. This
59176 is NULL for locally submitted messages.
59177 </para>
59178 </listitem></varlistentry>
59179 <varlistentry>
59180 <term><emphasis role="bold">int&nbsp;interface_port</emphasis></term>
59181 <listitem>
59182 <para>
59183 The port on which this message was received. When testing with the <option>-bh</option>
59184 command line option, the value of this variable is -1 unless a port has been
59185 specified via the <option>-oMi</option> option.
59186 </para>
59187 </listitem></varlistentry>
59188 <varlistentry>
59189 <term><emphasis role="bold">uschar&nbsp;*message_id</emphasis></term>
59190 <listitem>
59191 <para>
59192 This variable contains Exim&#x2019;s message id for the incoming message (the value of
59193 <varname>$message_exim_id</varname>) as a zero-terminated string.
59194 </para>
59195 </listitem></varlistentry>
59196 <varlistentry>
59197 <term><emphasis role="bold">uschar&nbsp;*received_protocol</emphasis></term>
59198 <listitem>
59199 <para>
59200 The name of the protocol by which the message was received.
59201 </para>
59202 </listitem></varlistentry>
59203 <varlistentry>
59204 <term><emphasis role="bold">int&nbsp;recipients_count</emphasis></term>
59205 <listitem>
59206 <para>
59207 The number of accepted recipients.
59208 </para>
59209 </listitem></varlistentry>
59210 <varlistentry>
59211 <term><emphasis role="bold">recipient_item&nbsp;*recipients_list</emphasis></term>
59212 <listitem>
59213 <para>
59214 <indexterm role="concept">
59215 <primary>recipient</primary>
59216 <secondary>adding in local scan</secondary>
59217 </indexterm>
59218 <indexterm role="concept">
59219 <primary>recipient</primary>
59220 <secondary>removing in local scan</secondary>
59221 </indexterm>
59222 The list of accepted recipients, held in a vector of length
59223 <option>recipients_count</option>. The <option>recipient_item</option> structure is discussed below. You
59224 can add additional recipients by calling <emphasis>receive_add_recipient()</emphasis> (see
59225 below). You can delete recipients by removing them from the vector and
59226 adjusting the value in <option>recipients_count</option>. In particular, by setting
59227 <option>recipients_count</option> to zero you remove all recipients. If you then return the
59228 value <literal>LOCAL_SCAN_ACCEPT</literal>, the message is accepted, but immediately
59229 blackholed. To replace the recipients, you can set <option>recipients_count</option> to zero
59230 and then call <emphasis>receive_add_recipient()</emphasis> as often as needed.
59231 </para>
59232 </listitem></varlistentry>
59233 <varlistentry>
59234 <term><emphasis role="bold">uschar&nbsp;*sender_address</emphasis></term>
59235 <listitem>
59236 <para>
59237 The envelope sender address. For bounce messages this is the empty string.
59238 </para>
59239 </listitem></varlistentry>
59240 <varlistentry>
59241 <term><emphasis role="bold">uschar&nbsp;*sender_host_address</emphasis></term>
59242 <listitem>
59243 <para>
59244 The IP address of the sending host, as a string. This is NULL for
59245 locally-submitted messages.
59246 </para>
59247 </listitem></varlistentry>
59248 <varlistentry>
59249 <term><emphasis role="bold">uschar&nbsp;*sender_host_authenticated</emphasis></term>
59250 <listitem>
59251 <para>
59252 The name of the authentication mechanism that was used, or NULL if the message
59253 was not received over an authenticated SMTP connection.
59254 </para>
59255 </listitem></varlistentry>
59256 <varlistentry>
59257 <term><emphasis role="bold">uschar&nbsp;*sender_host_name</emphasis></term>
59258 <listitem>
59259 <para>
59260 The name of the sending host, if known.
59261 </para>
59262 </listitem></varlistentry>
59263 <varlistentry>
59264 <term><emphasis role="bold">int&nbsp;sender_host_port</emphasis></term>
59265 <listitem>
59266 <para>
59267 The port on the sending host.
59268 </para>
59269 </listitem></varlistentry>
59270 <varlistentry>
59271 <term><emphasis role="bold">BOOL&nbsp;smtp_input</emphasis></term>
59272 <listitem>
59273 <para>
59274 This variable is TRUE for all SMTP input, including BSMTP.
59275 </para>
59276 </listitem></varlistentry>
59277 <varlistentry>
59278 <term><emphasis role="bold">BOOL&nbsp;smtp_batched_input</emphasis></term>
59279 <listitem>
59280 <para>
59281 This variable is TRUE for BSMTP input.
59282 </para>
59283 </listitem></varlistentry>
59284 <varlistentry>
59285 <term><emphasis role="bold">int&nbsp;store_pool</emphasis></term>
59286 <listitem>
59287 <para>
59288 The contents of this variable control which pool of memory is used for new
59289 requests. See section <xref linkend="SECTmemhanloc"/> for details.
59290 </para>
59291 </listitem></varlistentry>
59292 </variablelist>
59293 </section>
59294 <section id="SECID209">
59295 <title>Structure of header lines</title>
59296 <para>
59297 The <option>header_line</option> structure contains the members listed below.
59298 You can add additional header lines by calling the <emphasis>header_add()</emphasis> function
59299 (see below). You can cause header lines to be ignored (deleted) by setting
59300 their type to *.
59301 </para>
59302 <variablelist>
59303 <varlistentry>
59304 <term><emphasis role="bold">struct&nbsp;header_line&nbsp;*next</emphasis></term>
59305 <listitem>
59306 <para>
59307 A pointer to the next header line, or NULL for the last line.
59308 </para>
59309 </listitem></varlistentry>
59310 <varlistentry>
59311 <term><emphasis role="bold">int&nbsp;type</emphasis></term>
59312 <listitem>
59313 <para>
59314 A code identifying certain headers that Exim recognizes. The codes are printing
59315 characters, and are documented in chapter <xref linkend="CHAPspool"/> of this manual.
59316 Notice in particular that any header line whose type is * is not transmitted
59317 with the message. This flagging is used for header lines that have been
59318 rewritten, or are to be removed (for example, <emphasis>Envelope-sender:</emphasis> header
59319 lines.) Effectively, * means <quote>deleted</quote>.
59320 </para>
59321 </listitem></varlistentry>
59322 <varlistentry>
59323 <term><emphasis role="bold">int&nbsp;slen</emphasis></term>
59324 <listitem>
59325 <para>
59326 The number of characters in the header line, including the terminating and any
59327 internal newlines.
59328 </para>
59329 </listitem></varlistentry>
59330 <varlistentry>
59331 <term><emphasis role="bold">uschar&nbsp;*text</emphasis></term>
59332 <listitem>
59333 <para>
59334 A pointer to the text of the header. It always ends with a newline, followed by
59335 a zero byte. Internal newlines are preserved.
59336 </para>
59337 </listitem></varlistentry>
59338 </variablelist>
59339 </section>
59340 <section id="SECID210">
59341 <title>Structure of recipient items</title>
59342 <para>
59343 The <option>recipient_item</option> structure contains these members:
59344 </para>
59345 <variablelist>
59346 <varlistentry>
59347 <term><emphasis role="bold">uschar&nbsp;*address</emphasis></term>
59348 <listitem>
59349 <para>
59350 This is a pointer to the recipient address as it was received.
59351 </para>
59352 </listitem></varlistentry>
59353 <varlistentry>
59354 <term><emphasis role="bold">int&nbsp;pno</emphasis></term>
59355 <listitem>
59356 <para>
59357 This is used in later Exim processing when top level addresses are created by
59358 the <option>one_time</option> option. It is not relevant at the time <function>local_scan()</function> is run
59359 and must always contain -1 at this stage.
59360 </para>
59361 </listitem></varlistentry>
59362 <varlistentry>
59363 <term><emphasis role="bold">uschar&nbsp;*errors_to</emphasis></term>
59364 <listitem>
59365 <para>
59366 If this value is not NULL, bounce messages caused by failing to deliver to the
59367 recipient are sent to the address it contains. In other words, it overrides the
59368 envelope sender for this one recipient. (Compare the <option>errors_to</option> generic
59369 router option.) If a <function>local_scan()</function> function sets an <option>errors_to</option> field to
59370 an unqualified address, Exim qualifies it using the domain from
59371 <option>qualify_recipient</option>. When <function>local_scan()</function> is called, the <option>errors_to</option> field
59372 is NULL for all recipients.
59373 </para>
59374 </listitem></varlistentry>
59375 </variablelist>
59376 </section>
59377 <section id="SECID211">
59378 <title>Available Exim functions</title>
59379 <para>
59380 <indexterm role="concept">
59381 <primary><function>local_scan()</function> function</primary>
59382 <secondary>available Exim functions</secondary>
59383 </indexterm>
59384 The header <filename>local_scan.h</filename> gives you access to a number of Exim functions.
59385 These are the only ones that are guaranteed to be maintained from release to
59386 release:
59387 </para>
59388 <variablelist>
59389 <varlistentry>
59390 <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>
59391 <listitem>
59392 <para>
59393 This function creates a child process that runs the command specified by
59394 <option>argv</option>. The environment for the process is specified by <option>envp</option>, which can
59395 be NULL if no environment variables are to be passed. A new umask is supplied
59396 for the process in <option>newumask</option>.
59397 </para>
59398 <para>
59399 Pipes to the standard input and output of the new process are set up
59400 and returned to the caller via the <option>infdptr</option> and <option>outfdptr</option> arguments. The
59401 standard error is cloned to the standard output. If there are any file
59402 descriptors <quote>in the way</quote> in the new process, they are closed. If the final
59403 argument is TRUE, the new process is made into a process group leader.
59404 </para>
59405 <para>
59406 The function returns the pid of the new process, or -1 if things go wrong.
59407 </para>
59408 </listitem></varlistentry>
59409 <varlistentry>
59410 <term><emphasis role="bold">int&nbsp;child_close(pid_t&nbsp;pid,&nbsp;int&nbsp;timeout)</emphasis></term>
59411 <listitem>
59412 <para>
59413 This function waits for a child process to terminate, or for a timeout (in
59414 seconds) to expire. A timeout value of zero means wait as long as it takes. The
59415 return value is as follows:
59416 </para>
59417 <itemizedlist>
59418 <listitem>
59419 <para>
59420 &gt;= 0
59421 </para>
59422 <para>
59423 The process terminated by a normal exit and the value is the process
59424 ending status.
59425 </para>
59426 </listitem>
59427 <listitem>
59428 <para>
59429 &lt; 0 and &gt; &ndash;256
59430 </para>
59431 <para>
59432 The process was terminated by a signal and the value is the negation of the
59433 signal number.
59434 </para>
59435 </listitem>
59436 <listitem>
59437 <para>
59438 &ndash;256
59439 </para>
59440 <para>
59441 The process timed out.
59442 </para>
59443 </listitem>
59444 <listitem>
59445 <para>
59446 &ndash;257
59447 </para>
59448 <para>
59449 The was some other error in wait(); <option>errno</option> is still set.
59450 </para>
59451 </listitem>
59452 </itemizedlist>
59453 </listitem></varlistentry>
59454 <varlistentry>
59455 <term><emphasis role="bold">pid_t&nbsp;child_open_exim(int&nbsp;*fd)</emphasis></term>
59456 <listitem>
59457 <para>
59458 This function provide you with a means of submitting a new message to
59459 Exim. (Of course, you can also call <filename>/usr/sbin/sendmail</filename> yourself if you
59460 want, but this packages it all up for you.) The function creates a pipe,
59461 forks a subprocess that is running
59462 </para>
59463 <literallayout class="monospaced">
59464 exim -t -oem -oi -f &lt;&gt;
59465 </literallayout>
59466 <para>
59467 and returns to you (via the <literal>int *</literal> argument) a file descriptor for the pipe
59468 that is connected to the standard input. The yield of the function is the PID
59469 of the subprocess. You can then write a message to the file descriptor, with
59470 recipients in <emphasis>To:</emphasis>, <emphasis>Cc:</emphasis>, and/or <emphasis>Bcc:</emphasis> header lines.
59471 </para>
59472 <para>
59473 When you have finished, call <emphasis>child_close()</emphasis> to wait for the process to
59474 finish and to collect its ending status. A timeout value of zero is usually
59475 fine in this circumstance. Unless you have made a mistake with the recipient
59476 addresses, you should get a return code of zero.
59477 </para>
59478 </listitem></varlistentry>
59479 <varlistentry>
59480 <term><emphasis role="bold">pid_t&nbsp;child_open_exim2(int&nbsp;*fd,&nbsp;uschar&nbsp;*sender,&nbsp;uschar&nbsp;*sender_authentication)</emphasis></term>
59481 <listitem>
59482 <para>
59483 This function is a more sophisticated version of <emphasis>child_open()</emphasis>. The command
59484 that it runs is:
59485 </para>
59486 <literallayout>
59487 <literal>exim -t -oem -oi -f </literal><emphasis>sender</emphasis><literal> -oMas </literal><emphasis>sender_authentication</emphasis>
59488 </literallayout>
59489 <para>
59490 The third argument may be NULL, in which case the <option>-oMas</option> option is omitted.
59491 </para>
59492 </listitem></varlistentry>
59493 <varlistentry>
59494 <term><emphasis role="bold">void&nbsp;debug_printf(char&nbsp;*,&nbsp;...)</emphasis></term>
59495 <listitem>
59496 <para>
59497 This is Exim&#x2019;s debugging function, with arguments as for <emphasis>(printf()</emphasis>. The
59498 output is written to the standard error stream. If no debugging is selected,
59499 calls to <emphasis>debug_printf()</emphasis> have no effect. Normally, you should make calls
59500 conditional on the <literal>local_scan</literal> debug selector by coding like this:
59501 </para>
59502 <literallayout class="monospaced">
59503 if ((debug_selector &amp; D_local_scan) != 0)
59504   debug_printf("xxx", ...);
59505 </literallayout>
59506 </listitem></varlistentry>
59507 <varlistentry>
59508 <term><emphasis role="bold">uschar&nbsp;*expand_string(uschar&nbsp;*string)</emphasis></term>
59509 <listitem>
59510 <para>
59511 This is an interface to Exim&#x2019;s string expansion code. The return value is the
59512 expanded string, or NULL if there was an expansion failure.
59513 The C variable <option>expand_string_message</option> contains an error message after an
59514 expansion failure. If expansion does not change the string, the return value is
59515 the pointer to the input string. Otherwise, the return value points to a new
59516 block of memory that was obtained by a call to <emphasis>store_get()</emphasis>. See section
59517 <xref linkend="SECTmemhanloc"/> below for a discussion of memory handling.
59518 </para>
59519 </listitem></varlistentry>
59520 <varlistentry>
59521 <term><emphasis role="bold">void&nbsp;header_add(int&nbsp;type,&nbsp;char&nbsp;*format,&nbsp;...)</emphasis></term>
59522 <listitem>
59523 <para>
59524 This function allows you to an add additional header line at the end of the
59525 existing ones. The first argument is the type, and should normally be a space
59526 character. The second argument is a format string and any number of
59527 substitution arguments as for <function>sprintf()</function>. You may include internal newlines
59528 if you want, and you must ensure that the string ends with a newline.
59529 </para>
59530 </listitem></varlistentry>
59531 <varlistentry>
59532 <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>
59533 <listitem>
59534 <para>
59535 This function adds a new header line at a specified point in the header
59536 chain. The header itself is specified as for <emphasis>header_add()</emphasis>.
59537 </para>
59538 <para>
59539 If <option>name</option> is NULL, the new header is added at the end of the chain if
59540 <option>after</option> is true, or at the start if <option>after</option> is false. If <option>name</option> is not
59541 NULL, the header lines are searched for the first non-deleted header that
59542 matches the name. If one is found, the new header is added before it if
59543 <option>after</option> is false. If <option>after</option> is true, the new header is added after the
59544 found header and any adjacent subsequent ones with the same name (even if
59545 marked <quote>deleted</quote>). If no matching non-deleted header is found, the <option>topnot</option>
59546 option controls where the header is added. If it is true, addition is at the
59547 top; otherwise at the bottom. Thus, to add a header after all the <emphasis>Received:</emphasis>
59548 headers, or at the top if there are no <emphasis>Received:</emphasis> headers, you could use
59549 </para>
59550 <literallayout class="monospaced">
59551 header_add_at_position(TRUE, US"Received", TRUE,
59552   ' ', "X-xxx: ...");
59553 </literallayout>
59554 <para>
59555 Normally, there is always at least one non-deleted <emphasis>Received:</emphasis> header, but
59556 there may not be if <option>received_header_text</option> expands to an empty string.
59557 </para>
59558 </listitem></varlistentry>
59559 <varlistentry>
59560 <term><emphasis role="bold">void&nbsp;header_remove(int&nbsp;occurrence,&nbsp;uschar&nbsp;*name)</emphasis></term>
59561 <listitem>
59562 <para>
59563 This function removes header lines. If <option>occurrence</option> is zero or negative, all
59564 occurrences of the header are removed. If occurrence is greater than zero, that
59565 particular instance of the header is removed. If no header(s) can be found that
59566 match the specification, the function does nothing.
59567 </para>
59568 </listitem></varlistentry>
59569 <varlistentry>
59570 <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>
59571 <listitem>
59572 <para>
59573 This function tests whether the given header has the given name. It is not just
59574 a string comparison, because white space is permitted between the name and the
59575 colon. If the <option>notdel</option> argument is true, a false return is forced for all
59576 <quote>deleted</quote> headers; otherwise they are not treated specially. For example:
59577 </para>
59578 <literallayout class="monospaced">
59579 if (header_testname(h, US"X-Spam", 6, TRUE)) ...
59580 </literallayout>
59581 </listitem></varlistentry>
59582 <varlistentry>
59583 <term><emphasis role="bold">uschar&nbsp;*lss_b64encode(uschar&nbsp;*cleartext,&nbsp;int&nbsp;length)</emphasis></term>
59584 <listitem>
59585 <para>
59586 <indexterm role="concept">
59587 <primary>base64 encoding</primary>
59588 <secondary>functions for <function>local_scan()</function> use</secondary>
59589 </indexterm>
59590 This function base64-encodes a string, which is passed by address and length.
59591 The text may contain bytes of any value, including zero. The result is passed
59592 back in dynamic memory that is obtained by calling <emphasis>store_get()</emphasis>. It is
59593 zero-terminated.
59594 </para>
59595 </listitem></varlistentry>
59596 <varlistentry>
59597 <term><emphasis role="bold">int&nbsp;lss_b64decode(uschar&nbsp;*codetext,&nbsp;uschar&nbsp;**cleartext)</emphasis></term>
59598 <listitem>
59599 <para>
59600 This function decodes a base64-encoded string. Its arguments are a
59601 zero-terminated base64-encoded string and the address of a variable that is set
59602 to point to the result, which is in dynamic memory. The length of the decoded
59603 string is the yield of the function. If the input is invalid base64 data, the
59604 yield is -1. A zero byte is added to the end of the output string to make it
59605 easy to interpret as a C string (assuming it contains no zeros of its own). The
59606 added zero byte is not included in the returned count.
59607 </para>
59608 </listitem></varlistentry>
59609 <varlistentry>
59610 <term><emphasis role="bold">int&nbsp;lss_match_domain(uschar&nbsp;*domain,&nbsp;uschar&nbsp;*list)</emphasis></term>
59611 <listitem>
59612 <para>
59613 This function checks for a match in a domain list. Domains are always
59614 matched caselessly. The return value is one of the following:
59615 </para>
59616 <literallayout>
59617 <literal>OK     </literal> match succeeded
59618 <literal>FAIL   </literal> match failed
59619 <literal>DEFER  </literal> match deferred
59620 </literallayout>
59621 <para>
59622 DEFER is usually caused by some kind of lookup defer, such as the
59623 inability to contact a database.
59624 </para>
59625 </listitem></varlistentry>
59626 <varlistentry>
59627 <term><emphasis role="bold">int&nbsp;lss_match_local_part(uschar&nbsp;*localpart,&nbsp;uschar&nbsp;*list,&nbsp;BOOL&nbsp;caseless)</emphasis></term>
59628 <listitem>
59629 <para>
59630 This function checks for a match in a local part list. The third argument
59631 controls case-sensitivity. The return values are as for
59632 <emphasis>lss_match_domain()</emphasis>.
59633 </para>
59634 </listitem></varlistentry>
59635 <varlistentry>
59636 <term><emphasis role="bold">int&nbsp;lss_match_address(uschar&nbsp;*address,&nbsp;uschar&nbsp;*list,&nbsp;BOOL&nbsp;caseless)</emphasis></term>
59637 <listitem>
59638 <para>
59639 This function checks for a match in an address list. The third argument
59640 controls the case-sensitivity of the local part match. The domain is always
59641 matched caselessly. The return values are as for <emphasis>lss_match_domain()</emphasis>.
59642 </para>
59643 </listitem></varlistentry>
59644 <varlistentry>
59645 <term><emphasis role="bold">int&nbsp;lss_match_host(uschar&nbsp;*host_name,&nbsp;uschar&nbsp;*host_address,&nbsp;uschar&nbsp;*list)</emphasis></term>
59646 <listitem>
59647 <para>
59648 This function checks for a match in a host list. The most common usage is
59649 expected to be
59650 </para>
59651 <literallayout class="monospaced">
59652 lss_match_host(sender_host_name, sender_host_address, ...)
59653 </literallayout>
59654 <para>
59655 <indexterm role="variable">
59656 <primary><varname>$sender_host_address</varname></primary>
59657 </indexterm>
59658 An empty address field matches an empty item in the host list. If the host name
59659 is NULL, the name corresponding to <varname>$sender_host_address</varname> is automatically
59660 looked up if a host name is required to match an item in the list. The return
59661 values are as for <emphasis>lss_match_domain()</emphasis>, but in addition, <emphasis>lss_match_host()</emphasis>
59662 returns ERROR in the case when it had to look up a host name, but the lookup
59663 failed.
59664 </para>
59665 </listitem></varlistentry>
59666 <varlistentry>
59667 <term><emphasis role="bold">void&nbsp;log_write(unsigned&nbsp;int&nbsp;selector,&nbsp;int&nbsp;which,&nbsp;char&nbsp;*format,&nbsp;...)</emphasis></term>
59668 <listitem>
59669 <para>
59670 This function writes to Exim&#x2019;s log files. The first argument should be zero (it
59671 is concerned with <option>log_selector</option>). The second argument can be <literal>LOG_MAIN</literal> or
59672 <literal>LOG_REJECT</literal> or <literal>LOG_PANIC</literal> or the inclusive <quote>or</quote> of any combination of
59673 them. It specifies to which log or logs the message is written. The remaining
59674 arguments are a format and relevant insertion arguments. The string should not
59675 contain any newlines, not even at the end.
59676 </para>
59677 </listitem></varlistentry>
59678 <varlistentry>
59679 <term><emphasis role="bold">void&nbsp;receive_add_recipient(uschar&nbsp;*address,&nbsp;int&nbsp;pno)</emphasis></term>
59680 <listitem>
59681 <para>
59682 This function adds an additional recipient to the message. The first argument
59683 is the recipient address. If it is unqualified (has no domain), it is qualified
59684 with the <option>qualify_recipient</option> domain. The second argument must always be -1.
59685 </para>
59686 <para>
59687 This function does not allow you to specify a private <option>errors_to</option> address (as
59688 described with the structure of <option>recipient_item</option> above), because it pre-dates
59689 the addition of that field to the structure. However, it is easy to add such a
59690 value afterwards. For example:
59691 </para>
59692 <literallayout class="monospaced">
59693  receive_add_recipient(US"monitor@mydom.example", -1);
59694  recipients_list[recipients_count-1].errors_to =
59695    US"postmaster@mydom.example";
59696 </literallayout>
59697 </listitem></varlistentry>
59698 <varlistentry>
59699 <term><emphasis role="bold">BOOL&nbsp;receive_remove_recipient(uschar&nbsp;*recipient)</emphasis></term>
59700 <listitem>
59701 <para>
59702 This is a convenience function to remove a named recipient from the list of
59703 recipients. It returns true if a recipient was removed, and false if no
59704 matching recipient could be found. The argument must be a complete email
59705 address.
59706 </para>
59707 </listitem></varlistentry>
59708 </variablelist>
59709 <para>
59710 <indexterm role="concept">
59711 <primary>RFC 2047</primary>
59712 </indexterm>
59713 </para>
59714 <variablelist>
59715 <varlistentry>
59716 <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>
59717 <listitem>
59718 <para>
59719 This function decodes strings that are encoded according to RFC 2047. Typically
59720 these are the contents of header lines. First, each <quote>encoded word</quote> is decoded
59721 from the Q or B encoding into a byte-string. Then, if provided with the name of
59722 a charset encoding, and if the <function>iconv()</function> function is available, an attempt is
59723 made  to translate the result to the named character set. If this fails, the
59724 binary string is returned with an error message.
59725 </para>
59726 <para>
59727 The first argument is the string to be decoded. If <option>lencheck</option> is TRUE, the
59728 maximum MIME word length is enforced. The third argument is the target
59729 encoding, or NULL if no translation is wanted.
59730 </para>
59731 <para>
59732 <indexterm role="concept">
59733 <primary>binary zero</primary>
59734 <secondary>in RFC 2047 decoding</secondary>
59735 </indexterm>
59736 <indexterm role="concept">
59737 <primary>RFC 2047</primary>
59738 <secondary>binary zero in</secondary>
59739 </indexterm>
59740 If a binary zero is encountered in the decoded string, it is replaced by the
59741 contents of the <option>zeroval</option> argument. For use with Exim headers, the value must
59742 not be 0 because header lines are handled as zero-terminated strings.
59743 </para>
59744 <para>
59745 The function returns the result of processing the string, zero-terminated; if
59746 <option>lenptr</option> is not NULL, the length of the result is set in the variable to
59747 which it points. When <option>zeroval</option> is 0, <option>lenptr</option> should not be NULL.
59748 </para>
59749 <para>
59750 If an error is encountered, the function returns NULL and uses the <option>error</option>
59751 argument to return an error message. The variable pointed to by <option>error</option> is
59752 set to NULL if there is no error; it may be set non-NULL even when the function
59753 returns a non-NULL value if decoding was successful, but there was a problem
59754 with translation.
59755 </para>
59756 </listitem></varlistentry>
59757 <varlistentry>
59758 <term><emphasis role="bold">int&nbsp;smtp_fflush(void)</emphasis></term>
59759 <listitem>
59760 <para>
59761 This function is used in conjunction with <emphasis>smtp_printf()</emphasis>, as described
59762 below.
59763 </para>
59764 </listitem></varlistentry>
59765 <varlistentry>
59766 <term><emphasis role="bold">void&nbsp;smtp_printf(char&nbsp;*,&nbsp;...)</emphasis></term>
59767 <listitem>
59768 <para>
59769 The arguments of this function are like <function>printf()</function>; it writes to the SMTP
59770 output stream. You should use this function only when there is an SMTP output
59771 stream, that is, when the incoming message is being received via interactive
59772 SMTP. This is the case when <option>smtp_input</option> is TRUE and <option>smtp_batched_input</option>
59773 is FALSE. If you want to test for an incoming message from another host (as
59774 opposed to a local process that used the <option>-bs</option> command line option), you can
59775 test the value of <option>sender_host_address</option>, which is non-NULL when a remote host
59776 is involved.
59777 </para>
59778 <para>
59779 If an SMTP TLS connection is established, <emphasis>smtp_printf()</emphasis> uses the TLS
59780 output function, so it can be used for all forms of SMTP connection.
59781 </para>
59782 <para>
59783 Strings that are written by <emphasis>smtp_printf()</emphasis> from within <function>local_scan()</function>
59784 must start with an appropriate response code: 550 if you are going to return
59785 LOCAL_SCAN_REJECT, 451 if you are going to return
59786 LOCAL_SCAN_TEMPREJECT, and 250 otherwise. Because you are writing the
59787 initial lines of a multi-line response, the code must be followed by a hyphen
59788 to indicate that the line is not the final response line. You must also ensure
59789 that the lines you write terminate with CRLF. For example:
59790 </para>
59791 <literallayout class="monospaced">
59792 smtp_printf("550-this is some extra info\r\n");
59793 return LOCAL_SCAN_REJECT;
59794 </literallayout>
59795 <para>
59796 Note that you can also create multi-line responses by including newlines in
59797 the data returned via the <option>return_text</option> argument. The added value of using
59798 <emphasis>smtp_printf()</emphasis> is that, for instance, you could introduce delays between
59799 multiple output lines.
59800 </para>
59801 <para>
59802 The <emphasis>smtp_printf()</emphasis> function does not return any error indication, because it
59803 does not automatically flush pending output, and therefore does not test
59804 the state of the stream. (In the main code of Exim, flushing and error
59805 detection is done when Exim is ready for the next SMTP input command.) If
59806 you want to flush the output and check for an error (for example, the
59807 dropping of a TCP/IP connection), you can call <emphasis>smtp_fflush()</emphasis>, which has no
59808 arguments. It flushes the output stream, and returns a non-zero value if there
59809 is an error.
59810 </para>
59811 </listitem></varlistentry>
59812 <varlistentry>
59813 <term><emphasis role="bold">void&nbsp;*store_get(int)</emphasis></term>
59814 <listitem>
59815 <para>
59816 This function accesses Exim&#x2019;s internal store (memory) manager. It gets a new
59817 chunk of memory whose size is given by the argument. Exim bombs out if it ever
59818 runs out of memory. See the next section for a discussion of memory handling.
59819 </para>
59820 </listitem></varlistentry>
59821 <varlistentry>
59822 <term><emphasis role="bold">void&nbsp;*store_get_perm(int)</emphasis></term>
59823 <listitem>
59824 <para>
59825 This function is like <emphasis>store_get()</emphasis>, but it always gets memory from the
59826 permanent pool. See the next section for a discussion of memory handling.
59827 </para>
59828 </listitem></varlistentry>
59829 <varlistentry>
59830 <term><emphasis role="bold">uschar&nbsp;*string_copy(uschar&nbsp;*string)</emphasis></term>
59831 <listitem>
59832 <para>
59833 See below.
59834 </para>
59835 </listitem></varlistentry>
59836 <varlistentry>
59837 <term><emphasis role="bold">uschar&nbsp;*string_copyn(uschar&nbsp;*string,&nbsp;int&nbsp;length)</emphasis></term>
59838 <listitem>
59839 <para>
59840 See below.
59841 </para>
59842 </listitem></varlistentry>
59843 <varlistentry>
59844 <term><emphasis role="bold">uschar&nbsp;*string_sprintf(char&nbsp;*format,&nbsp;...)</emphasis></term>
59845 <listitem>
59846 <para>
59847 These three functions create strings using Exim&#x2019;s dynamic memory facilities.
59848 The first makes a copy of an entire string. The second copies up to a maximum
59849 number of characters, indicated by the second argument. The third uses a format
59850 and insertion arguments to create a new string. In each case, the result is a
59851 pointer to a new string in the current memory pool. See the next section for
59852 more discussion.
59853 </para>
59854 </listitem></varlistentry>
59855 </variablelist>
59856 </section>
59857 <section id="SECTmemhanloc">
59858 <title>More about Exim&#x2019;s memory handling</title>
59859 <para>
59860 <indexterm role="concept">
59861 <primary><function>local_scan()</function> function</primary>
59862 <secondary>memory handling</secondary>
59863 </indexterm>
59864 No function is provided for freeing memory, because that is never needed.
59865 The dynamic memory that Exim uses when receiving a message is automatically
59866 recycled if another message is received by the same process (this applies only
59867 to incoming SMTP connections &ndash; other input methods can supply only one
59868 message at a time). After receiving the last message, a reception process
59869 terminates.
59870 </para>
59871 <para>
59872 Because it is recycled, the normal dynamic memory cannot be used for holding
59873 data that must be preserved over a number of incoming messages on the same SMTP
59874 connection. However, Exim in fact uses two pools of dynamic memory; the second
59875 one is not recycled, and can be used for this purpose.
59876 </para>
59877 <para>
59878 If you want to allocate memory that remains available for subsequent messages
59879 in the same SMTP connection, you should set
59880 </para>
59881 <literallayout class="monospaced">
59882 store_pool = POOL_PERM
59883 </literallayout>
59884 <para>
59885 before calling the function that does the allocation. There is no need to
59886 restore the value if you do not need to; however, if you do want to revert to
59887 the normal pool, you can either restore the previous value of <option>store_pool</option> or
59888 set it explicitly to POOL_MAIN.
59889 </para>
59890 <para>
59891 The pool setting applies to all functions that get dynamic memory, including
59892 <emphasis>expand_string()</emphasis>, <emphasis>store_get()</emphasis>, and the <emphasis>string_xxx()</emphasis> functions.
59893 There is also a convenience function called <emphasis>store_get_perm()</emphasis> that gets a
59894 block of memory from the permanent pool while preserving the value of
59895 <option>store_pool</option>.
59896 <indexterm role="concept" startref="IIDlosca" class="endofrange"/>
59897 </para>
59898 </section>
59899 </chapter>
59900
59901 <chapter id="CHAPsystemfilter">
59902 <title>System-wide message filtering</title>
59903 <para>
59904 <indexterm role="concept" id="IIDsysfil1" class="startofrange">
59905 <primary>filter</primary>
59906 <secondary>system filter</secondary>
59907 </indexterm>
59908 <indexterm role="concept" id="IIDsysfil2" class="startofrange">
59909 <primary>filtering all mail</primary>
59910 </indexterm>
59911 <indexterm role="concept" id="IIDsysfil3" class="startofrange">
59912 <primary>system filter</primary>
59913 </indexterm>
59914 The previous chapters (on ACLs and the local scan function) describe checks
59915 that can be applied to messages before they are accepted by a host. There is
59916 also a mechanism for checking messages once they have been received, but before
59917 they are delivered. This is called the <emphasis>system filter</emphasis>.
59918 </para>
59919 <para>
59920 The system filter operates in a similar manner to users&#x2019; filter files, but it
59921 is run just once per message (however many recipients the message has).
59922 It should not normally be used as a substitute for routing, because <option>deliver</option>
59923 commands in a system router provide new envelope recipient addresses.
59924 The system filter must be an Exim filter. It cannot be a Sieve filter.
59925 </para>
59926 <para>
59927 The system filter is run at the start of a delivery attempt, before any routing
59928 is done. If a message fails to be completely delivered at the first attempt,
59929 the system filter is run again at the start of every retry.
59930 If you want your filter to do something only once per message, you can make use
59931 of the <option>first_delivery</option> condition in an <option>if</option> command in the filter to
59932 prevent it happening on retries.
59933 </para>
59934 <para>
59935 <indexterm role="variable">
59936 <primary><varname>$domain</varname></primary>
59937 </indexterm>
59938 <indexterm role="variable">
59939 <primary><varname>$local_part</varname></primary>
59940 </indexterm>
59941 <emphasis role="bold">Warning</emphasis>: Because the system filter runs just once, variables that are
59942 specific to individual recipient addresses, such as <varname>$local_part</varname> and
59943 <varname>$domain</varname>, are not set, and the <quote>personal</quote> condition is not meaningful. If
59944 you want to run a centrally-specified filter for each recipient address
59945 independently, you can do so by setting up a suitable <command>redirect</command> router, as
59946 described in section <xref linkend="SECTperaddfil"/> below.
59947 </para>
59948 <section id="SECID212">
59949 <title>Specifying a system filter</title>
59950 <para>
59951 <indexterm role="concept">
59952 <primary>uid (user id)</primary>
59953 <secondary>system filter</secondary>
59954 </indexterm>
59955 <indexterm role="concept">
59956 <primary>gid (group id)</primary>
59957 <secondary>system filter</secondary>
59958 </indexterm>
59959 The name of the file that contains the system filter must be specified by
59960 setting <option>system_filter</option>. If you want the filter to run under a uid and gid
59961 other than root, you must also set <option>system_filter_user</option> and
59962 <option>system_filter_group</option> as appropriate. For example:
59963 </para>
59964 <literallayout class="monospaced">
59965 system_filter = /etc/mail/exim.filter
59966 system_filter_user = exim
59967 </literallayout>
59968 <para>
59969 If a system filter generates any deliveries directly to files or pipes (via the
59970 <option>save</option> or <option>pipe</option> commands), transports to handle these deliveries must be
59971 specified by setting <option>system_filter_file_transport</option> and
59972 <option>system_filter_pipe_transport</option>, respectively. Similarly,
59973 <option>system_filter_reply_transport</option> must be set to handle any messages generated
59974 by the <option>reply</option> command.
59975 </para>
59976 </section>
59977 <section id="SECID213">
59978 <title>Testing a system filter</title>
59979 <para>
59980 You can run simple tests of a system filter in the same way as for a user
59981 filter, but you should use <option>-bF</option> rather than <option>-bf</option>, so that features that
59982 are permitted only in system filters are recognized.
59983 </para>
59984 <para>
59985 If you want to test the combined effect of a system filter and a user filter,
59986 you can use both <option>-bF</option> and <option>-bf</option> on the same command line.
59987 </para>
59988 </section>
59989 <section id="SECID214">
59990 <title>Contents of a system filter</title>
59991 <para>
59992 The language used to specify system filters is the same as for users&#x2019; filter
59993 files. It is described in the separate end-user document <emphasis>Exim&#x2019;s interface to
59994 mail filtering</emphasis>. However, there are some additional features that are
59995 available only in system filters; these are described in subsequent sections.
59996 If they are encountered in a user&#x2019;s filter file or when testing with <option>-bf</option>,
59997 they cause errors.
59998 </para>
59999 <para>
60000 <indexterm role="concept">
60001 <primary>frozen messages</primary>
60002 <secondary>manual thaw; testing in filter</secondary>
60003 </indexterm>
60004 There are two special conditions which, though available in users&#x2019; filter
60005 files, are designed for use in system filters. The condition <option>first_delivery</option>
60006 is true only for the first attempt at delivering a message, and
60007 <option>manually_thawed</option> is true only if the message has been frozen, and
60008 subsequently thawed by an admin user. An explicit forced delivery counts as a
60009 manual thaw, but thawing as a result of the <option>auto_thaw</option> setting does not.
60010 </para>
60011 <para>
60012 <emphasis role="bold">Warning</emphasis>: If a system filter uses the <option>first_delivery</option> condition to
60013 specify an <quote>unseen</quote> (non-significant) delivery, and that delivery does not
60014 succeed, it will not be tried again.
60015 If you want Exim to retry an unseen delivery until it succeeds, you should
60016 arrange to set it up every time the filter runs.
60017 </para>
60018 <para>
60019 When a system filter finishes running, the values of the variables <varname>$n0</varname> &ndash;
60020 <varname>$n9</varname> are copied into <varname>$sn0</varname> &ndash; <varname>$sn9</varname> and are thereby made available to
60021 users&#x2019; filter files. Thus a system filter can, for example, set up <quote>scores</quote>
60022 to which users&#x2019; filter files can refer.
60023 </para>
60024 </section>
60025 <section id="SECID215">
60026 <title>Additional variable for system filters</title>
60027 <para>
60028 <indexterm role="variable">
60029 <primary><varname>$recipients</varname></primary>
60030 </indexterm>
60031 The expansion variable <varname>$recipients</varname>, containing a list of all the recipients
60032 of the message (separated by commas and white space), is available in system
60033 filters. It is not available in users&#x2019; filters for privacy reasons.
60034 </para>
60035 </section>
60036 <section id="SECID216">
60037 <title>Defer, freeze, and fail commands for system filters</title>
60038 <para>
60039 <indexterm role="concept">
60040 <primary>freezing messages</primary>
60041 </indexterm>
60042 <indexterm role="concept">
60043 <primary>message</primary>
60044 <secondary>freezing</secondary>
60045 </indexterm>
60046 <indexterm role="concept">
60047 <primary>message</primary>
60048 <secondary>forced failure</secondary>
60049 </indexterm>
60050 <indexterm role="concept">
60051 <primary><option>fail</option></primary>
60052 <secondary>in system filter</secondary>
60053 </indexterm>
60054 <indexterm role="concept">
60055 <primary><option>freeze</option> in system filter</primary>
60056 </indexterm>
60057 <indexterm role="concept">
60058 <primary><option>defer</option> in system filter</primary>
60059 </indexterm>
60060 There are three extra commands (<option>defer</option>, <option>freeze</option> and <option>fail</option>) which are
60061 always available in system filters, but are not normally enabled in users&#x2019;
60062 filters. (See the <option>allow_defer</option>, <option>allow_freeze</option> and <option>allow_fail</option> options
60063 for the <command>redirect</command> router.) These commands can optionally be followed by the
60064 word <option>text</option> and a string containing an error message, for example:
60065 </para>
60066 <literallayout class="monospaced">
60067 fail text "this message looks like spam to me"
60068 </literallayout>
60069 <para>
60070 The keyword <option>text</option> is optional if the next character is a double quote.
60071 </para>
60072 <para>
60073 The <option>defer</option> command defers delivery of the original recipients of the
60074 message. The <option>fail</option> command causes all the original recipients to be failed,
60075 and a bounce message to be created. The <option>freeze</option> command suspends all
60076 delivery attempts for the original recipients. In all cases, any new deliveries
60077 that are specified by the filter are attempted as normal after the filter has
60078 run.
60079 </para>
60080 <para>
60081 The <option>freeze</option> command is ignored if the message has been manually unfrozen and
60082 not manually frozen since. This means that automatic freezing by a system
60083 filter can be used as a way of checking out suspicious messages. If a message
60084 is found to be all right, manually unfreezing it allows it to be delivered.
60085 </para>
60086 <para>
60087 <indexterm role="concept">
60088 <primary>log</primary>
60089 <secondary><option>fail</option> command log line</secondary>
60090 </indexterm>
60091 <indexterm role="concept">
60092 <primary><option>fail</option></primary>
60093 <secondary>log line; reducing</secondary>
60094 </indexterm>
60095 The text given with a fail command is used as part of the bounce message as
60096 well as being written to the log. If the message is quite long, this can fill
60097 up a lot of log space when such failures are common. To reduce the size of the
60098 log message, Exim interprets the text in a special way if it starts with the
60099 two characters <literal>&lt;&lt;</literal> and contains <literal>&gt;&gt;</literal> later. The text between these two
60100 strings is written to the log, and the rest of the text is used in the bounce
60101 message. For example:
60102 </para>
60103 <literallayout class="monospaced">
60104 fail "&lt;&lt;filter test 1&gt;&gt;Your message is rejected \
60105      because it contains attachments that we are \
60106      not prepared to receive."
60107 </literallayout>
60108 <para>
60109 <indexterm role="concept">
60110 <primary>loop</primary>
60111 <secondary>caused by <option>fail</option></secondary>
60112 </indexterm>
60113 Take great care with the <option>fail</option> command when basing the decision to fail on
60114 the contents of the message, because the bounce message will of course include
60115 the contents of the original message and will therefore trigger the <option>fail</option>
60116 command again (causing a mail loop) unless steps are taken to prevent this.
60117 Testing the <option>error_message</option> condition is one way to prevent this. You could
60118 use, for example
60119 </para>
60120 <literallayout class="monospaced">
60121 if $message_body contains "this is spam" and not error_message
60122 then fail text "spam is not wanted here" endif
60123 </literallayout>
60124 <para>
60125 though of course that might let through unwanted bounce messages. The
60126 alternative is clever checking of the body and/or headers to detect bounces
60127 generated by the filter.
60128 </para>
60129 <para>
60130 The interpretation of a system filter file ceases after a
60131 <option>defer</option>,
60132 <option>freeze</option>, or <option>fail</option> command is obeyed. However, any deliveries that were
60133 set up earlier in the filter file are honoured, so you can use a sequence such
60134 as
60135 </para>
60136 <literallayout class="monospaced">
60137 mail ...
60138 freeze
60139 </literallayout>
60140 <para>
60141 to send a specified message when the system filter is freezing (or deferring or
60142 failing) a message. The normal deliveries for the message do not, of course,
60143 take place.
60144 </para>
60145 </section>
60146 <section id="SECTaddremheasys">
60147 <title>Adding and removing headers in a system filter</title>
60148 <para>
60149 <indexterm role="concept">
60150 <primary>header lines</primary>
60151 <secondary>adding; in system filter</secondary>
60152 </indexterm>
60153 <indexterm role="concept">
60154 <primary>header lines</primary>
60155 <secondary>removing; in system filter</secondary>
60156 </indexterm>
60157 <indexterm role="concept">
60158 <primary>filter</primary>
60159 <secondary>header lines; adding/removing</secondary>
60160 </indexterm>
60161 Two filter commands that are available only in system filters are:
60162 </para>
60163 <literallayout class="monospaced">
60164 headers add &lt;string&gt;
60165 headers remove &lt;string&gt;
60166 </literallayout>
60167 <para>
60168 The argument for the <option>headers add</option> is a string that is expanded and then
60169 added to the end of the message&#x2019;s headers. It is the responsibility of the
60170 filter maintainer to make sure it conforms to RFC 2822 syntax. Leading white
60171 space is ignored, and if the string is otherwise empty, or if the expansion is
60172 forced to fail, the command has no effect.
60173 </para>
60174 <para>
60175 You can use <quote>\n</quote> within the string, followed by white space, to specify
60176 continued header lines. More than one header may be added in one command by
60177 including <quote>\n</quote> within the string without any following white space. For
60178 example:
60179 </para>
60180 <literallayout class="monospaced">
60181 headers add "X-header-1: ....\n  \
60182              continuation of X-header-1 ...\n\
60183              X-header-2: ...."
60184 </literallayout>
60185 <para>
60186 Note that the header line continuation white space after the first newline must
60187 be placed before the backslash that continues the input string, because white
60188 space after input continuations is ignored.
60189 </para>
60190 <para>
60191 The argument for <option>headers remove</option> is a colon-separated list of header names.
60192 This command applies only to those headers that are stored with the message;
60193 those that are added at delivery time (such as <emphasis>Envelope-To:</emphasis> and
60194 <emphasis>Return-Path:</emphasis>) cannot be removed by this means. If there is more than one
60195 header with the same name, they are all removed.
60196 </para>
60197 <para>
60198 The <option>headers</option> command in a system filter makes an immediate change to the set
60199 of header lines that was received with the message (with possible additions
60200 from ACL processing). Subsequent commands in the system filter operate on the
60201 modified set, which also forms the basis for subsequent message delivery.
60202 Unless further modified during routing or transporting, this set of headers is
60203 used for all recipients of the message.
60204 </para>
60205 <para>
60206 During routing and transporting, the variables that refer to the contents of
60207 header lines refer only to those lines that are in this set. Thus, header lines
60208 that are added by a system filter are visible to users&#x2019; filter files and to all
60209 routers and transports. This contrasts with the manipulation of header lines by
60210 routers and transports, which is not immediate, but which instead is saved up
60211 until the message is actually being written (see section
60212 <xref linkend="SECTheadersaddrem"/>).
60213 </para>
60214 <para>
60215 If the message is not delivered at the first attempt, header lines that were
60216 added by the system filter are stored with the message, and so are still
60217 present at the next delivery attempt. Header lines that were removed are still
60218 present, but marked <quote>deleted</quote> so that they are not transported with the
60219 message. For this reason, it is usual to make the <option>headers</option> command
60220 conditional on <option>first_delivery</option> so that the set of header lines is not
60221 modified more than once.
60222 </para>
60223 <para>
60224 Because header modification in a system filter acts immediately, you have to
60225 use an indirect approach if you want to modify the contents of a header line.
60226 For example:
60227 </para>
60228 <literallayout class="monospaced">
60229 headers add "Old-Subject: $h_subject:"
60230 headers remove "Subject"
60231 headers add "Subject: new subject (was: $h_old-subject:)"
60232 headers remove "Old-Subject"
60233 </literallayout>
60234 </section>
60235 <section id="SECID217">
60236 <title>Setting an errors address in a system filter</title>
60237 <para>
60238 <indexterm role="concept">
60239 <primary>envelope sender</primary>
60240 </indexterm>
60241 In a system filter, if a <option>deliver</option> command is followed by
60242 </para>
60243 <literallayout class="monospaced">
60244 errors_to &lt;some address&gt;
60245 </literallayout>
60246 <para>
60247 in order to change the envelope sender (and hence the error reporting) for that
60248 delivery, any address may be specified. (In a user filter, only the current
60249 user&#x2019;s address can be set.) For example, if some mail is being monitored, you
60250 might use
60251 </para>
60252 <literallayout class="monospaced">
60253 unseen deliver monitor@spying.example errors_to root@local.example
60254 </literallayout>
60255 <para>
60256 to take a copy which would not be sent back to the normal error reporting
60257 address if its delivery failed.
60258 </para>
60259 </section>
60260 <section id="SECTperaddfil">
60261 <title>Per-address filtering</title>
60262 <para>
60263 <indexterm role="variable">
60264 <primary><varname>$domain</varname></primary>
60265 </indexterm>
60266 <indexterm role="variable">
60267 <primary><varname>$local_part</varname></primary>
60268 </indexterm>
60269 In contrast to the system filter, which is run just once per message for each
60270 delivery attempt, it is also possible to set up a system-wide filtering
60271 operation that runs once for each recipient address. In this case, variables
60272 such as <varname>$local_part</varname> and <varname>$domain</varname> can be used, and indeed, the choice of
60273 filter file could be made dependent on them. This is an example of a router
60274 which implements such a filter:
60275 </para>
60276 <literallayout class="monospaced">
60277 central_filter:
60278   check_local_user
60279   driver = redirect
60280   domains = +local_domains
60281   file = /central/filters/$local_part
60282   no_verify
60283   allow_filter
60284   allow_freeze
60285 </literallayout>
60286 <para>
60287 The filter is run in a separate process under its own uid. Therefore, either
60288 <option>check_local_user</option> must be set (as above), in which case the filter is run as
60289 the local user, or the <option>user</option> option must be used to specify which user to
60290 use. If both are set, <option>user</option> overrides.
60291 </para>
60292 <para>
60293 Care should be taken to ensure that none of the commands in the filter file
60294 specify a significant delivery if the message is to go on to be delivered to
60295 its intended recipient. The router will not then claim to have dealt with the
60296 address, so it will be passed on to subsequent routers to be delivered in the
60297 normal way.
60298 <indexterm role="concept" startref="IIDsysfil1" class="endofrange"/>
60299 <indexterm role="concept" startref="IIDsysfil2" class="endofrange"/>
60300 <indexterm role="concept" startref="IIDsysfil3" class="endofrange"/>
60301 </para>
60302 </section>
60303 </chapter>
60304
60305 <chapter id="CHAPmsgproc">
60306 <title>Message processing</title>
60307 <para>
60308 <indexterm role="concept" id="IIDmesproc" class="startofrange">
60309 <primary>message</primary>
60310 <secondary>general processing</secondary>
60311 </indexterm>
60312 Exim performs various transformations on the sender and recipient addresses of
60313 all messages that it handles, and also on the messages&#x2019; header lines. Some of
60314 these are optional and configurable, while others always take place. All of
60315 this processing, except rewriting as a result of routing, and the addition or
60316 removal of header lines while delivering, happens when a message is received,
60317 before it is placed on Exim&#x2019;s queue.
60318 </para>
60319 <para>
60320 Some of the automatic processing takes place by default only for
60321 <quote>locally-originated</quote> messages. This adjective is used to describe messages
60322 that are not received over TCP/IP, but instead are passed to an Exim process on
60323 its standard input. This includes the interactive <quote>local SMTP</quote> case that is
60324 set up by the <option>-bs</option> command line option.
60325 </para>
60326 <para>
60327 <emphasis role="bold">Note</emphasis>: Messages received over TCP/IP on the loopback interface (127.0.0.1
60328 or ::1) are not considered to be locally-originated. Exim does not treat the
60329 loopback interface specially in any way.
60330 </para>
60331 <para>
60332 If you want the loopback interface to be treated specially, you must ensure
60333 that there are appropriate entries in your ACLs.
60334 </para>
60335 <section id="SECTsubmodnon">
60336 <title>Submission mode for non-local messages</title>
60337 <para>
60338 <indexterm role="concept">
60339 <primary>message</primary>
60340 <secondary>submission</secondary>
60341 </indexterm>
60342 <indexterm role="concept">
60343 <primary>submission mode</primary>
60344 </indexterm>
60345 Processing that happens automatically for locally-originated messages (unless
60346 <option>suppress_local_fixups</option> is set) can also be requested for messages that are
60347 received over TCP/IP. The term <quote>submission mode</quote> is used to describe this
60348 state. Submission mode is set by the modifier
60349 </para>
60350 <literallayout class="monospaced">
60351 control = submission
60352 </literallayout>
60353 <para>
60354 in a MAIL, RCPT, or pre-data ACL for an incoming message (see sections
60355 <xref linkend="SECTACLmodi"/> and <xref linkend="SECTcontrols"/>). This makes Exim treat the message as
60356 a local submission, and is normally used when the source of the message is
60357 known to be an MUA running on a client host (as opposed to an MTA). For
60358 example, to set submission mode for messages originating on the IPv4 loopback
60359 interface, you could include the following in the MAIL ACL:
60360 </para>
60361 <literallayout class="monospaced">
60362 warn  hosts = 127.0.0.1
60363       control = submission
60364 </literallayout>
60365 <para>
60366 <indexterm role="concept">
60367 <primary><option>sender_retain</option> submission option</primary>
60368 </indexterm>
60369 There are some options that can be used when setting submission mode. A slash
60370 is used to separate options. For example:
60371 </para>
60372 <literallayout class="monospaced">
60373 control = submission/sender_retain
60374 </literallayout>
60375 <para>
60376 Specifying <option>sender_retain</option> has the effect of setting <option>local_sender_retain</option>
60377 true and <option>local_from_check</option> false for the current incoming message. The first
60378 of these allows an existing <emphasis>Sender:</emphasis> header in the message to remain, and
60379 the second suppresses the check to ensure that <emphasis>From:</emphasis> matches the
60380 authenticated sender. With this setting, Exim still fixes up messages by adding
60381 <emphasis>Date:</emphasis> and <emphasis>Message-ID:</emphasis> header lines if they are missing, but makes no
60382 attempt to check sender authenticity in header lines.
60383 </para>
60384 <para>
60385 When <option>sender_retain</option> is not set, a submission mode setting may specify a
60386 domain to be used when generating a <emphasis>From:</emphasis> or <emphasis>Sender:</emphasis> header line. For
60387 example:
60388 </para>
60389 <literallayout class="monospaced">
60390 control = submission/domain=some.domain
60391 </literallayout>
60392 <para>
60393 The domain may be empty. How this value is used is described in sections
60394 <xref linkend="SECTthefrohea"/> and <xref linkend="SECTthesenhea"/>. There is also a <option>name</option> option
60395 that allows you to specify the user&#x2019;s full name for inclusion in a created
60396 <emphasis>Sender:</emphasis> or <emphasis>From:</emphasis> header line. For example:
60397 </para>
60398 <literallayout class="monospaced">
60399 accept authenticated = *
60400        control = submission/domain=wonderland.example/\
60401                             name=${lookup {$authenticated_id} \
60402                                    lsearch {/etc/exim/namelist}}
60403 </literallayout>
60404 <para>
60405 Because the name may contain any characters, including slashes, the <option>name</option>
60406 option must be given last. The remainder of the string is used as the name. For
60407 the example above, if <filename>/etc/exim/namelist</filename> contains:
60408 </para>
60409 <literallayout class="monospaced">
60410 bigegg:  Humpty Dumpty
60411 </literallayout>
60412 <para>
60413 then when the sender has authenticated as <emphasis>bigegg</emphasis>, the generated <emphasis>Sender:</emphasis>
60414 line would be:
60415 </para>
60416 <literallayout class="monospaced">
60417 Sender: Humpty Dumpty &lt;bigegg@wonderland.example&gt;
60418 </literallayout>
60419 <para>
60420 <indexterm role="concept">
60421 <primary>return path</primary>
60422 <secondary>in submission mode</secondary>
60423 </indexterm>
60424 By default, submission mode forces the return path to the same address as is
60425 used to create the <emphasis>Sender:</emphasis> header. However, if <option>sender_retain</option> is
60426 specified, the return path is also left unchanged.
60427 </para>
60428 <para>
60429 <emphasis role="bold">Note</emphasis>: The changes caused by submission mode take effect after the predata
60430 ACL. This means that any sender checks performed before the fix-ups use the
60431 untrusted sender address specified by the user, not the trusted sender address
60432 specified by submission mode. Although this might be slightly unexpected, it
60433 does mean that you can configure ACL checks to spot that a user is trying to
60434 spoof another&#x2019;s address.
60435 </para>
60436 </section>
60437 <section id="SECTlineendings">
60438 <title>Line endings</title>
60439 <para>
60440 <indexterm role="concept">
60441 <primary>line endings</primary>
60442 </indexterm>
60443 <indexterm role="concept">
60444 <primary>carriage return</primary>
60445 </indexterm>
60446 <indexterm role="concept">
60447 <primary>linefeed</primary>
60448 </indexterm>
60449 RFC 2821 specifies that CRLF (two characters: carriage-return, followed by
60450 linefeed) is the line ending for messages transmitted over the Internet using
60451 SMTP over TCP/IP. However, within individual operating systems, different
60452 conventions are used. For example, Unix-like systems use just LF, but others
60453 use CRLF or just CR.
60454 </para>
60455 <para>
60456 Exim was designed for Unix-like systems, and internally, it stores messages
60457 using the system&#x2019;s convention of a single LF as a line terminator. When
60458 receiving a message, all line endings are translated to this standard format.
60459 Originally, it was thought that programs that passed messages directly to an
60460 MTA within an operating system would use that system&#x2019;s convention. Experience
60461 has shown that this is not the case; for example, there are Unix applications
60462 that use CRLF in this circumstance. For this reason, and for compatibility with
60463 other MTAs, the way Exim handles line endings for all messages is now as
60464 follows:
60465 </para>
60466 <itemizedlist>
60467 <listitem>
60468 <para>
60469 LF not preceded by CR is treated as a line ending.
60470 </para>
60471 </listitem>
60472 <listitem>
60473 <para>
60474 CR is treated as a line ending; if it is immediately followed by LF, the LF
60475 is ignored.
60476 </para>
60477 </listitem>
60478 <listitem>
60479 <para>
60480 The sequence <quote>CR, dot, CR</quote> does not terminate an incoming SMTP message,
60481 nor a local message in the state where a line containing only a dot is a
60482 terminator.
60483 </para>
60484 </listitem>
60485 <listitem>
60486 <para>
60487 If a bare CR is encountered within a header line, an extra space is added after
60488 the line terminator so as not to end the header line. The reasoning behind this
60489 is that bare CRs in header lines are most likely either to be mistakes, or
60490 people trying to play silly games.
60491 </para>
60492 </listitem>
60493 <listitem>
60494 <para>
60495 If the first header line received in a message ends with CRLF, a subsequent
60496 bare LF in a header line is treated in the same way as a bare CR in a header
60497 line.
60498 </para>
60499 </listitem>
60500 </itemizedlist>
60501 </section>
60502 <section id="SECID218">
60503 <title>Unqualified addresses</title>
60504 <para>
60505 <indexterm role="concept">
60506 <primary>unqualified addresses</primary>
60507 </indexterm>
60508 <indexterm role="concept">
60509 <primary>address</primary>
60510 <secondary>qualification</secondary>
60511 </indexterm>
60512 By default, Exim expects every envelope address it receives from an external
60513 host to be fully qualified. Unqualified addresses cause negative responses to
60514 SMTP commands. However, because SMTP is used as a means of transporting
60515 messages from MUAs running on personal workstations, there is sometimes a
60516 requirement to accept unqualified addresses from specific hosts or IP networks.
60517 </para>
60518 <para>
60519 Exim has two options that separately control which hosts may send unqualified
60520 sender or recipient addresses in SMTP commands, namely
60521 <option>sender_unqualified_hosts</option> and <option>recipient_unqualified_hosts</option>. In both
60522 cases, if an unqualified address is accepted, it is qualified by adding the
60523 value of <option>qualify_domain</option> or <option>qualify_recipient</option>, as appropriate.
60524 </para>
60525 <para>
60526 <indexterm role="option">
60527 <primary><option>qualify_domain</option></primary>
60528 </indexterm>
60529 <indexterm role="option">
60530 <primary><option>qualify_recipient</option></primary>
60531 </indexterm>
60532 Unqualified addresses in header lines are automatically qualified for messages
60533 that are locally originated, unless the <option>-bnq</option> option is given on the command
60534 line. For messages received over SMTP, unqualified addresses in header lines
60535 are qualified only if unqualified addresses are permitted in SMTP commands. In
60536 other words, such qualification is also controlled by
60537 <option>sender_unqualified_hosts</option> and <option>recipient_unqualified_hosts</option>,
60538 </para>
60539 </section>
60540 <section id="SECID219">
60541 <title>The UUCP From line</title>
60542 <para>
60543 <indexterm role="concept">
60544 <primary><quote>From</quote> line</primary>
60545 </indexterm>
60546 <indexterm role="concept">
60547 <primary>UUCP</primary>
60548 <secondary><quote>From</quote> line</secondary>
60549 </indexterm>
60550 <indexterm role="concept">
60551 <primary>sender</primary>
60552 <secondary>address</secondary>
60553 </indexterm>
60554 <indexterm role="option">
60555 <primary><option>uucp_from_pattern</option></primary>
60556 </indexterm>
60557 <indexterm role="option">
60558 <primary><option>uucp_from_sender</option></primary>
60559 </indexterm>
60560 <indexterm role="concept">
60561 <primary>envelope sender</primary>
60562 </indexterm>
60563 <indexterm role="concept">
60564 <primary>Sendmail compatibility</primary>
60565 <secondary><quote>From</quote> line</secondary>
60566 </indexterm>
60567 Messages that have come from UUCP (and some other applications) often begin
60568 with a line containing the envelope sender and a timestamp, following the word
60569 <quote>From</quote>. Examples of two common formats are:
60570 </para>
60571 <literallayout class="monospaced">
60572 From a.oakley@berlin.mus Fri Jan  5 12:35 GMT 1996
60573 From f.butler@berlin.mus Fri, 7 Jan 97 14:00:00 GMT
60574 </literallayout>
60575 <para>
60576 This line precedes the RFC 2822 header lines. For compatibility with Sendmail,
60577 Exim recognizes such lines at the start of messages that are submitted to it
60578 via the command line (that is, on the standard input). It does not recognize
60579 such lines in incoming SMTP messages, unless the sending host matches
60580 <option>ignore_fromline_hosts</option> or the <option>-bs</option> option was used for a local message
60581 and <option>ignore_fromline_local</option> is set. The recognition is controlled by a
60582 regular expression that is defined by the <option>uucp_from_pattern</option> option, whose
60583 default value matches the two common cases shown above and puts the address
60584 that follows <quote>From</quote> into <varname>$1</varname>.
60585 </para>
60586 <para>
60587 <indexterm role="concept">
60588 <primary>numerical variables (<varname>$1</varname> <varname>$2</varname> etc)</primary>
60589 <secondary>in <quote>From </quote> line handling</secondary>
60590 </indexterm>
60591 When the caller of Exim for a non-SMTP message that contains a <quote>From</quote> line is
60592 a trusted user, the message&#x2019;s sender address is constructed by expanding the
60593 contents of <option>uucp_sender_address</option>, whose default value is <quote>$1</quote>. This is
60594 then parsed as an RFC 2822 address. If there is no domain, the local part is
60595 qualified with <option>qualify_domain</option> unless it is the empty string. However, if
60596 the command line <option>-f</option> option is used, it overrides the <quote>From</quote> line.
60597 </para>
60598 <para>
60599 If the caller of Exim is not trusted, the <quote>From</quote> line is recognized, but the
60600 sender address is not changed. This is also the case for incoming SMTP messages
60601 that are permitted to contain <quote>From</quote> lines.
60602 </para>
60603 <para>
60604 Only one <quote>From</quote> line is recognized. If there is more than one, the second is
60605 treated as a data line that starts the body of the message, as it is not valid
60606 as a header line. This also happens if a <quote>From</quote> line is present in an
60607 incoming SMTP message from a source that is not permitted to send them.
60608 </para>
60609 </section>
60610 <section id="SECID220">
60611 <title>Resent- header lines</title>
60612 <para>
60613 <indexterm role="concept">
60614 <primary><option>Resent-</option> header lines</primary>
60615 </indexterm>
60616 RFC 2822 makes provision for sets of header lines starting with the string
60617 <literal>Resent-</literal> to be added to a message when it is resent by the original
60618 recipient to somebody else. These headers are <emphasis>Resent-Date:</emphasis>,
60619 <emphasis>Resent-From:</emphasis>, <emphasis>Resent-Sender:</emphasis>, <emphasis>Resent-To:</emphasis>, <emphasis>Resent-Cc:</emphasis>,
60620 <emphasis>Resent-Bcc:</emphasis> and <emphasis>Resent-Message-ID:</emphasis>. The RFC says:
60621 </para>
60622 <blockquote>
60623 <para>
60624 <emphasis>Resent fields are strictly informational. They MUST NOT be used in the normal
60625 processing of replies or other such automatic actions on messages.</emphasis>
60626 </para>
60627 </blockquote>
60628 <para>
60629 This leaves things a bit vague as far as other processing actions such as
60630 address rewriting are concerned. Exim treats <option>Resent-</option> header lines as
60631 follows:
60632 </para>
60633 <itemizedlist>
60634 <listitem>
60635 <para>
60636 A <emphasis>Resent-From:</emphasis> line that just contains the login id of the submitting user
60637 is automatically rewritten in the same way as <emphasis>From:</emphasis> (see below).
60638 </para>
60639 </listitem>
60640 <listitem>
60641 <para>
60642 If there&#x2019;s a rewriting rule for a particular header line, it is also applied to
60643 <option>Resent-</option> header lines of the same type. For example, a rule that rewrites
60644 <emphasis>From:</emphasis> also rewrites <emphasis>Resent-From:</emphasis>.
60645 </para>
60646 </listitem>
60647 <listitem>
60648 <para>
60649 For local messages, if <emphasis>Sender:</emphasis> is removed on input, <emphasis>Resent-Sender:</emphasis> is
60650 also removed.
60651 </para>
60652 </listitem>
60653 <listitem>
60654 <para>
60655 For a locally-submitted message,
60656 if there are any <option>Resent-</option> header lines but no <emphasis>Resent-Date:</emphasis>,
60657 <emphasis>Resent-From:</emphasis>, or <emphasis>Resent-Message-Id:</emphasis>, they are added as necessary. It is
60658 the contents of <emphasis>Resent-Message-Id:</emphasis> (rather than <emphasis>Message-Id:</emphasis>) which are
60659 included in log lines in this case.
60660 </para>
60661 </listitem>
60662 <listitem>
60663 <para>
60664 The logic for adding <emphasis>Sender:</emphasis> is duplicated for <emphasis>Resent-Sender:</emphasis> when any
60665 <option>Resent-</option> header lines are present.
60666 </para>
60667 </listitem>
60668 </itemizedlist>
60669 </section>
60670 <section id="SECID221">
60671 <title>The Auto-Submitted: header line</title>
60672 <para>
60673 Whenever Exim generates an autoreply, a bounce, or a delay warning message, it
60674 includes the header line:
60675 </para>
60676 <literallayout class="monospaced">
60677 Auto-Submitted: auto-replied
60678 </literallayout>
60679 </section>
60680 <section id="SECID222">
60681 <title>The Bcc: header line</title>
60682 <para>
60683 <indexterm role="concept">
60684 <primary><emphasis>Bcc:</emphasis> header line</primary>
60685 </indexterm>
60686 If Exim is called with the <option>-t</option> option, to take recipient addresses from a
60687 message&#x2019;s header, it removes any <emphasis>Bcc:</emphasis> header line that may exist (after
60688 extracting its addresses). If <option>-t</option> is not present on the command line, any
60689 existing <emphasis>Bcc:</emphasis> is not removed.
60690 </para>
60691 </section>
60692 <section id="SECID223">
60693 <title>The Date: header line</title>
60694 <para>
60695 <indexterm role="concept">
60696 <primary><emphasis>Date:</emphasis> header line</primary>
60697 </indexterm>
60698 If a locally-generated or submission-mode message has no <emphasis>Date:</emphasis> header line,
60699 Exim adds one, using the current date and time, unless the
60700 <option>suppress_local_fixups</option> control has been specified.
60701 </para>
60702 </section>
60703 <section id="SECID224">
60704 <title>The Delivery-date: header line</title>
60705 <para>
60706 <indexterm role="concept">
60707 <primary><emphasis>Delivery-date:</emphasis> header line</primary>
60708 </indexterm>
60709 <indexterm role="option">
60710 <primary><option>delivery_date_remove</option></primary>
60711 </indexterm>
60712 <emphasis>Delivery-date:</emphasis> header lines are not part of the standard RFC 2822 header
60713 set. Exim can be configured to add them to the final delivery of messages. (See
60714 the generic <option>delivery_date_add</option> transport option.) They should not be present
60715 in messages in transit. If the <option>delivery_date_remove</option> configuration option is
60716 set (the default), Exim removes <emphasis>Delivery-date:</emphasis> header lines from incoming
60717 messages.
60718 </para>
60719 </section>
60720 <section id="SECID225">
60721 <title>The Envelope-to: header line</title>
60722 <para>
60723 <indexterm role="concept">
60724 <primary><emphasis>Envelope-to:</emphasis> header line</primary>
60725 </indexterm>
60726 <indexterm role="option">
60727 <primary><option>envelope_to_remove</option></primary>
60728 </indexterm>
60729 <emphasis>Envelope-to:</emphasis> header lines are not part of the standard RFC 2822 header set.
60730 Exim can be configured to add them to the final delivery of messages. (See the
60731 generic <option>envelope_to_add</option> transport option.) They should not be present in
60732 messages in transit. If the <option>envelope_to_remove</option> configuration option is set
60733 (the default), Exim removes <emphasis>Envelope-to:</emphasis> header lines from incoming
60734 messages.
60735 </para>
60736 </section>
60737 <section id="SECTthefrohea">
60738 <title>The From: header line</title>
60739 <para>
60740 <indexterm role="concept">
60741 <primary><emphasis>From:</emphasis> header line</primary>
60742 </indexterm>
60743 <indexterm role="concept">
60744 <primary>Sendmail compatibility</primary>
60745 <secondary><quote>From</quote> line</secondary>
60746 </indexterm>
60747 <indexterm role="concept">
60748 <primary>message</primary>
60749 <secondary>submission</secondary>
60750 </indexterm>
60751 <indexterm role="concept">
60752 <primary>submission mode</primary>
60753 </indexterm>
60754 If a submission-mode message does not contain a <emphasis>From:</emphasis> header line, Exim
60755 adds one if either of the following conditions is true:
60756 </para>
60757 <itemizedlist>
60758 <listitem>
60759 <para>
60760 The envelope sender address is not empty (that is, this is not a bounce
60761 message). The added header line copies the envelope sender address.
60762 </para>
60763 </listitem>
60764 <listitem>
60765 <para>
60766 <indexterm role="variable">
60767 <primary><varname>$authenticated_id</varname></primary>
60768 </indexterm>
60769 The SMTP session is authenticated and <varname>$authenticated_id</varname> is not empty.
60770 </para>
60771 <orderedlist numeration="arabic">
60772 <listitem>
60773 <para>
60774 <indexterm role="variable">
60775 <primary><varname>$qualify_domain</varname></primary>
60776 </indexterm>
60777 If no domain is specified by the submission control, the local part is
60778 <varname>$authenticated_id</varname> and the domain is <varname>$qualify_domain</varname>.
60779 </para>
60780 </listitem>
60781 <listitem>
60782 <para>
60783 If a non-empty domain is specified by the submission control, the local
60784 part is <varname>$authenticated_id</varname>, and the domain is the specified domain.
60785 </para>
60786 </listitem>
60787 <listitem>
60788 <para>
60789 If an empty domain is specified by the submission control,
60790 <varname>$authenticated_id</varname> is assumed to be the complete address.
60791 </para>
60792 </listitem>
60793 </orderedlist>
60794 </listitem>
60795 </itemizedlist>
60796 <para>
60797 A non-empty envelope sender takes precedence.
60798 </para>
60799 <para>
60800 If a locally-generated incoming message does not contain a <emphasis>From:</emphasis> header
60801 line, and the <option>suppress_local_fixups</option> control is not set, Exim adds one
60802 containing the sender&#x2019;s address. The calling user&#x2019;s login name and full name
60803 are used to construct the address, as described in section <xref linkend="SECTconstr"/>.
60804 They are obtained from the password data by calling <function>getpwuid()</function> (but see the
60805 <option>unknown_login</option> configuration option). The address is qualified with
60806 <option>qualify_domain</option>.
60807 </para>
60808 <para>
60809 For compatibility with Sendmail, if an incoming, non-SMTP message has a
60810 <emphasis>From:</emphasis> header line containing just the unqualified login name of the calling
60811 user, this is replaced by an address containing the user&#x2019;s login name and full
60812 name as described in section <xref linkend="SECTconstr"/>.
60813 </para>
60814 </section>
60815 <section id="SECID226">
60816 <title>The Message-ID: header line</title>
60817 <para>
60818 <indexterm role="concept">
60819 <primary><emphasis>Message-ID:</emphasis> header line</primary>
60820 </indexterm>
60821 <indexterm role="concept">
60822 <primary>message</primary>
60823 <secondary>submission</secondary>
60824 </indexterm>
60825 <indexterm role="option">
60826 <primary><option>message_id_header_text</option></primary>
60827 </indexterm>
60828 If a locally-generated or submission-mode incoming message does not contain a
60829 <emphasis>Message-ID:</emphasis> or <emphasis>Resent-Message-ID:</emphasis> header line, and the
60830 <option>suppress_local_fixups</option> control is not set, Exim adds a suitable header line
60831 to the message. If there are any <emphasis>Resent-:</emphasis> headers in the message, it
60832 creates <emphasis>Resent-Message-ID:</emphasis>. The id is constructed from Exim&#x2019;s internal
60833 message id, preceded by the letter E to ensure it starts with a letter, and
60834 followed by @ and the primary host name. Additional information can be included
60835 in this header line by setting the <option>message_id_header_text</option> and/or
60836 <option>message_id_header_domain</option> options.
60837 </para>
60838 </section>
60839 <section id="SECID227">
60840 <title>The Received: header line</title>
60841 <para>
60842 <indexterm role="concept">
60843 <primary><emphasis>Received:</emphasis> header line</primary>
60844 </indexterm>
60845 A <emphasis>Received:</emphasis> header line is added at the start of every message. The
60846 contents are defined by the <option>received_header_text</option> configuration option, and
60847 Exim automatically adds a semicolon and a timestamp to the configured string.
60848 </para>
60849 <para>
60850 The <emphasis>Received:</emphasis> header is generated as soon as the message&#x2019;s header lines
60851 have been received. At this stage, the timestamp in the <emphasis>Received:</emphasis> header
60852 line is the time that the message started to be received. This is the value
60853 that is seen by the DATA ACL and by the <function>local_scan()</function> function.
60854 </para>
60855 <para>
60856 Once a message is accepted, the timestamp in the <emphasis>Received:</emphasis> header line is
60857 changed to the time of acceptance, which is (apart from a small delay while the
60858 -H spool file is written) the earliest time at which delivery could start.
60859 </para>
60860 </section>
60861 <section id="SECID228">
60862 <title>The References: header line</title>
60863 <para>
60864 <indexterm role="concept">
60865 <primary><emphasis>References:</emphasis> header line</primary>
60866 </indexterm>
60867 Messages created by the <command>autoreply</command> transport include a <emphasis>References:</emphasis>
60868 header line. This is constructed according to the rules that are described in
60869 section 3.64 of RFC 2822 (which states that replies should contain such a
60870 header line), and section 3.14 of RFC 3834 (which states that automatic
60871 responses are not different in this respect). However, because some mail
60872 processing software does not cope well with very long header lines, no more
60873 than 12 message IDs are copied from the <emphasis>References:</emphasis> header line in the
60874 incoming message. If there are more than 12, the first one and then the final
60875 11 are copied, before adding the message ID of the incoming message.
60876 </para>
60877 </section>
60878 <section id="SECID229">
60879 <title>The Return-path: header line</title>
60880 <para>
60881 <indexterm role="concept">
60882 <primary><emphasis>Return-path:</emphasis> header line</primary>
60883 </indexterm>
60884 <indexterm role="option">
60885 <primary><option>return_path_remove</option></primary>
60886 </indexterm>
60887 <emphasis>Return-path:</emphasis> header lines are defined as something an MTA may insert when
60888 it does the final delivery of messages. (See the generic <option>return_path_add</option>
60889 transport option.) Therefore, they should not be present in messages in
60890 transit. If the <option>return_path_remove</option> configuration option is set (the
60891 default), Exim removes <emphasis>Return-path:</emphasis> header lines from incoming messages.
60892 </para>
60893 </section>
60894 <section id="SECTthesenhea">
60895 <title>The Sender: header line</title>
60896 <para>
60897 <indexterm role="concept">
60898 <primary><emphasis>Sender:</emphasis> header line</primary>
60899 </indexterm>
60900 <indexterm role="concept">
60901 <primary>message</primary>
60902 <secondary>submission</secondary>
60903 </indexterm>
60904 For a locally-originated message from an untrusted user, Exim may remove an
60905 existing <emphasis>Sender:</emphasis> header line, and it may add a new one. You can modify
60906 these actions by setting the <option>local_sender_retain</option> option true, the
60907 <option>local_from_check</option> option false, or by using the <option>suppress_local_fixups</option>
60908 control setting.
60909 </para>
60910 <para>
60911 When a local message is received from an untrusted user and
60912 <option>local_from_check</option> is true (the default), and the <option>suppress_local_fixups</option>
60913 control has not been set, a check is made to see if the address given in the
60914 <emphasis>From:</emphasis> header line is the correct (local) sender of the message. The address
60915 that is expected has the login name as the local part and the value of
60916 <option>qualify_domain</option> as the domain. Prefixes and suffixes for the local part can
60917 be permitted by setting <option>local_from_prefix</option> and <option>local_from_suffix</option>
60918 appropriately. If <emphasis>From:</emphasis> does not contain the correct sender, a <emphasis>Sender:</emphasis>
60919 line is added to the message.
60920 </para>
60921 <para>
60922 If you set <option>local_from_check</option> false, this checking does not occur. However,
60923 the removal of an existing <emphasis>Sender:</emphasis> line still happens, unless you also set
60924 <option>local_sender_retain</option> to be true. It is not possible to set both of these
60925 options true at the same time.
60926 </para>
60927 <para>
60928 <indexterm role="concept">
60929 <primary>submission mode</primary>
60930 </indexterm>
60931 By default, no processing of <emphasis>Sender:</emphasis> header lines is done for messages
60932 received over TCP/IP or for messages submitted by trusted users. However, when
60933 a message is received over TCP/IP in submission mode, and <option>sender_retain</option> is
60934 not specified on the submission control, the following processing takes place:
60935 </para>
60936 <para>
60937 <indexterm role="variable">
60938 <primary><varname>$authenticated_id</varname></primary>
60939 </indexterm>
60940 First, any existing <emphasis>Sender:</emphasis> lines are removed. Then, if the SMTP session is
60941 authenticated, and <varname>$authenticated_id</varname> is not empty, a sender address is
60942 created as follows:
60943 </para>
60944 <itemizedlist>
60945 <listitem>
60946 <para>
60947 <indexterm role="variable">
60948 <primary><varname>$qualify_domain</varname></primary>
60949 </indexterm>
60950 If no domain is specified by the submission control, the local part is
60951 <varname>$authenticated_id</varname> and the domain is <varname>$qualify_domain</varname>.
60952 </para>
60953 </listitem>
60954 <listitem>
60955 <para>
60956 If a non-empty domain is specified by the submission control, the local part
60957 is <varname>$authenticated_id</varname>, and the domain is the specified domain.
60958 </para>
60959 </listitem>
60960 <listitem>
60961 <para>
60962 If an empty domain is specified by the submission control,
60963 <varname>$authenticated_id</varname> is assumed to be the complete address.
60964 </para>
60965 </listitem>
60966 </itemizedlist>
60967 <para>
60968 This address is compared with the address in the <emphasis>From:</emphasis> header line. If they
60969 are different, a <emphasis>Sender:</emphasis> header line containing the created address is
60970 added. Prefixes and suffixes for the local part in <emphasis>From:</emphasis> can be permitted
60971 by setting <option>local_from_prefix</option> and <option>local_from_suffix</option> appropriately.
60972 </para>
60973 <para>
60974 <indexterm role="concept">
60975 <primary>return path</primary>
60976 <secondary>created from <emphasis>Sender:</emphasis></secondary>
60977 </indexterm>
60978 <emphasis role="bold">Note</emphasis>: Whenever a <emphasis>Sender:</emphasis> header line is created, the return path for
60979 the message (the envelope sender address) is changed to be the same address,
60980 except in the case of submission mode when <option>sender_retain</option> is specified.
60981 </para>
60982 </section>
60983 <section id="SECTheadersaddrem">
60984 <title>Adding and removing header lines in routers and transports</title>
60985 <para>
60986 <indexterm role="concept">
60987 <primary>header lines</primary>
60988 <secondary>adding; in router or transport</secondary>
60989 </indexterm>
60990 <indexterm role="concept">
60991 <primary>header lines</primary>
60992 <secondary>removing; in router or transport</secondary>
60993 </indexterm>
60994 When a message is delivered, the addition and removal of header lines can be
60995 specified in a system filter, or on any of the routers and transports that
60996 process the message. Section <xref linkend="SECTaddremheasys"/> contains details about
60997 modifying headers in a system filter. Header lines can also be added in an ACL
60998 as a message is received (see section <xref linkend="SECTaddheadacl"/>).
60999 </para>
61000 <para>
61001 In contrast to what happens in a system filter, header modifications that are
61002 specified on routers and transports apply only to the particular recipient
61003 addresses that are being processed by those routers and transports. These
61004 changes do not actually take place until a copy of the message is being
61005 transported. Therefore, they do not affect the basic set of header lines, and
61006 they do not affect the values of the variables that refer to header lines.
61007 </para>
61008 <para>
61009 <emphasis role="bold">Note</emphasis>: In particular, this means that any expansions in the configuration of
61010 the transport cannot refer to the modified header lines, because such
61011 expansions all occur before the message is actually transported.
61012 </para>
61013 <para>
61014 For both routers and transports, the argument of a <option>headers_add</option>
61015 option must be in the form of one or more RFC 2822 header lines, separated by
61016 newlines (coded as <quote>\n</quote>). For example:
61017 </para>
61018 <literallayout class="monospaced">
61019 headers_add = X-added-header: added by $primary_hostname\n\
61020               X-added-second: another added header line
61021 </literallayout>
61022 <para>
61023 Exim does not check the syntax of these added header lines.
61024 </para>
61025 <para>
61026 Multiple <option>headers_add</option> options for a single router or transport can be
61027 specified; the values will append to a single list of header lines.
61028 Each header-line is separately expanded.
61029 </para>
61030 <para>
61031 The argument of a <option>headers_remove</option> option must consist of a colon-separated
61032 list of header names. This is confusing, because header names themselves are
61033 often terminated by colons. In this case, the colons are the list separators,
61034 not part of the names. For example:
61035 </para>
61036 <literallayout class="monospaced">
61037 headers_remove = return-receipt-to:acknowledge-to
61038 </literallayout>
61039 <para>
61040 Multiple <option>headers_remove</option> options for a single router or transport can be
61041 specified; the arguments will append to a single header-names list.
61042 Each item is separately expanded.
61043 Note that colons in complex expansions which are used to
61044 form all or part of a <option>headers_remove</option> list
61045 will act as list separators.
61046 </para>
61047 <para>
61048 When <option>headers_add</option> or <option>headers_remove</option> is specified on a router,
61049 items are expanded at routing time,
61050 and then associated with all addresses that are
61051 accepted by that router, and also with any new addresses that it generates. If
61052 an address passes through several routers as a result of aliasing or
61053 forwarding, the changes are cumulative.
61054 </para>
61055 <para>
61056 <indexterm role="option">
61057 <primary><option>unseen</option></primary>
61058 </indexterm>
61059 However, this does not apply to multiple routers that result from the use of
61060 the <option>unseen</option> option. Any header modifications that were specified by the
61061 <quote>unseen</quote> router or its predecessors apply only to the <quote>unseen</quote> delivery.
61062 </para>
61063 <para>
61064 Addresses that end up with different <option>headers_add</option> or <option>headers_remove</option>
61065 settings cannot be delivered together in a batch, so a transport is always
61066 dealing with a set of addresses that have the same header-processing
61067 requirements.
61068 </para>
61069 <para>
61070 The transport starts by writing the original set of header lines that arrived
61071 with the message, possibly modified by the system filter. As it writes out
61072 these lines, it consults the list of header names that were attached to the
61073 recipient address(es) by <option>headers_remove</option> options in routers, and it also
61074 consults the transport&#x2019;s own <option>headers_remove</option> option. Header lines whose
61075 names are on either of these lists are not written out. If there are multiple
61076 instances of any listed header, they are all skipped.
61077 </para>
61078 <para>
61079 After the remaining original header lines have been written, new header
61080 lines that were specified by routers&#x2019; <option>headers_add</option> options are written, in
61081 the order in which they were attached to the address. These are followed by any
61082 header lines specified by the transport&#x2019;s <option>headers_add</option> option.
61083 </para>
61084 <para>
61085 This way of handling header line modifications in routers and transports has
61086 the following consequences:
61087 </para>
61088 <itemizedlist>
61089 <listitem>
61090 <para>
61091 The original set of header lines, possibly modified by the system filter,
61092 remains <quote>visible</quote>, in the sense that the <varname>$header_</varname><emphasis>xxx</emphasis> variables refer
61093 to it, at all times.
61094 </para>
61095 </listitem>
61096 <listitem>
61097 <para>
61098 Header lines that are added by a router&#x2019;s
61099 <option>headers_add</option> option are not accessible by means of the <varname>$header_</varname><emphasis>xxx</emphasis>
61100 expansion syntax in subsequent routers or the transport.
61101 </para>
61102 </listitem>
61103 <listitem>
61104 <para>
61105 Conversely, header lines that are specified for removal by <option>headers_remove</option>
61106 in a router remain visible to subsequent routers and the transport.
61107 </para>
61108 </listitem>
61109 <listitem>
61110 <para>
61111 Headers added to an address by <option>headers_add</option> in a router cannot be removed by
61112 a later router or by a transport.
61113 </para>
61114 </listitem>
61115 <listitem>
61116 <para>
61117 An added header can refer to the contents of an original header that is to be
61118 removed, even it has the same name as the added header. For example:
61119 </para>
61120 <literallayout class="monospaced">
61121 headers_remove = subject
61122 headers_add = Subject: new subject (was: $h_subject:)
61123 </literallayout>
61124 </listitem>
61125 </itemizedlist>
61126 <para>
61127 <emphasis role="bold">Warning</emphasis>: The <option>headers_add</option> and <option>headers_remove</option> options cannot be used
61128 for a <command>redirect</command> router that has the <option>one_time</option> option set.
61129 </para>
61130 </section>
61131 <section id="SECTconstr">
61132 <title>Constructed addresses</title>
61133 <para>
61134 <indexterm role="concept">
61135 <primary>address</primary>
61136 <secondary>constructed</secondary>
61137 </indexterm>
61138 <indexterm role="concept">
61139 <primary>constructed address</primary>
61140 </indexterm>
61141 When Exim constructs a sender address for a locally-generated message, it uses
61142 the form
61143 </para>
61144 <literallayout>
61145 &lt;<emphasis>user name</emphasis>&gt;&nbsp;&nbsp;&lt;<emphasis>login</emphasis><literal>@</literal><emphasis>qualify_domain</emphasis>&gt;
61146 </literallayout>
61147 <para>
61148 For example:
61149 </para>
61150 <literallayout class="monospaced">
61151 Zaphod Beeblebrox &lt;zaphod@end.univ.example&gt;
61152 </literallayout>
61153 <para>
61154 The user name is obtained from the <option>-F</option> command line option if set, or
61155 otherwise by looking up the calling user by <function>getpwuid()</function> and extracting the
61156 <quote>gecos</quote> field from the password entry. If the <quote>gecos</quote> field contains an
61157 ampersand character, this is replaced by the login name with the first letter
61158 upper cased, as is conventional in a number of operating systems. See the
61159 <option>gecos_name</option> option for a way to tailor the handling of the <quote>gecos</quote> field.
61160 The <option>unknown_username</option> option can be used to specify user names in cases when
61161 there is no password file entry.
61162 </para>
61163 <para>
61164 <indexterm role="concept">
61165 <primary>RFC 2047</primary>
61166 </indexterm>
61167 In all cases, the user name is made to conform to RFC 2822 by quoting all or
61168 parts of it if necessary. In addition, if it contains any non-printing
61169 characters, it is encoded as described in RFC 2047, which defines a way of
61170 including non-ASCII characters in header lines. The value of the
61171 <option>headers_charset</option> option specifies the name of the encoding that is used (the
61172 characters are assumed to be in this encoding). The setting of
61173 <option>print_topbitchars</option> controls whether characters with the top bit set (that
61174 is, with codes greater than 127) count as printing characters or not.
61175 </para>
61176 </section>
61177 <section id="SECID230">
61178 <title>Case of local parts</title>
61179 <para>
61180 <indexterm role="concept">
61181 <primary>case of local parts</primary>
61182 </indexterm>
61183 <indexterm role="concept">
61184 <primary>local part</primary>
61185 <secondary>case of</secondary>
61186 </indexterm>
61187 RFC 2822 states that the case of letters in the local parts of addresses cannot
61188 be assumed to be non-significant. Exim preserves the case of local parts of
61189 addresses, but by default it uses a lower-cased form when it is routing,
61190 because on most Unix systems, usernames are in lower case and case-insensitive
61191 routing is required. However, any particular router can be made to use the
61192 original case for local parts by setting the <option>caseful_local_part</option> generic
61193 router option.
61194 </para>
61195 <para>
61196 <indexterm role="concept">
61197 <primary>mixed-case login names</primary>
61198 </indexterm>
61199 If you must have mixed-case user names on your system, the best way to proceed,
61200 assuming you want case-independent handling of incoming email, is to set up
61201 your first router to convert incoming local parts in your domains to the
61202 correct case by means of a file lookup. For example:
61203 </para>
61204 <literallayout class="monospaced">
61205 correct_case:
61206   driver = redirect
61207   domains = +local_domains
61208   data = ${lookup{$local_part}cdb\
61209               {/etc/usercased.cdb}{$value}fail}\
61210               @$domain
61211 </literallayout>
61212 <para>
61213 For this router, the local part is forced to lower case by the default action
61214 (<option>caseful_local_part</option> is not set). The lower-cased local part is used to look
61215 up a new local part in the correct case. If you then set <option>caseful_local_part</option>
61216 on any subsequent routers which process your domains, they will operate on
61217 local parts with the correct case in a case-sensitive manner.
61218 </para>
61219 </section>
61220 <section id="SECID231">
61221 <title>Dots in local parts</title>
61222 <para>
61223 <indexterm role="concept">
61224 <primary>dot</primary>
61225 <secondary>in local part</secondary>
61226 </indexterm>
61227 <indexterm role="concept">
61228 <primary>local part</primary>
61229 <secondary>dots in</secondary>
61230 </indexterm>
61231 RFC 2822 forbids empty components in local parts. That is, an unquoted local
61232 part may not begin or end with a dot, nor have two consecutive dots in the
61233 middle. However, it seems that many MTAs do not enforce this, so Exim permits
61234 empty components for compatibility.
61235 </para>
61236 </section>
61237 <section id="SECID232">
61238 <title>Rewriting addresses</title>
61239 <para>
61240 <indexterm role="concept">
61241 <primary>rewriting</primary>
61242 <secondary>addresses</secondary>
61243 </indexterm>
61244 Rewriting of sender and recipient addresses, and addresses in headers, can
61245 happen automatically, or as the result of configuration options, as described
61246 in chapter <xref linkend="CHAPrewrite"/>. The headers that may be affected by this are
61247 <emphasis>Bcc:</emphasis>, <emphasis>Cc:</emphasis>, <emphasis>From:</emphasis>, <emphasis>Reply-To:</emphasis>, <emphasis>Sender:</emphasis>, and <emphasis>To:</emphasis>.
61248 </para>
61249 <para>
61250 Automatic rewriting includes qualification, as mentioned above. The other case
61251 in which it can happen is when an incomplete non-local domain is given. The
61252 routing process may cause this to be expanded into the full domain name. For
61253 example, a header such as
61254 </para>
61255 <literallayout class="monospaced">
61256 To: hare@teaparty
61257 </literallayout>
61258 <para>
61259 might get rewritten as
61260 </para>
61261 <literallayout class="monospaced">
61262 To: hare@teaparty.wonderland.fict.example
61263 </literallayout>
61264 <para>
61265 Rewriting as a result of routing is the one kind of message processing that
61266 does not happen at input time, as it cannot be done until the address has
61267 been routed.
61268 </para>
61269 <para>
61270 Strictly, one should not do <emphasis>any</emphasis> deliveries of a message until all its
61271 addresses have been routed, in case any of the headers get changed as a
61272 result of routing. However, doing this in practice would hold up many
61273 deliveries for unreasonable amounts of time, just because one address could not
61274 immediately be routed. Exim therefore does not delay other deliveries when
61275 routing of one or more addresses is deferred.
61276 <indexterm role="concept" startref="IIDmesproc" class="endofrange"/>
61277 </para>
61278 </section>
61279 </chapter>
61280
61281 <chapter id="CHAPSMTP">
61282 <title>SMTP processing</title>
61283 <para>
61284 <indexterm role="concept" id="IIDsmtpproc1" class="startofrange">
61285 <primary>SMTP</primary>
61286 <secondary>processing details</secondary>
61287 </indexterm>
61288 <indexterm role="concept" id="IIDsmtpproc2" class="startofrange">
61289 <primary>LMTP</primary>
61290 <secondary>processing details</secondary>
61291 </indexterm>
61292 Exim supports a number of different ways of using the SMTP protocol, and its
61293 LMTP variant, which is an interactive protocol for transferring messages into a
61294 closed mail store application. This chapter contains details of how SMTP is
61295 processed. For incoming mail, the following are available:
61296 </para>
61297 <itemizedlist>
61298 <listitem>
61299 <para>
61300 SMTP over TCP/IP (Exim daemon or <emphasis>inetd</emphasis>);
61301 </para>
61302 </listitem>
61303 <listitem>
61304 <para>
61305 SMTP over the standard input and output (the <option>-bs</option> option);
61306 </para>
61307 </listitem>
61308 <listitem>
61309 <para>
61310 Batched SMTP on the standard input (the <option>-bS</option> option).
61311 </para>
61312 </listitem>
61313 </itemizedlist>
61314 <para>
61315 For mail delivery, the following are available:
61316 </para>
61317 <itemizedlist>
61318 <listitem>
61319 <para>
61320 SMTP over TCP/IP (the <command>smtp</command> transport);
61321 </para>
61322 </listitem>
61323 <listitem>
61324 <para>
61325 LMTP over TCP/IP (the <command>smtp</command> transport with the <option>protocol</option> option set to
61326 <quote>lmtp</quote>);
61327 </para>
61328 </listitem>
61329 <listitem>
61330 <para>
61331 LMTP over a pipe to a process running in the local host (the <command>lmtp</command>
61332 transport);
61333 </para>
61334 </listitem>
61335 <listitem>
61336 <para>
61337 Batched SMTP to a file or pipe (the <command>appendfile</command> and <command>pipe</command> transports with
61338 the <option>use_bsmtp</option> option set).
61339 </para>
61340 </listitem>
61341 </itemizedlist>
61342 <para>
61343 <emphasis>Batched SMTP</emphasis> is the name for a process in which batches of messages are
61344 stored in or read from files (or pipes), in a format in which SMTP commands are
61345 used to contain the envelope information.
61346 </para>
61347 <section id="SECToutSMTPTCP">
61348 <title>Outgoing SMTP and LMTP over TCP/IP</title>
61349 <para>
61350 <indexterm role="concept">
61351 <primary>SMTP</primary>
61352 <secondary>outgoing over TCP/IP</secondary>
61353 </indexterm>
61354 <indexterm role="concept">
61355 <primary>outgoing SMTP over TCP/IP</primary>
61356 </indexterm>
61357 <indexterm role="concept">
61358 <primary>LMTP</primary>
61359 <secondary>over TCP/IP</secondary>
61360 </indexterm>
61361 <indexterm role="concept">
61362 <primary>outgoing LMTP over TCP/IP</primary>
61363 </indexterm>
61364 <indexterm role="concept">
61365 <primary>EHLO</primary>
61366 </indexterm>
61367 <indexterm role="concept">
61368 <primary>HELO</primary>
61369 </indexterm>
61370 <indexterm role="concept">
61371 <primary>SIZE option on MAIL command</primary>
61372 </indexterm>
61373 Outgoing SMTP and LMTP over TCP/IP is implemented by the <command>smtp</command> transport.
61374 The <option>protocol</option> option selects which protocol is to be used, but the actual
61375 processing is the same in both cases.
61376 </para>
61377 <para>
61378 If, in response to its EHLO command, Exim is told that the SIZE
61379 parameter is supported, it adds SIZE=&lt;<emphasis>n</emphasis>&gt; to each subsequent MAIL
61380 command. The value of &lt;<emphasis>n</emphasis>&gt; is the message size plus the value of the
61381 <option>size_addition</option> option (default 1024) to allow for additions to the message
61382 such as per-transport header lines, or changes made in a
61383 <indexterm role="concept">
61384 <primary>transport</primary>
61385 <secondary>filter</secondary>
61386 </indexterm>
61387 <indexterm role="concept">
61388 <primary>filter</primary>
61389 <secondary>transport filter</secondary>
61390 </indexterm>
61391 transport filter. If <option>size_addition</option> is set negative, the use of SIZE is
61392 suppressed.
61393 </para>
61394 <para>
61395 If the remote server advertises support for PIPELINING, Exim uses the
61396 pipelining extension to SMTP (RFC 2197) to reduce the number of TCP/IP packets
61397 required for the transaction.
61398 </para>
61399 <para>
61400 If the remote server advertises support for the STARTTLS command, and Exim
61401 was built to support TLS encryption, it tries to start a TLS session unless the
61402 server matches <option>hosts_avoid_tls</option>. See chapter <xref linkend="CHAPTLS"/> for more details.
61403 Either a match in that or <option>hosts_verify_avoid_tls</option> apply when the transport
61404 is called for verification.
61405 </para>
61406 <para>
61407 If the remote server advertises support for the AUTH command, Exim scans
61408 the authenticators configuration for any suitable client settings, as described
61409 in chapter <xref linkend="CHAPSMTPAUTH"/>.
61410 </para>
61411 <para>
61412 <indexterm role="concept">
61413 <primary>carriage return</primary>
61414 </indexterm>
61415 <indexterm role="concept">
61416 <primary>linefeed</primary>
61417 </indexterm>
61418 Responses from the remote host are supposed to be terminated by CR followed by
61419 LF. However, there are known to be hosts that do not send CR characters, so in
61420 order to be able to interwork with such hosts, Exim treats LF on its own as a
61421 line terminator.
61422 </para>
61423 <para>
61424 If a message contains a number of different addresses, all those with the same
61425 characteristics (for example, the same envelope sender) that resolve to the
61426 same set of hosts, in the same order, are sent in a single SMTP transaction,
61427 even if they are for different domains, unless there are more than the setting
61428 of the <option>max_rcpt</option>s option in the <command>smtp</command> transport allows, in which case
61429 they are split into groups containing no more than <option>max_rcpt</option>s addresses
61430 each. If <option>remote_max_parallel</option> is greater than one, such groups may be sent
61431 in parallel sessions. The order of hosts with identical MX values is not
61432 significant when checking whether addresses can be batched in this way.
61433 </para>
61434 <para>
61435 When the <command>smtp</command> transport suffers a temporary failure that is not
61436 message-related, Exim updates its transport-specific database, which contains
61437 records indexed by host name that remember which messages are waiting for each
61438 particular host. It also updates the retry database with new retry times.
61439 </para>
61440 <para>
61441 <indexterm role="concept">
61442 <primary>hints database</primary>
61443 <secondary>retry keys</secondary>
61444 </indexterm>
61445 Exim&#x2019;s retry hints are based on host name plus IP address, so if one address of
61446 a multi-homed host is broken, it will soon be skipped most of the time.
61447 See the next section for more detail about error handling.
61448 </para>
61449 <para>
61450 <indexterm role="concept">
61451 <primary>SMTP</primary>
61452 <secondary>passed connection</secondary>
61453 </indexterm>
61454 <indexterm role="concept">
61455 <primary>SMTP</primary>
61456 <secondary>batching over TCP/IP</secondary>
61457 </indexterm>
61458 When a message is successfully delivered over a TCP/IP SMTP connection, Exim
61459 looks in the hints database for the transport to see if there are any queued
61460 messages waiting for the host to which it is connected. If it finds one, it
61461 creates a new Exim process using the <option>-MC</option> option (which can only be used by
61462 a process running as root or the Exim user) and passes the TCP/IP socket to it
61463 so that it can deliver another message using the same socket. The new process
61464 does only those deliveries that are routed to the connected host, and may in
61465 turn pass the socket on to a third process, and so on.
61466 </para>
61467 <para>
61468 The <option>connection_max_messages</option> option of the <command>smtp</command> transport can be used to
61469 limit the number of messages sent down a single TCP/IP connection.
61470 </para>
61471 <para>
61472 <indexterm role="concept">
61473 <primary>asterisk</primary>
61474 <secondary>after IP address</secondary>
61475 </indexterm>
61476 The second and subsequent messages delivered down an existing connection are
61477 identified in the main log by the addition of an asterisk after the closing
61478 square bracket of the IP address.
61479 </para>
61480 </section>
61481 <section id="SECToutSMTPerr">
61482 <title>Errors in outgoing SMTP</title>
61483 <para>
61484 <indexterm role="concept">
61485 <primary>error</primary>
61486 <secondary>in outgoing SMTP</secondary>
61487 </indexterm>
61488 <indexterm role="concept">
61489 <primary>SMTP</primary>
61490 <secondary>errors in outgoing</secondary>
61491 </indexterm>
61492 <indexterm role="concept">
61493 <primary>host</primary>
61494 <secondary>error</secondary>
61495 </indexterm>
61496 Three different kinds of error are recognized for outgoing SMTP: host errors,
61497 message errors, and recipient errors.
61498 </para>
61499 <variablelist>
61500 <varlistentry>
61501 <term><emphasis role="bold">Host errors</emphasis></term>
61502 <listitem>
61503 <para>
61504 A host error is not associated with a particular message or with a
61505 particular recipient of a message. The host errors are:
61506 </para>
61507 <itemizedlist>
61508 <listitem>
61509 <para>
61510 Connection refused or timed out,
61511 </para>
61512 </listitem>
61513 <listitem>
61514 <para>
61515 Any error response code on connection,
61516 </para>
61517 </listitem>
61518 <listitem>
61519 <para>
61520 Any error response code to EHLO or HELO,
61521 </para>
61522 </listitem>
61523 <listitem>
61524 <para>
61525 Loss of connection at any time, except after <quote>.</quote>,
61526 </para>
61527 </listitem>
61528 <listitem>
61529 <para>
61530 I/O errors at any time,
61531 </para>
61532 </listitem>
61533 <listitem>
61534 <para>
61535 Timeouts during the session, other than in response to MAIL, RCPT or
61536 the <quote>.</quote> at the end of the data.
61537 </para>
61538 </listitem>
61539 </itemizedlist>
61540 <para>
61541 For a host error, a permanent error response on connection, or in response to
61542 EHLO, causes all addresses routed to the host to be failed. Any other host
61543 error causes all addresses to be deferred, and retry data to be created for the
61544 host. It is not tried again, for any message, until its retry time arrives. If
61545 the current set of addresses are not all delivered in this run (to some
61546 alternative host), the message is added to the list of those waiting for this
61547 host, so if it is still undelivered when a subsequent successful delivery is
61548 made to the host, it will be sent down the same SMTP connection.
61549 </para>
61550 </listitem></varlistentry>
61551 <varlistentry>
61552 <term><emphasis role="bold">Message errors</emphasis></term>
61553 <listitem>
61554 <para>
61555 <indexterm role="concept">
61556 <primary>message</primary>
61557 <secondary>error</secondary>
61558 </indexterm>
61559 A message error is associated with a particular message when sent to a
61560 particular host, but not with a particular recipient of the message. The
61561 message errors are:
61562 </para>
61563 <itemizedlist>
61564 <listitem>
61565 <para>
61566 Any error response code to MAIL, DATA, or the <quote>.</quote> that terminates
61567 the data,
61568 </para>
61569 </listitem>
61570 <listitem>
61571 <para>
61572 Timeout after MAIL,
61573 </para>
61574 </listitem>
61575 <listitem>
61576 <para>
61577 Timeout or loss of connection after the <quote>.</quote> that terminates the data. A
61578 timeout after the DATA command itself is treated as a host error, as is loss of
61579 connection at any other time.
61580 </para>
61581 </listitem>
61582 </itemizedlist>
61583 <para>
61584 For a message error, a permanent error response (5<emphasis>xx</emphasis>) causes all addresses
61585 to be failed, and a delivery error report to be returned to the sender. A
61586 temporary error response (4<emphasis>xx</emphasis>), or one of the timeouts, causes all
61587 addresses to be deferred. Retry data is not created for the host, but instead,
61588 a retry record for the combination of host plus message id is created. The
61589 message is not added to the list of those waiting for this host. This ensures
61590 that the failing message will not be sent to this host again until the retry
61591 time arrives. However, other messages that are routed to the host are not
61592 affected, so if it is some property of the message that is causing the error,
61593 it will not stop the delivery of other mail.
61594 </para>
61595 <para>
61596 If the remote host specified support for the SIZE parameter in its response
61597 to EHLO, Exim adds SIZE=<emphasis>nnn</emphasis> to the MAIL command, so an
61598 over-large message will cause a message error because the error arrives as a
61599 response to MAIL.
61600 </para>
61601 </listitem></varlistentry>
61602 <varlistentry>
61603 <term><emphasis role="bold">Recipient errors</emphasis></term>
61604 <listitem>
61605 <para>
61606 <indexterm role="concept">
61607 <primary>recipient</primary>
61608 <secondary>error</secondary>
61609 </indexterm>
61610 A recipient error is associated with a particular recipient of a message. The
61611 recipient errors are:
61612 </para>
61613 <itemizedlist>
61614 <listitem>
61615 <para>
61616 Any error response to RCPT,
61617 </para>
61618 </listitem>
61619 <listitem>
61620 <para>
61621 Timeout after RCPT.
61622 </para>
61623 </listitem>
61624 </itemizedlist>
61625 <para>
61626 For a recipient error, a permanent error response (5<emphasis>xx</emphasis>) causes the
61627 recipient address to be failed, and a bounce message to be returned to the
61628 sender. A temporary error response (4<emphasis>xx</emphasis>) or a timeout causes the failing
61629 address to be deferred, and routing retry data to be created for it. This is
61630 used to delay processing of the address in subsequent queue runs, until its
61631 routing retry time arrives. This applies to all messages, but because it
61632 operates only in queue runs, one attempt will be made to deliver a new message
61633 to the failing address before the delay starts to operate. This ensures that,
61634 if the failure is really related to the message rather than the recipient
61635 (<quote>message too big for this recipient</quote> is a possible example), other messages
61636 have a chance of getting delivered. If a delivery to the address does succeed,
61637 the retry information gets cleared, so all stuck messages get tried again, and
61638 the retry clock is reset.
61639 </para>
61640 <para>
61641 The message is not added to the list of those waiting for this host. Use of the
61642 host for other messages is unaffected, and except in the case of a timeout,
61643 other recipients are processed independently, and may be successfully delivered
61644 in the current SMTP session. After a timeout it is of course impossible to
61645 proceed with the session, so all addresses get deferred. However, those other
61646 than the one that failed do not suffer any subsequent retry delays. Therefore,
61647 if one recipient is causing trouble, the others have a chance of getting
61648 through when a subsequent delivery attempt occurs before the failing
61649 recipient&#x2019;s retry time.
61650 </para>
61651 </listitem></varlistentry>
61652 </variablelist>
61653 <para>
61654 In all cases, if there are other hosts (or IP addresses) available for the
61655 current set of addresses (for example, from multiple MX records), they are
61656 tried in this run for any undelivered addresses, subject of course to their
61657 own retry data. In other words, recipient error retry data does not take effect
61658 until the next delivery attempt.
61659 </para>
61660 <para>
61661 Some hosts have been observed to give temporary error responses to every
61662 MAIL command at certain times (<quote>insufficient space</quote> has been seen). It
61663 would be nice if such circumstances could be recognized, and defer data for the
61664 host itself created, but this is not possible within the current Exim design.
61665 What actually happens is that retry data for every (host, message) combination
61666 is created.
61667 </para>
61668 <para>
61669 The reason that timeouts after MAIL and RCPT are treated specially is that
61670 these can sometimes arise as a result of the remote host&#x2019;s verification
61671 procedures. Exim makes this assumption, and treats them as if a temporary error
61672 response had been received. A timeout after <quote>.</quote> is treated specially because
61673 it is known that some broken implementations fail to recognize the end of the
61674 message if the last character of the last line is a binary zero. Thus, it is
61675 helpful to treat this case as a message error.
61676 </para>
61677 <para>
61678 Timeouts at other times are treated as host errors, assuming a problem with the
61679 host, or the connection to it. If a timeout after MAIL, RCPT,
61680 or <quote>.</quote> is really a connection problem, the assumption is that at the next try
61681 the timeout is likely to occur at some other point in the dialogue, causing it
61682 then to be treated as a host error.
61683 </para>
61684 <para>
61685 There is experimental evidence that some MTAs drop the connection after the
61686 terminating <quote>.</quote> if they do not like the contents of the message for some
61687 reason, in contravention of the RFC, which indicates that a 5<emphasis>xx</emphasis> response
61688 should be given. That is why Exim treats this case as a message rather than a
61689 host error, in order not to delay other messages to the same host.
61690 </para>
61691 </section>
61692 <section id="SECID233">
61693 <title>Incoming SMTP messages over TCP/IP</title>
61694 <para>
61695 <indexterm role="concept">
61696 <primary>SMTP</primary>
61697 <secondary>incoming over TCP/IP</secondary>
61698 </indexterm>
61699 <indexterm role="concept">
61700 <primary>incoming SMTP over TCP/IP</primary>
61701 </indexterm>
61702 <indexterm role="concept">
61703 <primary>inetd</primary>
61704 </indexterm>
61705 <indexterm role="concept">
61706 <primary>daemon</primary>
61707 </indexterm>
61708 Incoming SMTP messages can be accepted in one of two ways: by running a
61709 listening daemon, or by using <emphasis>inetd</emphasis>. In the latter case, the entry in
61710 <filename>/etc/inetd.conf</filename> should be like this:
61711 </para>
61712 <literallayout class="monospaced">
61713 smtp stream tcp nowait exim /opt/exim/bin/exim in.exim -bs
61714 </literallayout>
61715 <para>
61716 Exim distinguishes between this case and the case of a locally running user
61717 agent using the <option>-bs</option> option by checking whether or not the standard input is
61718 a socket. When it is, either the port must be privileged (less than 1024), or
61719 the caller must be root or the Exim user. If any other user passes a socket
61720 with an unprivileged port number, Exim prints a message on the standard error
61721 stream and exits with an error code.
61722 </para>
61723 <para>
61724 By default, Exim does not make a log entry when a remote host connects or
61725 disconnects (either via the daemon or <emphasis>inetd</emphasis>), unless the disconnection is
61726 unexpected. It can be made to write such log entries by setting the
61727 <option>smtp_connection</option> log selector.
61728 </para>
61729 <para>
61730 <indexterm role="concept">
61731 <primary>carriage return</primary>
61732 </indexterm>
61733 <indexterm role="concept">
61734 <primary>linefeed</primary>
61735 </indexterm>
61736 Commands from the remote host are supposed to be terminated by CR followed by
61737 LF. However, there are known to be hosts that do not send CR characters. In
61738 order to be able to interwork with such hosts, Exim treats LF on its own as a
61739 line terminator.
61740 Furthermore, because common code is used for receiving messages from all
61741 sources, a CR on its own is also interpreted as a line terminator. However, the
61742 sequence <quote>CR, dot, CR</quote> does not terminate incoming SMTP data.
61743 </para>
61744 <para>
61745 <indexterm role="concept">
61746 <primary>EHLO</primary>
61747 <secondary>invalid data</secondary>
61748 </indexterm>
61749 <indexterm role="concept">
61750 <primary>HELO</primary>
61751 <secondary>invalid data</secondary>
61752 </indexterm>
61753 One area that sometimes gives rise to problems concerns the EHLO or
61754 HELO commands. Some clients send syntactically invalid versions of these
61755 commands, which Exim rejects by default. (This is nothing to do with verifying
61756 the data that is sent, so <option>helo_verify_hosts</option> is not relevant.) You can tell
61757 Exim not to apply a syntax check by setting <option>helo_accept_junk_hosts</option> to
61758 match the broken hosts that send invalid commands.
61759 </para>
61760 <para>
61761 <indexterm role="concept">
61762 <primary>SIZE option on MAIL command</primary>
61763 </indexterm>
61764 <indexterm role="concept">
61765 <primary>MAIL</primary>
61766 <secondary>SIZE option</secondary>
61767 </indexterm>
61768 The amount of disk space available is checked whenever SIZE is received on
61769 a MAIL command, independently of whether <option>message_size_limit</option> or
61770 <option>check_spool_space</option> is configured, unless <option>smtp_check_spool_space</option> is set
61771 false. A temporary error is given if there is not enough space. If
61772 <option>check_spool_space</option> is set, the check is for that amount of space plus the
61773 value given with SIZE, that is, it checks that the addition of the incoming
61774 message will not reduce the space below the threshold.
61775 </para>
61776 <para>
61777 When a message is successfully received, Exim includes the local message id in
61778 its response to the final <quote>.</quote> that terminates the data. If the remote host
61779 logs this text it can help with tracing what has happened to a message.
61780 </para>
61781 <para>
61782 The Exim daemon can limit the number of simultaneous incoming connections it is
61783 prepared to handle (see the <option>smtp_accept_max</option> option). It can also limit the
61784 number of simultaneous incoming connections from a single remote host (see the
61785 <option>smtp_accept_max_per_host</option> option). Additional connection attempts are
61786 rejected using the SMTP temporary error code 421.
61787 </para>
61788 <para>
61789 The Exim daemon does not rely on the SIGCHLD signal to detect when a
61790 subprocess has finished, as this can get lost at busy times. Instead, it looks
61791 for completed subprocesses every time it wakes up. Provided there are other
61792 things happening (new incoming calls, starts of queue runs), completed
61793 processes will be noticed and tidied away. On very quiet systems you may
61794 sometimes see a <quote>defunct</quote> Exim process hanging about. This is not a problem;
61795 it will be noticed when the daemon next wakes up.
61796 </para>
61797 <para>
61798 When running as a daemon, Exim can reserve some SMTP slots for specific hosts,
61799 and can also be set up to reject SMTP calls from non-reserved hosts at times of
61800 high system load &ndash; for details see the <option>smtp_accept_reserve</option>,
61801 <option>smtp_load_reserve</option>, and <option>smtp_reserve_hosts</option> options. The load check
61802 applies in both the daemon and <emphasis>inetd</emphasis> cases.
61803 </para>
61804 <para>
61805 Exim normally starts a delivery process for each message received, though this
61806 can be varied by means of the <option>-odq</option> command line option and the
61807 <option>queue_only</option>, <option>queue_only_file</option>, and <option>queue_only_load</option> options. The
61808 number of simultaneously running delivery processes started in this way from
61809 SMTP input can be limited by the <option>smtp_accept_queue</option> and
61810 <option>smtp_accept_queue_per_connection</option> options. When either limit is reached,
61811 subsequently received messages are just put on the input queue without starting
61812 a delivery process.
61813 </para>
61814 <para>
61815 The controls that involve counts of incoming SMTP calls (<option>smtp_accept_max</option>,
61816 <option>smtp_accept_queue</option>, <option>smtp_accept_reserve</option>) are not available when Exim is
61817 started up from the <emphasis>inetd</emphasis> daemon, because in that case each connection is
61818 handled by an entirely independent Exim process. Control by load average is,
61819 however, available with <emphasis>inetd</emphasis>.
61820 </para>
61821 <para>
61822 Exim can be configured to verify addresses in incoming SMTP commands as they
61823 are received. See chapter <xref linkend="CHAPACL"/> for details. It can also be configured
61824 to rewrite addresses at this time &ndash; before any syntax checking is done. See
61825 section <xref linkend="SECTrewriteS"/>.
61826 </para>
61827 <para>
61828 Exim can also be configured to limit the rate at which a client host submits
61829 MAIL and RCPT commands in a single SMTP session. See the
61830 <option>smtp_ratelimit_hosts</option> option.
61831 </para>
61832 </section>
61833 <section id="SECID234">
61834 <title>Unrecognized SMTP commands</title>
61835 <para>
61836 <indexterm role="concept">
61837 <primary>SMTP</primary>
61838 <secondary>unrecognized commands</secondary>
61839 </indexterm>
61840 If Exim receives more than <option>smtp_max_unknown_commands</option> unrecognized SMTP
61841 commands during a single SMTP connection, it drops the connection after sending
61842 the error response to the last command. The default value for
61843 <option>smtp_max_unknown_commands</option> is 3. This is a defence against some kinds of
61844 abuse that subvert web servers into making connections to SMTP ports; in these
61845 circumstances, a number of non-SMTP lines are sent first.
61846 </para>
61847 </section>
61848 <section id="SECID235">
61849 <title>Syntax and protocol errors in SMTP commands</title>
61850 <para>
61851 <indexterm role="concept">
61852 <primary>SMTP</primary>
61853 <secondary>syntax errors</secondary>
61854 </indexterm>
61855 <indexterm role="concept">
61856 <primary>SMTP</primary>
61857 <secondary>protocol errors</secondary>
61858 </indexterm>
61859 A syntax error is detected if an SMTP command is recognized, but there is
61860 something syntactically wrong with its data, for example, a malformed email
61861 address in a RCPT command. Protocol errors include invalid command
61862 sequencing such as RCPT before MAIL. If Exim receives more than
61863 <option>smtp_max_synprot_errors</option> such commands during a single SMTP connection, it
61864 drops the connection after sending the error response to the last command. The
61865 default value for <option>smtp_max_synprot_errors</option> is 3. This is a defence against
61866 broken clients that loop sending bad commands (yes, it has been seen).
61867 </para>
61868 </section>
61869 <section id="SECID236">
61870 <title>Use of non-mail SMTP commands</title>
61871 <para>
61872 <indexterm role="concept">
61873 <primary>SMTP</primary>
61874 <secondary>non-mail commands</secondary>
61875 </indexterm>
61876 The <quote>non-mail</quote> SMTP commands are those other than MAIL, RCPT, and
61877 DATA. Exim counts such commands, and drops the connection if there are too
61878 many of them in a single SMTP session. This action catches some
61879 denial-of-service attempts and things like repeated failing AUTHs, or a mad
61880 client looping sending EHLO. The global option <option>smtp_accept_max_nonmail</option>
61881 defines what <quote>too many</quote> means. Its default value is 10.
61882 </para>
61883 <para>
61884 When a new message is expected, one occurrence of RSET is not counted. This
61885 allows a client to send one RSET between messages (this is not necessary,
61886 but some clients do it). Exim also allows one uncounted occurrence of HELO
61887 or EHLO, and one occurrence of STARTTLS between messages. After
61888 starting up a TLS session, another EHLO is expected, and so it too is not
61889 counted.
61890 </para>
61891 <para>
61892 The first occurrence of AUTH in a connection, or immediately following
61893 STARTTLS is also not counted. Otherwise, all commands other than MAIL,
61894 RCPT, DATA, and QUIT are counted.
61895 </para>
61896 <para>
61897 You can control which hosts are subject to the limit set by
61898 <option>smtp_accept_max_nonmail</option> by setting
61899 <option>smtp_accept_max_nonmail_hosts</option>. The default value is <literal>*</literal>, which makes
61900 the limit apply to all hosts. This option means that you can exclude any
61901 specific badly-behaved hosts that you have to live with.
61902 </para>
61903 </section>
61904 <section id="SECID237">
61905 <title>The VRFY and EXPN commands</title>
61906 <para>
61907 When Exim receives a VRFY or EXPN command on a TCP/IP connection, it
61908 runs the ACL specified by <option>acl_smtp_vrfy</option> or <option>acl_smtp_expn</option> (as
61909 appropriate) in order to decide whether the command should be accepted or not.
61910 If no ACL is defined, the command is rejected.
61911 </para>
61912 <para>
61913 <indexterm role="concept">
61914 <primary>VRFY</primary>
61915 <secondary>processing</secondary>
61916 </indexterm>
61917 When VRFY is accepted, it runs exactly the same code as when Exim is
61918 called with the <option>-bv</option> option.
61919 </para>
61920 <para>
61921 <indexterm role="concept">
61922 <primary>EXPN</primary>
61923 <secondary>processing</secondary>
61924 </indexterm>
61925 When EXPN is accepted, a single-level expansion of the address is done.
61926 EXPN is treated as an <quote>address test</quote> (similar to the <option>-bt</option> option) rather
61927 than a verification (the <option>-bv</option> option). If an unqualified local part is given
61928 as the argument to EXPN, it is qualified with <option>qualify_domain</option>. Rejections
61929 of VRFY and EXPN commands are logged on the main and reject logs, and
61930 VRFY verification failures are logged on the main log for consistency with
61931 RCPT failures.
61932 </para>
61933 </section>
61934 <section id="SECTETRN">
61935 <title>The ETRN command</title>
61936 <para>
61937 <indexterm role="concept">
61938 <primary>ETRN</primary>
61939 <secondary>processing</secondary>
61940 </indexterm>
61941 RFC 1985 describes an SMTP command called ETRN that is designed to
61942 overcome the security problems of the TURN command (which has fallen into
61943 disuse). When Exim receives an ETRN command on a TCP/IP connection, it runs
61944 the ACL specified by <option>acl_smtp_etrn</option> in order to decide whether the command
61945 should be accepted or not. If no ACL is defined, the command is rejected.
61946 </para>
61947 <para>
61948 The ETRN command is concerned with <quote>releasing</quote> messages that are awaiting
61949 delivery to certain hosts. As Exim does not organize its message queue by host,
61950 the only form of ETRN that is supported by default is the one where the
61951 text starts with the <quote>#</quote> prefix, in which case the remainder of the text is
61952 specific to the SMTP server. A valid ETRN command causes a run of Exim with
61953 the <option>-R</option> option to happen, with the remainder of the ETRN text as its
61954 argument. For example,
61955 </para>
61956 <literallayout class="monospaced">
61957 ETRN #brigadoon
61958 </literallayout>
61959 <para>
61960 runs the command
61961 </para>
61962 <literallayout class="monospaced">
61963 exim -R brigadoon
61964 </literallayout>
61965 <para>
61966 which causes a delivery attempt on all messages with undelivered addresses
61967 containing the text <quote>brigadoon</quote>. When <option>smtp_etrn_serialize</option> is set (the
61968 default), Exim prevents the simultaneous execution of more than one queue run
61969 for the same argument string as a result of an ETRN command. This stops
61970 a misbehaving client from starting more than one queue runner at once.
61971 </para>
61972 <para>
61973 <indexterm role="concept">
61974 <primary>hints database</primary>
61975 <secondary>ETRN serialization</secondary>
61976 </indexterm>
61977 Exim implements the serialization by means of a hints database in which a
61978 record is written whenever a process is started by ETRN, and deleted when
61979 the process completes. However, Exim does not keep the SMTP session waiting for
61980 the ETRN process to complete. Once ETRN is accepted, the client is sent
61981 a <quote>success</quote> return code. Obviously there is scope for hints records to get
61982 left lying around if there is a system or program crash. To guard against this,
61983 Exim ignores any records that are more than six hours old.
61984 </para>
61985 <para>
61986 <indexterm role="option">
61987 <primary><option>smtp_etrn_command</option></primary>
61988 </indexterm>
61989 For more control over what ETRN does, the <option>smtp_etrn_command</option> option can
61990 used. This specifies a command that is run whenever ETRN is received,
61991 whatever the form of its argument. For
61992 example:
61993 </para>
61994 <literallayout class="monospaced">
61995 smtp_etrn_command = /etc/etrn_command $domain \
61996                     $sender_host_address
61997 </literallayout>
61998 <para>
61999 <indexterm role="variable">
62000 <primary><varname>$domain</varname></primary>
62001 </indexterm>
62002 The string is split up into arguments which are independently expanded. The
62003 expansion variable <varname>$domain</varname> is set to the argument of the ETRN command,
62004 and no syntax checking is done on the contents of this argument. Exim does not
62005 wait for the command to complete, so its status code is not checked. Exim runs
62006 under its own uid and gid when receiving incoming SMTP, so it is not possible
62007 for it to change them before running the command.
62008 </para>
62009 </section>
62010 <section id="SECID238">
62011 <title>Incoming local SMTP</title>
62012 <para>
62013 <indexterm role="concept">
62014 <primary>SMTP</primary>
62015 <secondary>local incoming</secondary>
62016 </indexterm>
62017 Some user agents use SMTP to pass messages to their local MTA using the
62018 standard input and output, as opposed to passing the envelope on the command
62019 line and writing the message to the standard input. This is supported by the
62020 <option>-bs</option> option. This form of SMTP is handled in the same way as incoming
62021 messages over TCP/IP (including the use of ACLs), except that the envelope
62022 sender given in a MAIL command is ignored unless the caller is trusted. In
62023 an ACL you can detect this form of SMTP input by testing for an empty host
62024 identification. It is common to have this as the first line in the ACL that
62025 runs for RCPT commands:
62026 </para>
62027 <literallayout class="monospaced">
62028 accept hosts = :
62029 </literallayout>
62030 <para>
62031 This accepts SMTP messages from local processes without doing any other tests.
62032 </para>
62033 </section>
62034 <section id="SECTbatchSMTP">
62035 <title>Outgoing batched SMTP</title>
62036 <para>
62037 <indexterm role="concept">
62038 <primary>SMTP</primary>
62039 <secondary>batched outgoing</secondary>
62040 </indexterm>
62041 <indexterm role="concept">
62042 <primary>batched SMTP output</primary>
62043 </indexterm>
62044 Both the <command>appendfile</command> and <command>pipe</command> transports can be used for handling
62045 batched SMTP. Each has an option called <option>use_bsmtp</option> which causes messages to
62046 be output in BSMTP format. No SMTP responses are possible for this form of
62047 delivery. All it is doing is using SMTP commands as a way of transmitting the
62048 envelope along with the message.
62049 </para>
62050 <para>
62051 The message is written to the file or pipe preceded by the SMTP commands
62052 MAIL and RCPT, and followed by a line containing a single dot. Lines in
62053 the message that start with a dot have an extra dot added. The SMTP command
62054 HELO is not normally used. If it is required, the <option>message_prefix</option> option
62055 can be used to specify it.
62056 </para>
62057 <para>
62058 Because <command>appendfile</command> and <command>pipe</command> are both local transports, they accept only
62059 one recipient address at a time by default. However, you can arrange for them
62060 to handle several addresses at once by setting the <option>batch_max</option> option. When
62061 this is done for BSMTP, messages may contain multiple RCPT commands. See
62062 chapter <xref linkend="CHAPbatching"/> for more details.
62063 </para>
62064 <para>
62065 <indexterm role="variable">
62066 <primary><varname>$host</varname></primary>
62067 </indexterm>
62068 When one or more addresses are routed to a BSMTP transport by a router that
62069 sets up a host list, the name of the first host on the list is available to the
62070 transport in the variable <varname>$host</varname>. Here is an example of such a transport and
62071 router:
62072 </para>
62073 <literallayout class="monospaced">
62074 begin routers
62075 route_append:
62076   driver = manualroute
62077   transport = smtp_appendfile
62078   route_list = domain.example  batch.host.example
62079
62080 begin transports
62081 smtp_appendfile:
62082   driver = appendfile
62083   directory = /var/bsmtp/$host
62084   batch_max = 1000
62085   use_bsmtp
62086   user = exim
62087 </literallayout>
62088 <para>
62089 This causes messages addressed to <emphasis>domain.example</emphasis> to be written in BSMTP
62090 format to <filename>/var/bsmtp/batch.host.example</filename>, with only a single copy of each
62091 message (unless there are more than 1000 recipients).
62092 </para>
62093 </section>
62094 <section id="SECTincomingbatchedSMTP">
62095 <title>Incoming batched SMTP</title>
62096 <para>
62097 <indexterm role="concept">
62098 <primary>SMTP</primary>
62099 <secondary>batched incoming</secondary>
62100 </indexterm>
62101 <indexterm role="concept">
62102 <primary>batched SMTP input</primary>
62103 </indexterm>
62104 The <option>-bS</option> command line option causes Exim to accept one or more messages by
62105 reading SMTP on the standard input, but to generate no responses. If the caller
62106 is trusted, the senders in the MAIL commands are believed; otherwise the
62107 sender is always the caller of Exim. Unqualified senders and receivers are not
62108 rejected (there seems little point) but instead just get qualified. HELO
62109 and EHLO act as RSET; VRFY, EXPN, ETRN and  HELP, act
62110 as NOOP; QUIT quits.
62111 </para>
62112 <para>
62113 Minimal policy checking is done for BSMTP input. Only the non-SMTP
62114 ACL is run in the same way as for non-SMTP local input.
62115 </para>
62116 <para>
62117 If an error is detected while reading a message, including a missing <quote>.</quote> at
62118 the end, Exim gives up immediately. It writes details of the error to the
62119 standard output in a stylized way that the calling program should be able to
62120 make some use of automatically, for example:
62121 </para>
62122 <literallayout class="monospaced">
62123 554 Unexpected end of file
62124 Transaction started in line 10
62125 Error detected in line 14
62126 </literallayout>
62127 <para>
62128 It writes a more verbose version, for human consumption, to the standard error
62129 file, for example:
62130 </para>
62131 <literallayout class="monospaced">
62132 An error was detected while processing a file of BSMTP input.
62133 The error message was:
62134
62135 501 '&gt;' missing at end of address
62136
62137 The SMTP transaction started in line 10.
62138 The error was detected in line 12.
62139 The SMTP command at fault was:
62140
62141 rcpt to:&lt;malformed@in.com.plete
62142
62143 1 previous message was successfully processed.
62144 The rest of the batch was abandoned.
62145 </literallayout>
62146 <para>
62147 The return code from Exim is zero only if there were no errors. It is 1 if some
62148 messages were accepted before an error was detected, and 2 if no messages were
62149 accepted.
62150 <indexterm role="concept" startref="IIDsmtpproc1" class="endofrange"/>
62151 <indexterm role="concept" startref="IIDsmtpproc2" class="endofrange"/>
62152 </para>
62153 </section>
62154 </chapter>
62155
62156 <chapter id="CHAPemsgcust">
62157 <title>Customizing bounce and warning messages</title>
62158 <titleabbrev>Customizing messages</titleabbrev>
62159 <para>
62160 When a message fails to be delivered, or remains on the queue for more than a
62161 configured amount of time, Exim sends a message to the original sender, or
62162 to an alternative configured address. The text of these messages is built into
62163 the code of Exim, but it is possible to change it, either by adding a single
62164 string, or by replacing each of the paragraphs by text supplied in a file.
62165 </para>
62166 <para>
62167 The <emphasis>From:</emphasis> and <emphasis>To:</emphasis> header lines are automatically generated; you can
62168 cause a <emphasis>Reply-To:</emphasis> line to be added by setting the <option>errors_reply_to</option>
62169 option. Exim also adds the line
62170 </para>
62171 <literallayout class="monospaced">
62172 Auto-Submitted: auto-generated
62173 </literallayout>
62174 <para>
62175 to all warning and bounce messages,
62176 </para>
62177 <section id="SECID239">
62178 <title>Customizing bounce messages</title>
62179 <para>
62180 <indexterm role="concept">
62181 <primary>customizing</primary>
62182 <secondary>bounce message</secondary>
62183 </indexterm>
62184 <indexterm role="concept">
62185 <primary>bounce message</primary>
62186 <secondary>customizing</secondary>
62187 </indexterm>
62188 If <option>bounce_message_text</option> is set, its contents are included in the default
62189 message immediately after <quote>This message was created automatically by mail
62190 delivery software.</quote> The string is not expanded. It is not used if
62191 <option>bounce_message_file</option> is set.
62192 </para>
62193 <para>
62194 When <option>bounce_message_file</option> is set, it must point to a template file for
62195 constructing error messages. The file consists of a series of text items,
62196 separated by lines consisting of exactly four asterisks. If the file cannot be
62197 opened, default text is used and a message is written to the main and panic
62198 logs. If any text item in the file is empty, default text is used for that
62199 item.
62200 </para>
62201 <para>
62202 <indexterm role="variable">
62203 <primary><varname>$bounce_recipient</varname></primary>
62204 </indexterm>
62205 <indexterm role="variable">
62206 <primary><varname>$bounce_return_size_limit</varname></primary>
62207 </indexterm>
62208 Each item of text that is read from the file is expanded, and there are two
62209 expansion variables which can be of use here: <varname>$bounce_recipient</varname> is set to
62210 the recipient of an error message while it is being created, and
62211 <varname>$bounce_return_size_limit</varname> contains the value of the <option>return_size_limit</option>
62212 option, rounded to a whole number.
62213 </para>
62214 <para>
62215 The items must appear in the file in the following order:
62216 </para>
62217 <itemizedlist>
62218 <listitem>
62219 <para>
62220 The first item is included in the headers, and should include at least a
62221 <emphasis>Subject:</emphasis> header. Exim does not check the syntax of these headers.
62222 </para>
62223 </listitem>
62224 <listitem>
62225 <para>
62226 The second item forms the start of the error message. After it, Exim lists the
62227 failing addresses with their error messages.
62228 </para>
62229 </listitem>
62230 <listitem>
62231 <para>
62232 The third item is used to introduce any text from pipe transports that is to be
62233 returned to the sender. It is omitted if there is no such text.
62234 </para>
62235 </listitem>
62236 <listitem>
62237 <para revisionflag="changed">
62238 The fourth, fifth and sixth items will be ignored and may be empty.
62239 The fields exist for back-compatibility
62240 </para>
62241 </listitem>
62242 </itemizedlist>
62243 <para>
62244 The default state (<option>bounce_message_file</option> unset) is equivalent to the
62245 following file, in which the sixth item is empty. The <emphasis>Subject:</emphasis> and some
62246 other lines have been split in order to fit them on the page:
62247 </para>
62248 <literallayout class="monospaced">
62249 Subject: Mail delivery failed
62250   ${if eq{$sender_address}{$bounce_recipient}
62251   {: returning message to sender}}
62252 ****
62253 This message was created automatically by mail delivery software.
62254
62255 A message ${if eq{$sender_address}{$bounce_recipient}
62256   {that you sent }{sent by
62257
62258 &lt;$sender_address&gt;
62259
62260 }}could not be delivered to all of its recipients.
62261 This is a permanent error. The following address(es) failed:
62262 ****
62263 The following text was generated during the delivery attempt(s):
62264 ****
62265 ------ This is a copy of the message, including all the headers.
62266   ------
62267 ****
62268 ------ The body of the message is $message_size characters long;
62269   only the first
62270 ------ $bounce_return_size_limit or so are included here.
62271 ****
62272 </literallayout>
62273 </section>
62274 <section id="SECTcustwarn">
62275 <title>Customizing warning messages</title>
62276 <para>
62277 <indexterm role="concept">
62278 <primary>customizing</primary>
62279 <secondary>warning message</secondary>
62280 </indexterm>
62281 <indexterm role="concept">
62282 <primary>warning of delay</primary>
62283 <secondary>customizing the message</secondary>
62284 </indexterm>
62285 The option <option>warn_message_file</option> can be pointed at a template file for use when
62286 warnings about message delays are created. In this case there are only three
62287 text sections:
62288 </para>
62289 <itemizedlist>
62290 <listitem>
62291 <para>
62292 The first item is included in the headers, and should include at least a
62293 <emphasis>Subject:</emphasis> header. Exim does not check the syntax of these headers.
62294 </para>
62295 </listitem>
62296 <listitem>
62297 <para>
62298 The second item forms the start of the warning message. After it, Exim lists
62299 the delayed addresses.
62300 </para>
62301 </listitem>
62302 <listitem>
62303 <para>
62304 The third item then ends the message.
62305 </para>
62306 </listitem>
62307 </itemizedlist>
62308 <para>
62309 The default state is equivalent to the following file, except that some lines
62310 have been split here, in order to fit them on the page:
62311 </para>
62312 <literallayout class="monospaced">
62313 Subject: Warning: message $message_exim_id delayed
62314   $warn_message_delay
62315 ****
62316 This message was created automatically by mail delivery software.
62317
62318 A message ${if eq{$sender_address}{$warn_message_recipients}
62319 {that you sent }{sent by
62320
62321 &lt;$sender_address&gt;
62322
62323 }}has not been delivered to all of its recipients after
62324 more than $warn_message_delay on the queue on $primary_hostname.
62325
62326 The message identifier is:     $message_exim_id
62327 The subject of the message is: $h_subject
62328 The date of the message is:    $h_date
62329
62330 The following address(es) have not yet been delivered:
62331 ****
62332 No action is required on your part. Delivery attempts will
62333 continue for some time, and this warning may be repeated at
62334 intervals if the message remains undelivered. Eventually the
62335 mail delivery software will give up, and when that happens,
62336 the message will be returned to you.
62337 </literallayout>
62338 <para>
62339 <indexterm role="variable">
62340 <primary><varname>$warn_message_delay</varname></primary>
62341 </indexterm>
62342 <indexterm role="variable">
62343 <primary><varname>$warn_message_recipients</varname></primary>
62344 </indexterm>
62345 However, in the default state the subject and date lines are omitted if no
62346 appropriate headers exist. During the expansion of this file,
62347 <varname>$warn_message_delay</varname> is set to the delay time in one of the forms <quote>&lt;<emphasis>n</emphasis>&gt;
62348 minutes</quote> or <quote>&lt;<emphasis>n</emphasis>&gt; hours</quote>, and <varname>$warn_message_recipients</varname> contains a list
62349 of recipients for the warning message. There may be more than one if there are
62350 multiple addresses with different <option>errors_to</option> settings on the routers that
62351 handled them.
62352 </para>
62353 </section>
62354 </chapter>
62355
62356 <chapter id="CHAPcomconreq">
62357 <title>Some common configuration settings</title>
62358 <para>
62359 This chapter discusses some configuration settings that seem to be fairly
62360 common. More examples and discussion can be found in the Exim book.
62361 </para>
62362 <section id="SECID240">
62363 <title>Sending mail to a smart host</title>
62364 <para>
62365 <indexterm role="concept">
62366 <primary>smart host</primary>
62367 <secondary>example router</secondary>
62368 </indexterm>
62369 If you want to send all mail for non-local domains to a <quote>smart host</quote>, you
62370 should replace the default <command>dnslookup</command> router with a router which does the
62371 routing explicitly:
62372 </para>
62373 <literallayout class="monospaced">
62374 send_to_smart_host:
62375   driver = manualroute
62376   route_list = !+local_domains smart.host.name
62377   transport = remote_smtp
62378 </literallayout>
62379 <para>
62380 You can use the smart host&#x2019;s IP address instead of the name if you wish.
62381 If you are using Exim only to submit messages to a smart host, and not for
62382 receiving incoming messages, you can arrange for it to do the submission
62383 synchronously by setting the <option>mua_wrapper</option> option (see chapter
62384 <xref linkend="CHAPnonqueueing"/>).
62385 </para>
62386 </section>
62387 <section id="SECTmailinglists">
62388 <title>Using Exim to handle mailing lists</title>
62389 <para>
62390 <indexterm role="concept">
62391 <primary>mailing lists</primary>
62392 </indexterm>
62393 Exim can be used to run simple mailing lists, but for large and/or complicated
62394 requirements, the use of additional specialized mailing list software such as
62395 Majordomo or Mailman is recommended.
62396 </para>
62397 <para>
62398 The <command>redirect</command> router can be used to handle mailing lists where each list
62399 is maintained in a separate file, which can therefore be managed by an
62400 independent manager. The <option>domains</option> router option can be used to run these
62401 lists in a separate domain from normal mail. For example:
62402 </para>
62403 <literallayout class="monospaced">
62404 lists:
62405   driver = redirect
62406   domains = lists.example
62407   file = /usr/lists/$local_part
62408   forbid_pipe
62409   forbid_file
62410   errors_to = $local_part-request@lists.example
62411   no_more
62412 </literallayout>
62413 <para>
62414 This router is skipped for domains other than <emphasis>lists.example</emphasis>. For addresses
62415 in that domain, it looks for a file that matches the local part. If there is no
62416 such file, the router declines, but because <option>no_more</option> is set, no subsequent
62417 routers are tried, and so the whole delivery fails.
62418 </para>
62419 <para>
62420 The <option>forbid_pipe</option> and <option>forbid_file</option> options prevent a local part from being
62421 expanded into a file name or a pipe delivery, which is usually inappropriate in
62422 a mailing list.
62423 </para>
62424 <para>
62425 <indexterm role="option">
62426 <primary><option>errors_to</option></primary>
62427 </indexterm>
62428 The <option>errors_to</option> option specifies that any delivery errors caused by addresses
62429 taken from a mailing list are to be sent to the given address rather than the
62430 original sender of the message. However, before acting on this, Exim verifies
62431 the error address, and ignores it if verification fails.
62432 </para>
62433 <para>
62434 For example, using the configuration above, mail sent to
62435 <emphasis>dicts@lists.example</emphasis> is passed on to those addresses contained in
62436 <filename>/usr/lists/dicts</filename>, with error reports directed to
62437 <emphasis>dicts-request@lists.example</emphasis>, provided that this address can be verified.
62438 There could be a file called <filename>/usr/lists/dicts-request</filename> containing
62439 the address(es) of this particular list&#x2019;s manager(s), but other approaches,
62440 such as setting up an earlier router (possibly using the <option>local_part_prefix</option>
62441 or <option>local_part_suffix</option> options) to handle addresses of the form
62442 <option>owner-</option><emphasis>xxx</emphasis> or <option>xxx-</option><emphasis>request</emphasis>, are also possible.
62443 </para>
62444 </section>
62445 <section id="SECID241">
62446 <title>Syntax errors in mailing lists</title>
62447 <para>
62448 <indexterm role="concept">
62449 <primary>mailing lists</primary>
62450 <secondary>syntax errors in</secondary>
62451 </indexterm>
62452 If an entry in redirection data contains a syntax error, Exim normally defers
62453 delivery of the original address. That means that a syntax error in a mailing
62454 list holds up all deliveries to the list. This may not be appropriate when a
62455 list is being maintained automatically from data supplied by users, and the
62456 addresses are not rigorously checked.
62457 </para>
62458 <para>
62459 If the <option>skip_syntax_errors</option> option is set, the <command>redirect</command> router just skips
62460 entries that fail to parse, noting the incident in the log. If in addition
62461 <option>syntax_errors_to</option> is set to a verifiable address, a message is sent to it
62462 whenever a broken address is skipped. It is usually appropriate to set
62463 <option>syntax_errors_to</option> to the same address as <option>errors_to</option>.
62464 </para>
62465 </section>
62466 <section id="SECID242">
62467 <title>Re-expansion of mailing lists</title>
62468 <para>
62469 <indexterm role="concept">
62470 <primary>mailing lists</primary>
62471 <secondary>re-expansion of</secondary>
62472 </indexterm>
62473 Exim remembers every individual address to which a message has been delivered,
62474 in order to avoid duplication, but it normally stores only the original
62475 recipient addresses with a message. If all the deliveries to a mailing list
62476 cannot be done at the first attempt, the mailing list is re-expanded when the
62477 delivery is next tried. This means that alterations to the list are taken into
62478 account at each delivery attempt, so addresses that have been added to
62479 the list since the message arrived will therefore receive a copy of the
62480 message, even though it pre-dates their subscription.
62481 </para>
62482 <para>
62483 If this behaviour is felt to be undesirable, the <option>one_time</option> option can be set
62484 on the <command>redirect</command> router. If this is done, any addresses generated by the
62485 router that fail to deliver at the first attempt are added to the message as
62486 <quote>top level</quote> addresses, and the parent address that generated them is marked
62487 <quote>delivered</quote>. Thus, expansion of the mailing list does not happen again at the
62488 subsequent delivery attempts. The disadvantage of this is that if any of the
62489 failing addresses are incorrect, correcting them in the file has no effect on
62490 pre-existing messages.
62491 </para>
62492 <para>
62493 The original top-level address is remembered with each of the generated
62494 addresses, and is output in any log messages. However, any intermediate parent
62495 addresses are not recorded. This makes a difference to the log only if the
62496 <option>all_parents</option> selector is set, but for mailing lists there is normally only
62497 one level of expansion anyway.
62498 </para>
62499 </section>
62500 <section id="SECID243">
62501 <title>Closed mailing lists</title>
62502 <para>
62503 <indexterm role="concept">
62504 <primary>mailing lists</primary>
62505 <secondary>closed</secondary>
62506 </indexterm>
62507 The examples so far have assumed open mailing lists, to which anybody may
62508 send mail. It is also possible to set up closed lists, where mail is accepted
62509 from specified senders only. This is done by making use of the generic
62510 <option>senders</option> option to restrict the router that handles the list.
62511 </para>
62512 <para>
62513 The following example uses the same file as a list of recipients and as a list
62514 of permitted senders. It requires three routers:
62515 </para>
62516 <literallayout class="monospaced">
62517 lists_request:
62518   driver = redirect
62519   domains = lists.example
62520   local_part_suffix = -request
62521   file = /usr/lists/$local_part$local_part_suffix
62522   no_more
62523
62524 lists_post:
62525   driver = redirect
62526   domains = lists.example
62527   senders = ${if exists {/usr/lists/$local_part}\
62528              {lsearch;/usr/lists/$local_part}{*}}
62529   file = /usr/lists/$local_part
62530   forbid_pipe
62531   forbid_file
62532   errors_to = $local_part-request@lists.example
62533   no_more
62534
62535 lists_closed:
62536   driver = redirect
62537   domains = lists.example
62538   allow_fail
62539   data = :fail: $local_part@lists.example is a closed mailing list
62540 </literallayout>
62541 <para>
62542 All three routers have the same <option>domains</option> setting, so for any other domains,
62543 they are all skipped. The first router runs only if the local part ends in
62544 <option>-request</option>. It handles messages to the list manager(s) by means of an open
62545 mailing list.
62546 </para>
62547 <para>
62548 The second router runs only if the <option>senders</option> precondition is satisfied. It
62549 checks for the existence of a list that corresponds to the local part, and then
62550 checks that the sender is on the list by means of a linear search. It is
62551 necessary to check for the existence of the file before trying to search it,
62552 because otherwise Exim thinks there is a configuration error. If the file does
62553 not exist, the expansion of <option>senders</option> is *, which matches all senders. This
62554 means that the router runs, but because there is no list, declines, and
62555 <option>no_more</option> ensures that no further routers are run. The address fails with an
62556 <quote>unrouteable address</quote> error.
62557 </para>
62558 <para>
62559 The third router runs only if the second router is skipped, which happens when
62560 a mailing list exists, but the sender is not on it. This router forcibly fails
62561 the address, giving a suitable error message.
62562 </para>
62563 </section>
62564 <section id="SECTverp">
62565 <title>Variable Envelope Return Paths (VERP)</title>
62566 <para>
62567 <indexterm role="concept">
62568 <primary>VERP</primary>
62569 </indexterm>
62570 <indexterm role="concept">
62571 <primary>Variable Envelope Return Paths</primary>
62572 </indexterm>
62573 <indexterm role="concept">
62574 <primary>envelope sender</primary>
62575 </indexterm>
62576 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;
62577 are a way of helping mailing list administrators discover which subscription
62578 address is the cause of a particular delivery failure. The idea is to encode
62579 the original recipient address in the outgoing envelope sender address, so that
62580 if the message is forwarded by another host and then subsequently bounces, the
62581 original recipient can be extracted from the recipient address of the bounce.
62582 </para>
62583 <para>
62584 <indexterm role="option">
62585 <primary><option>errors_to</option></primary>
62586 </indexterm>
62587 <indexterm role="option">
62588 <primary><option>return_path</option></primary>
62589 </indexterm>
62590 Envelope sender addresses can be modified by Exim using two different
62591 facilities: the <option>errors_to</option> option on a router (as shown in previous mailing
62592 list examples), or the <option>return_path</option> option on a transport. The second of
62593 these is effective only if the message is successfully delivered to another
62594 host; it is not used for errors detected on the local host (see the description
62595 of <option>return_path</option> in chapter <xref linkend="CHAPtransportgeneric"/>). Here is an example
62596 of the use of <option>return_path</option> to implement VERP on an <command>smtp</command> transport:
62597 </para>
62598 <literallayout class="monospaced">
62599 verp_smtp:
62600   driver = smtp
62601   max_rcpt = 1
62602   return_path = \
62603     ${if match {$return_path}{^(.+?)-request@your.dom.example\$}\
62604       {$1-request+$local_part=$domain@your.dom.example}fail}
62605 </literallayout>
62606 <para>
62607 This has the effect of rewriting the return path (envelope sender) on outgoing
62608 SMTP messages, if the local part of the original return path ends in
62609 <quote>-request</quote>, and the domain is <emphasis>your.dom.example</emphasis>. The rewriting inserts the
62610 local part and domain of the recipient into the return path. Suppose, for
62611 example, that a message whose return path has been set to
62612 <emphasis>somelist-request@your.dom.example</emphasis> is sent to
62613 <emphasis>subscriber@other.dom.example</emphasis>. In the transport, the return path is
62614 rewritten as
62615 </para>
62616 <literallayout class="monospaced">
62617 somelist-request+subscriber=other.dom.example@your.dom.example
62618 </literallayout>
62619 <para>
62620 <indexterm role="variable">
62621 <primary><varname>$local_part</varname></primary>
62622 </indexterm>
62623 For this to work, you must tell Exim to send multiple copies of messages that
62624 have more than one recipient, so that each copy has just one recipient. This is
62625 achieved by setting <option>max_rcpt</option> to 1. Without this, a single copy of a message
62626 might be sent to several different recipients in the same domain, in which case
62627 <varname>$local_part</varname> is not available in the transport, because it is not unique.
62628 </para>
62629 <para>
62630 Unless your host is doing nothing but mailing list deliveries, you should
62631 probably use a separate transport for the VERP deliveries, so as not to use
62632 extra resources in making one-per-recipient copies for other deliveries. This
62633 can easily be done by expanding the <option>transport</option> option in the router:
62634 </para>
62635 <literallayout class="monospaced">
62636 dnslookup:
62637   driver = dnslookup
62638   domains = ! +local_domains
62639   transport = \
62640     ${if match {$return_path}{^(.+?)-request@your.dom.example\$}\
62641       {verp_smtp}{remote_smtp}}
62642   no_more
62643 </literallayout>
62644 <para>
62645 If you want to change the return path using <option>errors_to</option> in a router instead
62646 of using <option>return_path</option> in the transport, you need to set <option>errors_to</option> on all
62647 routers that handle mailing list addresses. This will ensure that all delivery
62648 errors, including those detected on the local host, are sent to the VERP
62649 address.
62650 </para>
62651 <para>
62652 On a host that does no local deliveries and has no manual routing, only the
62653 <command>dnslookup</command> router needs to be changed. A special transport is not needed for
62654 SMTP deliveries. Every mailing list recipient has its own return path value,
62655 and so Exim must hand them to the transport one at a time. Here is an example
62656 of a <command>dnslookup</command> router that implements VERP:
62657 </para>
62658 <literallayout class="monospaced">
62659 verp_dnslookup:
62660   driver = dnslookup
62661   domains = ! +local_domains
62662   transport = remote_smtp
62663   errors_to = \
62664     ${if match {$return_path}{^(.+?)-request@your.dom.example\$}}
62665      {$1-request+$local_part=$domain@your.dom.example}fail}
62666   no_more
62667 </literallayout>
62668 <para>
62669 Before you start sending out messages with VERPed return paths, you must also
62670 configure Exim to accept the bounce messages that come back to those paths.
62671 Typically this is done by setting a <option>local_part_suffix</option> option for a
62672 router, and using this to route the messages to wherever you want to handle
62673 them.
62674 </para>
62675 <para>
62676 The overhead incurred in using VERP depends very much on the size of the
62677 message, the number of recipient addresses that resolve to the same remote
62678 host, and the speed of the connection over which the message is being sent. If
62679 a lot of addresses resolve to the same host and the connection is slow, sending
62680 a separate copy of the message for each address may take substantially longer
62681 than sending a single copy with many recipients (for which VERP cannot be
62682 used).
62683 </para>
62684 </section>
62685 <section id="SECTvirtualdomains">
62686 <title>Virtual domains</title>
62687 <para>
62688 <indexterm role="concept">
62689 <primary>virtual domains</primary>
62690 </indexterm>
62691 <indexterm role="concept">
62692 <primary>domain</primary>
62693 <secondary>virtual</secondary>
62694 </indexterm>
62695 The phrase <emphasis>virtual domain</emphasis> is unfortunately used with two rather different
62696 meanings:
62697 </para>
62698 <itemizedlist>
62699 <listitem>
62700 <para>
62701 A domain for which there are no real mailboxes; all valid local parts are
62702 aliases for other email addresses. Common examples are organizational
62703 top-level domains and <quote>vanity</quote> domains.
62704 </para>
62705 </listitem>
62706 <listitem>
62707 <para>
62708 One of a number of independent domains that are all handled by the same host,
62709 with mailboxes on that host, but where the mailbox owners do not necessarily
62710 have login accounts on that host.
62711 </para>
62712 </listitem>
62713 </itemizedlist>
62714 <para>
62715 The first usage is probably more common, and does seem more <quote>virtual</quote> than
62716 the second. This kind of domain can be handled in Exim with a straightforward
62717 aliasing router. One approach is to create a separate alias file for each
62718 virtual domain. Exim can test for the existence of the alias file to determine
62719 whether the domain exists. The <command>dsearch</command> lookup type is useful here, leading
62720 to a router of this form:
62721 </para>
62722 <literallayout class="monospaced">
62723 virtual:
62724   driver = redirect
62725   domains = dsearch;/etc/mail/virtual
62726   data = ${lookup{$local_part}lsearch{/etc/mail/virtual/$domain}}
62727   no_more
62728 </literallayout>
62729 <para>
62730 The <option>domains</option> option specifies that the router is to be skipped, unless there
62731 is a file in the <filename>/etc/mail/virtual</filename> directory whose name is the same as the
62732 domain that is being processed. When the router runs, it looks up the local
62733 part in the file to find a new address (or list of addresses). The <option>no_more</option>
62734 setting ensures that if the lookup fails (leading to <option>data</option> being an empty
62735 string), Exim gives up on the address without trying any subsequent routers.
62736 </para>
62737 <para>
62738 This one router can handle all the virtual domains because the alias file names
62739 follow a fixed pattern. Permissions can be arranged so that appropriate people
62740 can edit the different alias files. A successful aliasing operation results in
62741 a new envelope recipient address, which is then routed from scratch.
62742 </para>
62743 <para>
62744 The other kind of <quote>virtual</quote> domain can also be handled in a straightforward
62745 way. One approach is to create a file for each domain containing a list of
62746 valid local parts, and use it in a router like this:
62747 </para>
62748 <literallayout class="monospaced">
62749 my_domains:
62750   driver = accept
62751   domains = dsearch;/etc/mail/domains
62752   local_parts = lsearch;/etc/mail/domains/$domain
62753   transport = my_mailboxes
62754 </literallayout>
62755 <para>
62756 The address is accepted if there is a file for the domain, and the local part
62757 can be found in the file. The <option>domains</option> option is used to check for the
62758 file&#x2019;s existence because <option>domains</option> is tested before the <option>local_parts</option>
62759 option (see section <xref linkend="SECTrouprecon"/>). You cannot use <option>require_files</option>,
62760 because that option is tested after <option>local_parts</option>. The transport is as
62761 follows:
62762 </para>
62763 <literallayout class="monospaced">
62764 my_mailboxes:
62765   driver = appendfile
62766   file = /var/mail/$domain/$local_part
62767   user = mail
62768 </literallayout>
62769 <para>
62770 This uses a directory of mailboxes for each domain. The <option>user</option> setting is
62771 required, to specify which uid is to be used for writing to the mailboxes.
62772 </para>
62773 <para>
62774 The configuration shown here is just one example of how you might support this
62775 requirement. There are many other ways this kind of configuration can be set
62776 up, for example, by using a database instead of separate files to hold all the
62777 information about the domains.
62778 </para>
62779 </section>
62780 <section id="SECTmulbox">
62781 <title>Multiple user mailboxes</title>
62782 <para>
62783 <indexterm role="concept">
62784 <primary>multiple mailboxes</primary>
62785 </indexterm>
62786 <indexterm role="concept">
62787 <primary>mailbox</primary>
62788 <secondary>multiple</secondary>
62789 </indexterm>
62790 <indexterm role="concept">
62791 <primary>local part</primary>
62792 <secondary>prefix</secondary>
62793 </indexterm>
62794 <indexterm role="concept">
62795 <primary>local part</primary>
62796 <secondary>suffix</secondary>
62797 </indexterm>
62798 Heavy email users often want to operate with multiple mailboxes, into which
62799 incoming mail is automatically sorted. A popular way of handling this is to
62800 allow users to use multiple sender addresses, so that replies can easily be
62801 identified. Users are permitted to add prefixes or suffixes to their local
62802 parts for this purpose. The wildcard facility of the generic router options
62803 <option>local_part_prefix</option> and <option>local_part_suffix</option> can be used for this. For
62804 example, consider this router:
62805 </para>
62806 <literallayout class="monospaced">
62807 userforward:
62808   driver = redirect
62809   check_local_user
62810   file = $home/.forward
62811   local_part_suffix = -*
62812   local_part_suffix_optional
62813   allow_filter
62814 </literallayout>
62815 <para>
62816 <indexterm role="variable">
62817 <primary><varname>$local_part_suffix</varname></primary>
62818 </indexterm>
62819 It runs a user&#x2019;s <filename>.forward</filename> file for all local parts of the form
62820 <emphasis>username-*</emphasis>. Within the filter file the user can distinguish different
62821 cases by testing the variable <varname>$local_part_suffix</varname>. For example:
62822 </para>
62823 <literallayout class="monospaced">
62824 if $local_part_suffix contains -special then
62825 save /home/$local_part/Mail/special
62826 endif
62827 </literallayout>
62828 <para>
62829 If the filter file does not exist, or does not deal with such addresses, they
62830 fall through to subsequent routers, and, assuming no subsequent use of the
62831 <option>local_part_suffix</option> option is made, they presumably fail. Thus, users have
62832 control over which suffixes are valid.
62833 </para>
62834 <para>
62835 Alternatively, a suffix can be used to trigger the use of a different
62836 <filename>.forward</filename> file &ndash; which is the way a similar facility is implemented in
62837 another MTA:
62838 </para>
62839 <literallayout class="monospaced">
62840 userforward:
62841   driver = redirect
62842   check_local_user
62843   file = $home/.forward$local_part_suffix
62844   local_part_suffix = -*
62845   local_part_suffix_optional
62846   allow_filter
62847 </literallayout>
62848 <para>
62849 If there is no suffix, <filename>.forward</filename> is used; if the suffix is <emphasis>-special</emphasis>, for
62850 example, <filename>.forward-special</filename> is used. Once again, if the appropriate file
62851 does not exist, or does not deal with the address, it is passed on to
62852 subsequent routers, which could, if required, look for an unqualified
62853 <filename>.forward</filename> file to use as a default.
62854 </para>
62855 </section>
62856 <section id="SECID244">
62857 <title>Simplified vacation processing</title>
62858 <para>
62859 <indexterm role="concept">
62860 <primary>vacation processing</primary>
62861 </indexterm>
62862 The traditional way of running the <emphasis>vacation</emphasis> program is for a user to set up
62863 a pipe command in a <filename>.forward</filename> file
62864 (see section <xref linkend="SECTspecitredli"/> for syntax details).
62865 This is prone to error by inexperienced users. There are two features of Exim
62866 that can be used to make this process simpler for users:
62867 </para>
62868 <itemizedlist>
62869 <listitem>
62870 <para>
62871 A local part prefix such as <quote>vacation-</quote> can be specified on a router which
62872 can cause the message to be delivered directly to the <emphasis>vacation</emphasis> program, or
62873 alternatively can use Exim&#x2019;s <command>autoreply</command> transport. The contents of a user&#x2019;s
62874 <filename>.forward</filename> file are then much simpler. For example:
62875 </para>
62876 <literallayout class="monospaced">
62877 spqr, vacation-spqr
62878 </literallayout>
62879 </listitem>
62880 <listitem>
62881 <para>
62882 The <option>require_files</option> generic router option can be used to trigger a
62883 vacation delivery by checking for the existence of a certain file in the
62884 user&#x2019;s home directory. The <option>unseen</option> generic option should also be used, to
62885 ensure that the original delivery also proceeds. In this case, all the user has
62886 to do is to create a file called, say, <filename>.vacation</filename>, containing a vacation
62887 message.
62888 </para>
62889 </listitem>
62890 </itemizedlist>
62891 <para>
62892 Another advantage of both these methods is that they both work even when the
62893 use of arbitrary pipes by users is locked out.
62894 </para>
62895 </section>
62896 <section id="SECID245">
62897 <title>Taking copies of mail</title>
62898 <para>
62899 <indexterm role="concept">
62900 <primary>message</primary>
62901 <secondary>copying every</secondary>
62902 </indexterm>
62903 Some installations have policies that require archive copies of all messages to
62904 be made. A single copy of each message can easily be taken by an appropriate
62905 command in a system filter, which could, for example, use a different file for
62906 each day&#x2019;s messages.
62907 </para>
62908 <para>
62909 There is also a shadow transport mechanism that can be used to take copies of
62910 messages that are successfully delivered by local transports, one copy per
62911 delivery. This could be used, <emphasis>inter alia</emphasis>, to implement automatic
62912 notification of delivery by sites that insist on doing such things.
62913 </para>
62914 </section>
62915 <section id="SECID246">
62916 <title>Intermittently connected hosts</title>
62917 <para>
62918 <indexterm role="concept">
62919 <primary>intermittently connected hosts</primary>
62920 </indexterm>
62921 It has become quite common (because it is cheaper) for hosts to connect to the
62922 Internet periodically rather than remain connected all the time. The normal
62923 arrangement is that mail for such hosts accumulates on a system that is
62924 permanently connected.
62925 </para>
62926 <para>
62927 Exim was designed for use on permanently connected hosts, and so it is not
62928 particularly well-suited to use in an intermittently connected environment.
62929 Nevertheless there are some features that can be used.
62930 </para>
62931 </section>
62932 <section id="SECID247">
62933 <title>Exim on the upstream server host</title>
62934 <para>
62935 It is tempting to arrange for incoming mail for the intermittently connected
62936 host to remain on Exim&#x2019;s queue until the client connects. However, this
62937 approach does not scale very well. Two different kinds of waiting message are
62938 being mixed up in the same queue &ndash; those that cannot be delivered because of
62939 some temporary problem, and those that are waiting for their destination host
62940 to connect. This makes it hard to manage the queue, as well as wasting
62941 resources, because each queue runner scans the entire queue.
62942 </para>
62943 <para>
62944 A better approach is to separate off those messages that are waiting for an
62945 intermittently connected host. This can be done by delivering these messages
62946 into local files in batch SMTP, <quote>mailstore</quote>, or other envelope-preserving
62947 format, from where they are transmitted by other software when their
62948 destination connects. This makes it easy to collect all the mail for one host
62949 in a single directory, and to apply local timeout rules on a per-message basis
62950 if required.
62951 </para>
62952 <para>
62953 On a very small scale, leaving the mail on Exim&#x2019;s queue can be made to work. If
62954 you are doing this, you should configure Exim with a long retry period for the
62955 intermittent host. For example:
62956 </para>
62957 <literallayout class="monospaced">
62958 cheshire.wonderland.fict.example    *   F,5d,24h
62959 </literallayout>
62960 <para>
62961 This stops a lot of failed delivery attempts from occurring, but Exim remembers
62962 which messages it has queued up for that host. Once the intermittent host comes
62963 online, forcing delivery of one message (either by using the <option>-M</option> or <option>-R</option>
62964 options, or by using the ETRN SMTP command (see section <xref linkend="SECTETRN"/>)
62965 causes all the queued up messages to be delivered, often down a single SMTP
62966 connection. While the host remains connected, any new messages get delivered
62967 immediately.
62968 </para>
62969 <para>
62970 If the connecting hosts do not have fixed IP addresses, that is, if a host is
62971 issued with a different IP address each time it connects, Exim&#x2019;s retry
62972 mechanisms on the holding host get confused, because the IP address is normally
62973 used as part of the key string for holding retry information. This can be
62974 avoided by unsetting <option>retry_include_ip_address</option> on the <command>smtp</command> transport.
62975 Since this has disadvantages for permanently connected hosts, it is best to
62976 arrange a separate transport for the intermittently connected ones.
62977 </para>
62978 </section>
62979 <section id="SECID248">
62980 <title>Exim on the intermittently connected client host</title>
62981 <para>
62982 The value of <option>smtp_accept_queue_per_connection</option> should probably be
62983 increased, or even set to zero (that is, disabled) on the intermittently
62984 connected host, so that all incoming messages down a single connection get
62985 delivered immediately.
62986 </para>
62987 <para>
62988 <indexterm role="concept">
62989 <primary>SMTP</primary>
62990 <secondary>passed connection</secondary>
62991 </indexterm>
62992 <indexterm role="concept">
62993 <primary>SMTP</primary>
62994 <secondary>multiple deliveries</secondary>
62995 </indexterm>
62996 <indexterm role="concept">
62997 <primary>multiple SMTP deliveries</primary>
62998 </indexterm>
62999 Mail waiting to be sent from an intermittently connected host will probably
63000 not have been routed, because without a connection DNS lookups are not
63001 possible. This means that if a normal queue run is done at connection time,
63002 each message is likely to be sent in a separate SMTP session. This can be
63003 avoided by starting the queue run with a command line option beginning with
63004 <option>-qq</option> instead of <option>-q</option>. In this case, the queue is scanned twice. In the
63005 first pass, routing is done but no deliveries take place. The second pass is a
63006 normal queue run; since all the messages have been previously routed, those
63007 destined for the same host are likely to get sent as multiple deliveries in a
63008 single SMTP connection.
63009 </para>
63010 </section>
63011 </chapter>
63012
63013 <chapter id="CHAPnonqueueing">
63014 <title>Using Exim as a non-queueing client</title>
63015 <titleabbrev>Exim as a non-queueing client</titleabbrev>
63016 <para>
63017 <indexterm role="concept">
63018 <primary>client, non-queueing</primary>
63019 </indexterm>
63020 <indexterm role="concept">
63021 <primary>smart host</primary>
63022 <secondary>suppressing queueing</secondary>
63023 </indexterm>
63024 On a personal computer, it is a common requirement for all
63025 email to be sent to a <quote>smart host</quote>. There are plenty of MUAs that can be
63026 configured to operate that way, for all the popular operating systems.
63027 However, there are some MUAs for Unix-like systems that cannot be so
63028 configured: they submit messages using the command line interface of
63029 <filename>/usr/sbin/sendmail</filename>. Furthermore, utility programs such as <emphasis>cron</emphasis> submit
63030 messages this way.
63031 </para>
63032 <para>
63033 If the personal computer runs continuously, there is no problem, because it can
63034 run a conventional MTA that handles delivery to the smart host, and deal with
63035 any delays via its queueing mechanism. However, if the computer does not run
63036 continuously or runs different operating systems at different times, queueing
63037 email is not desirable.
63038 </para>
63039 <para>
63040 There is therefore a requirement for something that can provide the
63041 <filename>/usr/sbin/sendmail</filename> interface but deliver messages to a smart host without
63042 any queueing or retrying facilities. Furthermore, the delivery to the smart
63043 host should be synchronous, so that if it fails, the sending MUA is immediately
63044 informed. In other words, we want something that extends an MUA that submits
63045 to a local MTA via the command line so that it behaves like one that submits
63046 to a remote smart host using TCP/SMTP.
63047 </para>
63048 <para>
63049 There are a number of applications (for example, there is one called <emphasis>ssmtp</emphasis>)
63050 that do this job. However, people have found them to be lacking in various
63051 ways. For instance, you might want to allow aliasing and forwarding to be done
63052 before sending a message to the smart host.
63053 </para>
63054 <para>
63055 Exim already had the necessary infrastructure for doing this job. Just a few
63056 tweaks were needed to make it behave as required, though it is somewhat of an
63057 overkill to use a fully-featured MTA for this purpose.
63058 </para>
63059 <para>
63060 <indexterm role="option">
63061 <primary><option>mua_wrapper</option></primary>
63062 </indexterm>
63063 There is a Boolean global option called <option>mua_wrapper</option>, defaulting false.
63064 Setting <option>mua_wrapper</option> true causes Exim to run in a special mode where it
63065 assumes that it is being used to <quote>wrap</quote> a command-line MUA in the manner
63066 just described. As well as setting <option>mua_wrapper</option>, you also need to provide a
63067 compatible router and transport configuration. Typically there will be just one
63068 router and one transport, sending everything to a smart host.
63069 </para>
63070 <para>
63071 When run in MUA wrapping mode, the behaviour of Exim changes in the
63072 following ways:
63073 </para>
63074 <itemizedlist>
63075 <listitem>
63076 <para>
63077 A daemon cannot be run, nor will Exim accept incoming messages from <emphasis>inetd</emphasis>.
63078 In other words, the only way to submit messages is via the command line.
63079 </para>
63080 </listitem>
63081 <listitem>
63082 <para>
63083 Each message is synchronously delivered as soon as it is received (<option>-odi</option> is
63084 assumed). All queueing options (<option>queue_only</option>, <option>queue_smtp_domains</option>,
63085 <option>control</option> in an ACL, etc.) are quietly ignored. The Exim reception process
63086 does not finish until the delivery attempt is complete. If the delivery is
63087 successful, a zero return code is given.
63088 </para>
63089 </listitem>
63090 <listitem>
63091 <para>
63092 Address redirection is permitted, but the final routing for all addresses must
63093 be to the same remote transport, and to the same list of hosts. Furthermore,
63094 the return address (envelope sender) must be the same for all recipients, as
63095 must any added or deleted header lines. In other words, it must be possible to
63096 deliver the message in a single SMTP transaction, however many recipients there
63097 are.
63098 </para>
63099 </listitem>
63100 <listitem>
63101 <para>
63102 If these conditions are not met, or if routing any address results in a
63103 failure or defer status, or if Exim is unable to deliver all the recipients
63104 successfully to one of the smart hosts, delivery of the entire message fails.
63105 </para>
63106 </listitem>
63107 <listitem>
63108 <para>
63109 Because no queueing is allowed, all failures are treated as permanent; there
63110 is no distinction between 4<emphasis>xx</emphasis> and 5<emphasis>xx</emphasis> SMTP response codes from the
63111 smart host. Furthermore, because only a single yes/no response can be given to
63112 the caller, it is not possible to deliver to some recipients and not others. If
63113 there is an error (temporary or permanent) for any recipient, all are failed.
63114 </para>
63115 </listitem>
63116 <listitem>
63117 <para>
63118 If more than one smart host is listed, Exim will try another host after a
63119 connection failure or a timeout, in the normal way. However, if this kind of
63120 failure happens for all the hosts, the delivery fails.
63121 </para>
63122 </listitem>
63123 <listitem>
63124 <para>
63125 When delivery fails, an error message is written to the standard error stream
63126 (as well as to Exim&#x2019;s log), and Exim exits to the caller with a return code
63127 value 1. The message is expunged from Exim&#x2019;s spool files. No bounce messages
63128 are ever generated.
63129 </para>
63130 </listitem>
63131 <listitem>
63132 <para>
63133 No retry data is maintained, and any retry rules are ignored.
63134 </para>
63135 </listitem>
63136 <listitem>
63137 <para>
63138 A number of Exim options are overridden: <option>deliver_drop_privilege</option> is forced
63139 true, <option>max_rcpt</option> in the <command>smtp</command> transport is forced to <quote>unlimited</quote>,
63140 <option>remote_max_parallel</option> is forced to one, and fallback hosts are ignored.
63141 </para>
63142 </listitem>
63143 </itemizedlist>
63144 <para>
63145 The overall effect is that Exim makes a single synchronous attempt to deliver
63146 the message, failing if there is any kind of problem. Because no local
63147 deliveries are done and no daemon can be run, Exim does not need root
63148 privilege. It should be possible to run it setuid to <emphasis>exim</emphasis> instead of setuid
63149 to <emphasis>root</emphasis>. See section <xref linkend="SECTrunexiwitpri"/> for a general discussion about
63150 the advantages and disadvantages of running without root privilege.
63151 </para>
63152 </chapter>
63153
63154 <chapter id="CHAPlog">
63155 <title>Log files</title>
63156 <para>
63157 <indexterm role="concept" id="IIDloggen" class="startofrange">
63158 <primary>log</primary>
63159 <secondary>general description</secondary>
63160 </indexterm>
63161 <indexterm role="concept">
63162 <primary>log</primary>
63163 <secondary>types of</secondary>
63164 </indexterm>
63165 Exim writes three different logs, referred to as the main log, the reject log,
63166 and the panic log:
63167 </para>
63168 <itemizedlist>
63169 <listitem>
63170 <para>
63171 <indexterm role="concept">
63172 <primary>main log</primary>
63173 </indexterm>
63174 The main log records the arrival of each message and each delivery in a single
63175 line in each case. The format is as compact as possible, in an attempt to keep
63176 down the size of log files. Two-character flag sequences make it easy to pick
63177 out these lines. A number of other events are recorded in the main log. Some of
63178 them are optional, in which case the <option>log_selector</option> option controls whether
63179 they are included or not. A Perl script called <emphasis>eximstats</emphasis>, which does simple
63180 analysis of main log files, is provided in the Exim distribution (see section
63181 <xref linkend="SECTmailstat"/>).
63182 </para>
63183 </listitem>
63184 <listitem>
63185 <para>
63186 <indexterm role="concept">
63187 <primary>reject log</primary>
63188 </indexterm>
63189 The reject log records information from messages that are rejected as a result
63190 of a configuration option (that is, for policy reasons).
63191 The first line of each rejection is a copy of the line that is also written to
63192 the main log. Then, if the message&#x2019;s header has been read at the time the log
63193 is written, its contents are written to this log. Only the original header
63194 lines are available; header lines added by ACLs are not logged. You can use the
63195 reject log to check that your policy controls are working correctly; on a busy
63196 host this may be easier than scanning the main log for rejection messages. You
63197 can suppress the writing of the reject log by setting <option>write_rejectlog</option>
63198 false.
63199 </para>
63200 </listitem>
63201 <listitem>
63202 <para>
63203 <indexterm role="concept">
63204 <primary>panic log</primary>
63205 </indexterm>
63206 <indexterm role="concept">
63207 <primary>system log</primary>
63208 </indexterm>
63209 When certain serious errors occur, Exim writes entries to its panic log. If the
63210 error is sufficiently disastrous, Exim bombs out afterwards. Panic log entries
63211 are usually written to the main log as well, but can get lost amid the mass of
63212 other entries. The panic log should be empty under normal circumstances. It is
63213 therefore a good idea to check it (or to have a <emphasis>cron</emphasis> script check it)
63214 regularly, in order to become aware of any problems. When Exim cannot open its
63215 panic log, it tries as a last resort to write to the system log (syslog). This
63216 is opened with LOG_PID+LOG_CONS and the facility code of LOG_MAIL. The
63217 message itself is written at priority LOG_CRIT.
63218 </para>
63219 </listitem>
63220 </itemizedlist>
63221 <para>
63222 Every log line starts with a timestamp, in the format shown in the following
63223 example. Note that many of the examples shown in this chapter are line-wrapped.
63224 In the log file, this would be all on one line:
63225 </para>
63226 <literallayout class="monospaced">
63227 2001-09-16 16:09:47 SMTP connection from [127.0.0.1] closed
63228   by QUIT
63229 </literallayout>
63230 <para>
63231 By default, the timestamps are in the local timezone. There are two
63232 ways of changing this:
63233 </para>
63234 <itemizedlist>
63235 <listitem>
63236 <para>
63237 You can set the <option>timezone</option> option to a different time zone; in particular, if
63238 you set
63239 </para>
63240 <literallayout class="monospaced">
63241 timezone = UTC
63242 </literallayout>
63243 <para>
63244 the timestamps will be in UTC (aka GMT).
63245 </para>
63246 </listitem>
63247 <listitem>
63248 <para>
63249 If you set <option>log_timezone</option> true, the time zone is added to the timestamp, for
63250 example:
63251 </para>
63252 <literallayout class="monospaced">
63253 2003-04-25 11:17:07 +0100 Start queue run: pid=12762
63254 </literallayout>
63255 </listitem>
63256 </itemizedlist>
63257 <para>
63258 <indexterm role="concept">
63259 <primary>log</primary>
63260 <secondary>process ids in</secondary>
63261 </indexterm>
63262 <indexterm role="concept">
63263 <primary>pid (process id)</primary>
63264 <secondary>in log lines</secondary>
63265 </indexterm>
63266 Exim does not include its process id in log lines by default, but you can
63267 request that it does so by specifying the <literal>pid</literal> log selector (see section
63268 <xref linkend="SECTlogselector"/>). When this is set, the process id is output, in square
63269 brackets, immediately after the time and date.
63270 </para>
63271 <section id="SECTwhelogwri">
63272 <title>Where the logs are written</title>
63273 <para>
63274 <indexterm role="concept">
63275 <primary>log</primary>
63276 <secondary>destination</secondary>
63277 </indexterm>
63278 <indexterm role="concept">
63279 <primary>log</primary>
63280 <secondary>to file</secondary>
63281 </indexterm>
63282 <indexterm role="concept">
63283 <primary>log</primary>
63284 <secondary>to syslog</secondary>
63285 </indexterm>
63286 <indexterm role="concept">
63287 <primary>syslog</primary>
63288 </indexterm>
63289 The logs may be written to local files, or to syslog, or both. However, it
63290 should be noted that many syslog implementations use UDP as a transport, and
63291 are therefore unreliable in the sense that messages are not guaranteed to
63292 arrive at the loghost, nor is the ordering of messages necessarily maintained.
63293 It has also been reported that on large log files (tens of megabytes) you may
63294 need to tweak syslog to prevent it syncing the file with each write &ndash; on
63295 Linux this has been seen to make syslog take 90% plus of CPU time.
63296 </para>
63297 <para>
63298 The destination for Exim&#x2019;s logs is configured by setting LOG_FILE_PATH in
63299 <filename>Local/Makefile</filename> or by setting <option>log_file_path</option> in the run time
63300 configuration. This latter string is expanded, so it can contain, for example,
63301 references to the host name:
63302 </para>
63303 <literallayout class="monospaced">
63304 log_file_path = /var/log/$primary_hostname/exim_%slog
63305 </literallayout>
63306 <para>
63307 It is generally advisable, however, to set the string in <filename>Local/Makefile</filename>
63308 rather than at run time, because then the setting is available right from the
63309 start of Exim&#x2019;s execution. Otherwise, if there&#x2019;s something it wants to log
63310 before it has read the configuration file (for example, an error in the
63311 configuration file) it will not use the path you want, and may not be able to
63312 log at all.
63313 </para>
63314 <para>
63315 The value of LOG_FILE_PATH or <option>log_file_path</option> is a colon-separated
63316 list, currently limited to at most two items. This is one option where the
63317 facility for changing a list separator may not be used. The list must always be
63318 colon-separated. If an item in the list is <quote>syslog</quote> then syslog is used;
63319 otherwise the item must either be an absolute path, containing <literal>%s</literal> at the
63320 point where <quote>main</quote>, <quote>reject</quote>, or <quote>panic</quote> is to be inserted, or be empty,
63321 implying the use of a default path.
63322 </para>
63323 <para>
63324 When Exim encounters an empty item in the list, it searches the list defined by
63325 LOG_FILE_PATH, and uses the first item it finds that is neither empty nor
63326 <quote>syslog</quote>. This means that an empty item in <option>log_file_path</option> can be used to
63327 mean <quote>use the path specified at build time</quote>. It no such item exists, log
63328 files are written in the <filename>log</filename> subdirectory of the spool directory. This is
63329 equivalent to the setting:
63330 </para>
63331 <literallayout class="monospaced">
63332 log_file_path = $spool_directory/log/%slog
63333 </literallayout>
63334 <para>
63335 If you do not specify anything at build time or run time,
63336 or if you unset the option at run time (i.e. <literal>log_file_path = </literal>),
63337 that is where the logs are written.
63338 </para>
63339 <para>
63340 A log file path may also contain <literal>%D</literal> or <literal>%M</literal> if datestamped log file names
63341 are in use &ndash; see section <xref linkend="SECTdatlogfil"/> below.
63342 </para>
63343 <para>
63344 Here are some examples of possible settings:
63345 </para>
63346 <literallayout>
63347 <literal>LOG_FILE_PATH=syslog                    </literal> syslog only
63348 <literal>LOG_FILE_PATH=:syslog                   </literal> syslog and default path
63349 <literal>LOG_FILE_PATH=syslog : /usr/log/exim_%s </literal> syslog and specified path
63350 <literal>LOG_FILE_PATH=/usr/log/exim_%s          </literal> specified path only
63351 </literallayout>
63352 <para>
63353 If there are more than two paths in the list, the first is used and a panic
63354 error is logged.
63355 </para>
63356 </section>
63357 <section id="SECID285">
63358 <title>Logging to local files that are periodically <quote>cycled</quote></title>
63359 <para>
63360 <indexterm role="concept">
63361 <primary>log</primary>
63362 <secondary>cycling local files</secondary>
63363 </indexterm>
63364 <indexterm role="concept">
63365 <primary>cycling logs</primary>
63366 </indexterm>
63367 <indexterm role="concept">
63368 <primary><emphasis>exicyclog</emphasis></primary>
63369 </indexterm>
63370 <indexterm role="concept">
63371 <primary>log</primary>
63372 <secondary>local files; writing to</secondary>
63373 </indexterm>
63374 Some operating systems provide centralized and standardized methods for cycling
63375 log files. For those that do not, a utility script called <emphasis>exicyclog</emphasis> is
63376 provided (see section <xref linkend="SECTcyclogfil"/>). This renames and compresses the
63377 main and reject logs each time it is called. The maximum number of old logs to
63378 keep can be set. It is suggested this script is run as a daily <emphasis>cron</emphasis> job.
63379 </para>
63380 <para>
63381 An Exim delivery process opens the main log when it first needs to write to it,
63382 and it keeps the file open in case subsequent entries are required &ndash; for
63383 example, if a number of different deliveries are being done for the same
63384 message. However, remote SMTP deliveries can take a long time, and this means
63385 that the file may be kept open long after it is renamed if <emphasis>exicyclog</emphasis> or
63386 something similar is being used to rename log files on a regular basis. To
63387 ensure that a switch of log files is noticed as soon as possible, Exim calls
63388 <function>stat()</function> on the main log&#x2019;s name before reusing an open file, and if the file
63389 does not exist, or its inode has changed, the old file is closed and Exim
63390 tries to open the main log from scratch. Thus, an old log file may remain open
63391 for quite some time, but no Exim processes should write to it once it has been
63392 renamed.
63393 </para>
63394 </section>
63395 <section id="SECTdatlogfil">
63396 <title>Datestamped log files</title>
63397 <para>
63398 <indexterm role="concept">
63399 <primary>log</primary>
63400 <secondary>datestamped files</secondary>
63401 </indexterm>
63402 Instead of cycling the main and reject log files by renaming them
63403 periodically, some sites like to use files whose names contain a datestamp,
63404 for example, <filename>mainlog-20031225</filename>. The datestamp is in the form <filename>yyyymmdd</filename> or
63405 <filename>yyyymm</filename>. Exim has support for this way of working. It is enabled by setting
63406 the <option>log_file_path</option> option to a path that includes <literal>%D</literal> or <literal>%M</literal> at the
63407 point where the datestamp is required. For example:
63408 </para>
63409 <literallayout class="monospaced">
63410 log_file_path = /var/spool/exim/log/%slog-%D
63411 log_file_path = /var/log/exim-%s-%D.log
63412 log_file_path = /var/spool/exim/log/%D-%slog
63413 log_file_path = /var/log/exim/%s.%M
63414 </literallayout>
63415 <para>
63416 As before, <literal>%s</literal> is replaced by <quote>main</quote> or <quote>reject</quote>; the following are
63417 examples of names generated by the above examples:
63418 </para>
63419 <literallayout class="monospaced">
63420 /var/spool/exim/log/mainlog-20021225
63421 /var/log/exim-reject-20021225.log
63422 /var/spool/exim/log/20021225-mainlog
63423 /var/log/exim/main.200212
63424 </literallayout>
63425 <para>
63426 When this form of log file is specified, Exim automatically switches to new
63427 files at midnight. It does not make any attempt to compress old logs; you
63428 will need to write your own script if you require this. You should not
63429 run <emphasis>exicyclog</emphasis> with this form of logging.
63430 </para>
63431 <para>
63432 The location of the panic log is also determined by <option>log_file_path</option>, but it
63433 is not datestamped, because rotation of the panic log does not make sense.
63434 When generating the name of the panic log, <literal>%D</literal> or <literal>%M</literal> are removed from
63435 the string. In addition, if it immediately follows a slash, a following
63436 non-alphanumeric character is removed; otherwise a preceding non-alphanumeric
63437 character is removed. Thus, the four examples above would give these panic
63438 log names:
63439 </para>
63440 <literallayout class="monospaced">
63441 /var/spool/exim/log/paniclog
63442 /var/log/exim-panic.log
63443 /var/spool/exim/log/paniclog
63444 /var/log/exim/panic
63445 </literallayout>
63446 </section>
63447 <section id="SECID249">
63448 <title>Logging to syslog</title>
63449 <para>
63450 <indexterm role="concept">
63451 <primary>log</primary>
63452 <secondary>syslog; writing to</secondary>
63453 </indexterm>
63454 The use of syslog does not change what Exim logs or the format of its messages,
63455 except in one respect. If <option>syslog_timestamp</option> is set false, the timestamps on
63456 Exim&#x2019;s log lines are omitted when these lines are sent to syslog. Apart from
63457 that, the same strings are written to syslog as to log files. The syslog
63458 <quote>facility</quote> is set to LOG_MAIL, and the program name to <quote>exim</quote>
63459 by default, but you can change these by setting the <option>syslog_facility</option> and
63460 <option>syslog_processname</option> options, respectively. If Exim was compiled with
63461 SYSLOG_LOG_PID set in <filename>Local/Makefile</filename> (this is the default in
63462 <filename>src/EDITME</filename>), then, on systems that permit it (all except ULTRIX), the
63463 LOG_PID flag is set so that the <function>syslog()</function> call adds the pid as well as
63464 the time and host name to each line.
63465 The three log streams are mapped onto syslog priorities as follows:
63466 </para>
63467 <itemizedlist>
63468 <listitem>
63469 <para>
63470 <emphasis>mainlog</emphasis> is mapped to LOG_INFO
63471 </para>
63472 </listitem>
63473 <listitem>
63474 <para>
63475 <emphasis>rejectlog</emphasis> is mapped to LOG_NOTICE
63476 </para>
63477 </listitem>
63478 <listitem>
63479 <para>
63480 <emphasis>paniclog</emphasis> is mapped to LOG_ALERT
63481 </para>
63482 </listitem>
63483 </itemizedlist>
63484 <para>
63485 Many log lines are written to both <emphasis>mainlog</emphasis> and <emphasis>rejectlog</emphasis>, and some are
63486 written to both <emphasis>mainlog</emphasis> and <emphasis>paniclog</emphasis>, so there will be duplicates if
63487 these are routed by syslog to the same place. You can suppress this duplication
63488 by setting <option>syslog_duplication</option> false.
63489 </para>
63490 <para>
63491 Exim&#x2019;s log lines can sometimes be very long, and some of its <emphasis>rejectlog</emphasis>
63492 entries contain multiple lines when headers are included. To cope with both
63493 these cases, entries written to syslog are split into separate <function>syslog()</function>
63494 calls at each internal newline, and also after a maximum of
63495 870 data characters. (This allows for a total syslog line length of 1024, when
63496 additions such as timestamps are added.) If you are running a syslog
63497 replacement that can handle lines longer than the 1024 characters allowed by
63498 RFC 3164, you should set
63499 </para>
63500 <literallayout class="monospaced">
63501 SYSLOG_LONG_LINES=yes
63502 </literallayout>
63503 <para>
63504 in <filename>Local/Makefile</filename> before building Exim. That stops Exim from splitting long
63505 lines, but it still splits at internal newlines in <emphasis>reject</emphasis> log entries.
63506 </para>
63507 <para>
63508 To make it easy to re-assemble split lines later, each component of a split
63509 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;]
63510 where &lt;<emphasis>n</emphasis>&gt; is the component number and &lt;<emphasis>m</emphasis>&gt; is the total number of
63511 components in the entry. The / delimiter is used when the line was split
63512 because it was too long; if it was split because of an internal newline, the \
63513 delimiter is used. For example, supposing the length limit to be 50 instead of
63514 870, the following would be the result of a typical rejection message to
63515 <emphasis>mainlog</emphasis> (LOG_INFO), each line in addition being preceded by the time, host
63516 name, and pid as added by syslog:
63517 </para>
63518 <literallayout class="monospaced">
63519 [1/5] 2002-09-16 16:09:43 16RdAL-0006pc-00 rejected from
63520 [2/5]  [127.0.0.1] (ph10): syntax error in 'From' header
63521 [3/5]  when scanning for sender: missing or malformed lo
63522 [4/5] cal part in "&lt;&gt;" (envelope sender is &lt;ph10@cam.exa
63523 [5/5] mple&gt;)
63524 </literallayout>
63525 <para>
63526 The same error might cause the following lines to be written to <quote>rejectlog</quote>
63527 (LOG_NOTICE):
63528 </para>
63529 <literallayout class="monospaced">
63530 [1/18] 2002-09-16 16:09:43 16RdAL-0006pc-00 rejected fro
63531 [2/18] m [127.0.0.1] (ph10): syntax error in 'From' head
63532 [3/18] er when scanning for sender: missing or malformed
63533 [4/18]  local part in "&lt;&gt;" (envelope sender is &lt;ph10@cam
63534 [5\18] .example&gt;)
63535 [6\18] Recipients: ph10@some.domain.cam.example
63536 [7\18] P Received: from [127.0.0.1] (ident=ph10)
63537 [8\18]        by xxxxx.cam.example with smtp (Exim 4.00)
63538 [9\18]        id 16RdAL-0006pc-00
63539 [10/18]        for ph10@cam.example; Mon, 16 Sep 2002 16:
63540 [11\18] 09:43 +0100
63541 [12\18] F From: &lt;&gt;
63542 [13\18]   Subject: this is a test header
63543 [18\18]   X-something: this is another header
63544 [15/18] I Message-Id: &lt;E16RdAL-0006pc-00@xxxxx.cam.examp
63545 [16\18] le&gt;
63546 [17\18] B Bcc:
63547 [18/18]   Date: Mon, 16 Sep 2002 16:09:43 +0100
63548 </literallayout>
63549 <para>
63550 Log lines that are neither too long nor contain newlines are written to syslog
63551 without modification.
63552 </para>
63553 <para>
63554 If only syslog is being used, the Exim monitor is unable to provide a log tail
63555 display, unless syslog is routing <emphasis>mainlog</emphasis> to a file on the local host and
63556 the environment variable EXIMON_LOG_FILE_PATH is set to tell the monitor
63557 where it is.
63558 </para>
63559 </section>
63560 <section id="SECID250">
63561 <title>Log line flags</title>
63562 <para>
63563 One line is written to the main log for each message received, and for each
63564 successful, unsuccessful, and delayed delivery. These lines can readily be
63565 picked out by the distinctive two-character flags that immediately follow the
63566 timestamp. The flags are:
63567 </para>
63568 <literallayout>
63569 <literal>&lt;=</literal>     message arrival
63570 <literal>=&gt;</literal>     normal message delivery
63571 <literal>-&gt;</literal>     additional address in same delivery
63572 <literal>&gt;&gt;</literal>     cutthrough message delivery
63573 <literal>*&gt;</literal>     delivery suppressed by <option>-N</option>
63574 <literal>**</literal>     delivery failed; address bounced
63575 <literal>==</literal>     delivery deferred; temporary problem
63576 </literallayout>
63577 </section>
63578 <section id="SECID251">
63579 <title>Logging message reception</title>
63580 <para>
63581 <indexterm role="concept">
63582 <primary>log</primary>
63583 <secondary>reception line</secondary>
63584 </indexterm>
63585 The format of the single-line entry in the main log that is written for every
63586 message received is shown in the basic example below, which is split over
63587 several lines in order to fit it on the page:
63588 </para>
63589 <literallayout class="monospaced">
63590 2002-10-31 08:57:53 16ZCW1-0005MB-00 &lt;= kryten@dwarf.fict.example
63591   H=mailer.fict.example [192.168.123.123] U=exim
63592   P=smtp S=5678 id=&lt;incoming message id&gt;
63593 </literallayout>
63594 <para>
63595 The address immediately following <quote>&lt;=</quote> is the envelope sender address. A
63596 bounce message is shown with the sender address <quote>&lt;&gt;</quote>, and if it is locally
63597 generated, this is followed by an item of the form
63598 </para>
63599 <literallayout class="monospaced">
63600 R=&lt;message id&gt;
63601 </literallayout>
63602 <para>
63603 which is a reference to the message that caused the bounce to be sent.
63604 </para>
63605 <para>
63606 <indexterm role="concept">
63607 <primary>HELO</primary>
63608 </indexterm>
63609 <indexterm role="concept">
63610 <primary>EHLO</primary>
63611 </indexterm>
63612 For messages from other hosts, the H and U fields identify the remote host and
63613 record the RFC 1413 identity of the user that sent the message, if one was
63614 received. The number given in square brackets is the IP address of the sending
63615 host. If there is a single, unparenthesized  host name in the H field, as
63616 above, it has been verified to correspond to the IP address (see the
63617 <option>host_lookup</option> option). If the name is in parentheses, it was the name quoted
63618 by the remote host in the SMTP HELO or EHLO command, and has not been
63619 verified. If verification yields a different name to that given for HELO or
63620 EHLO, the verified name appears first, followed by the HELO or EHLO
63621 name in parentheses.
63622 </para>
63623 <para>
63624 Misconfigured hosts (and mail forgers) sometimes put an IP address, with or
63625 without brackets, in the HELO or EHLO command, leading to entries in
63626 the log containing text like these examples:
63627 </para>
63628 <literallayout class="monospaced">
63629 H=(10.21.32.43) [192.168.8.34]
63630 H=([10.21.32.43]) [192.168.8.34]
63631 </literallayout>
63632 <para>
63633 This can be confusing. Only the final address in square brackets can be relied
63634 on.
63635 </para>
63636 <para>
63637 For locally generated messages (that is, messages not received over TCP/IP),
63638 the H field is omitted, and the U field contains the login name of the caller
63639 of Exim.
63640 </para>
63641 <para>
63642 <indexterm role="concept">
63643 <primary>authentication</primary>
63644 <secondary>logging</secondary>
63645 </indexterm>
63646 <indexterm role="concept">
63647 <primary>AUTH</primary>
63648 <secondary>logging</secondary>
63649 </indexterm>
63650 For all messages, the P field specifies the protocol used to receive the
63651 message. This is the value that is stored in <varname>$received_protocol</varname>. In the case
63652 of incoming SMTP messages, the value indicates whether or not any SMTP
63653 extensions (ESMTP), encryption, or authentication were used. If the SMTP
63654 session was encrypted, there is an additional X field that records the cipher
63655 suite that was used.
63656 </para>
63657 <para>
63658 The protocol is set to <quote>esmtpsa</quote> or <quote>esmtpa</quote> for messages received from
63659 hosts that have authenticated themselves using the SMTP AUTH command. The first
63660 value is used when the SMTP connection was encrypted (<quote>secure</quote>). In this case
63661 there is an additional item A= followed by the name of the authenticator that
63662 was used. If an authenticated identification was set up by the authenticator&#x2019;s
63663 <option>server_set_id</option> option, this is logged too, separated by a colon from the
63664 authenticator name.
63665 </para>
63666 <para>
63667 <indexterm role="concept">
63668 <primary>size</primary>
63669 <secondary>of message</secondary>
63670 </indexterm>
63671 The id field records the existing message id, if present. The size of the
63672 received message is given by the S field. When the message is delivered,
63673 headers may be removed or added, so that the size of delivered copies of the
63674 message may not correspond with this value (and indeed may be different to each
63675 other).
63676 </para>
63677 <para>
63678 The <option>log_selector</option> option can be used to request the logging of additional
63679 data when a message is received. See section <xref linkend="SECTlogselector"/> below.
63680 </para>
63681 </section>
63682 <section id="SECID252">
63683 <title>Logging deliveries</title>
63684 <para>
63685 <indexterm role="concept">
63686 <primary>log</primary>
63687 <secondary>delivery line</secondary>
63688 </indexterm>
63689 The format of the single-line entry in the main log that is written for every
63690 delivery is shown in one of the examples below, for local and remote
63691 deliveries, respectively. Each example has been split into two lines in order
63692 to fit it on the page:
63693 </para>
63694 <literallayout class="monospaced">
63695 2002-10-31 08:59:13 16ZCW1-0005MB-00 =&gt; marv
63696   &lt;marv@hitch.fict.example&gt; R=localuser T=local_delivery
63697 2002-10-31 09:00:10 16ZCW1-0005MB-00 =&gt;
63698   monk@holistic.fict.example R=dnslookup T=remote_smtp
63699   H=holistic.fict.example [192.168.234.234]
63700 </literallayout>
63701 <para>
63702 For ordinary local deliveries, the original address is given in angle brackets
63703 after the final delivery address, which might be a pipe or a file. If
63704 intermediate address(es) exist between the original and the final address, the
63705 last of these is given in parentheses after the final address. The R and T
63706 fields record the router and transport that were used to process the address.
63707 </para>
63708 <para>
63709 If SMTP AUTH was used for the delivery there is an additional item A=
63710 followed by the name of the authenticator that was used.
63711 If an authenticated identification was set up by the authenticator&#x2019;s <option>client_set_id</option>
63712 option, this is logged too, separated by a colon from the authenticator name.
63713 </para>
63714 <para>
63715 If a shadow transport was run after a successful local delivery, the log line
63716 for the successful delivery has an item added on the end, of the form
63717 </para>
63718 <literallayout>
63719 <literal>ST=&lt;</literal><emphasis>shadow transport name</emphasis><literal>&gt;</literal>
63720 </literallayout>
63721 <para>
63722 If the shadow transport did not succeed, the error message is put in
63723 parentheses afterwards.
63724 </para>
63725 <para>
63726 <indexterm role="concept">
63727 <primary>asterisk</primary>
63728 <secondary>after IP address</secondary>
63729 </indexterm>
63730 When more than one address is included in a single delivery (for example, two
63731 SMTP RCPT commands in one transaction) the second and subsequent addresses are
63732 flagged with <literal>-&gt;</literal> instead of <literal>=&gt;</literal>. When two or more messages are delivered
63733 down a single SMTP connection, an asterisk follows the IP address in the log
63734 lines for the second and subsequent messages.
63735 </para>
63736 <para>
63737 <indexterm role="concept">
63738 <primary>delivery</primary>
63739 <secondary>cutthrough; logging</secondary>
63740 </indexterm>
63741 <indexterm role="concept">
63742 <primary>cutthrough</primary>
63743 <secondary>logging</secondary>
63744 </indexterm>
63745 When delivery is done in cutthrough mode it is flagged with <literal>&gt;&gt;</literal> and the log
63746 line precedes the reception line, since cutthrough waits for a possible
63747 rejection from the destination in case it can reject the sourced item.
63748 </para>
63749 <para>
63750 The generation of a reply message by a filter file gets logged as a
63751 <quote>delivery</quote> to the addressee, preceded by <quote>&gt;</quote>.
63752 </para>
63753 <para>
63754 The <option>log_selector</option> option can be used to request the logging of additional
63755 data when a message is delivered. See section <xref linkend="SECTlogselector"/> below.
63756 </para>
63757 </section>
63758 <section id="SECID253">
63759 <title>Discarded deliveries</title>
63760 <para>
63761 <indexterm role="concept">
63762 <primary>discarded messages</primary>
63763 </indexterm>
63764 <indexterm role="concept">
63765 <primary>message</primary>
63766 <secondary>discarded</secondary>
63767 </indexterm>
63768 <indexterm role="concept">
63769 <primary>delivery</primary>
63770 <secondary>discarded; logging</secondary>
63771 </indexterm>
63772 When a message is discarded as a result of the command <quote>seen finish</quote> being
63773 obeyed in a filter file which generates no deliveries, a log entry of the form
63774 </para>
63775 <literallayout class="monospaced">
63776 2002-12-10 00:50:49 16auJc-0001UB-00 =&gt; discarded
63777   &lt;low.club@bridge.example&gt; R=userforward
63778 </literallayout>
63779 <para>
63780 is written, to record why no deliveries are logged. When a message is discarded
63781 because it is aliased to <quote>:blackhole:</quote> the log line is like this:
63782 </para>
63783 <literallayout class="monospaced">
63784 1999-03-02 09:44:33 10HmaX-0005vi-00 =&gt; :blackhole:
63785   &lt;hole@nowhere.example&gt; R=blackhole_router
63786 </literallayout>
63787 </section>
63788 <section id="SECID254">
63789 <title>Deferred deliveries</title>
63790 <para>
63791 When a delivery is deferred, a line of the following form is logged:
63792 </para>
63793 <literallayout class="monospaced">
63794 2002-12-19 16:20:23 16aiQz-0002Q5-00 == marvin@endrest.example
63795   R=dnslookup T=smtp defer (146): Connection refused
63796 </literallayout>
63797 <para>
63798 In the case of remote deliveries, the error is the one that was given for the
63799 last IP address that was tried. Details of individual SMTP failures are also
63800 written to the log, so the above line would be preceded by something like
63801 </para>
63802 <literallayout class="monospaced">
63803 2002-12-19 16:20:23 16aiQz-0002Q5-00 Failed to connect to
63804   mail1.endrest.example [192.168.239.239]: Connection refused
63805 </literallayout>
63806 <para>
63807 When a deferred address is skipped because its retry time has not been reached,
63808 a message is written to the log, but this can be suppressed by setting an
63809 appropriate value in <option>log_selector</option>.
63810 </para>
63811 </section>
63812 <section id="SECID255">
63813 <title>Delivery failures</title>
63814 <para>
63815 <indexterm role="concept">
63816 <primary>delivery</primary>
63817 <secondary>failure; logging</secondary>
63818 </indexterm>
63819 If a delivery fails because an address cannot be routed, a line of the
63820 following form is logged:
63821 </para>
63822 <literallayout class="monospaced">
63823 1995-12-19 16:20:23 0tRiQz-0002Q5-00 ** jim@trek99.example
63824   &lt;jim@trek99.example&gt;: unknown mail domain
63825 </literallayout>
63826 <para>
63827 If a delivery fails at transport time, the router and transport are shown, and
63828 the response from the remote host is included, as in this example:
63829 </para>
63830 <literallayout class="monospaced">
63831 2002-07-11 07:14:17 17SXDU-000189-00 ** ace400@pb.example
63832   R=dnslookup T=remote_smtp: SMTP error from remote mailer
63833   after pipelined RCPT TO:&lt;ace400@pb.example&gt;: host
63834   pbmail3.py.example [192.168.63.111]: 553 5.3.0
63835   &lt;ace400@pb.example&gt;...Addressee unknown
63836 </literallayout>
63837 <para>
63838 The word <quote>pipelined</quote> indicates that the SMTP PIPELINING extension was being
63839 used. See <option>hosts_avoid_esmtp</option> in the <command>smtp</command> transport for a way of
63840 disabling PIPELINING. The log lines for all forms of delivery failure are
63841 flagged with <literal>**</literal>.
63842 </para>
63843 </section>
63844 <section id="SECID256">
63845 <title>Fake deliveries</title>
63846 <para>
63847 <indexterm role="concept">
63848 <primary>delivery</primary>
63849 <secondary>fake; logging</secondary>
63850 </indexterm>
63851 If a delivery does not actually take place because the <option>-N</option> option has been
63852 used to suppress it, a normal delivery line is written to the log, except that
63853 <quote>=&gt;</quote> is replaced by <quote>*&gt;</quote>.
63854 </para>
63855 </section>
63856 <section id="SECID257">
63857 <title>Completion</title>
63858 <para>
63859 A line of the form
63860 </para>
63861 <literallayout class="monospaced">
63862 2002-10-31 09:00:11 16ZCW1-0005MB-00 Completed
63863 </literallayout>
63864 <para>
63865 is written to the main log when a message is about to be removed from the spool
63866 at the end of its processing.
63867 </para>
63868 </section>
63869 <section id="SECID258">
63870 <title>Summary of Fields in Log Lines</title>
63871 <para>
63872 <indexterm role="concept">
63873 <primary>log</primary>
63874 <secondary>summary of fields</secondary>
63875 </indexterm>
63876 A summary of the field identifiers that are used in log lines is shown in
63877 the following table:
63878 </para>
63879 <literallayout>
63880 <literal>A   </literal>        authenticator name (and optional id and sender)
63881 <literal>C   </literal>        SMTP confirmation on delivery
63882 <literal>    </literal>        command list for <quote>no mail in SMTP session</quote>
63883 <literal>CV  </literal>        certificate verification status
63884 <literal>D   </literal>        duration of <quote>no mail in SMTP session</quote>
63885 <literal>DN  </literal>        distinguished name from peer certificate
63886 <literal>DT  </literal>        on <literal>=&gt;</literal> lines: time taken for a delivery
63887 <literal>F   </literal>        sender address (on delivery lines)
63888 <literal>H   </literal>        host name and IP address
63889 <literal>I   </literal>        local interface used
63890 <literal>id  </literal>        message id for incoming message
63891 <literal>P   </literal>        on <literal>&lt;=</literal> lines: protocol used
63892 <literal>    </literal>        on <literal>=&gt;</literal> and <literal>**</literal> lines: return path
63893 <literal>QT  </literal>        on <literal>=&gt;</literal> lines: time spent on queue so far
63894 <literal>    </literal>        on <quote>Completed</quote> lines: time spent on queue
63895 <literal>R   </literal>        on <literal>&lt;=</literal> lines: reference for local bounce
63896 <literal>    </literal>        on <literal>=&gt;</literal>  <literal>**</literal> and <literal>==</literal> lines: router name
63897 <literal>S   </literal>        size of message
63898 <literal>SNI </literal>        server name indication from TLS client hello
63899 <literal>ST  </literal>        shadow transport name
63900 <literal>T   </literal>        on <literal>&lt;=</literal> lines: message subject (topic)
63901 <literal>    </literal>        on <literal>=&gt;</literal> <literal>**</literal> and <literal>==</literal> lines: transport name
63902 <literal>U   </literal>        local user or RFC 1413 identity
63903 <literal>X   </literal>        TLS cipher suite
63904 </literallayout>
63905 </section>
63906 <section id="SECID259">
63907 <title>Other log entries</title>
63908 <para>
63909 Various other types of log entry are written from time to time. Most should be
63910 self-explanatory. Among the more common are:
63911 </para>
63912 <itemizedlist>
63913 <listitem>
63914 <para>
63915 <indexterm role="concept">
63916 <primary>retry</primary>
63917 <secondary>time not reached</secondary>
63918 </indexterm>
63919 <emphasis>retry time not reached</emphasis>&nbsp;&nbsp;An address previously suffered a temporary error
63920 during routing or local delivery, and the time to retry has not yet arrived.
63921 This message is not written to an individual message log file unless it happens
63922 during the first delivery attempt.
63923 </para>
63924 </listitem>
63925 <listitem>
63926 <para>
63927 <emphasis>retry time not reached for any host</emphasis>&nbsp;&nbsp;An address previously suffered
63928 temporary errors during remote delivery, and the retry time has not yet arrived
63929 for any of the hosts to which it is routed.
63930 </para>
63931 </listitem>
63932 <listitem>
63933 <para>
63934 <indexterm role="concept">
63935 <primary>spool directory</primary>
63936 <secondary>file locked</secondary>
63937 </indexterm>
63938 <emphasis>spool file locked</emphasis>&nbsp;&nbsp;An attempt to deliver a message cannot proceed because
63939 some other Exim process is already working on the message. This can be quite
63940 common if queue running processes are started at frequent intervals. The
63941 <emphasis>exiwhat</emphasis> utility script can be used to find out what Exim processes are
63942 doing.
63943 </para>
63944 </listitem>
63945 <listitem>
63946 <para>
63947 <indexterm role="concept">
63948 <primary>error</primary>
63949 <secondary>ignored</secondary>
63950 </indexterm>
63951 <emphasis>error ignored</emphasis>&nbsp;&nbsp;There are several circumstances that give rise to this
63952 message:
63953 </para>
63954 <orderedlist numeration="arabic">
63955 <listitem>
63956 <para>
63957 Exim failed to deliver a bounce message whose age was greater than
63958 <option>ignore_bounce_errors_after</option>. The bounce was discarded.
63959 </para>
63960 </listitem>
63961 <listitem>
63962 <para>
63963 A filter file set up a delivery using the <quote>noerror</quote> option, and the delivery
63964 failed. The delivery was discarded.
63965 </para>
63966 </listitem>
63967 <listitem>
63968 <para>
63969 A delivery set up by a router configured with
63970 </para>
63971 <literallayout class="monospaced">
63972     errors_to = &lt;&gt;
63973 </literallayout>
63974 <para>
63975 failed. The delivery was discarded.
63976 </para>
63977 </listitem>
63978 </orderedlist>
63979 </listitem>
63980 </itemizedlist>
63981 </section>
63982 <section id="SECTlogselector">
63983 <title>Reducing or increasing what is logged</title>
63984 <para>
63985 <indexterm role="concept">
63986 <primary>log</primary>
63987 <secondary>selectors</secondary>
63988 </indexterm>
63989 By setting the <option>log_selector</option> global option, you can disable some of Exim&#x2019;s
63990 default logging, or you can request additional logging. The value of
63991 <option>log_selector</option> is made up of names preceded by plus or minus characters. For
63992 example:
63993 </para>
63994 <literallayout class="monospaced">
63995 log_selector = +arguments -retry_defer
63996 </literallayout>
63997 <para>
63998 The list of optional log items is in the following table, with the default
63999 selection marked by asterisks:
64000 </para>
64001 <literallayout>
64002 <literal> 8bitmime                   </literal>  received 8BITMIME status
64003 <literal>*acl_warn_skipped           </literal>  skipped <option>warn</option> statement in ACL
64004 <literal> address_rewrite            </literal>  address rewriting
64005 <literal> all_parents                </literal>  all parents in =&gt; lines
64006 <literal> arguments                  </literal>  command line arguments
64007 <literal>*connection_reject          </literal>  connection rejections
64008 <literal>*delay_delivery             </literal>  immediate delivery delayed
64009 <literal> deliver_time               </literal>  time taken to perform delivery
64010 <literal> delivery_size              </literal>  add <literal>S=</literal><emphasis>nnn</emphasis> to =&gt; lines
64011 <literal>*dnslist_defer              </literal>  defers of DNS list (aka RBL) lookups
64012 <literal>*etrn                       </literal>  ETRN commands
64013 <literal>*host_lookup_failed         </literal>  as it says
64014 <literal> ident_timeout              </literal>  timeout for ident connection
64015 <phrase revisionflag="changed"><literal> incoming_interface         </literal>  local interface on &lt;= and =&gt; lines
64016 </phrase><literal> incoming_port              </literal>  remote port on &lt;= lines
64017 <literal>*lost_incoming_connection   </literal>  as it says (includes timeouts)
64018 <literal> outgoing_port              </literal>  add remote port to =&gt; lines
64019 <literal>*queue_run                  </literal>  start and end queue runs
64020 <literal> queue_time                 </literal>  time on queue for one recipient
64021 <literal> queue_time_overall         </literal>  time on queue for whole message
64022 <literal> pid                        </literal>  Exim process id
64023 <literal> received_recipients        </literal>  recipients on &lt;= lines
64024 <literal> received_sender            </literal>  sender on &lt;= lines
64025 <literal>*rejected_header            </literal>  header contents on reject log
64026 <literal>*retry_defer                </literal>  <quote>retry time not reached</quote>
64027 <literal> return_path_on_delivery    </literal>  put return path on =&gt; and ** lines
64028 <literal> sender_on_delivery         </literal>  add sender to =&gt; lines
64029 <literal>*sender_verify_fail         </literal>  sender verification failures
64030 <literal>*size_reject                </literal>  rejection because too big
64031 <literal>*skip_delivery              </literal>  delivery skipped in a queue run
64032 <literal>*smtp_confirmation          </literal>  SMTP confirmation on =&gt; lines
64033 <literal> smtp_connection            </literal>  incoming SMTP connections
64034 <literal> smtp_incomplete_transaction</literal>  incomplete SMTP transactions
64035 <literal> smtp_mailauth              </literal>  AUTH argument to MAIL commands
64036 <literal> smtp_no_mail               </literal>  session with no MAIL commands
64037 <literal> smtp_protocol_error        </literal>  SMTP protocol errors
64038 <literal> smtp_syntax_error          </literal>  SMTP syntax errors
64039 <literal> subject                    </literal>  contents of <emphasis>Subject:</emphasis> on &lt;= lines
64040 <phrase revisionflag="changed"><literal>*tls_certificate_verified   </literal>  certificate verification status
64041 </phrase><literal>*tls_cipher                 </literal>  TLS cipher suite on &lt;= and =&gt; lines
64042 <literal> tls_peerdn                 </literal>  TLS peer DN on &lt;= and =&gt; lines
64043 <literal> tls_sni                    </literal>  TLS SNI on &lt;= lines
64044 <literal> unknown_in_list            </literal>  DNS lookup failed in list match
64045
64046 <literal> all                        </literal>  all of the above
64047 </literallayout>
64048 <para>
64049 More details on each of these items follows:
64050 </para>
64051 <itemizedlist>
64052 <listitem>
64053 <para>
64054 <indexterm role="concept">
64055 <primary>8BITMIME</primary>
64056 </indexterm>
64057 <indexterm role="concept">
64058 <primary>log</primary>
64059 <secondary>8BITMIME</secondary>
64060 </indexterm>
64061 <option>8bitmime</option>: This causes Exim to log any 8BITMIME status of received messages,
64062 which may help in tracking down interoperability issues with ancient MTAs
64063 that are not 8bit clean.  This is added to the <quote>&lt;=</quote> line, tagged with
64064 <literal>M8S=</literal> and a value of <literal>0</literal>, <literal>7</literal> or <literal>8</literal>, corresponding to "not given",
64065 <literal>7BIT</literal> and <literal>8BITMIME</literal> respectively.
64066 </para>
64067 </listitem>
64068 <listitem>
64069 <para>
64070 <indexterm role="concept">
64071 <primary><option>warn</option> ACL verb</primary>
64072 <secondary>log when skipping</secondary>
64073 </indexterm>
64074 <option>acl_warn_skipped</option>: When an ACL <option>warn</option> statement is skipped because one of
64075 its conditions cannot be evaluated, a log line to this effect is written if
64076 this log selector is set.
64077 </para>
64078 </listitem>
64079 <listitem>
64080 <para>
64081 <indexterm role="concept">
64082 <primary>log</primary>
64083 <secondary>rewriting</secondary>
64084 </indexterm>
64085 <indexterm role="concept">
64086 <primary>rewriting</primary>
64087 <secondary>logging</secondary>
64088 </indexterm>
64089 <option>address_rewrite</option>: This applies both to global rewrites and per-transport
64090 rewrites, but not to rewrites in filters run as an unprivileged user (because
64091 such users cannot access the log).
64092 </para>
64093 </listitem>
64094 <listitem>
64095 <para>
64096 <indexterm role="concept">
64097 <primary>log</primary>
64098 <secondary>full parentage</secondary>
64099 </indexterm>
64100 <option>all_parents</option>: Normally only the original and final addresses are logged on
64101 delivery lines; with this selector, intermediate parents are given in
64102 parentheses between them.
64103 </para>
64104 </listitem>
64105 <listitem>
64106 <para>
64107 <indexterm role="concept">
64108 <primary>log</primary>
64109 <secondary>Exim arguments</secondary>
64110 </indexterm>
64111 <indexterm role="concept">
64112 <primary>Exim arguments, logging</primary>
64113 </indexterm>
64114 <option>arguments</option>: This causes Exim to write the arguments with which it was called
64115 to the main log, preceded by the current working directory. This is a debugging
64116 feature, added to make it easier to find out how certain MUAs call
64117 <filename>/usr/sbin/sendmail</filename>. The logging does not happen if Exim has given up root
64118 privilege because it was called with the <option>-C</option> or <option>-D</option> options. Arguments
64119 that are empty or that contain white space are quoted. Non-printing characters
64120 are shown as escape sequences. This facility cannot log unrecognized arguments,
64121 because the arguments are checked before the configuration file is read. The
64122 only way to log such cases is to interpose a script such as <filename>util/logargs.sh</filename>
64123 between the caller and Exim.
64124 </para>
64125 </listitem>
64126 <listitem>
64127 <para>
64128 <indexterm role="concept">
64129 <primary>log</primary>
64130 <secondary>connection rejections</secondary>
64131 </indexterm>
64132 <option>connection_reject</option>: A log entry is written whenever an incoming SMTP
64133 connection is rejected, for whatever reason.
64134 </para>
64135 </listitem>
64136 <listitem>
64137 <para>
64138 <indexterm role="concept">
64139 <primary>log</primary>
64140 <secondary>delayed delivery</secondary>
64141 </indexterm>
64142 <indexterm role="concept">
64143 <primary>delayed delivery, logging</primary>
64144 </indexterm>
64145 <option>delay_delivery</option>: A log entry is written whenever a delivery process is not
64146 started for an incoming message because the load is too high or too many
64147 messages were received on one connection. Logging does not occur if no delivery
64148 process is started because <option>queue_only</option> is set or <option>-odq</option> was used.
64149 </para>
64150 </listitem>
64151 <listitem>
64152 <para>
64153 <indexterm role="concept">
64154 <primary>log</primary>
64155 <secondary>delivery duration</secondary>
64156 </indexterm>
64157 <option>deliver_time</option>: For each delivery, the amount of real time it has taken to
64158 perform the actual delivery is logged as DT=&lt;<emphasis>time</emphasis>&gt;, for example, <literal>DT=1s</literal>.
64159 </para>
64160 </listitem>
64161 <listitem>
64162 <para>
64163 <indexterm role="concept">
64164 <primary>log</primary>
64165 <secondary>message size on delivery</secondary>
64166 </indexterm>
64167 <indexterm role="concept">
64168 <primary>size</primary>
64169 <secondary>of message</secondary>
64170 </indexterm>
64171 <option>delivery_size</option>: For each delivery, the size of message delivered is added to
64172 the <quote>=&gt;</quote> line, tagged with S=.
64173 </para>
64174 </listitem>
64175 <listitem>
64176 <para>
64177 <indexterm role="concept">
64178 <primary>log</primary>
64179 <secondary>dnslist defer</secondary>
64180 </indexterm>
64181 <indexterm role="concept">
64182 <primary>DNS list</primary>
64183 <secondary>logging defer</secondary>
64184 </indexterm>
64185 <indexterm role="concept">
64186 <primary>black list (DNS)</primary>
64187 </indexterm>
64188 <option>dnslist_defer</option>: A log entry is written if an attempt to look up a host in a
64189 DNS black list suffers a temporary error.
64190 </para>
64191 </listitem>
64192 <listitem>
64193 <para>
64194 <indexterm role="concept">
64195 <primary>log</primary>
64196 <secondary>ETRN commands</secondary>
64197 </indexterm>
64198 <indexterm role="concept">
64199 <primary>ETRN</primary>
64200 <secondary>logging</secondary>
64201 </indexterm>
64202 <option>etrn</option>: Every valid ETRN command that is received is logged, before the ACL
64203 is run to determine whether or not it is actually accepted. An invalid ETRN
64204 command, or one received within a message transaction is not logged by this
64205 selector (see <option>smtp_syntax_error</option> and <option>smtp_protocol_error</option>).
64206 </para>
64207 </listitem>
64208 <listitem>
64209 <para>
64210 <indexterm role="concept">
64211 <primary>log</primary>
64212 <secondary>host lookup failure</secondary>
64213 </indexterm>
64214 <option>host_lookup_failed</option>: When a lookup of a host&#x2019;s IP addresses fails to find
64215 any addresses, or when a lookup of an IP address fails to find a host name, a
64216 log line is written. This logging does not apply to direct DNS lookups when
64217 routing email addresses, but it does apply to <quote>byname</quote> lookups.
64218 </para>
64219 </listitem>
64220 <listitem>
64221 <para>
64222 <indexterm role="concept">
64223 <primary>log</primary>
64224 <secondary>ident timeout</secondary>
64225 </indexterm>
64226 <indexterm role="concept">
64227 <primary>RFC 1413</primary>
64228 <secondary>logging timeout</secondary>
64229 </indexterm>
64230 <option>ident_timeout</option>: A log line is written whenever an attempt to connect to a
64231 client&#x2019;s ident port times out.
64232 </para>
64233 </listitem>
64234 <listitem>
64235 <para>
64236 <indexterm role="concept">
64237 <primary>log</primary>
64238 <secondary>incoming interface</secondary>
64239 </indexterm>
64240 <indexterm role="concept">
64241 <primary>log</primary>
64242 <secondary>local interface</secondary>
64243 </indexterm>
64244 <indexterm role="concept">
64245 <primary>log</primary>
64246 <secondary>local address and port</secondary>
64247 </indexterm>
64248 <indexterm role="concept">
64249 <primary>TCP/IP</primary>
64250 <secondary>logging local address and port</secondary>
64251 </indexterm>
64252 <indexterm role="concept">
64253 <primary>interface</primary>
64254 <secondary>logging</secondary>
64255 </indexterm>
64256 <option>incoming_interface</option>: The interface on which a message was received is added
64257 to the <quote>&lt;=</quote> line as an IP address in square brackets, tagged by I= and
64258 followed by a colon and the port number. The local interface and port are also
64259 added to other SMTP log lines, for example <quote>SMTP connection from</quote> and to
64260 rejection lines
64261 </para>
64262 <para revisionflag="changed">
64263 and (despite the name) the local interface is added to <quote>=&gt;</quote> lines..
64264 </para>
64265 </listitem>
64266 <listitem>
64267 <para>
64268 <indexterm role="concept">
64269 <primary>log</primary>
64270 <secondary>incoming remote port</secondary>
64271 </indexterm>
64272 <indexterm role="concept">
64273 <primary>port</primary>
64274 <secondary>logging remote</secondary>
64275 </indexterm>
64276 <indexterm role="concept">
64277 <primary>TCP/IP</primary>
64278 <secondary>logging incoming remote port</secondary>
64279 </indexterm>
64280 <indexterm role="variable">
64281 <primary><varname>$sender_fullhost</varname></primary>
64282 </indexterm>
64283 <indexterm role="variable">
64284 <primary><varname>$sender_rcvhost</varname></primary>
64285 </indexterm>
64286 <option>incoming_port</option>: The remote port number from which a message was received is
64287 added to log entries and <emphasis>Received:</emphasis> header lines, following the IP address
64288 in square brackets, and separated from it by a colon. This is implemented by
64289 changing the value that is put in the <varname>$sender_fullhost</varname> and
64290 <varname>$sender_rcvhost</varname> variables. Recording the remote port number has become more
64291 important with the widening use of NAT (see RFC 2505).
64292 </para>
64293 </listitem>
64294 <listitem>
64295 <para>
64296 <indexterm role="concept">
64297 <primary>log</primary>
64298 <secondary>dropped connection</secondary>
64299 </indexterm>
64300 <option>lost_incoming_connection</option>: A log line is written when an incoming SMTP
64301 connection is unexpectedly dropped.
64302 </para>
64303 </listitem>
64304 <listitem>
64305 <para>
64306 <indexterm role="concept">
64307 <primary>log</primary>
64308 <secondary>outgoing remote port</secondary>
64309 </indexterm>
64310 <indexterm role="concept">
64311 <primary>port</primary>
64312 <secondary>logging outgoint remote</secondary>
64313 </indexterm>
64314 <indexterm role="concept">
64315 <primary>TCP/IP</primary>
64316 <secondary>logging ougtoing remote port</secondary>
64317 </indexterm>
64318 <option>outgoing_port</option>: The remote port number is added to delivery log lines (those
64319 containing =&gt; tags) following the IP address. This option is not included in
64320 the default setting, because for most ordinary configurations, the remote port
64321 number is always 25 (the SMTP port).
64322 </para>
64323 </listitem>
64324 <listitem>
64325 <para>
64326 <indexterm role="concept">
64327 <primary>log</primary>
64328 <secondary>process ids in</secondary>
64329 </indexterm>
64330 <indexterm role="concept">
64331 <primary>pid (process id)</primary>
64332 <secondary>in log lines</secondary>
64333 </indexterm>
64334 <option>pid</option>: The current process id is added to every log line, in square brackets,
64335 immediately after the time and date.
64336 </para>
64337 </listitem>
64338 <listitem>
64339 <para>
64340 <indexterm role="concept">
64341 <primary>log</primary>
64342 <secondary>queue run</secondary>
64343 </indexterm>
64344 <indexterm role="concept">
64345 <primary>queue runner</primary>
64346 <secondary>logging</secondary>
64347 </indexterm>
64348 <option>queue_run</option>: The start and end of every queue run are logged.
64349 </para>
64350 </listitem>
64351 <listitem>
64352 <para>
64353 <indexterm role="concept">
64354 <primary>log</primary>
64355 <secondary>queue time</secondary>
64356 </indexterm>
64357 <option>queue_time</option>: The amount of time the message has been in the queue on the
64358 local host is logged as QT=&lt;<emphasis>time</emphasis>&gt; on delivery (<literal>=&gt;</literal>) lines, for example,
64359 <literal>QT=3m45s</literal>. The clock starts when Exim starts to receive the message, so it
64360 includes reception time as well as the delivery time for the current address.
64361 This means that it may be longer than the difference between the arrival and
64362 delivery log line times, because the arrival log line is not written until the
64363 message has been successfully received.
64364 </para>
64365 </listitem>
64366 <listitem>
64367 <para>
64368 <option>queue_time_overall</option>: The amount of time the message has been in the queue on
64369 the local host is logged as QT=&lt;<emphasis>time</emphasis>&gt; on <quote>Completed</quote> lines, for
64370 example, <literal>QT=3m45s</literal>. The clock starts when Exim starts to receive the
64371 message, so it includes reception time as well as the total delivery time.
64372 </para>
64373 </listitem>
64374 <listitem>
64375 <para>
64376 <indexterm role="concept">
64377 <primary>log</primary>
64378 <secondary>recipients</secondary>
64379 </indexterm>
64380 <option>received_recipients</option>: The recipients of a message are listed in the main log
64381 as soon as the message is received. The list appears at the end of the log line
64382 that is written when a message is received, preceded by the word <quote>for</quote>. The
64383 addresses are listed after they have been qualified, but before any rewriting
64384 has taken place.
64385 Recipients that were discarded by an ACL for MAIL or RCPT do not appear
64386 in the list.
64387 </para>
64388 </listitem>
64389 <listitem>
64390 <para>
64391 <indexterm role="concept">
64392 <primary>log</primary>
64393 <secondary>sender reception</secondary>
64394 </indexterm>
64395 <option>received_sender</option>: The unrewritten original sender of a message is added to
64396 the end of the log line that records the message&#x2019;s arrival, after the word
64397 <quote>from</quote> (before the recipients if <option>received_recipients</option> is also set).
64398 </para>
64399 </listitem>
64400 <listitem>
64401 <para>
64402 <indexterm role="concept">
64403 <primary>log</primary>
64404 <secondary>header lines for rejection</secondary>
64405 </indexterm>
64406 <option>rejected_header</option>: If a message&#x2019;s header has been received at the time a
64407 rejection is written to the reject log, the complete header is added to the
64408 log. Header logging can be turned off individually for messages that are
64409 rejected by the <function>local_scan()</function> function (see section <xref linkend="SECTapiforloc"/>).
64410 </para>
64411 </listitem>
64412 <listitem>
64413 <para>
64414 <indexterm role="concept">
64415 <primary>log</primary>
64416 <secondary>retry defer</secondary>
64417 </indexterm>
64418 <option>retry_defer</option>: A log line is written if a delivery is deferred because a
64419 retry time has not yet been reached. However, this <quote>retry time not reached</quote>
64420 message is always omitted from individual message logs after the first delivery
64421 attempt.
64422 </para>
64423 </listitem>
64424 <listitem>
64425 <para>
64426 <indexterm role="concept">
64427 <primary>log</primary>
64428 <secondary>return path</secondary>
64429 </indexterm>
64430 <option>return_path_on_delivery</option>: The return path that is being transmitted with
64431 the message is included in delivery and bounce lines, using the tag P=.
64432 This is omitted if no delivery actually happens, for example, if routing fails,
64433 or if delivery is to <filename>/dev/null</filename> or to <literal>:blackhole:</literal>.
64434 </para>
64435 </listitem>
64436 <listitem>
64437 <para>
64438 <indexterm role="concept">
64439 <primary>log</primary>
64440 <secondary>sender on delivery</secondary>
64441 </indexterm>
64442 <option>sender_on_delivery</option>: The message&#x2019;s sender address is added to every delivery
64443 and bounce line, tagged by F= (for <quote>from</quote>).
64444 This is the original sender that was received with the message; it is not
64445 necessarily the same as the outgoing return path.
64446 </para>
64447 </listitem>
64448 <listitem>
64449 <para>
64450 <indexterm role="concept">
64451 <primary>log</primary>
64452 <secondary>sender verify failure</secondary>
64453 </indexterm>
64454 <option>sender_verify_fail</option>: If this selector is unset, the separate log line that
64455 gives details of a sender verification failure is not written. Log lines for
64456 the rejection of SMTP commands contain just <quote>sender verify failed</quote>, so some
64457 detail is lost.
64458 </para>
64459 </listitem>
64460 <listitem>
64461 <para>
64462 <indexterm role="concept">
64463 <primary>log</primary>
64464 <secondary>size rejection</secondary>
64465 </indexterm>
64466 <option>size_reject</option>: A log line is written whenever a message is rejected because
64467 it is too big.
64468 </para>
64469 </listitem>
64470 <listitem>
64471 <para>
64472 <indexterm role="concept">
64473 <primary>log</primary>
64474 <secondary>frozen messages; skipped</secondary>
64475 </indexterm>
64476 <indexterm role="concept">
64477 <primary>frozen messages</primary>
64478 <secondary>logging skipping</secondary>
64479 </indexterm>
64480 <option>skip_delivery</option>: A log line is written whenever a message is skipped during a
64481 queue run because it is frozen or because another process is already delivering
64482 it.
64483 <indexterm role="concept">
64484 <primary><quote>spool file is locked</quote></primary>
64485 </indexterm>
64486 The message that is written is <quote>spool file is locked</quote>.
64487 </para>
64488 </listitem>
64489 <listitem>
64490 <para>
64491 <indexterm role="concept">
64492 <primary>log</primary>
64493 <secondary>smtp confirmation</secondary>
64494 </indexterm>
64495 <indexterm role="concept">
64496 <primary>SMTP</primary>
64497 <secondary>logging confirmation</secondary>
64498 </indexterm>
64499 <indexterm role="concept">
64500 <primary>LMTP</primary>
64501 <secondary>logging confirmation</secondary>
64502 </indexterm>
64503 <option>smtp_confirmation</option>: The response to the final <quote>.</quote> in the SMTP or LMTP dialogue for
64504 outgoing messages is added to delivery log lines in the form <literal>C=</literal>&lt;<emphasis>text</emphasis>&gt;.
64505 A number of MTAs (including Exim) return an identifying string in this
64506 response.
64507 </para>
64508 </listitem>
64509 <listitem>
64510 <para>
64511 <indexterm role="concept">
64512 <primary>log</primary>
64513 <secondary>SMTP connections</secondary>
64514 </indexterm>
64515 <indexterm role="concept">
64516 <primary>SMTP</primary>
64517 <secondary>logging connections</secondary>
64518 </indexterm>
64519 <option>smtp_connection</option>: A log line is written whenever an incoming SMTP connection is
64520 established or closed, unless the connection is from a host that matches
64521 <option>hosts_connection_nolog</option>. (In contrast, <option>lost_incoming_connection</option> applies
64522 only when the closure is unexpected.) This applies to connections from local
64523 processes that use <option>-bs</option> as well as to TCP/IP connections. If a connection is
64524 dropped in the middle of a message, a log line is always written, whether or
64525 not this selector is set, but otherwise nothing is written at the start and end
64526 of connections unless this selector is enabled.
64527 </para>
64528 <para>
64529 For TCP/IP connections to an Exim daemon, the current number of connections is
64530 included in the log message for each new connection, but note that the count is
64531 reset if the daemon is restarted.
64532 Also, because connections are closed (and the closure is logged) in
64533 subprocesses, the count may not include connections that have been closed but
64534 whose termination the daemon has not yet noticed. Thus, while it is possible to
64535 match up the opening and closing of connections in the log, the value of the
64536 logged counts may not be entirely accurate.
64537 </para>
64538 </listitem>
64539 <listitem>
64540 <para>
64541 <indexterm role="concept">
64542 <primary>log</primary>
64543 <secondary>SMTP transaction; incomplete</secondary>
64544 </indexterm>
64545 <indexterm role="concept">
64546 <primary>SMTP</primary>
64547 <secondary>logging incomplete transactions</secondary>
64548 </indexterm>
64549 <option>smtp_incomplete_transaction</option>: When a mail transaction is aborted by
64550 RSET, QUIT, loss of connection, or otherwise, the incident is logged,
64551 and the message sender plus any accepted recipients are included in the log
64552 line. This can provide evidence of dictionary attacks.
64553 </para>
64554 </listitem>
64555 <listitem>
64556 <para>
64557 <indexterm role="concept">
64558 <primary>log</primary>
64559 <secondary>non-MAIL SMTP sessions</secondary>
64560 </indexterm>
64561 <indexterm role="concept">
64562 <primary>MAIL</primary>
64563 <secondary>logging session without</secondary>
64564 </indexterm>
64565 <option>smtp_no_mail</option>: A line is written to the main log whenever an accepted SMTP
64566 connection terminates without having issued a MAIL command. This includes both
64567 the case when the connection is dropped, and the case when QUIT is used. It
64568 does not include cases where the connection is rejected right at the start (by
64569 an ACL, or because there are too many connections, or whatever). These cases
64570 already have their own log lines.
64571 </para>
64572 <para>
64573 The log line that is written contains the identity of the client in the usual
64574 way, followed by D= and a time, which records the duration of the connection.
64575 If the connection was authenticated, this fact is logged exactly as it is for
64576 an incoming message, with an A= item. If the connection was encrypted, CV=,
64577 DN=, and X= items may appear as they do for an incoming message, controlled by
64578 the same logging options.
64579 </para>
64580 <para>
64581 Finally, if any SMTP commands were issued during the connection, a C= item
64582 is added to the line, listing the commands that were used. For example,
64583 </para>
64584 <literallayout class="monospaced">
64585 C=EHLO,QUIT
64586 </literallayout>
64587 <para>
64588 shows that the client issued QUIT straight after EHLO. If there were fewer
64589 than 20 commands, they are all listed. If there were more than 20 commands,
64590 the last 20 are listed, preceded by <quote>...</quote>. However, with the default
64591 setting of 10 for <option>smtp_accept_max_nonmail</option>, the connection will in any case
64592 have been aborted before 20 non-mail commands are processed.
64593 </para>
64594 </listitem>
64595 <listitem>
64596 <para>
64597 <option>smtp_mailauth</option>: A third subfield with the authenticated sender,
64598 colon-separated, is appended to the A= item for a message arrival or delivery
64599 log line, if an AUTH argument to the SMTP MAIL command (see <xref linkend="SECTauthparamail"/>)
64600 was accepted or used.
64601 </para>
64602 </listitem>
64603 <listitem>
64604 <para>
64605 <indexterm role="concept">
64606 <primary>log</primary>
64607 <secondary>SMTP protocol error</secondary>
64608 </indexterm>
64609 <indexterm role="concept">
64610 <primary>SMTP</primary>
64611 <secondary>logging protocol error</secondary>
64612 </indexterm>
64613 <option>smtp_protocol_error</option>: A log line is written for every SMTP protocol error
64614 encountered. Exim does not have perfect detection of all protocol errors
64615 because of transmission delays and the use of pipelining. If PIPELINING has
64616 been advertised to a client, an Exim server assumes that the client will use
64617 it, and therefore it does not count <quote>expected</quote> errors (for example, RCPT
64618 received after rejecting MAIL) as protocol errors.
64619 </para>
64620 </listitem>
64621 <listitem>
64622 <para>
64623 <indexterm role="concept">
64624 <primary>SMTP</primary>
64625 <secondary>logging syntax errors</secondary>
64626 </indexterm>
64627 <indexterm role="concept">
64628 <primary>SMTP</primary>
64629 <secondary>syntax errors; logging</secondary>
64630 </indexterm>
64631 <indexterm role="concept">
64632 <primary>SMTP</primary>
64633 <secondary>unknown command; logging</secondary>
64634 </indexterm>
64635 <indexterm role="concept">
64636 <primary>log</primary>
64637 <secondary>unknown SMTP command</secondary>
64638 </indexterm>
64639 <indexterm role="concept">
64640 <primary>log</primary>
64641 <secondary>SMTP syntax error</secondary>
64642 </indexterm>
64643 <option>smtp_syntax_error</option>: A log line is written for every SMTP syntax error
64644 encountered. An unrecognized command is treated as a syntax error. For an
64645 external connection, the host identity is given; for an internal connection
64646 using <option>-bs</option> the sender identification (normally the calling user) is given.
64647 </para>
64648 </listitem>
64649 <listitem>
64650 <para>
64651 <indexterm role="concept">
64652 <primary>log</primary>
64653 <secondary>subject</secondary>
64654 </indexterm>
64655 <indexterm role="concept">
64656 <primary>subject, logging</primary>
64657 </indexterm>
64658 <option>subject</option>: The subject of the message is added to the arrival log line,
64659 preceded by <quote>T=</quote> (T for <quote>topic</quote>, since S is already used for <quote>size</quote>).
64660 Any MIME <quote>words</quote> in the subject are decoded. The <option>print_topbitchars</option> option
64661 specifies whether characters with values greater than 127 should be logged
64662 unchanged, or whether they should be rendered as escape sequences.
64663 </para>
64664 </listitem>
64665 <listitem>
64666 <para>
64667 <indexterm role="concept">
64668 <primary>log</primary>
64669 <secondary>certificate verification</secondary>
64670 </indexterm>
64671 <option>tls_certificate_verified</option>: An extra item is added to &lt;= and =&gt; log lines
64672 when TLS is in use. The item is <literal>CV=yes</literal> if the peer&#x2019;s certificate was
64673 verified, and <literal>CV=no</literal> if not.
64674 </para>
64675 </listitem>
64676 <listitem>
64677 <para>
64678 <indexterm role="concept">
64679 <primary>log</primary>
64680 <secondary>TLS cipher</secondary>
64681 </indexterm>
64682 <indexterm role="concept">
64683 <primary>TLS</primary>
64684 <secondary>logging cipher</secondary>
64685 </indexterm>
64686 <option>tls_cipher</option>: When a message is sent or received over an encrypted
64687 connection, the cipher suite used is added to the log line, preceded by X=.
64688 </para>
64689 </listitem>
64690 <listitem>
64691 <para>
64692 <indexterm role="concept">
64693 <primary>log</primary>
64694 <secondary>TLS peer DN</secondary>
64695 </indexterm>
64696 <indexterm role="concept">
64697 <primary>TLS</primary>
64698 <secondary>logging peer DN</secondary>
64699 </indexterm>
64700 <option>tls_peerdn</option>: When a message is sent or received over an encrypted
64701 connection, and a certificate is supplied by the remote host, the peer DN is
64702 added to the log line, preceded by DN=.
64703 </para>
64704 </listitem>
64705 <listitem>
64706 <para>
64707 <indexterm role="concept">
64708 <primary>log</primary>
64709 <secondary>TLS SNI</secondary>
64710 </indexterm>
64711 <indexterm role="concept">
64712 <primary>TLS</primary>
64713 <secondary>logging SNI</secondary>
64714 </indexterm>
64715 <option>tls_sni</option>: When a message is received over an encrypted connection, and
64716 the remote host provided the Server Name Indication extension, the SNI is
64717 added to the log line, preceded by SNI=.
64718 </para>
64719 </listitem>
64720 <listitem>
64721 <para>
64722 <indexterm role="concept">
64723 <primary>log</primary>
64724 <secondary>DNS failure in list</secondary>
64725 </indexterm>
64726 <option>unknown_in_list</option>: This setting causes a log entry to be written when the
64727 result of a list match is failure because a DNS lookup failed.
64728 </para>
64729 </listitem>
64730 </itemizedlist>
64731 </section>
64732 <section id="SECID260">
64733 <title>Message log</title>
64734 <para>
64735 <indexterm role="concept">
64736 <primary>message</primary>
64737 <secondary>log file for</secondary>
64738 </indexterm>
64739 <indexterm role="concept">
64740 <primary>log</primary>
64741 <secondary>message log; description of</secondary>
64742 </indexterm>
64743 <indexterm role="concept">
64744 <primary><filename>msglog</filename> directory</primary>
64745 </indexterm>
64746 <indexterm role="option">
64747 <primary><option>preserve_message_logs</option></primary>
64748 </indexterm>
64749 In addition to the general log files, Exim writes a log file for each message
64750 that it handles. The names of these per-message logs are the message ids, and
64751 they are kept in the <filename>msglog</filename> sub-directory of the spool directory. Each
64752 message log contains copies of the log lines that apply to the message. This
64753 makes it easier to inspect the status of an individual message without having
64754 to search the main log. A message log is deleted when processing of the message
64755 is complete, unless <option>preserve_message_logs</option> is set, but this should be used
64756 only with great care because they can fill up your disk very quickly.
64757 </para>
64758 <para>
64759 On a heavily loaded system, it may be desirable to disable the use of
64760 per-message logs, in order to reduce disk I/O. This can be done by setting the
64761 <option>message_logs</option> option false.
64762 <indexterm role="concept" startref="IIDloggen" class="endofrange"/>
64763 </para>
64764 </section>
64765 </chapter>
64766
64767 <chapter id="CHAPutils">
64768 <title>Exim utilities</title>
64769 <para>
64770 <indexterm role="concept" id="IIDutils" class="startofrange">
64771 <primary>utilities</primary>
64772 </indexterm>
64773 A number of utility scripts and programs are supplied with Exim and are
64774 described in this chapter. There is also the Exim Monitor, which is covered in
64775 the next chapter. The utilities described here are:
64776 </para>
64777 <informaltable frame="none">
64778 <tgroup cols="3" colsep="0" rowsep="0">
64779 <colspec colwidth="7*" align="left"/>
64780 <colspec colwidth="15*" align="left"/>
64781 <colspec colwidth="40*" align="left"/>
64782 <tbody>
64783 <row>
64784 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<xref linkend="SECTfinoutwha"/></entry>
64785 <entry><emphasis>exiwhat</emphasis></entry>
64786 <entry>list what Exim processes are doing</entry>
64787 </row>
64788 <row>
64789 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<xref linkend="SECTgreptheque"/></entry>
64790 <entry><emphasis>exiqgrep</emphasis></entry>
64791 <entry>grep the queue</entry>
64792 </row>
64793 <row>
64794 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<xref linkend="SECTsumtheque"/></entry>
64795 <entry><emphasis>exiqsumm</emphasis></entry>
64796 <entry>summarize the queue</entry>
64797 </row>
64798 <row>
64799 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<xref linkend="SECTextspeinf"/></entry>
64800 <entry><emphasis>exigrep</emphasis></entry>
64801 <entry>search the main log</entry>
64802 </row>
64803 <row>
64804 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<xref linkend="SECTexipick"/></entry>
64805 <entry><emphasis>exipick</emphasis></entry>
64806 <entry>select messages on various criteria</entry>
64807 </row>
64808 <row>
64809 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<xref linkend="SECTcyclogfil"/></entry>
64810 <entry><emphasis>exicyclog</emphasis></entry>
64811 <entry>cycle (rotate) log files</entry>
64812 </row>
64813 <row>
64814 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<xref linkend="SECTmailstat"/></entry>
64815 <entry><emphasis>eximstats</emphasis></entry>
64816 <entry>extract statistics from the log</entry>
64817 </row>
64818 <row>
64819 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<xref linkend="SECTcheckaccess"/></entry>
64820 <entry><emphasis>exim_checkaccess</emphasis></entry>
64821 <entry>check address acceptance from given IP</entry>
64822 </row>
64823 <row>
64824 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<xref linkend="SECTdbmbuild"/></entry>
64825 <entry><emphasis>exim_dbmbuild</emphasis></entry>
64826 <entry>build a DBM file</entry>
64827 </row>
64828 <row>
64829 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<xref linkend="SECTfinindret"/></entry>
64830 <entry><emphasis>exinext</emphasis></entry>
64831 <entry>extract retry information</entry>
64832 </row>
64833 <row>
64834 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<xref linkend="SECThindatmai"/></entry>
64835 <entry><emphasis>exim_dumpdb</emphasis></entry>
64836 <entry>dump a hints database</entry>
64837 </row>
64838 <row>
64839 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<xref linkend="SECThindatmai"/></entry>
64840 <entry><emphasis>exim_tidydb</emphasis></entry>
64841 <entry>clean up a hints database</entry>
64842 </row>
64843 <row>
64844 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<xref linkend="SECThindatmai"/></entry>
64845 <entry><emphasis>exim_fixdb</emphasis></entry>
64846 <entry>patch a hints database</entry>
64847 </row>
64848 <row>
64849 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<xref linkend="SECTmailboxmaint"/></entry>
64850 <entry><emphasis>exim_lock</emphasis></entry>
64851 <entry>lock a mailbox file</entry>
64852 </row>
64853 </tbody>
64854 </tgroup>
64855 </informaltable>
64856 <para>
64857 Another utility that might be of use to sites with many MTAs is Tom Kistner&#x2019;s
64858 <emphasis>exilog</emphasis>. It provides log visualizations across multiple Exim servers. See
64859 <emphasis role="bold"><ulink url="http://duncanthrax.net/exilog/">http://duncanthrax.net/exilog/</ulink></emphasis> for details.
64860 </para>
64861 <section id="SECTfinoutwha">
64862 <title>Finding out what Exim processes are doing (exiwhat)</title>
64863 <para>
64864 <indexterm role="concept">
64865 <primary><emphasis>exiwhat</emphasis></primary>
64866 </indexterm>
64867 <indexterm role="concept">
64868 <primary>process, querying</primary>
64869 </indexterm>
64870 <indexterm role="concept">
64871 <primary>SIGUSR1</primary>
64872 </indexterm>
64873 On operating systems that can restart a system call after receiving a signal
64874 (most modern OS), an Exim process responds to the SIGUSR1 signal by writing
64875 a line describing what it is doing to the file <filename>exim-process.info</filename> in the
64876 Exim spool directory. The <emphasis>exiwhat</emphasis> script sends the signal to all Exim
64877 processes it can find, having first emptied the file. It then waits for one
64878 second to allow the Exim processes to react before displaying the results. In
64879 order to run <emphasis>exiwhat</emphasis> successfully you have to have sufficient privilege to
64880 send the signal to the Exim processes, so it is normally run as root.
64881 </para>
64882 <para>
64883 <emphasis role="bold">Warning</emphasis>: This is not an efficient process. It is intended for occasional
64884 use by system administrators. It is not sensible, for example, to set up a
64885 script that sends SIGUSR1 signals to Exim processes at short intervals.
64886 </para>
64887 <para>
64888 Unfortunately, the <emphasis>ps</emphasis> command that <emphasis>exiwhat</emphasis> uses to find Exim processes
64889 varies in different operating systems. Not only are different options used,
64890 but the format of the output is different. For this reason, there are some
64891 system configuration options that configure exactly how <emphasis>exiwhat</emphasis> works. If
64892 it doesn&#x2019;t seem to be working for you, check the following compile-time
64893 options:
64894 </para>
64895 <literallayout>
64896 <literal>EXIWHAT_PS_CMD    </literal> the command for running <emphasis>ps</emphasis>
64897 <literal>EXIWHAT_PS_ARG    </literal> the argument for <emphasis>ps</emphasis>
64898 <literal>EXIWHAT_EGREP_ARG </literal> the argument for <emphasis>egrep</emphasis> to select from <emphasis>ps</emphasis> output
64899 <literal>EXIWHAT_KILL_ARG  </literal> the argument for the <emphasis>kill</emphasis> command
64900 </literallayout>
64901 <para>
64902 An example of typical output from <emphasis>exiwhat</emphasis> is
64903 </para>
64904 <literallayout class="monospaced">
64905 164 daemon: -q1h, listening on port 25
64906 10483 running queue: waiting for 0tAycK-0002ij-00 (10492)
64907 10492 delivering 0tAycK-0002ij-00 to mail.ref.example
64908   [10.19.42.42] (editor@ref.example)
64909 10592 handling incoming call from [192.168.243.242]
64910 10628 accepting a local non-SMTP message
64911 </literallayout>
64912 <para>
64913 The first number in the output line is the process number. The third line has
64914 been split here, in order to fit it on the page.
64915 </para>
64916 </section>
64917 <section id="SECTgreptheque">
64918 <title>Selective queue listing (exiqgrep)</title>
64919 <para>
64920 <indexterm role="concept">
64921 <primary><emphasis>exiqgrep</emphasis></primary>
64922 </indexterm>
64923 <indexterm role="concept">
64924 <primary>queue</primary>
64925 <secondary>grepping</secondary>
64926 </indexterm>
64927 This utility is a Perl script contributed by Matt Hubbard. It runs
64928 </para>
64929 <literallayout class="monospaced">
64930 exim -bpu
64931 </literallayout>
64932 <para>
64933 or (in case <emphasis role="bold">-a</emphasis> switch is specified)
64934 </para>
64935 <literallayout class="monospaced">
64936 exim -bp
64937 </literallayout>
64938 <para>
64939 The <emphasis role="bold">-C</emphasis> option is used to specify an alternate <filename>exim.conf</filename> which might
64940 contain alternate exim configuration the queue management might be using.
64941 </para>
64942 <para>
64943 to obtain a queue listing, and then greps the output to select messages
64944 that match given criteria. The following selection options are available:
64945 </para>
64946 <variablelist>
64947 <varlistentry>
64948 <term><emphasis role="bold">-f</emphasis>&nbsp;&lt;<emphasis>regex</emphasis>&gt;</term>
64949 <listitem>
64950 <para>
64951 Match the sender address using a case-insensitive search. The field that is
64952 tested is enclosed in angle brackets, so you can test for bounce messages with
64953 </para>
64954 <literallayout class="monospaced">
64955 exiqgrep -f '^&lt;&gt;$'
64956 </literallayout>
64957 </listitem></varlistentry>
64958 <varlistentry>
64959 <term><emphasis role="bold">-r</emphasis>&nbsp;&lt;<emphasis>regex</emphasis>&gt;</term>
64960 <listitem>
64961 <para>
64962 Match a recipient address using a case-insensitive search. The field that is
64963 tested is not enclosed in angle brackets.
64964 </para>
64965 </listitem></varlistentry>
64966 <varlistentry>
64967 <term><emphasis role="bold">-s</emphasis>&nbsp;&lt;<emphasis>regex</emphasis>&gt;</term>
64968 <listitem>
64969 <para>
64970 Match against the size field.
64971 </para>
64972 </listitem></varlistentry>
64973 <varlistentry>
64974 <term><emphasis role="bold">-y</emphasis>&nbsp;&lt;<emphasis>seconds</emphasis>&gt;</term>
64975 <listitem>
64976 <para>
64977 Match messages that are younger than the given time.
64978 </para>
64979 </listitem></varlistentry>
64980 <varlistentry>
64981 <term><emphasis role="bold">-o</emphasis>&nbsp;&lt;<emphasis>seconds</emphasis>&gt;</term>
64982 <listitem>
64983 <para>
64984 Match messages that are older than the given time.
64985 </para>
64986 </listitem></varlistentry>
64987 <varlistentry>
64988 <term><emphasis role="bold">-z</emphasis></term>
64989 <listitem>
64990 <para>
64991 Match only frozen messages.
64992 </para>
64993 </listitem></varlistentry>
64994 <varlistentry>
64995 <term><emphasis role="bold">-x</emphasis></term>
64996 <listitem>
64997 <para>
64998 Match only non-frozen messages.
64999 </para>
65000 </listitem></varlistentry>
65001 </variablelist>
65002 <para>
65003 The following options control the format of the output:
65004 </para>
65005 <variablelist>
65006 <varlistentry>
65007 <term><emphasis role="bold">-c</emphasis></term>
65008 <listitem>
65009 <para>
65010 Display only the count of matching messages.
65011 </para>
65012 </listitem></varlistentry>
65013 <varlistentry>
65014 <term><emphasis role="bold">-l</emphasis></term>
65015 <listitem>
65016 <para>
65017 Long format &ndash; display the full message information as output by Exim. This is
65018 the default.
65019 </para>
65020 </listitem></varlistentry>
65021 <varlistentry>
65022 <term><emphasis role="bold">-i</emphasis></term>
65023 <listitem>
65024 <para>
65025 Display message ids only.
65026 </para>
65027 </listitem></varlistentry>
65028 <varlistentry>
65029 <term><emphasis role="bold">-b</emphasis></term>
65030 <listitem>
65031 <para>
65032 Brief format &ndash; one line per message.
65033 </para>
65034 </listitem></varlistentry>
65035 <varlistentry>
65036 <term><emphasis role="bold">-R</emphasis></term>
65037 <listitem>
65038 <para>
65039 Display messages in reverse order.
65040 </para>
65041 </listitem></varlistentry>
65042 <varlistentry>
65043 <term><emphasis role="bold">-a</emphasis></term>
65044 <listitem>
65045 <para>
65046 Include delivered recipients in queue listing.
65047 </para>
65048 </listitem></varlistentry>
65049 </variablelist>
65050 <para>
65051 There is one more option, <option>-h</option>, which outputs a list of options.
65052 </para>
65053 </section>
65054 <section id="SECTsumtheque">
65055 <title>Summarizing the queue (exiqsumm)</title>
65056 <para>
65057 <indexterm role="concept">
65058 <primary><emphasis>exiqsumm</emphasis></primary>
65059 </indexterm>
65060 <indexterm role="concept">
65061 <primary>queue</primary>
65062 <secondary>summary</secondary>
65063 </indexterm>
65064 The <emphasis>exiqsumm</emphasis> utility is a Perl script which reads the output of <literal>exim
65065 -bp</literal> and produces a summary of the messages on the queue. Thus, you use it by
65066 running a command such as
65067 </para>
65068 <literallayout class="monospaced">
65069 exim -bp | exiqsumm
65070 </literallayout>
65071 <para>
65072 The output consists of one line for each domain that has messages waiting for
65073 it, as in the following example:
65074 </para>
65075 <literallayout class="monospaced">
65076 3   2322   74m   66m  msn.com.example
65077 </literallayout>
65078 <para>
65079 Each line lists the number of pending deliveries for a domain, their total
65080 volume, and the length of time that the oldest and the newest messages have
65081 been waiting. Note that the number of pending deliveries is greater than the
65082 number of messages when messages have more than one recipient.
65083 </para>
65084 <para>
65085 A summary line is output at the end. By default the output is sorted on the
65086 domain name, but <emphasis>exiqsumm</emphasis> has the options <option>-a</option> and <option>-c</option>, which cause
65087 the output to be sorted by oldest message and by count of messages,
65088 respectively. There are also three options that split the messages for each
65089 domain into two or more subcounts: <option>-b</option> separates bounce messages, <option>-f</option>
65090 separates frozen messages, and <option>-s</option> separates messages according to their
65091 sender.
65092 </para>
65093 <para>
65094 The output of <emphasis>exim -bp</emphasis> contains the original addresses in the message, so
65095 this also applies to the output from <emphasis>exiqsumm</emphasis>. No domains from addresses
65096 generated by aliasing or forwarding are included (unless the <option>one_time</option>
65097 option of the <command>redirect</command> router has been used to convert them into <quote>top
65098 level</quote> addresses).
65099 </para>
65100 </section>
65101 <section id="SECTextspeinf">
65102 <title>Extracting specific information from the log (exigrep)</title>
65103 <para>
65104 <indexterm role="concept">
65105 <primary><emphasis>exigrep</emphasis></primary>
65106 </indexterm>
65107 <indexterm role="concept">
65108 <primary>log</primary>
65109 <secondary>extracts; grepping for</secondary>
65110 </indexterm>
65111 The <emphasis>exigrep</emphasis> utility is a Perl script that searches one or more main log
65112 files for entries that match a given pattern. When it finds a match, it
65113 extracts all the log entries for the relevant message, not just those that
65114 match the pattern. Thus, <emphasis>exigrep</emphasis> can extract complete log entries for a
65115 given message, or all mail for a given user, or for a given host, for example.
65116 The input files can be in Exim log format or syslog format.
65117 If a matching log line is not associated with a specific message, it is
65118 included in <emphasis>exigrep</emphasis>&#x2019;s output without any additional lines. The usage is:
65119 </para>
65120 <literallayout>
65121 <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>
65122 </literallayout>
65123 <para>
65124 If no log file names are given on the command line, the standard input is read.
65125 </para>
65126 <para>
65127 The <option>-t</option> argument specifies a number of seconds. It adds an additional
65128 condition for message selection. Messages that are complete are shown only if
65129 they spent more than &lt;<emphasis>n</emphasis>&gt; seconds on the queue.
65130 </para>
65131 <para>
65132 By default, <emphasis>exigrep</emphasis> does case-insensitive matching. The <option>-I</option> option
65133 makes it case-sensitive. This may give a performance improvement when searching
65134 large log files. Without <option>-I</option>, the Perl pattern matches use Perl&#x2019;s <literal>/i</literal>
65135 option; with <option>-I</option> they do not. In both cases it is possible to change the
65136 case sensitivity within the pattern by using <literal>(?i)</literal> or <literal>(?-i)</literal>.
65137 </para>
65138 <para>
65139 The <option>-l</option> option means <quote>literal</quote>, that is, treat all characters in the
65140 pattern as standing for themselves. Otherwise the pattern must be a Perl
65141 regular expression.
65142 </para>
65143 <para>
65144 The <option>-v</option> option inverts the matching condition. That is, a line is selected
65145 if it does <emphasis>not</emphasis> match the pattern.
65146 </para>
65147 <para>
65148 The <option>-M</option> options means <quote>related messages</quote>. <emphasis>exigrep</emphasis> will show messages
65149 that are generated as a result/response to a message that <emphasis>exigrep</emphasis> matched
65150 normally.
65151 </para>
65152 <para>
65153 Example of <option>-M</option>:
65154 user_a sends a message to user_b, which generates a bounce back to user_b. If
65155 <emphasis>exigrep</emphasis> is used to search for <quote>user_a</quote>, only the first message will be
65156 displayed.  But if <emphasis>exigrep</emphasis> is used to search for <quote>user_b</quote>, the first and
65157 the second (bounce) message will be displayed. Using <option>-M</option> with <emphasis>exigrep</emphasis>
65158 when searching for <quote>user_a</quote> will show both messages since the bounce is
65159 <quote>related</quote> to or a <quote>result</quote> of the first message that was found by the
65160 search term.
65161 </para>
65162 <para>
65163 If the location of a <emphasis>zcat</emphasis> command is known from the definition of
65164 ZCAT_COMMAND in <filename>Local/Makefile</filename>, <emphasis>exigrep</emphasis> automatically passes any file
65165 whose name ends in COMPRESS_SUFFIX through <emphasis>zcat</emphasis> as it searches it.
65166 If the ZCAT_COMMAND is not executable, <emphasis>exigrep</emphasis> tries to use
65167 autodetection of some well known compression extensions.
65168 </para>
65169 </section>
65170 <section id="SECTexipick">
65171 <title>Selecting messages by various criteria (exipick)</title>
65172 <para>
65173 <indexterm role="concept">
65174 <primary><emphasis>exipick</emphasis></primary>
65175 </indexterm>
65176 John Jetmore&#x2019;s <emphasis>exipick</emphasis> utility is included in the Exim distribution. It
65177 lists messages from the queue according to a variety of criteria. For details
65178 of <emphasis>exipick</emphasis>&#x2019;s facilities, visit the web page at
65179 <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
65180 the <option>--help</option> option.
65181 </para>
65182 </section>
65183 <section id="SECTcyclogfil">
65184 <title>Cycling log files (exicyclog)</title>
65185 <para>
65186 <indexterm role="concept">
65187 <primary>log</primary>
65188 <secondary>cycling local files</secondary>
65189 </indexterm>
65190 <indexterm role="concept">
65191 <primary>cycling logs</primary>
65192 </indexterm>
65193 <indexterm role="concept">
65194 <primary><emphasis>exicyclog</emphasis></primary>
65195 </indexterm>
65196 The <emphasis>exicyclog</emphasis> script can be used to cycle (rotate) <emphasis>mainlog</emphasis> and
65197 <emphasis>rejectlog</emphasis> files. This is not necessary if only syslog is being used, or if
65198 you are using log files with datestamps in their names (see section
65199 <xref linkend="SECTdatlogfil"/>). Some operating systems have their own standard mechanisms
65200 for log cycling, and these can be used instead of <emphasis>exicyclog</emphasis> if preferred.
65201 There are two command line options for <emphasis>exicyclog</emphasis>:
65202 </para>
65203 <itemizedlist>
65204 <listitem>
65205 <para>
65206 <option>-k</option> &lt;<emphasis>count</emphasis>&gt; specifies the number of log files to keep, overriding the
65207 default that is set when Exim is built. The default default is 10.
65208 </para>
65209 </listitem>
65210 <listitem>
65211 <para>
65212 <option>-l</option> &lt;<emphasis>path</emphasis>&gt; specifies the log file path, in the same format as Exim&#x2019;s
65213 <option>log_file_path</option> option (for example, <literal>/var/log/exim_%slog</literal>), again
65214 overriding the script&#x2019;s default, which is to find the setting from Exim&#x2019;s
65215 configuration.
65216 </para>
65217 </listitem>
65218 </itemizedlist>
65219 <para>
65220 Each time <emphasis>exicyclog</emphasis> is run the file names get <quote>shuffled down</quote> by one. If
65221 the main log file name is <filename>mainlog</filename> (the default) then when <emphasis>exicyclog</emphasis> is
65222 run <filename>mainlog</filename> becomes <filename>mainlog.01</filename>, the previous <filename>mainlog.01</filename> becomes
65223 <filename>mainlog.02</filename> and so on, up to the limit that is set in the script or by the
65224 <option>-k</option> option. Log files whose numbers exceed the limit are discarded. Reject
65225 logs are handled similarly.
65226 </para>
65227 <para>
65228 If the limit is greater than 99, the script uses 3-digit numbers such as
65229 <filename>mainlog.001</filename>, <filename>mainlog.002</filename>, etc. If you change from a number less than 99
65230 to one that is greater, or <emphasis>vice versa</emphasis>, you will have to fix the names of
65231 any existing log files.
65232 </para>
65233 <para>
65234 If no <filename>mainlog</filename> file exists, the script does nothing. Files that <quote>drop off</quote>
65235 the end are deleted. All files with numbers greater than 01 are compressed,
65236 using a compression command which is configured by the COMPRESS_COMMAND
65237 setting in <filename>Local/Makefile</filename>. It is usual to run <emphasis>exicyclog</emphasis> daily from a
65238 root <option>crontab</option> entry of the form
65239 </para>
65240 <literallayout class="monospaced">
65241 1 0 * * * su exim -c /usr/exim/bin/exicyclog
65242 </literallayout>
65243 <para>
65244 assuming you have used the name <quote>exim</quote> for the Exim user. You can run
65245 <emphasis>exicyclog</emphasis> as root if you wish, but there is no need.
65246 </para>
65247 </section>
65248 <section id="SECTmailstat">
65249 <title>Mail statistics (eximstats)</title>
65250 <para>
65251 <indexterm role="concept">
65252 <primary>statistics</primary>
65253 </indexterm>
65254 <indexterm role="concept">
65255 <primary><emphasis>eximstats</emphasis></primary>
65256 </indexterm>
65257 A Perl script called <emphasis>eximstats</emphasis> is provided for extracting statistical
65258 information from log files. The output is either plain text, or HTML.
65259 Exim log files are also supported by the <emphasis>Lire</emphasis> system produced by the
65260 LogReport Foundation <emphasis role="bold"><ulink url="http://www.logreport.org">http://www.logreport.org</ulink></emphasis>.
65261 </para>
65262 <para>
65263 The <emphasis>eximstats</emphasis> script has been hacked about quite a bit over time. The
65264 latest version is the result of some extensive revision by Steve Campbell. A
65265 lot of information is given by default, but there are options for suppressing
65266 various parts of it. Following any options, the arguments to the script are a
65267 list of files, which should be main log files. For example:
65268 </para>
65269 <literallayout class="monospaced">
65270 eximstats -nr /var/spool/exim/log/mainlog.01
65271 </literallayout>
65272 <para>
65273 By default, <emphasis>eximstats</emphasis> extracts information about the number and volume of
65274 messages received from or delivered to various hosts. The information is sorted
65275 both by message count and by volume, and the top fifty hosts in each category
65276 are listed on the standard output. Similar information, based on email
65277 addresses or domains instead of hosts can be requested by means of various
65278 options. For messages delivered and received locally, similar statistics are
65279 also produced per user.
65280 </para>
65281 <para>
65282 The output also includes total counts and statistics about delivery errors, and
65283 histograms showing the number of messages received and deliveries made in each
65284 hour of the day. A delivery with more than one address in its envelope (for
65285 example, an SMTP transaction with more than one RCPT command) is counted
65286 as a single delivery by <emphasis>eximstats</emphasis>.
65287 </para>
65288 <para>
65289 Though normally more deliveries than receipts are reported (as messages may
65290 have multiple recipients), it is possible for <emphasis>eximstats</emphasis> to report more
65291 messages received than delivered, even though the queue is empty at the start
65292 and end of the period in question. If an incoming message contains no valid
65293 recipients, no deliveries are recorded for it. A bounce message is handled as
65294 an entirely separate message.
65295 </para>
65296 <para>
65297 <emphasis>eximstats</emphasis> always outputs a grand total summary giving the volume and number
65298 of messages received and deliveries made, and the number of hosts involved in
65299 each case. It also outputs the number of messages that were delayed (that is,
65300 not completely delivered at the first attempt), and the number that had at
65301 least one address that failed.
65302 </para>
65303 <para>
65304 The remainder of the output is in sections that can be independently disabled
65305 or modified by various options. It consists of a summary of deliveries by
65306 transport, histograms of messages received and delivered per time interval
65307 (default per hour), information about the time messages spent on the queue,
65308 a list of relayed messages, lists of the top fifty sending hosts, local
65309 senders, destination hosts, and destination local users by count and by volume,
65310 and a list of delivery errors that occurred.
65311 </para>
65312 <para>
65313 The relay information lists messages that were actually relayed, that is, they
65314 came from a remote host and were directly delivered to some other remote host,
65315 without being processed (for example, for aliasing or forwarding) locally.
65316 </para>
65317 <para>
65318 There are quite a few options for <emphasis>eximstats</emphasis> to control exactly what it
65319 outputs. These are documented in the Perl script itself, and can be extracted
65320 by running the command <command>perldoc</command> on the script. For example:
65321 </para>
65322 <literallayout class="monospaced">
65323 perldoc /usr/exim/bin/eximstats
65324 </literallayout>
65325 </section>
65326 <section id="SECTcheckaccess">
65327 <title>Checking access policy (exim_checkaccess)</title>
65328 <para>
65329 <indexterm role="concept">
65330 <primary><emphasis>exim_checkaccess</emphasis></primary>
65331 </indexterm>
65332 <indexterm role="concept">
65333 <primary>policy control</primary>
65334 <secondary>checking access</secondary>
65335 </indexterm>
65336 <indexterm role="concept">
65337 <primary>checking access</primary>
65338 </indexterm>
65339 The <option>-bh</option> command line argument allows you to run a fake SMTP session with
65340 debugging output, in order to check what Exim is doing when it is applying
65341 policy controls to incoming SMTP mail. However, not everybody is sufficiently
65342 familiar with the SMTP protocol to be able to make full use of <option>-bh</option>, and
65343 sometimes you just want to answer the question <quote>Does this address have
65344 access?</quote> without bothering with any further details.
65345 </para>
65346 <para>
65347 The <emphasis>exim_checkaccess</emphasis> utility is a <quote>packaged</quote> version of <option>-bh</option>. It takes
65348 two arguments, an IP address and an email address:
65349 </para>
65350 <literallayout class="monospaced">
65351 exim_checkaccess 10.9.8.7 A.User@a.domain.example
65352 </literallayout>
65353 <para>
65354 The utility runs a call to Exim with the <option>-bh</option> option, to test whether the
65355 given email address would be accepted in a RCPT command in a TCP/IP
65356 connection from the host with the given IP address. The output of the utility
65357 is either the word <quote>accepted</quote>, or the SMTP error response, for example:
65358 </para>
65359 <literallayout class="monospaced">
65360 Rejected:
65361 550 Relay not permitted
65362 </literallayout>
65363 <para>
65364 When running this test, the utility uses <literal>&lt;&gt;</literal> as the envelope sender address
65365 for the MAIL command, but you can change this by providing additional
65366 options. These are passed directly to the Exim command. For example, to specify
65367 that the test is to be run with the sender address <emphasis>himself@there.example</emphasis>
65368 you can use:
65369 </para>
65370 <literallayout class="monospaced">
65371 exim_checkaccess 10.9.8.7 A.User@a.domain.example \
65372                  -f himself@there.example
65373 </literallayout>
65374 <para>
65375 Note that these additional Exim command line items must be given after the two
65376 mandatory arguments.
65377 </para>
65378 <para>
65379 Because the <option>exim_checkaccess</option> uses <option>-bh</option>, it does not perform callouts
65380 while running its checks. You can run checks that include callouts by using
65381 <option>-bhc</option>, but this is not yet available in a <quote>packaged</quote> form.
65382 </para>
65383 </section>
65384 <section id="SECTdbmbuild">
65385 <title>Making DBM files (exim_dbmbuild)</title>
65386 <para>
65387 <indexterm role="concept">
65388 <primary>DBM</primary>
65389 <secondary>building dbm files</secondary>
65390 </indexterm>
65391 <indexterm role="concept">
65392 <primary>building DBM files</primary>
65393 </indexterm>
65394 <indexterm role="concept">
65395 <primary><emphasis>exim_dbmbuild</emphasis></primary>
65396 </indexterm>
65397 <indexterm role="concept">
65398 <primary>lower casing</primary>
65399 </indexterm>
65400 <indexterm role="concept">
65401 <primary>binary zero</primary>
65402 <secondary>in lookup key</secondary>
65403 </indexterm>
65404 The <emphasis>exim_dbmbuild</emphasis> program reads an input file containing keys and data in
65405 the format used by the <command>lsearch</command> lookup (see section
65406 <xref linkend="SECTsinglekeylookups"/>). It writes a DBM file using the lower-cased alias
65407 names as keys and the remainder of the information as data. The lower-casing
65408 can be prevented by calling the program with the <option>-nolc</option> option.
65409 </para>
65410 <para>
65411 A terminating zero is included as part of the key string. This is expected by
65412 the <command>dbm</command> lookup type. However, if the option <option>-nozero</option> is given,
65413 <emphasis>exim_dbmbuild</emphasis> creates files without terminating zeroes in either the key
65414 strings or the data strings. The <command>dbmnz</command> lookup type can be used with such
65415 files.
65416 </para>
65417 <para>
65418 The program requires two arguments: the name of the input file (which can be a
65419 single hyphen to indicate the standard input), and the name of the output file.
65420 It creates the output under a temporary name, and then renames it if all went
65421 well.
65422 </para>
65423 <para>
65424 <indexterm role="concept">
65425 <primary>USE_DB</primary>
65426 </indexterm>
65427 If the native DB interface is in use (USE_DB is set in a compile-time
65428 configuration file &ndash; this is common in free versions of Unix) the two file
65429 names must be different, because in this mode the Berkeley DB functions create
65430 a single output file using exactly the name given. For example,
65431 </para>
65432 <literallayout class="monospaced">
65433 exim_dbmbuild /etc/aliases /etc/aliases.db
65434 </literallayout>
65435 <para>
65436 reads the system alias file and creates a DBM version of it in
65437 <filename>/etc/aliases.db</filename>.
65438 </para>
65439 <para>
65440 In systems that use the <emphasis>ndbm</emphasis> routines (mostly proprietary versions of
65441 Unix), two files are used, with the suffixes <filename>.dir</filename> and <filename>.pag</filename>. In this
65442 environment, the suffixes are added to the second argument of
65443 <emphasis>exim_dbmbuild</emphasis>, so it can be the same as the first. This is also the case
65444 when the Berkeley functions are used in compatibility mode (though this is not
65445 recommended), because in that case it adds a <filename>.db</filename> suffix to the file name.
65446 </para>
65447 <para>
65448 If a duplicate key is encountered, the program outputs a warning, and when it
65449 finishes, its return code is 1 rather than zero, unless the <option>-noduperr</option>
65450 option is used. By default, only the first of a set of duplicates is used &ndash;
65451 this makes it compatible with <command>lsearch</command> lookups. There is an option
65452 <option>-lastdup</option> which causes it to use the data for the last duplicate instead.
65453 There is also an option <option>-nowarn</option>, which stops it listing duplicate keys to
65454 <option>stderr</option>. For other errors, where it doesn&#x2019;t actually make a new file, the
65455 return code is 2.
65456 </para>
65457 </section>
65458 <section id="SECTfinindret">
65459 <title>Finding individual retry times (exinext)</title>
65460 <para>
65461 <indexterm role="concept">
65462 <primary>retry</primary>
65463 <secondary>times</secondary>
65464 </indexterm>
65465 <indexterm role="concept">
65466 <primary><emphasis>exinext</emphasis></primary>
65467 </indexterm>
65468 A utility called <emphasis>exinext</emphasis> (mostly a Perl script) provides the ability to
65469 fish specific information out of the retry database. Given a mail domain (or a
65470 complete address), it looks up the hosts for that domain, and outputs any retry
65471 information for the hosts or for the domain. At present, the retry information
65472 is obtained by running <emphasis>exim_dumpdb</emphasis> (see below) and post-processing the
65473 output. For example:
65474 </para>
65475 <literallayout class="monospaced">
65476 $ exinext piglet@milne.fict.example
65477 kanga.milne.example:192.168.8.1 error 146: Connection refused
65478   first failed: 21-Feb-1996 14:57:34
65479   last tried:   21-Feb-1996 14:57:34
65480   next try at:  21-Feb-1996 15:02:34
65481 roo.milne.example:192.168.8.3 error 146: Connection refused
65482   first failed: 20-Jan-1996 13:12:08
65483   last tried:   21-Feb-1996 11:42:03
65484   next try at:  21-Feb-1996 19:42:03
65485   past final cutoff time
65486 </literallayout>
65487 <para>
65488 You can also give <emphasis>exinext</emphasis> a local part, without a domain, and it
65489 will give any retry information for that local part in your default domain.
65490 A message id can be used to obtain retry information pertaining to a specific
65491 message. This exists only when an attempt to deliver a message to a remote host
65492 suffers a message-specific error (see section <xref linkend="SECToutSMTPerr"/>).
65493 <emphasis>exinext</emphasis> is not particularly efficient, but then it is not expected to be
65494 run very often.
65495 </para>
65496 <para>
65497 The <emphasis>exinext</emphasis> utility calls Exim to find out information such as the location
65498 of the spool directory. The utility has <option>-C</option> and <option>-D</option> options, which are
65499 passed on to the <emphasis>exim</emphasis> commands. The first specifies an alternate Exim
65500 configuration file, and the second sets macros for use within the configuration
65501 file. These features are mainly to help in testing, but might also be useful in
65502 environments where more than one configuration file is in use.
65503 </para>
65504 </section>
65505 <section id="SECThindatmai">
65506 <title>Hints database maintenance</title>
65507 <para>
65508 <indexterm role="concept">
65509 <primary>hints database</primary>
65510 <secondary>maintenance</secondary>
65511 </indexterm>
65512 <indexterm role="concept">
65513 <primary>maintaining Exim&#x2019;s hints database</primary>
65514 </indexterm>
65515 Three utility programs are provided for maintaining the DBM files that Exim
65516 uses to contain its delivery hint information. Each program requires two
65517 arguments. The first specifies the name of Exim&#x2019;s spool directory, and the
65518 second is the name of the database it is to operate on. These are as follows:
65519 </para>
65520 <itemizedlist>
65521 <listitem>
65522 <para>
65523 <emphasis>retry</emphasis>: the database of retry information
65524 </para>
65525 </listitem>
65526 <listitem>
65527 <para>
65528 <emphasis>wait-</emphasis>&lt;<emphasis>transport name</emphasis>&gt;: databases of information about messages waiting
65529 for remote hosts
65530 </para>
65531 </listitem>
65532 <listitem>
65533 <para>
65534 <emphasis>callout</emphasis>: the callout cache
65535 </para>
65536 </listitem>
65537 <listitem>
65538 <para>
65539 <emphasis>ratelimit</emphasis>: the data for implementing the ratelimit ACL condition
65540 </para>
65541 </listitem>
65542 <listitem>
65543 <para>
65544 <emphasis>misc</emphasis>: other hints data
65545 </para>
65546 </listitem>
65547 </itemizedlist>
65548 <para>
65549 The <emphasis>misc</emphasis> database is used for
65550 </para>
65551 <itemizedlist>
65552 <listitem>
65553 <para>
65554 Serializing ETRN runs (when <option>smtp_etrn_serialize</option> is set)
65555 </para>
65556 </listitem>
65557 <listitem>
65558 <para>
65559 Serializing delivery to a specific host (when <option>serialize_hosts</option> is set in an
65560 <command>smtp</command> transport)
65561 </para>
65562 </listitem>
65563 </itemizedlist>
65564 </section>
65565 <section id="SECID261">
65566 <title>exim_dumpdb</title>
65567 <para>
65568 <indexterm role="concept">
65569 <primary><emphasis>exim_dumpdb</emphasis></primary>
65570 </indexterm>
65571 The entire contents of a database are written to the standard output by the
65572 <emphasis>exim_dumpdb</emphasis> program, which has no options or arguments other than the
65573 spool and database names. For example, to dump the retry database:
65574 </para>
65575 <literallayout class="monospaced">
65576 exim_dumpdb /var/spool/exim retry
65577 </literallayout>
65578 <para>
65579 Two lines of output are produced for each entry:
65580 </para>
65581 <literallayout class="monospaced">
65582 T:mail.ref.example:192.168.242.242 146 77 Connection refused
65583 31-Oct-1995 12:00:12 02-Nov-1995 12:21:39 02-Nov-1995 20:21:39 *
65584 </literallayout>
65585 <para>
65586 The first item on the first line is the key of the record. It starts with one
65587 of the letters R, or T, depending on whether it refers to a routing or
65588 transport retry. For a local delivery, the next part is the local address; for
65589 a remote delivery it is the name of the remote host, followed by its failing IP
65590 address (unless <option>retry_include_ip_address</option> is set false on the <command>smtp</command>
65591 transport). If the remote port is not the standard one (port 25), it is added
65592 to the IP address. Then there follows an error code, an additional error code,
65593 and a textual description of the error.
65594 </para>
65595 <para>
65596 The three times on the second line are the time of first failure, the time of
65597 the last delivery attempt, and the computed time for the next attempt. The line
65598 ends with an asterisk if the cutoff time for the last retry rule has been
65599 exceeded.
65600 </para>
65601 <para>
65602 Each output line from <emphasis>exim_dumpdb</emphasis> for the <emphasis>wait-xxx</emphasis> databases
65603 consists of a host name followed by a list of ids for messages that are or were
65604 waiting to be delivered to that host. If there are a very large number for any
65605 one host, continuation records, with a sequence number added to the host name,
65606 may be seen. The data in these records is often out of date, because a message
65607 may be routed to several alternative hosts, and Exim makes no effort to keep
65608 cross-references.
65609 </para>
65610 </section>
65611 <section id="SECID262">
65612 <title>exim_tidydb</title>
65613 <para>
65614 <indexterm role="concept">
65615 <primary><emphasis>exim_tidydb</emphasis></primary>
65616 </indexterm>
65617 The <emphasis>exim_tidydb</emphasis> utility program is used to tidy up the contents of a hints
65618 database. If run with no options, it removes all records that are more than 30
65619 days old. The age is calculated from the date and time that the record was last
65620 updated. Note that, in the case of the retry database, it is <emphasis>not</emphasis> the time
65621 since the first delivery failure. Information about a host that has been down
65622 for more than 30 days will remain in the database, provided that the record is
65623 updated sufficiently often.
65624 </para>
65625 <para>
65626 The cutoff date can be altered by means of the <option>-t</option> option, which must be
65627 followed by a time. For example, to remove all records older than a week from
65628 the retry database:
65629 </para>
65630 <literallayout class="monospaced">
65631 exim_tidydb -t 7d /var/spool/exim retry
65632 </literallayout>
65633 <para>
65634 Both the <emphasis>wait-xxx</emphasis> and <emphasis>retry</emphasis> databases contain items that involve
65635 message ids. In the former these appear as data in records keyed by host &ndash;
65636 they were messages that were waiting for that host &ndash; and in the latter they
65637 are the keys for retry information for messages that have suffered certain
65638 types of error. When <emphasis>exim_tidydb</emphasis> is run, a check is made to ensure that
65639 message ids in database records are those of messages that are still on the
65640 queue. Message ids for messages that no longer exist are removed from
65641 <emphasis>wait-xxx</emphasis> records, and if this leaves any records empty, they are deleted.
65642 For the <emphasis>retry</emphasis> database, records whose keys are non-existent message ids are
65643 removed. The <emphasis>exim_tidydb</emphasis> utility outputs comments on the standard output
65644 whenever it removes information from the database.
65645 </para>
65646 <para>
65647 Certain records are automatically removed by Exim when they are no longer
65648 needed, but others are not. For example, if all the MX hosts for a domain are
65649 down, a retry record is created for each one. If the primary MX host comes back
65650 first, its record is removed when Exim successfully delivers to it, but the
65651 records for the others remain because Exim has not tried to use those hosts.
65652 </para>
65653 <para>
65654 It is important, therefore, to run <emphasis>exim_tidydb</emphasis> periodically on all the
65655 hints databases. You should do this at a quiet time of day, because it requires
65656 a database to be locked (and therefore inaccessible to Exim) while it does its
65657 work. Removing records from a DBM file does not normally make the file smaller,
65658 but all the common DBM libraries are able to re-use the space that is released.
65659 After an initial phase of increasing in size, the databases normally reach a
65660 point at which they no longer get any bigger, as long as they are regularly
65661 tidied.
65662 </para>
65663 <para>
65664 <emphasis role="bold">Warning</emphasis>: If you never run <emphasis>exim_tidydb</emphasis>, the space used by the hints
65665 databases is likely to keep on increasing.
65666 </para>
65667 </section>
65668 <section id="SECID263">
65669 <title>exim_fixdb</title>
65670 <para>
65671 <indexterm role="concept">
65672 <primary><emphasis>exim_fixdb</emphasis></primary>
65673 </indexterm>
65674 The <emphasis>exim_fixdb</emphasis> program is a utility for interactively modifying databases.
65675 Its main use is for testing Exim, but it might also be occasionally useful for
65676 getting round problems in a live system. It has no options, and its interface
65677 is somewhat crude. On entry, it prompts for input with a right angle-bracket. A
65678 key of a database record can then be entered, and the data for that record is
65679 displayed.
65680 </para>
65681 <para>
65682 If <quote>d</quote> is typed at the next prompt, the entire record is deleted. For all
65683 except the <emphasis>retry</emphasis> database, that is the only operation that can be carried
65684 out. For the <emphasis>retry</emphasis> database, each field is output preceded by a number, and
65685 data for individual fields can be changed by typing the field number followed
65686 by new data, for example:
65687 </para>
65688 <literallayout class="monospaced">
65689 &gt; 4 951102:1000
65690 </literallayout>
65691 <para>
65692 resets the time of the next delivery attempt. Time values are given as a
65693 sequence of digit pairs for year, month, day, hour, and minute. Colons can be
65694 used as optional separators.
65695 </para>
65696 </section>
65697 <section id="SECTmailboxmaint">
65698 <title>Mailbox maintenance (exim_lock)</title>
65699 <para>
65700 <indexterm role="concept">
65701 <primary>mailbox</primary>
65702 <secondary>maintenance</secondary>
65703 </indexterm>
65704 <indexterm role="concept">
65705 <primary><emphasis>exim_lock</emphasis></primary>
65706 </indexterm>
65707 <indexterm role="concept">
65708 <primary>locking mailboxes</primary>
65709 </indexterm>
65710 The <emphasis>exim_lock</emphasis> utility locks a mailbox file using the same algorithm as
65711 Exim. For a discussion of locking issues, see section <xref linkend="SECTopappend"/>.
65712 <emphasis>Exim_lock</emphasis> can be used to prevent any modification of a mailbox by Exim or
65713 a user agent while investigating a problem. The utility requires the name of
65714 the file as its first argument. If the locking is successful, the second
65715 argument is run as a command (using C&#x2019;s <function>system()</function> function); if there is no
65716 second argument, the value of the SHELL environment variable is used; if this
65717 is unset or empty, <filename>/bin/sh</filename> is run. When the command finishes, the mailbox
65718 is unlocked and the utility ends. The following options are available:
65719 </para>
65720 <variablelist>
65721 <varlistentry>
65722 <term><option>-fcntl</option></term>
65723 <listitem>
65724 <para>
65725 Use <function>fcntl()</function> locking on the open mailbox.
65726 </para>
65727 </listitem></varlistentry>
65728 <varlistentry>
65729 <term><option>-flock</option></term>
65730 <listitem>
65731 <para>
65732 Use <function>flock()</function> locking on the open mailbox, provided the operating system
65733 supports it.
65734 </para>
65735 </listitem></varlistentry>
65736 <varlistentry>
65737 <term><option>-interval</option></term>
65738 <listitem>
65739 <para>
65740 This must be followed by a number, which is a number of seconds; it sets the
65741 interval to sleep between retries (default 3).
65742 </para>
65743 </listitem></varlistentry>
65744 <varlistentry>
65745 <term><option>-lockfile</option></term>
65746 <listitem>
65747 <para>
65748 Create a lock file before opening the mailbox.
65749 </para>
65750 </listitem></varlistentry>
65751 <varlistentry>
65752 <term><option>-mbx</option></term>
65753 <listitem>
65754 <para>
65755 Lock the mailbox using MBX rules.
65756 </para>
65757 </listitem></varlistentry>
65758 <varlistentry>
65759 <term><option>-q</option></term>
65760 <listitem>
65761 <para>
65762 Suppress verification output.
65763 </para>
65764 </listitem></varlistentry>
65765 <varlistentry>
65766 <term><option>-retries</option></term>
65767 <listitem>
65768 <para>
65769 This must be followed by a number; it sets the number of times to try to get
65770 the lock (default 10).
65771 </para>
65772 </listitem></varlistentry>
65773 <varlistentry>
65774 <term><option>-restore_time</option></term>
65775 <listitem>
65776 <para>
65777 This option causes <option>exim_lock</option> to restore the modified and read times to the
65778 locked file before exiting. This allows you to access a locked mailbox (for
65779 example, to take a backup copy) without disturbing the times that the user
65780 subsequently sees.
65781 </para>
65782 </listitem></varlistentry>
65783 <varlistentry>
65784 <term><option>-timeout</option></term>
65785 <listitem>
65786 <para>
65787 This must be followed by a number, which is a number of seconds; it sets a
65788 timeout to be used with a blocking <function>fcntl()</function> lock. If it is not set (the
65789 default), a non-blocking call is used.
65790 </para>
65791 </listitem></varlistentry>
65792 <varlistentry>
65793 <term><option>-v</option></term>
65794 <listitem>
65795 <para>
65796 Generate verbose output.
65797 </para>
65798 </listitem></varlistentry>
65799 </variablelist>
65800 <para>
65801 If none of <option>-fcntl</option>, <option>-flock</option>, <option>-lockfile</option> or <option>-mbx</option> are given, the
65802 default is to create a lock file and also to use <function>fcntl()</function> locking on the
65803 mailbox, which is the same as Exim&#x2019;s default. The use of <option>-flock</option> or
65804 <option>-fcntl</option> requires that the file be writeable; the use of <option>-lockfile</option>
65805 requires that the directory containing the file be writeable. Locking by lock
65806 file does not last for ever; Exim assumes that a lock file is expired if it is
65807 more than 30 minutes old.
65808 </para>
65809 <para>
65810 The <option>-mbx</option> option can be used with either or both of <option>-fcntl</option> or
65811 <option>-flock</option>. It assumes <option>-fcntl</option> by default. MBX locking causes a shared lock
65812 to be taken out on the open mailbox, and an exclusive lock on the file
65813 <filename>/tmp/.n.m</filename> where <emphasis>n</emphasis> and <emphasis>m</emphasis> are the device number and inode
65814 number of the mailbox file. When the locking is released, if an exclusive lock
65815 can be obtained for the mailbox, the file in <filename>/tmp</filename> is deleted.
65816 </para>
65817 <para>
65818 The default output contains verification of the locking that takes place. The
65819 <option>-v</option> option causes some additional information to be given. The <option>-q</option> option
65820 suppresses all output except error messages.
65821 </para>
65822 <para>
65823 A command such as
65824 </para>
65825 <literallayout class="monospaced">
65826 exim_lock /var/spool/mail/spqr
65827 </literallayout>
65828 <para>
65829 runs an interactive shell while the file is locked, whereas
65830 </para>
65831 <literallayout>
65832 <literal>exim_lock -q /var/spool/mail/spqr &lt;&lt;End</literal>
65833 &lt;<emphasis>some commands</emphasis>&gt;
65834 <literal>End</literal>
65835 </literallayout>
65836 <para>
65837 runs a specific non-interactive sequence of commands while the file is locked,
65838 suppressing all verification output. A single command can be run by a command
65839 such as
65840 </para>
65841 <literallayout class="monospaced">
65842 exim_lock -q /var/spool/mail/spqr \
65843   "cp /var/spool/mail/spqr /some/where"
65844 </literallayout>
65845 <para>
65846 Note that if a command is supplied, it must be entirely contained within the
65847 second argument &ndash; hence the quotes.
65848 <indexterm role="concept" startref="IIDutils" class="endofrange"/>
65849 </para>
65850 </section>
65851 </chapter>
65852
65853 <chapter id="CHAPeximon">
65854 <title>The Exim monitor</title>
65855 <para>
65856 <indexterm role="concept" id="IIDeximon" class="startofrange">
65857 <primary>Exim monitor</primary>
65858 <secondary>description</secondary>
65859 </indexterm>
65860 <indexterm role="concept">
65861 <primary>X-windows</primary>
65862 </indexterm>
65863 <indexterm role="concept">
65864 <primary><emphasis>eximon</emphasis></primary>
65865 </indexterm>
65866 <indexterm role="concept">
65867 <primary>Local/eximon.conf</primary>
65868 </indexterm>
65869 <indexterm role="concept">
65870 <primary><filename>exim_monitor/EDITME</filename></primary>
65871 </indexterm>
65872 The Exim monitor is an application which displays in an X window information
65873 about the state of Exim&#x2019;s queue and what Exim is doing. An admin user can
65874 perform certain operations on messages from this GUI interface; however all
65875 such facilities are also available from the command line, and indeed, the
65876 monitor itself makes use of the command line to perform any actions requested.
65877 </para>
65878 <section id="SECID264">
65879 <title>Running the monitor</title>
65880 <para>
65881 The monitor is started by running the script called <emphasis>eximon</emphasis>. This is a shell
65882 script that sets up a number of environment variables, and then runs the
65883 binary called <filename>eximon.bin</filename>. The default appearance of the monitor window can
65884 be changed by editing the <filename>Local/eximon.conf</filename> file created by editing
65885 <filename>exim_monitor/EDITME</filename>. Comments in that file describe what the various
65886 parameters are for.
65887 </para>
65888 <para>
65889 The parameters that get built into the <emphasis>eximon</emphasis> script can be overridden for
65890 a particular invocation by setting up environment variables of the same names,
65891 preceded by <literal>EXIMON_</literal>. For example, a shell command such as
65892 </para>
65893 <literallayout class="monospaced">
65894 EXIMON_LOG_DEPTH=400 eximon
65895 </literallayout>
65896 <para>
65897 (in a Bourne-compatible shell) runs <emphasis>eximon</emphasis> with an overriding setting of
65898 the LOG_DEPTH parameter. If EXIMON_LOG_FILE_PATH is set in the environment, it
65899 overrides the Exim log file configuration. This makes it possible to have
65900 <emphasis>eximon</emphasis> tailing log data that is written to syslog, provided that MAIL.INFO
65901 syslog messages are routed to a file on the local host.
65902 </para>
65903 <para>
65904 X resources can be used to change the appearance of the window in the normal
65905 way. For example, a resource setting of the form
65906 </para>
65907 <literallayout class="monospaced">
65908 Eximon*background: gray94
65909 </literallayout>
65910 <para>
65911 changes the colour of the background to light grey rather than white. The
65912 stripcharts are drawn with both the data lines and the reference lines in
65913 black. This means that the reference lines are not visible when on top of the
65914 data. However, their colour can be changed by setting a resource called
65915 <quote>highlight</quote> (an odd name, but that&#x2019;s what the Athena stripchart widget uses).
65916 For example, if your X server is running Unix, you could set up lighter
65917 reference lines in the stripcharts by obeying
65918 </para>
65919 <literallayout class="monospaced">
65920 xrdb -merge &lt;&lt;End
65921 Eximon*highlight: gray
65922 End
65923 </literallayout>
65924 <para>
65925 <indexterm role="concept">
65926 <primary>admin user</primary>
65927 </indexterm>
65928 In order to see the contents of messages on the queue, and to operate on them,
65929 <emphasis>eximon</emphasis> must either be run as root or by an admin user.
65930 </para>
65931 <para>
65932 The command-line parameters of <emphasis>eximon</emphasis> are passed to <filename>eximon.bin</filename> and may
65933 contain X11 resource parameters interpreted by the X11 library.  In addition,
65934 if the first parameter starts with the string "gdb" then it is removed and the
65935 binary is invoked under gdb (the parameter is used as the gdb command-name, so
65936 versioned variants of gdb can be invoked).
65937 </para>
65938 <para>
65939 The monitor&#x2019;s window is divided into three parts. The first contains one or
65940 more stripcharts and two action buttons, the second contains a <quote>tail</quote> of the
65941 main log file, and the third is a display of the queue of messages awaiting
65942 delivery, with two more action buttons. The following sections describe these
65943 different parts of the display.
65944 </para>
65945 </section>
65946 <section id="SECID265">
65947 <title>The stripcharts</title>
65948 <para>
65949 <indexterm role="concept">
65950 <primary>stripchart</primary>
65951 </indexterm>
65952 The first stripchart is always a count of messages on the queue. Its name can
65953 be configured by setting QUEUE_STRIPCHART_NAME in the
65954 <filename>Local/eximon.conf</filename> file. The remaining stripcharts are defined in the
65955 configuration script by regular expression matches on log file entries, making
65956 it possible to display, for example, counts of messages delivered to certain
65957 hosts or using certain transports. The supplied defaults display counts of
65958 received and delivered messages, and of local and SMTP deliveries. The default
65959 period between stripchart updates is one minute; this can be adjusted by a
65960 parameter in the <filename>Local/eximon.conf</filename> file.
65961 </para>
65962 <para>
65963 The stripchart displays rescale themselves automatically as the value they are
65964 displaying changes. There are always 10 horizontal lines in each chart; the
65965 title string indicates the value of each division when it is greater than one.
65966 For example, <quote>x2</quote> means that each division represents a value of 2.
65967 </para>
65968 <para>
65969 It is also possible to have a stripchart which shows the percentage fullness of
65970 a particular disk partition, which is useful when local deliveries are confined
65971 to a single partition.
65972 </para>
65973 <para>
65974 <indexterm role="concept">
65975 <primary><option>statvfs</option> function</primary>
65976 </indexterm>
65977 This relies on the availability of the <function>statvfs()</function> function or equivalent in
65978 the operating system. Most, but not all versions of Unix that support Exim have
65979 this. For this particular stripchart, the top of the chart always represents
65980 100%, and the scale is given as <quote>x10%</quote>. This chart is configured by setting
65981 SIZE_STRIPCHART and (optionally) SIZE_STRIPCHART_NAME in the
65982 <filename>Local/eximon.conf</filename> file.
65983 </para>
65984 </section>
65985 <section id="SECID266">
65986 <title>Main action buttons</title>
65987 <para>
65988 <indexterm role="concept">
65989 <primary>size</primary>
65990 <secondary>of monitor window</secondary>
65991 </indexterm>
65992 <indexterm role="concept">
65993 <primary>Exim monitor</primary>
65994 <secondary>window size</secondary>
65995 </indexterm>
65996 <indexterm role="concept">
65997 <primary>window size</primary>
65998 </indexterm>
65999 Below the stripcharts there is an action button for quitting the monitor. Next
66000 to this is another button marked <quote>Size</quote>. They are placed here so that
66001 shrinking the window to its default minimum size leaves just the queue count
66002 stripchart and these two buttons visible. Pressing the <quote>Size</quote> button causes
66003 the window to expand to its maximum size, unless it is already at the maximum,
66004 in which case it is reduced to its minimum.
66005 </para>
66006 <para>
66007 When expanding to the maximum, if the window cannot be fully seen where it
66008 currently is, it is moved back to where it was the last time it was at full
66009 size. When it is expanding from its minimum size, the old position is
66010 remembered, and next time it is reduced to the minimum it is moved back there.
66011 </para>
66012 <para>
66013 The idea is that you can keep a reduced window just showing one or two
66014 stripcharts at a convenient place on your screen, easily expand it to show
66015 the full window when required, and just as easily put it back to what it was.
66016 The idea is copied from what the <emphasis>twm</emphasis> window manager does for its
66017 <emphasis>f.fullzoom</emphasis> action. The minimum size of the window can be changed by setting
66018 the MIN_HEIGHT and MIN_WIDTH values in <filename>Local/eximon.conf</filename>.
66019 </para>
66020 <para>
66021 Normally, the monitor starts up with the window at its full size, but it can be
66022 built so that it starts up with the window at its smallest size, by setting
66023 START_SMALL=yes in <filename>Local/eximon.conf</filename>.
66024 </para>
66025 </section>
66026 <section id="SECID267">
66027 <title>The log display</title>
66028 <para>
66029 <indexterm role="concept">
66030 <primary>log</primary>
66031 <secondary>tail of; in monitor</secondary>
66032 </indexterm>
66033 The second section of the window is an area in which a display of the tail of
66034 the main log is maintained.
66035 To save space on the screen, the timestamp on each log line is shortened by
66036 removing the date and, if <option>log_timezone</option> is set, the timezone.
66037 The log tail is not available when the only destination for logging data is
66038 syslog, unless the syslog lines are routed to a local file whose name is passed
66039 to <emphasis>eximon</emphasis> via the EXIMON_LOG_FILE_PATH environment variable.
66040 </para>
66041 <para>
66042 The log sub-window has a scroll bar at its lefthand side which can be used to
66043 move back to look at earlier text, and the up and down arrow keys also have a
66044 scrolling effect. The amount of log that is kept depends on the setting of
66045 LOG_BUFFER in <filename>Local/eximon.conf</filename>, which specifies the amount of memory
66046 to use. When this is full, the earlier 50% of data is discarded &ndash; this is
66047 much more efficient than throwing it away line by line. The sub-window also has
66048 a horizontal scroll bar for accessing the ends of long log lines. This is the
66049 only means of horizontal scrolling; the right and left arrow keys are not
66050 available. Text can be cut from this part of the window using the mouse in the
66051 normal way. The size of this subwindow is controlled by parameters in the
66052 configuration file <filename>Local/eximon.conf</filename>.
66053 </para>
66054 <para>
66055 Searches of the text in the log window can be carried out by means of the ^R
66056 and ^S keystrokes, which default to a reverse and a forward search,
66057 respectively. The search covers only the text that is displayed in the window.
66058 It cannot go further back up the log.
66059 </para>
66060 <para>
66061 The point from which the search starts is indicated by a caret marker. This is
66062 normally at the end of the text in the window, but can be positioned explicitly
66063 by pointing and clicking with the left mouse button, and is moved automatically
66064 by a successful search. If new text arrives in the window when it is scrolled
66065 back, the caret remains where it is, but if the window is not scrolled back,
66066 the caret is moved to the end of the new text.
66067 </para>
66068 <para>
66069 Pressing ^R or ^S pops up a window into which the search text can be typed.
66070 There are buttons for selecting forward or reverse searching, for carrying out
66071 the search, and for cancelling. If the <quote>Search</quote> button is pressed, the search
66072 happens and the window remains so that further searches can be done. If the
66073 <quote>Return</quote> key is pressed, a single search is done and the window is closed. If
66074 ^C is typed the search is cancelled.
66075 </para>
66076 <para>
66077 The searching facility is implemented using the facilities of the Athena text
66078 widget. By default this pops up a window containing both <quote>search</quote> and
66079 <quote>replace</quote> options. In order to suppress the unwanted <quote>replace</quote> portion for
66080 eximon, a modified version of the <option>TextPop</option> widget is distributed with Exim.
66081 However, the linkers in BSDI and HP-UX seem unable to handle an externally
66082 provided version of <option>TextPop</option> when the remaining parts of the text widget
66083 come from the standard libraries. The compile-time option EXIMON_TEXTPOP can be
66084 unset to cut out the modified <option>TextPop</option>, making it possible to build Eximon
66085 on these systems, at the expense of having unwanted items in the search popup
66086 window.
66087 </para>
66088 </section>
66089 <section id="SECID268">
66090 <title>The queue display</title>
66091 <para>
66092 <indexterm role="concept">
66093 <primary>queue</primary>
66094 <secondary>display in monitor</secondary>
66095 </indexterm>
66096 The bottom section of the monitor window contains a list of all messages that
66097 are on the queue, which includes those currently being received or delivered,
66098 as well as those awaiting delivery. The size of this subwindow is controlled by
66099 parameters in the configuration file <filename>Local/eximon.conf</filename>, and the frequency
66100 at which it is updated is controlled by another parameter in the same file &ndash;
66101 the default is 5 minutes, since queue scans can be quite expensive. However,
66102 there is an <quote>Update</quote> action button just above the display which can be used
66103 to force an update of the queue display at any time.
66104 </para>
66105 <para>
66106 When a host is down for some time, a lot of pending mail can build up for it,
66107 and this can make it hard to deal with other messages on the queue. To help
66108 with this situation there is a button next to <quote>Update</quote> called <quote>Hide</quote>. If
66109 pressed, a dialogue box called <quote>Hide addresses ending with</quote> is put up. If you
66110 type anything in here and press <quote>Return</quote>, the text is added to a chain of
66111 such texts, and if every undelivered address in a message matches at least one
66112 of the texts, the message is not displayed.
66113 </para>
66114 <para>
66115 If there is an address that does not match any of the texts, all the addresses
66116 are displayed as normal. The matching happens on the ends of addresses so, for
66117 example, <emphasis>cam.ac.uk</emphasis> specifies all addresses in Cambridge, while
66118 <emphasis>xxx@foo.com.example</emphasis> specifies just one specific address. When any hiding
66119 has been set up, a button called <quote>Unhide</quote> is displayed. If pressed, it
66120 cancels all hiding. Also, to ensure that hidden messages do not get forgotten,
66121 a hide request is automatically cancelled after one hour.
66122 </para>
66123 <para>
66124 While the dialogue box is displayed, you can&#x2019;t press any buttons or do anything
66125 else to the monitor window. For this reason, if you want to cut text from the
66126 queue display to use in the dialogue box, you have to do the cutting before
66127 pressing the <quote>Hide</quote> button.
66128 </para>
66129 <para>
66130 The queue display contains, for each unhidden queued message, the length of
66131 time it has been on the queue, the size of the message, the message id, the
66132 message sender, and the first undelivered recipient, all on one line. If it is
66133 a bounce message, the sender is shown as <quote>&lt;&gt;</quote>. If there is more than one
66134 recipient to which the message has not yet been delivered, subsequent ones are
66135 listed on additional lines, up to a maximum configured number, following which
66136 an ellipsis is displayed. Recipients that have already received the message are
66137 not shown.
66138 </para>
66139 <para>
66140 <indexterm role="concept">
66141 <primary>frozen messages</primary>
66142 <secondary>display</secondary>
66143 </indexterm>
66144 If a message is frozen, an asterisk is displayed at the left-hand side.
66145 </para>
66146 <para>
66147 The queue display has a vertical scroll bar, and can also be scrolled by means
66148 of the arrow keys. Text can be cut from it using the mouse in the normal way.
66149 The text searching facilities, as described above for the log window, are also
66150 available, but the caret is always moved to the end of the text when the queue
66151 display is updated.
66152 </para>
66153 </section>
66154 <section id="SECID269">
66155 <title>The queue menu</title>
66156 <para>
66157 <indexterm role="concept">
66158 <primary>queue</primary>
66159 <secondary>menu in monitor</secondary>
66160 </indexterm>
66161 If the <option>shift</option> key is held down and the left button is clicked when the mouse
66162 pointer is over the text for any message, an action menu pops up, and the first
66163 line of the queue display for the message is highlighted. This does not affect
66164 any selected text.
66165 </para>
66166 <para>
66167 If you want to use some other event for popping up the menu, you can set the
66168 MENU_EVENT parameter in <filename>Local/eximon.conf</filename> to change the default, or
66169 set EXIMON_MENU_EVENT in the environment before starting the monitor. The
66170 value set in this parameter is a standard X event description. For example, to
66171 run eximon using <option>ctrl</option> rather than <option>shift</option> you could use
66172 </para>
66173 <literallayout class="monospaced">
66174 EXIMON_MENU_EVENT='Ctrl&lt;Btn1Down&gt;' eximon
66175 </literallayout>
66176 <para>
66177 The title of the menu is the message id, and it contains entries which act as
66178 follows:
66179 </para>
66180 <itemizedlist>
66181 <listitem>
66182 <para>
66183 <emphasis>message log</emphasis>: The contents of the message log for the message are displayed
66184 in a new text window.
66185 </para>
66186 </listitem>
66187 <listitem>
66188 <para>
66189 <emphasis>headers</emphasis>: Information from the spool file that contains the envelope
66190 information and headers is displayed in a new text window. See chapter
66191 <xref linkend="CHAPspool"/> for a description of the format of spool files.
66192 </para>
66193 </listitem>
66194 <listitem>
66195 <para>
66196 <emphasis>body</emphasis>: The contents of the spool file containing the body of the message are
66197 displayed in a new text window. There is a default limit of 20,000 bytes to the
66198 amount of data displayed. This can be changed by setting the BODY_MAX
66199 option at compile time, or the EXIMON_BODY_MAX option at run time.
66200 </para>
66201 </listitem>
66202 <listitem>
66203 <para>
66204 <emphasis>deliver message</emphasis>: A call to Exim is made using the <option>-M</option> option to request
66205 delivery of the message. This causes an automatic thaw if the message is
66206 frozen. The <option>-v</option> option is also set, and the output from Exim is displayed in
66207 a new text window. The delivery is run in a separate process, to avoid holding
66208 up the monitor while the delivery proceeds.
66209 </para>
66210 </listitem>
66211 <listitem>
66212 <para>
66213 <emphasis>freeze message</emphasis>: A call to Exim is made using the <option>-Mf</option> option to request
66214 that the message be frozen.
66215 </para>
66216 </listitem>
66217 <listitem>
66218 <para>
66219 <indexterm role="concept">
66220 <primary>thawing messages</primary>
66221 </indexterm>
66222 <indexterm role="concept">
66223 <primary>unfreezing messages</primary>
66224 </indexterm>
66225 <indexterm role="concept">
66226 <primary>frozen messages</primary>
66227 <secondary>thawing</secondary>
66228 </indexterm>
66229 <emphasis>thaw message</emphasis>: A call to Exim is made using the <option>-Mt</option> option to request
66230 that the message be thawed.
66231 </para>
66232 </listitem>
66233 <listitem>
66234 <para>
66235 <indexterm role="concept">
66236 <primary>delivery</primary>
66237 <secondary>forcing failure</secondary>
66238 </indexterm>
66239 <emphasis>give up on msg</emphasis>: A call to Exim is made using the <option>-Mg</option> option to request
66240 that Exim gives up trying to deliver the message. A bounce message is generated
66241 for any remaining undelivered addresses.
66242 </para>
66243 </listitem>
66244 <listitem>
66245 <para>
66246 <emphasis>remove message</emphasis>: A call to Exim is made using the <option>-Mrm</option> option to request
66247 that the message be deleted from the system without generating a bounce
66248 message.
66249 </para>
66250 </listitem>
66251 <listitem>
66252 <para>
66253 <emphasis>add recipient</emphasis>: A dialog box is displayed into which a recipient address can
66254 be typed. If the address is not qualified and the QUALIFY_DOMAIN parameter
66255 is set in <filename>Local/eximon.conf</filename>, the address is qualified with that domain.
66256 Otherwise it must be entered as a fully qualified address. Pressing RETURN
66257 causes a call to Exim to be made using the <option>-Mar</option> option to request that an
66258 additional recipient be added to the message, unless the entry box is empty, in
66259 which case no action is taken.
66260 </para>
66261 </listitem>
66262 <listitem>
66263 <para>
66264 <emphasis>mark delivered</emphasis>: A dialog box is displayed into which a recipient address
66265 can be typed. If the address is not qualified and the QUALIFY_DOMAIN parameter
66266 is set in <filename>Local/eximon.conf</filename>, the address is qualified with that domain.
66267 Otherwise it must be entered as a fully qualified address. Pressing RETURN
66268 causes a call to Exim to be made using the <option>-Mmd</option> option to mark the given
66269 recipient address as already delivered, unless the entry box is empty, in which
66270 case no action is taken.
66271 </para>
66272 </listitem>
66273 <listitem>
66274 <para>
66275 <emphasis>mark all delivered</emphasis>: A call to Exim is made using the <option>-Mmad</option> option to
66276 mark all recipient addresses as already delivered.
66277 </para>
66278 </listitem>
66279 <listitem>
66280 <para>
66281 <emphasis>edit sender</emphasis>: A dialog box is displayed initialized with the current
66282 sender&#x2019;s address. Pressing RETURN causes a call to Exim to be made using the
66283 <option>-Mes</option> option to replace the sender address, unless the entry box is empty,
66284 in which case no action is taken. If you want to set an empty sender (as in
66285 bounce messages), you must specify it as <quote>&lt;&gt;</quote>. Otherwise, if the address is
66286 not qualified and the QUALIFY_DOMAIN parameter is set in <filename>Local/eximon.conf</filename>,
66287 the address is qualified with that domain.
66288 </para>
66289 </listitem>
66290 </itemizedlist>
66291 <para>
66292 When a delivery is forced, a window showing the <option>-v</option> output is displayed. In
66293 other cases when a call to Exim is made, if there is any output from Exim (in
66294 particular, if the command fails) a window containing the command and the
66295 output is displayed. Otherwise, the results of the action are normally apparent
66296 from the log and queue displays. However, if you set ACTION_OUTPUT=yes in
66297 <filename>Local/eximon.conf</filename>, a window showing the Exim command is always opened, even
66298 if no output is generated.
66299 </para>
66300 <para>
66301 The queue display is automatically updated for actions such as freezing and
66302 thawing, unless ACTION_QUEUE_UPDATE=no has been set in
66303 <filename>Local/eximon.conf</filename>. In this case the <quote>Update</quote> button has to be used to
66304 force an update of the display after one of these actions.
66305 </para>
66306 <para>
66307 In any text window that is displayed as result of a menu action, the normal
66308 cut-and-paste facility is available, and searching can be carried out using ^R
66309 and ^S, as described above for the log tail window.
66310 <indexterm role="concept" startref="IIDeximon" class="endofrange"/>
66311 </para>
66312 </section>
66313 </chapter>
66314
66315 <chapter id="CHAPsecurity">
66316 <title>Security considerations</title>
66317 <para>
66318 <indexterm role="concept" id="IIDsecurcon" class="startofrange">
66319 <primary>security</primary>
66320 <secondary>discussion of</secondary>
66321 </indexterm>
66322 This chapter discusses a number of issues concerned with security, some of
66323 which are also covered in other parts of this manual.
66324 </para>
66325 <para>
66326 For reasons that this author does not understand, some people have promoted
66327 Exim as a <quote>particularly secure</quote> mailer. Perhaps it is because of the
66328 existence of this chapter in the documentation. However, the intent of the
66329 chapter is simply to describe the way Exim works in relation to certain
66330 security concerns, not to make any specific claims about the effectiveness of
66331 its security as compared with other MTAs.
66332 </para>
66333 <para>
66334 What follows is a description of the way Exim is supposed to be. Best efforts
66335 have been made to try to ensure that the code agrees with the theory, but an
66336 absence of bugs can never be guaranteed. Any that are reported will get fixed
66337 as soon as possible.
66338 </para>
66339 <section id="SECID286">
66340 <title>Building a more <quote>hardened</quote> Exim</title>
66341 <para>
66342 <indexterm role="concept">
66343 <primary>security</primary>
66344 <secondary>build-time features</secondary>
66345 </indexterm>
66346 There are a number of build-time options that can be set in <filename>Local/Makefile</filename>
66347 to create Exim binaries that are <quote>harder</quote> to attack, in particular by a rogue
66348 Exim administrator who does not have the root password, or by someone who has
66349 penetrated the Exim (but not the root) account. These options are as follows:
66350 </para>
66351 <itemizedlist>
66352 <listitem>
66353 <para>
66354 ALT_CONFIG_PREFIX can be set to a string that is required to match the
66355 start of any file names used with the <option>-C</option> option. When it is set, these file
66356 names are also not allowed to contain the sequence <quote>/../</quote>. (However, if the
66357 value of the <option>-C</option> option is identical to the value of CONFIGURE_FILE in
66358 <filename>Local/Makefile</filename>, Exim ignores <option>-C</option> and proceeds as usual.) There is no
66359 default setting for <option>ALT_CONFIG_PREFIX</option>.
66360 </para>
66361 <para>
66362 If the permitted configuration files are confined to a directory to
66363 which only root has access, this guards against someone who has broken
66364 into the Exim account from running a privileged Exim with an arbitrary
66365 configuration file, and using it to break into other accounts.
66366 </para>
66367 </listitem>
66368 <listitem>
66369 <para>
66370 If a non-trusted configuration file (i.e. not the default configuration file
66371 or one which is trusted by virtue of being listed in the TRUSTED_CONFIG_LIST
66372 file) is specified with <option>-C</option>, or if macros are given with <option>-D</option> (but see
66373 the next item), then root privilege is retained only if the caller of Exim is
66374 root. This locks out the possibility of testing a configuration using <option>-C</option>
66375 right through message reception and delivery, even if the caller is root. The
66376 reception works, but by that time, Exim is running as the Exim user, so when
66377 it re-execs to regain privilege for the delivery, the use of <option>-C</option> causes
66378 privilege to be lost. However, root can test reception and delivery using two
66379 separate commands.
66380 </para>
66381 </listitem>
66382 <listitem>
66383 <para>
66384 The WHITELIST_D_MACROS build option declares some macros to be safe to override
66385 with <option>-D</option> if the real uid is one of root, the Exim run-time user or the
66386 CONFIGURE_OWNER, if defined.  The potential impact of this option is limited by
66387 requiring the run-time value supplied to <option>-D</option> to match a regex that errs on
66388 the restrictive side.  Requiring build-time selection of safe macros is onerous
66389 but this option is intended solely as a transition mechanism to permit
66390 previously-working configurations to continue to work after release 4.73.
66391 </para>
66392 </listitem>
66393 <listitem>
66394 <para>
66395 If DISABLE_D_OPTION is defined, the use of the <option>-D</option> command line option
66396 is disabled.
66397 </para>
66398 </listitem>
66399 <listitem>
66400 <para>
66401 FIXED_NEVER_USERS can be set to a colon-separated list of users that are
66402 never to be used for any deliveries. This is like the <option>never_users</option> runtime
66403 option, but it cannot be overridden; the runtime option adds additional users
66404 to the list. The default setting is <quote>root</quote>; this prevents a non-root user who
66405 is permitted to modify the runtime file from using Exim as a way to get root.
66406 </para>
66407 </listitem>
66408 </itemizedlist>
66409 </section>
66410 <section id="SECID270">
66411 <title>Root privilege</title>
66412 <para>
66413 <indexterm role="concept">
66414 <primary>setuid</primary>
66415 </indexterm>
66416 <indexterm role="concept">
66417 <primary>root privilege</primary>
66418 </indexterm>
66419 The Exim binary is normally setuid to root, which means that it gains root
66420 privilege (runs as root) when it starts execution. In some special cases (for
66421 example, when the daemon is not in use and there are no local deliveries), it
66422 may be possible to run Exim setuid to some user other than root. This is
66423 discussed in the next section. However, in most installations, root privilege
66424 is required for two things:
66425 </para>
66426 <itemizedlist>
66427 <listitem>
66428 <para>
66429 To set up a socket connected to the standard SMTP port (25) when initialising
66430 the listening daemon. If Exim is run from <emphasis>inetd</emphasis>, this privileged action is
66431 not required.
66432 </para>
66433 </listitem>
66434 <listitem>
66435 <para>
66436 To be able to change uid and gid in order to read users&#x2019; <filename>.forward</filename> files and
66437 perform local deliveries as the receiving user or as specified in the
66438 configuration.
66439 </para>
66440 </listitem>
66441 </itemizedlist>
66442 <para>
66443 It is not necessary to be root to do any of the other things Exim does, such as
66444 receiving messages and delivering them externally over SMTP, and it is
66445 obviously more secure if Exim does not run as root except when necessary.
66446 For this reason, a user and group for Exim to use must be defined in
66447 <filename>Local/Makefile</filename>. These are known as <quote>the Exim user</quote> and <quote>the Exim
66448 group</quote>. Their values can be changed by the run time configuration, though this
66449 is not recommended. Often a user called <emphasis>exim</emphasis> is used, but some sites use
66450 <emphasis>mail</emphasis> or another user name altogether.
66451 </para>
66452 <para>
66453 Exim uses <function>setuid()</function> whenever it gives up root privilege. This is a permanent
66454 abdication; the process cannot regain root afterwards. Prior to release 4.00,
66455 <function>seteuid()</function> was used in some circumstances, but this is no longer the case.
66456 </para>
66457 <para>
66458 After a new Exim process has interpreted its command line options, it changes
66459 uid and gid in the following cases:
66460 </para>
66461 <itemizedlist>
66462 <listitem>
66463 <para>
66464 <indexterm role="option">
66465 <primary><option>-C</option></primary>
66466 </indexterm>
66467 <indexterm role="option">
66468 <primary><option>-D</option></primary>
66469 </indexterm>
66470 If the <option>-C</option> option is used to specify an alternate configuration file, or if
66471 the <option>-D</option> option is used to define macro values for the configuration, and the
66472 calling process is not running as root, the uid and gid are changed to those of
66473 the calling process.
66474 However, if DISABLE_D_OPTION is defined in <filename>Local/Makefile</filename>, the <option>-D</option>
66475 option may not be used at all.
66476 If WHITELIST_D_MACROS is defined in <filename>Local/Makefile</filename>, then some macro values
66477 can be supplied if the calling process is running as root, the Exim run-time
66478 user or CONFIGURE_OWNER, if defined.
66479 </para>
66480 </listitem>
66481 <listitem>
66482 <para>
66483 <indexterm role="option">
66484 <primary><option>-be</option></primary>
66485 </indexterm>
66486 <indexterm role="option">
66487 <primary><option>-bf</option></primary>
66488 </indexterm>
66489 <indexterm role="option">
66490 <primary><option>-bF</option></primary>
66491 </indexterm>
66492 If the expansion test option (<option>-be</option>) or one of the filter testing options
66493 (<option>-bf</option> or <option>-bF</option>) are used, the uid and gid are changed to those of the
66494 calling process.
66495 </para>
66496 </listitem>
66497 <listitem>
66498 <para>
66499 If the process is not a daemon process or a queue runner process or a delivery
66500 process or a process for testing address routing (started with <option>-bt</option>), the
66501 uid and gid are changed to the Exim user and group. This means that Exim always
66502 runs under its own uid and gid when receiving messages. This also applies when
66503 testing address verification
66504 <indexterm role="option">
66505 <primary><option>-bv</option></primary>
66506 </indexterm>
66507 <indexterm role="option">
66508 <primary><option>-bh</option></primary>
66509 </indexterm>
66510 (the <option>-bv</option> option) and testing incoming message policy controls (the <option>-bh</option>
66511 option).
66512 </para>
66513 </listitem>
66514 <listitem>
66515 <para>
66516 For a daemon, queue runner, delivery, or address testing process, the uid
66517 remains as root at this stage, but the gid is changed to the Exim group.
66518 </para>
66519 </listitem>
66520 </itemizedlist>
66521 <para>
66522 The processes that initially retain root privilege behave as follows:
66523 </para>
66524 <itemizedlist>
66525 <listitem>
66526 <para>
66527 A daemon process changes the gid to the Exim group and the uid to the Exim
66528 user after setting up one or more listening sockets. The <function>initgroups()</function>
66529 function is called, so that if the Exim user is in any additional groups, they
66530 will be used during message reception.
66531 </para>
66532 </listitem>
66533 <listitem>
66534 <para>
66535 A queue runner process retains root privilege throughout its execution. Its
66536 job is to fork a controlled sequence of delivery processes.
66537 </para>
66538 </listitem>
66539 <listitem>
66540 <para>
66541 A delivery process retains root privilege throughout most of its execution,
66542 but any actual deliveries (that is, the transports themselves) are run in
66543 subprocesses which always change to a non-root uid and gid. For local
66544 deliveries this is typically the uid and gid of the owner of the mailbox; for
66545 remote deliveries, the Exim uid and gid are used. Once all the delivery
66546 subprocesses have been run, a delivery process changes to the Exim uid and gid
66547 while doing post-delivery tidying up such as updating the retry database and
66548 generating bounce and warning messages.
66549 </para>
66550 <para>
66551 While the recipient addresses in a message are being routed, the delivery
66552 process runs as root. However, if a user&#x2019;s filter file has to be processed,
66553 this is done in a subprocess that runs under the individual user&#x2019;s uid and
66554 gid. A system filter is run as root unless <option>system_filter_user</option> is set.
66555 </para>
66556 </listitem>
66557 <listitem>
66558 <para>
66559 A process that is testing addresses (the <option>-bt</option> option) runs as root so that
66560 the routing is done in the same environment as a message delivery.
66561 </para>
66562 </listitem>
66563 </itemizedlist>
66564 </section>
66565 <section id="SECTrunexiwitpri">
66566 <title>Running Exim without privilege</title>
66567 <para>
66568 <indexterm role="concept">
66569 <primary>privilege, running without</primary>
66570 </indexterm>
66571 <indexterm role="concept">
66572 <primary>unprivileged running</primary>
66573 </indexterm>
66574 <indexterm role="concept">
66575 <primary>root privilege</primary>
66576 <secondary>running without</secondary>
66577 </indexterm>
66578 Some installations like to run Exim in an unprivileged state for more of its
66579 operation, for added security. Support for this mode of operation is provided
66580 by the global option <option>deliver_drop_privilege</option>. When this is set, the uid and
66581 gid are changed to the Exim user and group at the start of a delivery process
66582 (and also queue runner and address testing processes). This means that address
66583 routing is no longer run as root, and the deliveries themselves cannot change
66584 to any other uid.
66585 </para>
66586 <para>
66587 <indexterm role="concept">
66588 <primary>SIGHUP</primary>
66589 </indexterm>
66590 <indexterm role="concept">
66591 <primary>daemon</primary>
66592 <secondary>restarting</secondary>
66593 </indexterm>
66594 Leaving the binary setuid to root, but setting <option>deliver_drop_privilege</option> means
66595 that the daemon can still be started in the usual way, and it can respond
66596 correctly to SIGHUP because the re-invocation regains root privilege.
66597 </para>
66598 <para>
66599 An alternative approach is to make Exim setuid to the Exim user and also setgid
66600 to the Exim group. If you do this, the daemon must be started from a root
66601 process. (Calling Exim from a root process makes it behave in the way it does
66602 when it is setuid root.) However, the daemon cannot restart itself after a
66603 SIGHUP signal because it cannot regain privilege.
66604 </para>
66605 <para>
66606 It is still useful to set <option>deliver_drop_privilege</option> in this case, because it
66607 stops Exim from trying to re-invoke itself to do a delivery after a message has
66608 been received. Such a re-invocation is a waste of resources because it has no
66609 effect.
66610 </para>
66611 <para>
66612 If restarting the daemon is not an issue (for example, if <option>mua_wrapper</option> is
66613 set, or <emphasis>inetd</emphasis> is being used instead of a daemon), having the binary setuid
66614 to the Exim user seems a clean approach, but there is one complication:
66615 </para>
66616 <para>
66617 In this style of operation, Exim is running with the real uid and gid set to
66618 those of the calling process, and the effective uid/gid set to Exim&#x2019;s values.
66619 Ideally, any association with the calling process&#x2019; uid/gid should be dropped,
66620 that is, the real uid/gid should be reset to the effective values so as to
66621 discard any privileges that the caller may have. While some operating systems
66622 have a function that permits this action for a non-root effective uid, quite a
66623 number of them do not. Because of this lack of standardization, Exim does not
66624 address this problem at this time.
66625 </para>
66626 <para>
66627 For this reason, the recommended approach for <quote>mostly unprivileged</quote> running
66628 is to keep the Exim binary setuid to root, and to set
66629 <option>deliver_drop_privilege</option>. This also has the advantage of allowing a daemon to
66630 be used in the most straightforward way.
66631 </para>
66632 <para>
66633 If you configure Exim not to run delivery processes as root, there are a
66634 number of restrictions on what you can do:
66635 </para>
66636 <itemizedlist>
66637 <listitem>
66638 <para>
66639 You can deliver only as the Exim user/group. You should  explicitly use the
66640 <option>user</option> and <option>group</option> options to override routers or local transports that
66641 normally deliver as the recipient. This makes sure that configurations that
66642 work in this mode function the same way in normal mode. Any implicit or
66643 explicit specification of another user causes an error.
66644 </para>
66645 </listitem>
66646 <listitem>
66647 <para>
66648 Use of <filename>.forward</filename> files is severely restricted, such that it is usually
66649 not worthwhile to include them in the configuration.
66650 </para>
66651 </listitem>
66652 <listitem>
66653 <para>
66654 Users who wish to use <filename>.forward</filename> would have to make their home directory and
66655 the file itself accessible to the Exim user. Pipe and append-to-file entries,
66656 and their equivalents in Exim filters, cannot be used. While they could be
66657 enabled in the Exim user&#x2019;s name, that would be insecure and not very useful.
66658 </para>
66659 </listitem>
66660 <listitem>
66661 <para>
66662 Unless the local user mailboxes are all owned by the Exim user (possible in
66663 some POP3 or IMAP-only environments):
66664 </para>
66665 <orderedlist numeration="arabic">
66666 <listitem>
66667 <para>
66668 They must be owned by the Exim group and be writeable by that group. This
66669 implies you must set <option>mode</option> in the appendfile configuration, as well as the
66670 mode of the mailbox files themselves.
66671 </para>
66672 </listitem>
66673 <listitem>
66674 <para>
66675 You must set <option>no_check_owner</option>, since most or all of the files will not be
66676 owned by the Exim user.
66677 </para>
66678 </listitem>
66679 <listitem>
66680 <para>
66681 You must set <option>file_must_exist</option>, because Exim cannot set the owner correctly
66682 on a newly created mailbox when unprivileged. This also implies that new
66683 mailboxes need to be created manually.
66684 </para>
66685 </listitem>
66686 </orderedlist>
66687 </listitem>
66688 </itemizedlist>
66689 <para>
66690 These restrictions severely restrict what can be done in local deliveries.
66691 However, there are no restrictions on remote deliveries. If you are running a
66692 gateway host that does no local deliveries, setting <option>deliver_drop_privilege</option>
66693 gives more security at essentially no cost.
66694 </para>
66695 <para>
66696 If you are using the <option>mua_wrapper</option> facility (see chapter
66697 <xref linkend="CHAPnonqueueing"/>), <option>deliver_drop_privilege</option> is forced to be true.
66698 </para>
66699 </section>
66700 <section id="SECID271">
66701 <title>Delivering to local files</title>
66702 <para>
66703 Full details of the checks applied by <command>appendfile</command> before it writes to a file
66704 are given in chapter <xref linkend="CHAPappendfile"/>.
66705 </para>
66706 </section>
66707 <section id="SECTsecconslocalcmds">
66708 <title>Running local commands</title>
66709 <para>
66710 <indexterm role="concept">
66711 <primary>security</primary>
66712 <secondary>local commands</secondary>
66713 </indexterm>
66714 <indexterm role="concept">
66715 <primary>security</primary>
66716 <secondary>command injection attacks</secondary>
66717 </indexterm>
66718 There are a number of ways in which an administrator can configure Exim to run
66719 commands based upon received, untrustworthy, data. Further, in some
66720 configurations a user who can control a <filename>.forward</filename> file can also arrange to
66721 run commands. Configuration to check includes, but is not limited to:
66722 </para>
66723 <itemizedlist>
66724 <listitem>
66725 <para>
66726 Use of <option>use_shell</option> in the pipe transport: various forms of shell command
66727 injection may be possible with this option present. It is dangerous and should
66728 be used only with considerable caution. Consider constraints which whitelist
66729 allowed characters in a variable which is to be used in a pipe transport that
66730 has <option>use_shell</option> enabled.
66731 </para>
66732 </listitem>
66733 <listitem>
66734 <para>
66735 A number of options such as <option>forbid_filter_run</option>, <option>forbid_filter_perl</option>,
66736 <option>forbid_filter_dlfunc</option> and so forth which restrict facilities available to
66737 <filename>.forward</filename> files in a redirect router. If Exim is running on a central mail
66738 hub to which ordinary users do not have shell access, but home directories are
66739 NFS mounted (for instance) then administrators should review the list of these
66740 forbid options available, and should bear in mind that the options that may
66741 need forbidding can change as new features are added between releases.
66742 </para>
66743 </listitem>
66744 <listitem>
66745 <para>
66746 The <option>${run...}</option> expansion item does not use a shell by default, but
66747 administrators can configure use of <filename>/bin/sh</filename> as part of the command.
66748 Such invocations should be viewed with prejudicial suspicion.
66749 </para>
66750 </listitem>
66751 <listitem>
66752 <para>
66753 Administrators who use embedded Perl are advised to explore how Perl&#x2019;s
66754 taint checking might apply to their usage.
66755 </para>
66756 </listitem>
66757 <listitem>
66758 <para>
66759 Use of <option>${expand...}</option> is somewhat analogous to shell&#x2019;s eval builtin and
66760 administrators are well advised to view its use with suspicion, in case (for
66761 instance) it allows a local-part to contain embedded Exim directives.
66762 </para>
66763 </listitem>
66764 <listitem>
66765 <para>
66766 Use of <option>${match_local_part...}</option> and friends becomes more dangerous if
66767 Exim was built with EXPAND_LISTMATCH_RHS defined: the second string in
66768 each can reference arbitrary lists and files, rather than just being a list
66769 of opaque strings.
66770 The EXPAND_LISTMATCH_RHS option was added and set false by default because of
66771 real-world security vulnerabilities caused by its use with untrustworthy data
66772 injected in, for SQL injection attacks.
66773 Consider the use of the <option>inlisti</option> expansion condition instead.
66774 </para>
66775 </listitem>
66776 </itemizedlist>
66777 </section>
66778 <section id="SECTsecconfdata">
66779 <title>Trust in configuration data</title>
66780 <para>
66781 <indexterm role="concept">
66782 <primary>security</primary>
66783 <secondary>data sources</secondary>
66784 </indexterm>
66785 <indexterm role="concept">
66786 <primary>security</primary>
66787 <secondary>regular expressions</secondary>
66788 </indexterm>
66789 <indexterm role="concept">
66790 <primary>regular expressions</primary>
66791 <secondary>security</secondary>
66792 </indexterm>
66793 <indexterm role="concept">
66794 <primary>PCRE</primary>
66795 <secondary>security</secondary>
66796 </indexterm>
66797 If configuration data for Exim can come from untrustworthy sources, there
66798 are some issues to be aware of:
66799 </para>
66800 <itemizedlist>
66801 <listitem>
66802 <para>
66803 Use of <option>${expand...}</option> may provide a path for shell injection attacks.
66804 </para>
66805 </listitem>
66806 <listitem>
66807 <para>
66808 Letting untrusted data provide a regular expression is unwise.
66809 </para>
66810 </listitem>
66811 <listitem>
66812 <para>
66813 Using <option>${match...}</option> to apply a fixed regular expression against untrusted
66814 data may result in pathological behaviour within PCRE.  Be aware of what
66815 "backtracking" means and consider options for being more strict with a regular
66816 expression. Avenues to explore include limiting what can match (avoiding <literal>.</literal>
66817 when <literal>[a-z0-9]</literal> or other character class will do), use of atomic grouping and
66818 possessive quantifiers or just not using regular expressions against untrusted
66819 data.
66820 </para>
66821 </listitem>
66822 <listitem>
66823 <para>
66824 It can be important to correctly use <option>${quote:...}</option>,
66825 <option>${quote_local_part:...}</option> and <option>${quote_</option>&lt;<emphasis>lookup-type</emphasis>&gt;<option>:...}</option> expansion
66826 items to ensure that data is correctly constructed.
66827 </para>
66828 </listitem>
66829 <listitem>
66830 <para>
66831 Some lookups might return multiple results, even though normal usage is only
66832 expected to yield one result.
66833 </para>
66834 </listitem>
66835 </itemizedlist>
66836 </section>
66837 <section id="SECID272">
66838 <title>IPv4 source routing</title>
66839 <para>
66840 <indexterm role="concept">
66841 <primary>source routing</primary>
66842 <secondary>in IP packets</secondary>
66843 </indexterm>
66844 <indexterm role="concept">
66845 <primary>IP source routing</primary>
66846 </indexterm>
66847 Many operating systems suppress IP source-routed packets in the kernel, but
66848 some cannot be made to do this, so Exim does its own check. It logs incoming
66849 IPv4 source-routed TCP calls, and then drops them. Things are all different in
66850 IPv6. No special checking is currently done.
66851 </para>
66852 </section>
66853 <section id="SECID273">
66854 <title>The VRFY, EXPN, and ETRN commands in SMTP</title>
66855 <para>
66856 Support for these SMTP commands is disabled by default. If required, they can
66857 be enabled by defining suitable ACLs.
66858 </para>
66859 </section>
66860 <section id="SECID274">
66861 <title>Privileged users</title>
66862 <para>
66863 <indexterm role="concept">
66864 <primary>trusted users</primary>
66865 </indexterm>
66866 <indexterm role="concept">
66867 <primary>admin user</primary>
66868 </indexterm>
66869 <indexterm role="concept">
66870 <primary>privileged user</primary>
66871 </indexterm>
66872 <indexterm role="concept">
66873 <primary>user</primary>
66874 <secondary>trusted</secondary>
66875 </indexterm>
66876 <indexterm role="concept">
66877 <primary>user</primary>
66878 <secondary>admin</secondary>
66879 </indexterm>
66880 Exim recognizes two sets of users with special privileges. Trusted users are
66881 able to submit new messages to Exim locally, but supply their own sender
66882 addresses and information about a sending host. For other users submitting
66883 local messages, Exim sets up the sender address from the uid, and doesn&#x2019;t
66884 permit a remote host to be specified.
66885 </para>
66886 <para>
66887 <indexterm role="option">
66888 <primary><option>-f</option></primary>
66889 </indexterm>
66890 However, an untrusted user is permitted to use the <option>-f</option> command line option
66891 in the special form <option>-f &lt;&gt;</option> to indicate that a delivery failure for the
66892 message should not cause an error report. This affects the message&#x2019;s envelope,
66893 but it does not affect the <emphasis>Sender:</emphasis> header. Untrusted users may also be
66894 permitted to use specific forms of address with the <option>-f</option> option by setting
66895 the <option>untrusted_set_sender</option> option.
66896 </para>
66897 <para>
66898 Trusted users are used to run processes that receive mail messages from some
66899 other mail domain and pass them on to Exim for delivery either locally, or over
66900 the Internet. Exim trusts a caller that is running as root, as the Exim user,
66901 as any user listed in the <option>trusted_users</option> configuration option, or under any
66902 group listed in the <option>trusted_groups</option> option.
66903 </para>
66904 <para>
66905 Admin users are permitted to do things to the messages on Exim&#x2019;s queue. They
66906 can freeze or thaw messages, cause them to be returned to their senders, remove
66907 them entirely, or modify them in various ways. In addition, admin users can run
66908 the Exim monitor and see all the information it is capable of providing, which
66909 includes the contents of files on the spool.
66910 </para>
66911 <para>
66912 <indexterm role="option">
66913 <primary><option>-M</option></primary>
66914 </indexterm>
66915 <indexterm role="option">
66916 <primary><option>-q</option></primary>
66917 </indexterm>
66918 By default, the use of the <option>-M</option> and <option>-q</option> options to cause Exim to attempt
66919 delivery of messages on its queue is restricted to admin users. This
66920 restriction can be relaxed by setting the <option>no_prod_requires_admin</option> option.
66921 Similarly, the use of <option>-bp</option> (and its variants) to list the contents of the
66922 queue is also restricted to admin users. This restriction can be relaxed by
66923 setting <option>no_queue_list_requires_admin</option>.
66924 </para>
66925 <para>
66926 Exim recognizes an admin user if the calling process is running as root or as
66927 the Exim user or if any of the groups associated with the calling process is
66928 the Exim group. It is not necessary actually to be running under the Exim
66929 group. However, if admin users who are not root or the Exim user are to access
66930 the contents of files on the spool via the Exim monitor (which runs
66931 unprivileged), Exim must be built to allow group read access to its spool
66932 files.
66933 </para>
66934 </section>
66935 <section id="SECID275">
66936 <title>Spool files</title>
66937 <para>
66938 <indexterm role="concept">
66939 <primary>spool directory</primary>
66940 <secondary>files</secondary>
66941 </indexterm>
66942 Exim&#x2019;s spool directory and everything it contains is owned by the Exim user and
66943 set to the Exim group. The mode for spool files is defined in the
66944 <filename>Local/Makefile</filename> configuration file, and defaults to 0640. This means that
66945 any user who is a member of the Exim group can access these files.
66946 </para>
66947 </section>
66948 <section id="SECID276">
66949 <title>Use of argv[0]</title>
66950 <para>
66951 Exim examines the last component of <option>argv[0]</option>, and if it matches one of a set
66952 of specific strings, Exim assumes certain options. For example, calling Exim
66953 with the last component of <option>argv[0]</option> set to <quote>rsmtp</quote> is exactly equivalent
66954 to calling it with the option <option>-bS</option>. There are no security implications in
66955 this.
66956 </para>
66957 </section>
66958 <section id="SECID277">
66959 <title>Use of %f formatting</title>
66960 <para>
66961 The only use made of <quote>%f</quote> by Exim is in formatting load average values. These
66962 are actually stored in integer variables as 1000 times the load average.
66963 Consequently, their range is limited and so therefore is the length of the
66964 converted output.
66965 </para>
66966 </section>
66967 <section id="SECID278">
66968 <title>Embedded Exim path</title>
66969 <para>
66970 Exim uses its own path name, which is embedded in the code, only when it needs
66971 to re-exec in order to regain root privilege. Therefore, it is not root when it
66972 does so. If some bug allowed the path to get overwritten, it would lead to an
66973 arbitrary program&#x2019;s being run as exim, not as root.
66974 </para>
66975 </section>
66976 <section id="SECTdynmoddir">
66977 <title>Dynamic module directory</title>
66978 <para>
66979 Any dynamically loadable modules must be installed into the directory
66980 defined in <literal>LOOKUP_MODULE_DIR</literal> in <filename>Local/Makefile</filename> for Exim to permit
66981 loading it.
66982 </para>
66983 </section>
66984 <section id="SECID279">
66985 <title>Use of sprintf()</title>
66986 <para>
66987 <indexterm role="concept">
66988 <primary><function>sprintf()</function></primary>
66989 </indexterm>
66990 A large number of occurrences of <quote>sprintf</quote> in the code are actually calls to
66991 <emphasis>string_sprintf()</emphasis>, a function that returns the result in malloc&#x2019;d store.
66992 The intermediate formatting is done into a large fixed buffer by a function
66993 that runs through the format string itself, and checks the length of each
66994 conversion before performing it, thus preventing buffer overruns.
66995 </para>
66996 <para>
66997 The remaining uses of <function>sprintf()</function> happen in controlled circumstances where
66998 the output buffer is known to be sufficiently long to contain the converted
66999 string.
67000 </para>
67001 </section>
67002 <section id="SECID280">
67003 <title>Use of debug_printf() and log_write()</title>
67004 <para>
67005 Arbitrary strings are passed to both these functions, but they do their
67006 formatting by calling the function <emphasis>string_vformat()</emphasis>, which runs through
67007 the format string itself, and checks the length of each conversion.
67008 </para>
67009 </section>
67010 <section id="SECID281">
67011 <title>Use of strcat() and strcpy()</title>
67012 <para>
67013 These are used only in cases where the output buffer is known to be large
67014 enough to hold the result.
67015 <indexterm role="concept" startref="IIDsecurcon" class="endofrange"/>
67016 </para>
67017 </section>
67018 </chapter>
67019
67020 <chapter id="CHAPspool">
67021 <title>Format of spool files</title>
67022 <para>
67023 <indexterm role="concept" id="IIDforspo1" class="startofrange">
67024 <primary>format</primary>
67025 <secondary>spool files</secondary>
67026 </indexterm>
67027 <indexterm role="concept" id="IIDforspo2" class="startofrange">
67028 <primary>spool directory</primary>
67029 <secondary>format of files</secondary>
67030 </indexterm>
67031 <indexterm role="concept" id="IIDforspo3" class="startofrange">
67032 <primary>spool files</primary>
67033 <secondary>format of</secondary>
67034 </indexterm>
67035 <indexterm role="concept">
67036 <primary>spool files</primary>
67037 <secondary>editing</secondary>
67038 </indexterm>
67039 A message on Exim&#x2019;s queue consists of two files, whose names are the message id
67040 followed by -D and -H, respectively. The data portion of the message is kept in
67041 the -D file on its own. The message&#x2019;s envelope, status, and headers are all
67042 kept in the -H file, whose format is described in this chapter. Each of these
67043 two files contains the final component of its own name as its first line. This
67044 is insurance against disk crashes where the directory is lost but the files
67045 themselves are recoverable.
67046 </para>
67047 <para>
67048 Some people are tempted into editing -D files in order to modify messages. You
67049 need to be extremely careful if you do this; it is not recommended and you are
67050 on your own if you do it. Here are some of the pitfalls:
67051 </para>
67052 <itemizedlist>
67053 <listitem>
67054 <para>
67055 You must ensure that Exim does not try to deliver the message while you are
67056 fiddling with it. The safest way is to take out a write lock on the -D file,
67057 which is what Exim itself does, using <function>fcntl()</function>. If you update the file in
67058 place, the lock will be retained. If you write a new file and rename it, the
67059 lock will be lost at the instant of rename.
67060 </para>
67061 </listitem>
67062 <listitem>
67063 <para>
67064 <indexterm role="variable">
67065 <primary><varname>$body_linecount</varname></primary>
67066 </indexterm>
67067 If you change the number of lines in the file, the value of
67068 <varname>$body_linecount</varname>, which is stored in the -H file, will be incorrect. At
67069 present, this value is not used by Exim, but there is no guarantee that this
67070 will always be the case.
67071 </para>
67072 </listitem>
67073 <listitem>
67074 <para>
67075 If the message is in MIME format, you must take care not to break it.
67076 </para>
67077 </listitem>
67078 <listitem>
67079 <para>
67080 If the message is cryptographically signed, any change will invalidate the
67081 signature.
67082 </para>
67083 </listitem>
67084 </itemizedlist>
67085 <para>
67086 All in all, modifying -D files is fraught with danger.
67087 </para>
67088 <para>
67089 Files whose names end with -J may also be seen in the <filename>input</filename> directory (or
67090 its subdirectories when <option>split_spool_directory</option> is set). These are journal
67091 files, used to record addresses to which the message has been delivered during
67092 the course of a delivery attempt. If there are still undelivered recipients at
67093 the end, the -H file is updated, and the -J file is deleted. If, however, there
67094 is some kind of crash (for example, a power outage) before this happens, the -J
67095 file remains in existence. When Exim next processes the message, it notices the
67096 -J file and uses it to update the -H file before starting the next delivery
67097 attempt.
67098 </para>
67099 <section id="SECID282">
67100 <title>Format of the -H file</title>
67101 <para>
67102 <indexterm role="concept">
67103 <primary>uid (user id)</primary>
67104 <secondary>in spool file</secondary>
67105 </indexterm>
67106 <indexterm role="concept">
67107 <primary>gid (group id)</primary>
67108 <secondary>in spool file</secondary>
67109 </indexterm>
67110 The second line of the -H file contains the login name for the uid of the
67111 process that called Exim to read the message, followed by the numerical uid and
67112 gid. For a locally generated message, this is normally the user who sent the
67113 message. For a message received over TCP/IP via the daemon, it is
67114 normally the Exim user.
67115 </para>
67116 <para>
67117 The third line of the file contains the address of the message&#x2019;s sender as
67118 transmitted in the envelope, contained in angle brackets. The sender address is
67119 empty for bounce messages. For incoming SMTP mail, the sender address is given
67120 in the MAIL command. For locally generated mail, the sender address is
67121 created by Exim from the login name of the current user and the configured
67122 <option>qualify_domain</option>. However, this can be overridden by the <option>-f</option> option or a
67123 leading <quote>From&nbsp;</quote> line if the caller is trusted, or if the supplied address is
67124 <quote>&lt;&gt;</quote> or an address that matches <option>untrusted_set_senders</option>.
67125 </para>
67126 <para>
67127 The fourth line contains two numbers. The first is the time that the message
67128 was received, in the conventional Unix form &ndash; the number of seconds since the
67129 start of the epoch. The second number is a count of the number of messages
67130 warning of delayed delivery that have been sent to the sender.
67131 </para>
67132 <para>
67133 There follow a number of lines starting with a hyphen. These can appear in any
67134 order, and are omitted when not relevant:
67135 </para>
67136 <variablelist>
67137 <varlistentry>
67138 <term><option>-acl</option>&nbsp;&lt;<emphasis>number</emphasis>&gt;&nbsp;&lt;<emphasis>length</emphasis>&gt;</term>
67139 <listitem>
67140 <para>
67141 This item is obsolete, and is not generated from Exim release 4.61 onwards;
67142 <option>-aclc</option> and <option>-aclm</option> are used instead. However, <option>-acl</option> is still
67143 recognized, to provide backward compatibility. In the old format, a line of
67144 this form is present for every ACL variable that is not empty. The number
67145 identifies the variable; the <option>acl_c</option><emphasis role="bold">x</emphasis> variables are numbered 0&ndash;9 and
67146 the <option>acl_m</option><emphasis role="bold">x</emphasis> variables are numbered 10&ndash;19. The length is the length of
67147 the data string for the variable. The string itself starts at the beginning of
67148 the next line, and is followed by a newline character. It may contain internal
67149 newlines.
67150 </para>
67151 </listitem></varlistentry>
67152 <varlistentry>
67153 <term><option>-aclc</option>&nbsp;&lt;<emphasis>rest-of-name</emphasis>&gt;&nbsp;&lt;<emphasis>length</emphasis>&gt;</term>
67154 <listitem>
67155 <para>
67156 A line of this form is present for every ACL connection variable that is
67157 defined. Note that there is a space between <option>-aclc</option> and the rest of the name.
67158 The length is the length of the data string for the variable. The string itself
67159 starts at the beginning of the next line, and is followed by a newline
67160 character. It may contain internal newlines.
67161 </para>
67162 </listitem></varlistentry>
67163 <varlistentry>
67164 <term><option>-aclm</option>&nbsp;&lt;<emphasis>rest-of-name</emphasis>&gt;&nbsp;&lt;<emphasis>length</emphasis>&gt;</term>
67165 <listitem>
67166 <para>
67167 A line of this form is present for every ACL message variable that is defined.
67168 Note that there is a space between <option>-aclm</option> and the rest of the name. The
67169 length is the length of the data string for the variable. The string itself
67170 starts at the beginning of the next line, and is followed by a newline
67171 character. It may contain internal newlines.
67172 </para>
67173 </listitem></varlistentry>
67174 <varlistentry>
67175 <term><option>-active_hostname</option>&nbsp;&lt;<emphasis>hostname</emphasis>&gt;</term>
67176 <listitem>
67177 <para>
67178 This is present if, when the message was received over SMTP, the value of
67179 <varname>$smtp_active_hostname</varname> was different to the value of <varname>$primary_hostname</varname>.
67180 </para>
67181 </listitem></varlistentry>
67182 <varlistentry>
67183 <term><option>-allow_unqualified_recipient</option></term>
67184 <listitem>
67185 <para>
67186 This is present if unqualified recipient addresses are permitted in header
67187 lines (to stop such addresses from being qualified if rewriting occurs at
67188 transport time). Local messages that were input using <option>-bnq</option> and remote
67189 messages from hosts that match <option>recipient_unqualified_hosts</option> set this flag.
67190 </para>
67191 </listitem></varlistentry>
67192 <varlistentry>
67193 <term><option>-allow_unqualified_sender</option></term>
67194 <listitem>
67195 <para>
67196 This is present if unqualified sender addresses are permitted in header lines
67197 (to stop such addresses from being qualified if rewriting occurs at transport
67198 time). Local messages that were input using <option>-bnq</option> and remote messages from
67199 hosts that match <option>sender_unqualified_hosts</option> set this flag.
67200 </para>
67201 </listitem></varlistentry>
67202 <varlistentry>
67203 <term><option>-auth_id</option>&nbsp;&lt;<emphasis>text</emphasis>&gt;</term>
67204 <listitem>
67205 <para>
67206 The id information for a message received on an authenticated SMTP connection
67207 &ndash; the value of the <varname>$authenticated_id</varname> variable.
67208 </para>
67209 </listitem></varlistentry>
67210 <varlistentry>
67211 <term><option>-auth_sender</option>&nbsp;&lt;<emphasis>address</emphasis>&gt;</term>
67212 <listitem>
67213 <para>
67214 The address of an authenticated sender &ndash; the value of the
67215 <varname>$authenticated_sender</varname> variable.
67216 </para>
67217 </listitem></varlistentry>
67218 <varlistentry>
67219 <term><option>-body_linecount</option>&nbsp;&lt;<emphasis>number</emphasis>&gt;</term>
67220 <listitem>
67221 <para>
67222 This records the number of lines in the body of the message, and is always
67223 present.
67224 </para>
67225 </listitem></varlistentry>
67226 <varlistentry>
67227 <term><option>-body_zerocount</option>&nbsp;&lt;<emphasis>number</emphasis>&gt;</term>
67228 <listitem>
67229 <para>
67230 This records the number of binary zero bytes in the body of the message, and is
67231 present if the number is greater than zero.
67232 </para>
67233 </listitem></varlistentry>
67234 <varlistentry>
67235 <term><option>-deliver_firsttime</option></term>
67236 <listitem>
67237 <para>
67238 This is written when a new message is first added to the spool. When the spool
67239 file is updated after a deferral, it is omitted.
67240 </para>
67241 </listitem></varlistentry>
67242 <varlistentry>
67243 <term><option>-frozen</option>&nbsp;&lt;<emphasis>time</emphasis>&gt;</term>
67244 <listitem>
67245 <para>
67246 <indexterm role="concept">
67247 <primary>frozen messages</primary>
67248 <secondary>spool data</secondary>
67249 </indexterm>
67250 The message is frozen, and the freezing happened at &lt;<emphasis>time</emphasis>&gt;.
67251 </para>
67252 </listitem></varlistentry>
67253 <varlistentry>
67254 <term><option>-helo_name</option>&nbsp;&lt;<emphasis>text</emphasis>&gt;</term>
67255 <listitem>
67256 <para>
67257 This records the host name as specified by a remote host in a HELO or EHLO
67258 command.
67259 </para>
67260 </listitem></varlistentry>
67261 <varlistentry>
67262 <term><option>-host_address</option>&nbsp;&lt;<emphasis>address</emphasis>&gt;.&lt;<emphasis>port</emphasis>&gt;</term>
67263 <listitem>
67264 <para>
67265 This records the IP address of the host from which the message was received and
67266 the remote port number that was used. It is omitted for locally generated
67267 messages.
67268 </para>
67269 </listitem></varlistentry>
67270 <varlistentry>
67271 <term><option>-host_auth</option>&nbsp;&lt;<emphasis>text</emphasis>&gt;</term>
67272 <listitem>
67273 <para>
67274 If the message was received on an authenticated SMTP connection, this records
67275 the name of the authenticator &ndash; the value of the
67276 <varname>$sender_host_authenticated</varname> variable.
67277 </para>
67278 </listitem></varlistentry>
67279 <varlistentry>
67280 <term><option>-host_lookup_failed</option></term>
67281 <listitem>
67282 <para>
67283 This is present if an attempt to look up the sending host&#x2019;s name from its IP
67284 address failed. It corresponds to the <varname>$host_lookup_failed</varname> variable.
67285 </para>
67286 </listitem></varlistentry>
67287 <varlistentry>
67288 <term><option>-host_name</option>&nbsp;&lt;<emphasis>text</emphasis>&gt;</term>
67289 <listitem>
67290 <para>
67291 <indexterm role="concept">
67292 <primary>reverse DNS lookup</primary>
67293 </indexterm>
67294 <indexterm role="concept">
67295 <primary>DNS</primary>
67296 <secondary>reverse lookup</secondary>
67297 </indexterm>
67298 This records the name of the remote host from which the message was received,
67299 if the host name was looked up from the IP address when the message was being
67300 received. It is not present if no reverse lookup was done.
67301 </para>
67302 </listitem></varlistentry>
67303 <varlistentry>
67304 <term><option>-ident</option>&nbsp;&lt;<emphasis>text</emphasis>&gt;</term>
67305 <listitem>
67306 <para>
67307 For locally submitted messages, this records the login of the originating user,
67308 unless it was a trusted user and the <option>-oMt</option> option was used to specify an
67309 ident value. For messages received over TCP/IP, this records the ident string
67310 supplied by the remote host, if any.
67311 </para>
67312 </listitem></varlistentry>
67313 <varlistentry>
67314 <term><option>-interface_address</option>&nbsp;&lt;<emphasis>address</emphasis>&gt;.&lt;<emphasis>port</emphasis>&gt;</term>
67315 <listitem>
67316 <para>
67317 This records the IP address of the local interface and the port number through
67318 which a message was received from a remote host. It is omitted for locally
67319 generated messages.
67320 </para>
67321 </listitem></varlistentry>
67322 <varlistentry>
67323 <term><option>-local</option></term>
67324 <listitem>
67325 <para>
67326 The message is from a local sender.
67327 </para>
67328 </listitem></varlistentry>
67329 <varlistentry>
67330 <term><option>-localerror</option></term>
67331 <listitem>
67332 <para>
67333 The message is a locally-generated bounce message.
67334 </para>
67335 </listitem></varlistentry>
67336 <varlistentry>
67337 <term><option>-local_scan</option>&nbsp;&lt;<emphasis>string</emphasis>&gt;</term>
67338 <listitem>
67339 <para>
67340 This records the data string that was returned by the <function>local_scan()</function> function
67341 when the message was received &ndash; the value of the <varname>$local_scan_data</varname>
67342 variable. It is omitted if no data was returned.
67343 </para>
67344 </listitem></varlistentry>
67345 <varlistentry>
67346 <term><option>-manual_thaw</option></term>
67347 <listitem>
67348 <para>
67349 The message was frozen but has been thawed manually, that is, by an explicit
67350 Exim command rather than via the auto-thaw process.
67351 </para>
67352 </listitem></varlistentry>
67353 <varlistentry>
67354 <term><option>-N</option></term>
67355 <listitem>
67356 <para>
67357 A testing delivery process was started using the <option>-N</option> option to suppress any
67358 actual deliveries, but delivery was deferred. At any further delivery attempts,
67359 <option>-N</option> is assumed.
67360 </para>
67361 </listitem></varlistentry>
67362 <varlistentry>
67363 <term><option>-received_protocol</option></term>
67364 <listitem>
67365 <para>
67366 This records the value of the <varname>$received_protocol</varname> variable, which contains
67367 the name of the protocol by which the message was received.
67368 </para>
67369 </listitem></varlistentry>
67370 <varlistentry>
67371 <term><option>-sender_set_untrusted</option></term>
67372 <listitem>
67373 <para>
67374 The envelope sender of this message was set by an untrusted local caller (used
67375 to ensure that the caller is displayed in queue listings).
67376 </para>
67377 </listitem></varlistentry>
67378 <varlistentry>
67379 <term><option>-spam_score_int</option>&nbsp;&lt;<emphasis>number</emphasis>&gt;</term>
67380 <listitem>
67381 <para>
67382 If a message was scanned by SpamAssassin, this is present. It records the value
67383 of <varname>$spam_score_int</varname>.
67384 </para>
67385 </listitem></varlistentry>
67386 <varlistentry>
67387 <term><option>-tls_certificate_verified</option></term>
67388 <listitem>
67389 <para>
67390 A TLS certificate was received from the client that sent this message, and the
67391 certificate was verified by the server.
67392 </para>
67393 </listitem></varlistentry>
67394 <varlistentry>
67395 <term><option>-tls_cipher</option>&nbsp;&lt;<emphasis>cipher name</emphasis>&gt;</term>
67396 <listitem>
67397 <para>
67398 When the message was received over an encrypted connection, this records the
67399 name of the cipher suite that was used.
67400 </para>
67401 </listitem></varlistentry>
67402 <varlistentry>
67403 <term><option>-tls_peerdn</option>&nbsp;&lt;<emphasis>peer DN</emphasis>&gt;</term>
67404 <listitem>
67405 <para>
67406 When the message was received over an encrypted connection, and a certificate
67407 was received from the client, this records the Distinguished Name from that
67408 certificate.
67409 </para>
67410 </listitem></varlistentry>
67411 </variablelist>
67412 <para>
67413 Following the options there is a list of those addresses to which the message
67414 is not to be delivered. This set of addresses is initialized from the command
67415 line when the <option>-t</option> option is used and <option>extract_addresses_remove_arguments</option>
67416 is set; otherwise it starts out empty. Whenever a successful delivery is made,
67417 the address is added to this set. The addresses are kept internally as a
67418 balanced binary tree, and it is a representation of that tree which is written
67419 to the spool file. If an address is expanded via an alias or forward file, the
67420 original address is added to the tree when deliveries to all its child
67421 addresses are complete.
67422 </para>
67423 <para>
67424 If the tree is empty, there is a single line in the spool file containing just
67425 the text <quote>XX</quote>. Otherwise, each line consists of two letters, which are either
67426 Y or N, followed by an address. The address is the value for the node of the
67427 tree, and the letters indicate whether the node has a left branch and/or a
67428 right branch attached to it, respectively. If branches exist, they immediately
67429 follow. Here is an example of a three-node tree:
67430 </para>
67431 <literallayout class="monospaced">
67432 YY darcy@austen.fict.example
67433 NN alice@wonderland.fict.example
67434 NN editor@thesaurus.ref.example
67435 </literallayout>
67436 <para>
67437 After the non-recipients tree, there is a list of the message&#x2019;s recipients.
67438 This is a simple list, preceded by a count. It includes all the original
67439 recipients of the message, including those to whom the message has already been
67440 delivered. In the simplest case, the list contains one address per line. For
67441 example:
67442 </para>
67443 <literallayout class="monospaced">
67444 4
67445 editor@thesaurus.ref.example
67446 darcy@austen.fict.example
67447 rdo@foundation
67448 alice@wonderland.fict.example
67449 </literallayout>
67450 <para>
67451 However, when a child address has been added to the top-level addresses as a
67452 result of the use of the <option>one_time</option> option on a <command>redirect</command> router, each
67453 line is of the following form:
67454 </para>
67455 <literallayout>
67456 &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;
67457 </literallayout>
67458 <para>
67459 The 01 flag bit indicates the presence of the three other fields that follow
67460 the top-level address. Other bits may be used in future to support additional
67461 fields. The &lt;<emphasis>parent number</emphasis>&gt; is the offset in the recipients list of the
67462 original parent of the <quote>one time</quote> address. The first two fields are the
67463 envelope sender that is associated with this address and its length. If the
67464 length is zero, there is no special envelope sender (there are then two space
67465 characters in the line). A non-empty field can arise from a <command>redirect</command> router
67466 that has an <option>errors_to</option> setting.
67467 </para>
67468 <para>
67469 A blank line separates the envelope and status information from the headers
67470 which follow. A header may occupy several lines of the file, and to save effort
67471 when reading it in, each header is preceded by a number and an identifying
67472 character. The number is the number of characters in the header, including any
67473 embedded newlines and the terminating newline. The character is one of the
67474 following:
67475 </para>
67476 <informaltable frame="none">
67477 <tgroup cols="2" colsep="0" rowsep="0">
67478 <colspec colwidth="50pt" align="left"/>
67479 <colspec colwidth="254pt" align="left"/>
67480 <tbody>
67481 <row>
67482 <entry>&lt;<emphasis>blank</emphasis>&gt;</entry>
67483 <entry>header in which Exim has no special interest</entry>
67484 </row>
67485 <row>
67486 <entry><literal>B</literal></entry>
67487 <entry><emphasis>Bcc:</emphasis> header</entry>
67488 </row>
67489 <row>
67490 <entry><literal>C</literal></entry>
67491 <entry><emphasis>Cc:</emphasis> header</entry>
67492 </row>
67493 <row>
67494 <entry><literal>F</literal></entry>
67495 <entry><emphasis>From:</emphasis> header</entry>
67496 </row>
67497 <row>
67498 <entry><literal>I</literal></entry>
67499 <entry><emphasis>Message-id:</emphasis> header</entry>
67500 </row>
67501 <row>
67502 <entry><literal>P</literal></entry>
67503 <entry><emphasis>Received:</emphasis> header &ndash; P for <quote>postmark</quote></entry>
67504 </row>
67505 <row>
67506 <entry><literal>R</literal></entry>
67507 <entry><emphasis>Reply-To:</emphasis> header</entry>
67508 </row>
67509 <row>
67510 <entry><literal>S</literal></entry>
67511 <entry><emphasis>Sender:</emphasis> header</entry>
67512 </row>
67513 <row>
67514 <entry><literal>T</literal></entry>
67515 <entry><emphasis>To:</emphasis> header</entry>
67516 </row>
67517 <row>
67518 <entry><literal>*</literal></entry>
67519 <entry>replaced or deleted header</entry>
67520 </row>
67521 </tbody>
67522 </tgroup>
67523 </informaltable>
67524 <para>
67525 Deleted or replaced (rewritten) headers remain in the spool file for debugging
67526 purposes. They are not transmitted when the message is delivered. Here is a
67527 typical set of headers:
67528 </para>
67529 <literallayout class="monospaced">
67530 111P Received: by hobbit.fict.example with local (Exim 4.00)
67531 id 14y9EI-00026G-00; Fri, 11 May 2001 10:28:59 +0100
67532 049  Message-Id: &lt;E14y9EI-00026G-00@hobbit.fict.example&gt;
67533 038* X-rewrote-sender: bb@hobbit.fict.example
67534 042* From: Bilbo Baggins &lt;bb@hobbit.fict.example&gt;
67535 049F From: Bilbo Baggins &lt;B.Baggins@hobbit.fict.example&gt;
67536 099* To: alice@wonderland.fict.example, rdo@foundation,
67537 darcy@austen.fict.example, editor@thesaurus.ref.example
67538 104T To: alice@wonderland.fict.example, rdo@foundation.example,
67539 darcy@austen.fict.example, editor@thesaurus.ref.example
67540 038  Date: Fri, 11 May 2001 10:28:59 +0100
67541 </literallayout>
67542 <para>
67543 The asterisked headers indicate that the envelope sender, <emphasis>From:</emphasis> header, and
67544 <emphasis>To:</emphasis> header have been rewritten, the last one because routing expanded the
67545 unqualified domain <emphasis>foundation</emphasis>.
67546 <indexterm role="concept" startref="IIDforspo1" class="endofrange"/>
67547 <indexterm role="concept" startref="IIDforspo2" class="endofrange"/>
67548 <indexterm role="concept" startref="IIDforspo3" class="endofrange"/>
67549 </para>
67550 </section>
67551 </chapter>
67552
67553 <chapter id="CHAPdkim">
67554 <title>Support for DKIM (DomainKeys Identified Mail)</title>
67555 <titleabbrev>DKIM Support</titleabbrev>
67556 <para>
67557 <indexterm role="concept">
67558 <primary>DKIM</primary>
67559 </indexterm>
67560 </para>
67561 <para>
67562 DKIM is a mechanism by which messages sent by some entity can be provably
67563 linked to a domain which that entity controls.  It permits reputation to
67564 be tracked on a per-domain basis, rather than merely upon source IP address.
67565 DKIM is documented in RFC 4871.
67566 </para>
67567 <para>
67568 Since version 4.70, DKIM support is compiled into Exim by default. It can be
67569 disabled by setting DISABLE_DKIM=yes in Local/Makefile.
67570 </para>
67571 <para>
67572 Exim&#x2019;s DKIM implementation allows to
67573 </para>
67574 <orderedlist numeration="arabic">
67575 <listitem>
67576 <para>
67577 Sign outgoing messages: This function is implemented in the SMTP transport.
67578 It can co-exist with all other Exim features
67579 (including transport filters)
67580 except cutthrough delivery.
67581 </para>
67582 </listitem>
67583 <listitem>
67584 <para>
67585 Verify signatures in incoming messages: This is implemented by an additional
67586 ACL (acl_smtp_dkim), which can be called several times per message, with
67587 different signature contexts.
67588 </para>
67589 </listitem>
67590 </orderedlist>
67591 <para>
67592 In typical Exim style, the verification implementation does not include any
67593 default "policy". Instead it enables you to build your own policy using
67594 Exim&#x2019;s standard controls.
67595 </para>
67596 <para>
67597 Please note that verification of DKIM signatures in incoming mail is turned
67598 on by default for logging purposes. For each signature in incoming email,
67599 exim will log a line displaying the most important signature details, and the
67600 signature status. Here is an example (with line-breaks added for clarity):
67601 </para>
67602 <literallayout class="monospaced">
67603 2009-09-09 10:22:28 1MlIRf-0003LU-U3 DKIM:
67604     d=facebookmail.com s=q1-2009b
67605     c=relaxed/relaxed a=rsa-sha1
67606     i=@facebookmail.com t=1252484542 [verification succeeded]
67607 </literallayout>
67608 <para>
67609 You might want to turn off DKIM verification processing entirely for internal
67610 or relay mail sources. To do that, set the <option>dkim_disable_verify</option> ACL
67611 control modifier. This should typically be done in the RCPT ACL, at points
67612 where you accept mail from relay sources (internal hosts or authenticated
67613 senders).
67614 </para>
67615 <section id="SECID513">
67616 <title>Signing outgoing messages</title>
67617 <para>
67618 <indexterm role="concept">
67619 <primary>DKIM</primary>
67620 <secondary>signing</secondary>
67621 </indexterm>
67622 </para>
67623 <para>
67624 Signing is implemented by setting private options on the SMTP transport.
67625 These options take (expandable) strings as arguments.
67626 </para>
67627 <para>
67628 <indexterm role="option">
67629 <primary><option>dkim_domain</option></primary>
67630 </indexterm>
67631 </para>
67632 <informaltable frame="all">
67633 <tgroup cols="4" colsep="0" rowsep="0">
67634 <colspec colwidth="8*" align="left"/>
67635 <colspec colwidth="6*" align="center"/>
67636 <colspec colwidth="6*" align="center"/>
67637 <colspec colwidth="6*" align="right"/>
67638 <tbody>
67639 <row>
67640 <entry><option>dkim_domain</option></entry>
67641 <entry>Use: <emphasis>smtp</emphasis></entry>
67642 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
67643 <entry>Default: <emphasis>unset</emphasis></entry>
67644 </row>
67645 </tbody>
67646 </tgroup>
67647 </informaltable>
67648 <para>
67649 MANDATORY:
67650 The domain you want to sign with. The result of this expanded
67651 option is put into the <option>$dkim_domain</option> expansion variable.
67652 </para>
67653 <para>
67654 <indexterm role="option">
67655 <primary><option>dkim_selector</option></primary>
67656 </indexterm>
67657 </para>
67658 <informaltable frame="all">
67659 <tgroup cols="4" colsep="0" rowsep="0">
67660 <colspec colwidth="8*" align="left"/>
67661 <colspec colwidth="6*" align="center"/>
67662 <colspec colwidth="6*" align="center"/>
67663 <colspec colwidth="6*" align="right"/>
67664 <tbody>
67665 <row>
67666 <entry><option>dkim_selector</option></entry>
67667 <entry>Use: <emphasis>smtp</emphasis></entry>
67668 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
67669 <entry>Default: <emphasis>unset</emphasis></entry>
67670 </row>
67671 </tbody>
67672 </tgroup>
67673 </informaltable>
67674 <para>
67675 MANDATORY:
67676 This sets the key selector string. You can use the <option>$dkim_domain</option> expansion
67677 variable to look up a matching selector. The result is put in the expansion
67678 variable <option>$dkim_selector</option> which should be used in the <option>dkim_private_key</option>
67679 option along with <option>$dkim_domain</option>.
67680 </para>
67681 <para>
67682 <indexterm role="option">
67683 <primary><option>dkim_private_key</option></primary>
67684 </indexterm>
67685 </para>
67686 <informaltable frame="all">
67687 <tgroup cols="4" colsep="0" rowsep="0">
67688 <colspec colwidth="8*" align="left"/>
67689 <colspec colwidth="6*" align="center"/>
67690 <colspec colwidth="6*" align="center"/>
67691 <colspec colwidth="6*" align="right"/>
67692 <tbody>
67693 <row>
67694 <entry><option>dkim_private_key</option></entry>
67695 <entry>Use: <emphasis>smtp</emphasis></entry>
67696 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
67697 <entry>Default: <emphasis>unset</emphasis></entry>
67698 </row>
67699 </tbody>
67700 </tgroup>
67701 </informaltable>
67702 <para>
67703 MANDATORY:
67704 This sets the private key to use. You can use the <option>$dkim_domain</option> and
67705 <option>$dkim_selector</option> expansion variables to determine the private key to use.
67706 The result can either
67707 </para>
67708 <itemizedlist>
67709 <listitem>
67710 <para>
67711 be a valid RSA private key in ASCII armor, including line breaks.
67712 </para>
67713 </listitem>
67714 <listitem>
67715 <para>
67716 start with a slash, in which case it is treated as a file that contains
67717 the private key.
67718 </para>
67719 </listitem>
67720 <listitem>
67721 <para>
67722 be "0", "false" or the empty string, in which case the message will not
67723 be signed. This case will not result in an error, even if <option>dkim_strict</option>
67724 is set.
67725 </para>
67726 </listitem>
67727 </itemizedlist>
67728 <para>
67729 <indexterm role="option">
67730 <primary><option>dkim_canon</option></primary>
67731 </indexterm>
67732 </para>
67733 <informaltable frame="all">
67734 <tgroup cols="4" colsep="0" rowsep="0">
67735 <colspec colwidth="8*" align="left"/>
67736 <colspec colwidth="6*" align="center"/>
67737 <colspec colwidth="6*" align="center"/>
67738 <colspec colwidth="6*" align="right"/>
67739 <tbody>
67740 <row>
67741 <entry><option>dkim_canon</option></entry>
67742 <entry>Use: <emphasis>smtp</emphasis></entry>
67743 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
67744 <entry>Default: <emphasis>unset</emphasis></entry>
67745 </row>
67746 </tbody>
67747 </tgroup>
67748 </informaltable>
67749 <para>
67750 OPTIONAL:
67751 This option sets the canonicalization method used when signing a message.
67752 The DKIM RFC currently supports two methods: "simple" and "relaxed".
67753 The option defaults to "relaxed" when unset. Note: the current implementation
67754 only supports using the same canonicalization method for both headers and body.
67755 </para>
67756 <para>
67757 <indexterm role="option">
67758 <primary><option>dkim_strict</option></primary>
67759 </indexterm>
67760 </para>
67761 <informaltable frame="all">
67762 <tgroup cols="4" colsep="0" rowsep="0">
67763 <colspec colwidth="8*" align="left"/>
67764 <colspec colwidth="6*" align="center"/>
67765 <colspec colwidth="6*" align="center"/>
67766 <colspec colwidth="6*" align="right"/>
67767 <tbody>
67768 <row>
67769 <entry><option>dkim_strict</option></entry>
67770 <entry>Use: <emphasis>smtp</emphasis></entry>
67771 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
67772 <entry>Default: <emphasis>unset</emphasis></entry>
67773 </row>
67774 </tbody>
67775 </tgroup>
67776 </informaltable>
67777 <para>
67778 OPTIONAL:
67779 This  option  defines  how  Exim  behaves  when  signing a message that
67780 should be signed fails for some reason.  When the expansion evaluates to
67781 either "1" or "true", Exim will defer. Otherwise Exim will send the message
67782 unsigned. You can use the <option>$dkim_domain</option> and <option>$dkim_selector</option> expansion
67783 variables here.
67784 </para>
67785 <para>
67786 <indexterm role="option">
67787 <primary><option>dkim_sign_headers</option></primary>
67788 </indexterm>
67789 </para>
67790 <informaltable frame="all">
67791 <tgroup cols="4" colsep="0" rowsep="0">
67792 <colspec colwidth="8*" align="left"/>
67793 <colspec colwidth="6*" align="center"/>
67794 <colspec colwidth="6*" align="center"/>
67795 <colspec colwidth="6*" align="right"/>
67796 <tbody>
67797 <row>
67798 <entry><option>dkim_sign_headers</option></entry>
67799 <entry>Use: <emphasis>smtp</emphasis></entry>
67800 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
67801 <entry>Default: <emphasis>unset</emphasis></entry>
67802 </row>
67803 </tbody>
67804 </tgroup>
67805 </informaltable>
67806 <para>
67807 OPTIONAL:
67808 When set, this option must expand to (or be specified as) a colon-separated
67809 list of header names. Headers with these names will be included in the message
67810 signature. When unspecified, the header names recommended in RFC4871 will be
67811 used.
67812 </para>
67813 </section>
67814 <section id="SECID514">
67815 <title>Verifying DKIM signatures in incoming mail</title>
67816 <para>
67817 <indexterm role="concept">
67818 <primary>DKIM</primary>
67819 <secondary>verification</secondary>
67820 </indexterm>
67821 </para>
67822 <para>
67823 Verification of DKIM signatures in incoming email is implemented via the
67824 <option>acl_smtp_dkim</option> ACL. By default, this ACL is called once for each
67825 syntactically(!) correct signature in the incoming message.
67826 A missing ACL definition defaults to accept.
67827 If any ACL call does not accept, the message is not accepted.
67828 If a cutthrough delivery was in progress for the message it is
67829 summarily dropped (having wasted the transmission effort).
67830 </para>
67831 <para>
67832 To evaluate the signature in the ACL a large number of expansion variables
67833 containing the signature status and its details are set up during the
67834 runtime of the ACL.
67835 </para>
67836 <para>
67837 Calling the ACL only for existing signatures is not sufficient to build
67838 more advanced policies. For that reason, the global option
67839 <option>dkim_verify_signers</option>, and a global expansion variable
67840 <option>$dkim_signers</option> exist.
67841 </para>
67842 <para>
67843 The global option <option>dkim_verify_signers</option> can be set to a colon-separated
67844 list of DKIM domains or identities for which the ACL <option>acl_smtp_dkim</option> is
67845 called. It is expanded when the message has been received. At this point,
67846 the expansion variable <option>$dkim_signers</option> already contains a colon-separated
67847 list of signer domains and identities for the message. When
67848 <option>dkim_verify_signers</option> is not specified in the main configuration,
67849 it defaults as:
67850 </para>
67851 <literallayout class="monospaced">
67852 dkim_verify_signers = $dkim_signers
67853 </literallayout>
67854 <para>
67855 This leads to the default behaviour of calling <option>acl_smtp_dkim</option> for each
67856 DKIM signature in the message. Current DKIM verifiers may want to explicitly
67857 call the ACL for known domains or identities. This would be achieved as follows:
67858 </para>
67859 <literallayout class="monospaced">
67860 dkim_verify_signers = paypal.com:ebay.com:$dkim_signers
67861 </literallayout>
67862 <para>
67863 This would result in <option>acl_smtp_dkim</option> always being called for "paypal.com"
67864 and "ebay.com", plus all domains and identities that have signatures in the message.
67865 You can also be more creative in constructing your policy. For example:
67866 </para>
67867 <literallayout class="monospaced">
67868 dkim_verify_signers = $sender_address_domain:$dkim_signers
67869 </literallayout>
67870 <para>
67871 If a domain or identity is listed several times in the (expanded) value of
67872 <option>dkim_verify_signers</option>, the ACL is only called once for that domain or identity.
67873 </para>
67874 <para>
67875 Inside the <option>acl_smtp_dkim</option>, the following expansion variables are
67876 available (from most to least important):
67877 </para>
67878 <variablelist>
67879 <varlistentry>
67880 <term><option>$dkim_cur_signer</option></term>
67881 <listitem>
67882 <para>
67883 The signer that is being evaluated in this ACL run. This can be a domain or
67884 an identity. This is one of the list items from the expanded main option
67885 <option>dkim_verify_signers</option> (see above).
67886 </para>
67887 </listitem></varlistentry>
67888 <varlistentry>
67889 <term><option>$dkim_verify_status</option></term>
67890 <listitem>
67891 <para>
67892 A string describing the general status of the signature. One of
67893 </para>
67894 <itemizedlist>
67895 <listitem>
67896 <para>
67897 <option>none</option>: There is no signature in the message for the current domain or
67898 identity (as reflected by <option>$dkim_cur_signer</option>).
67899 </para>
67900 </listitem>
67901 <listitem>
67902 <para>
67903 <option>invalid</option>: The signature could not be verified due to a processing error.
67904 More detail is available in <option>$dkim_verify_reason</option>.
67905 </para>
67906 </listitem>
67907 <listitem>
67908 <para>
67909 <option>fail</option>: Verification of the signature failed.  More detail is
67910 available in <option>$dkim_verify_reason</option>.
67911 </para>
67912 </listitem>
67913 <listitem>
67914 <para>
67915 <option>pass</option>: The signature passed verification. It is valid.
67916 </para>
67917 </listitem>
67918 </itemizedlist>
67919 </listitem></varlistentry>
67920 <varlistentry>
67921 <term><option>$dkim_verify_reason</option></term>
67922 <listitem>
67923 <para>
67924 A string giving a little bit more detail when <option>$dkim_verify_status</option> is either
67925 "fail" or "invalid". One of
67926 </para>
67927 <itemizedlist>
67928 <listitem>
67929 <para>
67930 <option>pubkey_unavailable</option> (when <option>$dkim_verify_status</option>="invalid"): The public
67931 key for the domain could not be retrieved. This may be a temporary problem.
67932 </para>
67933 </listitem>
67934 <listitem>
67935 <para>
67936 <option>pubkey_syntax</option> (when <option>$dkim_verify_status</option>="invalid"): The public key
67937 record for the domain is syntactically invalid.
67938 </para>
67939 </listitem>
67940 <listitem>
67941 <para>
67942 <option>bodyhash_mismatch</option> (when <option>$dkim_verify_status</option>="fail"): The calculated
67943 body hash does not match the one specified in the signature header. This
67944 means that the message body was modified in transit.
67945 </para>
67946 </listitem>
67947 <listitem>
67948 <para>
67949 <option>signature_incorrect</option> (when <option>$dkim_verify_status</option>="fail"): The signature
67950 could not be verified. This may mean that headers were modified,
67951 re-written or otherwise changed in a way which is incompatible with
67952 DKIM verification. It may of course also mean that the signature is forged.
67953 </para>
67954 </listitem>
67955 </itemizedlist>
67956 </listitem></varlistentry>
67957 <varlistentry>
67958 <term><option>$dkim_domain</option></term>
67959 <listitem>
67960 <para>
67961 The signing domain. IMPORTANT: This variable is only populated if there is
67962 an actual signature in the message for the current domain or identity (as
67963 reflected by <option>$dkim_cur_signer</option>).
67964 </para>
67965 </listitem></varlistentry>
67966 <varlistentry>
67967 <term><option>$dkim_identity</option></term>
67968 <listitem>
67969 <para>
67970 The signing identity, if present. IMPORTANT: This variable is only populated
67971 if there is an actual signature in the message for the current domain or
67972 identity (as reflected by <option>$dkim_cur_signer</option>).
67973 </para>
67974 </listitem></varlistentry>
67975 <varlistentry>
67976 <term><option>$dkim_selector</option></term>
67977 <listitem>
67978 <para>
67979 The key record selector string.
67980 </para>
67981 </listitem></varlistentry>
67982 <varlistentry>
67983 <term><option>$dkim_algo</option></term>
67984 <listitem>
67985 <para>
67986 The algorithm used. One of &#x2019;rsa-sha1&#x2019; or &#x2019;rsa-sha256&#x2019;.
67987 </para>
67988 </listitem></varlistentry>
67989 <varlistentry>
67990 <term><option>$dkim_canon_body</option></term>
67991 <listitem>
67992 <para>
67993 The body canonicalization method. One of &#x2019;relaxed&#x2019; or &#x2019;simple&#x2019;.
67994 </para>
67995 </listitem></varlistentry>
67996 <varlistentry>
67997 <term><option>dkim_canon_headers</option></term>
67998 <listitem>
67999 <para>
68000 The header canonicalization method. One of &#x2019;relaxed&#x2019; or &#x2019;simple&#x2019;.
68001 </para>
68002 </listitem></varlistentry>
68003 <varlistentry>
68004 <term><option>$dkim_copiedheaders</option></term>
68005 <listitem>
68006 <para>
68007 A transcript of headers and their values which are included in the signature
68008 (copied from the &#x2019;z=&#x2019; tag of the signature).
68009 </para>
68010 </listitem></varlistentry>
68011 <varlistentry>
68012 <term><option>$dkim_bodylength</option></term>
68013 <listitem>
68014 <para>
68015 The number of signed body bytes. If zero ("0"), the body is unsigned. If no
68016 limit was set by the signer, "9999999999999" is returned. This makes sure
68017 that this variable always expands to an integer value.
68018 </para>
68019 </listitem></varlistentry>
68020 <varlistentry>
68021 <term><option>$dkim_created</option></term>
68022 <listitem>
68023 <para>
68024 UNIX timestamp reflecting the date and time when the signature was created.
68025 When this was not specified by the signer, "0" is returned.
68026 </para>
68027 </listitem></varlistentry>
68028 <varlistentry>
68029 <term><option>$dkim_expires</option></term>
68030 <listitem>
68031 <para>
68032 UNIX timestamp reflecting the date and time when the signer wants the
68033 signature to be treated as "expired". When this was not specified by the
68034 signer, "9999999999999" is returned. This makes it possible to do useful
68035 integer size comparisons against this value.
68036 </para>
68037 </listitem></varlistentry>
68038 <varlistentry>
68039 <term><option>$dkim_headernames</option></term>
68040 <listitem>
68041 <para>
68042 A colon-separated list of names of headers included in the signature.
68043 </para>
68044 </listitem></varlistentry>
68045 <varlistentry>
68046 <term><option>$dkim_key_testing</option></term>
68047 <listitem>
68048 <para>
68049 "1" if the key record has the "testing" flag set, "0" if not.
68050 </para>
68051 </listitem></varlistentry>
68052 <varlistentry>
68053 <term><option>$dkim_key_nosubdomains</option></term>
68054 <listitem>
68055 <para>
68056 "1" if the key record forbids subdomaining, "0" otherwise.
68057 </para>
68058 </listitem></varlistentry>
68059 <varlistentry>
68060 <term><option>$dkim_key_srvtype</option></term>
68061 <listitem>
68062 <para>
68063 Service type (tag s=) from the key record. Defaults to "*" if not specified
68064 in the key record.
68065 </para>
68066 </listitem></varlistentry>
68067 <varlistentry>
68068 <term><option>$dkim_key_granularity</option></term>
68069 <listitem>
68070 <para>
68071 Key granularity (tag g=) from the key record. Defaults to "*" if not specified
68072 in the key record.
68073 </para>
68074 </listitem></varlistentry>
68075 <varlistentry>
68076 <term><option>$dkim_key_notes</option></term>
68077 <listitem>
68078 <para>
68079 Notes from the key record (tag n=).
68080 </para>
68081 </listitem></varlistentry>
68082 </variablelist>
68083 <para>
68084 In addition, two ACL conditions are provided:
68085 </para>
68086 <variablelist>
68087 <varlistentry>
68088 <term><option>dkim_signers</option></term>
68089 <listitem>
68090 <para>
68091 ACL condition that checks a colon-separated list of domains or identities
68092 for a match against the domain or identity that the ACL is currently verifying
68093 (reflected by <option>$dkim_cur_signer</option>). This is typically used to restrict an ACL
68094 verb to a group of domains or identities. For example:
68095 </para>
68096 <literallayout class="monospaced">
68097 # Warn when Mail purportedly from GMail has no signature at all
68098 warn log_message = GMail sender without DKIM signature
68099      sender_domains = gmail.com
68100      dkim_signers = gmail.com
68101      dkim_status = none
68102 </literallayout>
68103 </listitem></varlistentry>
68104 <varlistentry>
68105 <term><option>dkim_status</option></term>
68106 <listitem>
68107 <para>
68108 ACL condition that checks a colon-separated list of possible DKIM verification
68109 results against the actual result of verification. This is typically used
68110 to restrict an ACL verb to a list of verification outcomes, for example:
68111 </para>
68112 <literallayout class="monospaced">
68113 deny message = Mail from Paypal with invalid/missing signature
68114      sender_domains = paypal.com:paypal.de
68115      dkim_signers = paypal.com:paypal.de
68116      dkim_status = none:invalid:fail
68117 </literallayout>
68118 <para>
68119 The possible status keywords are: &#x2019;none&#x2019;,&#x2019;invalid&#x2019;,&#x2019;fail&#x2019; and &#x2019;pass&#x2019;. Please
68120 see the documentation of the <option>$dkim_verify_status</option> expansion variable above
68121 for more information of what they mean.
68122 </para>
68123 </listitem></varlistentry>
68124 </variablelist>
68125 </section>
68126 </chapter>
68127
68128 <chapter id="CHID13">
68129 <title>Adding new drivers or lookup types</title>
68130 <titleabbrev>Adding drivers or lookups</titleabbrev>
68131 <para>
68132 <indexterm role="concept">
68133 <primary>adding drivers</primary>
68134 </indexterm>
68135 <indexterm role="concept">
68136 <primary>new drivers, adding</primary>
68137 </indexterm>
68138 <indexterm role="concept">
68139 <primary>drivers</primary>
68140 <secondary>adding new</secondary>
68141 </indexterm>
68142 The following actions have to be taken in order to add a new router, transport,
68143 authenticator, or lookup type to Exim:
68144 </para>
68145 <orderedlist numeration="arabic">
68146 <listitem>
68147 <para>
68148 Choose a name for the driver or lookup type that does not conflict with any
68149 existing name; I will use <quote>newdriver</quote> in what follows.
68150 </para>
68151 </listitem>
68152 <listitem>
68153 <para>
68154 Add to <filename>src/EDITME</filename> the line:
68155 </para>
68156 <literallayout>
68157 &lt;<emphasis>type</emphasis>&gt;<literal>_NEWDRIVER=yes</literal>
68158 </literallayout>
68159 <para>
68160 where &lt;<emphasis>type</emphasis>&gt; is ROUTER, TRANSPORT, AUTH, or LOOKUP. If the
68161 code is not to be included in the binary by default, comment this line out. You
68162 should also add any relevant comments about the driver or lookup type.
68163 </para>
68164 </listitem>
68165 <listitem>
68166 <para>
68167 Add to <filename>src/config.h.defaults</filename> the line:
68168 </para>
68169 <literallayout class="monospaced">
68170 #define &lt;type&gt;_NEWDRIVER
68171 </literallayout>
68172 </listitem>
68173 <listitem>
68174 <para>
68175 Edit <filename>src/drtables.c</filename>, adding conditional code to pull in the private header
68176 and create a table entry as is done for all the other drivers and lookup types.
68177 </para>
68178 </listitem>
68179 <listitem>
68180 <para>
68181 Edit <filename>scripts/lookups-Makefile</filename> if this is a new lookup; there is a for-loop
68182 near the bottom, ranging the <literal>name_mod</literal> variable over a list of all lookups.
68183 Add your <literal>NEWDRIVER</literal> to that list.
68184 As long as the dynamic module would be named <filename>newdriver.so</filename>, you can use the
68185 simple form that most lookups have.
68186 </para>
68187 </listitem>
68188 <listitem>
68189 <para>
68190 Edit <filename>Makefile</filename> in the appropriate sub-directory (<filename>src/routers</filename>,
68191 <filename>src/transports</filename>, <filename>src/auths</filename>, or <filename>src/lookups</filename>); add a line for the new
68192 driver or lookup type and add it to the definition of OBJ.
68193 </para>
68194 </listitem>
68195 <listitem>
68196 <para>
68197 Create <filename>newdriver.h</filename> and <filename>newdriver.c</filename> in the appropriate sub-directory of
68198 <filename>src</filename>.
68199 </para>
68200 </listitem>
68201 <listitem>
68202 <para>
68203 Edit <filename>scripts/MakeLinks</filename> and add commands to link the <filename>.h</filename> and <filename>.c</filename> files
68204 as for other drivers and lookups.
68205 </para>
68206 </listitem>
68207 </orderedlist>
68208 <para>
68209 Then all you need to do is write the code! A good way to start is to make a
68210 proforma by copying an existing module of the same type, globally changing all
68211 occurrences of the name, and cutting out most of the code. Note that any
68212 options you create must be listed in alphabetical order, because the tables are
68213 searched using a binary chop procedure.
68214 </para>
68215 <para>
68216 There is a <filename>README</filename> file in each of the sub-directories of <filename>src</filename> describing
68217 the interface that is expected.
68218 </para>
68219 <?sdop
68220   format="newpage"
68221   foot_right_recto="&chaptertitle;"
68222   foot_right_verso="&chaptertitle;"
68223 ?>
68224 </chapter>
68225
68226 <index role="option">
68227 <title>Options index</title>
68228 </index>
68229
68230 <index role="variable">
68231 <title>Variables index</title>
68232 </index>
68233
68234 <index role="concept">
68235 <title>Concept index</title>
68236 </index>
68237
68238 </book>