Fix build on Fedora 32
[exim-website.git] / docbook / 4.84 / 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 11 Aug 2014
17 </date>
18 <author><firstname>Exim</firstname><surname>Maintainers</surname></author>
19 <authorinitials>EM</authorinitials>
20 <revhistory><revision>
21 <revnumber>4.84</revnumber>
22 <date>11 Aug 2014</date>
23   <authorinitials>EM</authorinitials>
24 </revision></revhistory>
25 <copyright><year>
26 2014
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.84 of Exim.
206 Substantive changes from the 4.83 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.84</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>. It is not known
2689 if anyone is actually using A6 records. Exim has support for A6 records, but
2690 this is included only if you set <literal>SUPPORT_A6=YES</literal> in <filename>Local/Makefile</filename>. The
2691 support has not been tested for some time.
2692 </para>
2693 </section>
2694 <section id="SECTdynamicmodules">
2695 <title>Dynamically loaded lookup module support</title>
2696 <para>
2697 <indexterm role="concept">
2698 <primary>lookup modules</primary>
2699 </indexterm>
2700 <indexterm role="concept">
2701 <primary>dynamic modules</primary>
2702 </indexterm>
2703 <indexterm role="concept">
2704 <primary>.so building</primary>
2705 </indexterm>
2706 On some platforms, Exim supports not compiling all lookup types directly into
2707 the main binary, instead putting some into external modules which can be loaded
2708 on demand.
2709 This permits packagers to build Exim with support for lookups with extensive
2710 library dependencies without requiring all users to install all of those
2711 dependencies.
2712 Most, but not all, lookup types can be built this way.
2713 </para>
2714 <para>
2715 Set <literal>LOOKUP_MODULE_DIR</literal> to the directory into which the modules will be
2716 installed; Exim will only load modules from that directory, as a security
2717 measure.  You will need to set <literal>CFLAGS_DYNAMIC</literal> if not already defined
2718 for your OS; see <filename>OS/Makefile-Linux</filename> for an example.
2719 Some other requirements for adjusting <literal>EXTRALIBS</literal> may also be necessary,
2720 see <filename>src/EDITME</filename> for details.
2721 </para>
2722 <para>
2723 Then, for each module to be loaded dynamically, define the relevant
2724 <literal>LOOKUP_</literal>&lt;<emphasis>lookup_type</emphasis>&gt; flags to have the value "2" instead of "yes".
2725 For example, this will build in lsearch but load sqlite and mysql support
2726 on demand:
2727 </para>
2728 <literallayout class="monospaced">
2729 LOOKUP_LSEARCH=yes
2730 LOOKUP_SQLITE=2
2731 LOOKUP_MYSQL=2
2732 </literallayout>
2733 </section>
2734 <section id="SECID29">
2735 <title>The building process</title>
2736 <para>
2737 <indexterm role="concept">
2738 <primary>build directory</primary>
2739 </indexterm>
2740 Once <filename>Local/Makefile</filename> (and <filename>Local/eximon.conf</filename>, if required) have been
2741 created, run <emphasis>make</emphasis> at the top level. It determines the architecture and
2742 operating system types, and creates a build directory if one does not exist.
2743 For example, on a Sun system running Solaris 8, the directory
2744 <filename>build-SunOS5-5.8-sparc</filename> is created.
2745 <indexterm role="concept">
2746 <primary>symbolic link</primary>
2747 <secondary>to source files</secondary>
2748 </indexterm>
2749 Symbolic links to relevant source files are installed in the build directory.
2750 </para>
2751 <para>
2752 <emphasis role="bold">Warning</emphasis>: The <option>-j</option> (parallel) flag must not be used with <emphasis>make</emphasis>; the
2753 building process fails if it is set.
2754 </para>
2755 <para>
2756 If this is the first time <emphasis>make</emphasis> has been run, it calls a script that builds
2757 a make file inside the build directory, using the configuration files from the
2758 <filename>Local</filename> directory. The new make file is then passed to another instance of
2759 <emphasis>make</emphasis>. This does the real work, building a number of utility scripts, and
2760 then compiling and linking the binaries for the Exim monitor (if configured), a
2761 number of utility programs, and finally Exim itself. The command <literal>make
2762 makefile</literal> can be used to force a rebuild of the make file in the build
2763 directory, should this ever be necessary.
2764 </para>
2765 <para>
2766 If you have problems building Exim, check for any comments there may be in the
2767 <filename>README</filename> file concerning your operating system, and also take a look at the
2768 FAQ, where some common problems are covered.
2769 </para>
2770 </section>
2771 <section id="SECID283">
2772 <title>Output from <quote>make</quote></title>
2773 <para>
2774 The output produced by the <emphasis>make</emphasis> process for compile lines is often very
2775 unreadable, because these lines can be very long. For this reason, the normal
2776 output is suppressed by default, and instead output similar to that which
2777 appears when compiling the 2.6 Linux kernel is generated: just a short line for
2778 each module that is being compiled or linked. However, it is still possible to
2779 get the full output, by calling <emphasis>make</emphasis> like this:
2780 </para>
2781 <literallayout class="monospaced">
2782 FULLECHO='' make -e
2783 </literallayout>
2784 <para>
2785 The value of FULLECHO defaults to <quote>@</quote>, the flag character that suppresses
2786 command reflection in <emphasis>make</emphasis>. When you ask for the full output, it is
2787 given in addition to the short output.
2788 </para>
2789 </section>
2790 <section id="SECToverride">
2791 <title>Overriding build-time options for Exim</title>
2792 <para>
2793 <indexterm role="concept">
2794 <primary>build-time options, overriding</primary>
2795 </indexterm>
2796 The main make file that is created at the beginning of the building process
2797 consists of the concatenation of a number of files which set configuration
2798 values, followed by a fixed set of <emphasis>make</emphasis> instructions. If a value is set
2799 more than once, the last setting overrides any previous ones. This provides a
2800 convenient way of overriding defaults. The files that are concatenated are, in
2801 order:
2802 </para>
2803 <literallayout>
2804 <filename>OS/Makefile-Default</filename>
2805 <filename>OS/Makefile-</filename>&lt;<emphasis>ostype</emphasis>&gt;
2806 <filename>Local/Makefile</filename>
2807 <filename>Local/Makefile-</filename>&lt;<emphasis>ostype</emphasis>&gt;
2808 <filename>Local/Makefile-</filename>&lt;<emphasis>archtype</emphasis>&gt;
2809 <filename>Local/Makefile-</filename>&lt;<emphasis>ostype</emphasis>&gt;-&lt;<emphasis>archtype</emphasis>&gt;
2810 <filename>OS/Makefile-Base</filename>
2811 </literallayout>
2812 <para>
2813 <indexterm role="concept">
2814 <primary><filename>Local/Makefile</filename></primary>
2815 </indexterm>
2816 <indexterm role="concept">
2817 <primary>building Exim</primary>
2818 <secondary>operating system type</secondary>
2819 </indexterm>
2820 <indexterm role="concept">
2821 <primary>building Exim</primary>
2822 <secondary>architecture type</secondary>
2823 </indexterm>
2824 where &lt;<emphasis>ostype</emphasis>&gt; is the operating system type and &lt;<emphasis>archtype</emphasis>&gt; is the
2825 architecture type. <filename>Local/Makefile</filename> is required to exist, and the building
2826 process fails if it is absent. The other three <filename>Local</filename> files are optional,
2827 and are often not needed.
2828 </para>
2829 <para>
2830 The values used for &lt;<emphasis>ostype</emphasis>&gt; and &lt;<emphasis>archtype</emphasis>&gt; are obtained from scripts
2831 called <filename>scripts/os-type</filename> and <filename>scripts/arch-type</filename> respectively. If either of
2832 the environment variables EXIM_OSTYPE or EXIM_ARCHTYPE is set, their
2833 values are used, thereby providing a means of forcing particular settings.
2834 Otherwise, the scripts try to get values from the <option>uname</option> command. If this
2835 fails, the shell variables OSTYPE and ARCHTYPE are inspected. A number
2836 of <emphasis>ad hoc</emphasis> transformations are then applied, to produce the standard names
2837 that Exim expects. You can run these scripts directly from the shell in order
2838 to find out what values are being used on your system.
2839 </para>
2840 <para>
2841 <filename>OS/Makefile-Default</filename> contains comments about the variables that are set
2842 therein. Some (but not all) are mentioned below. If there is something that
2843 needs changing, review the contents of this file and the contents of the make
2844 file for your operating system (<filename>OS/Makefile-&lt;ostype&gt;</filename>) to see what the
2845 default values are.
2846 </para>
2847 <para>
2848 <indexterm role="concept">
2849 <primary>building Exim</primary>
2850 <secondary>overriding default settings</secondary>
2851 </indexterm>
2852 If you need to change any of the values that are set in <filename>OS/Makefile-Default</filename>
2853 or in <filename>OS/Makefile-&lt;ostype&gt;</filename>, or to add any new definitions, you do not
2854 need to change the original files. Instead, you should make the changes by
2855 putting the new values in an appropriate <filename>Local</filename> file. For example,
2856 <indexterm role="concept">
2857 <primary>Tru64-Unix build-time settings</primary>
2858 </indexterm>
2859 when building Exim in many releases of the Tru64-Unix (formerly Digital UNIX,
2860 formerly DEC-OSF1) operating system, it is necessary to specify that the C
2861 compiler is called <emphasis>cc</emphasis> rather than <emphasis>gcc</emphasis>. Also, the compiler must be
2862 called with the option <option>-std1</option>, to make it recognize some of the features of
2863 Standard C that Exim uses. (Most other compilers recognize Standard C by
2864 default.) To do this, you should create a file called <filename>Local/Makefile-OSF1</filename>
2865 containing the lines
2866 </para>
2867 <literallayout class="monospaced">
2868 CC=cc
2869 CFLAGS=-std1
2870 </literallayout>
2871 <para>
2872 If you are compiling for just one operating system, it may be easier to put
2873 these lines directly into <filename>Local/Makefile</filename>.
2874 </para>
2875 <para>
2876 Keeping all your local configuration settings separate from the distributed
2877 files makes it easy to transfer them to new versions of Exim simply by copying
2878 the contents of the <filename>Local</filename> directory.
2879 </para>
2880 <para>
2881 <indexterm role="concept">
2882 <primary>NIS lookup type</primary>
2883 <secondary>including support for</secondary>
2884 </indexterm>
2885 <indexterm role="concept">
2886 <primary>NIS+ lookup type</primary>
2887 <secondary>including support for</secondary>
2888 </indexterm>
2889 <indexterm role="concept">
2890 <primary>LDAP</primary>
2891 <secondary>including support for</secondary>
2892 </indexterm>
2893 <indexterm role="concept">
2894 <primary>lookup</primary>
2895 <secondary>inclusion in binary</secondary>
2896 </indexterm>
2897 Exim contains support for doing LDAP, NIS, NIS+, and other kinds of file
2898 lookup, but not all systems have these components installed, so the default is
2899 not to include the relevant code in the binary. All the different kinds of file
2900 and database lookup that Exim supports are implemented as separate code modules
2901 which are included only if the relevant compile-time options are set. In the
2902 case of LDAP, NIS, and NIS+, the settings for <filename>Local/Makefile</filename> are:
2903 </para>
2904 <literallayout class="monospaced">
2905 LOOKUP_LDAP=yes
2906 LOOKUP_NIS=yes
2907 LOOKUP_NISPLUS=yes
2908 </literallayout>
2909 <para>
2910 and similar settings apply to the other lookup types. They are all listed in
2911 <filename>src/EDITME</filename>. In many cases the relevant include files and interface
2912 libraries need to be installed before compiling Exim.
2913 <indexterm role="concept">
2914 <primary>cdb</primary>
2915 <secondary>including support for</secondary>
2916 </indexterm>
2917 However, there are some optional lookup types (such as cdb) for which
2918 the code is entirely contained within Exim, and no external include
2919 files or libraries are required. When a lookup type is not included in the
2920 binary, attempts to configure Exim to use it cause run time configuration
2921 errors.
2922 </para>
2923 <para>
2924 <indexterm role="concept">
2925 <primary>pkg-config</primary>
2926 <secondary>lookups</secondary>
2927 </indexterm>
2928 <indexterm role="concept">
2929 <primary>pkg-config</primary>
2930 <secondary>authenticators</secondary>
2931 </indexterm>
2932 Many systems now use a tool called <emphasis>pkg-config</emphasis> to encapsulate information
2933 about how to compile against a library; Exim has some initial support for
2934 being able to use pkg-config for lookups and authenticators.  For any given
2935 makefile variable which starts <literal>LOOKUP_</literal> or <literal>AUTH_</literal>, you can add a new
2936 variable with the <literal>_PC</literal> suffix in the name and assign as the value the
2937 name of the package to be queried.  The results of querying via the
2938 <emphasis>pkg-config</emphasis> command will be added to the appropriate Makefile variables
2939 with <literal>+=</literal> directives, so your version of <emphasis>make</emphasis> will need to support that
2940 syntax.  For instance:
2941 </para>
2942 <literallayout class="monospaced">
2943 LOOKUP_SQLITE=yes
2944 LOOKUP_SQLITE_PC=sqlite3
2945 AUTH_GSASL=yes
2946 AUTH_GSASL_PC=libgsasl
2947 AUTH_HEIMDAL_GSSAPI=yes
2948 AUTH_HEIMDAL_GSSAPI_PC=heimdal-gssapi
2949 </literallayout>
2950 <para>
2951 <indexterm role="concept">
2952 <primary>Perl</primary>
2953 <secondary>including support for</secondary>
2954 </indexterm>
2955 Exim can be linked with an embedded Perl interpreter, allowing Perl
2956 subroutines to be called during string expansion. To enable this facility,
2957 </para>
2958 <literallayout class="monospaced">
2959 EXIM_PERL=perl.o
2960 </literallayout>
2961 <para>
2962 must be defined in <filename>Local/Makefile</filename>. Details of this facility are given in
2963 chapter <xref linkend="CHAPperl"/>.
2964 </para>
2965 <para>
2966 <indexterm role="concept">
2967 <primary>X11 libraries, location of</primary>
2968 </indexterm>
2969 The location of the X11 libraries is something that varies a lot between
2970 operating systems, and there may be different versions of X11 to cope
2971 with. Exim itself makes no use of X11, but if you are compiling the Exim
2972 monitor, the X11 libraries must be available.
2973 The following three variables are set in <filename>OS/Makefile-Default</filename>:
2974 </para>
2975 <literallayout class="monospaced">
2976 X11=/usr/X11R6
2977 XINCLUDE=-I$(X11)/include
2978 XLFLAGS=-L$(X11)/lib
2979 </literallayout>
2980 <para>
2981 These are overridden in some of the operating-system configuration files. For
2982 example, in <filename>OS/Makefile-SunOS5</filename> there is
2983 </para>
2984 <literallayout class="monospaced">
2985 X11=/usr/openwin
2986 XINCLUDE=-I$(X11)/include
2987 XLFLAGS=-L$(X11)/lib -R$(X11)/lib
2988 </literallayout>
2989 <para>
2990 If you need to override the default setting for your operating system, place a
2991 definition of all three of these variables into your
2992 <filename>Local/Makefile-&lt;ostype&gt;</filename> file.
2993 </para>
2994 <para>
2995 <indexterm role="concept">
2996 <primary>EXTRALIBS</primary>
2997 </indexterm>
2998 If you need to add any extra libraries to the link steps, these can be put in a
2999 variable called EXTRALIBS, which appears in all the link commands, but by
3000 default is not defined. In contrast, EXTRALIBS_EXIM is used only on the
3001 command for linking the main Exim binary, and not for any associated utilities.
3002 </para>
3003 <para>
3004 <indexterm role="concept">
3005 <primary>DBM libraries</primary>
3006 <secondary>configuration for building</secondary>
3007 </indexterm>
3008 There is also DBMLIB, which appears in the link commands for binaries that
3009 use DBM functions (see also section <xref linkend="SECTdb"/>). Finally, there is
3010 EXTRALIBS_EXIMON, which appears only in the link step for the Exim monitor
3011 binary, and which can be used, for example, to include additional X11
3012 libraries.
3013 </para>
3014 <para>
3015 <indexterm role="concept">
3016 <primary>configuration file</primary>
3017 <secondary>editing</secondary>
3018 </indexterm>
3019 The make file copes with rebuilding Exim correctly if any of the configuration
3020 files are edited. However, if an optional configuration file is deleted, it is
3021 necessary to touch the associated non-optional file (that is,
3022 <filename>Local/Makefile</filename> or <filename>Local/eximon.conf</filename>) before rebuilding.
3023 </para>
3024 </section>
3025 <section id="SECID30">
3026 <title>OS-specific header files</title>
3027 <para>
3028 <indexterm role="concept">
3029 <primary><filename>os.h</filename></primary>
3030 </indexterm>
3031 <indexterm role="concept">
3032 <primary>building Exim</primary>
3033 <secondary>OS-specific C header files</secondary>
3034 </indexterm>
3035 The <filename>OS</filename> directory contains a number of files with names of the form
3036 <filename>os.h-&lt;ostype&gt;</filename>. These are system-specific C header files that should not
3037 normally need to be changed. There is a list of macro settings that are
3038 recognized in the file <filename>OS/os.configuring</filename>, which should be consulted if you
3039 are porting Exim to a new operating system.
3040 </para>
3041 </section>
3042 <section id="SECID31">
3043 <title>Overriding build-time options for the monitor</title>
3044 <para>
3045 <indexterm role="concept">
3046 <primary>building Eximon</primary>
3047 </indexterm>
3048 A similar process is used for overriding things when building the Exim monitor,
3049 where the files that are involved are
3050 </para>
3051 <literallayout>
3052 <filename>OS/eximon.conf-Default</filename>
3053 <filename>OS/eximon.conf-</filename>&lt;<emphasis>ostype</emphasis>&gt;
3054 <filename>Local/eximon.conf</filename>
3055 <filename>Local/eximon.conf-</filename>&lt;<emphasis>ostype</emphasis>&gt;
3056 <filename>Local/eximon.conf-</filename>&lt;<emphasis>archtype</emphasis>&gt;
3057 <filename>Local/eximon.conf-</filename>&lt;<emphasis>ostype</emphasis>&gt;-&lt;<emphasis>archtype</emphasis>&gt;
3058 </literallayout>
3059 <para>
3060 <indexterm role="concept">
3061 <primary><filename>Local/eximon.conf</filename></primary>
3062 </indexterm>
3063 As with Exim itself, the final three files need not exist, and in this case the
3064 <filename>OS/eximon.conf-&lt;ostype&gt;</filename> file is also optional. The default values in
3065 <filename>OS/eximon.conf-Default</filename> can be overridden dynamically by setting environment
3066 variables of the same name, preceded by EXIMON_. For example, setting
3067 EXIMON_LOG_DEPTH in the environment overrides the value of
3068 LOG_DEPTH at run time.
3069 <indexterm role="concept" startref="IIDbuex" class="endofrange"/>
3070 </para>
3071 </section>
3072 <section id="SECID32">
3073 <title>Installing Exim binaries and scripts</title>
3074 <para>
3075 <indexterm role="concept">
3076 <primary>installing Exim</primary>
3077 </indexterm>
3078 <indexterm role="concept">
3079 <primary>BIN_DIRECTORY</primary>
3080 </indexterm>
3081 The command <literal>make install</literal> runs the <command>exim_install</command> script with no
3082 arguments. The script copies binaries and utility scripts into the directory
3083 whose name is specified by the BIN_DIRECTORY setting in <filename>Local/Makefile</filename>.
3084 <indexterm role="concept">
3085 <primary>setuid</primary>
3086 <secondary>installing Exim with</secondary>
3087 </indexterm>
3088 The install script copies files only if they are newer than the files they are
3089 going to replace. The Exim binary is required to be owned by root and have the
3090 <emphasis>setuid</emphasis> bit set, for normal configurations. Therefore, you must run <literal>make
3091 install</literal> as root so that it can set up the Exim binary in this way. However, in
3092 some special situations (for example, if a host is doing no local deliveries)
3093 it may be possible to run Exim without making the binary setuid root (see
3094 chapter <xref linkend="CHAPsecurity"/> for details).
3095 </para>
3096 <para>
3097 <indexterm role="concept">
3098 <primary>CONFIGURE_FILE</primary>
3099 </indexterm>
3100 Exim&#x2019;s run time configuration file is named by the CONFIGURE_FILE setting
3101 in <filename>Local/Makefile</filename>. If this names a single file, and the file does not
3102 exist, the default configuration file <filename>src/configure.default</filename> is copied there
3103 by the installation script. If a run time configuration file already exists, it
3104 is left alone. If CONFIGURE_FILE is a colon-separated list, naming several
3105 alternative files, no default is installed.
3106 </para>
3107 <para>
3108 <indexterm role="concept">
3109 <primary>system aliases file</primary>
3110 </indexterm>
3111 <indexterm role="concept">
3112 <primary><filename>/etc/aliases</filename></primary>
3113 </indexterm>
3114 One change is made to the default configuration file when it is installed: the
3115 default configuration contains a router that references a system aliases file.
3116 The path to this file is set to the value specified by
3117 SYSTEM_ALIASES_FILE in <filename>Local/Makefile</filename> (<filename>/etc/aliases</filename> by default).
3118 If the system aliases file does not exist, the installation script creates it,
3119 and outputs a comment to the user.
3120 </para>
3121 <para>
3122 The created file contains no aliases, but it does contain comments about the
3123 aliases a site should normally have. Mail aliases have traditionally been
3124 kept in <filename>/etc/aliases</filename>. However, some operating systems are now using
3125 <filename>/etc/mail/aliases</filename>. You should check if yours is one of these, and change
3126 Exim&#x2019;s configuration if necessary.
3127 </para>
3128 <para>
3129 The default configuration uses the local host&#x2019;s name as the only local domain,
3130 and is set up to do local deliveries into the shared directory <filename>/var/mail</filename>,
3131 running as the local user. System aliases and <filename>.forward</filename> files in users&#x2019; home
3132 directories are supported, but no NIS or NIS+ support is configured. Domains
3133 other than the name of the local host are routed using the DNS, with delivery
3134 over SMTP.
3135 </para>
3136 <para>
3137 It is possible to install Exim for special purposes (such as building a binary
3138 distribution) in a private part of the file system. You can do this by a
3139 command such as
3140 </para>
3141 <literallayout class="monospaced">
3142 make DESTDIR=/some/directory/ install
3143 </literallayout>
3144 <para>
3145 This has the effect of pre-pending the specified directory to all the file
3146 paths, except the name of the system aliases file that appears in the default
3147 configuration. (If a default alias file is created, its name <emphasis>is</emphasis> modified.)
3148 For backwards compatibility, ROOT is used if DESTDIR is not set,
3149 but this usage is deprecated.
3150 </para>
3151 <para>
3152 <indexterm role="concept">
3153 <primary>installing Exim</primary>
3154 <secondary>what is not installed</secondary>
3155 </indexterm>
3156 Running <emphasis>make install</emphasis> does not copy the Exim 4 conversion script
3157 <emphasis>convert4r4</emphasis>. You will probably run this only once if you are
3158 upgrading from Exim 3. None of the documentation files in the <filename>doc</filename>
3159 directory are copied, except for the info files when you have set
3160 INFO_DIRECTORY, as described in section <xref linkend="SECTinsinfdoc"/> below.
3161 </para>
3162 <para>
3163 For the utility programs, old versions are renamed by adding the suffix <filename>.O</filename>
3164 to their names. The Exim binary itself, however, is handled differently. It is
3165 installed under a name that includes the version number and the compile number,
3166 for example <filename>exim-4.84-1</filename>. The script then arranges for a symbolic link
3167 called <filename>exim</filename> to point to the binary. If you are updating a previous version
3168 of Exim, the script takes care to ensure that the name <filename>exim</filename> is never absent
3169 from the directory (as seen by other processes).
3170 </para>
3171 <para>
3172 <indexterm role="concept">
3173 <primary>installing Exim</primary>
3174 <secondary>testing the script</secondary>
3175 </indexterm>
3176 If you want to see what the <emphasis>make install</emphasis> will do before running it for
3177 real, you can pass the <option>-n</option> option to the installation script by this
3178 command:
3179 </para>
3180 <literallayout class="monospaced">
3181 make INSTALL_ARG=-n install
3182 </literallayout>
3183 <para>
3184 The contents of the variable INSTALL_ARG are passed to the installation
3185 script. You do not need to be root to run this test. Alternatively, you can run
3186 the installation script directly, but this must be from within the build
3187 directory. For example, from the top-level Exim directory you could use this
3188 command:
3189 </para>
3190 <literallayout class="monospaced">
3191 (cd build-SunOS5-5.5.1-sparc; ../scripts/exim_install -n)
3192 </literallayout>
3193 <para>
3194 <indexterm role="concept">
3195 <primary>installing Exim</primary>
3196 <secondary>install script options</secondary>
3197 </indexterm>
3198 There are two other options that can be supplied to the installation script.
3199 </para>
3200 <itemizedlist>
3201 <listitem>
3202 <para>
3203 <option>-no_chown</option> bypasses the call to change the owner of the installed binary
3204 to root, and the call to make it a setuid binary.
3205 </para>
3206 </listitem>
3207 <listitem>
3208 <para>
3209 <option>-no_symlink</option> bypasses the setting up of the symbolic link <filename>exim</filename> to the
3210 installed binary.
3211 </para>
3212 </listitem>
3213 </itemizedlist>
3214 <para>
3215 INSTALL_ARG can be used to pass these options to the script. For example:
3216 </para>
3217 <literallayout class="monospaced">
3218 make INSTALL_ARG=-no_symlink install
3219 </literallayout>
3220 <para>
3221 The installation script can also be given arguments specifying which files are
3222 to be copied. For example, to install just the Exim binary, and nothing else,
3223 without creating the symbolic link, you could use:
3224 </para>
3225 <literallayout class="monospaced">
3226 make INSTALL_ARG='-no_symlink exim' install
3227 </literallayout>
3228 </section>
3229 <section id="SECTinsinfdoc">
3230 <title>Installing info documentation</title>
3231 <para>
3232 <indexterm role="concept">
3233 <primary>installing Exim</primary>
3234 <secondary><emphasis>info</emphasis> documentation</secondary>
3235 </indexterm>
3236 Not all systems use the GNU <emphasis>info</emphasis> system for documentation, and for this
3237 reason, the Texinfo source of Exim&#x2019;s documentation is not included in the main
3238 distribution. Instead it is available separately from the ftp site (see section
3239 <xref linkend="SECTavail"/>).
3240 </para>
3241 <para>
3242 If you have defined INFO_DIRECTORY in <filename>Local/Makefile</filename> and the Texinfo
3243 source of the documentation is found in the source tree, running <literal>make
3244 install</literal> automatically builds the info files and installs them.
3245 </para>
3246 </section>
3247 <section id="SECID33">
3248 <title>Setting up the spool directory</title>
3249 <para>
3250 <indexterm role="concept">
3251 <primary>spool directory</primary>
3252 <secondary>creating</secondary>
3253 </indexterm>
3254 When it starts up, Exim tries to create its spool directory if it does not
3255 exist. The Exim uid and gid are used for the owner and group of the spool
3256 directory. Sub-directories are automatically created in the spool directory as
3257 necessary.
3258 </para>
3259 </section>
3260 <section id="SECID34">
3261 <title>Testing</title>
3262 <para>
3263 <indexterm role="concept">
3264 <primary>testing</primary>
3265 <secondary>installation</secondary>
3266 </indexterm>
3267 Having installed Exim, you can check that the run time configuration file is
3268 syntactically valid by running the following command, which assumes that the
3269 Exim binary directory is within your PATH environment variable:
3270 </para>
3271 <literallayout class="monospaced">
3272 exim -bV
3273 </literallayout>
3274 <para>
3275 If there are any errors in the configuration file, Exim outputs error messages.
3276 Otherwise it outputs the version number and build date,
3277 the DBM library that is being used, and information about which drivers and
3278 other optional code modules are included in the binary.
3279 Some simple routing tests can be done by using the address testing option. For
3280 example,
3281 </para>
3282 <literallayout>
3283 <literal>exim -bt</literal> &lt;<emphasis>local username</emphasis>&gt;
3284 </literallayout>
3285 <para>
3286 should verify that it recognizes a local mailbox, and
3287 </para>
3288 <literallayout>
3289 <literal>exim -bt</literal> &lt;<emphasis>remote address</emphasis>&gt;
3290 </literallayout>
3291 <para>
3292 a remote one. Then try getting it to deliver mail, both locally and remotely.
3293 This can be done by passing messages directly to Exim, without going through a
3294 user agent. For example:
3295 </para>
3296 <literallayout class="monospaced">
3297 exim -v postmaster@your.domain.example
3298 From: user@your.domain.example
3299 To: postmaster@your.domain.example
3300 Subject: Testing Exim
3301
3302 This is a test message.
3303 ^D
3304 </literallayout>
3305 <para>
3306 The <option>-v</option> option causes Exim to output some verification of what it is doing.
3307 In this case you should see copies of three log lines, one for the message&#x2019;s
3308 arrival, one for its delivery, and one containing <quote>Completed</quote>.
3309 </para>
3310 <para>
3311 <indexterm role="concept">
3312 <primary>delivery</primary>
3313 <secondary>problems with</secondary>
3314 </indexterm>
3315 If you encounter problems, look at Exim&#x2019;s log files (<emphasis>mainlog</emphasis> and
3316 <emphasis>paniclog</emphasis>) to see if there is any relevant information there. Another source
3317 of information is running Exim with debugging turned on, by specifying the
3318 <option>-d</option> option. If a message is stuck on Exim&#x2019;s spool, you can force a delivery
3319 with debugging turned on by a command of the form
3320 </para>
3321 <literallayout>
3322 <literal>exim -d -M</literal> &lt;<emphasis>exim-message-id</emphasis>&gt;
3323 </literallayout>
3324 <para>
3325 You must be root or an <quote>admin user</quote> in order to do this. The <option>-d</option> option
3326 produces rather a lot of output, but you can cut this down to specific areas.
3327 For example, if you use <option>-d-all+route</option> only the debugging information
3328 relevant to routing is included. (See the <option>-d</option> option in chapter
3329 <xref linkend="CHAPcommandline"/> for more details.)
3330 </para>
3331 <para>
3332 <indexterm role="concept">
3333 <primary><quote>sticky</quote> bit</primary>
3334 </indexterm>
3335 <indexterm role="concept">
3336 <primary>lock files</primary>
3337 </indexterm>
3338 One specific problem that has shown up on some sites is the inability to do
3339 local deliveries into a shared mailbox directory, because it does not have the
3340 <quote>sticky bit</quote> set on it. By default, Exim tries to create a lock file before
3341 writing to a mailbox file, and if it cannot create the lock file, the delivery
3342 is deferred. You can get round this either by setting the <quote>sticky bit</quote> on the
3343 directory, or by setting a specific group for local deliveries and allowing
3344 that group to create files in the directory (see the comments above the
3345 <command>local_delivery</command> transport in the default configuration file). Another
3346 approach is to configure Exim not to use lock files, but just to rely on
3347 <function>fcntl()</function> locking instead. However, you should do this only if all user
3348 agents also use <function>fcntl()</function> locking. For further discussion of locking issues,
3349 see chapter <xref linkend="CHAPappendfile"/>.
3350 </para>
3351 <para>
3352 One thing that cannot be tested on a system that is already running an MTA is
3353 the receipt of incoming SMTP mail on the standard SMTP port. However, the
3354 <option>-oX</option> option can be used to run an Exim daemon that listens on some other
3355 port, or <emphasis>inetd</emphasis> can be used to do this. The <option>-bh</option> option and the
3356 <emphasis>exim_checkaccess</emphasis> utility can be used to check out policy controls on
3357 incoming SMTP mail.
3358 </para>
3359 <para>
3360 Testing a new version on a system that is already running Exim can most easily
3361 be done by building a binary with a different CONFIGURE_FILE setting. From
3362 within the run time configuration, all other file and directory names
3363 that Exim uses can be altered, in order to keep it entirely clear of the
3364 production version.
3365 </para>
3366 </section>
3367 <section id="SECID35">
3368 <title>Replacing another MTA with Exim</title>
3369 <para>
3370 <indexterm role="concept">
3371 <primary>replacing another MTA</primary>
3372 </indexterm>
3373 Building and installing Exim for the first time does not of itself put it in
3374 general use. The name by which the system&#x2019;s MTA is called by mail user agents
3375 is either <filename>/usr/sbin/sendmail</filename>, or <filename>/usr/lib/sendmail</filename> (depending on the
3376 operating system), and it is necessary to make this name point to the <emphasis>exim</emphasis>
3377 binary in order to get the user agents to pass messages to Exim. This is
3378 normally done by renaming any existing file and making <filename>/usr/sbin/sendmail</filename>
3379 or <filename>/usr/lib/sendmail</filename>
3380 <indexterm role="concept">
3381 <primary>symbolic link</primary>
3382 <secondary>to <emphasis>exim</emphasis> binary</secondary>
3383 </indexterm>
3384 a symbolic link to the <emphasis>exim</emphasis> binary. It is a good idea to remove any setuid
3385 privilege and executable status from the old MTA. It is then necessary to stop
3386 and restart the mailer daemon, if one is running.
3387 </para>
3388 <para>
3389 <indexterm role="concept">
3390 <primary>FreeBSD, MTA indirection</primary>
3391 </indexterm>
3392 <indexterm role="concept">
3393 <primary><filename>/etc/mail/mailer.conf</filename></primary>
3394 </indexterm>
3395 Some operating systems have introduced alternative ways of switching MTAs. For
3396 example, if you are running FreeBSD, you need to edit the file
3397 <filename>/etc/mail/mailer.conf</filename> instead of setting up a symbolic link as just
3398 described. A typical example of the contents of this file for running Exim is
3399 as follows:
3400 </para>
3401 <literallayout class="monospaced">
3402 sendmail            /usr/exim/bin/exim
3403 send-mail           /usr/exim/bin/exim
3404 mailq               /usr/exim/bin/exim -bp
3405 newaliases          /usr/bin/true
3406 </literallayout>
3407 <para>
3408 Once you have set up the symbolic link, or edited <filename>/etc/mail/mailer.conf</filename>,
3409 your Exim installation is <quote>live</quote>. Check it by sending a message from your
3410 favourite user agent.
3411 </para>
3412 <para>
3413 You should consider what to tell your users about the change of MTA. Exim may
3414 have different capabilities to what was previously running, and there are
3415 various operational differences such as the text of messages produced by
3416 command line options and in bounce messages. If you allow your users to make
3417 use of Exim&#x2019;s filtering capabilities, you should make the document entitled
3418 <emphasis>Exim&#x2019;s interface to mail filtering</emphasis> available to them.
3419 </para>
3420 </section>
3421 <section id="SECID36">
3422 <title>Upgrading Exim</title>
3423 <para>
3424 <indexterm role="concept">
3425 <primary>upgrading Exim</primary>
3426 </indexterm>
3427 If you are already running Exim on your host, building and installing a new
3428 version automatically makes it available to MUAs, or any other programs that
3429 call the MTA directly. However, if you are running an Exim daemon, you do need
3430 to send it a HUP signal, to make it re-execute itself, and thereby pick up the
3431 new binary. You do not need to stop processing mail in order to install a new
3432 version of Exim. The install script does not modify an existing runtime
3433 configuration file.
3434 </para>
3435 </section>
3436 <section id="SECID37">
3437 <title>Stopping the Exim daemon on Solaris</title>
3438 <para>
3439 <indexterm role="concept">
3440 <primary>Solaris</primary>
3441 <secondary>stopping Exim on</secondary>
3442 </indexterm>
3443 The standard command for stopping the mailer daemon on Solaris is
3444 </para>
3445 <literallayout class="monospaced">
3446 /etc/init.d/sendmail stop
3447 </literallayout>
3448 <para>
3449 If <filename>/usr/lib/sendmail</filename> has been turned into a symbolic link, this script
3450 fails to stop Exim because it uses the command <emphasis>ps -e</emphasis> and greps the output
3451 for the text <quote>sendmail</quote>; this is not present because the actual program name
3452 (that is, <quote>exim</quote>) is given by the <emphasis>ps</emphasis> command with these options. A
3453 solution is to replace the line that finds the process id with something like
3454 </para>
3455 <literallayout class="monospaced">
3456 pid=`cat /var/spool/exim/exim-daemon.pid`
3457 </literallayout>
3458 <para>
3459 to obtain the daemon&#x2019;s pid directly from the file that Exim saves it in.
3460 </para>
3461 <para>
3462 Note, however, that stopping the daemon does not <quote>stop Exim</quote>. Messages can
3463 still be received from local processes, and if automatic delivery is configured
3464 (the normal case), deliveries will still occur.
3465 </para>
3466 </section>
3467 </chapter>
3468
3469 <chapter id="CHAPcommandline">
3470 <title>The Exim command line</title>
3471 <para>
3472 <indexterm role="concept" id="IIDclo1" class="startofrange">
3473 <primary>command line</primary>
3474 <secondary>options</secondary>
3475 </indexterm>
3476 <indexterm role="concept" id="IIDclo2" class="startofrange">
3477 <primary>options</primary>
3478 <secondary>command line</secondary>
3479 </indexterm>
3480 Exim&#x2019;s command line takes the standard Unix form of a sequence of options,
3481 each starting with a hyphen character, followed by a number of arguments. The
3482 options are compatible with the main options of Sendmail, and there are also
3483 some additional options, some of which are compatible with Smail 3. Certain
3484 combinations of options do not make sense, and provoke an error if used.
3485 The form of the arguments depends on which options are set.
3486 </para>
3487 <section id="SECID38">
3488 <title>Setting options by program name</title>
3489 <para>
3490 <indexterm role="concept">
3491 <primary><emphasis>mailq</emphasis></primary>
3492 </indexterm>
3493 If Exim is called under the name <emphasis>mailq</emphasis>, it behaves as if the option <option>-bp</option>
3494 were present before any other options.
3495 The <option>-bp</option> option requests a listing of the contents of the mail queue on the
3496 standard output.
3497 This feature is for compatibility with some systems that contain a command of
3498 that name in one of the standard libraries, symbolically linked to
3499 <filename>/usr/sbin/sendmail</filename> or <filename>/usr/lib/sendmail</filename>.
3500 </para>
3501 <para>
3502 <indexterm role="concept">
3503 <primary><emphasis>rsmtp</emphasis></primary>
3504 </indexterm>
3505 If Exim is called under the name <emphasis>rsmtp</emphasis> it behaves as if the option <option>-bS</option>
3506 were present before any other options, for compatibility with Smail. The
3507 <option>-bS</option> option is used for reading in a number of messages in batched SMTP
3508 format.
3509 </para>
3510 <para>
3511 <indexterm role="concept">
3512 <primary><emphasis>rmail</emphasis></primary>
3513 </indexterm>
3514 If Exim is called under the name <emphasis>rmail</emphasis> it behaves as if the <option>-i</option> and
3515 <option>-oee</option> options were present before any other options, for compatibility with
3516 Smail. The name <emphasis>rmail</emphasis> is used as an interface by some UUCP systems.
3517 </para>
3518 <para>
3519 <indexterm role="concept">
3520 <primary><emphasis>runq</emphasis></primary>
3521 </indexterm>
3522 <indexterm role="concept">
3523 <primary>queue runner</primary>
3524 </indexterm>
3525 If Exim is called under the name <emphasis>runq</emphasis> it behaves as if the option <option>-q</option>
3526 were present before any other options, for compatibility with Smail. The <option>-q</option>
3527 option causes a single queue runner process to be started.
3528 </para>
3529 <para>
3530 <indexterm role="concept">
3531 <primary><emphasis>newaliases</emphasis></primary>
3532 </indexterm>
3533 <indexterm role="concept">
3534 <primary>alias file</primary>
3535 <secondary>building</secondary>
3536 </indexterm>
3537 <indexterm role="concept">
3538 <primary>Sendmail compatibility</primary>
3539 <secondary>calling Exim as <emphasis>newaliases</emphasis></secondary>
3540 </indexterm>
3541 If Exim is called under the name <emphasis>newaliases</emphasis> it behaves as if the option
3542 <option>-bi</option> were present before any other options, for compatibility with Sendmail.
3543 This option is used for rebuilding Sendmail&#x2019;s alias file. Exim does not have
3544 the concept of a single alias file, but can be configured to run a given
3545 command if called with the <option>-bi</option> option.
3546 </para>
3547 </section>
3548 <section id="SECTtrustedadmin">
3549 <title>Trusted and admin users</title>
3550 <para>
3551 Some Exim options are available only to <emphasis>trusted users</emphasis> and others are
3552 available only to <emphasis>admin users</emphasis>. In the description below, the phrases <quote>Exim
3553 user</quote> and <quote>Exim group</quote> mean the user and group defined by EXIM_USER and
3554 EXIM_GROUP in <filename>Local/Makefile</filename> or set by the <option>exim_user</option> and
3555 <option>exim_group</option> options. These do not necessarily have to use the name <quote>exim</quote>.
3556 </para>
3557 <itemizedlist>
3558 <listitem>
3559 <para>
3560 <indexterm role="concept">
3561 <primary>trusted users</primary>
3562 <secondary>definition of</secondary>
3563 </indexterm>
3564 <indexterm role="concept">
3565 <primary>user</primary>
3566 <secondary>trusted definition of</secondary>
3567 </indexterm>
3568 The trusted users are root, the Exim user, any user listed in the
3569 <option>trusted_users</option> configuration option, and any user whose current group or any
3570 supplementary group is one of those listed in the <option>trusted_groups</option>
3571 configuration option. Note that the Exim group is not automatically trusted.
3572 </para>
3573 <para>
3574 <indexterm role="concept">
3575 <primary><quote>From</quote> line</primary>
3576 </indexterm>
3577 <indexterm role="concept">
3578 <primary>envelope sender</primary>
3579 </indexterm>
3580 Trusted users are always permitted to use the <option>-f</option> option or a leading
3581 <quote>From&nbsp;</quote> line to specify the envelope sender of a message that is passed to
3582 Exim through the local interface (see the <option>-bm</option> and <option>-f</option> options below).
3583 See the <option>untrusted_set_sender</option> option for a way of permitting non-trusted
3584 users to set envelope senders.
3585 </para>
3586 <para>
3587 <indexterm role="concept">
3588 <primary><emphasis>From:</emphasis> header line</primary>
3589 </indexterm>
3590 <indexterm role="concept">
3591 <primary><emphasis>Sender:</emphasis> header line</primary>
3592 </indexterm>
3593 For a trusted user, there is never any check on the contents of the <emphasis>From:</emphasis>
3594 header line, and a <emphasis>Sender:</emphasis> line is never added. Furthermore, any existing
3595 <emphasis>Sender:</emphasis> line in incoming local (non-TCP/IP) messages is not removed.
3596 </para>
3597 <para>
3598 Trusted users may also specify a host name, host address, interface address,
3599 protocol name, ident value, and authentication data when submitting a message
3600 locally. Thus, they are able to insert messages into Exim&#x2019;s queue locally that
3601 have the characteristics of messages received from a remote host. Untrusted
3602 users may in some circumstances use <option>-f</option>, but can never set the other values
3603 that are available to trusted users.
3604 </para>
3605 </listitem>
3606 <listitem>
3607 <para>
3608 <indexterm role="concept">
3609 <primary>user</primary>
3610 <secondary>admin definition of</secondary>
3611 </indexterm>
3612 <indexterm role="concept">
3613 <primary>admin user</primary>
3614 <secondary>definition of</secondary>
3615 </indexterm>
3616 The admin users are root, the Exim user, and any user that is a member of the
3617 Exim group or of any group listed in the <option>admin_groups</option> configuration option.
3618 The current group does not have to be one of these groups.
3619 </para>
3620 <para>
3621 Admin users are permitted to list the queue, and to carry out certain
3622 operations on messages, for example, to force delivery failures. It is also
3623 necessary to be an admin user in order to see the full information provided by
3624 the Exim monitor, and full debugging output.
3625 </para>
3626 <para>
3627 By default, the use of the <option>-M</option>, <option>-q</option>, <option>-R</option>, and <option>-S</option> options to cause
3628 Exim to attempt delivery of messages on its queue is restricted to admin users.
3629 However, this restriction can be relaxed by setting the <option>prod_requires_admin</option>
3630 option false (that is, specifying <option>no_prod_requires_admin</option>).
3631 </para>
3632 <para>
3633 Similarly, the use of the <option>-bp</option> option to list all the messages in the queue
3634 is restricted to admin users unless <option>queue_list_requires_admin</option> is set
3635 false.
3636 </para>
3637 </listitem>
3638 </itemizedlist>
3639 <para>
3640 <emphasis role="bold">Warning</emphasis>: If you configure your system so that admin users are able to
3641 edit Exim&#x2019;s configuration file, you are giving those users an easy way of
3642 getting root. There is further discussion of this issue at the start of chapter
3643 <xref linkend="CHAPconf"/>.
3644 </para>
3645 </section>
3646 <section id="SECID39">
3647 <title>Command line options</title>
3648 <para>
3649 Exim&#x2019;s command line options are described in alphabetical order below. If none
3650 of the options that specifies a specific action (such as starting the daemon or
3651 a queue runner, or testing an address, or receiving a message in a specific
3652 format, or listing the queue) are present, and there is at least one argument
3653 on the command line, <option>-bm</option> (accept a local message on the standard input,
3654 with the arguments specifying the recipients) is assumed. Otherwise, Exim
3655 outputs a brief message about itself and exits.
3656 </para>
3657 <!-- === Start of command line options === -->
3658 <variablelist>
3659 <varlistentry>
3660 <term><option>--</option></term>
3661 <listitem>
3662 <para>
3663 <indexterm role="option">
3664 <primary>--</primary>
3665 </indexterm>
3666 <indexterm role="concept">
3667 <primary>options</primary>
3668 <secondary>command line; terminating</secondary>
3669 </indexterm>
3670 This is a pseudo-option whose only purpose is to terminate the options and
3671 therefore to cause subsequent command line items to be treated as arguments
3672 rather than options, even if they begin with hyphens.
3673 </para>
3674 </listitem></varlistentry>
3675 <varlistentry>
3676 <term><option>--help</option></term>
3677 <listitem>
3678 <para>
3679 <indexterm role="option">
3680 <primary><option>--help</option></primary>
3681 </indexterm>
3682 This option causes Exim to output a few sentences stating what it is.
3683 The same output is generated if the Exim binary is called with no options and
3684 no arguments.
3685 </para>
3686 </listitem></varlistentry>
3687 <varlistentry>
3688 <term><option>--version</option></term>
3689 <listitem>
3690 <para>
3691 <indexterm role="option">
3692 <primary><option>--version</option></primary>
3693 </indexterm>
3694 This option is an alias for <option>-bV</option> and causes version information to be
3695 displayed.
3696 </para>
3697 </listitem></varlistentry>
3698 <varlistentry>
3699 <term><option>-Ac</option></term>
3700 <term><option>-Am</option></term>
3701 <listitem>
3702 <para>
3703 <indexterm role="option">
3704 <primary><option>-Ac</option></primary>
3705 </indexterm>
3706 <indexterm role="option">
3707 <primary><option>-Am</option></primary>
3708 </indexterm>
3709 These options are used by Sendmail for selecting configuration files and are
3710 ignored by Exim.
3711 </para>
3712 </listitem></varlistentry>
3713 <varlistentry>
3714 <term><option>-B</option>&lt;<emphasis>type</emphasis>&gt;</term>
3715 <listitem>
3716 <para>
3717 <indexterm role="option">
3718 <primary><option>-B</option></primary>
3719 </indexterm>
3720 <indexterm role="concept">
3721 <primary>8-bit characters</primary>
3722 </indexterm>
3723 <indexterm role="concept">
3724 <primary>Sendmail compatibility</primary>
3725 <secondary>8-bit characters</secondary>
3726 </indexterm>
3727 This is a Sendmail option for selecting 7 or 8 bit processing. Exim is 8-bit
3728 clean; it ignores this option.
3729 </para>
3730 </listitem></varlistentry>
3731 <varlistentry>
3732 <term><option>-bd</option></term>
3733 <listitem>
3734 <para>
3735 <indexterm role="option">
3736 <primary><option>-bd</option></primary>
3737 </indexterm>
3738 <indexterm role="concept">
3739 <primary>daemon</primary>
3740 </indexterm>
3741 <indexterm role="concept">
3742 <primary>SMTP</primary>
3743 <secondary>listener</secondary>
3744 </indexterm>
3745 <indexterm role="concept">
3746 <primary>queue runner</primary>
3747 </indexterm>
3748 This option runs Exim as a daemon, awaiting incoming SMTP connections. Usually
3749 the <option>-bd</option> option is combined with the <option>-q</option>&lt;<emphasis>time</emphasis>&gt; option, to specify
3750 that the daemon should also initiate periodic queue runs.
3751 </para>
3752 <para>
3753 The <option>-bd</option> option can be used only by an admin user. If either of the <option>-d</option>
3754 (debugging) or <option>-v</option> (verifying) options are set, the daemon does not
3755 disconnect from the controlling terminal. When running this way, it can be
3756 stopped by pressing ctrl-C.
3757 </para>
3758 <para>
3759 By default, Exim listens for incoming connections to the standard SMTP port on
3760 all the host&#x2019;s running interfaces. However, it is possible to listen on other
3761 ports, on multiple ports, and only on specific interfaces. Chapter
3762 <xref linkend="CHAPinterfaces"/> contains a description of the options that control this.
3763 </para>
3764 <para>
3765 When a listening daemon
3766 <indexterm role="concept">
3767 <primary>daemon</primary>
3768 <secondary>process id (pid)</secondary>
3769 </indexterm>
3770 <indexterm role="concept">
3771 <primary>pid (process id)</primary>
3772 <secondary>of daemon</secondary>
3773 </indexterm>
3774 is started without the use of <option>-oX</option> (that is, without overriding the normal
3775 configuration), it writes its process id to a file called <filename>exim-daemon.pid</filename>
3776 in Exim&#x2019;s spool directory. This location can be overridden by setting
3777 PID_FILE_PATH in <filename>Local/Makefile</filename>. The file is written while Exim is still
3778 running as root.
3779 </para>
3780 <para>
3781 When <option>-oX</option> is used on the command line to start a listening daemon, the
3782 process id is not written to the normal pid file path. However, <option>-oP</option> can be
3783 used to specify a path on the command line if a pid file is required.
3784 </para>
3785 <para>
3786 The SIGHUP signal
3787 <indexterm role="concept">
3788 <primary>SIGHUP</primary>
3789 </indexterm>
3790 <indexterm role="concept">
3791 <primary>daemon</primary>
3792 <secondary>restarting</secondary>
3793 </indexterm>
3794 can be used to cause the daemon to re-execute itself. This should be done
3795 whenever Exim&#x2019;s configuration file, or any file that is incorporated into it by
3796 means of the <option>.include</option> facility, is changed, and also whenever a new version
3797 of Exim is installed. It is not necessary to do this when other files that are
3798 referenced from the configuration (for example, alias files) are changed,
3799 because these are reread each time they are used.
3800 </para>
3801 </listitem></varlistentry>
3802 <varlistentry>
3803 <term><option>-bdf</option></term>
3804 <listitem>
3805 <para>
3806 <indexterm role="option">
3807 <primary><option>-bdf</option></primary>
3808 </indexterm>
3809 This option has the same effect as <option>-bd</option> except that it never disconnects
3810 from the controlling terminal, even when no debugging is specified.
3811 </para>
3812 </listitem></varlistentry>
3813 <varlistentry>
3814 <term><option>-be</option></term>
3815 <listitem>
3816 <para>
3817 <indexterm role="option">
3818 <primary><option>-be</option></primary>
3819 </indexterm>
3820 <indexterm role="concept">
3821 <primary>testing</primary>
3822 <secondary>string expansion</secondary>
3823 </indexterm>
3824 <indexterm role="concept">
3825 <primary>expansion</primary>
3826 <secondary>testing</secondary>
3827 </indexterm>
3828 Run Exim in expansion testing mode. Exim discards its root privilege, to
3829 prevent ordinary users from using this mode to read otherwise inaccessible
3830 files. If no arguments are given, Exim runs interactively, prompting for lines
3831 of data. Otherwise, it processes each argument in turn.
3832 </para>
3833 <para>
3834 If Exim was built with USE_READLINE=yes in <filename>Local/Makefile</filename>, it tries
3835 to load the <option>libreadline</option> library dynamically whenever the <option>-be</option> option is
3836 used without command line arguments. If successful, it uses the <function>readline()</function>
3837 function, which provides extensive line-editing facilities, for reading the
3838 test data. A line history is supported.
3839 </para>
3840 <para>
3841 Long expansion expressions can be split over several lines by using backslash
3842 continuations. As in Exim&#x2019;s run time configuration, white space at the start of
3843 continuation lines is ignored. Each argument or data line is passed through the
3844 string expansion mechanism, and the result is output. Variable values from the
3845 configuration file (for example, <varname>$qualify_domain</varname>) are available, but no
3846 message-specific values (such as <varname>$sender_domain</varname>) are set, because no message
3847 is being processed (but see <option>-bem</option> and <option>-Mset</option>).
3848 </para>
3849 <para>
3850 <emphasis role="bold">Note</emphasis>: If you use this mechanism to test lookups, and you change the data
3851 files or databases you are using, you must exit and restart Exim before trying
3852 the same lookup again. Otherwise, because each Exim process caches the results
3853 of lookups, you will just get the same result as before.
3854 </para>
3855 </listitem></varlistentry>
3856 <varlistentry>
3857 <term><option>-bem</option>&nbsp;&lt;<emphasis>filename</emphasis>&gt;</term>
3858 <listitem>
3859 <para>
3860 <indexterm role="option">
3861 <primary><option>-bem</option></primary>
3862 </indexterm>
3863 <indexterm role="concept">
3864 <primary>testing</primary>
3865 <secondary>string expansion</secondary>
3866 </indexterm>
3867 <indexterm role="concept">
3868 <primary>expansion</primary>
3869 <secondary>testing</secondary>
3870 </indexterm>
3871 This option operates like <option>-be</option> except that it must be followed by the name
3872 of a file. For example:
3873 </para>
3874 <literallayout class="monospaced">
3875 exim -bem /tmp/testmessage
3876 </literallayout>
3877 <para>
3878 The file is read as a message (as if receiving a locally-submitted non-SMTP
3879 message) before any of the test expansions are done. Thus, message-specific
3880 variables such as <varname>$message_size</varname> and <varname>$header_from:</varname> are available. However,
3881 no <emphasis>Received:</emphasis> header is added to the message. If the <option>-t</option> option is set,
3882 recipients are read from the headers in the normal way, and are shown in the
3883 <varname>$recipients</varname> variable. Note that recipients cannot be given on the command
3884 line, because further arguments are taken as strings to expand (just like
3885 <option>-be</option>).
3886 </para>
3887 </listitem></varlistentry>
3888 <varlistentry>
3889 <term><option>-bF</option>&nbsp;&lt;<emphasis>filename</emphasis>&gt;</term>
3890 <listitem>
3891 <para>
3892 <indexterm role="option">
3893 <primary><option>-bF</option></primary>
3894 </indexterm>
3895 <indexterm role="concept">
3896 <primary>system filter</primary>
3897 <secondary>testing</secondary>
3898 </indexterm>
3899 <indexterm role="concept">
3900 <primary>testing</primary>
3901 <secondary>system filter</secondary>
3902 </indexterm>
3903 This option is the same as <option>-bf</option> except that it assumes that the filter being
3904 tested is a system filter. The additional commands that are available only in
3905 system filters are recognized.
3906 </para>
3907 </listitem></varlistentry>
3908 <varlistentry>
3909 <term><option>-bf</option>&nbsp;&lt;<emphasis>filename</emphasis>&gt;</term>
3910 <listitem>
3911 <para>
3912 <indexterm role="option">
3913 <primary><option>-bf</option></primary>
3914 </indexterm>
3915 <indexterm role="concept">
3916 <primary>filter</primary>
3917 <secondary>testing</secondary>
3918 </indexterm>
3919 <indexterm role="concept">
3920 <primary>testing</primary>
3921 <secondary>filter file</secondary>
3922 </indexterm>
3923 <indexterm role="concept">
3924 <primary>forward file</primary>
3925 <secondary>testing</secondary>
3926 </indexterm>
3927 <indexterm role="concept">
3928 <primary>testing</primary>
3929 <secondary>forward file</secondary>
3930 </indexterm>
3931 <indexterm role="concept">
3932 <primary>Sieve filter</primary>
3933 <secondary>testing</secondary>
3934 </indexterm>
3935 This option runs Exim in user filter testing mode; the file is the filter file
3936 to be tested, and a test message must be supplied on the standard input. If
3937 there are no message-dependent tests in the filter, an empty file can be
3938 supplied.
3939 </para>
3940 <para>
3941 If you want to test a system filter file, use <option>-bF</option> instead of <option>-bf</option>. You
3942 can use both <option>-bF</option> and <option>-bf</option> on the same command, in order to test a system
3943 filter and a user filter in the same run. For example:
3944 </para>
3945 <literallayout class="monospaced">
3946 exim -bF /system/filter -bf /user/filter &lt;/test/message
3947 </literallayout>
3948 <para>
3949 This is helpful when the system filter adds header lines or sets filter
3950 variables that are used by the user filter.
3951 </para>
3952 <para>
3953 If the test filter file does not begin with one of the special lines
3954 </para>
3955 <literallayout class="monospaced">
3956 # Exim filter
3957 # Sieve filter
3958 </literallayout>
3959 <para>
3960 it is taken to be a normal <filename>.forward</filename> file, and is tested for validity under
3961 that interpretation. See sections <xref linkend="SECTitenonfilred"/> to
3962 <xref linkend="SECTspecitredli"/> for a description of the possible contents of non-filter
3963 redirection lists.
3964 </para>
3965 <para>
3966 The result of an Exim command that uses <option>-bf</option>, provided no errors are
3967 detected, is a list of the actions that Exim would try to take if presented
3968 with the message for real. More details of filter testing are given in the
3969 separate document entitled <emphasis>Exim&#x2019;s interfaces to mail filtering</emphasis>.
3970 </para>
3971 <para>
3972 When testing a filter file,
3973 <indexterm role="concept">
3974 <primary><quote>From</quote> line</primary>
3975 </indexterm>
3976 <indexterm role="concept">
3977 <primary>envelope sender</primary>
3978 </indexterm>
3979 <indexterm role="option">
3980 <primary><option>-f</option></primary>
3981 <secondary>for filter testing</secondary>
3982 </indexterm>
3983 the envelope sender can be set by the <option>-f</option> option,
3984 or by a <quote>From&nbsp;</quote> line at the start of the test message. Various parameters
3985 that would normally be taken from the envelope recipient address of the message
3986 can be set by means of additional command line options (see the next four
3987 options).
3988 </para>
3989 </listitem></varlistentry>
3990 <varlistentry>
3991 <term><option>-bfd</option>&nbsp;&lt;<emphasis>domain</emphasis>&gt;</term>
3992 <listitem>
3993 <para>
3994 <indexterm role="option">
3995 <primary><option>-bfd</option></primary>
3996 </indexterm>
3997 <indexterm role="variable">
3998 <primary><varname>$qualify_domain</varname></primary>
3999 </indexterm>
4000 This sets the domain of the recipient address when a filter file is being
4001 tested by means of the <option>-bf</option> option. The default is the value of
4002 <varname>$qualify_domain</varname>.
4003 </para>
4004 </listitem></varlistentry>
4005 <varlistentry>
4006 <term><option>-bfl</option>&nbsp;&lt;<emphasis>local&nbsp;part</emphasis>&gt;</term>
4007 <listitem>
4008 <para>
4009 <indexterm role="option">
4010 <primary><option>-bfl</option></primary>
4011 </indexterm>
4012 This sets the local part of the recipient address when a filter file is being
4013 tested by means of the <option>-bf</option> option. The default is the username of the
4014 process that calls Exim. A local part should be specified with any prefix or
4015 suffix stripped, because that is how it appears to the filter when a message is
4016 actually being delivered.
4017 </para>
4018 </listitem></varlistentry>
4019 <varlistentry>
4020 <term><option>-bfp</option>&nbsp;&lt;<emphasis>prefix</emphasis>&gt;</term>
4021 <listitem>
4022 <para>
4023 <indexterm role="option">
4024 <primary><option>-bfp</option></primary>
4025 </indexterm>
4026 This sets the prefix of the local part of the recipient address when a filter
4027 file is being tested by means of the <option>-bf</option> option. The default is an empty
4028 prefix.
4029 </para>
4030 </listitem></varlistentry>
4031 <varlistentry>
4032 <term><option>-bfs</option>&nbsp;&lt;<emphasis>suffix</emphasis>&gt;</term>
4033 <listitem>
4034 <para>
4035 <indexterm role="option">
4036 <primary><option>-bfs</option></primary>
4037 </indexterm>
4038 This sets the suffix of the local part of the recipient address when a filter
4039 file is being tested by means of the <option>-bf</option> option. The default is an empty
4040 suffix.
4041 </para>
4042 </listitem></varlistentry>
4043 <varlistentry>
4044 <term><option>-bh</option>&nbsp;&lt;<emphasis>IP&nbsp;address</emphasis>&gt;</term>
4045 <listitem>
4046 <para>
4047 <indexterm role="option">
4048 <primary><option>-bh</option></primary>
4049 </indexterm>
4050 <indexterm role="concept">
4051 <primary>testing</primary>
4052 <secondary>incoming SMTP</secondary>
4053 </indexterm>
4054 <indexterm role="concept">
4055 <primary>SMTP</primary>
4056 <secondary>testing incoming</secondary>
4057 </indexterm>
4058 <indexterm role="concept">
4059 <primary>testing</primary>
4060 <secondary>relay control</secondary>
4061 </indexterm>
4062 <indexterm role="concept">
4063 <primary>relaying</primary>
4064 <secondary>testing configuration</secondary>
4065 </indexterm>
4066 <indexterm role="concept">
4067 <primary>policy control</primary>
4068 <secondary>testing</secondary>
4069 </indexterm>
4070 <indexterm role="concept">
4071 <primary>debugging</primary>
4072 <secondary><option>-bh</option> option</secondary>
4073 </indexterm>
4074 This option runs a fake SMTP session as if from the given IP address, using the
4075 standard input and output. The IP address may include a port number at the end,
4076 after a full stop. For example:
4077 </para>
4078 <literallayout class="monospaced">
4079 exim -bh 10.9.8.7.1234
4080 exim -bh fe80::a00:20ff:fe86:a061.5678
4081 </literallayout>
4082 <para>
4083 When an IPv6 address is given, it is converted into canonical form. In the case
4084 of the second example above, the value of <varname>$sender_host_address</varname> after
4085 conversion to the canonical form is
4086 <literal>fe80:0000:0000:0a00:20ff:fe86:a061.5678</literal>.
4087 </para>
4088 <para>
4089 Comments as to what is going on are written to the standard error file. These
4090 include lines beginning with <quote>LOG</quote> for anything that would have been logged.
4091 This facility is provided for testing configuration options for incoming
4092 messages, to make sure they implement the required policy. For example, you can
4093 test your relay controls using <option>-bh</option>.
4094 </para>
4095 <para>
4096 <emphasis role="bold">Warning 1</emphasis>:
4097 <indexterm role="concept">
4098 <primary>RFC 1413</primary>
4099 </indexterm>
4100 You can test features of the configuration that rely on ident (RFC 1413)
4101 information by using the <option>-oMt</option> option. However, Exim cannot actually perform
4102 an ident callout when testing using <option>-bh</option> because there is no incoming SMTP
4103 connection.
4104 </para>
4105 <para>
4106 <emphasis role="bold">Warning 2</emphasis>: Address verification callouts (see section <xref linkend="SECTcallver"/>)
4107 are also skipped when testing using <option>-bh</option>. If you want these callouts to
4108 occur, use <option>-bhc</option> instead.
4109 </para>
4110 <para>
4111 Messages supplied during the testing session are discarded, and nothing is
4112 written to any of the real log files. There may be pauses when DNS (and other)
4113 lookups are taking place, and of course these may time out. The <option>-oMi</option> option
4114 can be used to specify a specific IP interface and port if this is important,
4115 and <option>-oMaa</option> and <option>-oMai</option> can be used to set parameters as if the SMTP
4116 session were authenticated.
4117 </para>
4118 <para>
4119 The <emphasis>exim_checkaccess</emphasis> utility is a <quote>packaged</quote> version of <option>-bh</option> whose
4120 output just states whether a given recipient address from a given host is
4121 acceptable or not. See section <xref linkend="SECTcheckaccess"/>.
4122 </para>
4123 <para>
4124 Features such as authentication and encryption, where the client input is not
4125 plain text, cannot easily be tested with <option>-bh</option>. Instead, you should use a
4126 specialized SMTP test program such as
4127 <emphasis role="bold"><ulink url="http://jetmore.org/john/code/#swaks">swaks</ulink></emphasis>.
4128 </para>
4129 </listitem></varlistentry>
4130 <varlistentry>
4131 <term><option>-bhc</option>&nbsp;&lt;<emphasis>IP&nbsp;address</emphasis>&gt;</term>
4132 <listitem>
4133 <para>
4134 <indexterm role="option">
4135 <primary><option>-bhc</option></primary>
4136 </indexterm>
4137 This option operates in the same way as <option>-bh</option>, except that address
4138 verification callouts are performed if required. This includes consulting and
4139 updating the callout cache database.
4140 </para>
4141 </listitem></varlistentry>
4142 <varlistentry>
4143 <term><option>-bi</option></term>
4144 <listitem>
4145 <para>
4146 <indexterm role="option">
4147 <primary><option>-bi</option></primary>
4148 </indexterm>
4149 <indexterm role="concept">
4150 <primary>alias file</primary>
4151 <secondary>building</secondary>
4152 </indexterm>
4153 <indexterm role="concept">
4154 <primary>building alias file</primary>
4155 </indexterm>
4156 <indexterm role="concept">
4157 <primary>Sendmail compatibility</primary>
4158 <secondary><option>-bi</option> option</secondary>
4159 </indexterm>
4160 Sendmail interprets the <option>-bi</option> option as a request to rebuild its alias file.
4161 Exim does not have the concept of a single alias file, and so it cannot mimic
4162 this behaviour. However, calls to <filename>/usr/lib/sendmail</filename> with the <option>-bi</option> option
4163 tend to appear in various scripts such as NIS make files, so the option must be
4164 recognized.
4165 </para>
4166 <para>
4167 If <option>-bi</option> is encountered, the command specified by the <option>bi_command</option>
4168 configuration option is run, under the uid and gid of the caller of Exim. If
4169 the <option>-oA</option> option is used, its value is passed to the command as an argument.
4170 The command set by <option>bi_command</option> may not contain arguments. The command can
4171 use the <emphasis>exim_dbmbuild</emphasis> utility, or some other means, to rebuild alias files
4172 if this is required. If the <option>bi_command</option> option is not set, calling Exim with
4173 <option>-bi</option> is a no-op.
4174 </para>
4175 </listitem></varlistentry>
4176 <varlistentry>
4177 <term><option>-bI:help</option></term>
4178 <listitem>
4179 <para>
4180 <indexterm role="option">
4181 <primary><option>-bI:help</option></primary>
4182 </indexterm>
4183 <indexterm role="concept">
4184 <primary>querying exim information</primary>
4185 </indexterm>
4186 We shall provide various options starting <literal>-bI:</literal> for querying Exim for
4187 information.  The output of many of these will be intended for machine
4188 consumption.  This one is not.  The <option>-bI:help</option> option asks Exim for a
4189 synopsis of supported options beginning <literal>-bI:</literal>.  Use of any of these
4190 options shall cause Exim to exit after producing the requested output.
4191 </para>
4192 </listitem></varlistentry>
4193 <varlistentry>
4194 <term><option>-bI:dscp</option></term>
4195 <listitem>
4196 <para>
4197 <indexterm role="option">
4198 <primary><option>-bI:dscp</option></primary>
4199 </indexterm>
4200 <indexterm role="concept">
4201 <primary>DSCP</primary>
4202 <secondary>values</secondary>
4203 </indexterm>
4204 This option causes Exim to emit an alphabetically sorted list of all
4205 recognised DSCP names.
4206 </para>
4207 </listitem></varlistentry>
4208 <varlistentry>
4209 <term><option>-bI:sieve</option></term>
4210 <listitem>
4211 <para>
4212 <indexterm role="option">
4213 <primary><option>-bI:sieve</option></primary>
4214 </indexterm>
4215 <indexterm role="concept">
4216 <primary>Sieve filter</primary>
4217 <secondary>capabilities</secondary>
4218 </indexterm>
4219 This option causes Exim to emit an alphabetically sorted list of all supported
4220 Sieve protocol extensions on stdout, one per line.  This is anticipated to be
4221 useful for ManageSieve (RFC 5804) implementations, in providing that protocol&#x2019;s
4222 <literal>SIEVE</literal> capability response line.  As the precise list may depend upon
4223 compile-time build options, which this option will adapt to, this is the only
4224 way to guarantee a correct response.
4225 </para>
4226 </listitem></varlistentry>
4227 <varlistentry>
4228 <term><option>-bm</option></term>
4229 <listitem>
4230 <para>
4231 <indexterm role="option">
4232 <primary><option>-bm</option></primary>
4233 </indexterm>
4234 <indexterm role="concept">
4235 <primary>local message reception</primary>
4236 </indexterm>
4237 This option runs an Exim receiving process that accepts an incoming,
4238 locally-generated message on the standard input. The recipients are given as the
4239 command arguments (except when <option>-t</option> is also present &ndash; see below). Each
4240 argument can be a comma-separated list of RFC 2822 addresses. This is the
4241 default option for selecting the overall action of an Exim call; it is assumed
4242 if no other conflicting option is present.
4243 </para>
4244 <para>
4245 If any addresses in the message are unqualified (have no domain), they are
4246 qualified by the values of the <option>qualify_domain</option> or <option>qualify_recipient</option>
4247 options, as appropriate. The <option>-bnq</option> option (see below) provides a way of
4248 suppressing this for special cases.
4249 </para>
4250 <para>
4251 Policy checks on the contents of local messages can be enforced by means of
4252 the non-SMTP ACL. See chapter <xref linkend="CHAPACL"/> for details.
4253 </para>
4254 <para>
4255 <indexterm role="concept">
4256 <primary>return code</primary>
4257 <secondary>for <option>-bm</option></secondary>
4258 </indexterm>
4259 The return code is zero if the message is successfully accepted. Otherwise, the
4260 action is controlled by the <option>-oe</option><emphasis>x</emphasis> option setting &ndash; see below.
4261 </para>
4262 <para>
4263 The format
4264 <indexterm role="concept">
4265 <primary>message</primary>
4266 <secondary>format</secondary>
4267 </indexterm>
4268 <indexterm role="concept">
4269 <primary>format</primary>
4270 <secondary>message</secondary>
4271 </indexterm>
4272 <indexterm role="concept">
4273 <primary><quote>From</quote> line</primary>
4274 </indexterm>
4275 <indexterm role="concept">
4276 <primary>UUCP</primary>
4277 <secondary><quote>From</quote> line</secondary>
4278 </indexterm>
4279 <indexterm role="concept">
4280 <primary>Sendmail compatibility</primary>
4281 <secondary><quote>From</quote> line</secondary>
4282 </indexterm>
4283 of the message must be as defined in RFC 2822, except that, for
4284 compatibility with Sendmail and Smail, a line in one of the forms
4285 </para>
4286 <literallayout class="monospaced">
4287 From sender Fri Jan  5 12:55 GMT 1997
4288 From sender Fri, 5 Jan 97 12:55:01
4289 </literallayout>
4290 <para>
4291 (with the weekday optional, and possibly with additional text after the date)
4292 is permitted to appear at the start of the message. There appears to be no
4293 authoritative specification of the format of this line. Exim recognizes it by
4294 matching against the regular expression defined by the <option>uucp_from_pattern</option>
4295 option, which can be changed if necessary.
4296 </para>
4297 <para>
4298 <indexterm role="option">
4299 <primary><option>-f</option></primary>
4300 <secondary>overriding <quote>From</quote> line</secondary>
4301 </indexterm>
4302 The specified sender is treated as if it were given as the argument to the
4303 <option>-f</option> option, but if a <option>-f</option> option is also present, its argument is used in
4304 preference to the address taken from the message. The caller of Exim must be a
4305 trusted user for the sender of a message to be set in this way.
4306 </para>
4307 </listitem></varlistentry>
4308 <varlistentry>
4309 <term><option>-bmalware</option>&nbsp;&lt;<emphasis>filename</emphasis>&gt;</term>
4310 <listitem>
4311 <para>
4312 <indexterm role="option">
4313 <primary><option>-bmalware</option></primary>
4314 </indexterm>
4315 <indexterm role="concept">
4316 <primary>testing</primary>
4317 <secondary>,</secondary>
4318 </indexterm>
4319 <indexterm role="concept">
4320 <primary>malware scan test</primary>
4321 </indexterm>
4322 This debugging option causes Exim to scan the given file,
4323 using the malware scanning framework.  The option of <option>av_scanner</option> influences
4324 this option, so if <option>av_scanner</option>&#x2019;s value is dependent upon an expansion then
4325 the expansion should have defaults which apply to this invocation.  ACLs are
4326 not invoked, so if <option>av_scanner</option> references an ACL variable then that variable
4327 will never be populated and <option>-bmalware</option> will fail.
4328 </para>
4329 <para>
4330 Exim will have changed working directory before resolving the filename, so
4331 using fully qualified pathnames is advisable.  Exim will be running as the Exim
4332 user when it tries to open the file, rather than as the invoking user.
4333 This option requires admin privileges.
4334 </para>
4335 <para>
4336 The <option>-bmalware</option> option will not be extended to be more generally useful,
4337 there are better tools for file-scanning.  This option exists to help
4338 administrators verify their Exim and AV scanner configuration.
4339 </para>
4340 </listitem></varlistentry>
4341 <varlistentry>
4342 <term><option>-bnq</option></term>
4343 <listitem>
4344 <para>
4345 <indexterm role="option">
4346 <primary><option>-bnq</option></primary>
4347 </indexterm>
4348 <indexterm role="concept">
4349 <primary>address qualification, suppressing</primary>
4350 </indexterm>
4351 By default, Exim automatically qualifies unqualified addresses (those
4352 without domains) that appear in messages that are submitted locally (that
4353 is, not over TCP/IP). This qualification applies both to addresses in
4354 envelopes, and addresses in header lines. Sender addresses are qualified using
4355 <option>qualify_domain</option>, and recipient addresses using <option>qualify_recipient</option> (which
4356 defaults to the value of <option>qualify_domain</option>).
4357 </para>
4358 <para>
4359 Sometimes, qualification is not wanted. For example, if <option>-bS</option> (batch SMTP) is
4360 being used to re-submit messages that originally came from remote hosts after
4361 content scanning, you probably do not want to qualify unqualified addresses in
4362 header lines. (Such lines will be present only if you have not enabled a header
4363 syntax check in the appropriate ACL.)
4364 </para>
4365 <para>
4366 The <option>-bnq</option> option suppresses all qualification of unqualified addresses in
4367 messages that originate on the local host. When this is used, unqualified
4368 addresses in the envelope provoke errors (causing message rejection) and
4369 unqualified addresses in header lines are left alone.
4370 </para>
4371 </listitem></varlistentry>
4372 <varlistentry>
4373 <term><option>-bP</option></term>
4374 <listitem>
4375 <para>
4376 <indexterm role="option">
4377 <primary><option>-bP</option></primary>
4378 </indexterm>
4379 <indexterm role="concept">
4380 <primary>configuration options</primary>
4381 <secondary>extracting</secondary>
4382 </indexterm>
4383 <indexterm role="concept">
4384 <primary>options</primary>
4385 <secondary>configuration &ndash; extracting</secondary>
4386 </indexterm>
4387 If this option is given with no arguments, it causes the values of all Exim&#x2019;s
4388 main configuration options to be written to the standard output. The values
4389 of one or more specific options can be requested by giving their names as
4390 arguments, for example:
4391 </para>
4392 <literallayout class="monospaced">
4393 exim -bP qualify_domain hold_domains
4394 </literallayout>
4395 <para>
4396 <indexterm role="concept">
4397 <primary>hiding configuration option values</primary>
4398 </indexterm>
4399 <indexterm role="concept">
4400 <primary>configuration options</primary>
4401 <secondary>hiding value of</secondary>
4402 </indexterm>
4403 <indexterm role="concept">
4404 <primary>options</primary>
4405 <secondary>hiding value of</secondary>
4406 </indexterm>
4407 However, any option setting that is preceded by the word <quote>hide</quote> in the
4408 configuration file is not shown in full, except to an admin user. For other
4409 users, the output is as in this example:
4410 </para>
4411 <literallayout class="monospaced">
4412 mysql_servers = &lt;value not displayable&gt;
4413 </literallayout>
4414 <para>
4415 If <option>configure_file</option> is given as an argument, the name of the run time
4416 configuration file is output.
4417 If a list of configuration files was supplied, the value that is output here
4418 is the name of the file that was actually used.
4419 </para>
4420 <para>
4421 <indexterm role="concept">
4422 <primary>options</primary>
4423 <secondary>hiding name of</secondary>
4424 </indexterm>
4425 If the <option>-n</option> flag is given, then for most modes of <option>-bP</option> operation the
4426 name will not be output.
4427 </para>
4428 <para>
4429 <indexterm role="concept">
4430 <primary>daemon</primary>
4431 <secondary>process id (pid)</secondary>
4432 </indexterm>
4433 <indexterm role="concept">
4434 <primary>pid (process id)</primary>
4435 <secondary>of daemon</secondary>
4436 </indexterm>
4437 If <option>log_file_path</option> or <option>pid_file_path</option> are given, the names of the
4438 directories where log files and daemon pid files are written are output,
4439 respectively. If these values are unset, log files are written in a
4440 sub-directory of the spool directory called <option>log</option>, and the pid file is
4441 written directly into the spool directory.
4442 </para>
4443 <para>
4444 If <option>-bP</option> is followed by a name preceded by <literal>+</literal>, for example,
4445 </para>
4446 <literallayout class="monospaced">
4447 exim -bP +local_domains
4448 </literallayout>
4449 <para>
4450 it searches for a matching named list of any type (domain, host, address, or
4451 local part) and outputs what it finds.
4452 </para>
4453 <para>
4454 <indexterm role="concept">
4455 <primary>options</primary>
4456 <secondary>router &ndash; extracting</secondary>
4457 </indexterm>
4458 <indexterm role="concept">
4459 <primary>options</primary>
4460 <secondary>transport &ndash; extracting</secondary>
4461 </indexterm>
4462 <indexterm role="concept">
4463 <primary>options</primary>
4464 <secondary>authenticator &ndash; extracting</secondary>
4465 </indexterm>
4466 If one of the words <option>router</option>, <option>transport</option>, or <option>authenticator</option> is given,
4467 followed by the name of an appropriate driver instance, the option settings for
4468 that driver are output. For example:
4469 </para>
4470 <literallayout class="monospaced">
4471 exim -bP transport local_delivery
4472 </literallayout>
4473 <para>
4474 The generic driver options are output first, followed by the driver&#x2019;s private
4475 options. A list of the names of drivers of a particular type can be obtained by
4476 using one of the words <option>router_list</option>, <option>transport_list</option>, or
4477 <option>authenticator_list</option>, and a complete list of all drivers with their option
4478 settings can be obtained by using <option>routers</option>, <option>transports</option>, or
4479 <option>authenticators</option>.
4480 </para>
4481 <para>
4482 <indexterm role="concept">
4483 <primary>options</primary>
4484 <secondary>macro &ndash; extracting</secondary>
4485 </indexterm>
4486 If invoked by an admin user, then <option>macro</option>, <option>macro_list</option> and <option>macros</option>
4487 are available, similarly to the drivers.  Because macros are sometimes used
4488 for storing passwords, this option is restricted.
4489 The output format is one item per line.
4490 </para>
4491 </listitem></varlistentry>
4492 <varlistentry>
4493 <term><option>-bp</option></term>
4494 <listitem>
4495 <para>
4496 <indexterm role="option">
4497 <primary><option>-bp</option></primary>
4498 </indexterm>
4499 <indexterm role="concept">
4500 <primary>queue</primary>
4501 <secondary>listing messages on</secondary>
4502 </indexterm>
4503 <indexterm role="concept">
4504 <primary>listing</primary>
4505 <secondary>messages on the queue</secondary>
4506 </indexterm>
4507 This option requests a listing of the contents of the mail queue on the
4508 standard output. If the <option>-bp</option> option is followed by a list of message ids,
4509 just those messages are listed. By default, this option can be used only by an
4510 admin user. However, the <option>queue_list_requires_admin</option> option can be set false
4511 to allow any user to see the queue.
4512 </para>
4513 <para>
4514 Each message on the queue is displayed as in the following example:
4515 </para>
4516 <literallayout class="monospaced">
4517 25m  2.9K 0t5C6f-0000c8-00 &lt;alice@wonderland.fict.example&gt;
4518           red.king@looking-glass.fict.example
4519           &lt;other addresses&gt;
4520 </literallayout>
4521 <para>
4522 <indexterm role="concept">
4523 <primary>message</primary>
4524 <secondary>size in queue listing</secondary>
4525 </indexterm>
4526 <indexterm role="concept">
4527 <primary>size</primary>
4528 <secondary>of message</secondary>
4529 </indexterm>
4530 The first line contains the length of time the message has been on the queue
4531 (in this case 25 minutes), the size of the message (2.9K), the unique local
4532 identifier for the message, and the message sender, as contained in the
4533 envelope. For bounce messages, the sender address is empty, and appears as
4534 <quote>&lt;&gt;</quote>. If the message was submitted locally by an untrusted user who overrode
4535 the default sender address, the user&#x2019;s login name is shown in parentheses
4536 before the sender address.
4537 </para>
4538 <para>
4539 <indexterm role="concept">
4540 <primary>frozen messages</primary>
4541 <secondary>in queue listing</secondary>
4542 </indexterm>
4543 If the message is frozen (attempts to deliver it are suspended) then the text
4544 <quote>*** frozen ***</quote> is displayed at the end of this line.
4545 </para>
4546 <para>
4547 The recipients of the message (taken from the envelope, not the headers) are
4548 displayed on subsequent lines. Those addresses to which the message has already
4549 been delivered are marked with the letter D. If an original address gets
4550 expanded into several addresses via an alias or forward file, the original is
4551 displayed with a D only when deliveries for all of its child addresses are
4552 complete.
4553 </para>
4554 </listitem></varlistentry>
4555 <varlistentry>
4556 <term><option>-bpa</option></term>
4557 <listitem>
4558 <para>
4559 <indexterm role="option">
4560 <primary><option>-bpa</option></primary>
4561 </indexterm>
4562 This option operates like <option>-bp</option>, but in addition it shows delivered addresses
4563 that were generated from the original top level address(es) in each message by
4564 alias or forwarding operations. These addresses are flagged with <quote>+D</quote> instead
4565 of just <quote>D</quote>.
4566 </para>
4567 </listitem></varlistentry>
4568 <varlistentry>
4569 <term><option>-bpc</option></term>
4570 <listitem>
4571 <para>
4572 <indexterm role="option">
4573 <primary><option>-bpc</option></primary>
4574 </indexterm>
4575 <indexterm role="concept">
4576 <primary>queue</primary>
4577 <secondary>count of messages on</secondary>
4578 </indexterm>
4579 This option counts the number of messages on the queue, and writes the total
4580 to the standard output. It is restricted to admin users, unless
4581 <option>queue_list_requires_admin</option> is set false.
4582 </para>
4583 </listitem></varlistentry>
4584 <varlistentry>
4585 <term><option>-bpr</option></term>
4586 <listitem>
4587 <para>
4588 <indexterm role="option">
4589 <primary><option>-bpr</option></primary>
4590 </indexterm>
4591 This option operates like <option>-bp</option>, but the output is not sorted into
4592 chronological order of message arrival. This can speed it up when there are
4593 lots of messages on the queue, and is particularly useful if the output is
4594 going to be post-processed in a way that doesn&#x2019;t need the sorting.
4595 </para>
4596 </listitem></varlistentry>
4597 <varlistentry>
4598 <term><option>-bpra</option></term>
4599 <listitem>
4600 <para>
4601 <indexterm role="option">
4602 <primary><option>-bpra</option></primary>
4603 </indexterm>
4604 This option is a combination of <option>-bpr</option> and <option>-bpa</option>.
4605 </para>
4606 </listitem></varlistentry>
4607 <varlistentry>
4608 <term><option>-bpru</option></term>
4609 <listitem>
4610 <para>
4611 <indexterm role="option">
4612 <primary><option>-bpru</option></primary>
4613 </indexterm>
4614 This option is a combination of <option>-bpr</option> and <option>-bpu</option>.
4615 </para>
4616 </listitem></varlistentry>
4617 <varlistentry>
4618 <term><option>-bpu</option></term>
4619 <listitem>
4620 <para>
4621 <indexterm role="option">
4622 <primary><option>-bpu</option></primary>
4623 </indexterm>
4624 This option operates like <option>-bp</option> but shows only undelivered top-level
4625 addresses for each message displayed. Addresses generated by aliasing or
4626 forwarding are not shown, unless the message was deferred after processing by a
4627 router with the <option>one_time</option> option set.
4628 </para>
4629 </listitem></varlistentry>
4630 <varlistentry>
4631 <term><option>-brt</option></term>
4632 <listitem>
4633 <para>
4634 <indexterm role="option">
4635 <primary><option>-brt</option></primary>
4636 </indexterm>
4637 <indexterm role="concept">
4638 <primary>testing</primary>
4639 <secondary>retry configuration</secondary>
4640 </indexterm>
4641 <indexterm role="concept">
4642 <primary>retry</primary>
4643 <secondary>configuration testing</secondary>
4644 </indexterm>
4645 This option is for testing retry rules, and it must be followed by up to three
4646 arguments. It causes Exim to look for a retry rule that matches the values
4647 and to write it to the standard output. For example:
4648 </para>
4649 <literallayout class="monospaced">
4650 exim -brt bach.comp.mus.example
4651 Retry rule: *.comp.mus.example  F,2h,15m; F,4d,30m;
4652 </literallayout>
4653 <para>
4654 See chapter <xref linkend="CHAPretry"/> for a description of Exim&#x2019;s retry rules. The first
4655 argument, which is required, can be a complete address in the form
4656 <emphasis>local_part@domain</emphasis>, or it can be just a domain name. If the second argument
4657 contains a dot, it is interpreted as an optional second domain name; if no
4658 retry rule is found for the first argument, the second is tried. This ties in
4659 with Exim&#x2019;s behaviour when looking for retry rules for remote hosts &ndash; if no
4660 rule is found that matches the host, one that matches the mail domain is
4661 sought. Finally, an argument that is the name of a specific delivery error, as
4662 used in setting up retry rules, can be given. For example:
4663 </para>
4664 <literallayout class="monospaced">
4665 exim -brt haydn.comp.mus.example quota_3d
4666 Retry rule: *@haydn.comp.mus.example quota_3d  F,1h,15m
4667 </literallayout>
4668 </listitem></varlistentry>
4669 <varlistentry>
4670 <term><option>-brw</option></term>
4671 <listitem>
4672 <para>
4673 <indexterm role="option">
4674 <primary><option>-brw</option></primary>
4675 </indexterm>
4676 <indexterm role="concept">
4677 <primary>testing</primary>
4678 <secondary>rewriting</secondary>
4679 </indexterm>
4680 <indexterm role="concept">
4681 <primary>rewriting</primary>
4682 <secondary>testing</secondary>
4683 </indexterm>
4684 This option is for testing address rewriting rules, and it must be followed by
4685 a single argument, consisting of either a local part without a domain, or a
4686 complete address with a fully qualified domain. Exim outputs how this address
4687 would be rewritten for each possible place it might appear. See chapter
4688 <xref linkend="CHAPrewrite"/> for further details.
4689 </para>
4690 </listitem></varlistentry>
4691 <varlistentry>
4692 <term><option>-bS</option></term>
4693 <listitem>
4694 <para>
4695 <indexterm role="option">
4696 <primary><option>-bS</option></primary>
4697 </indexterm>
4698 <indexterm role="concept">
4699 <primary>SMTP</primary>
4700 <secondary>batched incoming</secondary>
4701 </indexterm>
4702 <indexterm role="concept">
4703 <primary>batched SMTP input</primary>
4704 </indexterm>
4705 This option is used for batched SMTP input, which is an alternative interface
4706 for non-interactive local message submission. A number of messages can be
4707 submitted in a single run. However, despite its name, this is not really SMTP
4708 input. Exim reads each message&#x2019;s envelope from SMTP commands on the standard
4709 input, but generates no responses. If the caller is trusted, or
4710 <option>untrusted_set_sender</option> is set, the senders in the SMTP MAIL commands are
4711 believed; otherwise the sender is always the caller of Exim.
4712 </para>
4713 <para>
4714 The message itself is read from the standard input, in SMTP format (leading
4715 dots doubled), terminated by a line containing just a single dot. An error is
4716 provoked if the terminating dot is missing. A further message may then follow.
4717 </para>
4718 <para>
4719 As for other local message submissions, the contents of incoming batch SMTP
4720 messages can be checked using the non-SMTP ACL (see chapter <xref linkend="CHAPACL"/>).
4721 Unqualified addresses are automatically qualified using <option>qualify_domain</option> and
4722 <option>qualify_recipient</option>, as appropriate, unless the <option>-bnq</option> option is used.
4723 </para>
4724 <para>
4725 Some other SMTP commands are recognized in the input. HELO and EHLO act
4726 as RSET; VRFY, EXPN, ETRN, and HELP act as NOOP;
4727 QUIT quits, ignoring the rest of the standard input.
4728 </para>
4729 <para>
4730 <indexterm role="concept">
4731 <primary>return code</primary>
4732 <secondary>for <option>-bS</option></secondary>
4733 </indexterm>
4734 If any error is encountered, reports are written to the standard output and
4735 error streams, and Exim gives up immediately. The return code is 0 if no error
4736 was detected; it is 1 if one or more messages were accepted before the error
4737 was detected; otherwise it is 2.
4738 </para>
4739 <para>
4740 More details of input using batched SMTP are given in section
4741 <xref linkend="SECTincomingbatchedSMTP"/>.
4742 </para>
4743 </listitem></varlistentry>
4744 <varlistentry>
4745 <term><option>-bs</option></term>
4746 <listitem>
4747 <para>
4748 <indexterm role="option">
4749 <primary><option>-bs</option></primary>
4750 </indexterm>
4751 <indexterm role="concept">
4752 <primary>SMTP</primary>
4753 <secondary>local input</secondary>
4754 </indexterm>
4755 <indexterm role="concept">
4756 <primary>local SMTP input</primary>
4757 </indexterm>
4758 This option causes Exim to accept one or more messages by reading SMTP commands
4759 on the standard input, and producing SMTP replies on the standard output. SMTP
4760 policy controls, as defined in ACLs (see chapter <xref linkend="CHAPACL"/>) are applied.
4761 Some user agents use this interface as a way of passing locally-generated
4762 messages to the MTA.
4763 </para>
4764 <para>
4765 In
4766 <indexterm role="concept">
4767 <primary>sender</primary>
4768 <secondary>source of</secondary>
4769 </indexterm>
4770 this usage, if the caller of Exim is trusted, or <option>untrusted_set_sender</option> is
4771 set, the senders of messages are taken from the SMTP MAIL commands.
4772 Otherwise the content of these commands is ignored and the sender is set up as
4773 the calling user. Unqualified addresses are automatically qualified using
4774 <option>qualify_domain</option> and <option>qualify_recipient</option>, as appropriate, unless the
4775 <option>-bnq</option> option is used.
4776 </para>
4777 <para>
4778 <indexterm role="concept">
4779 <primary>inetd</primary>
4780 </indexterm>
4781 The
4782 <option>-bs</option> option is also used to run Exim from <emphasis>inetd</emphasis>, as an alternative to
4783 using a listening daemon. Exim can distinguish the two cases by checking
4784 whether the standard input is a TCP/IP socket. When Exim is called from
4785 <emphasis>inetd</emphasis>, the source of the mail is assumed to be remote, and the comments
4786 above concerning senders and qualification do not apply. In this situation,
4787 Exim behaves in exactly the same way as it does when receiving a message via
4788 the listening daemon.
4789 </para>
4790 </listitem></varlistentry>
4791 <varlistentry>
4792 <term><option>-bt</option></term>
4793 <listitem>
4794 <para>
4795 <indexterm role="option">
4796 <primary><option>-bt</option></primary>
4797 </indexterm>
4798 <indexterm role="concept">
4799 <primary>testing</primary>
4800 <secondary>addresses</secondary>
4801 </indexterm>
4802 <indexterm role="concept">
4803 <primary>address</primary>
4804 <secondary>testing</secondary>
4805 </indexterm>
4806 This option runs Exim in address testing mode, in which each argument is taken
4807 as a recipient address to be tested for deliverability. The results are
4808 written to the standard output. If a test fails, and the caller is not an admin
4809 user, no details of the failure are output, because these might contain
4810 sensitive information such as usernames and passwords for database lookups.
4811 </para>
4812 <para>
4813 If no arguments are given, Exim runs in an interactive manner, prompting with a
4814 right angle bracket for addresses to be tested.
4815 </para>
4816 <para>
4817 Unlike the <option>-be</option> test option, you cannot arrange for Exim to use the
4818 <function>readline()</function> function, because it is running as <emphasis>root</emphasis> and there are
4819 security issues.
4820 </para>
4821 <para>
4822 Each address is handled as if it were the recipient address of a message
4823 (compare the <option>-bv</option> option). It is passed to the routers and the result is
4824 written to the standard output. However, any router that has
4825 <option>no_address_test</option> set is bypassed. This can make <option>-bt</option> easier to use for
4826 genuine routing tests if your first router passes everything to a scanner
4827 program.
4828 </para>
4829 <para>
4830 <indexterm role="concept">
4831 <primary>return code</primary>
4832 <secondary>for <option>-bt</option></secondary>
4833 </indexterm>
4834 The return code is 2 if any address failed outright; it is 1 if no address
4835 failed outright but at least one could not be resolved for some reason. Return
4836 code 0 is given only when all addresses succeed.
4837 </para>
4838 <para>
4839 <indexterm role="concept">
4840 <primary>duplicate addresses</primary>
4841 </indexterm>
4842 <emphasis role="bold">Note</emphasis>: When actually delivering a message, Exim removes duplicate recipient
4843 addresses after routing is complete, so that only one delivery takes place.
4844 This does not happen when testing with <option>-bt</option>; the full results of routing are
4845 always shown.
4846 </para>
4847 <para>
4848 <emphasis role="bold">Warning</emphasis>: <option>-bt</option> can only do relatively simple testing. If any of the
4849 routers in the configuration makes any tests on the sender address of a
4850 message,
4851 <indexterm role="option">
4852 <primary><option>-f</option></primary>
4853 <secondary>for address testing</secondary>
4854 </indexterm>
4855 you can use the <option>-f</option> option to set an appropriate sender when running
4856 <option>-bt</option> tests. Without it, the sender is assumed to be the calling user at the
4857 default qualifying domain. However, if you have set up (for example) routers
4858 whose behaviour depends on the contents of an incoming message, you cannot test
4859 those conditions using <option>-bt</option>. The <option>-N</option> option provides a possible way of
4860 doing such tests.
4861 </para>
4862 </listitem></varlistentry>
4863 <varlistentry>
4864 <term><option>-bV</option></term>
4865 <listitem>
4866 <para>
4867 <indexterm role="option">
4868 <primary><option>-bV</option></primary>
4869 </indexterm>
4870 <indexterm role="concept">
4871 <primary>version number of Exim</primary>
4872 </indexterm>
4873 This option causes Exim to write the current version number, compilation
4874 number, and compilation date of the <emphasis>exim</emphasis> binary to the standard output.
4875 It also lists the DBM library that is being used, the optional modules (such as
4876 specific lookup types), the drivers that are included in the binary, and the
4877 name of the run time configuration file that is in use.
4878 </para>
4879 <para>
4880 As part of its operation, <option>-bV</option> causes Exim to read and syntax check its
4881 configuration file. However, this is a static check only. It cannot check
4882 values that are to be expanded. For example, although a misspelt ACL verb is
4883 detected, an error in the verb&#x2019;s arguments is not. You cannot rely on <option>-bV</option>
4884 alone to discover (for example) all the typos in the configuration; some
4885 realistic testing is needed. The <option>-bh</option> and <option>-N</option> options provide more
4886 dynamic testing facilities.
4887 </para>
4888 </listitem></varlistentry>
4889 <varlistentry>
4890 <term><option>-bv</option></term>
4891 <listitem>
4892 <para>
4893 <indexterm role="option">
4894 <primary><option>-bv</option></primary>
4895 </indexterm>
4896 <indexterm role="concept">
4897 <primary>verifying address</primary>
4898 <secondary>using <option>-bv</option></secondary>
4899 </indexterm>
4900 <indexterm role="concept">
4901 <primary>address</primary>
4902 <secondary>verification</secondary>
4903 </indexterm>
4904 This option runs Exim in address verification mode, in which each argument is
4905 taken as a recipient address to be verified by the routers. (This does
4906 not involve any verification callouts). During normal operation, verification
4907 happens mostly as a consequence processing a <option>verify</option> condition in an ACL
4908 (see chapter <xref linkend="CHAPACL"/>). If you want to test an entire ACL, possibly
4909 including callouts, see the <option>-bh</option> and <option>-bhc</option> options.
4910 </para>
4911 <para>
4912 If verification fails, and the caller is not an admin user, no details of the
4913 failure are output, because these might contain sensitive information such as
4914 usernames and passwords for database lookups.
4915 </para>
4916 <para>
4917 If no arguments are given, Exim runs in an interactive manner, prompting with a
4918 right angle bracket for addresses to be verified.
4919 </para>
4920 <para>
4921 Unlike the <option>-be</option> test option, you cannot arrange for Exim to use the
4922 <function>readline()</function> function, because it is running as <emphasis>exim</emphasis> and there are
4923 security issues.
4924 </para>
4925 <para>
4926 Verification differs from address testing (the <option>-bt</option> option) in that routers
4927 that have <option>no_verify</option> set are skipped, and if the address is accepted by a
4928 router that has <option>fail_verify</option> set, verification fails. The address is
4929 verified as a recipient if <option>-bv</option> is used; to test verification for a sender
4930 address, <option>-bvs</option> should be used.
4931 </para>
4932 <para>
4933 If the <option>-v</option> option is not set, the output consists of a single line for each
4934 address, stating whether it was verified or not, and giving a reason in the
4935 latter case. Without <option>-v</option>, generating more than one address by redirection
4936 causes verification to end successfully, without considering the generated
4937 addresses. However, if just one address is generated, processing continues,
4938 and the generated address must verify successfully for the overall verification
4939 to succeed.
4940 </para>
4941 <para>
4942 When <option>-v</option> is set, more details are given of how the address has been handled,
4943 and in the case of address redirection, all the generated addresses are also
4944 considered. Verification may succeed for some and fail for others.
4945 </para>
4946 <para>
4947 The
4948 <indexterm role="concept">
4949 <primary>return code</primary>
4950 <secondary>for <option>-bv</option></secondary>
4951 </indexterm>
4952 return code is 2 if any address failed outright; it is 1 if no address
4953 failed outright but at least one could not be resolved for some reason. Return
4954 code 0 is given only when all addresses succeed.
4955 </para>
4956 <para>
4957 If any of the routers in the configuration makes any tests on the sender
4958 address of a message, you should use the <option>-f</option> option to set an appropriate
4959 sender when running <option>-bv</option> tests. Without it, the sender is assumed to be the
4960 calling user at the default qualifying domain.
4961 </para>
4962 </listitem></varlistentry>
4963 <varlistentry>
4964 <term><option>-bvs</option></term>
4965 <listitem>
4966 <para>
4967 <indexterm role="option">
4968 <primary><option>-bvs</option></primary>
4969 </indexterm>
4970 This option acts like <option>-bv</option>, but verifies the address as a sender rather
4971 than a recipient address. This affects any rewriting and qualification that
4972 might happen.
4973 </para>
4974 </listitem></varlistentry>
4975 <varlistentry>
4976 <term><option>-bw</option></term>
4977 <listitem>
4978 <para>
4979 <indexterm role="option">
4980 <primary><option>-bw</option></primary>
4981 </indexterm>
4982 <indexterm role="concept">
4983 <primary>daemon</primary>
4984 </indexterm>
4985 <indexterm role="concept">
4986 <primary>inetd</primary>
4987 </indexterm>
4988 <indexterm role="concept">
4989 <primary>inetd</primary>
4990 <secondary>wait mode</secondary>
4991 </indexterm>
4992 This option runs Exim as a daemon, awaiting incoming SMTP connections,
4993 similarly to the <option>-bd</option> option.  All port specifications on the command-line
4994 and in the configuration file are ignored.  Queue-running may not be specified.
4995 </para>
4996 <para>
4997 In this mode, Exim expects to be passed a socket as fd 0 (stdin) which is
4998 listening for connections.  This permits the system to start up and have
4999 inetd (or equivalent) listen on the SMTP ports, starting an Exim daemon for
5000 each port only when the first connection is received.
5001 </para>
5002 <para>
5003 If the option is given as <option>-bw</option>&lt;<emphasis>time</emphasis>&gt; then the time is a timeout, after
5004 which the daemon will exit, which should cause inetd to listen once more.
5005 </para>
5006 </listitem></varlistentry>
5007 <varlistentry>
5008 <term><option>-C</option>&nbsp;&lt;<emphasis>filelist</emphasis>&gt;</term>
5009 <listitem>
5010 <para>
5011 <indexterm role="option">
5012 <primary><option>-C</option></primary>
5013 </indexterm>
5014 <indexterm role="concept">
5015 <primary>configuration file</primary>
5016 <secondary>alternate</secondary>
5017 </indexterm>
5018 <indexterm role="concept">
5019 <primary>CONFIGURE_FILE</primary>
5020 </indexterm>
5021 <indexterm role="concept">
5022 <primary>alternate configuration file</primary>
5023 </indexterm>
5024 This option causes Exim to find the run time configuration file from the given
5025 list instead of from the list specified by the CONFIGURE_FILE
5026 compile-time setting. Usually, the list will consist of just a single file
5027 name, but it can be a colon-separated list of names. In this case, the first
5028 file that exists is used. Failure to open an existing file stops Exim from
5029 proceeding any further along the list, and an error is generated.
5030 </para>
5031 <para>
5032 When this option is used by a caller other than root, and the list is different
5033 from the compiled-in list, Exim gives up its root privilege immediately, and
5034 runs with the real and effective uid and gid set to those of the caller.
5035 However, if a TRUSTED_CONFIG_LIST file is defined in <filename>Local/Makefile</filename>, that
5036 file contains a list of full pathnames, one per line, for configuration files
5037 which are trusted. Root privilege is retained for any configuration file so
5038 listed, as long as the caller is the Exim user (or the user specified in the
5039 CONFIGURE_OWNER option, if any), and as long as the configuration file is
5040 not writeable by inappropriate users or groups.
5041 </para>
5042 <para>
5043 Leaving TRUSTED_CONFIG_LIST unset precludes the possibility of testing a
5044 configuration using <option>-C</option> right through message reception and delivery,
5045 even if the caller is root. The reception works, but by that time, Exim is
5046 running as the Exim user, so when it re-executes to regain privilege for the
5047 delivery, the use of <option>-C</option> causes privilege to be lost. However, root can
5048 test reception and delivery using two separate commands (one to put a message
5049 on the queue, using <option>-odq</option>, and another to do the delivery, using <option>-M</option>).
5050 </para>
5051 <para>
5052 If ALT_CONFIG_PREFIX is defined <filename>in Local/Makefile</filename>, it specifies a
5053 prefix string with which any file named in a <option>-C</option> command line option
5054 must start. In addition, the file name must not contain the sequence <literal>/../</literal>.
5055 However, if the value of the <option>-C</option> option is identical to the value of
5056 CONFIGURE_FILE in <filename>Local/Makefile</filename>, Exim ignores <option>-C</option> and proceeds as
5057 usual. There is no default setting for ALT_CONFIG_PREFIX; when it is
5058 unset, any file name can be used with <option>-C</option>.
5059 </para>
5060 <para>
5061 ALT_CONFIG_PREFIX can be used to confine alternative configuration files
5062 to a directory to which only root has access. This prevents someone who has
5063 broken into the Exim account from running a privileged Exim with an arbitrary
5064 configuration file.
5065 </para>
5066 <para>
5067 The <option>-C</option> facility is useful for ensuring that configuration files are
5068 syntactically correct, but cannot be used for test deliveries, unless the
5069 caller is privileged, or unless it is an exotic configuration that does not
5070 require privilege. No check is made on the owner or group of the files
5071 specified by this option.
5072 </para>
5073 </listitem></varlistentry>
5074 <varlistentry>
5075 <term><option>-D</option>&lt;<emphasis>macro</emphasis>&gt;=&lt;<emphasis>value</emphasis>&gt;</term>
5076 <listitem>
5077 <para>
5078 <indexterm role="option">
5079 <primary><option>-D</option></primary>
5080 </indexterm>
5081 <indexterm role="concept">
5082 <primary>macro</primary>
5083 <secondary>setting on command line</secondary>
5084 </indexterm>
5085 This option can be used to override macro definitions in the configuration file
5086 (see section <xref linkend="SECTmacrodefs"/>). However, like <option>-C</option>, if it is used by an
5087 unprivileged caller, it causes Exim to give up its root privilege.
5088 If DISABLE_D_OPTION is defined in <filename>Local/Makefile</filename>, the use of <option>-D</option> is
5089 completely disabled, and its use causes an immediate error exit.
5090 </para>
5091 <para>
5092 If WHITELIST_D_MACROS is defined in <filename>Local/Makefile</filename> then it should be a
5093 colon-separated list of macros which are considered safe and, if <option>-D</option> only
5094 supplies macros from this list, and the values are acceptable, then Exim will
5095 not give up root privilege if the caller is root, the Exim run-time user, or
5096 the CONFIGURE_OWNER, if set.  This is a transition mechanism and is expected
5097 to be removed in the future.  Acceptable values for the macros satisfy the
5098 regexp: <literal>^[A-Za-z0-9_/.-]*$</literal>
5099 </para>
5100 <para>
5101 The entire option (including equals sign if present) must all be within one
5102 command line item. <option>-D</option> can be used to set the value of a macro to the empty
5103 string, in which case the equals sign is optional. These two commands are
5104 synonymous:
5105 </para>
5106 <literallayout class="monospaced">
5107 exim -DABC  ...
5108 exim -DABC= ...
5109 </literallayout>
5110 <para>
5111 To include spaces in a macro definition item, quotes must be used. If you use
5112 quotes, spaces are permitted around the macro name and the equals sign. For
5113 example:
5114 </para>
5115 <literallayout class="monospaced">
5116 exim '-D ABC = something' ...
5117 </literallayout>
5118 <para>
5119 <option>-D</option> may be repeated up to 10 times on a command line.
5120 </para>
5121 </listitem></varlistentry>
5122 <varlistentry>
5123 <term><option>-d</option>&lt;<emphasis>debug&nbsp;options</emphasis>&gt;</term>
5124 <listitem>
5125 <para>
5126 <indexterm role="option">
5127 <primary><option>-d</option></primary>
5128 </indexterm>
5129 <indexterm role="concept">
5130 <primary>debugging</primary>
5131 <secondary>list of selectors</secondary>
5132 </indexterm>
5133 <indexterm role="concept">
5134 <primary>debugging</primary>
5135 <secondary><option>-d</option> option</secondary>
5136 </indexterm>
5137 This option causes debugging information to be written to the standard
5138 error stream. It is restricted to admin users because debugging output may show
5139 database queries that contain password information. Also, the details of users&#x2019;
5140 filter files should be protected. If a non-admin user uses <option>-d</option>, Exim
5141 writes an error message to the standard error stream and exits with a non-zero
5142 return code.
5143 </para>
5144 <para>
5145 When <option>-d</option> is used, <option>-v</option> is assumed. If <option>-d</option> is given on its own, a lot of
5146 standard debugging data is output. This can be reduced, or increased to include
5147 some more rarely needed information, by directly following <option>-d</option> with a string
5148 made up of names preceded by plus or minus characters. These add or remove sets
5149 of debugging data, respectively. For example, <option>-d+filter</option> adds filter
5150 debugging, whereas <option>-d-all+filter</option> selects only filter debugging. Note that
5151 no spaces are allowed in the debug setting. The available debugging categories
5152 are:
5153 </para>
5154 <literallayout>
5155 <literal>acl            </literal> ACL interpretation
5156 <literal>auth           </literal> authenticators
5157 <literal>deliver        </literal> general delivery logic
5158 <literal>dns            </literal> DNS lookups (see also resolver)
5159 <literal>dnsbl          </literal> DNS black list (aka RBL) code
5160 <literal>exec           </literal> arguments for <function>execv()</function> calls
5161 <literal>expand         </literal> detailed debugging for string expansions
5162 <literal>filter         </literal> filter handling
5163 <literal>hints_lookup   </literal> hints data lookups
5164 <literal>host_lookup    </literal> all types of name-to-IP address handling
5165 <literal>ident          </literal> ident lookup
5166 <literal>interface      </literal> lists of local interfaces
5167 <literal>lists          </literal> matching things in lists
5168 <literal>load           </literal> system load checks
5169 <literal>local_scan     </literal> can be used by <function>local_scan()</function> (see chapter <xref linkend="CHAPlocalscan"/>)
5170 <literal>lookup         </literal> general lookup code and all lookups
5171 <literal>memory         </literal> memory handling
5172 <literal>pid            </literal> add pid to debug output lines
5173 <literal>process_info   </literal> setting info for the process log
5174 <literal>queue_run      </literal> queue runs
5175 <literal>receive        </literal> general message reception logic
5176 <literal>resolver       </literal> turn on the DNS resolver&#x2019;s debugging output
5177 <literal>retry          </literal> retry handling
5178 <literal>rewrite        </literal> address rewriting
5179 <literal>route          </literal> address routing
5180 <literal>timestamp      </literal> add timestamp to debug output lines
5181 <literal>tls            </literal> TLS logic
5182 <literal>transport      </literal> transports
5183 <literal>uid            </literal> changes of uid/gid and looking up uid/gid
5184 <literal>verify         </literal> address verification logic
5185 <literal>all            </literal> almost all of the above (see below), and also <option>-v</option>
5186 </literallayout>
5187 <para>
5188 The <literal>all</literal> option excludes <literal>memory</literal> when used as <literal>+all</literal>, but includes it
5189 for <literal>-all</literal>. The reason for this is that <literal>+all</literal> is something that people
5190 tend to use when generating debug output for Exim maintainers. If <literal>+memory</literal>
5191 is included, an awful lot of output that is very rarely of interest is
5192 generated, so it now has to be explicitly requested. However, <literal>-all</literal> does
5193 turn everything off.
5194 </para>
5195 <para>
5196 <indexterm role="concept">
5197 <primary>resolver, debugging output</primary>
5198 </indexterm>
5199 <indexterm role="concept">
5200 <primary>DNS resolver, debugging output</primary>
5201 </indexterm>
5202 The <literal>resolver</literal> option produces output only if the DNS resolver was compiled
5203 with DEBUG enabled. This is not the case in some operating systems. Also,
5204 unfortunately, debugging output from the DNS resolver is written to stdout
5205 rather than stderr.
5206 </para>
5207 <para>
5208 The default (<option>-d</option> with no argument) omits <literal>expand</literal>, <literal>filter</literal>,
5209 <literal>interface</literal>, <literal>load</literal>, <literal>memory</literal>, <literal>pid</literal>, <literal>resolver</literal>, and <literal>timestamp</literal>.
5210 However, the <literal>pid</literal> selector is forced when debugging is turned on for a
5211 daemon, which then passes it on to any re-executed Exims. Exim also
5212 automatically adds the pid to debug lines when several remote deliveries are
5213 run in parallel.
5214 </para>
5215 <para>
5216 The <literal>timestamp</literal> selector causes the current time to be inserted at the start
5217 of all debug output lines. This can be useful when trying to track down delays
5218 in processing.
5219 </para>
5220 <para>
5221 If the <option>debug_print</option> option is set in any driver, it produces output whenever
5222 any debugging is selected, or if <option>-v</option> is used.
5223 </para>
5224 </listitem></varlistentry>
5225 <varlistentry>
5226 <term><option>-dd</option>&lt;<emphasis>debug&nbsp;options</emphasis>&gt;</term>
5227 <listitem>
5228 <para>
5229 <indexterm role="option">
5230 <primary><option>-dd</option></primary>
5231 </indexterm>
5232 This option behaves exactly like <option>-d</option> except when used on a command that
5233 starts a daemon process. In that case, debugging is turned off for the
5234 subprocesses that the daemon creates. Thus, it is useful for monitoring the
5235 behaviour of the daemon without creating as much output as full debugging does.
5236 </para>
5237 </listitem></varlistentry>
5238 <varlistentry>
5239 <term><option>-dropcr</option></term>
5240 <listitem>
5241 <para>
5242 <indexterm role="option">
5243 <primary><option>-dropcr</option></primary>
5244 </indexterm>
5245 This is an obsolete option that is now a no-op. It used to affect the way Exim
5246 handled CR and LF characters in incoming messages. What happens now is
5247 described in section <xref linkend="SECTlineendings"/>.
5248 </para>
5249 </listitem></varlistentry>
5250 <varlistentry>
5251 <term><option>-E</option></term>
5252 <listitem>
5253 <para>
5254 <indexterm role="option">
5255 <primary><option>-E</option></primary>
5256 </indexterm>
5257 <indexterm role="concept">
5258 <primary>bounce message</primary>
5259 <secondary>generating</secondary>
5260 </indexterm>
5261 This option specifies that an incoming message is a locally-generated delivery
5262 failure report. It is used internally by Exim when handling delivery failures
5263 and is not intended for external use. Its only effect is to stop Exim
5264 generating certain messages to the postmaster, as otherwise message cascades
5265 could occur in some situations. As part of the same option, a message id may
5266 follow the characters <option>-E</option>. If it does, the log entry for the receipt of the
5267 new message contains the id, following <quote>R=</quote>, as a cross-reference.
5268 </para>
5269 </listitem></varlistentry>
5270 <varlistentry>
5271 <term><option>-e</option><emphasis>x</emphasis></term>
5272 <listitem>
5273 <para>
5274 <indexterm role="option">
5275 <primary><option>-e</option><emphasis>x</emphasis></primary>
5276 </indexterm>
5277 There are a number of Sendmail options starting with <option>-oe</option> which seem to be
5278 called by various programs without the leading <option>o</option> in the option. For
5279 example, the <option>vacation</option> program uses <option>-eq</option>. Exim treats all options of the
5280 form <option>-e</option><emphasis>x</emphasis> as synonymous with the corresponding <option>-oe</option><emphasis>x</emphasis> options.
5281 </para>
5282 </listitem></varlistentry>
5283 <varlistentry>
5284 <term><option>-F</option>&nbsp;&lt;<emphasis>string</emphasis>&gt;</term>
5285 <listitem>
5286 <para>
5287 <indexterm role="option">
5288 <primary><option>-F</option></primary>
5289 </indexterm>
5290 <indexterm role="concept">
5291 <primary>sender</primary>
5292 <secondary>name</secondary>
5293 </indexterm>
5294 <indexterm role="concept">
5295 <primary>name</primary>
5296 <secondary>of sender</secondary>
5297 </indexterm>
5298 This option sets the sender&#x2019;s full name for use when a locally-generated
5299 message is being accepted. In the absence of this option, the user&#x2019;s <emphasis>gecos</emphasis>
5300 entry from the password data is used. As users are generally permitted to alter
5301 their <emphasis>gecos</emphasis> entries, no security considerations are involved. White space
5302 between <option>-F</option> and the &lt;<emphasis>string</emphasis>&gt; is optional.
5303 </para>
5304 </listitem></varlistentry>
5305 <varlistentry>
5306 <term><option>-f</option>&nbsp;&lt;<emphasis>address</emphasis>&gt;</term>
5307 <listitem>
5308 <para>
5309 <indexterm role="option">
5310 <primary><option>-f</option></primary>
5311 </indexterm>
5312 <indexterm role="concept">
5313 <primary>sender</primary>
5314 <secondary>address</secondary>
5315 </indexterm>
5316 <indexterm role="concept">
5317 <primary>address</primary>
5318 <secondary>sender</secondary>
5319 </indexterm>
5320 <indexterm role="concept">
5321 <primary>trusted users</primary>
5322 </indexterm>
5323 <indexterm role="concept">
5324 <primary>envelope sender</primary>
5325 </indexterm>
5326 <indexterm role="concept">
5327 <primary>user</primary>
5328 <secondary>trusted</secondary>
5329 </indexterm>
5330 This option sets the address of the envelope sender of a locally-generated
5331 message (also known as the return path). The option can normally be used only
5332 by a trusted user, but <option>untrusted_set_sender</option> can be set to allow untrusted
5333 users to use it.
5334 </para>
5335 <para>
5336 Processes running as root or the Exim user are always trusted. Other
5337 trusted users are defined by the <option>trusted_users</option> or <option>trusted_groups</option>
5338 options. In the absence of <option>-f</option>, or if the caller is not trusted, the sender
5339 of a local message is set to the caller&#x2019;s login name at the default qualify
5340 domain.
5341 </para>
5342 <para>
5343 There is one exception to the restriction on the use of <option>-f</option>: an empty sender
5344 can be specified by any user, trusted or not, to create a message that can
5345 never provoke a bounce. An empty sender can be specified either as an empty
5346 string, or as a pair of angle brackets with nothing between them, as in these
5347 examples of shell commands:
5348 </para>
5349 <literallayout class="monospaced">
5350 exim -f '&lt;&gt;' user@domain
5351 exim -f "" user@domain
5352 </literallayout>
5353 <para>
5354 In addition, the use of <option>-f</option> is not restricted when testing a filter file
5355 with <option>-bf</option> or when testing or verifying addresses using the <option>-bt</option> or
5356 <option>-bv</option> options.
5357 </para>
5358 <para>
5359 Allowing untrusted users to change the sender address does not of itself make
5360 it possible to send anonymous mail. Exim still checks that the <emphasis>From:</emphasis> header
5361 refers to the local user, and if it does not, it adds a <emphasis>Sender:</emphasis> header,
5362 though this can be overridden by setting <option>no_local_from_check</option>.
5363 </para>
5364 <para>
5365 White
5366 <indexterm role="concept">
5367 <primary><quote>From</quote> line</primary>
5368 </indexterm>
5369 space between <option>-f</option> and the &lt;<emphasis>address</emphasis>&gt; is optional (that is, they can be
5370 given as two arguments or one combined argument). The sender of a
5371 locally-generated message can also be set (when permitted) by an initial
5372 <quote>From&nbsp;</quote> line in the message &ndash; see the description of <option>-bm</option> above &ndash; but
5373 if <option>-f</option> is also present, it overrides <quote>From&nbsp;</quote>.
5374 </para>
5375 </listitem></varlistentry>
5376 <varlistentry>
5377 <term><option>-G</option></term>
5378 <listitem>
5379 <para>
5380 <indexterm role="option">
5381 <primary><option>-G</option></primary>
5382 </indexterm>
5383 <indexterm role="concept">
5384 <primary>submission fixups, suppressing (command-line)</primary>
5385 </indexterm>
5386 This option is equivalent to an ACL applying:
5387 </para>
5388 <literallayout class="monospaced">
5389 control = suppress_local_fixups
5390 </literallayout>
5391 <para>
5392 for every message received.  Note that Sendmail will complain about such
5393 bad formatting, where Exim silently just does not fix it up.  This may change
5394 in future.
5395 </para>
5396 <para>
5397 As this affects audit information, the caller must be a trusted user to use
5398 this option.
5399 </para>
5400 </listitem></varlistentry>
5401 <varlistentry>
5402 <term><option>-h</option>&nbsp;&lt;<emphasis>number</emphasis>&gt;</term>
5403 <listitem>
5404 <para>
5405 <indexterm role="option">
5406 <primary><option>-h</option></primary>
5407 </indexterm>
5408 <indexterm role="concept">
5409 <primary>Sendmail compatibility</primary>
5410 <secondary><option>-h</option> option ignored</secondary>
5411 </indexterm>
5412 This option is accepted for compatibility with Sendmail, but has no effect. (In
5413 Sendmail it overrides the <quote>hop count</quote> obtained by counting <emphasis>Received:</emphasis>
5414 headers.)
5415 </para>
5416 </listitem></varlistentry>
5417 <varlistentry>
5418 <term><option>-i</option></term>
5419 <listitem>
5420 <para>
5421 <indexterm role="option">
5422 <primary><option>-i</option></primary>
5423 </indexterm>
5424 <indexterm role="concept">
5425 <primary>Solaris</primary>
5426 <secondary><emphasis>mail</emphasis> command</secondary>
5427 </indexterm>
5428 <indexterm role="concept">
5429 <primary>dot</primary>
5430 <secondary>in incoming non-SMTP message</secondary>
5431 </indexterm>
5432 This option, which has the same effect as <option>-oi</option>, specifies that a dot on a
5433 line by itself should not terminate an incoming, non-SMTP message. I can find
5434 no documentation for this option in Solaris 2.4 Sendmail, but the <emphasis>mailx</emphasis>
5435 command in Solaris 2.4 uses it. See also <option>-ti</option>.
5436 </para>
5437 </listitem></varlistentry>
5438 <varlistentry>
5439 <term><option>-L</option>&nbsp;&lt;<emphasis>tag</emphasis>&gt;</term>
5440 <listitem>
5441 <para>
5442 <indexterm role="option">
5443 <primary><option>-L</option></primary>
5444 </indexterm>
5445 <indexterm role="concept">
5446 <primary>syslog</primary>
5447 <secondary>process name; set with flag</secondary>
5448 </indexterm>
5449 This option is equivalent to setting <option>syslog_processname</option> in the config
5450 file and setting <option>log_file_path</option> to <literal>syslog</literal>.
5451 Its use is restricted to administrators.  The configuration file has to be
5452 read and parsed, to determine access rights, before this is set and takes
5453 effect, so early configuration file errors will not honour this flag.
5454 </para>
5455 <para>
5456 The tag should not be longer than 32 characters.
5457 </para>
5458 </listitem></varlistentry>
5459 <varlistentry>
5460 <term><option>-M</option>&nbsp;&lt;<emphasis>message&nbsp;id</emphasis>&gt;&nbsp;&lt;<emphasis>message&nbsp;id</emphasis>&gt;&nbsp;...</term>
5461 <listitem>
5462 <para>
5463 <indexterm role="option">
5464 <primary><option>-M</option></primary>
5465 </indexterm>
5466 <indexterm role="concept">
5467 <primary>forcing delivery</primary>
5468 </indexterm>
5469 <indexterm role="concept">
5470 <primary>delivery</primary>
5471 <secondary>forcing attempt</secondary>
5472 </indexterm>
5473 <indexterm role="concept">
5474 <primary>frozen messages</primary>
5475 <secondary>forcing delivery</secondary>
5476 </indexterm>
5477 This option requests Exim to run a delivery attempt on each message in turn. If
5478 any of the messages are frozen, they are automatically thawed before the
5479 delivery attempt. The settings of <option>queue_domains</option>, <option>queue_smtp_domains</option>,
5480 and <option>hold_domains</option> are ignored.
5481 </para>
5482 <para>
5483 Retry
5484 <indexterm role="concept">
5485 <primary>hints database</primary>
5486 <secondary>overriding retry hints</secondary>
5487 </indexterm>
5488 hints for any of the addresses are overridden &ndash; Exim tries to deliver even if
5489 the normal retry time has not yet been reached. This option requires the caller
5490 to be an admin user. However, there is an option called <option>prod_requires_admin</option>
5491 which can be set false to relax this restriction (and also the same requirement
5492 for the <option>-q</option>, <option>-R</option>, and <option>-S</option> options).
5493 </para>
5494 <para>
5495 The deliveries happen synchronously, that is, the original Exim process does
5496 not terminate until all the delivery attempts have finished. No output is
5497 produced unless there is a serious error. If you want to see what is happening,
5498 use the <option>-v</option> option as well, or inspect Exim&#x2019;s main log.
5499 </para>
5500 </listitem></varlistentry>
5501 <varlistentry>
5502 <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>
5503 <listitem>
5504 <para>
5505 <indexterm role="option">
5506 <primary><option>-Mar</option></primary>
5507 </indexterm>
5508 <indexterm role="concept">
5509 <primary>message</primary>
5510 <secondary>adding recipients</secondary>
5511 </indexterm>
5512 <indexterm role="concept">
5513 <primary>recipient</primary>
5514 <secondary>adding</secondary>
5515 </indexterm>
5516 This option requests Exim to add the addresses to the list of recipients of the
5517 message (<quote>ar</quote> for <quote>add recipients</quote>). The first argument must be a message
5518 id, and the remaining ones must be email addresses. However, if the message is
5519 active (in the middle of a delivery attempt), it is not altered. This option
5520 can be used only by an admin user.
5521 </para>
5522 </listitem></varlistentry>
5523 <varlistentry>
5524 <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>
5525 <listitem>
5526 <para>
5527 <indexterm role="option">
5528 <primary><option>-MC</option></primary>
5529 </indexterm>
5530 <indexterm role="concept">
5531 <primary>SMTP</primary>
5532 <secondary>passed connection</secondary>
5533 </indexterm>
5534 <indexterm role="concept">
5535 <primary>SMTP</primary>
5536 <secondary>multiple deliveries</secondary>
5537 </indexterm>
5538 <indexterm role="concept">
5539 <primary>multiple SMTP deliveries</primary>
5540 </indexterm>
5541 This option is not intended for use by external callers. It is used internally
5542 by Exim to invoke another instance of itself to deliver a waiting message using
5543 an existing SMTP connection, which is passed as the standard input. Details are
5544 given in chapter <xref linkend="CHAPSMTP"/>. This must be the final option, and the caller
5545 must be root or the Exim user in order to use it.
5546 </para>
5547 </listitem></varlistentry>
5548 <varlistentry>
5549 <term><option>-MCA</option></term>
5550 <listitem>
5551 <para>
5552 <indexterm role="option">
5553 <primary><option>-MCA</option></primary>
5554 </indexterm>
5555 This option is not intended for use by external callers. It is used internally
5556 by Exim in conjunction with the <option>-MC</option> option. It signifies that the
5557 connection to the remote host has been authenticated.
5558 </para>
5559 </listitem></varlistentry>
5560 <varlistentry>
5561 <term><option>-MCP</option></term>
5562 <listitem>
5563 <para>
5564 <indexterm role="option">
5565 <primary><option>-MCP</option></primary>
5566 </indexterm>
5567 This option is not intended for use by external callers. It is used internally
5568 by Exim in conjunction with the <option>-MC</option> option. It signifies that the server to
5569 which Exim is connected supports pipelining.
5570 </para>
5571 </listitem></varlistentry>
5572 <varlistentry>
5573 <term><option>-MCQ</option>&nbsp;&lt;<emphasis>process&nbsp;id</emphasis>&gt;&nbsp;&lt;<emphasis>pipe&nbsp;fd</emphasis>&gt;</term>
5574 <listitem>
5575 <para>
5576 <indexterm role="option">
5577 <primary><option>-MCQ</option></primary>
5578 </indexterm>
5579 This option is not intended for use by external callers. It is used internally
5580 by Exim in conjunction with the <option>-MC</option> option when the original delivery was
5581 started by a queue runner. It passes on the process id of the queue runner,
5582 together with the file descriptor number of an open pipe. Closure of the pipe
5583 signals the final completion of the sequence of processes that are passing
5584 messages through the same SMTP connection.
5585 </para>
5586 </listitem></varlistentry>
5587 <varlistentry>
5588 <term><option>-MCS</option></term>
5589 <listitem>
5590 <para>
5591 <indexterm role="option">
5592 <primary><option>-MCS</option></primary>
5593 </indexterm>
5594 This option is not intended for use by external callers. It is used internally
5595 by Exim in conjunction with the <option>-MC</option> option, and passes on the fact that the
5596 SMTP SIZE option should be used on messages delivered down the existing
5597 connection.
5598 </para>
5599 </listitem></varlistentry>
5600 <varlistentry>
5601 <term><option>-MCT</option></term>
5602 <listitem>
5603 <para>
5604 <indexterm role="option">
5605 <primary><option>-MCT</option></primary>
5606 </indexterm>
5607 This option is not intended for use by external callers. It is used internally
5608 by Exim in conjunction with the <option>-MC</option> option, and passes on the fact that the
5609 host to which Exim is connected supports TLS encryption.
5610 </para>
5611 </listitem></varlistentry>
5612 <varlistentry>
5613 <term><option>-Mc</option>&nbsp;&lt;<emphasis>message&nbsp;id</emphasis>&gt;&nbsp;&lt;<emphasis>message&nbsp;id</emphasis>&gt;&nbsp;...</term>
5614 <listitem>
5615 <para>
5616 <indexterm role="option">
5617 <primary><option>-Mc</option></primary>
5618 </indexterm>
5619 <indexterm role="concept">
5620 <primary>hints database</primary>
5621 <secondary>not overridden by <option>-Mc</option></secondary>
5622 </indexterm>
5623 <indexterm role="concept">
5624 <primary>delivery</primary>
5625 <secondary>manually started &ndash; not forced</secondary>
5626 </indexterm>
5627 This option requests Exim to run a delivery attempt on each message in turn,
5628 but unlike the <option>-M</option> option, it does check for retry hints, and respects any
5629 that are found. This option is not very useful to external callers. It is
5630 provided mainly for internal use by Exim when it needs to re-invoke itself in
5631 order to regain root privilege for a delivery (see chapter <xref linkend="CHAPsecurity"/>).
5632 However, <option>-Mc</option> can be useful when testing, in order to run a delivery that
5633 respects retry times and other options such as <option>hold_domains</option> that are
5634 overridden when <option>-M</option> is used. Such a delivery does not count as a queue run.
5635 If you want to run a specific delivery as if in a queue run, you should use
5636 <option>-q</option> with a message id argument. A distinction between queue run deliveries
5637 and other deliveries is made in one or two places.
5638 </para>
5639 </listitem></varlistentry>
5640 <varlistentry>
5641 <term><option>-Mes</option>&nbsp;&lt;<emphasis>message&nbsp;id</emphasis>&gt;&nbsp;&lt;<emphasis>address</emphasis>&gt;</term>
5642 <listitem>
5643 <para>
5644 <indexterm role="option">
5645 <primary><option>-Mes</option></primary>
5646 </indexterm>
5647 <indexterm role="concept">
5648 <primary>message</primary>
5649 <secondary>changing sender</secondary>
5650 </indexterm>
5651 <indexterm role="concept">
5652 <primary>sender</primary>
5653 <secondary>changing</secondary>
5654 </indexterm>
5655 This option requests Exim to change the sender address in the message to the
5656 given address, which must be a fully qualified address or <quote>&lt;&gt;</quote> (<quote>es</quote> for
5657 <quote>edit sender</quote>). There must be exactly two arguments. The first argument must
5658 be a message id, and the second one an email address. However, if the message
5659 is active (in the middle of a delivery attempt), its status is not altered.
5660 This option can be used only by an admin user.
5661 </para>
5662 </listitem></varlistentry>
5663 <varlistentry>
5664 <term><option>-Mf</option>&nbsp;&lt;<emphasis>message&nbsp;id</emphasis>&gt;&nbsp;&lt;<emphasis>message&nbsp;id</emphasis>&gt;&nbsp;...</term>
5665 <listitem>
5666 <para>
5667 <indexterm role="option">
5668 <primary><option>-Mf</option></primary>
5669 </indexterm>
5670 <indexterm role="concept">
5671 <primary>freezing messages</primary>
5672 </indexterm>
5673 <indexterm role="concept">
5674 <primary>message</primary>
5675 <secondary>manually freezing</secondary>
5676 </indexterm>
5677 This option requests Exim to mark each listed message as <quote>frozen</quote>. This
5678 prevents any delivery attempts taking place until the message is <quote>thawed</quote>,
5679 either manually or as a result of the <option>auto_thaw</option> configuration option.
5680 However, if any of the messages are active (in the middle of a delivery
5681 attempt), their status is not altered. This option can be used only by an admin
5682 user.
5683 </para>
5684 </listitem></varlistentry>
5685 <varlistentry>
5686 <term><option>-Mg</option>&nbsp;&lt;<emphasis>message&nbsp;id</emphasis>&gt;&nbsp;&lt;<emphasis>message&nbsp;id</emphasis>&gt;&nbsp;...</term>
5687 <listitem>
5688 <para>
5689 <indexterm role="option">
5690 <primary><option>-Mg</option></primary>
5691 </indexterm>
5692 <indexterm role="concept">
5693 <primary>giving up on messages</primary>
5694 </indexterm>
5695 <indexterm role="concept">
5696 <primary>message</primary>
5697 <secondary>abandoning delivery attempts</secondary>
5698 </indexterm>
5699 <indexterm role="concept">
5700 <primary>delivery</primary>
5701 <secondary>abandoning further attempts</secondary>
5702 </indexterm>
5703 This option requests Exim to give up trying to deliver the listed messages,
5704 including any that are frozen. However, if any of the messages are active,
5705 their status is not altered. For non-bounce messages, a delivery error message
5706 is sent to the sender, containing the text <quote>cancelled by administrator</quote>.
5707 Bounce messages are just discarded. This option can be used only by an admin
5708 user.
5709 </para>
5710 </listitem></varlistentry>
5711 <varlistentry>
5712 <term><option>-Mmad</option>&nbsp;&lt;<emphasis>message&nbsp;id</emphasis>&gt;&nbsp;&lt;<emphasis>message&nbsp;id</emphasis>&gt;&nbsp;...</term>
5713 <listitem>
5714 <para>
5715 <indexterm role="option">
5716 <primary><option>-Mmad</option></primary>
5717 </indexterm>
5718 <indexterm role="concept">
5719 <primary>delivery</primary>
5720 <secondary>cancelling all</secondary>
5721 </indexterm>
5722 This option requests Exim to mark all the recipient addresses in the messages
5723 as already delivered (<quote>mad</quote> for <quote>mark all delivered</quote>). However, if any
5724 message is active (in the middle of a delivery attempt), its status is not
5725 altered. This option can be used only by an admin user.
5726 </para>
5727 </listitem></varlistentry>
5728 <varlistentry>
5729 <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>
5730 <listitem>
5731 <para>
5732 <indexterm role="option">
5733 <primary><option>-Mmd</option></primary>
5734 </indexterm>
5735 <indexterm role="concept">
5736 <primary>delivery</primary>
5737 <secondary>cancelling by address</secondary>
5738 </indexterm>
5739 <indexterm role="concept">
5740 <primary>recipient</primary>
5741 <secondary>removing</secondary>
5742 </indexterm>
5743 <indexterm role="concept">
5744 <primary>removing recipients</primary>
5745 </indexterm>
5746 This option requests Exim to mark the given addresses as already delivered
5747 (<quote>md</quote> for <quote>mark delivered</quote>). The first argument must be a message id, and
5748 the remaining ones must be email addresses. These are matched to recipient
5749 addresses in the message in a case-sensitive manner. If the message is active
5750 (in the middle of a delivery attempt), its status is not altered. This option
5751 can be used only by an admin user.
5752 </para>
5753 </listitem></varlistentry>
5754 <varlistentry>
5755 <term><option>-Mrm</option>&nbsp;&lt;<emphasis>message&nbsp;id</emphasis>&gt;&nbsp;&lt;<emphasis>message&nbsp;id</emphasis>&gt;&nbsp;...</term>
5756 <listitem>
5757 <para>
5758 <indexterm role="option">
5759 <primary><option>-Mrm</option></primary>
5760 </indexterm>
5761 <indexterm role="concept">
5762 <primary>removing messages</primary>
5763 </indexterm>
5764 <indexterm role="concept">
5765 <primary>abandoning mail</primary>
5766 </indexterm>
5767 <indexterm role="concept">
5768 <primary>message</primary>
5769 <secondary>manually discarding</secondary>
5770 </indexterm>
5771 This option requests Exim to remove the given messages from the queue. No
5772 bounce messages are sent; each message is simply forgotten. However, if any of
5773 the messages are active, their status is not altered. This option can be used
5774 only by an admin user or by the user who originally caused the message to be
5775 placed on the queue.
5776 </para>
5777 </listitem></varlistentry>
5778 <varlistentry>
5779 <term><option>-Mset</option>&nbsp;&lt;<emphasis>message&nbsp;id</emphasis>&gt;</term>
5780 <listitem>
5781 <para>
5782 <indexterm role="option">
5783 <primary><option>-Mset</option></primary>
5784 </indexterm>
5785 <indexterm role="concept">
5786 <primary>testing</primary>
5787 <secondary>string expansion</secondary>
5788 </indexterm>
5789 <indexterm role="concept">
5790 <primary>expansion</primary>
5791 <secondary>testing</secondary>
5792 </indexterm>
5793 This option is useful only in conjunction with <option>-be</option> (that is, when testing
5794 string expansions). Exim loads the given message from its spool before doing
5795 the test expansions, thus setting message-specific variables such as
5796 <varname>$message_size</varname> and the header variables. The <varname>$recipients</varname> variable is made
5797 available. This feature is provided to make it easier to test expansions that
5798 make use of these variables. However, this option can be used only by an admin
5799 user. See also <option>-bem</option>.
5800 </para>
5801 </listitem></varlistentry>
5802 <varlistentry>
5803 <term><option>-Mt</option>&nbsp;&lt;<emphasis>message&nbsp;id</emphasis>&gt;&nbsp;&lt;<emphasis>message&nbsp;id</emphasis>&gt;&nbsp;...</term>
5804 <listitem>
5805 <para>
5806 <indexterm role="option">
5807 <primary><option>-Mt</option></primary>
5808 </indexterm>
5809 <indexterm role="concept">
5810 <primary>thawing messages</primary>
5811 </indexterm>
5812 <indexterm role="concept">
5813 <primary>unfreezing messages</primary>
5814 </indexterm>
5815 <indexterm role="concept">
5816 <primary>frozen messages</primary>
5817 <secondary>thawing</secondary>
5818 </indexterm>
5819 <indexterm role="concept">
5820 <primary>message</primary>
5821 <secondary>thawing frozen</secondary>
5822 </indexterm>
5823 This option requests Exim to <quote>thaw</quote> any of the listed messages that are
5824 <quote>frozen</quote>, so that delivery attempts can resume. However, if any of the
5825 messages are active, their status is not altered. This option can be used only
5826 by an admin user.
5827 </para>
5828 </listitem></varlistentry>
5829 <varlistentry>
5830 <term><option>-Mvb</option>&nbsp;&lt;<emphasis>message&nbsp;id</emphasis>&gt;</term>
5831 <listitem>
5832 <para>
5833 <indexterm role="option">
5834 <primary><option>-Mvb</option></primary>
5835 </indexterm>
5836 <indexterm role="concept">
5837 <primary>listing</primary>
5838 <secondary>message body</secondary>
5839 </indexterm>
5840 <indexterm role="concept">
5841 <primary>message</primary>
5842 <secondary>listing body of</secondary>
5843 </indexterm>
5844 This option causes the contents of the message body (-D) spool file to be
5845 written to the standard output. This option can be used only by an admin user.
5846 </para>
5847 </listitem></varlistentry>
5848 <varlistentry>
5849 <term><option>-Mvc</option>&nbsp;&lt;<emphasis>message&nbsp;id</emphasis>&gt;</term>
5850 <listitem>
5851 <para>
5852 <indexterm role="option">
5853 <primary><option>-Mvc</option></primary>
5854 </indexterm>
5855 <indexterm role="concept">
5856 <primary>message</primary>
5857 <secondary>listing in RFC 2822 format</secondary>
5858 </indexterm>
5859 <indexterm role="concept">
5860 <primary>listing</primary>
5861 <secondary>message in RFC 2822 format</secondary>
5862 </indexterm>
5863 This option causes a copy of the complete message (header lines plus body) to
5864 be written to the standard output in RFC 2822 format. This option can be used
5865 only by an admin user.
5866 </para>
5867 </listitem></varlistentry>
5868 <varlistentry>
5869 <term><option>-Mvh</option>&nbsp;&lt;<emphasis>message&nbsp;id</emphasis>&gt;</term>
5870 <listitem>
5871 <para>
5872 <indexterm role="option">
5873 <primary><option>-Mvh</option></primary>
5874 </indexterm>
5875 <indexterm role="concept">
5876 <primary>listing</primary>
5877 <secondary>message headers</secondary>
5878 </indexterm>
5879 <indexterm role="concept">
5880 <primary>header lines</primary>
5881 <secondary>listing</secondary>
5882 </indexterm>
5883 <indexterm role="concept">
5884 <primary>message</primary>
5885 <secondary>listing header lines</secondary>
5886 </indexterm>
5887 This option causes the contents of the message headers (-H) spool file to be
5888 written to the standard output. This option can be used only by an admin user.
5889 </para>
5890 </listitem></varlistentry>
5891 <varlistentry>
5892 <term><option>-Mvl</option>&nbsp;&lt;<emphasis>message&nbsp;id</emphasis>&gt;</term>
5893 <listitem>
5894 <para>
5895 <indexterm role="option">
5896 <primary><option>-Mvl</option></primary>
5897 </indexterm>
5898 <indexterm role="concept">
5899 <primary>listing</primary>
5900 <secondary>message log</secondary>
5901 </indexterm>
5902 <indexterm role="concept">
5903 <primary>message</primary>
5904 <secondary>listing message log</secondary>
5905 </indexterm>
5906 This option causes the contents of the message log spool file to be written to
5907 the standard output. This option can be used only by an admin user.
5908 </para>
5909 </listitem></varlistentry>
5910 <varlistentry>
5911 <term><option>-m</option></term>
5912 <listitem>
5913 <para>
5914 <indexterm role="option">
5915 <primary><option>-m</option></primary>
5916 </indexterm>
5917 This is apparently a synonym for <option>-om</option> that is accepted by Sendmail, so Exim
5918 treats it that way too.
5919 </para>
5920 </listitem></varlistentry>
5921 <varlistentry>
5922 <term><option>-N</option></term>
5923 <listitem>
5924 <para>
5925 <indexterm role="option">
5926 <primary><option>-N</option></primary>
5927 </indexterm>
5928 <indexterm role="concept">
5929 <primary>debugging</primary>
5930 <secondary><option>-N</option> option</secondary>
5931 </indexterm>
5932 <indexterm role="concept">
5933 <primary>debugging</primary>
5934 <secondary>suppressing delivery</secondary>
5935 </indexterm>
5936 This is a debugging option that inhibits delivery of a message at the transport
5937 level. It implies <option>-v</option>. Exim goes through many of the motions of delivery &ndash;
5938 it just doesn&#x2019;t actually transport the message, but instead behaves as if it
5939 had successfully done so. However, it does not make any updates to the retry
5940 database, and the log entries for deliveries are flagged with <quote>*&gt;</quote> rather
5941 than <quote>=&gt;</quote>.
5942 </para>
5943 <para>
5944 Because <option>-N</option> discards any message to which it applies, only root or the Exim
5945 user are allowed to use it with <option>-bd</option>, <option>-q</option>, <option>-R</option> or <option>-M</option>. In other
5946 words, an ordinary user can use it only when supplying an incoming message to
5947 which it will apply. Although transportation never fails when <option>-N</option> is set, an
5948 address may be deferred because of a configuration problem on a transport, or a
5949 routing problem. Once <option>-N</option> has been used for a delivery attempt, it sticks to
5950 the message, and applies to any subsequent delivery attempts that may happen
5951 for that message.
5952 </para>
5953 </listitem></varlistentry>
5954 <varlistentry>
5955 <term><option>-n</option></term>
5956 <listitem>
5957 <para>
5958 <indexterm role="option">
5959 <primary><option>-n</option></primary>
5960 </indexterm>
5961 This option is interpreted by Sendmail to mean <quote>no aliasing</quote>.
5962 For normal modes of operation, it is ignored by Exim.
5963 When combined with <option>-bP</option> it suppresses the name of an option from being output.
5964 </para>
5965 </listitem></varlistentry>
5966 <varlistentry>
5967 <term><option>-O</option>&nbsp;&lt;<emphasis>data</emphasis>&gt;</term>
5968 <listitem>
5969 <para>
5970 <indexterm role="option">
5971 <primary><option>-O</option></primary>
5972 </indexterm>
5973 This option is interpreted by Sendmail to mean <literal>set option</literal>. It is ignored by
5974 Exim.
5975 </para>
5976 </listitem></varlistentry>
5977 <varlistentry>
5978 <term><option>-oA</option>&nbsp;&lt;<emphasis>file&nbsp;name</emphasis>&gt;</term>
5979 <listitem>
5980 <para>
5981 <indexterm role="option">
5982 <primary><option>-oA</option></primary>
5983 </indexterm>
5984 <indexterm role="concept">
5985 <primary>Sendmail compatibility</primary>
5986 <secondary><option>-oA</option> option</secondary>
5987 </indexterm>
5988 This option is used by Sendmail in conjunction with <option>-bi</option> to specify an
5989 alternative alias file name. Exim handles <option>-bi</option> differently; see the
5990 description above.
5991 </para>
5992 </listitem></varlistentry>
5993 <varlistentry>
5994 <term><option>-oB</option>&nbsp;&lt;<emphasis>n</emphasis>&gt;</term>
5995 <listitem>
5996 <para>
5997 <indexterm role="option">
5998 <primary><option>-oB</option></primary>
5999 </indexterm>
6000 <indexterm role="concept">
6001 <primary>SMTP</primary>
6002 <secondary>passed connection</secondary>
6003 </indexterm>
6004 <indexterm role="concept">
6005 <primary>SMTP</primary>
6006 <secondary>multiple deliveries</secondary>
6007 </indexterm>
6008 <indexterm role="concept">
6009 <primary>multiple SMTP deliveries</primary>
6010 </indexterm>
6011 This is a debugging option which limits the maximum number of messages that can
6012 be delivered down one SMTP connection, overriding the value set in any <command>smtp</command>
6013 transport. If &lt;<emphasis>n</emphasis>&gt; is omitted, the limit is set to 1.
6014 </para>
6015 </listitem></varlistentry>
6016 <varlistentry>
6017 <term><option>-odb</option></term>
6018 <listitem>
6019 <para>
6020 <indexterm role="option">
6021 <primary><option>-odb</option></primary>
6022 </indexterm>
6023 <indexterm role="concept">
6024 <primary>background delivery</primary>
6025 </indexterm>
6026 <indexterm role="concept">
6027 <primary>delivery</primary>
6028 <secondary>in the background</secondary>
6029 </indexterm>
6030 This option applies to all modes in which Exim accepts incoming messages,
6031 including the listening daemon. It requests <quote>background</quote> delivery of such
6032 messages, which means that the accepting process automatically starts a
6033 delivery process for each message received, but does not wait for the delivery
6034 processes to finish.
6035 </para>
6036 <para>
6037 When all the messages have been received, the reception process exits,
6038 leaving the delivery processes to finish in their own time. The standard output
6039 and error streams are closed at the start of each delivery process.
6040 This is the default action if none of the <option>-od</option> options are present.
6041 </para>
6042 <para>
6043 If one of the queueing options in the configuration file
6044 (<option>queue_only</option> or <option>queue_only_file</option>, for example) is in effect, <option>-odb</option>
6045 overrides it if <option>queue_only_override</option> is set true, which is the default
6046 setting. If <option>queue_only_override</option> is set false, <option>-odb</option> has no effect.
6047 </para>
6048 </listitem></varlistentry>
6049 <varlistentry>
6050 <term><option>-odf</option></term>
6051 <listitem>
6052 <para>
6053 <indexterm role="option">
6054 <primary><option>-odf</option></primary>
6055 </indexterm>
6056 <indexterm role="concept">
6057 <primary>foreground delivery</primary>
6058 </indexterm>
6059 <indexterm role="concept">
6060 <primary>delivery</primary>
6061 <secondary>in the foreground</secondary>
6062 </indexterm>
6063 This option requests <quote>foreground</quote> (synchronous) delivery when Exim has
6064 accepted a locally-generated message. (For the daemon it is exactly the same as
6065 <option>-odb</option>.) A delivery process is automatically started to deliver the message,
6066 and Exim waits for it to complete before proceeding.
6067 </para>
6068 <para>
6069 The original Exim reception process does not finish until the delivery
6070 process for the final message has ended. The standard error stream is left open
6071 during deliveries.
6072 </para>
6073 <para>
6074 However, like <option>-odb</option>, this option has no effect if <option>queue_only_override</option> is
6075 false and one of the queueing options in the configuration file is in effect.
6076 </para>
6077 <para>
6078 If there is a temporary delivery error during foreground delivery, the
6079 message is left on the queue for later delivery, and the original reception
6080 process exits. See chapter <xref linkend="CHAPnonqueueing"/> for a way of setting up a
6081 restricted configuration that never queues messages.
6082 </para>
6083 </listitem></varlistentry>
6084 <varlistentry>
6085 <term><option>-odi</option></term>
6086 <listitem>
6087 <para>
6088 <indexterm role="option">
6089 <primary><option>-odi</option></primary>
6090 </indexterm>
6091 This option is synonymous with <option>-odf</option>. It is provided for compatibility with
6092 Sendmail.
6093 </para>
6094 </listitem></varlistentry>
6095 <varlistentry>
6096 <term><option>-odq</option></term>
6097 <listitem>
6098 <para>
6099 <indexterm role="option">
6100 <primary><option>-odq</option></primary>
6101 </indexterm>
6102 <indexterm role="concept">
6103 <primary>non-immediate delivery</primary>
6104 </indexterm>
6105 <indexterm role="concept">
6106 <primary>delivery</primary>
6107 <secondary>suppressing immediate</secondary>
6108 </indexterm>
6109 <indexterm role="concept">
6110 <primary>queueing incoming messages</primary>
6111 </indexterm>
6112 This option applies to all modes in which Exim accepts incoming messages,
6113 including the listening daemon. It specifies that the accepting process should
6114 not automatically start a delivery process for each message received. Messages
6115 are placed on the queue, and remain there until a subsequent queue runner
6116 process encounters them. There are several configuration options (such as
6117 <option>queue_only</option>) that can be used to queue incoming messages under certain
6118 conditions. This option overrides all of them and also <option>-odqs</option>. It always
6119 forces queueing.
6120 </para>
6121 </listitem></varlistentry>
6122 <varlistentry>
6123 <term><option>-odqs</option></term>
6124 <listitem>
6125 <para>
6126 <indexterm role="option">
6127 <primary><option>-odqs</option></primary>
6128 </indexterm>
6129 <indexterm role="concept">
6130 <primary>SMTP</primary>
6131 <secondary>delaying delivery</secondary>
6132 </indexterm>
6133 This option is a hybrid between <option>-odb</option>/<option>-odi</option> and <option>-odq</option>.
6134 However, like <option>-odb</option> and <option>-odi</option>, this option has no effect if
6135 <option>queue_only_override</option> is false and one of the queueing options in the
6136 configuration file is in effect.
6137 </para>
6138 <para>
6139 When <option>-odqs</option> does operate, a delivery process is started for each incoming
6140 message, in the background by default, but in the foreground if <option>-odi</option> is
6141 also present. The recipient addresses are routed, and local deliveries are done
6142 in the normal way. However, if any SMTP deliveries are required, they are not
6143 done at this time, so the message remains on the queue until a subsequent queue
6144 runner process encounters it. Because routing was done, Exim knows which
6145 messages are waiting for which hosts, and so a number of messages for the same
6146 host can be sent in a single SMTP connection. The <option>queue_smtp_domains</option>
6147 configuration option has the same effect for specific domains. See also the
6148 <option>-qq</option> option.
6149 </para>
6150 </listitem></varlistentry>
6151 <varlistentry>
6152 <term><option>-oee</option></term>
6153 <listitem>
6154 <para>
6155 <indexterm role="option">
6156 <primary><option>-oee</option></primary>
6157 </indexterm>
6158 <indexterm role="concept">
6159 <primary>error</primary>
6160 <secondary>reporting</secondary>
6161 </indexterm>
6162 If an error is detected while a non-SMTP message is being received (for
6163 example, a malformed address), the error is reported to the sender in a mail
6164 message.
6165 </para>
6166 <para>
6167 <indexterm role="concept">
6168 <primary>return code</primary>
6169 <secondary>for <option>-oee</option></secondary>
6170 </indexterm>
6171 Provided
6172 this error message is successfully sent, the Exim receiving process
6173 exits with a return code of zero. If not, the return code is 2 if the problem
6174 is that the original message has no recipients, or 1 for any other error.
6175 This is the default <option>-oe</option><emphasis>x</emphasis> option if Exim is called as <emphasis>rmail</emphasis>.
6176 </para>
6177 </listitem></varlistentry>
6178 <varlistentry>
6179 <term><option>-oem</option></term>
6180 <listitem>
6181 <para>
6182 <indexterm role="option">
6183 <primary><option>-oem</option></primary>
6184 </indexterm>
6185 <indexterm role="concept">
6186 <primary>error</primary>
6187 <secondary>reporting</secondary>
6188 </indexterm>
6189 <indexterm role="concept">
6190 <primary>return code</primary>
6191 <secondary>for <option>-oem</option></secondary>
6192 </indexterm>
6193 This is the same as <option>-oee</option>, except that Exim always exits with a non-zero
6194 return code, whether or not the error message was successfully sent.
6195 This is the default <option>-oe</option><emphasis>x</emphasis> option, unless Exim is called as <emphasis>rmail</emphasis>.
6196 </para>
6197 </listitem></varlistentry>
6198 <varlistentry>
6199 <term><option>-oep</option></term>
6200 <listitem>
6201 <para>
6202 <indexterm role="option">
6203 <primary><option>-oep</option></primary>
6204 </indexterm>
6205 <indexterm role="concept">
6206 <primary>error</primary>
6207 <secondary>reporting</secondary>
6208 </indexterm>
6209 If an error is detected while a non-SMTP message is being received, the
6210 error is reported by writing a message to the standard error file (stderr).
6211 <indexterm role="concept">
6212 <primary>return code</primary>
6213 <secondary>for <option>-oep</option></secondary>
6214 </indexterm>
6215 The return code is 1 for all errors.
6216 </para>
6217 </listitem></varlistentry>
6218 <varlistentry>
6219 <term><option>-oeq</option></term>
6220 <listitem>
6221 <para>
6222 <indexterm role="option">
6223 <primary><option>-oeq</option></primary>
6224 </indexterm>
6225 <indexterm role="concept">
6226 <primary>error</primary>
6227 <secondary>reporting</secondary>
6228 </indexterm>
6229 This option is supported for compatibility with Sendmail, but has the same
6230 effect as <option>-oep</option>.
6231 </para>
6232 </listitem></varlistentry>
6233 <varlistentry>
6234 <term><option>-oew</option></term>
6235 <listitem>
6236 <para>
6237 <indexterm role="option">
6238 <primary><option>-oew</option></primary>
6239 </indexterm>
6240 <indexterm role="concept">
6241 <primary>error</primary>
6242 <secondary>reporting</secondary>
6243 </indexterm>
6244 This option is supported for compatibility with Sendmail, but has the same
6245 effect as <option>-oem</option>.
6246 </para>
6247 </listitem></varlistentry>
6248 <varlistentry>
6249 <term><option>-oi</option></term>
6250 <listitem>
6251 <para>
6252 <indexterm role="option">
6253 <primary><option>-oi</option></primary>
6254 </indexterm>
6255 <indexterm role="concept">
6256 <primary>dot</primary>
6257 <secondary>in incoming non-SMTP message</secondary>
6258 </indexterm>
6259 This option, which has the same effect as <option>-i</option>, specifies that a dot on a
6260 line by itself should not terminate an incoming, non-SMTP message. Otherwise, a
6261 single dot does terminate, though Exim does no special processing for other
6262 lines that start with a dot. This option is set by default if Exim is called as
6263 <emphasis>rmail</emphasis>. See also <option>-ti</option>.
6264 </para>
6265 </listitem></varlistentry>
6266 <varlistentry>
6267 <term><option>-oitrue</option></term>
6268 <listitem>
6269 <para>
6270 <indexterm role="option">
6271 <primary><option>-oitrue</option></primary>
6272 </indexterm>
6273 This option is treated as synonymous with <option>-oi</option>.
6274 </para>
6275 </listitem></varlistentry>
6276 <varlistentry>
6277 <term><option>-oMa</option>&nbsp;&lt;<emphasis>host&nbsp;address</emphasis>&gt;</term>
6278 <listitem>
6279 <para>
6280 <indexterm role="option">
6281 <primary><option>-oMa</option></primary>
6282 </indexterm>
6283 <indexterm role="concept">
6284 <primary>sender</primary>
6285 <secondary>host address, specifying for local message</secondary>
6286 </indexterm>
6287 A number of options starting with <option>-oM</option> can be used to set values associated
6288 with remote hosts on locally-submitted messages (that is, messages not received
6289 over TCP/IP). These options can be used by any caller in conjunction with the
6290 <option>-bh</option>, <option>-be</option>, <option>-bf</option>, <option>-bF</option>, <option>-bt</option>, or <option>-bv</option> testing options. In
6291 other circumstances, they are ignored unless the caller is trusted.
6292 </para>
6293 <para>
6294 The <option>-oMa</option> option sets the sender host address. This may include a port
6295 number at the end, after a full stop (period). For example:
6296 </para>
6297 <literallayout class="monospaced">
6298 exim -bs -oMa 10.9.8.7.1234
6299 </literallayout>
6300 <para>
6301 An alternative syntax is to enclose the IP address in square brackets,
6302 followed by a colon and the port number:
6303 </para>
6304 <literallayout class="monospaced">
6305 exim -bs -oMa [10.9.8.7]:1234
6306 </literallayout>
6307 <para>
6308 The IP address is placed in the <varname>$sender_host_address</varname> variable, and the
6309 port, if present, in <varname>$sender_host_port</varname>. If both <option>-oMa</option> and <option>-bh</option>
6310 are present on the command line, the sender host IP address is taken from
6311 whichever one is last.
6312 </para>
6313 </listitem></varlistentry>
6314 <varlistentry>
6315 <term><option>-oMaa</option>&nbsp;&lt;<emphasis>name</emphasis>&gt;</term>
6316 <listitem>
6317 <para>
6318 <indexterm role="option">
6319 <primary><option>-oMaa</option></primary>
6320 </indexterm>
6321 <indexterm role="concept">
6322 <primary>authentication</primary>
6323 <secondary>name, specifying for local message</secondary>
6324 </indexterm>
6325 See <option>-oMa</option> above for general remarks about the <option>-oM</option> options. The <option>-oMaa</option>
6326 option sets the value of <varname>$sender_host_authenticated</varname> (the authenticator
6327 name). See chapter <xref linkend="CHAPSMTPAUTH"/> for a discussion of SMTP authentication.
6328 This option can be used with <option>-bh</option> and <option>-bs</option> to set up an
6329 authenticated SMTP session without actually using the SMTP AUTH command.
6330 </para>
6331 </listitem></varlistentry>
6332 <varlistentry>
6333 <term><option>-oMai</option>&nbsp;&lt;<emphasis>string</emphasis>&gt;</term>
6334 <listitem>
6335 <para>
6336 <indexterm role="option">
6337 <primary><option>-oMai</option></primary>
6338 </indexterm>
6339 <indexterm role="concept">
6340 <primary>authentication</primary>
6341 <secondary>id, specifying for local message</secondary>
6342 </indexterm>
6343 See <option>-oMa</option> above for general remarks about the <option>-oM</option> options. The <option>-oMai</option>
6344 option sets the value of <varname>$authenticated_id</varname> (the id that was authenticated).
6345 This overrides the default value (the caller&#x2019;s login id, except with <option>-bh</option>,
6346 where there is no default) for messages from local sources. See chapter
6347 <xref linkend="CHAPSMTPAUTH"/> for a discussion of authenticated ids.
6348 </para>
6349 </listitem></varlistentry>
6350 <varlistentry>
6351 <term><option>-oMas</option>&nbsp;&lt;<emphasis>address</emphasis>&gt;</term>
6352 <listitem>
6353 <para>
6354 <indexterm role="option">
6355 <primary><option>-oMas</option></primary>
6356 </indexterm>
6357 <indexterm role="concept">
6358 <primary>authentication</primary>
6359 <secondary>sender, specifying for local message</secondary>
6360 </indexterm>
6361 See <option>-oMa</option> above for general remarks about the <option>-oM</option> options. The <option>-oMas</option>
6362 option sets the authenticated sender value in <varname>$authenticated_sender</varname>. It
6363 overrides the sender address that is created from the caller&#x2019;s login id for
6364 messages from local sources, except when <option>-bh</option> is used, when there is no
6365 default. For both <option>-bh</option> and <option>-bs</option>, an authenticated sender that is
6366 specified on a MAIL command overrides this value. See chapter
6367 <xref linkend="CHAPSMTPAUTH"/> for a discussion of authenticated senders.
6368 </para>
6369 </listitem></varlistentry>
6370 <varlistentry>
6371 <term><option>-oMi</option>&nbsp;&lt;<emphasis>interface&nbsp;address</emphasis>&gt;</term>
6372 <listitem>
6373 <para>
6374 <indexterm role="option">
6375 <primary><option>-oMi</option></primary>
6376 </indexterm>
6377 <indexterm role="concept">
6378 <primary>interface</primary>
6379 <secondary>address, specifying for local message</secondary>
6380 </indexterm>
6381 See <option>-oMa</option> above for general remarks about the <option>-oM</option> options. The <option>-oMi</option>
6382 option sets the IP interface address value. A port number may be included,
6383 using the same syntax as for <option>-oMa</option>. The interface address is placed in
6384 <varname>$received_ip_address</varname> and the port number, if present, in <varname>$received_port</varname>.
6385 </para>
6386 </listitem></varlistentry>
6387 <varlistentry>
6388 <term><option>-oMm</option>&nbsp;&lt;<emphasis>message&nbsp;reference</emphasis>&gt;</term>
6389 <listitem>
6390 <para>
6391 <indexterm role="option">
6392 <primary><option>-oMm</option></primary>
6393 </indexterm>
6394 <indexterm role="concept">
6395 <primary>message reference</primary>
6396 <secondary>message reference, specifying for local message</secondary>
6397 </indexterm>
6398 See <option>-oMa</option> above for general remarks about the <option>-oM</option> options. The <option>-oMm</option>
6399 option sets the message reference, e.g. message-id, and is logged during
6400 delivery. This is useful when some kind of audit trail is required to tie
6401 messages together. The format of the message reference is checked and will
6402 abort if the format is invalid. The option will only be accepted if exim is
6403 running in trusted mode, not as any regular user.
6404 </para>
6405 <para>
6406 The best example of a message reference is when Exim sends a bounce message.
6407 The message reference is the message-id of the original message for which Exim
6408 is sending the bounce.
6409 </para>
6410 </listitem></varlistentry>
6411 <varlistentry>
6412 <term><option>-oMr</option>&nbsp;&lt;<emphasis>protocol&nbsp;name</emphasis>&gt;</term>
6413 <listitem>
6414 <para>
6415 <indexterm role="option">
6416 <primary><option>-oMr</option></primary>
6417 </indexterm>
6418 <indexterm role="concept">
6419 <primary>protocol, specifying for local message</primary>
6420 </indexterm>
6421 <indexterm role="variable">
6422 <primary><varname>$received_protocol</varname></primary>
6423 </indexterm>
6424 See <option>-oMa</option> above for general remarks about the <option>-oM</option> options. The <option>-oMr</option>
6425 option sets the received protocol value that is stored in
6426 <varname>$received_protocol</varname>. However, it does not apply (and is ignored) when <option>-bh</option>
6427 or <option>-bs</option> is used. For <option>-bh</option>, the protocol is forced to one of the standard
6428 SMTP protocol names (see the description of <varname>$received_protocol</varname> in section
6429 <xref linkend="SECTexpvar"/>). For <option>-bs</option>, the protocol is always <quote>local-</quote> followed by
6430 one of those same names. For <option>-bS</option> (batched SMTP) however, the protocol can
6431 be set by <option>-oMr</option>.
6432 </para>
6433 </listitem></varlistentry>
6434 <varlistentry>
6435 <term><option>-oMs</option>&nbsp;&lt;<emphasis>host&nbsp;name</emphasis>&gt;</term>
6436 <listitem>
6437 <para>
6438 <indexterm role="option">
6439 <primary><option>-oMs</option></primary>
6440 </indexterm>
6441 <indexterm role="concept">
6442 <primary>sender</primary>
6443 <secondary>host name, specifying for local message</secondary>
6444 </indexterm>
6445 See <option>-oMa</option> above for general remarks about the <option>-oM</option> options. The <option>-oMs</option>
6446 option sets the sender host name in <varname>$sender_host_name</varname>. When this option is
6447 present, Exim does not attempt to look up a host name from an IP address; it
6448 uses the name it is given.
6449 </para>
6450 </listitem></varlistentry>
6451 <varlistentry>
6452 <term><option>-oMt</option>&nbsp;&lt;<emphasis>ident&nbsp;string</emphasis>&gt;</term>
6453 <listitem>
6454 <para>
6455 <indexterm role="option">
6456 <primary><option>-oMt</option></primary>
6457 </indexterm>
6458 <indexterm role="concept">
6459 <primary>sender</primary>
6460 <secondary>ident string, specifying for local message</secondary>
6461 </indexterm>
6462 See <option>-oMa</option> above for general remarks about the <option>-oM</option> options. The <option>-oMt</option>
6463 option sets the sender ident value in <varname>$sender_ident</varname>. The default setting for
6464 local callers is the login id of the calling process, except when <option>-bh</option> is
6465 used, when there is no default.
6466 </para>
6467 </listitem></varlistentry>
6468 <varlistentry>
6469 <term><option>-om</option></term>
6470 <listitem>
6471 <para>
6472 <indexterm role="option">
6473 <primary><option>-om</option></primary>
6474 </indexterm>
6475 <indexterm role="concept">
6476 <primary>Sendmail compatibility</primary>
6477 <secondary><option>-om</option> option ignored</secondary>
6478 </indexterm>
6479 In Sendmail, this option means <quote>me too</quote>, indicating that the sender of a
6480 message should receive a copy of the message if the sender appears in an alias
6481 expansion. Exim always does this, so the option does nothing.
6482 </para>
6483 </listitem></varlistentry>
6484 <varlistentry>
6485 <term><option>-oo</option></term>
6486 <listitem>
6487 <para>
6488 <indexterm role="option">
6489 <primary><option>-oo</option></primary>
6490 </indexterm>
6491 <indexterm role="concept">
6492 <primary>Sendmail compatibility</primary>
6493 <secondary><option>-oo</option> option ignored</secondary>
6494 </indexterm>
6495 This option is ignored. In Sendmail it specifies <quote>old style headers</quote>,
6496 whatever that means.
6497 </para>
6498 </listitem></varlistentry>
6499 <varlistentry>
6500 <term><option>-oP</option>&nbsp;&lt;<emphasis>path</emphasis>&gt;</term>
6501 <listitem>
6502 <para>
6503 <indexterm role="option">
6504 <primary><option>-oP</option></primary>
6505 </indexterm>
6506 <indexterm role="concept">
6507 <primary>pid (process id)</primary>
6508 <secondary>of daemon</secondary>
6509 </indexterm>
6510 <indexterm role="concept">
6511 <primary>daemon</primary>
6512 <secondary>process id (pid)</secondary>
6513 </indexterm>
6514 This option is useful only in conjunction with <option>-bd</option> or <option>-q</option> with a time
6515 value. The option specifies the file to which the process id of the daemon is
6516 written. When <option>-oX</option> is used with <option>-bd</option>, or when <option>-q</option> with a time is used
6517 without <option>-bd</option>, this is the only way of causing Exim to write a pid file,
6518 because in those cases, the normal pid file is not used.
6519 </para>
6520 </listitem></varlistentry>
6521 <varlistentry>
6522 <term><option>-or</option>&nbsp;&lt;<emphasis>time</emphasis>&gt;</term>
6523 <listitem>
6524 <para>
6525 <indexterm role="option">
6526 <primary><option>-or</option></primary>
6527 </indexterm>
6528 <indexterm role="concept">
6529 <primary>timeout</primary>
6530 <secondary>for non-SMTP input</secondary>
6531 </indexterm>
6532 This option sets a timeout value for incoming non-SMTP messages. If it is not
6533 set, Exim will wait forever for the standard input. The value can also be set
6534 by the <option>receive_timeout</option> option. The format used for specifying times is
6535 described in section <xref linkend="SECTtimeformat"/>.
6536 </para>
6537 </listitem></varlistentry>
6538 <varlistentry>
6539 <term><option>-os</option>&nbsp;&lt;<emphasis>time</emphasis>&gt;</term>
6540 <listitem>
6541 <para>
6542 <indexterm role="option">
6543 <primary><option>-os</option></primary>
6544 </indexterm>
6545 <indexterm role="concept">
6546 <primary>timeout</primary>
6547 <secondary>for SMTP input</secondary>
6548 </indexterm>
6549 <indexterm role="concept">
6550 <primary>SMTP</primary>
6551 <secondary>input timeout</secondary>
6552 </indexterm>
6553 This option sets a timeout value for incoming SMTP messages. The timeout
6554 applies to each SMTP command and block of data. The value can also be set by
6555 the <option>smtp_receive_timeout</option> option; it defaults to 5 minutes. The format used
6556 for specifying times is described in section <xref linkend="SECTtimeformat"/>.
6557 </para>
6558 </listitem></varlistentry>
6559 <varlistentry>
6560 <term><option>-ov</option></term>
6561 <listitem>
6562 <para>
6563 <indexterm role="option">
6564 <primary><option>-ov</option></primary>
6565 </indexterm>
6566 This option has exactly the same effect as <option>-v</option>.
6567 </para>
6568 </listitem></varlistentry>
6569 <varlistentry>
6570 <term><option>-oX</option>&nbsp;&lt;<emphasis>number&nbsp;or&nbsp;string</emphasis>&gt;</term>
6571 <listitem>
6572 <para>
6573 <indexterm role="option">
6574 <primary><option>-oX</option></primary>
6575 </indexterm>
6576 <indexterm role="concept">
6577 <primary>TCP/IP</primary>
6578 <secondary>setting listening ports</secondary>
6579 </indexterm>
6580 <indexterm role="concept">
6581 <primary>TCP/IP</primary>
6582 <secondary>setting listening interfaces</secondary>
6583 </indexterm>
6584 <indexterm role="concept">
6585 <primary>port</primary>
6586 <secondary>receiving TCP/IP</secondary>
6587 </indexterm>
6588 This option is relevant only when the <option>-bd</option> (start listening daemon) option
6589 is also given. It controls which ports and interfaces the daemon uses. Details
6590 of the syntax, and how it interacts with configuration file options, are given
6591 in chapter <xref linkend="CHAPinterfaces"/>. When <option>-oX</option> is used to start a daemon, no pid
6592 file is written unless <option>-oP</option> is also present to specify a pid file name.
6593 </para>
6594 </listitem></varlistentry>
6595 <varlistentry>
6596 <term><option>-pd</option></term>
6597 <listitem>
6598 <para>
6599 <indexterm role="option">
6600 <primary><option>-pd</option></primary>
6601 </indexterm>
6602 <indexterm role="concept">
6603 <primary>Perl</primary>
6604 <secondary>starting the interpreter</secondary>
6605 </indexterm>
6606 This option applies when an embedded Perl interpreter is linked with Exim (see
6607 chapter <xref linkend="CHAPperl"/>). It overrides the setting of the <option>perl_at_start</option>
6608 option, forcing the starting of the interpreter to be delayed until it is
6609 needed.
6610 </para>
6611 </listitem></varlistentry>
6612 <varlistentry>
6613 <term><option>-ps</option></term>
6614 <listitem>
6615 <para>
6616 <indexterm role="option">
6617 <primary><option>-ps</option></primary>
6618 </indexterm>
6619 <indexterm role="concept">
6620 <primary>Perl</primary>
6621 <secondary>starting the interpreter</secondary>
6622 </indexterm>
6623 This option applies when an embedded Perl interpreter is linked with Exim (see
6624 chapter <xref linkend="CHAPperl"/>). It overrides the setting of the <option>perl_at_start</option>
6625 option, forcing the starting of the interpreter to occur as soon as Exim is
6626 started.
6627 </para>
6628 </listitem></varlistentry>
6629 <varlistentry>
6630 <term><option>-p</option>&lt;<emphasis>rval</emphasis>&gt;:&lt;<emphasis>sval</emphasis>&gt;</term>
6631 <listitem>
6632 <para>
6633 <indexterm role="option">
6634 <primary><option>-p</option></primary>
6635 </indexterm>
6636 For compatibility with Sendmail, this option is equivalent to
6637 </para>
6638 <literallayout>
6639 <literal>-oMr</literal> &lt;<emphasis>rval</emphasis>&gt; <literal>-oMs</literal> &lt;<emphasis>sval</emphasis>&gt;
6640 </literallayout>
6641 <para>
6642 It sets the incoming protocol and host name (for trusted callers). The
6643 host name and its colon can be omitted when only the protocol is to be set.
6644 Note the Exim already has two private options, <option>-pd</option> and <option>-ps</option>, that refer
6645 to embedded Perl. It is therefore impossible to set a protocol value of <literal>d</literal>
6646 or <literal>s</literal> using this option (but that does not seem a real limitation).
6647 </para>
6648 </listitem></varlistentry>
6649 <varlistentry>
6650 <term><option>-q</option></term>
6651 <listitem>
6652 <para>
6653 <indexterm role="option">
6654 <primary><option>-q</option></primary>
6655 </indexterm>
6656 <indexterm role="concept">
6657 <primary>queue runner</primary>
6658 <secondary>starting manually</secondary>
6659 </indexterm>
6660 This option is normally restricted to admin users. However, there is a
6661 configuration option called <option>prod_requires_admin</option> which can be set false to
6662 relax this restriction (and also the same requirement for the <option>-M</option>, <option>-R</option>,
6663 and <option>-S</option> options).
6664 </para>
6665 <para>
6666 <indexterm role="concept">
6667 <primary>queue runner</primary>
6668 <secondary>description of operation</secondary>
6669 </indexterm>
6670 The <option>-q</option> option starts one queue runner process. This scans the queue of
6671 waiting messages, and runs a delivery process for each one in turn. It waits
6672 for each delivery process to finish before starting the next one. A delivery
6673 process may not actually do any deliveries if the retry times for the addresses
6674 have not been reached. Use <option>-qf</option> (see below) if you want to override this.
6675 </para>
6676 <para>
6677 If
6678 <indexterm role="concept">
6679 <primary>SMTP</primary>
6680 <secondary>passed connection</secondary>
6681 </indexterm>
6682 <indexterm role="concept">
6683 <primary>SMTP</primary>
6684 <secondary>multiple deliveries</secondary>
6685 </indexterm>
6686 <indexterm role="concept">
6687 <primary>multiple SMTP deliveries</primary>
6688 </indexterm>
6689 the delivery process spawns other processes to deliver other messages down
6690 passed SMTP connections, the queue runner waits for these to finish before
6691 proceeding.
6692 </para>
6693 <para>
6694 When all the queued messages have been considered, the original queue runner
6695 process terminates. In other words, a single pass is made over the waiting
6696 mail, one message at a time. Use <option>-q</option> with a time (see below) if you want
6697 this to be repeated periodically.
6698 </para>
6699 <para>
6700 Exim processes the waiting messages in an unpredictable order. It isn&#x2019;t very
6701 random, but it is likely to be different each time, which is all that matters.
6702 If one particular message screws up a remote MTA, other messages to the same
6703 MTA have a chance of getting through if they get tried first.
6704 </para>
6705 <para>
6706 It is possible to cause the messages to be processed in lexical message id
6707 order, which is essentially the order in which they arrived, by setting the
6708 <option>queue_run_in_order</option> option, but this is not recommended for normal use.
6709 </para>
6710 </listitem></varlistentry>
6711 <varlistentry>
6712 <term><option>-q</option>&lt;<emphasis>qflags</emphasis>&gt;</term>
6713 <listitem>
6714 <para>
6715 The <option>-q</option> option may be followed by one or more flag letters that change its
6716 behaviour. They are all optional, but if more than one is present, they must
6717 appear in the correct order. Each flag is described in a separate item below.
6718 </para>
6719 </listitem></varlistentry>
6720 <varlistentry>
6721 <term><option>-qq...</option></term>
6722 <listitem>
6723 <para>
6724 <indexterm role="option">
6725 <primary><option>-qq</option></primary>
6726 </indexterm>
6727 <indexterm role="concept">
6728 <primary>queue</primary>
6729 <secondary>double scanning</secondary>
6730 </indexterm>
6731 <indexterm role="concept">
6732 <primary>queue</primary>
6733 <secondary>routing</secondary>
6734 </indexterm>
6735 <indexterm role="concept">
6736 <primary>routing</primary>
6737 <secondary>whole queue before delivery</secondary>
6738 </indexterm>
6739 An option starting with <option>-qq</option> requests a two-stage queue run. In the first
6740 stage, the queue is scanned as if the <option>queue_smtp_domains</option> option matched
6741 every domain. Addresses are routed, local deliveries happen, but no remote
6742 transports are run.
6743 </para>
6744 <para>
6745 <indexterm role="concept">
6746 <primary>hints database</primary>
6747 <secondary>remembering routing</secondary>
6748 </indexterm>
6749 The hints database that remembers which messages are waiting for specific hosts
6750 is updated, as if delivery to those hosts had been deferred. After this is
6751 complete, a second, normal queue scan happens, with routing and delivery taking
6752 place as normal. Messages that are routed to the same host should mostly be
6753 delivered down a single SMTP
6754 <indexterm role="concept">
6755 <primary>SMTP</primary>
6756 <secondary>passed connection</secondary>
6757 </indexterm>
6758 <indexterm role="concept">
6759 <primary>SMTP</primary>
6760 <secondary>multiple deliveries</secondary>
6761 </indexterm>
6762 <indexterm role="concept">
6763 <primary>multiple SMTP deliveries</primary>
6764 </indexterm>
6765 connection because of the hints that were set up during the first queue scan.
6766 This option may be useful for hosts that are connected to the Internet
6767 intermittently.
6768 </para>
6769 </listitem></varlistentry>
6770 <varlistentry>
6771 <term><option>-q[q]i...</option></term>
6772 <listitem>
6773 <para>
6774 <indexterm role="option">
6775 <primary><option>-qi</option></primary>
6776 </indexterm>
6777 <indexterm role="concept">
6778 <primary>queue</primary>
6779 <secondary>initial delivery</secondary>
6780 </indexterm>
6781 If the <emphasis>i</emphasis> flag is present, the queue runner runs delivery processes only for
6782 those messages that haven&#x2019;t previously been tried. (<emphasis>i</emphasis> stands for <quote>initial
6783 delivery</quote>.) This can be helpful if you are putting messages on the queue using
6784 <option>-odq</option> and want a queue runner just to process the new messages.
6785 </para>
6786 </listitem></varlistentry>
6787 <varlistentry>
6788 <term><option>-q[q][i]f...</option></term>
6789 <listitem>
6790 <para>
6791 <indexterm role="option">
6792 <primary><option>-qf</option></primary>
6793 </indexterm>
6794 <indexterm role="concept">
6795 <primary>queue</primary>
6796 <secondary>forcing delivery</secondary>
6797 </indexterm>
6798 <indexterm role="concept">
6799 <primary>delivery</primary>
6800 <secondary>forcing in queue run</secondary>
6801 </indexterm>
6802 If one <emphasis>f</emphasis> flag is present, a delivery attempt is forced for each non-frozen
6803 message, whereas without <emphasis>f</emphasis> only those non-frozen addresses that have passed
6804 their retry times are tried.
6805 </para>
6806 </listitem></varlistentry>
6807 <varlistentry>
6808 <term><option>-q[q][i]ff...</option></term>
6809 <listitem>
6810 <para>
6811 <indexterm role="option">
6812 <primary><option>-qff</option></primary>
6813 </indexterm>
6814 <indexterm role="concept">
6815 <primary>frozen messages</primary>
6816 <secondary>forcing delivery</secondary>
6817 </indexterm>
6818 If <emphasis>ff</emphasis> is present, a delivery attempt is forced for every message, whether
6819 frozen or not.
6820 </para>
6821 </listitem></varlistentry>
6822 <varlistentry>
6823 <term><option>-q[q][i][f[f]]l</option></term>
6824 <listitem>
6825 <para>
6826 <indexterm role="option">
6827 <primary><option>-ql</option></primary>
6828 </indexterm>
6829 <indexterm role="concept">
6830 <primary>queue</primary>
6831 <secondary>local deliveries only</secondary>
6832 </indexterm>
6833 The <emphasis>l</emphasis> (the letter <quote>ell</quote>) flag specifies that only local deliveries are to
6834 be done. If a message requires any remote deliveries, it remains on the queue
6835 for later delivery.
6836 </para>
6837 </listitem></varlistentry>
6838 <varlistentry>
6839 <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>
6840 <listitem>
6841 <para>
6842 <indexterm role="concept">
6843 <primary>queue</primary>
6844 <secondary>delivering specific messages</secondary>
6845 </indexterm>
6846 When scanning the queue, Exim can be made to skip over messages whose ids are
6847 lexically less than a given value by following the <option>-q</option> option with a
6848 starting message id. For example:
6849 </para>
6850 <literallayout class="monospaced">
6851 exim -q 0t5C6f-0000c8-00
6852 </literallayout>
6853 <para>
6854 Messages that arrived earlier than <literal>0t5C6f-0000c8-00</literal> are not inspected. If a
6855 second message id is given, messages whose ids are lexically greater than it
6856 are also skipped. If the same id is given twice, for example,
6857 </para>
6858 <literallayout class="monospaced">
6859 exim -q 0t5C6f-0000c8-00 0t5C6f-0000c8-00
6860 </literallayout>
6861 <para>
6862 just one delivery process is started, for that message. This differs from
6863 <option>-M</option> in that retry data is respected, and it also differs from <option>-Mc</option> in
6864 that it counts as a delivery from a queue run. Note that the selection
6865 mechanism does not affect the order in which the messages are scanned. There
6866 are also other ways of selecting specific sets of messages for delivery in a
6867 queue run &ndash; see <option>-R</option> and <option>-S</option>.
6868 </para>
6869 </listitem></varlistentry>
6870 <varlistentry>
6871 <term><option>-q</option>&lt;<emphasis>qflags</emphasis>&gt;&lt;<emphasis>time</emphasis>&gt;</term>
6872 <listitem>
6873 <para>
6874 <indexterm role="concept">
6875 <primary>queue runner</primary>
6876 <secondary>starting periodically</secondary>
6877 </indexterm>
6878 <indexterm role="concept">
6879 <primary>periodic queue running</primary>
6880 </indexterm>
6881 When a time value is present, the <option>-q</option> option causes Exim to run as a daemon,
6882 starting a queue runner process at intervals specified by the given time value
6883 (whose format is described in section <xref linkend="SECTtimeformat"/>). This form of the
6884 <option>-q</option> option is commonly combined with the <option>-bd</option> option, in which case a
6885 single daemon process handles both functions. A common way of starting up a
6886 combined daemon at system boot time is to use a command such as
6887 </para>
6888 <literallayout class="monospaced">
6889 /usr/exim/bin/exim -bd -q30m
6890 </literallayout>
6891 <para>
6892 Such a daemon listens for incoming SMTP calls, and also starts a queue runner
6893 process every 30 minutes.
6894 </para>
6895 <para>
6896 When a daemon is started by <option>-q</option> with a time value, but without <option>-bd</option>, no
6897 pid file is written unless one is explicitly requested by the <option>-oP</option> option.
6898 </para>
6899 </listitem></varlistentry>
6900 <varlistentry>
6901 <term><option>-qR</option>&lt;<emphasis>rsflags</emphasis>&gt;&nbsp;&lt;<emphasis>string</emphasis>&gt;</term>
6902 <listitem>
6903 <para>
6904 <indexterm role="option">
6905 <primary><option>-qR</option></primary>
6906 </indexterm>
6907 This option is synonymous with <option>-R</option>. It is provided for Sendmail
6908 compatibility.
6909 </para>
6910 </listitem></varlistentry>
6911 <varlistentry>
6912 <term><option>-qS</option>&lt;<emphasis>rsflags</emphasis>&gt;&nbsp;&lt;<emphasis>string</emphasis>&gt;</term>
6913 <listitem>
6914 <para>
6915 <indexterm role="option">
6916 <primary><option>-qS</option></primary>
6917 </indexterm>
6918 This option is synonymous with <option>-S</option>.
6919 </para>
6920 </listitem></varlistentry>
6921 <varlistentry>
6922 <term><option>-R</option>&lt;<emphasis>rsflags</emphasis>&gt;&nbsp;&lt;<emphasis>string</emphasis>&gt;</term>
6923 <listitem>
6924 <para>
6925 <indexterm role="option">
6926 <primary><option>-R</option></primary>
6927 </indexterm>
6928 <indexterm role="concept">
6929 <primary>queue runner</primary>
6930 <secondary>for specific recipients</secondary>
6931 </indexterm>
6932 <indexterm role="concept">
6933 <primary>delivery</primary>
6934 <secondary>to given domain</secondary>
6935 </indexterm>
6936 <indexterm role="concept">
6937 <primary>domain</primary>
6938 <secondary>delivery to</secondary>
6939 </indexterm>
6940 The &lt;<emphasis>rsflags</emphasis>&gt; may be empty, in which case the white space before the string
6941 is optional, unless the string is <emphasis>f</emphasis>, <emphasis>ff</emphasis>, <emphasis>r</emphasis>, <emphasis>rf</emphasis>, or <emphasis>rff</emphasis>,
6942 which are the possible values for &lt;<emphasis>rsflags</emphasis>&gt;. White space is required if
6943 &lt;<emphasis>rsflags</emphasis>&gt; is not empty.
6944 </para>
6945 <para>
6946 This option is similar to <option>-q</option> with no time value, that is, it causes Exim to
6947 perform a single queue run, except that, when scanning the messages on the
6948 queue, Exim processes only those that have at least one undelivered recipient
6949 address containing the given string, which is checked in a case-independent
6950 way. If the &lt;<emphasis>rsflags</emphasis>&gt; start with <emphasis>r</emphasis>, &lt;<emphasis>string</emphasis>&gt; is interpreted as a
6951 regular expression; otherwise it is a literal string.
6952 </para>
6953 <para>
6954 If you want to do periodic queue runs for messages with specific recipients,
6955 you can combine <option>-R</option> with <option>-q</option> and a time value. For example:
6956 </para>
6957 <literallayout class="monospaced">
6958 exim -q25m -R @special.domain.example
6959 </literallayout>
6960 <para>
6961 This example does a queue run for messages with recipients in the given domain
6962 every 25 minutes. Any additional flags that are specified with <option>-q</option> are
6963 applied to each queue run.
6964 </para>
6965 <para>
6966 Once a message is selected for delivery by this mechanism, all its addresses
6967 are processed. For the first selected message, Exim overrides any retry
6968 information and forces a delivery attempt for each undelivered address. This
6969 means that if delivery of any address in the first message is successful, any
6970 existing retry information is deleted, and so delivery attempts for that
6971 address in subsequently selected messages (which are processed without forcing)
6972 will run. However, if delivery of any address does not succeed, the retry
6973 information is updated, and in subsequently selected messages, the failing
6974 address will be skipped.
6975 </para>
6976 <para>
6977 <indexterm role="concept">
6978 <primary>frozen messages</primary>
6979 <secondary>forcing delivery</secondary>
6980 </indexterm>
6981 If the &lt;<emphasis>rsflags</emphasis>&gt; contain <emphasis>f</emphasis> or <emphasis>ff</emphasis>, the delivery forcing applies to
6982 all selected messages, not just the first; frozen messages are included when
6983 <emphasis>ff</emphasis> is present.
6984 </para>
6985 <para>
6986 The <option>-R</option> option makes it straightforward to initiate delivery of all messages
6987 to a given domain after a host has been down for some time. When the SMTP
6988 command ETRN is accepted by its ACL (see chapter <xref linkend="CHAPACL"/>), its default
6989 effect is to run Exim with the <option>-R</option> option, but it can be configured to run
6990 an arbitrary command instead.
6991 </para>
6992 </listitem></varlistentry>
6993 <varlistentry>
6994 <term><option>-r</option></term>
6995 <listitem>
6996 <para>
6997 <indexterm role="option">
6998 <primary><option>-r</option></primary>
6999 </indexterm>
7000 This is a documented (for Sendmail) obsolete alternative name for <option>-f</option>.
7001 </para>
7002 </listitem></varlistentry>
7003 <varlistentry>
7004 <term><option>-S</option>&lt;<emphasis>rsflags</emphasis>&gt;&nbsp;&lt;<emphasis>string</emphasis>&gt;</term>
7005 <listitem>
7006 <para>
7007 <indexterm role="option">
7008 <primary><option>-S</option></primary>
7009 </indexterm>
7010 <indexterm role="concept">
7011 <primary>delivery</primary>
7012 <secondary>from given sender</secondary>
7013 </indexterm>
7014 <indexterm role="concept">
7015 <primary>queue runner</primary>
7016 <secondary>for specific senders</secondary>
7017 </indexterm>
7018 This option acts like <option>-R</option> except that it checks the string against each
7019 message&#x2019;s sender instead of against the recipients. If <option>-R</option> is also set, both
7020 conditions must be met for a message to be selected. If either of the options
7021 has <emphasis>f</emphasis> or <emphasis>ff</emphasis> in its flags, the associated action is taken.
7022 </para>
7023 </listitem></varlistentry>
7024 <varlistentry>
7025 <term><option>-Tqt</option>&nbsp;&lt;<emphasis>times</emphasis>&gt;</term>
7026 <listitem>
7027 <para>
7028 <indexterm role="option">
7029 <primary><option>-Tqt</option></primary>
7030 </indexterm>
7031 This is an option that is exclusively for use by the Exim testing suite. It is not
7032 recognized when Exim is run normally. It allows for the setting up of explicit
7033 <quote>queue times</quote> so that various warning/retry features can be tested.
7034 </para>
7035 </listitem></varlistentry>
7036 <varlistentry>
7037 <term><option>-t</option></term>
7038 <listitem>
7039 <para>
7040 <indexterm role="option">
7041 <primary><option>-t</option></primary>
7042 </indexterm>
7043 <indexterm role="concept">
7044 <primary>recipient</primary>
7045 <secondary>extracting from header lines</secondary>
7046 </indexterm>
7047 <indexterm role="concept">
7048 <primary><emphasis>Bcc:</emphasis> header line</primary>
7049 </indexterm>
7050 <indexterm role="concept">
7051 <primary><emphasis>Cc:</emphasis> header line</primary>
7052 </indexterm>
7053 <indexterm role="concept">
7054 <primary><emphasis>To:</emphasis> header line</primary>
7055 </indexterm>
7056 When Exim is receiving a locally-generated, non-SMTP message on its standard
7057 input, the <option>-t</option> option causes the recipients of the message to be obtained
7058 from the <emphasis>To:</emphasis>, <emphasis>Cc:</emphasis>, and <emphasis>Bcc:</emphasis> header lines in the message instead of
7059 from the command arguments. The addresses are extracted before any rewriting
7060 takes place and the <emphasis>Bcc:</emphasis> header line, if present, is then removed.
7061 </para>
7062 <para>
7063 <indexterm role="concept">
7064 <primary>Sendmail compatibility</primary>
7065 <secondary><option>-t</option> option</secondary>
7066 </indexterm>
7067 If the command has any arguments, they specify addresses to which the message
7068 is <emphasis>not</emphasis> to be delivered. That is, the argument addresses are removed from
7069 the recipients list obtained from the headers. This is compatible with Smail 3
7070 and in accordance with the documented behaviour of several versions of
7071 Sendmail, as described in man pages on a number of operating systems (e.g.
7072 Solaris 8, IRIX 6.5, HP-UX 11). However, some versions of Sendmail <emphasis>add</emphasis>
7073 argument addresses to those obtained from the headers, and the O&#x2019;Reilly
7074 Sendmail book documents it that way. Exim can be made to add argument addresses
7075 instead of subtracting them by setting the option
7076 <option>extract_addresses_remove_arguments</option> false.
7077 </para>
7078 <para>
7079 <indexterm role="concept">
7080 <primary><option>Resent-</option> header lines</primary>
7081 <secondary>with <option>-t</option></secondary>
7082 </indexterm>
7083 If there are any <option>Resent-</option> header lines in the message, Exim extracts
7084 recipients from all <emphasis>Resent-To:</emphasis>, <emphasis>Resent-Cc:</emphasis>, and <emphasis>Resent-Bcc:</emphasis> header
7085 lines instead of from <emphasis>To:</emphasis>, <emphasis>Cc:</emphasis>, and <emphasis>Bcc:</emphasis>. This is for compatibility
7086 with Sendmail and other MTAs. (Prior to release 4.20, Exim gave an error if
7087 <option>-t</option> was used in conjunction with <option>Resent-</option> header lines.)
7088 </para>
7089 <para>
7090 RFC 2822 talks about different sets of <option>Resent-</option> header lines (for when a
7091 message is resent several times). The RFC also specifies that they should be
7092 added at the front of the message, and separated by <emphasis>Received:</emphasis> lines. It is
7093 not at all clear how <option>-t</option> should operate in the present of multiple sets,
7094 nor indeed exactly what constitutes a <quote>set</quote>.
7095 In practice, it seems that MUAs do not follow the RFC. The <option>Resent-</option> lines
7096 are often added at the end of the header, and if a message is resent more than
7097 once, it is common for the original set of <option>Resent-</option> headers to be renamed as
7098 <option>X-Resent-</option> when a new set is added. This removes any possible ambiguity.
7099 </para>
7100 </listitem></varlistentry>
7101 <varlistentry>
7102 <term><option>-ti</option></term>
7103 <listitem>
7104 <para>
7105 <indexterm role="option">
7106 <primary><option>-ti</option></primary>
7107 </indexterm>
7108 This option is exactly equivalent to <option>-t</option> <option>-i</option>. It is provided for
7109 compatibility with Sendmail.
7110 </para>
7111 </listitem></varlistentry>
7112 <varlistentry>
7113 <term><option>-tls-on-connect</option></term>
7114 <listitem>
7115 <para>
7116 <indexterm role="option">
7117 <primary><option>-tls-on-connect</option></primary>
7118 </indexterm>
7119 <indexterm role="concept">
7120 <primary>TLS</primary>
7121 <secondary>use without STARTTLS</secondary>
7122 </indexterm>
7123 <indexterm role="concept">
7124 <primary>TLS</primary>
7125 <secondary>automatic start</secondary>
7126 </indexterm>
7127 This option is available when Exim is compiled with TLS support. It forces all
7128 incoming SMTP connections to behave as if the incoming port is listed in the
7129 <option>tls_on_connect_ports</option> option. See section <xref linkend="SECTsupobssmt"/> and chapter
7130 <xref linkend="CHAPTLS"/> for further details.
7131 </para>
7132 </listitem></varlistentry>
7133 <varlistentry>
7134 <term><option>-U</option></term>
7135 <listitem>
7136 <para>
7137 <indexterm role="option">
7138 <primary><option>-U</option></primary>
7139 </indexterm>
7140 <indexterm role="concept">
7141 <primary>Sendmail compatibility</primary>
7142 <secondary><option>-U</option> option ignored</secondary>
7143 </indexterm>
7144 Sendmail uses this option for <quote>initial message submission</quote>, and its
7145 documentation states that in future releases, it may complain about
7146 syntactically invalid messages rather than fixing them when this flag is not
7147 set. Exim ignores this option.
7148 </para>
7149 </listitem></varlistentry>
7150 <varlistentry>
7151 <term><option>-v</option></term>
7152 <listitem>
7153 <para>
7154 <indexterm role="option">
7155 <primary><option>-v</option></primary>
7156 </indexterm>
7157 This option causes Exim to write information to the standard error stream,
7158 describing what it is doing. In particular, it shows the log lines for
7159 receiving and delivering a message, and if an SMTP connection is made, the SMTP
7160 dialogue is shown. Some of the log lines shown may not actually be written to
7161 the log if the setting of <option>log_selector</option> discards them. Any relevant
7162 selectors are shown with each log line. If none are shown, the logging is
7163 unconditional.
7164 </para>
7165 </listitem></varlistentry>
7166 <varlistentry>
7167 <term><option>-x</option></term>
7168 <listitem>
7169 <para>
7170 <indexterm role="option">
7171 <primary><option>-x</option></primary>
7172 </indexterm>
7173 AIX uses <option>-x</option> for a private purpose (<quote>mail from a local mail program has
7174 National Language Support extended characters in the body of the mail item</quote>).
7175 It sets <option>-x</option> when calling the MTA from its <option>mail</option> command. Exim ignores
7176 this option.
7177 </para>
7178 </listitem></varlistentry>
7179 <varlistentry>
7180 <term><option>-X</option>&nbsp;&lt;<emphasis>logfile</emphasis>&gt;</term>
7181 <listitem>
7182 <para>
7183 <indexterm role="option">
7184 <primary><option>-X</option></primary>
7185 </indexterm>
7186 This option is interpreted by Sendmail to cause debug information to be sent
7187 to the named file.  It is ignored by Exim.
7188 </para>
7189 </listitem></varlistentry>
7190 </variablelist>
7191 <para>
7192 <indexterm role="concept" startref="IIDclo1" class="endofrange"/>
7193 <indexterm role="concept" startref="IIDclo2" class="endofrange"/>
7194 </para>
7195 <!-- === End of command line options === -->
7196 </section>
7197 </chapter>
7198
7199 <chapter id="CHAPconf">
7200 <title>The Exim run time configuration file</title>
7201 <titleabbrev>The runtime configuration file</titleabbrev>
7202 <para>
7203 <indexterm role="concept">
7204 <primary>run time configuration</primary>
7205 </indexterm>
7206 <indexterm role="concept">
7207 <primary>configuration file</primary>
7208 <secondary>general description</secondary>
7209 </indexterm>
7210 <indexterm role="concept">
7211 <primary>CONFIGURE_FILE</primary>
7212 </indexterm>
7213 <indexterm role="concept">
7214 <primary>configuration file</primary>
7215 <secondary>errors in</secondary>
7216 </indexterm>
7217 <indexterm role="concept">
7218 <primary>error</primary>
7219 <secondary>in configuration file</secondary>
7220 </indexterm>
7221 <indexterm role="concept">
7222 <primary>return code</primary>
7223 <secondary>for bad configuration</secondary>
7224 </indexterm>
7225 Exim uses a single run time configuration file that is read whenever an Exim
7226 binary is executed. Note that in normal operation, this happens frequently,
7227 because Exim is designed to operate in a distributed manner, without central
7228 control.
7229 </para>
7230 <para>
7231 If a syntax error is detected while reading the configuration file, Exim
7232 writes a message on the standard error, and exits with a non-zero return code.
7233 The message is also written to the panic log. <emphasis role="bold">Note</emphasis>: Only simple syntax
7234 errors can be detected at this time. The values of any expanded options are
7235 not checked until the expansion happens, even when the expansion does not
7236 actually alter the string.
7237 </para>
7238 <para>
7239 The name of the configuration file is compiled into the binary for security
7240 reasons, and is specified by the CONFIGURE_FILE compilation option. In
7241 most configurations, this specifies a single file. However, it is permitted to
7242 give a colon-separated list of file names, in which case Exim uses the first
7243 existing file in the list.
7244 </para>
7245 <para>
7246 <indexterm role="concept">
7247 <primary>EXIM_USER</primary>
7248 </indexterm>
7249 <indexterm role="concept">
7250 <primary>EXIM_GROUP</primary>
7251 </indexterm>
7252 <indexterm role="concept">
7253 <primary>CONFIGURE_OWNER</primary>
7254 </indexterm>
7255 <indexterm role="concept">
7256 <primary>CONFIGURE_GROUP</primary>
7257 </indexterm>
7258 <indexterm role="concept">
7259 <primary>configuration file</primary>
7260 <secondary>ownership</secondary>
7261 </indexterm>
7262 <indexterm role="concept">
7263 <primary>ownership</primary>
7264 <secondary>configuration file</secondary>
7265 </indexterm>
7266 The run time configuration file must be owned by root or by the user that is
7267 specified at compile time by the CONFIGURE_OWNER option (if set). The
7268 configuration file must not be world-writeable, or group-writeable unless its
7269 group is the root group or the one specified at compile time by the
7270 CONFIGURE_GROUP option.
7271 </para>
7272 <para>
7273 <emphasis role="bold">Warning</emphasis>: In a conventional configuration, where the Exim binary is setuid
7274 to root, anybody who is able to edit the run time configuration file has an
7275 easy way to run commands as root. If you specify a user or group in the
7276 CONFIGURE_OWNER or CONFIGURE_GROUP options, then that user and/or any users
7277 who are members of that group will trivially be able to obtain root privileges.
7278 </para>
7279 <para>
7280 Up to Exim version 4.72, the run time configuration file was also permitted to
7281 be writeable by the Exim user and/or group. That has been changed in Exim 4.73
7282 since it offered a simple privilege escalation for any attacker who managed to
7283 compromise the Exim user account.
7284 </para>
7285 <para>
7286 A default configuration file, which will work correctly in simple situations,
7287 is provided in the file <filename>src/configure.default</filename>. If CONFIGURE_FILE
7288 defines just one file name, the installation process copies the default
7289 configuration to a new file of that name if it did not previously exist. If
7290 CONFIGURE_FILE is a list, no default is automatically installed. Chapter
7291 <xref linkend="CHAPdefconfil"/> is a <quote>walk-through</quote> discussion of the default
7292 configuration.
7293 </para>
7294 <section id="SECID40">
7295 <title>Using a different configuration file</title>
7296 <para>
7297 <indexterm role="concept">
7298 <primary>configuration file</primary>
7299 <secondary>alternate</secondary>
7300 </indexterm>
7301 A one-off alternate configuration can be specified by the <option>-C</option> command line
7302 option, which may specify a single file or a list of files. However, when
7303 <option>-C</option> is used, Exim gives up its root privilege, unless called by root (or
7304 unless the argument for <option>-C</option> is identical to the built-in value from
7305 CONFIGURE_FILE), or is listed in the TRUSTED_CONFIG_LIST file and the caller
7306 is the Exim user or the user specified in the CONFIGURE_OWNER setting. <option>-C</option>
7307 is useful mainly for checking the syntax of configuration files before
7308 installing them. No owner or group checks are done on a configuration file
7309 specified by <option>-C</option>, if root privilege has been dropped.
7310 </para>
7311 <para>
7312 Even the Exim user is not trusted to specify an arbitrary configuration file
7313 with the <option>-C</option> option to be used with root privileges, unless that file is
7314 listed in the TRUSTED_CONFIG_LIST file. This locks out the possibility of
7315 testing a configuration using <option>-C</option> right through message reception and
7316 delivery, even if the caller is root. The reception works, but by that time,
7317 Exim is running as the Exim user, so when it re-execs to regain privilege for
7318 the delivery, the use of <option>-C</option> causes privilege to be lost. However, root
7319 can test reception and delivery using two separate commands (one to put a
7320 message on the queue, using <option>-odq</option>, and another to do the delivery, using
7321 <option>-M</option>).
7322 </para>
7323 <para>
7324 If ALT_CONFIG_PREFIX is defined <filename>in Local/Makefile</filename>, it specifies a
7325 prefix string with which any file named in a <option>-C</option> command line option must
7326 start. In addition, the file name must not contain the sequence <quote><literal>/../</literal></quote>.
7327 There is no default setting for ALT_CONFIG_PREFIX; when it is unset, any file
7328 name can be used with <option>-C</option>.
7329 </para>
7330 <para>
7331 One-off changes to a configuration can be specified by the <option>-D</option> command line
7332 option, which defines and overrides values for macros used inside the
7333 configuration file. However, like <option>-C</option>, the use of this option by a
7334 non-privileged user causes Exim to discard its root privilege.
7335 If DISABLE_D_OPTION is defined in <filename>Local/Makefile</filename>, the use of <option>-D</option> is
7336 completely disabled, and its use causes an immediate error exit.
7337 </para>
7338 <para>
7339 The WHITELIST_D_MACROS option in <filename>Local/Makefile</filename> permits the binary builder
7340 to declare certain macro names trusted, such that root privilege will not
7341 necessarily be discarded.
7342 WHITELIST_D_MACROS defines a colon-separated list of macros which are
7343 considered safe and, if <option>-D</option> only supplies macros from this list, and the
7344 values are acceptable, then Exim will not give up root privilege if the caller
7345 is root, the Exim run-time user, or the CONFIGURE_OWNER, if set.  This is a
7346 transition mechanism and is expected to be removed in the future.  Acceptable
7347 values for the macros satisfy the regexp: <literal>^[A-Za-z0-9_/.-]*$</literal>
7348 </para>
7349 <para>
7350 Some sites may wish to use the same Exim binary on different machines that
7351 share a file system, but to use different configuration files on each machine.
7352 If CONFIGURE_FILE_USE_NODE is defined in <filename>Local/Makefile</filename>, Exim first
7353 looks for a file whose name is the configuration file name followed by a dot
7354 and the machine&#x2019;s node name, as obtained from the <function>uname()</function> function. If this
7355 file does not exist, the standard name is tried. This processing occurs for
7356 each file name in the list given by CONFIGURE_FILE or <option>-C</option>.
7357 </para>
7358 <para>
7359 In some esoteric situations different versions of Exim may be run under
7360 different effective uids and the CONFIGURE_FILE_USE_EUID is defined to
7361 help with this. See the comments in <filename>src/EDITME</filename> for details.
7362 </para>
7363 </section>
7364 <section id="SECTconffilfor">
7365 <title>Configuration file format</title>
7366 <para>
7367 <indexterm role="concept">
7368 <primary>configuration file</primary>
7369 <secondary>format of</secondary>
7370 </indexterm>
7371 <indexterm role="concept">
7372 <primary>format</primary>
7373 <secondary>configuration file</secondary>
7374 </indexterm>
7375 Exim&#x2019;s configuration file is divided into a number of different parts. General
7376 option settings must always appear at the start of the file. The other parts
7377 are all optional, and may appear in any order. Each part other than the first
7378 is introduced by the word <quote>begin</quote> followed by the name of the part. The
7379 optional parts are:
7380 </para>
7381 <itemizedlist>
7382 <listitem>
7383 <para>
7384 <emphasis>ACL</emphasis>: Access control lists for controlling incoming SMTP mail (see chapter
7385 <xref linkend="CHAPACL"/>).
7386 </para>
7387 </listitem>
7388 <listitem>
7389 <para>
7390 <indexterm role="concept">
7391 <primary>AUTH</primary>
7392 <secondary>configuration</secondary>
7393 </indexterm>
7394 <emphasis>authenticators</emphasis>: Configuration settings for the authenticator drivers. These
7395 are concerned with the SMTP AUTH command (see chapter <xref linkend="CHAPSMTPAUTH"/>).
7396 </para>
7397 </listitem>
7398 <listitem>
7399 <para>
7400 <emphasis>routers</emphasis>: Configuration settings for the router drivers. Routers process
7401 addresses and determine how the message is to be delivered (see chapters
7402 <xref linkend="CHAProutergeneric"/>&ndash;<xref linkend="CHAPredirect"/>).
7403 </para>
7404 </listitem>
7405 <listitem>
7406 <para>
7407 <emphasis>transports</emphasis>: Configuration settings for the transport drivers. Transports
7408 define mechanisms for copying messages to destinations (see chapters
7409 <xref linkend="CHAPtransportgeneric"/>&ndash;<xref linkend="CHAPsmtptrans"/>).
7410 </para>
7411 </listitem>
7412 <listitem>
7413 <para>
7414 <emphasis>retry</emphasis>: Retry rules, for use when a message cannot be delivered immediately.
7415 If there is no retry section, or if it is empty (that is, no retry rules are
7416 defined), Exim will not retry deliveries. In this situation, temporary errors
7417 are treated the same as permanent errors. Retry rules are discussed in chapter
7418 <xref linkend="CHAPretry"/>.
7419 </para>
7420 </listitem>
7421 <listitem>
7422 <para>
7423 <emphasis>rewrite</emphasis>: Global address rewriting rules, for use when a message arrives and
7424 when new addresses are generated during delivery. Rewriting is discussed in
7425 chapter <xref linkend="CHAPrewrite"/>.
7426 </para>
7427 </listitem>
7428 <listitem>
7429 <para>
7430 <emphasis>local_scan</emphasis>: Private options for the <function>local_scan()</function> function. If you
7431 want to use this feature, you must set
7432 </para>
7433 <literallayout class="monospaced">
7434 LOCAL_SCAN_HAS_OPTIONS=yes
7435 </literallayout>
7436 <para>
7437 in <filename>Local/Makefile</filename> before building Exim. Details of the <function>local_scan()</function>
7438 facility are given in chapter <xref linkend="CHAPlocalscan"/>.
7439 </para>
7440 </listitem>
7441 </itemizedlist>
7442 <para>
7443 <indexterm role="concept">
7444 <primary>configuration file</primary>
7445 <secondary>leading white space in</secondary>
7446 </indexterm>
7447 <indexterm role="concept">
7448 <primary>configuration file</primary>
7449 <secondary>trailing white space in</secondary>
7450 </indexterm>
7451 <indexterm role="concept">
7452 <primary>white space</primary>
7453 <secondary>in configuration file</secondary>
7454 </indexterm>
7455 Leading and trailing white space in configuration lines is always ignored.
7456 </para>
7457 <para>
7458 Blank lines in the file, and lines starting with a # character (ignoring
7459 leading white space) are treated as comments and are ignored. <emphasis role="bold">Note</emphasis>: A
7460 # character other than at the beginning of a line is not treated specially,
7461 and does not introduce a comment.
7462 </para>
7463 <para>
7464 Any non-comment line can be continued by ending it with a backslash. Note that
7465 the general rule for white space means that trailing white space after the
7466 backslash and leading white space at the start of continuation
7467 lines is ignored. Comment lines beginning with # (but not empty lines) may
7468 appear in the middle of a sequence of continuation lines.
7469 </para>
7470 <para>
7471 A convenient way to create a configuration file is to start from the
7472 default, which is supplied in <filename>src/configure.default</filename>, and add, delete, or
7473 change settings as required.
7474 </para>
7475 <para>
7476 The ACLs, retry rules, and rewriting rules have their own syntax which is
7477 described in chapters <xref linkend="CHAPACL"/>, <xref linkend="CHAPretry"/>, and <xref linkend="CHAPrewrite"/>,
7478 respectively. The other parts of the configuration file have some syntactic
7479 items in common, and these are described below, from section <xref linkend="SECTcos"/>
7480 onwards. Before that, the inclusion, macro, and conditional facilities are
7481 described.
7482 </para>
7483 </section>
7484 <section id="SECID41">
7485 <title>File inclusions in the configuration file</title>
7486 <para>
7487 <indexterm role="concept">
7488 <primary>inclusions in configuration file</primary>
7489 </indexterm>
7490 <indexterm role="concept">
7491 <primary>configuration file</primary>
7492 <secondary>including other files</secondary>
7493 </indexterm>
7494 <indexterm role="concept">
7495 <primary><literal>.include</literal> in configuration file</primary>
7496 </indexterm>
7497 <indexterm role="concept">
7498 <primary><literal>.include_if_exists</literal> in configuration file</primary>
7499 </indexterm>
7500 You can include other files inside Exim&#x2019;s run time configuration file by
7501 using this syntax:
7502 </para>
7503 <literallayout>
7504 <literal>.include</literal> &lt;<emphasis>file name</emphasis>&gt;
7505 <literal>.include_if_exists</literal> &lt;<emphasis>file name</emphasis>&gt;
7506 </literallayout>
7507 <para>
7508 on a line by itself. Double quotes round the file name are optional. If you use
7509 the first form, a configuration error occurs if the file does not exist; the
7510 second form does nothing for non-existent files. In all cases, an absolute file
7511 name is required.
7512 </para>
7513 <para>
7514 Includes may be nested to any depth, but remember that Exim reads its
7515 configuration file often, so it is a good idea to keep them to a minimum.
7516 If you change the contents of an included file, you must HUP the daemon,
7517 because an included file is read only when the configuration itself is read.
7518 </para>
7519 <para>
7520 The processing of inclusions happens early, at a physical line level, so, like
7521 comment lines, an inclusion can be used in the middle of an option setting,
7522 for example:
7523 </para>
7524 <literallayout class="monospaced">
7525 hosts_lookup = a.b.c \
7526                .include /some/file
7527 </literallayout>
7528 <para>
7529 Include processing happens after macro processing (see below). Its effect is to
7530 process the lines of the included file as if they occurred inline where the
7531 inclusion appears.
7532 </para>
7533 </section>
7534 <section id="SECTmacrodefs">
7535 <title>Macros in the configuration file</title>
7536 <para>
7537 <indexterm role="concept">
7538 <primary>macro</primary>
7539 <secondary>description of</secondary>
7540 </indexterm>
7541 <indexterm role="concept">
7542 <primary>configuration file</primary>
7543 <secondary>macros</secondary>
7544 </indexterm>
7545 If a line in the main part of the configuration (that is, before the first
7546 <quote>begin</quote> line) begins with an upper case letter, it is taken as a macro
7547 definition, and must be of the form
7548 </para>
7549 <literallayout>
7550 &lt;<emphasis>name</emphasis>&gt; = &lt;<emphasis>rest of line</emphasis>&gt;
7551 </literallayout>
7552 <para>
7553 The name must consist of letters, digits, and underscores, and need not all be
7554 in upper case, though that is recommended. The rest of the line, including any
7555 continuations, is the replacement text, and has leading and trailing white
7556 space removed. Quotes are not removed. The replacement text can never end with
7557 a backslash character, but this doesn&#x2019;t seem to be a serious limitation.
7558 </para>
7559 <para>
7560 Macros may also be defined between router, transport, authenticator, or ACL
7561 definitions. They may not, however, be defined within an individual driver or
7562 ACL, or in the <option>local_scan</option>, retry, or rewrite sections of the configuration.
7563 </para>
7564 </section>
7565 <section id="SECID42">
7566 <title>Macro substitution</title>
7567 <para>
7568 Once a macro is defined, all subsequent lines in the file (and any included
7569 files) are scanned for the macro name; if there are several macros, the line is
7570 scanned for each in turn, in the order in which the macros are defined. The
7571 replacement text is not re-scanned for the current macro, though it is scanned
7572 for subsequently defined macros. For this reason, a macro name may not contain
7573 the name of a previously defined macro as a substring. You could, for example,
7574 define
7575 </para>
7576 <literallayout>
7577 <literal>ABCD_XYZ = </literal>&lt;<emphasis>something</emphasis>&gt;
7578 <literal>ABCD = </literal>&lt;<emphasis>something else</emphasis>&gt;
7579 </literallayout>
7580 <para>
7581 but putting the definitions in the opposite order would provoke a configuration
7582 error. Macro expansion is applied to individual physical lines from the file,
7583 before checking for line continuation or file inclusion (see above). If a line
7584 consists solely of a macro name, and the expansion of the macro is empty, the
7585 line is ignored. A macro at the start of a line may turn the line into a
7586 comment line or a <literal>.include</literal> line.
7587 </para>
7588 </section>
7589 <section id="SECID43">
7590 <title>Redefining macros</title>
7591 <para>
7592 Once defined, the value of a macro can be redefined later in the configuration
7593 (or in an included file). Redefinition is specified by using <emphasis>==</emphasis> instead of
7594 <emphasis>=</emphasis>. For example:
7595 </para>
7596 <literallayout class="monospaced">
7597 MAC =  initial value
7598 ...
7599 MAC == updated value
7600 </literallayout>
7601 <para>
7602 Redefinition does not alter the order in which the macros are applied to the
7603 subsequent lines of the configuration file. It is still the same order in which
7604 the macros were originally defined. All that changes is the macro&#x2019;s value.
7605 Redefinition makes it possible to accumulate values. For example:
7606 </para>
7607 <literallayout class="monospaced">
7608 MAC =  initial value
7609 ...
7610 MAC == MAC and something added
7611 </literallayout>
7612 <para>
7613 This can be helpful in situations where the configuration file is built
7614 from a number of other files.
7615 </para>
7616 </section>
7617 <section id="SECID44">
7618 <title>Overriding macro values</title>
7619 <para>
7620 The values set for macros in the configuration file can be overridden by the
7621 <option>-D</option> command line option, but Exim gives up its root privilege when <option>-D</option> is
7622 used, unless called by root or the Exim user. A definition on the command line
7623 using the <option>-D</option> option causes all definitions and redefinitions within the
7624 file to be ignored.
7625 </para>
7626 </section>
7627 <section id="SECID45">
7628 <title>Example of macro usage</title>
7629 <para>
7630 As an example of macro usage, consider a configuration where aliases are looked
7631 up in a MySQL database. It helps to keep the file less cluttered if long
7632 strings such as SQL statements are defined separately as macros, for example:
7633 </para>
7634 <literallayout class="monospaced">
7635 ALIAS_QUERY = select mailbox from user where \
7636               login='${quote_mysql:$local_part}';
7637 </literallayout>
7638 <para>
7639 This can then be used in a <command>redirect</command> router setting like this:
7640 </para>
7641 <literallayout class="monospaced">
7642 data = ${lookup mysql{ALIAS_QUERY}}
7643 </literallayout>
7644 <para>
7645 In earlier versions of Exim macros were sometimes used for domain, host, or
7646 address lists. In Exim 4 these are handled better by named lists &ndash; see
7647 section <xref linkend="SECTnamedlists"/>.
7648 </para>
7649 </section>
7650 <section id="SECID46">
7651 <title>Conditional skips in the configuration file</title>
7652 <para>
7653 <indexterm role="concept">
7654 <primary>configuration file</primary>
7655 <secondary>conditional skips</secondary>
7656 </indexterm>
7657 <indexterm role="concept">
7658 <primary><literal>.ifdef</literal></primary>
7659 </indexterm>
7660 You can use the directives <literal>.ifdef</literal>, <literal>.ifndef</literal>, <literal>.elifdef</literal>,
7661 <literal>.elifndef</literal>, <literal>.else</literal>, and <literal>.endif</literal> to dynamically include or exclude
7662 portions of the configuration file. The processing happens whenever the file is
7663 read (that is, when an Exim binary starts to run).
7664 </para>
7665 <para>
7666 The implementation is very simple. Instances of the first four directives must
7667 be followed by text that includes the names of one or macros. The condition
7668 that is tested is whether or not any macro substitution has taken place in the
7669 line. Thus:
7670 </para>
7671 <literallayout class="monospaced">
7672 .ifdef AAA
7673 message_size_limit = 50M
7674 .else
7675 message_size_limit = 100M
7676 .endif
7677 </literallayout>
7678 <para>
7679 sets a message size limit of 50M if the macro <literal>AAA</literal> is defined, and 100M
7680 otherwise. If there is more than one macro named on the line, the condition
7681 is true if any of them are defined. That is, it is an <quote>or</quote> condition. To
7682 obtain an <quote>and</quote> condition, you need to use nested <literal>.ifdef</literal>s.
7683 </para>
7684 <para>
7685 Although you can use a macro expansion to generate one of these directives,
7686 it is not very useful, because the condition <quote>there was a macro substitution
7687 in this line</quote> will always be true.
7688 </para>
7689 <para>
7690 Text following <literal>.else</literal> and <literal>.endif</literal> is ignored, and can be used as comment
7691 to clarify complicated nestings.
7692 </para>
7693 </section>
7694 <section id="SECTcos">
7695 <title>Common option syntax</title>
7696 <para>
7697 <indexterm role="concept">
7698 <primary>common option syntax</primary>
7699 </indexterm>
7700 <indexterm role="concept">
7701 <primary>syntax of common options</primary>
7702 </indexterm>
7703 <indexterm role="concept">
7704 <primary>configuration file</primary>
7705 <secondary>common option syntax</secondary>
7706 </indexterm>
7707 For the main set of options, driver options, and <function>local_scan()</function> options,
7708 each setting is on a line by itself, and starts with a name consisting of
7709 lower-case letters and underscores. Many options require a data value, and in
7710 these cases the name must be followed by an equals sign (with optional white
7711 space) and then the value. For example:
7712 </para>
7713 <literallayout class="monospaced">
7714 qualify_domain = mydomain.example.com
7715 </literallayout>
7716 <para>
7717 <indexterm role="concept">
7718 <primary>hiding configuration option values</primary>
7719 </indexterm>
7720 <indexterm role="concept">
7721 <primary>configuration options</primary>
7722 <secondary>hiding value of</secondary>
7723 </indexterm>
7724 <indexterm role="concept">
7725 <primary>options</primary>
7726 <secondary>hiding value of</secondary>
7727 </indexterm>
7728 Some option settings may contain sensitive data, for example, passwords for
7729 accessing databases. To stop non-admin users from using the <option>-bP</option> command
7730 line option to read these values, you can precede the option settings with the
7731 word <quote>hide</quote>. For example:
7732 </para>
7733 <literallayout class="monospaced">
7734 hide mysql_servers = localhost/users/admin/secret-password
7735 </literallayout>
7736 <para>
7737 For non-admin users, such options are displayed like this:
7738 </para>
7739 <literallayout class="monospaced">
7740 mysql_servers = &lt;value not displayable&gt;
7741 </literallayout>
7742 <para>
7743 If <quote>hide</quote> is used on a driver option, it hides the value of that option on
7744 all instances of the same driver.
7745 </para>
7746 <para>
7747 The following sections describe the syntax used for the different data types
7748 that are found in option settings.
7749 </para>
7750 </section>
7751 <section id="SECID47">
7752 <title>Boolean options</title>
7753 <para>
7754 <indexterm role="concept">
7755 <primary>format</primary>
7756 <secondary>boolean</secondary>
7757 </indexterm>
7758 <indexterm role="concept">
7759 <primary>boolean configuration values</primary>
7760 </indexterm>
7761 <indexterm role="option">
7762 <primary><option>no_</option><emphasis>xxx</emphasis></primary>
7763 </indexterm>
7764 <indexterm role="option">
7765 <primary><option>not_</option><emphasis>xxx</emphasis></primary>
7766 </indexterm>
7767 Options whose type is given as boolean are on/off switches. There are two
7768 different ways of specifying such options: with and without a data value. If
7769 the option name is specified on its own without data, the switch is turned on;
7770 if it is preceded by <quote>no_</quote> or <quote>not_</quote> the switch is turned off. However,
7771 boolean options may be followed by an equals sign and one of the words
7772 <quote>true</quote>, <quote>false</quote>, <quote>yes</quote>, or <quote>no</quote>, as an alternative syntax. For example,
7773 the following two settings have exactly the same effect:
7774 </para>
7775 <literallayout class="monospaced">
7776 queue_only
7777 queue_only = true
7778 </literallayout>
7779 <para>
7780 The following two lines also have the same (opposite) effect:
7781 </para>
7782 <literallayout class="monospaced">
7783 no_queue_only
7784 queue_only = false
7785 </literallayout>
7786 <para>
7787 You can use whichever syntax you prefer.
7788 </para>
7789 </section>
7790 <section id="SECID48">
7791 <title>Integer values</title>
7792 <para>
7793 <indexterm role="concept">
7794 <primary>integer configuration values</primary>
7795 </indexterm>
7796 <indexterm role="concept">
7797 <primary>format</primary>
7798 <secondary>integer</secondary>
7799 </indexterm>
7800 If an option&#x2019;s type is given as <quote>integer</quote>, the value can be given in decimal,
7801 hexadecimal, or octal. If it starts with a digit greater than zero, a decimal
7802 number is assumed. Otherwise, it is treated as an octal number unless it starts
7803 with the characters <quote>0x</quote>, in which case the remainder is interpreted as a
7804 hexadecimal number.
7805 </para>
7806 <para>
7807 If an integer value is followed by the letter K, it is multiplied by 1024; if
7808 it is followed by the letter M, it is multiplied by 1024x1024. When the values
7809 of integer option settings are output, values which are an exact multiple of
7810 1024 or 1024x1024 are sometimes, but not always, printed using the letters K
7811 and M. The printing style is independent of the actual input format that was
7812 used.
7813 </para>
7814 </section>
7815 <section id="SECID49">
7816 <title>Octal integer values</title>
7817 <para>
7818 <indexterm role="concept">
7819 <primary>integer format</primary>
7820 </indexterm>
7821 <indexterm role="concept">
7822 <primary>format</primary>
7823 <secondary>octal integer</secondary>
7824 </indexterm>
7825 If an option&#x2019;s type is given as <quote>octal integer</quote>, its value is always
7826 interpreted as an octal number, whether or not it starts with the digit zero.
7827 Such options are always output in octal.
7828 </para>
7829 </section>
7830 <section id="SECID50">
7831 <title>Fixed point numbers</title>
7832 <para>
7833 <indexterm role="concept">
7834 <primary>fixed point configuration values</primary>
7835 </indexterm>
7836 <indexterm role="concept">
7837 <primary>format</primary>
7838 <secondary>fixed point</secondary>
7839 </indexterm>
7840 If an option&#x2019;s type is given as <quote>fixed-point</quote>, its value must be a decimal
7841 integer, optionally followed by a decimal point and up to three further digits.
7842 </para>
7843 </section>
7844 <section id="SECTtimeformat">
7845 <title>Time intervals</title>
7846 <para>
7847 <indexterm role="concept">
7848 <primary>time interval</primary>
7849 <secondary>specifying in configuration</secondary>
7850 </indexterm>
7851 <indexterm role="concept">
7852 <primary>format</primary>
7853 <secondary>time interval</secondary>
7854 </indexterm>
7855 A time interval is specified as a sequence of numbers, each followed by one of
7856 the following letters, with no intervening white space:
7857 </para>
7858 <informaltable frame="none">
7859 <tgroup cols="2" colsep="0" rowsep="0">
7860 <colspec colwidth="30pt" align="left"/>
7861 <colspec colwidth="254pt" align="left"/>
7862 <tbody>
7863 <row>
7864 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<option>s</option></entry>
7865 <entry>seconds</entry>
7866 </row>
7867 <row>
7868 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<option>m</option></entry>
7869 <entry>minutes</entry>
7870 </row>
7871 <row>
7872 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<option>h</option></entry>
7873 <entry>hours</entry>
7874 </row>
7875 <row>
7876 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<option>d</option></entry>
7877 <entry>days</entry>
7878 </row>
7879 <row>
7880 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<option>w</option></entry>
7881 <entry>weeks</entry>
7882 </row>
7883 </tbody>
7884 </tgroup>
7885 </informaltable>
7886 <para>
7887 For example, <quote>3h50m</quote> specifies 3 hours and 50 minutes. The values of time
7888 intervals are output in the same format. Exim does not restrict the values; it
7889 is perfectly acceptable, for example, to specify <quote>90m</quote> instead of <quote>1h30m</quote>.
7890 </para>
7891 </section>
7892 <section id="SECTstrings">
7893 <title>String values</title>
7894 <para>
7895 <indexterm role="concept">
7896 <primary>string</primary>
7897 <secondary>format of configuration values</secondary>
7898 </indexterm>
7899 <indexterm role="concept">
7900 <primary>format</primary>
7901 <secondary>string</secondary>
7902 </indexterm>
7903 If an option&#x2019;s type is specified as <quote>string</quote>, the value can be specified with
7904 or without double-quotes. If it does not start with a double-quote, the value
7905 consists of the remainder of the line plus any continuation lines, starting at
7906 the first character after any leading white space, with trailing white space
7907 removed, and with no interpretation of the characters in the string. Because
7908 Exim removes comment lines (those beginning with #) at an early stage, they can
7909 appear in the middle of a multi-line string. The following two settings are
7910 therefore equivalent:
7911 </para>
7912 <literallayout class="monospaced">
7913 trusted_users = uucp:mail
7914 trusted_users = uucp:\
7915                 # This comment line is ignored
7916                 mail
7917 </literallayout>
7918 <para>
7919 <indexterm role="concept">
7920 <primary>string</primary>
7921 <secondary>quoted</secondary>
7922 </indexterm>
7923 <indexterm role="concept">
7924 <primary>escape characters in quoted strings</primary>
7925 </indexterm>
7926 If a string does start with a double-quote, it must end with a closing
7927 double-quote, and any backslash characters other than those used for line
7928 continuation are interpreted as escape characters, as follows:
7929 </para>
7930 <informaltable frame="none">
7931 <tgroup cols="2" colsep="0" rowsep="0">
7932 <colspec colwidth="100pt" align="left"/>
7933 <colspec colwidth="254pt" align="left"/>
7934 <tbody>
7935 <row>
7936 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<literal>\\</literal></entry>
7937 <entry>single backslash</entry>
7938 </row>
7939 <row>
7940 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<literal>\n</literal></entry>
7941 <entry>newline</entry>
7942 </row>
7943 <row>
7944 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<literal>\r</literal></entry>
7945 <entry>carriage return</entry>
7946 </row>
7947 <row>
7948 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<literal>\t</literal></entry>
7949 <entry>tab</entry>
7950 </row>
7951 <row>
7952 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<literal>\</literal>&lt;<emphasis>octal digits</emphasis>&gt;</entry>
7953 <entry>up to 3 octal digits specify one character</entry>
7954 </row>
7955 <row>
7956 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<literal>\x</literal>&lt;<emphasis>hex digits</emphasis>&gt;</entry>
7957 <entry>up to 2 hexadecimal digits specify one character</entry>
7958 </row>
7959 </tbody>
7960 </tgroup>
7961 </informaltable>
7962 <para>
7963 If a backslash is followed by some other character, including a double-quote
7964 character, that character replaces the pair.
7965 </para>
7966 <para>
7967 Quoting is necessary only if you want to make use of the backslash escapes to
7968 insert special characters, or if you need to specify a value with leading or
7969 trailing spaces. These cases are rare, so quoting is almost never needed in
7970 current versions of Exim. In versions of Exim before 3.14, quoting was required
7971 in order to continue lines, so you may come across older configuration files
7972 and examples that apparently quote unnecessarily.
7973 </para>
7974 </section>
7975 <section id="SECID51">
7976 <title>Expanded strings</title>
7977 <para>
7978 <indexterm role="concept">
7979 <primary>expansion</primary>
7980 <secondary>definition of</secondary>
7981 </indexterm>
7982 Some strings in the configuration file are subjected to <emphasis>string expansion</emphasis>,
7983 by which means various parts of the string may be changed according to the
7984 circumstances (see chapter <xref linkend="CHAPexpand"/>). The input syntax for such strings
7985 is as just described; in particular, the handling of backslashes in quoted
7986 strings is done as part of the input process, before expansion takes place.
7987 However, backslash is also an escape character for the expander, so any
7988 backslashes that are required for that reason must be doubled if they are
7989 within a quoted configuration string.
7990 </para>
7991 </section>
7992 <section id="SECID52">
7993 <title>User and group names</title>
7994 <para>
7995 <indexterm role="concept">
7996 <primary>user name</primary>
7997 <secondary>format of</secondary>
7998 </indexterm>
7999 <indexterm role="concept">
8000 <primary>format</primary>
8001 <secondary>user name</secondary>
8002 </indexterm>
8003 <indexterm role="concept">
8004 <primary>groups</primary>
8005 <secondary>name format</secondary>
8006 </indexterm>
8007 <indexterm role="concept">
8008 <primary>format</primary>
8009 <secondary>group name</secondary>
8010 </indexterm>
8011 User and group names are specified as strings, using the syntax described
8012 above, but the strings are interpreted specially. A user or group name must
8013 either consist entirely of digits, or be a name that can be looked up using the
8014 <function>getpwnam()</function> or <function>getgrnam()</function> function, as appropriate.
8015 </para>
8016 </section>
8017 <section id="SECTlistconstruct">
8018 <title>List construction</title>
8019 <para>
8020 <indexterm role="concept">
8021 <primary>list</primary>
8022 <secondary>syntax of in configuration</secondary>
8023 </indexterm>
8024 <indexterm role="concept">
8025 <primary>format</primary>
8026 <secondary>list item in configuration</secondary>
8027 </indexterm>
8028 <indexterm role="concept">
8029 <primary>string</primary>
8030 <secondary>list, definition of</secondary>
8031 </indexterm>
8032 The data for some configuration options is a list of items, with colon as the
8033 default separator. Many of these options are shown with type <quote>string list</quote> in
8034 the descriptions later in this document. Others are listed as <quote>domain list</quote>,
8035 <quote>host list</quote>, <quote>address list</quote>, or <quote>local part list</quote>. Syntactically, they
8036 are all the same; however, those other than <quote>string list</quote> are subject to
8037 particular kinds of interpretation, as described in chapter
8038 <xref linkend="CHAPdomhosaddlists"/>.
8039 </para>
8040 <para>
8041 In all these cases, the entire list is treated as a single string as far as the
8042 input syntax is concerned. The <option>trusted_users</option> setting in section
8043 <xref linkend="SECTstrings"/> above is an example. If a colon is actually needed in an item
8044 in a list, it must be entered as two colons. Leading and trailing white space
8045 on each item in a list is ignored. This makes it possible to include items that
8046 start with a colon, and in particular, certain forms of IPv6 address. For
8047 example, the list
8048 </para>
8049 <literallayout class="monospaced">
8050 local_interfaces = 127.0.0.1 : ::::1
8051 </literallayout>
8052 <para>
8053 contains two IP addresses, the IPv4 address 127.0.0.1 and the IPv6 address ::1.
8054 </para>
8055 <para>
8056 <emphasis role="bold">Note</emphasis>: Although leading and trailing white space is ignored in individual
8057 list items, it is not ignored when parsing the list. The space after the first
8058 colon in the example above is necessary. If it were not there, the list would
8059 be interpreted as the two items 127.0.0.1:: and 1.
8060 </para>
8061 </section>
8062 <section id="SECID53">
8063 <title>Changing list separators</title>
8064 <para>
8065 <indexterm role="concept">
8066 <primary>list separator</primary>
8067 <secondary>changing</secondary>
8068 </indexterm>
8069 <indexterm role="concept">
8070 <primary>IPv6</primary>
8071 <secondary>addresses in lists</secondary>
8072 </indexterm>
8073 Doubling colons in IPv6 addresses is an unwelcome chore, so a mechanism was
8074 introduced to allow the separator character to be changed. If a list begins
8075 with a left angle bracket, followed by any punctuation character, that
8076 character is used instead of colon as the list separator. For example, the list
8077 above can be rewritten to use a semicolon separator like this:
8078 </para>
8079 <literallayout class="monospaced">
8080 local_interfaces = &lt;; 127.0.0.1 ; ::1
8081 </literallayout>
8082 <para>
8083 This facility applies to all lists, with the exception of the list in
8084 <option>log_file_path</option>. It is recommended that the use of non-colon separators be
8085 confined to circumstances where they really are needed.
8086 </para>
8087 <para>
8088 <indexterm role="concept">
8089 <primary>list separator</primary>
8090 <secondary>newline as</secondary>
8091 </indexterm>
8092 <indexterm role="concept">
8093 <primary>newline</primary>
8094 <secondary>as list separator</secondary>
8095 </indexterm>
8096 It is also possible to use newline and other control characters (those with
8097 code values less than 32, plus DEL) as separators in lists. Such separators
8098 must be provided literally at the time the list is processed. For options that
8099 are string-expanded, you can write the separator using a normal escape
8100 sequence. This will be processed by the expander before the string is
8101 interpreted as a list. For example, if a newline-separated list of domains is
8102 generated by a lookup, you can process it directly by a line such as this:
8103 </para>
8104 <literallayout class="monospaced">
8105 domains = &lt;\n ${lookup mysql{.....}}
8106 </literallayout>
8107 <para>
8108 This avoids having to change the list separator in such data. You are unlikely
8109 to want to use a control character as a separator in an option that is not
8110 expanded, because the value is literal text. However, it can be done by giving
8111 the value in quotes. For example:
8112 </para>
8113 <literallayout class="monospaced">
8114 local_interfaces = "&lt;\n 127.0.0.1 \n ::1"
8115 </literallayout>
8116 <para>
8117 Unlike printing character separators, which can be included in list items by
8118 doubling, it is not possible to include a control character as data when it is
8119 set as the separator. Two such characters in succession are interpreted as
8120 enclosing an empty list item.
8121 </para>
8122 </section>
8123 <section id="SECTempitelis">
8124 <title>Empty items in lists</title>
8125 <para>
8126 <indexterm role="concept">
8127 <primary>list</primary>
8128 <secondary>empty item in</secondary>
8129 </indexterm>
8130 An empty item at the end of a list is always ignored. In other words, trailing
8131 separator characters are ignored. Thus, the list in
8132 </para>
8133 <literallayout class="monospaced">
8134 senders = user@domain :
8135 </literallayout>
8136 <para>
8137 contains only a single item. If you want to include an empty string as one item
8138 in a list, it must not be the last item. For example, this list contains three
8139 items, the second of which is empty:
8140 </para>
8141 <literallayout class="monospaced">
8142 senders = user1@domain : : user2@domain
8143 </literallayout>
8144 <para>
8145 <emphasis role="bold">Note</emphasis>: There must be white space between the two colons, as otherwise they
8146 are interpreted as representing a single colon data character (and the list
8147 would then contain just one item). If you want to specify a list that contains
8148 just one, empty item, you can do it as in this example:
8149 </para>
8150 <literallayout class="monospaced">
8151 senders = :
8152 </literallayout>
8153 <para>
8154 In this case, the first item is empty, and the second is discarded because it
8155 is at the end of the list.
8156 </para>
8157 </section>
8158 <section id="SECTfordricon">
8159 <title>Format of driver configurations</title>
8160 <para>
8161 <indexterm role="concept">
8162 <primary>drivers</primary>
8163 <secondary>configuration format</secondary>
8164 </indexterm>
8165 There are separate parts in the configuration for defining routers, transports,
8166 and authenticators. In each part, you are defining a number of driver
8167 instances, each with its own set of options. Each driver instance is defined by
8168 a sequence of lines like this:
8169 </para>
8170 <literallayout>
8171 &lt;<emphasis>instance name</emphasis>&gt;:
8172   &lt;<emphasis>option</emphasis>&gt;
8173   ...
8174   &lt;<emphasis>option</emphasis>&gt;
8175 </literallayout>
8176 <para>
8177 In the following example, the instance name is <command>localuser</command>, and it is
8178 followed by three options settings:
8179 </para>
8180 <literallayout class="monospaced">
8181 localuser:
8182   driver = accept
8183   check_local_user
8184   transport = local_delivery
8185 </literallayout>
8186 <para>
8187 For each driver instance, you specify which Exim code module it uses &ndash; by the
8188 setting of the <option>driver</option> option &ndash; and (optionally) some configuration
8189 settings. For example, in the case of transports, if you want a transport to
8190 deliver with SMTP you would use the <command>smtp</command> driver; if you want to deliver to
8191 a local file you would use the <command>appendfile</command> driver. Each of the drivers is
8192 described in detail in its own separate chapter later in this manual.
8193 </para>
8194 <para>
8195 You can have several routers, transports, or authenticators that are based on
8196 the same underlying driver (each must have a different instance name).
8197 </para>
8198 <para>
8199 The order in which routers are defined is important, because addresses are
8200 passed to individual routers one by one, in order. The order in which
8201 transports are defined does not matter at all. The order in which
8202 authenticators are defined is used only when Exim, as a client, is searching
8203 them to find one that matches an authentication mechanism offered by the
8204 server.
8205 </para>
8206 <para>
8207 <indexterm role="concept">
8208 <primary>generic options</primary>
8209 </indexterm>
8210 <indexterm role="concept">
8211 <primary>options</primary>
8212 <secondary>generic &ndash; definition of</secondary>
8213 </indexterm>
8214 Within a driver instance definition, there are two kinds of option: <emphasis>generic</emphasis>
8215 and <emphasis>private</emphasis>. The generic options are those that apply to all drivers of the
8216 same type (that is, all routers, all transports or all authenticators). The
8217 <option>driver</option> option is a generic option that must appear in every definition.
8218 <indexterm role="concept">
8219 <primary>private options</primary>
8220 </indexterm>
8221 The private options are special for each driver, and none need appear, because
8222 they all have default values.
8223 </para>
8224 <para>
8225 The options may appear in any order, except that the <option>driver</option> option must
8226 precede any private options, since these depend on the particular driver. For
8227 this reason, it is recommended that <option>driver</option> always be the first option.
8228 </para>
8229 <para>
8230 Driver instance names, which are used for reference in log entries and
8231 elsewhere, can be any sequence of letters, digits, and underscores (starting
8232 with a letter) and must be unique among drivers of the same type. A router and
8233 a transport (for example) can each have the same name, but no two router
8234 instances can have the same name. The name of a driver instance should not be
8235 confused with the name of the underlying driver module. For example, the
8236 configuration lines:
8237 </para>
8238 <literallayout class="monospaced">
8239 remote_smtp:
8240   driver = smtp
8241 </literallayout>
8242 <para>
8243 create an instance of the <command>smtp</command> transport driver whose name is
8244 <command>remote_smtp</command>. The same driver code can be used more than once, with
8245 different instance names and different option settings each time. A second
8246 instance of the <command>smtp</command> transport, with different options, might be defined
8247 thus:
8248 </para>
8249 <literallayout class="monospaced">
8250 special_smtp:
8251   driver = smtp
8252   port = 1234
8253   command_timeout = 10s
8254 </literallayout>
8255 <para>
8256 The names <command>remote_smtp</command> and <command>special_smtp</command> would be used to reference
8257 these transport instances from routers, and these names would appear in log
8258 lines.
8259 </para>
8260 <para>
8261 Comment lines may be present in the middle of driver specifications. The full
8262 list of option settings for any particular driver instance, including all the
8263 defaulted values, can be extracted by making use of the <option>-bP</option> command line
8264 option.
8265 </para>
8266 </section>
8267 </chapter>
8268
8269 <chapter id="CHAPdefconfil">
8270 <title>The default configuration file</title>
8271 <para>
8272 <indexterm role="concept" id="IIDconfiwal" class="startofrange">
8273 <primary>configuration file</primary>
8274 <secondary>default <quote>walk through</quote></secondary>
8275 </indexterm>
8276 <indexterm role="concept">
8277 <primary>default</primary>
8278 <secondary>configuration file <quote>walk through</quote></secondary>
8279 </indexterm>
8280 The default configuration file supplied with Exim as <filename>src/configure.default</filename>
8281 is sufficient for a host with simple mail requirements. As an introduction to
8282 the way Exim is configured, this chapter <quote>walks through</quote> the default
8283 configuration, giving brief explanations of the settings. Detailed descriptions
8284 of the options are given in subsequent chapters. The default configuration file
8285 itself contains extensive comments about ways you might want to modify the
8286 initial settings. However, note that there are many options that are not
8287 mentioned at all in the default configuration.
8288 </para>
8289 <section id="SECTdefconfmain">
8290 <title>Main configuration settings</title>
8291 <para>
8292 The main (global) configuration option settings must always come first in the
8293 file. The first thing you&#x2019;ll see in the file, after some initial comments, is
8294 the line
8295 </para>
8296 <literallayout class="monospaced">
8297 # primary_hostname =
8298 </literallayout>
8299 <para>
8300 This is a commented-out setting of the <option>primary_hostname</option> option. Exim needs
8301 to know the official, fully qualified name of your host, and this is where you
8302 can specify it. However, in most cases you do not need to set this option. When
8303 it is unset, Exim uses the <function>uname()</function> system function to obtain the host name.
8304 </para>
8305 <para>
8306 The first three non-comment configuration lines are as follows:
8307 </para>
8308 <literallayout class="monospaced">
8309 domainlist local_domains    = @
8310 domainlist relay_to_domains =
8311 hostlist   relay_from_hosts = 127.0.0.1
8312 </literallayout>
8313 <para>
8314 These are not, in fact, option settings. They are definitions of two named
8315 domain lists and one named host list. Exim allows you to give names to lists of
8316 domains, hosts, and email addresses, in order to make it easier to manage the
8317 configuration file (see section <xref linkend="SECTnamedlists"/>).
8318 </para>
8319 <para>
8320 The first line defines a domain list called <emphasis>local_domains</emphasis>; this is used
8321 later in the configuration to identify domains that are to be delivered
8322 on the local host.
8323 </para>
8324 <para>
8325 <indexterm role="concept">
8326 <primary>@ in a domain list</primary>
8327 </indexterm>
8328 There is just one item in this list, the string <quote>@</quote>. This is a special form
8329 of entry which means <quote>the name of the local host</quote>. Thus, if the local host is
8330 called <emphasis>a.host.example</emphasis>, mail to <emphasis>any.user@a.host.example</emphasis> is expected to
8331 be delivered locally. Because the local host&#x2019;s name is referenced indirectly,
8332 the same configuration file can be used on different hosts.
8333 </para>
8334 <para>
8335 The second line defines a domain list called <emphasis>relay_to_domains</emphasis>, but the
8336 list itself is empty. Later in the configuration we will come to the part that
8337 controls mail relaying through the local host; it allows relaying to any
8338 domains in this list. By default, therefore, no relaying on the basis of a mail
8339 domain is permitted.
8340 </para>
8341 <para>
8342 The third line defines a host list called <emphasis>relay_from_hosts</emphasis>. This list is
8343 used later in the configuration to permit relaying from any host or IP address
8344 that matches the list. The default contains just the IP address of the IPv4
8345 loopback interface, which means that processes on the local host are able to
8346 submit mail for relaying by sending it over TCP/IP to that interface. No other
8347 hosts are permitted to submit messages for relaying.
8348 </para>
8349 <para>
8350 Just to be sure there&#x2019;s no misunderstanding: at this point in the configuration
8351 we aren&#x2019;t actually setting up any controls. We are just defining some domains
8352 and hosts that will be used in the controls that are specified later.
8353 </para>
8354 <para>
8355 The next two configuration lines are genuine option settings:
8356 </para>
8357 <literallayout class="monospaced">
8358 acl_smtp_rcpt = acl_check_rcpt
8359 acl_smtp_data = acl_check_data
8360 </literallayout>
8361 <para>
8362 These options specify <emphasis>Access Control Lists</emphasis> (ACLs) that are to be used
8363 during an incoming SMTP session for every recipient of a message (every RCPT
8364 command), and after the contents of the message have been received,
8365 respectively. The names of the lists are <emphasis>acl_check_rcpt</emphasis> and
8366 <emphasis>acl_check_data</emphasis>, and we will come to their definitions below, in the ACL
8367 section of the configuration. The RCPT ACL controls which recipients are
8368 accepted for an incoming message &ndash; if a configuration does not provide an ACL
8369 to check recipients, no SMTP mail can be accepted. The DATA ACL allows the
8370 contents of a message to be checked.
8371 </para>
8372 <para>
8373 Two commented-out option settings are next:
8374 </para>
8375 <literallayout class="monospaced">
8376 # av_scanner = clamd:/tmp/clamd
8377 # spamd_address = 127.0.0.1 783
8378 </literallayout>
8379 <para>
8380 These are example settings that can be used when Exim is compiled with the
8381 content-scanning extension. The first specifies the interface to the virus
8382 scanner, and the second specifies the interface to SpamAssassin. Further
8383 details are given in chapter <xref linkend="CHAPexiscan"/>.
8384 </para>
8385 <para>
8386 Three more commented-out option settings follow:
8387 </para>
8388 <literallayout class="monospaced">
8389 # tls_advertise_hosts = *
8390 # tls_certificate = /etc/ssl/exim.crt
8391 # tls_privatekey = /etc/ssl/exim.pem
8392 </literallayout>
8393 <para>
8394 These are example settings that can be used when Exim is compiled with
8395 support for TLS (aka SSL) as described in section <xref linkend="SECTinctlsssl"/>. The
8396 first one specifies the list of clients that are allowed to use TLS when
8397 connecting to this server; in this case the wildcard means all clients. The
8398 other options specify where Exim should find its TLS certificate and private
8399 key, which together prove the server&#x2019;s identity to any clients that connect.
8400 More details are given in chapter <xref linkend="CHAPTLS"/>.
8401 </para>
8402 <para>
8403 Another two commented-out option settings follow:
8404 </para>
8405 <literallayout class="monospaced">
8406 # daemon_smtp_ports = 25 : 465 : 587
8407 # tls_on_connect_ports = 465
8408 </literallayout>
8409 <para>
8410 <indexterm role="concept">
8411 <primary>port</primary>
8412 <secondary>465 and 587</secondary>
8413 </indexterm>
8414 <indexterm role="concept">
8415 <primary>port</primary>
8416 <secondary>for message submission</secondary>
8417 </indexterm>
8418 <indexterm role="concept">
8419 <primary>message</primary>
8420 <secondary>submission, ports for</secondary>
8421 </indexterm>
8422 <indexterm role="concept">
8423 <primary>ssmtp protocol</primary>
8424 </indexterm>
8425 <indexterm role="concept">
8426 <primary>smtps protocol</primary>
8427 </indexterm>
8428 <indexterm role="concept">
8429 <primary>SMTP</primary>
8430 <secondary>ssmtp protocol</secondary>
8431 </indexterm>
8432 <indexterm role="concept">
8433 <primary>SMTP</primary>
8434 <secondary>smtps protocol</secondary>
8435 </indexterm>
8436 These options provide better support for roaming users who wish to use this
8437 server for message submission. They are not much use unless you have turned on
8438 TLS (as described in the previous paragraph) and authentication (about which
8439 more in section <xref linkend="SECTdefconfauth"/>). The usual SMTP port 25 is often blocked
8440 on end-user networks, so RFC 4409 specifies that message submission should use
8441 port 587 instead. However some software (notably Microsoft Outlook) cannot be
8442 configured to use port 587 correctly, so these settings also enable the
8443 non-standard <quote>smtps</quote> (aka <quote>ssmtp</quote>) port 465 (see section
8444 <xref linkend="SECTsupobssmt"/>).
8445 </para>
8446 <para>
8447 Two more commented-out options settings follow:
8448 </para>
8449 <literallayout class="monospaced">
8450 # qualify_domain =
8451 # qualify_recipient =
8452 </literallayout>
8453 <para>
8454 The first of these specifies a domain that Exim uses when it constructs a
8455 complete email address from a local login name. This is often needed when Exim
8456 receives a message from a local process. If you do not set <option>qualify_domain</option>,
8457 the value of <option>primary_hostname</option> is used. If you set both of these options,
8458 you can have different qualification domains for sender and recipient
8459 addresses. If you set only the first one, its value is used in both cases.
8460 </para>
8461 <para>
8462 <indexterm role="concept">
8463 <primary>domain literal</primary>
8464 <secondary>recognizing format</secondary>
8465 </indexterm>
8466 The following line must be uncommented if you want Exim to recognize
8467 addresses of the form <emphasis>user@[10.11.12.13]</emphasis> that is, with a <quote>domain literal</quote>
8468 (an IP address within square brackets) instead of a named domain.
8469 </para>
8470 <literallayout class="monospaced">
8471 # allow_domain_literals
8472 </literallayout>
8473 <para>
8474 The RFCs still require this form, but many people think that in the modern
8475 Internet it makes little sense to permit mail to be sent to specific hosts by
8476 quoting their IP addresses. This ancient format has been used by people who
8477 try to abuse hosts by using them for unwanted relaying. However, some
8478 people believe there are circumstances (for example, messages addressed to
8479 <emphasis>postmaster</emphasis>) where domain literals are still useful.
8480 </para>
8481 <para>
8482 The next configuration line is a kind of trigger guard:
8483 </para>
8484 <literallayout class="monospaced">
8485 never_users = root
8486 </literallayout>
8487 <para>
8488 It specifies that no delivery must ever be run as the root user. The normal
8489 convention is to set up <emphasis>root</emphasis> as an alias for the system administrator. This
8490 setting is a guard against slips in the configuration.
8491 The list of users specified by <option>never_users</option> is not, however, the complete
8492 list; the build-time configuration in <filename>Local/Makefile</filename> has an option called
8493 FIXED_NEVER_USERS specifying a list that cannot be overridden. The
8494 contents of <option>never_users</option> are added to this list. By default
8495 FIXED_NEVER_USERS also specifies root.
8496 </para>
8497 <para>
8498 When a remote host connects to Exim in order to send mail, the only information
8499 Exim has about the host&#x2019;s identity is its IP address. The next configuration
8500 line,
8501 </para>
8502 <literallayout class="monospaced">
8503 host_lookup = *
8504 </literallayout>
8505 <para>
8506 specifies that Exim should do a reverse DNS lookup on all incoming connections,
8507 in order to get a host name. This improves the quality of the logging
8508 information, but if you feel it is too expensive, you can remove it entirely,
8509 or restrict the lookup to hosts on <quote>nearby</quote> networks.
8510 Note that it is not always possible to find a host name from an IP address,
8511 because not all DNS reverse zones are maintained, and sometimes DNS servers are
8512 unreachable.
8513 </para>
8514 <para>
8515 The next two lines are concerned with <emphasis>ident</emphasis> callbacks, as defined by RFC
8516 1413 (hence their names):
8517 </para>
8518 <literallayout class="monospaced" revisionflag="changed">
8519 rfc1413_hosts = *
8520 rfc1413_query_timeout = 0s
8521 </literallayout>
8522 <para>
8523 These settings cause Exim to avoid ident callbacks for all incoming SMTP calls.
8524 Few hosts offer RFC1413 service these days; calls have to be
8525 terminated by a timeout and this needlessly delays the startup
8526 of an incoming SMTP connection.
8527 If you have hosts for which you trust RFC1413 and need this
8528 information, you can change this.
8529 </para>
8530 <para>
8531 This line enables an efficiency SMTP option.  It is negociated by clients
8532 and not expected to cause problems but can be disabled if needed.
8533 </para>
8534 <literallayout class="monospaced">
8535 prdr_enable = true
8536 </literallayout>
8537 <para>
8538 When Exim receives messages over SMTP connections, it expects all addresses to
8539 be fully qualified with a domain, as required by the SMTP definition. However,
8540 if you are running a server to which simple clients submit messages, you may
8541 find that they send unqualified addresses. The two commented-out options:
8542 </para>
8543 <literallayout class="monospaced">
8544 # sender_unqualified_hosts =
8545 # recipient_unqualified_hosts =
8546 </literallayout>
8547 <para>
8548 show how you can specify hosts that are permitted to send unqualified sender
8549 and recipient addresses, respectively.
8550 </para>
8551 <para>
8552 The <option>percent_hack_domains</option> option is also commented out:
8553 </para>
8554 <literallayout class="monospaced">
8555 # percent_hack_domains =
8556 </literallayout>
8557 <para>
8558 It provides a list of domains for which the <quote>percent hack</quote> is to operate.
8559 This is an almost obsolete form of explicit email routing. If you do not know
8560 anything about it, you can safely ignore this topic.
8561 </para>
8562 <para>
8563 The last two settings in the main part of the default configuration are
8564 concerned with messages that have been <quote>frozen</quote> on Exim&#x2019;s queue. When a
8565 message is frozen, Exim no longer continues to try to deliver it. Freezing
8566 occurs when a bounce message encounters a permanent failure because the sender
8567 address of the original message that caused the bounce is invalid, so the
8568 bounce cannot be delivered. This is probably the most common case, but there
8569 are also other conditions that cause freezing, and frozen messages are not
8570 always bounce messages.
8571 </para>
8572 <literallayout class="monospaced">
8573 ignore_bounce_errors_after = 2d
8574 timeout_frozen_after = 7d
8575 </literallayout>
8576 <para>
8577 The first of these options specifies that failing bounce messages are to be
8578 discarded after 2 days on the queue. The second specifies that any frozen
8579 message (whether a bounce message or not) is to be timed out (and discarded)
8580 after a week. In this configuration, the first setting ensures that no failing
8581 bounce message ever lasts a week.
8582 </para>
8583 </section>
8584 <section id="SECID54">
8585 <title>ACL configuration</title>
8586 <para>
8587 <indexterm role="concept">
8588 <primary>default</primary>
8589 <secondary>ACLs</secondary>
8590 </indexterm>
8591 <indexterm role="concept">
8592 <primary>access control lists (ACLs)</primary>
8593 <secondary>default configuration</secondary>
8594 </indexterm>
8595 In the default configuration, the ACL section follows the main configuration.
8596 It starts with the line
8597 </para>
8598 <literallayout class="monospaced">
8599 begin acl
8600 </literallayout>
8601 <para>
8602 and it contains the definitions of two ACLs, called <emphasis>acl_check_rcpt</emphasis> and
8603 <emphasis>acl_check_data</emphasis>, that were referenced in the settings of <option>acl_smtp_rcpt</option>
8604 and <option>acl_smtp_data</option> above.
8605 </para>
8606 <para>
8607 <indexterm role="concept">
8608 <primary>RCPT</primary>
8609 <secondary>ACL for</secondary>
8610 </indexterm>
8611 The first ACL is used for every RCPT command in an incoming SMTP message. Each
8612 RCPT command specifies one of the message&#x2019;s recipients. The ACL statements
8613 are considered in order, until the recipient address is either accepted or
8614 rejected. The RCPT command is then accepted or rejected, according to the
8615 result of the ACL processing.
8616 </para>
8617 <literallayout class="monospaced">
8618 acl_check_rcpt:
8619 </literallayout>
8620 <para>
8621 This line, consisting of a name terminated by a colon, marks the start of the
8622 ACL, and names it.
8623 </para>
8624 <literallayout class="monospaced">
8625 accept  hosts = :
8626 </literallayout>
8627 <para>
8628 This ACL statement accepts the recipient if the sending host matches the list.
8629 But what does that strange list mean? It doesn&#x2019;t actually contain any host
8630 names or IP addresses. The presence of the colon puts an empty item in the
8631 list; Exim matches this only if the incoming message did not come from a remote
8632 host, because in that case, the remote hostname is empty. The colon is
8633 important. Without it, the list itself is empty, and can never match anything.
8634 </para>
8635 <para>
8636 What this statement is doing is to accept unconditionally all recipients in
8637 messages that are submitted by SMTP from local processes using the standard
8638 input and output (that is, not using TCP/IP). A number of MUAs operate in this
8639 manner.
8640 </para>
8641 <literallayout class="monospaced">
8642 deny    message       = Restricted characters in address
8643         domains       = +local_domains
8644         local_parts   = ^[.] : ^.*[@%!/|]
8645
8646 deny    message       = Restricted characters in address
8647         domains       = !+local_domains
8648         local_parts   = ^[./|] : ^.*[@%!] : ^.*/\\.\\./
8649 </literallayout>
8650 <para>
8651 These statements are concerned with local parts that contain any of the
8652 characters <quote>@</quote>, <quote>%</quote>, <quote>!</quote>, <quote>/</quote>, <quote>|</quote>, or dots in unusual places.
8653 Although these characters are entirely legal in local parts (in the case of
8654 <quote>@</quote> and leading dots, only if correctly quoted), they do not commonly occur
8655 in Internet mail addresses.
8656 </para>
8657 <para>
8658 The first three have in the past been associated with explicitly routed
8659 addresses (percent is still sometimes used &ndash; see the <option>percent_hack_domains</option>
8660 option). Addresses containing these characters are regularly tried by spammers
8661 in an attempt to bypass relaying restrictions, and also by open relay testing
8662 programs. Unless you really need them it is safest to reject these characters
8663 at this early stage. This configuration is heavy-handed in rejecting these
8664 characters for all messages it accepts from remote hosts. This is a deliberate
8665 policy of being as safe as possible.
8666 </para>
8667 <para>
8668 The first rule above is stricter, and is applied to messages that are addressed
8669 to one of the local domains handled by this host. This is implemented by the
8670 first condition, which restricts it to domains that are listed in the
8671 <emphasis>local_domains</emphasis> domain list. The <quote>+</quote> character is used to indicate a
8672 reference to a named list. In this configuration, there is just one domain in
8673 <emphasis>local_domains</emphasis>, but in general there may be many.
8674 </para>
8675 <para>
8676 The second condition on the first statement uses two regular expressions to
8677 block local parts that begin with a dot or contain <quote>@</quote>, <quote>%</quote>, <quote>!</quote>, <quote>/</quote>,
8678 or <quote>|</quote>. If you have local accounts that include these characters, you will
8679 have to modify this rule.
8680 </para>
8681 <para>
8682 Empty components (two dots in a row) are not valid in RFC 2822, but Exim
8683 allows them because they have been encountered in practice. (Consider the
8684 common convention of local parts constructed as
8685 <quote><emphasis>first-initial.second-initial.family-name</emphasis></quote> when applied to someone like
8686 the author of Exim, who has no second initial.) However, a local part starting
8687 with a dot or containing <quote>/../</quote> can cause trouble if it is used as part of a
8688 file name (for example, for a mailing list). This is also true for local parts
8689 that contain slashes. A pipe symbol can also be troublesome if the local part
8690 is incorporated unthinkingly into a shell command line.
8691 </para>
8692 <para>
8693 The second rule above applies to all other domains, and is less strict. This
8694 allows your own users to send outgoing messages to sites that use slashes
8695 and vertical bars in their local parts. It blocks local parts that begin
8696 with a dot, slash, or vertical bar, but allows these characters within the
8697 local part. However, the sequence <quote>/../</quote> is barred. The use of <quote>@</quote>, <quote>%</quote>,
8698 and <quote>!</quote> is blocked, as before. The motivation here is to prevent your users
8699 (or your users&#x2019; viruses) from mounting certain kinds of attack on remote sites.
8700 </para>
8701 <literallayout class="monospaced">
8702 accept  local_parts   = postmaster
8703         domains       = +local_domains
8704 </literallayout>
8705 <para>
8706 This statement, which has two conditions, accepts an incoming address if the
8707 local part is <emphasis>postmaster</emphasis> and the domain is one of those listed in the
8708 <emphasis>local_domains</emphasis> domain list. The <quote>+</quote> character is used to indicate a
8709 reference to a named list. In this configuration, there is just one domain in
8710 <emphasis>local_domains</emphasis>, but in general there may be many.
8711 </para>
8712 <para>
8713 The presence of this statement means that mail to postmaster is never blocked
8714 by any of the subsequent tests. This can be helpful while sorting out problems
8715 in cases where the subsequent tests are incorrectly denying access.
8716 </para>
8717 <literallayout class="monospaced">
8718 require verify        = sender
8719 </literallayout>
8720 <para>
8721 This statement requires the sender address to be verified before any subsequent
8722 ACL statement can be used. If verification fails, the incoming recipient
8723 address is refused. Verification consists of trying to route the address, to
8724 see if a bounce message could be delivered to it. In the case of remote
8725 addresses, basic verification checks only the domain, but <emphasis>callouts</emphasis> can be
8726 used for more verification if required. Section <xref linkend="SECTaddressverification"/>
8727 discusses the details of address verification.
8728 </para>
8729 <literallayout class="monospaced">
8730 accept  hosts         = +relay_from_hosts
8731         control       = submission
8732 </literallayout>
8733 <para>
8734 This statement accepts the address if the message is coming from one of the
8735 hosts that are defined as being allowed to relay through this host. Recipient
8736 verification is omitted here, because in many cases the clients are dumb MUAs
8737 that do not cope well with SMTP error responses. For the same reason, the
8738 second line specifies <quote>submission mode</quote> for messages that are accepted. This
8739 is described in detail in section <xref linkend="SECTsubmodnon"/>; it causes Exim to fix
8740 messages that are deficient in some way, for example, because they lack a
8741 <emphasis>Date:</emphasis> header line. If you are actually relaying out from MTAs, you should
8742 probably add recipient verification here, and disable submission mode.
8743 </para>
8744 <literallayout class="monospaced">
8745 accept  authenticated = *
8746         control       = submission
8747 </literallayout>
8748 <para>
8749 This statement accepts the address if the client host has authenticated itself.
8750 Submission mode is again specified, on the grounds that such messages are most
8751 likely to come from MUAs. The default configuration does not define any
8752 authenticators, though it does include some nearly complete commented-out
8753 examples described in <xref linkend="SECTdefconfauth"/>. This means that no client can in
8754 fact authenticate until you complete the authenticator definitions.
8755 </para>
8756 <literallayout class="monospaced">
8757 require message = relay not permitted
8758         domains = +local_domains : +relay_to_domains
8759 </literallayout>
8760 <para>
8761 This statement rejects the address if its domain is neither a local domain nor
8762 one of the domains for which this host is a relay.
8763 </para>
8764 <literallayout class="monospaced">
8765 require verify = recipient
8766 </literallayout>
8767 <para>
8768 This statement requires the recipient address to be verified; if verification
8769 fails, the address is rejected.
8770 </para>
8771 <literallayout class="monospaced">
8772 # deny    message     = rejected because $sender_host_address \
8773 #                       is in a black list at $dnslist_domain\n\
8774 #                       $dnslist_text
8775 #         dnslists    = black.list.example
8776 #
8777 # warn    dnslists    = black.list.example
8778 #         add_header  = X-Warning: $sender_host_address is in \
8779 #                       a black list at $dnslist_domain
8780 #         log_message = found in $dnslist_domain
8781 </literallayout>
8782 <para>
8783 These commented-out lines are examples of how you could configure Exim to check
8784 sending hosts against a DNS black list. The first statement rejects messages
8785 from blacklisted hosts, whereas the second just inserts a warning header
8786 line.
8787 </para>
8788 <literallayout class="monospaced">
8789 # require verify = csa
8790 </literallayout>
8791 <para>
8792 This commented-out line is an example of how you could turn on client SMTP
8793 authorization (CSA) checking. Such checks do DNS lookups for special SRV
8794 records.
8795 </para>
8796 <literallayout class="monospaced">
8797 accept
8798 </literallayout>
8799 <para>
8800 The final statement in the first ACL unconditionally accepts any recipient
8801 address that has successfully passed all the previous tests.
8802 </para>
8803 <literallayout class="monospaced">
8804 acl_check_data:
8805 </literallayout>
8806 <para>
8807 This line marks the start of the second ACL, and names it. Most of the contents
8808 of this ACL are commented out:
8809 </para>
8810 <literallayout class="monospaced">
8811 # deny    malware   = *
8812 #         message   = This message contains a virus \
8813 #                     ($malware_name).
8814 </literallayout>
8815 <para>
8816 These lines are examples of how to arrange for messages to be scanned for
8817 viruses when Exim has been compiled with the content-scanning extension, and a
8818 suitable virus scanner is installed. If the message is found to contain a
8819 virus, it is rejected with the given custom error message.
8820 </para>
8821 <literallayout class="monospaced">
8822 # warn    spam      = nobody
8823 #         message   = X-Spam_score: $spam_score\n\
8824 #                     X-Spam_score_int: $spam_score_int\n\
8825 #                     X-Spam_bar: $spam_bar\n\
8826 #                     X-Spam_report: $spam_report
8827 </literallayout>
8828 <para>
8829 These lines are an example of how to arrange for messages to be scanned by
8830 SpamAssassin when Exim has been compiled with the content-scanning extension,
8831 and SpamAssassin has been installed. The SpamAssassin check is run with
8832 <literal>nobody</literal> as its user parameter, and the results are added to the message as a
8833 series of extra header line. In this case, the message is not rejected,
8834 whatever the spam score.
8835 </para>
8836 <literallayout class="monospaced">
8837 accept
8838 </literallayout>
8839 <para>
8840 This final line in the DATA ACL accepts the message unconditionally.
8841 </para>
8842 </section>
8843 <section id="SECID55">
8844 <title>Router configuration</title>
8845 <para>
8846 <indexterm role="concept">
8847 <primary>default</primary>
8848 <secondary>routers</secondary>
8849 </indexterm>
8850 <indexterm role="concept">
8851 <primary>routers</primary>
8852 <secondary>default</secondary>
8853 </indexterm>
8854 The router configuration comes next in the default configuration, introduced
8855 by the line
8856 </para>
8857 <literallayout class="monospaced">
8858 begin routers
8859 </literallayout>
8860 <para>
8861 Routers are the modules in Exim that make decisions about where to send
8862 messages. An address is passed to each router in turn, until it is either
8863 accepted, or failed. This means that the order in which you define the routers
8864 matters. Each router is fully described in its own chapter later in this
8865 manual. Here we give only brief overviews.
8866 </para>
8867 <literallayout class="monospaced">
8868 # domain_literal:
8869 #   driver = ipliteral
8870 #   domains = !+local_domains
8871 #   transport = remote_smtp
8872 </literallayout>
8873 <para>
8874 <indexterm role="concept">
8875 <primary>domain literal</primary>
8876 <secondary>default router</secondary>
8877 </indexterm>
8878 This router is commented out because the majority of sites do not want to
8879 support domain literal addresses (those of the form <emphasis>user@[10.9.8.7]</emphasis>). If
8880 you uncomment this router, you also need to uncomment the setting of
8881 <option>allow_domain_literals</option> in the main part of the configuration.
8882 </para>
8883 <literallayout class="monospaced">
8884 dnslookup:
8885   driver = dnslookup
8886   domains = ! +local_domains
8887   transport = remote_smtp
8888   ignore_target_hosts = 0.0.0.0 : 127.0.0.0/8
8889   no_more
8890 </literallayout>
8891 <para>
8892 The first uncommented router handles addresses that do not involve any local
8893 domains. This is specified by the line
8894 </para>
8895 <literallayout class="monospaced">
8896 domains = ! +local_domains
8897 </literallayout>
8898 <para>
8899 The <option>domains</option> option lists the domains to which this router applies, but the
8900 exclamation mark is a negation sign, so the router is used only for domains
8901 that are not in the domain list called <emphasis>local_domains</emphasis> (which was defined at
8902 the start of the configuration). The plus sign before <emphasis>local_domains</emphasis>
8903 indicates that it is referring to a named list. Addresses in other domains are
8904 passed on to the following routers.
8905 </para>
8906 <para>
8907 The name of the router driver is <command>dnslookup</command>,
8908 and is specified by the <option>driver</option> option. Do not be confused by the fact that
8909 the name of this router instance is the same as the name of the driver. The
8910 instance name is arbitrary, but the name set in the <option>driver</option> option must be
8911 one of the driver modules that is in the Exim binary.
8912 </para>
8913 <para>
8914 The <command>dnslookup</command> router routes addresses by looking up their domains in the
8915 DNS in order to obtain a list of hosts to which the address is routed. If the
8916 router succeeds, the address is queued for the <command>remote_smtp</command> transport, as
8917 specified by the <option>transport</option> option. If the router does not find the domain
8918 in the DNS, no further routers are tried because of the <option>no_more</option> setting, so
8919 the address fails and is bounced.
8920 </para>
8921 <para>
8922 The <option>ignore_target_hosts</option> option specifies a list of IP addresses that are to
8923 be entirely ignored. This option is present because a number of cases have been
8924 encountered where MX records in the DNS point to host names
8925 whose IP addresses are 0.0.0.0 or are in the 127 subnet (typically 127.0.0.1).
8926 Completely ignoring these IP addresses causes Exim to fail to route the
8927 email address, so it bounces. Otherwise, Exim would log a routing problem, and
8928 continue to try to deliver the message periodically until the address timed
8929 out.
8930 </para>
8931 <literallayout class="monospaced">
8932 system_aliases:
8933   driver = redirect
8934   allow_fail
8935   allow_defer
8936   data = ${lookup{$local_part}lsearch{/etc/aliases}}
8937 # user = exim
8938   file_transport = address_file
8939   pipe_transport = address_pipe
8940 </literallayout>
8941 <para>
8942 Control reaches this and subsequent routers only for addresses in the local
8943 domains. This router checks to see whether the local part is defined as an
8944 alias in the <filename>/etc/aliases</filename> file, and if so, redirects it according to the
8945 data that it looks up from that file. If no data is found for the local part,
8946 the value of the <option>data</option> option is empty, causing the address to be passed to
8947 the next router.
8948 </para>
8949 <para>
8950 <filename>/etc/aliases</filename> is a conventional name for the system aliases file that is
8951 often used. That is why it is referenced by from the default configuration
8952 file. However, you can change this by setting SYSTEM_ALIASES_FILE in
8953 <filename>Local/Makefile</filename> before building Exim.
8954 </para>
8955 <literallayout class="monospaced">
8956 userforward:
8957   driver = redirect
8958   check_local_user
8959 # local_part_suffix = +* : -*
8960 # local_part_suffix_optional
8961   file = $home/.forward
8962 # allow_filter
8963   no_verify
8964   no_expn
8965   check_ancestor
8966   file_transport = address_file
8967   pipe_transport = address_pipe
8968   reply_transport = address_reply
8969 </literallayout>
8970 <para>
8971 This is the most complicated router in the default configuration. It is another
8972 redirection router, but this time it is looking for forwarding data set up by
8973 individual users. The <option>check_local_user</option> setting specifies a check that the
8974 local part of the address is the login name of a local user. If it is not, the
8975 router is skipped. The two commented options that follow <option>check_local_user</option>,
8976 namely:
8977 </para>
8978 <literallayout class="monospaced">
8979 # local_part_suffix = +* : -*
8980 # local_part_suffix_optional
8981 </literallayout>
8982 <para>
8983 <indexterm role="variable">
8984 <primary><varname>$local_part_suffix</varname></primary>
8985 </indexterm>
8986 show how you can specify the recognition of local part suffixes. If the first
8987 is uncommented, a suffix beginning with either a plus or a minus sign, followed
8988 by any sequence of characters, is removed from the local part and placed in the
8989 variable <varname>$local_part_suffix</varname>. The second suffix option specifies that the
8990 presence of a suffix in the local part is optional. When a suffix is present,
8991 the check for a local login uses the local part with the suffix removed.
8992 </para>
8993 <para>
8994 When a local user account is found, the file called <filename>.forward</filename> in the user&#x2019;s
8995 home directory is consulted. If it does not exist, or is empty, the router
8996 declines. Otherwise, the contents of <filename>.forward</filename> are interpreted as
8997 redirection data (see chapter <xref linkend="CHAPredirect"/> for more details).
8998 </para>
8999 <para>
9000 <indexterm role="concept">
9001 <primary>Sieve filter</primary>
9002 <secondary>enabling in default router</secondary>
9003 </indexterm>
9004 Traditional <filename>.forward</filename> files contain just a list of addresses, pipes, or
9005 files. Exim supports this by default. However, if <option>allow_filter</option> is set (it
9006 is commented out by default), the contents of the file are interpreted as a set
9007 of Exim or Sieve filtering instructions, provided the file begins with <quote>#Exim
9008 filter</quote> or <quote>#Sieve filter</quote>, respectively. User filtering is discussed in the
9009 separate document entitled <emphasis>Exim&#x2019;s interfaces to mail filtering</emphasis>.
9010 </para>
9011 <para>
9012 The <option>no_verify</option> and <option>no_expn</option> options mean that this router is skipped when
9013 verifying addresses, or when running as a consequence of an SMTP EXPN command.
9014 There are two reasons for doing this:
9015 </para>
9016 <orderedlist numeration="arabic">
9017 <listitem>
9018 <para>
9019 Whether or not a local user has a <filename>.forward</filename> file is not really relevant when
9020 checking an address for validity; it makes sense not to waste resources doing
9021 unnecessary work.
9022 </para>
9023 </listitem>
9024 <listitem>
9025 <para>
9026 More importantly, when Exim is verifying addresses or handling an EXPN
9027 command during an SMTP session, it is running as the Exim user, not as root.
9028 The group is the Exim group, and no additional groups are set up.
9029 It may therefore not be possible for Exim to read users&#x2019; <filename>.forward</filename> files at
9030 this time.
9031 </para>
9032 </listitem>
9033 </orderedlist>
9034 <para>
9035 The setting of <option>check_ancestor</option> prevents the router from generating a new
9036 address that is the same as any previous address that was redirected. (This
9037 works round a problem concerning a bad interaction between aliasing and
9038 forwarding &ndash; see section <xref linkend="SECTredlocmai"/>).
9039 </para>
9040 <para>
9041 The final three option settings specify the transports that are to be used when
9042 forwarding generates a direct delivery to a file, or to a pipe, or sets up an
9043 auto-reply, respectively. For example, if a <filename>.forward</filename> file contains
9044 </para>
9045 <literallayout class="monospaced">
9046 a.nother@elsewhere.example, /home/spqr/archive
9047 </literallayout>
9048 <para>
9049 the delivery to <filename>/home/spqr/archive</filename> is done by running the <option>address_file</option>
9050 transport.
9051 </para>
9052 <literallayout class="monospaced">
9053 localuser:
9054   driver = accept
9055   check_local_user
9056 # local_part_suffix = +* : -*
9057 # local_part_suffix_optional
9058   transport = local_delivery
9059 </literallayout>
9060 <para>
9061 The final router sets up delivery into local mailboxes, provided that the local
9062 part is the name of a local login, by accepting the address and assigning it to
9063 the <command>local_delivery</command> transport. Otherwise, we have reached the end of the
9064 routers, so the address is bounced. The commented suffix settings fulfil the
9065 same purpose as they do for the <command>userforward</command> router.
9066 </para>
9067 </section>
9068 <section id="SECID56">
9069 <title>Transport configuration</title>
9070 <para>
9071 <indexterm role="concept">
9072 <primary>default</primary>
9073 <secondary>transports</secondary>
9074 </indexterm>
9075 <indexterm role="concept">
9076 <primary>transports</primary>
9077 <secondary>default</secondary>
9078 </indexterm>
9079 Transports define mechanisms for actually delivering messages. They operate
9080 only when referenced from routers, so the order in which they are defined does
9081 not matter. The transports section of the configuration starts with
9082 </para>
9083 <literallayout class="monospaced">
9084 begin transports
9085 </literallayout>
9086 <para>
9087 One remote transport and four local transports are defined.
9088 </para>
9089 <literallayout class="monospaced">
9090 remote_smtp:
9091   driver = smtp
9092   hosts_try_prdr = *
9093 </literallayout>
9094 <para>
9095 This transport is used for delivering messages over SMTP connections.
9096 The list of remote hosts comes from the router.
9097 The <option>hosts_try_prdr</option> option enables an efficiency SMTP option.
9098 It is negotiated between client and server
9099 and not expected to cause problems but can be disabled if needed.
9100 All other options are defaulted.
9101 </para>
9102 <literallayout class="monospaced">
9103 local_delivery:
9104   driver = appendfile
9105   file = /var/mail/$local_part
9106   delivery_date_add
9107   envelope_to_add
9108   return_path_add
9109 # group = mail
9110 # mode = 0660
9111 </literallayout>
9112 <para>
9113 This <command>appendfile</command> transport is used for local delivery to user mailboxes in
9114 traditional BSD mailbox format. By default it runs under the uid and gid of the
9115 local user, which requires the sticky bit to be set on the <filename>/var/mail</filename>
9116 directory. Some systems use the alternative approach of running mail deliveries
9117 under a particular group instead of using the sticky bit. The commented options
9118 show how this can be done.
9119 </para>
9120 <para>
9121 Exim adds three headers to the message as it delivers it: <emphasis>Delivery-date:</emphasis>,
9122 <emphasis>Envelope-to:</emphasis> and <emphasis>Return-path:</emphasis>. This action is requested by the three
9123 similarly-named options above.
9124 </para>
9125 <literallayout class="monospaced">
9126 address_pipe:
9127   driver = pipe
9128   return_output
9129 </literallayout>
9130 <para>
9131 This transport is used for handling deliveries to pipes that are generated by
9132 redirection (aliasing or users&#x2019; <filename>.forward</filename> files). The <option>return_output</option>
9133 option specifies that any output generated by the pipe is to be returned to the
9134 sender.
9135 </para>
9136 <literallayout class="monospaced">
9137 address_file:
9138   driver = appendfile
9139   delivery_date_add
9140   envelope_to_add
9141   return_path_add
9142 </literallayout>
9143 <para>
9144 This transport is used for handling deliveries to files that are generated by
9145 redirection. The name of the file is not specified in this instance of
9146 <command>appendfile</command>, because it comes from the <command>redirect</command> router.
9147 </para>
9148 <literallayout class="monospaced">
9149 address_reply:
9150   driver = autoreply
9151 </literallayout>
9152 <para>
9153 This transport is used for handling automatic replies generated by users&#x2019;
9154 filter files.
9155 </para>
9156 </section>
9157 <section id="SECID57">
9158 <title>Default retry rule</title>
9159 <para>
9160 <indexterm role="concept">
9161 <primary>retry</primary>
9162 <secondary>default rule</secondary>
9163 </indexterm>
9164 <indexterm role="concept">
9165 <primary>default</primary>
9166 <secondary>retry rule</secondary>
9167 </indexterm>
9168 The retry section of the configuration file contains rules which affect the way
9169 Exim retries deliveries that cannot be completed at the first attempt. It is
9170 introduced by the line
9171 </para>
9172 <literallayout class="monospaced">
9173 begin retry
9174 </literallayout>
9175 <para>
9176 In the default configuration, there is just one rule, which applies to all
9177 errors:
9178 </para>
9179 <literallayout class="monospaced">
9180 *   *   F,2h,15m; G,16h,1h,1.5; F,4d,6h
9181 </literallayout>
9182 <para>
9183 This causes any temporarily failing address to be retried every 15 minutes for
9184 2 hours, then at intervals starting at one hour and increasing by a factor of
9185 1.5 until 16 hours have passed, then every 6 hours up to 4 days. If an address
9186 is not delivered after 4 days of temporary failure, it is bounced.
9187 </para>
9188 <para>
9189 If the retry section is removed from the configuration, or is empty (that is,
9190 if no retry rules are defined), Exim will not retry deliveries. This turns
9191 temporary errors into permanent errors.
9192 </para>
9193 </section>
9194 <section id="SECID58">
9195 <title>Rewriting configuration</title>
9196 <para>
9197 The rewriting section of the configuration, introduced by
9198 </para>
9199 <literallayout class="monospaced">
9200 begin rewrite
9201 </literallayout>
9202 <para>
9203 contains rules for rewriting addresses in messages as they arrive. There are no
9204 rewriting rules in the default configuration file.
9205 </para>
9206 </section>
9207 <section id="SECTdefconfauth">
9208 <title>Authenticators configuration</title>
9209 <para>
9210 <indexterm role="concept">
9211 <primary>AUTH</primary>
9212 <secondary>configuration</secondary>
9213 </indexterm>
9214 The authenticators section of the configuration, introduced by
9215 </para>
9216 <literallayout class="monospaced">
9217 begin authenticators
9218 </literallayout>
9219 <para>
9220 defines mechanisms for the use of the SMTP AUTH command. The default
9221 configuration file contains two commented-out example authenticators
9222 which support plaintext username/password authentication using the
9223 standard PLAIN mechanism and the traditional but non-standard LOGIN
9224 mechanism, with Exim acting as the server. PLAIN and LOGIN are enough
9225 to support most MUA software.
9226 </para>
9227 <para>
9228 The example PLAIN authenticator looks like this:
9229 </para>
9230 <literallayout class="monospaced">
9231 #PLAIN:
9232 #  driver                  = plaintext
9233 #  server_set_id           = $auth2
9234 #  server_prompts          = :
9235 #  server_condition        = Authentication is not yet configured
9236 #  server_advertise_condition = ${if def:tls_in_cipher }
9237 </literallayout>
9238 <para>
9239 And the example LOGIN authenticator looks like this:
9240 </para>
9241 <literallayout class="monospaced">
9242 #LOGIN:
9243 #  driver                  = plaintext
9244 #  server_set_id           = $auth1
9245 #  server_prompts          = &lt;| Username: | Password:
9246 #  server_condition        = Authentication is not yet configured
9247 #  server_advertise_condition = ${if def:tls_in_cipher }
9248 </literallayout>
9249 <para>
9250 The <option>server_set_id</option> option makes Exim remember the authenticated username
9251 in <varname>$authenticated_id</varname>, which can be used later in ACLs or routers. The
9252 <option>server_prompts</option> option configures the <command>plaintext</command> authenticator so
9253 that it implements the details of the specific authentication mechanism,
9254 i.e. PLAIN or LOGIN. The <option>server_advertise_condition</option> setting controls
9255 when Exim offers authentication to clients; in the examples, this is only
9256 when TLS or SSL has been started, so to enable the authenticators you also
9257 need to add support for TLS as described in section <xref linkend="SECTdefconfmain"/>.
9258 </para>
9259 <para>
9260 The <option>server_condition</option> setting defines how to verify that the username and
9261 password are correct. In the examples it just produces an error message.
9262 To make the authenticators work, you can use a string expansion
9263 expression like one of the examples in chapter <xref linkend="CHAPplaintext"/>.
9264 </para>
9265 <para>
9266 Beware that the sequence of the parameters to PLAIN and LOGIN differ; the
9267 usercode and password are in different positions.
9268 Chapter <xref linkend="CHAPplaintext"/> covers both.
9269 </para>
9270 <para>
9271 <indexterm role="concept" startref="IIDconfiwal" class="endofrange"/>
9272 </para>
9273 </section>
9274 </chapter>
9275
9276 <chapter id="CHAPregexp">
9277 <title>Regular expressions</title>
9278 <para>
9279 <indexterm role="concept">
9280 <primary>regular expressions</primary>
9281 <secondary>library</secondary>
9282 </indexterm>
9283 <indexterm role="concept">
9284 <primary>PCRE</primary>
9285 </indexterm>
9286 Exim supports the use of regular expressions in many of its options. It
9287 uses the PCRE regular expression library; this provides regular expression
9288 matching that is compatible with Perl 5. The syntax and semantics of
9289 regular expressions is discussed in many Perl reference books, and also in
9290 Jeffrey Friedl&#x2019;s <emphasis>Mastering Regular Expressions</emphasis>, which is published by
9291 O&#x2019;Reilly (see <emphasis role="bold"><ulink url="http://www.oreilly.com/catalog/regex2/">http://www.oreilly.com/catalog/regex2/</ulink></emphasis>).
9292 </para>
9293 <para>
9294 The documentation for the syntax and semantics of the regular expressions that
9295 are supported by PCRE is included in the PCRE distribution, and no further
9296 description is included here. The PCRE functions are called from Exim using
9297 the default option settings (that is, with no PCRE options set), except that
9298 the PCRE_CASELESS option is set when the matching is required to be
9299 case-insensitive.
9300 </para>
9301 <para>
9302 In most cases, when a regular expression is required in an Exim configuration,
9303 it has to start with a circumflex, in order to distinguish it from plain text
9304 or an <quote>ends with</quote> wildcard. In this example of a configuration setting, the
9305 second item in the colon-separated list is a regular expression.
9306 </para>
9307 <literallayout class="monospaced">
9308 domains = a.b.c : ^\\d{3} : *.y.z : ...
9309 </literallayout>
9310 <para>
9311 The doubling of the backslash is required because of string expansion that
9312 precedes interpretation &ndash; see section <xref linkend="SECTlittext"/> for more discussion
9313 of this issue, and a way of avoiding the need for doubling backslashes. The
9314 regular expression that is eventually used in this example contains just one
9315 backslash. The circumflex is included in the regular expression, and has the
9316 normal effect of <quote>anchoring</quote> it to the start of the string that is being
9317 matched.
9318 </para>
9319 <para>
9320 There are, however, two cases where a circumflex is not required for the
9321 recognition of a regular expression: these are the <option>match</option> condition in a
9322 string expansion, and the <option>matches</option> condition in an Exim filter file. In
9323 these cases, the relevant string is always treated as a regular expression; if
9324 it does not start with a circumflex, the expression is not anchored, and can
9325 match anywhere in the subject string.
9326 </para>
9327 <para>
9328 In all cases, if you want a regular expression to match at the end of a string,
9329 you must code the $ metacharacter to indicate this. For example:
9330 </para>
9331 <literallayout class="monospaced">
9332 domains = ^\\d{3}\\.example
9333 </literallayout>
9334 <para>
9335 matches the domain <emphasis>123.example</emphasis>, but it also matches <emphasis>123.example.com</emphasis>.
9336 You need to use:
9337 </para>
9338 <literallayout class="monospaced">
9339 domains = ^\\d{3}\\.example\$
9340 </literallayout>
9341 <para>
9342 if you want <emphasis>example</emphasis> to be the top-level domain. The backslash before the
9343 $ is needed because string expansion also interprets dollar characters.
9344 </para>
9345 </chapter>
9346
9347 <chapter id="CHAPfdlookup">
9348 <title>File and database lookups</title>
9349 <para>
9350 <indexterm role="concept" id="IIDfidalo1" class="startofrange">
9351 <primary>file</primary>
9352 <secondary>lookups</secondary>
9353 </indexterm>
9354 <indexterm role="concept" id="IIDfidalo2" class="startofrange">
9355 <primary>database</primary>
9356 <secondary>lookups</secondary>
9357 </indexterm>
9358 <indexterm role="concept">
9359 <primary>lookup</primary>
9360 <secondary>description of</secondary>
9361 </indexterm>
9362 Exim can be configured to look up data in files or databases as it processes
9363 messages. Two different kinds of syntax are used:
9364 </para>
9365 <orderedlist numeration="arabic">
9366 <listitem>
9367 <para>
9368 A string that is to be expanded may contain explicit lookup requests. These
9369 cause parts of the string to be replaced by data that is obtained from the
9370 lookup. Lookups of this type are conditional expansion items. Different results
9371 can be defined for the cases of lookup success and failure. See chapter
9372 <xref linkend="CHAPexpand"/>, where string expansions are described in detail.
9373 </para>
9374 </listitem>
9375 <listitem>
9376 <para>
9377 Lists of domains, hosts, and email addresses can contain lookup requests as a
9378 way of avoiding excessively long linear lists. In this case, the data that is
9379 returned by the lookup is often (but not always) discarded; whether the lookup
9380 succeeds or fails is what really counts. These kinds of list are described in
9381 chapter <xref linkend="CHAPdomhosaddlists"/>.
9382 </para>
9383 </listitem>
9384 </orderedlist>
9385 <para>
9386 String expansions, lists, and lookups interact with each other in such a way
9387 that there is no order in which to describe any one of them that does not
9388 involve references to the others. Each of these three chapters makes more sense
9389 if you have read the other two first. If you are reading this for the first
9390 time, be aware that some of it will make a lot more sense after you have read
9391 chapters <xref linkend="CHAPdomhosaddlists"/> and <xref linkend="CHAPexpand"/>.
9392 </para>
9393 <section id="SECID60">
9394 <title>Examples of different lookup syntax</title>
9395 <para>
9396 It is easy to confuse the two different kinds of lookup, especially as the
9397 lists that may contain the second kind are always expanded before being
9398 processed as lists. Therefore, they may also contain lookups of the first kind.
9399 Be careful to distinguish between the following two examples:
9400 </para>
9401 <literallayout class="monospaced">
9402 domains = ${lookup{$sender_host_address}lsearch{/some/file}}
9403 domains = lsearch;/some/file
9404 </literallayout>
9405 <para>
9406 The first uses a string expansion, the result of which must be a domain list.
9407 No strings have been specified for a successful or a failing lookup; the
9408 defaults in this case are the looked-up data and an empty string, respectively.
9409 The expansion takes place before the string is processed as a list, and the
9410 file that is searched could contain lines like this:
9411 </para>
9412 <literallayout class="monospaced">
9413 192.168.3.4: domain1:domain2:...
9414 192.168.1.9: domain3:domain4:...
9415 </literallayout>
9416 <para>
9417 When the lookup succeeds, the result of the expansion is a list of domains (and
9418 possibly other types of item that are allowed in domain lists).
9419 </para>
9420 <para>
9421 In the second example, the lookup is a single item in a domain list. It causes
9422 Exim to use a lookup to see if the domain that is being processed can be found
9423 in the file. The file could contains lines like this:
9424 </para>
9425 <literallayout class="monospaced">
9426 domain1:
9427 domain2:
9428 </literallayout>
9429 <para>
9430 Any data that follows the keys is not relevant when checking that the domain
9431 matches the list item.
9432 </para>
9433 <para>
9434 It is possible, though no doubt confusing, to use both kinds of lookup at once.
9435 Consider a file containing lines like this:
9436 </para>
9437 <literallayout class="monospaced">
9438 192.168.5.6: lsearch;/another/file
9439 </literallayout>
9440 <para>
9441 If the value of <varname>$sender_host_address</varname> is 192.168.5.6, expansion of the
9442 first <option>domains</option> setting above generates the second setting, which therefore
9443 causes a second lookup to occur.
9444 </para>
9445 <para>
9446 The rest of this chapter describes the different lookup types that are
9447 available. Any of them can be used in any part of the configuration where a
9448 lookup is permitted.
9449 </para>
9450 </section>
9451 <section id="SECID61">
9452 <title>Lookup types</title>
9453 <para>
9454 <indexterm role="concept">
9455 <primary>lookup</primary>
9456 <secondary>types of</secondary>
9457 </indexterm>
9458 <indexterm role="concept">
9459 <primary>single-key lookup</primary>
9460 <secondary>definition of</secondary>
9461 </indexterm>
9462 Two different types of data lookup are implemented:
9463 </para>
9464 <itemizedlist>
9465 <listitem>
9466 <para>
9467 The <emphasis>single-key</emphasis> type requires the specification of a file in which to look,
9468 and a single key to search for. The key must be a non-empty string for the
9469 lookup to succeed. The lookup type determines how the file is searched.
9470 </para>
9471 </listitem>
9472 <listitem>
9473 <para>
9474 <indexterm role="concept">
9475 <primary>query-style lookup</primary>
9476 <secondary>definition of</secondary>
9477 </indexterm>
9478 The <emphasis>query-style</emphasis> type accepts a generalized database query. No particular
9479 key value is assumed by Exim for query-style lookups. You can use whichever
9480 Exim variables you need to construct the database query.
9481 </para>
9482 </listitem>
9483 </itemizedlist>
9484 <para>
9485 The code for each lookup type is in a separate source file that is included in
9486 the binary of Exim only if the corresponding compile-time option is set. The
9487 default settings in <filename>src/EDITME</filename> are:
9488 </para>
9489 <literallayout class="monospaced">
9490 LOOKUP_DBM=yes
9491 LOOKUP_LSEARCH=yes
9492 </literallayout>
9493 <para>
9494 which means that only linear searching and DBM lookups are included by default.
9495 For some types of lookup (e.g. SQL databases), you need to install appropriate
9496 libraries and header files before building Exim.
9497 </para>
9498 </section>
9499 <section id="SECTsinglekeylookups">
9500 <title>Single-key lookup types</title>
9501 <para>
9502 <indexterm role="concept">
9503 <primary>lookup</primary>
9504 <secondary>single-key types</secondary>
9505 </indexterm>
9506 <indexterm role="concept">
9507 <primary>single-key lookup</primary>
9508 <secondary>list of types</secondary>
9509 </indexterm>
9510 The following single-key lookup types are implemented:
9511 </para>
9512 <itemizedlist>
9513 <listitem>
9514 <para>
9515 <indexterm role="concept">
9516 <primary>cdb</primary>
9517 <secondary>description of</secondary>
9518 </indexterm>
9519 <indexterm role="concept">
9520 <primary>lookup</primary>
9521 <secondary>cdb</secondary>
9522 </indexterm>
9523 <indexterm role="concept">
9524 <primary>binary zero</primary>
9525 <secondary>in lookup key</secondary>
9526 </indexterm>
9527 <command>cdb</command>: The given file is searched as a Constant DataBase file, using the key
9528 string without a terminating binary zero. The cdb format is designed for
9529 indexed files that are read frequently and never updated, except by total
9530 re-creation. As such, it is particularly suitable for large files containing
9531 aliases or other indexed data referenced by an MTA. Information about cdb can
9532 be found in several places:
9533 </para>
9534 <literallayout>
9535 <emphasis role="bold"><ulink url="http://www.pobox.com/~djb/cdb.html">http://www.pobox.com/~djb/cdb.html</ulink></emphasis>
9536 <emphasis role="bold"><ulink url="ftp://ftp.corpit.ru/pub/tinycdb/">ftp://ftp.corpit.ru/pub/tinycdb/</ulink></emphasis>
9537 <emphasis role="bold"><ulink url="http://packages.debian.org/stable/utils/freecdb.html">http://packages.debian.org/stable/utils/freecdb.html</ulink></emphasis>
9538 </literallayout>
9539 <para>
9540 A cdb distribution is not needed in order to build Exim with cdb support,
9541 because the code for reading cdb files is included directly in Exim itself.
9542 However, no means of building or testing cdb files is provided with Exim, so
9543 you need to obtain a cdb distribution in order to do this.
9544 </para>
9545 </listitem>
9546 <listitem>
9547 <para>
9548 <indexterm role="concept">
9549 <primary>DBM</primary>
9550 <secondary>lookup type</secondary>
9551 </indexterm>
9552 <indexterm role="concept">
9553 <primary>lookup</primary>
9554 <secondary>dbm</secondary>
9555 </indexterm>
9556 <indexterm role="concept">
9557 <primary>binary zero</primary>
9558 <secondary>in lookup key</secondary>
9559 </indexterm>
9560 <command>dbm</command>: Calls to DBM library functions are used to extract data from the given
9561 DBM file by looking up the record with the given key. A terminating binary
9562 zero is included in the key that is passed to the DBM library. See section
9563 <xref linkend="SECTdb"/> for a discussion of DBM libraries.
9564 </para>
9565 <para>
9566 <indexterm role="concept">
9567 <primary>Berkeley DB library</primary>
9568 <secondary>file format</secondary>
9569 </indexterm>
9570 For all versions of Berkeley DB, Exim uses the DB_HASH style of database
9571 when building DBM files using the <option>exim_dbmbuild</option> utility. However, when
9572 using Berkeley DB versions 3 or 4, it opens existing databases for reading with
9573 the DB_UNKNOWN option. This enables it to handle any of the types of database
9574 that the library supports, and can be useful for accessing DBM files created by
9575 other applications. (For earlier DB versions, DB_HASH is always used.)
9576 </para>
9577 </listitem>
9578 <listitem>
9579 <para>
9580 <indexterm role="concept">
9581 <primary>lookup</primary>
9582 <secondary>dbmjz</secondary>
9583 </indexterm>
9584 <indexterm role="concept">
9585 <primary>lookup</primary>
9586 <secondary>dbm &ndash; embedded NULs</secondary>
9587 </indexterm>
9588 <indexterm role="concept">
9589 <primary>sasldb2</primary>
9590 </indexterm>
9591 <indexterm role="concept">
9592 <primary>dbmjz lookup type</primary>
9593 </indexterm>
9594 <command>dbmjz</command>: This is the same as <command>dbm</command>, except that the lookup key is
9595 interpreted as an Exim list; the elements of the list are joined together with
9596 ASCII NUL characters to form the lookup key.  An example usage would be to
9597 authenticate incoming SMTP calls using the passwords from Cyrus SASL&#x2019;s
9598 <filename>/etc/sasldb2</filename> file with the <command>gsasl</command> authenticator or Exim&#x2019;s own
9599 <command>cram_md5</command> authenticator.
9600 </para>
9601 </listitem>
9602 <listitem>
9603 <para>
9604 <indexterm role="concept">
9605 <primary>lookup</primary>
9606 <secondary>dbmnz</secondary>
9607 </indexterm>
9608 <indexterm role="concept">
9609 <primary>lookup</primary>
9610 <secondary>dbm &ndash; terminating zero</secondary>
9611 </indexterm>
9612 <indexterm role="concept">
9613 <primary>binary zero</primary>
9614 <secondary>in lookup key</secondary>
9615 </indexterm>
9616 <indexterm role="concept">
9617 <primary>Courier</primary>
9618 </indexterm>
9619 <indexterm role="concept">
9620 <primary><filename>/etc/userdbshadow.dat</filename></primary>
9621 </indexterm>
9622 <indexterm role="concept">
9623 <primary>dbmnz lookup type</primary>
9624 </indexterm>
9625 <command>dbmnz</command>: This is the same as <command>dbm</command>, except that a terminating binary zero
9626 is not included in the key that is passed to the DBM library. You may need this
9627 if you want to look up data in files that are created by or shared with some
9628 other application that does not use terminating zeros. For example, you need to
9629 use <command>dbmnz</command> rather than <command>dbm</command> if you want to authenticate incoming SMTP
9630 calls using the passwords from Courier&#x2019;s <filename>/etc/userdbshadow.dat</filename> file. Exim&#x2019;s
9631 utility program for creating DBM files (<emphasis>exim_dbmbuild</emphasis>) includes the zeros
9632 by default, but has an option to omit them (see section <xref linkend="SECTdbmbuild"/>).
9633 </para>
9634 </listitem>
9635 <listitem>
9636 <para>
9637 <indexterm role="concept">
9638 <primary>lookup</primary>
9639 <secondary>dsearch</secondary>
9640 </indexterm>
9641 <indexterm role="concept">
9642 <primary>dsearch lookup type</primary>
9643 </indexterm>
9644 <command>dsearch</command>: The given file must be a directory; this is searched for an entry
9645 whose name is the key by calling the <function>lstat()</function> function. The key may not
9646 contain any forward slash characters. If <function>lstat()</function> succeeds, the result of
9647 the lookup is the name of the entry, which may be a file, directory,
9648 symbolic link, or any other kind of directory entry. An example of how this
9649 lookup can be used to support virtual domains is given in section
9650 <xref linkend="SECTvirtualdomains"/>.
9651 </para>
9652 </listitem>
9653 <listitem>
9654 <para>
9655 <indexterm role="concept">
9656 <primary>lookup</primary>
9657 <secondary>iplsearch</secondary>
9658 </indexterm>
9659 <indexterm role="concept">
9660 <primary>iplsearch lookup type</primary>
9661 </indexterm>
9662 <command>iplsearch</command>: The given file is a text file containing keys and data. A key is
9663 terminated by a colon or white space or the end of the line. The keys in the
9664 file must be IP addresses, or IP addresses with CIDR masks. Keys that involve
9665 IPv6 addresses must be enclosed in quotes to prevent the first internal colon
9666 being interpreted as a key terminator. For example:
9667 </para>
9668 <literallayout class="monospaced">
9669 1.2.3.4:           data for 1.2.3.4
9670 192.168.0.0/16:    data for 192.168.0.0/16
9671 "abcd::cdab":      data for abcd::cdab
9672 "abcd:abcd::/32"   data for abcd:abcd::/32
9673 </literallayout>
9674 <para>
9675 The key for an <command>iplsearch</command> lookup must be an IP address (without a mask). The
9676 file is searched linearly, using the CIDR masks where present, until a matching
9677 key is found. The first key that matches is used; there is no attempt to find a
9678 <quote>best</quote> match. Apart from the way the keys are matched, the processing for
9679 <command>iplsearch</command> is the same as for <command>lsearch</command>.
9680 </para>
9681 <para>
9682 <emphasis role="bold">Warning 1</emphasis>: Unlike most other single-key lookup types, a file of data for
9683 <command>iplsearch</command> can <emphasis>not</emphasis> be turned into a DBM or cdb file, because those
9684 lookup types support only literal keys.
9685 </para>
9686 <para>
9687 <emphasis role="bold">Warning 2</emphasis>: In a host list, you must always use <command>net-iplsearch</command> so that
9688 the implicit key is the host&#x2019;s IP address rather than its name (see section
9689 <xref linkend="SECThoslispatsikey"/>).
9690 </para>
9691 </listitem>
9692 <listitem>
9693 <para>
9694 <indexterm role="concept">
9695 <primary>linear search</primary>
9696 </indexterm>
9697 <indexterm role="concept">
9698 <primary>lookup</primary>
9699 <secondary>lsearch</secondary>
9700 </indexterm>
9701 <indexterm role="concept">
9702 <primary>lsearch lookup type</primary>
9703 </indexterm>
9704 <indexterm role="concept">
9705 <primary>case sensitivity</primary>
9706 <secondary>in lsearch lookup</secondary>
9707 </indexterm>
9708 <command>lsearch</command>: The given file is a text file that is searched linearly for a
9709 line beginning with the search key, terminated by a colon or white space or the
9710 end of the line. The search is case-insensitive; that is, upper and lower case
9711 letters are treated as the same. The first occurrence of the key that is found
9712 in the file is used.
9713 </para>
9714 <para>
9715 White space between the key and the colon is permitted. The remainder of the
9716 line, with leading and trailing white space removed, is the data. This can be
9717 continued onto subsequent lines by starting them with any amount of white
9718 space, but only a single space character is included in the data at such a
9719 junction. If the data begins with a colon, the key must be terminated by a
9720 colon, for example:
9721 </para>
9722 <literallayout class="monospaced">
9723 baduser:  :fail:
9724 </literallayout>
9725 <para>
9726 Empty lines and lines beginning with # are ignored, even if they occur in the
9727 middle of an item. This is the traditional textual format of alias files. Note
9728 that the keys in an <command>lsearch</command> file are literal strings. There is no
9729 wildcarding of any kind.
9730 </para>
9731 <para>
9732 <indexterm role="concept">
9733 <primary>lookup</primary>
9734 <secondary>lsearch &ndash; colons in keys</secondary>
9735 </indexterm>
9736 <indexterm role="concept">
9737 <primary>white space</primary>
9738 <secondary>in lsearch key</secondary>
9739 </indexterm>
9740 In most <command>lsearch</command> files, keys are not required to contain colons or #
9741 characters, or white space. However, if you need this feature, it is available.
9742 If a key begins with a doublequote character, it is terminated only by a
9743 matching quote (or end of line), and the normal escaping rules apply to its
9744 contents (see section <xref linkend="SECTstrings"/>). An optional colon is permitted after
9745 quoted keys (exactly as for unquoted keys). There is no special handling of
9746 quotes for the data part of an <command>lsearch</command> line.
9747 </para>
9748 </listitem>
9749 <listitem>
9750 <para>
9751 <indexterm role="concept">
9752 <primary>NIS lookup type</primary>
9753 </indexterm>
9754 <indexterm role="concept">
9755 <primary>lookup</primary>
9756 <secondary>NIS</secondary>
9757 </indexterm>
9758 <indexterm role="concept">
9759 <primary>binary zero</primary>
9760 <secondary>in lookup key</secondary>
9761 </indexterm>
9762 <command>nis</command>: The given file is the name of a NIS map, and a NIS lookup is done with
9763 the given key, without a terminating binary zero. There is a variant called
9764 <command>nis0</command> which does include the terminating binary zero in the key. This is
9765 reportedly needed for Sun-style alias files. Exim does not recognize NIS
9766 aliases; the full map names must be used.
9767 </para>
9768 </listitem>
9769 <listitem>
9770 <para>
9771 <indexterm role="concept">
9772 <primary>wildlsearch lookup type</primary>
9773 </indexterm>
9774 <indexterm role="concept">
9775 <primary>lookup</primary>
9776 <secondary>wildlsearch</secondary>
9777 </indexterm>
9778 <indexterm role="concept">
9779 <primary>nwildlsearch lookup type</primary>
9780 </indexterm>
9781 <indexterm role="concept">
9782 <primary>lookup</primary>
9783 <secondary>nwildlsearch</secondary>
9784 </indexterm>
9785 <command>wildlsearch</command> or <command>nwildlsearch</command>: These search a file linearly, like
9786 <command>lsearch</command>, but instead of being interpreted as a literal string, each key in
9787 the file may be wildcarded. The difference between these two lookup types is
9788 that for <command>wildlsearch</command>, each key in the file is string-expanded before being
9789 used, whereas for <command>nwildlsearch</command>, no expansion takes place.
9790 </para>
9791 <para>
9792 <indexterm role="concept">
9793 <primary>case sensitivity</primary>
9794 <secondary>in (n)wildlsearch lookup</secondary>
9795 </indexterm>
9796 Like <command>lsearch</command>, the testing is done case-insensitively. However, keys in the
9797 file that are regular expressions can be made case-sensitive by the use of
9798 <literal>(-i)</literal> within the pattern. The following forms of wildcard are recognized:
9799 </para>
9800 <orderedlist numeration="arabic">
9801 <listitem>
9802 <para>
9803 The string may begin with an asterisk to mean <quote>ends with</quote>. For example:
9804 </para>
9805 <literallayout class="monospaced">
9806     *.a.b.c       data for anything.a.b.c
9807     *fish         data for anythingfish
9808 </literallayout>
9809 </listitem>
9810 <listitem>
9811 <para>
9812 The string may begin with a circumflex to indicate a regular expression. For
9813 example, for <command>wildlsearch</command>:
9814 </para>
9815 <literallayout class="monospaced">
9816     ^\N\d+\.a\.b\N    data for &lt;digits&gt;.a.b
9817 </literallayout>
9818 <para>
9819 Note the use of <literal>\N</literal> to disable expansion of the contents of the regular
9820 expression. If you are using <command>nwildlsearch</command>, where the keys are not
9821 string-expanded, the equivalent entry is:
9822 </para>
9823 <literallayout class="monospaced">
9824     ^\d+\.a\.b        data for &lt;digits&gt;.a.b
9825 </literallayout>
9826 <para>
9827 The case-insensitive flag is set at the start of compiling the regular
9828 expression, but it can be turned off by using <literal>(-i)</literal> at an appropriate point.
9829 For example, to make the entire pattern case-sensitive:
9830 </para>
9831 <literallayout class="monospaced">
9832     ^(?-i)\d+\.a\.b        data for &lt;digits&gt;.a.b
9833 </literallayout>
9834 <para>
9835 If the regular expression contains white space or colon characters, you must
9836 either quote it (see <command>lsearch</command> above), or represent these characters in other
9837 ways. For example, <literal>\s</literal> can be used for white space and <literal>\x3A</literal> for a
9838 colon. This may be easier than quoting, because if you quote, you have to
9839 escape all the backslashes inside the quotes.
9840 </para>
9841 <para>
9842 <emphasis role="bold">Note</emphasis>: It is not possible to capture substrings in a regular expression
9843 match for later use, because the results of all lookups are cached. If a lookup
9844 is repeated, the result is taken from the cache, and no actual pattern matching
9845 takes place. The values of all the numeric variables are unset after a
9846 <command>(n)wildlsearch</command> match.
9847 </para>
9848 </listitem>
9849 <listitem>
9850 <para>
9851 Although I cannot see it being of much use, the general matching function that
9852 is used to implement <command>(n)wildlsearch</command> means that the string may begin with a
9853 lookup name terminated by a semicolon, and followed by lookup data. For
9854 example:
9855 </para>
9856 <literallayout class="monospaced">
9857     cdb;/some/file  data for keys that match the file
9858 </literallayout>
9859 <para>
9860 The data that is obtained from the nested lookup is discarded.
9861 </para>
9862 </listitem>
9863 </orderedlist>
9864 <para>
9865 Keys that do not match any of these patterns are interpreted literally. The
9866 continuation rules for the data are the same as for <command>lsearch</command>, and keys may
9867 be followed by optional colons.
9868 </para>
9869 <para>
9870 <emphasis role="bold">Warning</emphasis>: Unlike most other single-key lookup types, a file of data for
9871 <command>(n)wildlsearch</command> can <emphasis>not</emphasis> be turned into a DBM or cdb file, because those
9872 lookup types support only literal keys.
9873 </para>
9874 </listitem>
9875 </itemizedlist>
9876 </section>
9877 <section id="SECID62">
9878 <title>Query-style lookup types</title>
9879 <para>
9880 <indexterm role="concept">
9881 <primary>lookup</primary>
9882 <secondary>query-style types</secondary>
9883 </indexterm>
9884 <indexterm role="concept">
9885 <primary>query-style lookup</primary>
9886 <secondary>list of types</secondary>
9887 </indexterm>
9888 The supported query-style lookup types are listed below. Further details about
9889 many of them are given in later sections.
9890 </para>
9891 <itemizedlist>
9892 <listitem>
9893 <para>
9894 <indexterm role="concept">
9895 <primary>DNS</primary>
9896 <secondary>as a lookup type</secondary>
9897 </indexterm>
9898 <indexterm role="concept">
9899 <primary>lookup</primary>
9900 <secondary>DNS</secondary>
9901 </indexterm>
9902 <command>dnsdb</command>: This does a DNS search for one or more records whose domain names
9903 are given in the supplied query. The resulting data is the contents of the
9904 records. See section <xref linkend="SECTdnsdb"/>.
9905 </para>
9906 </listitem>
9907 <listitem>
9908 <para>
9909 <indexterm role="concept">
9910 <primary>InterBase lookup type</primary>
9911 </indexterm>
9912 <indexterm role="concept">
9913 <primary>lookup</primary>
9914 <secondary>InterBase</secondary>
9915 </indexterm>
9916 <command>ibase</command>: This does a lookup in an InterBase database.
9917 </para>
9918 </listitem>
9919 <listitem>
9920 <para>
9921 <indexterm role="concept">
9922 <primary>LDAP</primary>
9923 <secondary>lookup type</secondary>
9924 </indexterm>
9925 <indexterm role="concept">
9926 <primary>lookup</primary>
9927 <secondary>LDAP</secondary>
9928 </indexterm>
9929 <command>ldap</command>: This does an LDAP lookup using a query in the form of a URL, and
9930 returns attributes from a single entry. There is a variant called <command>ldapm</command>
9931 that permits values from multiple entries to be returned. A third variant
9932 called <command>ldapdn</command> returns the Distinguished Name of a single entry instead of
9933 any attribute values. See section <xref linkend="SECTldap"/>.
9934 </para>
9935 </listitem>
9936 <listitem>
9937 <para>
9938 <indexterm role="concept">
9939 <primary>MySQL</primary>
9940 <secondary>lookup type</secondary>
9941 </indexterm>
9942 <indexterm role="concept">
9943 <primary>lookup</primary>
9944 <secondary>MySQL</secondary>
9945 </indexterm>
9946 <command>mysql</command>: The format of the query is an SQL statement that is passed to a
9947 MySQL database. See section <xref linkend="SECTsql"/>.
9948 </para>
9949 </listitem>
9950 <listitem>
9951 <para>
9952 <indexterm role="concept">
9953 <primary>NIS+ lookup type</primary>
9954 </indexterm>
9955 <indexterm role="concept">
9956 <primary>lookup</primary>
9957 <secondary>NIS+</secondary>
9958 </indexterm>
9959 <command>nisplus</command>: This does a NIS+ lookup using a query that can specify the name of
9960 the field to be returned. See section <xref linkend="SECTnisplus"/>.
9961 </para>
9962 </listitem>
9963 <listitem>
9964 <para>
9965 <indexterm role="concept">
9966 <primary>Oracle</primary>
9967 <secondary>lookup type</secondary>
9968 </indexterm>
9969 <indexterm role="concept">
9970 <primary>lookup</primary>
9971 <secondary>Oracle</secondary>
9972 </indexterm>
9973 <command>oracle</command>: The format of the query is an SQL statement that is passed to an
9974 Oracle database. See section <xref linkend="SECTsql"/>.
9975 </para>
9976 </listitem>
9977 <listitem>
9978 <para>
9979 <indexterm role="concept">
9980 <primary>lookup</primary>
9981 <secondary>passwd</secondary>
9982 </indexterm>
9983 <indexterm role="concept">
9984 <primary>passwd lookup type</primary>
9985 </indexterm>
9986 <indexterm role="concept">
9987 <primary><filename>/etc/passwd</filename></primary>
9988 </indexterm>
9989 <command>passwd</command> is a query-style lookup with queries that are just user names. The
9990 lookup calls <function>getpwnam()</function> to interrogate the system password data, and on
9991 success, the result string is the same as you would get from an <command>lsearch</command>
9992 lookup on a traditional <filename>/etc/passwd file</filename>, though with <literal>*</literal> for the
9993 password value. For example:
9994 </para>
9995 <literallayout class="monospaced">
9996 *:42:42:King Rat:/home/kr:/bin/bash
9997 </literallayout>
9998 </listitem>
9999 <listitem>
10000 <para>
10001 <indexterm role="concept">
10002 <primary>PostgreSQL lookup type</primary>
10003 </indexterm>
10004 <indexterm role="concept">
10005 <primary>lookup</primary>
10006 <secondary>PostgreSQL</secondary>
10007 </indexterm>
10008 <command>pgsql</command>: The format of the query is an SQL statement that is passed to a
10009 PostgreSQL database. See section <xref linkend="SECTsql"/>.
10010 </para>
10011 </listitem>
10012 <listitem>
10013 <para>
10014 <indexterm role="concept">
10015 <primary>sqlite lookup type</primary>
10016 </indexterm>
10017 <indexterm role="concept">
10018 <primary>lookup</primary>
10019 <secondary>sqlite</secondary>
10020 </indexterm>
10021 <command>sqlite</command>: The format of the query is a file name followed by an SQL statement
10022 that is passed to an SQLite database. See section <xref linkend="SECTsqlite"/>.
10023 </para>
10024 </listitem>
10025 <listitem>
10026 <para>
10027 <command>testdb</command>: This is a lookup type that is used for testing Exim. It is
10028 not likely to be useful in normal operation.
10029 </para>
10030 </listitem>
10031 <listitem>
10032 <para>
10033 <indexterm role="concept">
10034 <primary>whoson lookup type</primary>
10035 </indexterm>
10036 <indexterm role="concept">
10037 <primary>lookup</primary>
10038 <secondary>whoson</secondary>
10039 </indexterm>
10040 <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
10041 allows a server to check whether a particular (dynamically allocated) IP
10042 address is currently allocated to a known (trusted) user and, optionally, to
10043 obtain the identity of the said user. For SMTP servers, <emphasis>Whoson</emphasis> was popular
10044 at one time for <quote>POP before SMTP</quote> authentication, but that approach has been
10045 superseded by SMTP authentication. In Exim, <emphasis>Whoson</emphasis> can be used to implement
10046 <quote>POP before SMTP</quote> checking using ACL statements such as
10047 </para>
10048 <literallayout class="monospaced">
10049 require condition = \
10050   ${lookup whoson {$sender_host_address}{yes}{no}}
10051 </literallayout>
10052 <para>
10053 The query consists of a single IP address. The value returned is the name of
10054 the authenticated user, which is stored in the variable <varname>$value</varname>. However, in
10055 this example, the data in <varname>$value</varname> is not used; the result of the lookup is
10056 one of the fixed strings <quote>yes</quote> or <quote>no</quote>.
10057 </para>
10058 </listitem>
10059 </itemizedlist>
10060 </section>
10061 <section id="SECID63">
10062 <title>Temporary errors in lookups</title>
10063 <para>
10064 <indexterm role="concept">
10065 <primary>lookup</primary>
10066 <secondary>temporary error in</secondary>
10067 </indexterm>
10068 Lookup functions can return temporary error codes if the lookup cannot be
10069 completed. For example, an SQL or LDAP database might be unavailable. For this
10070 reason, it is not advisable to use a lookup that might do this for critical
10071 options such as a list of local domains.
10072 </para>
10073 <para>
10074 When a lookup cannot be completed in a router or transport, delivery
10075 of the message (to the relevant address) is deferred, as for any other
10076 temporary error. In other circumstances Exim may assume the lookup has failed,
10077 or may give up altogether.
10078 </para>
10079 </section>
10080 <section id="SECTdefaultvaluelookups">
10081 <title>Default values in single-key lookups</title>
10082 <para>
10083 <indexterm role="concept">
10084 <primary>wildcard lookups</primary>
10085 </indexterm>
10086 <indexterm role="concept">
10087 <primary>lookup</primary>
10088 <secondary>default values</secondary>
10089 </indexterm>
10090 <indexterm role="concept">
10091 <primary>lookup</primary>
10092 <secondary>wildcard</secondary>
10093 </indexterm>
10094 <indexterm role="concept">
10095 <primary>lookup</primary>
10096 <secondary>* added to type</secondary>
10097 </indexterm>
10098 <indexterm role="concept">
10099 <primary>default</primary>
10100 <secondary>in single-key lookups</secondary>
10101 </indexterm>
10102 In this context, a <quote>default value</quote> is a value specified by the administrator
10103 that is to be used if a lookup fails.
10104 </para>
10105 <para>
10106 <emphasis role="bold">Note:</emphasis> This section applies only to single-key lookups. For query-style
10107 lookups, the facilities of the query language must be used. An attempt to
10108 specify a default for a query-style lookup provokes an error.
10109 </para>
10110 <para>
10111 If <quote>*</quote> is added to a single-key lookup type (for example, <option>lsearch*</option>)
10112 and the initial lookup fails, the key <quote>*</quote> is looked up in the file to
10113 provide a default value. See also the section on partial matching below.
10114 </para>
10115 <para>
10116 <indexterm role="concept">
10117 <primary>*@ with single-key lookup</primary>
10118 </indexterm>
10119 <indexterm role="concept">
10120 <primary>lookup</primary>
10121 <secondary>*@ added to type</secondary>
10122 </indexterm>
10123 <indexterm role="concept">
10124 <primary>alias file</primary>
10125 <secondary>per-domain default</secondary>
10126 </indexterm>
10127 Alternatively, if <quote>*@</quote> is added to a single-key lookup type (for example
10128 <option>dbm*@</option>) then, if the initial lookup fails and the key contains an @
10129 character, a second lookup is done with everything before the last @ replaced
10130 by *. This makes it possible to provide per-domain defaults in alias files
10131 that include the domains in the keys. If the second lookup fails (or doesn&#x2019;t
10132 take place because there is no @ in the key), <quote>*</quote> is looked up.
10133 For example, a <command>redirect</command> router might contain:
10134 </para>
10135 <literallayout class="monospaced">
10136 data = ${lookup{$local_part@$domain}lsearch*@{/etc/mix-aliases}}
10137 </literallayout>
10138 <para>
10139 Suppose the address that is being processed is <emphasis>jane@eyre.example</emphasis>. Exim
10140 looks up these keys, in this order:
10141 </para>
10142 <literallayout class="monospaced">
10143 jane@eyre.example
10144 *@eyre.example
10145 *
10146 </literallayout>
10147 <para>
10148 The data is taken from whichever key it finds first. <emphasis role="bold">Note</emphasis>: In an
10149 <command>lsearch</command> file, this does not mean the first of these keys in the file. A
10150 complete scan is done for each key, and only if it is not found at all does
10151 Exim move on to try the next key.
10152 </para>
10153 </section>
10154 <section id="SECTpartiallookup">
10155 <title>Partial matching in single-key lookups</title>
10156 <para>
10157 <indexterm role="concept">
10158 <primary>partial matching</primary>
10159 </indexterm>
10160 <indexterm role="concept">
10161 <primary>wildcard lookups</primary>
10162 </indexterm>
10163 <indexterm role="concept">
10164 <primary>lookup</primary>
10165 <secondary>partial matching</secondary>
10166 </indexterm>
10167 <indexterm role="concept">
10168 <primary>lookup</primary>
10169 <secondary>wildcard</secondary>
10170 </indexterm>
10171 <indexterm role="concept">
10172 <primary>asterisk</primary>
10173 <secondary>in search type</secondary>
10174 </indexterm>
10175 The normal operation of a single-key lookup is to search the file for an exact
10176 match with the given key. However, in a number of situations where domains are
10177 being looked up, it is useful to be able to do partial matching. In this case,
10178 information in the file that has a key starting with <quote>*.</quote> is matched by any
10179 domain that ends with the components that follow the full stop. For example, if
10180 a key in a DBM file is
10181 </para>
10182 <literallayout class="monospaced">
10183 *.dates.fict.example
10184 </literallayout>
10185 <para>
10186 then when partial matching is enabled this is matched by (amongst others)
10187 <emphasis>2001.dates.fict.example</emphasis> and <emphasis>1984.dates.fict.example</emphasis>. It is also matched
10188 by <emphasis>dates.fict.example</emphasis>, if that does not appear as a separate key in the
10189 file.
10190 </para>
10191 <para>
10192 <emphasis role="bold">Note</emphasis>: Partial matching is not available for query-style lookups. It is
10193 also not available for any lookup items in address lists (see section
10194 <xref linkend="SECTaddresslist"/>).
10195 </para>
10196 <para>
10197 Partial matching is implemented by doing a series of separate lookups using
10198 keys constructed by modifying the original subject key. This means that it can
10199 be used with any of the single-key lookup types, provided that
10200 partial matching keys
10201 beginning with a special prefix (default <quote>*.</quote>) are included in the data file.
10202 Keys in the file that do not begin with the prefix are matched only by
10203 unmodified subject keys when partial matching is in use.
10204 </para>
10205 <para>
10206 Partial matching is requested by adding the string <quote>partial-</quote> to the front of
10207 the name of a single-key lookup type, for example, <option>partial-dbm</option>. When this
10208 is done, the subject key is first looked up unmodified; if that fails, <quote>*.</quote>
10209 is added at the start of the subject key, and it is looked up again. If that
10210 fails, further lookups are tried with dot-separated components removed from the
10211 start of the subject key, one-by-one, and <quote>*.</quote> added on the front of what
10212 remains.
10213 </para>
10214 <para>
10215 A minimum number of two non-* components are required. This can be adjusted
10216 by including a number before the hyphen in the search type. For example,
10217 <option>partial3-lsearch</option> specifies a minimum of three non-* components in the
10218 modified keys. Omitting the number is equivalent to <quote>partial2-</quote>. If the
10219 subject key is <emphasis>2250.dates.fict.example</emphasis> then the following keys are looked
10220 up when the minimum number of non-* components is two:
10221 </para>
10222 <literallayout class="monospaced">
10223 2250.dates.fict.example
10224 *.2250.dates.fict.example
10225 *.dates.fict.example
10226 *.fict.example
10227 </literallayout>
10228 <para>
10229 As soon as one key in the sequence is successfully looked up, the lookup
10230 finishes.
10231 </para>
10232 <para>
10233 <indexterm role="concept">
10234 <primary>lookup</primary>
10235 <secondary>partial matching &ndash; changing prefix</secondary>
10236 </indexterm>
10237 <indexterm role="concept">
10238 <primary>prefix</primary>
10239 <secondary>for partial matching</secondary>
10240 </indexterm>
10241 The use of <quote>*.</quote> as the partial matching prefix is a default that can be
10242 changed. The motivation for this feature is to allow Exim to operate with file
10243 formats that are used by other MTAs. A different prefix can be supplied in
10244 parentheses instead of the hyphen after <quote>partial</quote>. For example:
10245 </para>
10246 <literallayout class="monospaced">
10247 domains = partial(.)lsearch;/some/file
10248 </literallayout>
10249 <para>
10250 In this example, if the domain is <emphasis>a.b.c</emphasis>, the sequence of lookups is
10251 <literal>a.b.c</literal>, <literal>.a.b.c</literal>, and <literal>.b.c</literal> (the default minimum of 2 non-wild
10252 components is unchanged). The prefix may consist of any punctuation characters
10253 other than a closing parenthesis. It may be empty, for example:
10254 </para>
10255 <literallayout class="monospaced">
10256 domains = partial1()cdb;/some/file
10257 </literallayout>
10258 <para>
10259 For this example, if the domain is <emphasis>a.b.c</emphasis>, the sequence of lookups is
10260 <literal>a.b.c</literal>, <literal>b.c</literal>, and <literal>c</literal>.
10261 </para>
10262 <para>
10263 If <quote>partial0</quote> is specified, what happens at the end (when the lookup with
10264 just one non-wild component has failed, and the original key is shortened right
10265 down to the null string) depends on the prefix:
10266 </para>
10267 <itemizedlist>
10268 <listitem>
10269 <para>
10270 If the prefix has zero length, the whole lookup fails.
10271 </para>
10272 </listitem>
10273 <listitem>
10274 <para>
10275 If the prefix has length 1, a lookup for just the prefix is done. For
10276 example, the final lookup for <quote>partial0(.)</quote> is for <literal>.</literal> alone.
10277 </para>
10278 </listitem>
10279 <listitem>
10280 <para>
10281 Otherwise, if the prefix ends in a dot, the dot is removed, and the
10282 remainder is looked up. With the default prefix, therefore, the final lookup is
10283 for <quote>*</quote> on its own.
10284 </para>
10285 </listitem>
10286 <listitem>
10287 <para>
10288 Otherwise, the whole prefix is looked up.
10289 </para>
10290 </listitem>
10291 </itemizedlist>
10292 <para>
10293 If the search type ends in <quote>*</quote> or <quote>*@</quote> (see section
10294 <xref linkend="SECTdefaultvaluelookups"/> above), the search for an ultimate default that
10295 this implies happens after all partial lookups have failed. If <quote>partial0</quote> is
10296 specified, adding <quote>*</quote> to the search type has no effect with the default
10297 prefix, because the <quote>*</quote> key is already included in the sequence of partial
10298 lookups. However, there might be a use for lookup types such as
10299 <quote>partial0(.)lsearch*</quote>.
10300 </para>
10301 <para>
10302 The use of <quote>*</quote> in lookup partial matching differs from its use as a wildcard
10303 in domain lists and the like. Partial matching works only in terms of
10304 dot-separated components; a key such as <literal>*fict.example</literal>
10305 in a database file is useless, because the asterisk in a partial matching
10306 subject key is always followed by a dot.
10307 </para>
10308 </section>
10309 <section id="SECID64">
10310 <title>Lookup caching</title>
10311 <para>
10312 <indexterm role="concept">
10313 <primary>lookup</primary>
10314 <secondary>caching</secondary>
10315 </indexterm>
10316 <indexterm role="concept">
10317 <primary>caching</primary>
10318 <secondary>lookup data</secondary>
10319 </indexterm>
10320 Exim caches all lookup results in order to avoid needless repetition of
10321 lookups. However, because (apart from the daemon) Exim operates as a collection
10322 of independent, short-lived processes, this caching applies only within a
10323 single Exim process. There is no inter-process lookup caching facility.
10324 </para>
10325 <para>
10326 For single-key lookups, Exim keeps the relevant files open in case there is
10327 another lookup that needs them. In some types of configuration this can lead to
10328 many files being kept open for messages with many recipients. To avoid hitting
10329 the operating system limit on the number of simultaneously open files, Exim
10330 closes the least recently used file when it needs to open more files than its
10331 own internal limit, which can be changed via the <option>lookup_open_max</option> option.
10332 </para>
10333 <para>
10334 The single-key lookup files are closed and the lookup caches are flushed at
10335 strategic points during delivery &ndash; for example, after all routing is
10336 complete.
10337 </para>
10338 </section>
10339 <section id="SECID65">
10340 <title>Quoting lookup data</title>
10341 <para>
10342 <indexterm role="concept">
10343 <primary>lookup</primary>
10344 <secondary>quoting</secondary>
10345 </indexterm>
10346 <indexterm role="concept">
10347 <primary>quoting</primary>
10348 <secondary>in lookups</secondary>
10349 </indexterm>
10350 When data from an incoming message is included in a query-style lookup, there
10351 is the possibility of special characters in the data messing up the syntax of
10352 the query. For example, a NIS+ query that contains
10353 </para>
10354 <literallayout class="monospaced">
10355 [name=$local_part]
10356 </literallayout>
10357 <para>
10358 will be broken if the local part happens to contain a closing square bracket.
10359 For NIS+, data can be enclosed in double quotes like this:
10360 </para>
10361 <literallayout class="monospaced">
10362 [name="$local_part"]
10363 </literallayout>
10364 <para>
10365 but this still leaves the problem of a double quote in the data. The rule for
10366 NIS+ is that double quotes must be doubled. Other lookup types have different
10367 rules, and to cope with the differing requirements, an expansion operator
10368 of the following form is provided:
10369 </para>
10370 <literallayout class="monospaced">
10371 ${quote_&lt;lookup-type&gt;:&lt;string&gt;}
10372 </literallayout>
10373 <para>
10374 For example, the safest way to write the NIS+ query is
10375 </para>
10376 <literallayout class="monospaced">
10377 [name="${quote_nisplus:$local_part}"]
10378 </literallayout>
10379 <para>
10380 See chapter <xref linkend="CHAPexpand"/> for full coverage of string expansions. The quote
10381 operator can be used for all lookup types, but has no effect for single-key
10382 lookups, since no quoting is ever needed in their key strings.
10383 </para>
10384 </section>
10385 <section id="SECTdnsdb">
10386 <title>More about dnsdb</title>
10387 <para>
10388 <indexterm role="concept">
10389 <primary>dnsdb lookup</primary>
10390 </indexterm>
10391 <indexterm role="concept">
10392 <primary>lookup</primary>
10393 <secondary>dnsdb</secondary>
10394 </indexterm>
10395 <indexterm role="concept">
10396 <primary>DNS</primary>
10397 <secondary>as a lookup type</secondary>
10398 </indexterm>
10399 The <command>dnsdb</command> lookup type uses the DNS as its database. A simple query consists
10400 of a record type and a domain name, separated by an equals sign. For example,
10401 an expansion string could contain:
10402 </para>
10403 <literallayout class="monospaced">
10404 ${lookup dnsdb{mx=a.b.example}{$value}fail}
10405 </literallayout>
10406 <para>
10407 If the lookup succeeds, the result is placed in <varname>$value</varname>, which in this case
10408 is used on its own as the result. If the lookup does not succeed, the
10409 <literal>fail</literal> keyword causes a <emphasis>forced expansion failure</emphasis> &ndash; see section
10410 <xref linkend="SECTforexpfai"/> for an explanation of what this means.
10411 </para>
10412 <para>
10413 The supported DNS record types are A, CNAME, MX, NS, PTR, SPF, SRV, TLSA and TXT,
10414 and, when Exim is compiled with IPv6 support, AAAA (and A6 if that is also
10415 configured). If no type is given, TXT is assumed. When the type is PTR,
10416 the data can be an IP address, written as normal; inversion and the addition of
10417 <option>in-addr.arpa</option> or <option>ip6.arpa</option> happens automatically. For example:
10418 </para>
10419 <literallayout class="monospaced">
10420 ${lookup dnsdb{ptr=192.168.4.5}{$value}fail}
10421 </literallayout>
10422 <para>
10423 If the data for a PTR record is not a syntactically valid IP address, it is not
10424 altered and nothing is added.
10425 </para>
10426 <para>
10427 <indexterm role="concept">
10428 <primary>MX record</primary>
10429 <secondary>in <command>dnsdb</command> lookup</secondary>
10430 </indexterm>
10431 <indexterm role="concept">
10432 <primary>SRV record</primary>
10433 <secondary>in <command>dnsdb</command> lookup</secondary>
10434 </indexterm>
10435 For an MX lookup, both the preference value and the host name are returned for
10436 each record, separated by a space. For an SRV lookup, the priority, weight,
10437 port, and host name are returned for each record, separated by spaces.
10438 </para>
10439 <para>
10440 For any record type, if multiple records are found (or, for A6 lookups, if a
10441 single record leads to multiple addresses), the data is returned as a
10442 concatenation, with newline as the default separator. The order, of course,
10443 depends on the DNS resolver. You can specify a different separator character
10444 between multiple records by putting a right angle-bracket followed immediately
10445 by the new separator at the start of the query. For example:
10446 </para>
10447 <literallayout class="monospaced">
10448 ${lookup dnsdb{&gt;: a=host1.example}}
10449 </literallayout>
10450 <para>
10451 It is permitted to specify a space as the separator character. Further
10452 white space is ignored.
10453 </para>
10454 <para>
10455 <indexterm role="concept">
10456 <primary>TXT record</primary>
10457 <secondary>in <command>dnsdb</command> lookup</secondary>
10458 </indexterm>
10459 <indexterm role="concept">
10460 <primary>SPF record</primary>
10461 <secondary>in <command>dnsdb</command> lookup</secondary>
10462 </indexterm>
10463 For TXT records with multiple items of data, only the first item is returned,
10464 unless a separator for them is specified using a comma after the separator
10465 character followed immediately by the TXT record item separator. To concatenate
10466 items without a separator, use a semicolon instead. For SPF records the
10467 default behaviour is to concatenate multiple items without using a separator.
10468 </para>
10469 <literallayout class="monospaced">
10470 ${lookup dnsdb{&gt;\n,: txt=a.b.example}}
10471 ${lookup dnsdb{&gt;\n; txt=a.b.example}}
10472 ${lookup dnsdb{spf=example.org}}
10473 </literallayout>
10474 <para>
10475 It is permitted to specify a space as the separator character. Further
10476 white space is ignored.
10477 </para>
10478 </section>
10479 <section id="SECID66">
10480 <title>Pseudo dnsdb record types</title>
10481 <para>
10482 <indexterm role="concept">
10483 <primary>MX record</primary>
10484 <secondary>in <command>dnsdb</command> lookup</secondary>
10485 </indexterm>
10486 By default, both the preference value and the host name are returned for
10487 each MX record, separated by a space. If you want only host names, you can use
10488 the pseudo-type MXH:
10489 </para>
10490 <literallayout class="monospaced">
10491 ${lookup dnsdb{mxh=a.b.example}}
10492 </literallayout>
10493 <para>
10494 In this case, the preference values are omitted, and just the host names are
10495 returned.
10496 </para>
10497 <para>
10498 <indexterm role="concept">
10499 <primary>name server for enclosing domain</primary>
10500 </indexterm>
10501 Another pseudo-type is ZNS (for <quote>zone NS</quote>). It performs a lookup for NS
10502 records on the given domain, but if none are found, it removes the first
10503 component of the domain name, and tries again. This process continues until NS
10504 records are found or there are no more components left (or there is a DNS
10505 error). In other words, it may return the name servers for a top-level domain,
10506 but it never returns the root name servers. If there are no NS records for the
10507 top-level domain, the lookup fails. Consider these examples:
10508 </para>
10509 <literallayout class="monospaced">
10510 ${lookup dnsdb{zns=xxx.quercite.com}}
10511 ${lookup dnsdb{zns=xxx.edu}}
10512 </literallayout>
10513 <para>
10514 Assuming that in each case there are no NS records for the full domain name,
10515 the first returns the name servers for <option>quercite.com</option>, and the second returns
10516 the name servers for <option>edu</option>.
10517 </para>
10518 <para>
10519 You should be careful about how you use this lookup because, unless the
10520 top-level domain does not exist, the lookup always returns some host names. The
10521 sort of use to which this might be put is for seeing if the name servers for a
10522 given domain are on a blacklist. You can probably assume that the name servers
10523 for the high-level domains such as <option>com</option> or <option>co.uk</option> are not going to be on
10524 such a list.
10525 </para>
10526 <para>
10527 <indexterm role="concept">
10528 <primary>CSA</primary>
10529 <secondary>in <command>dnsdb</command> lookup</secondary>
10530 </indexterm>
10531 A third pseudo-type is CSA (Client SMTP Authorization). This looks up SRV
10532 records according to the CSA rules, which are described in section
10533 <xref linkend="SECTverifyCSA"/>. Although <command>dnsdb</command> supports SRV lookups directly, this is
10534 not sufficient because of the extra parent domain search behaviour of CSA. The
10535 result of a successful lookup such as:
10536 </para>
10537 <literallayout class="monospaced">
10538 ${lookup dnsdb {csa=$sender_helo_name}}
10539 </literallayout>
10540 <para>
10541 has two space-separated fields: an authorization code and a target host name.
10542 The authorization code can be <quote>Y</quote> for yes, <quote>N</quote> for no, <quote>X</quote> for explicit
10543 authorization required but absent, or <quote>?</quote> for unknown.
10544 </para>
10545 <para>
10546 <indexterm role="concept">
10547 <primary>A+</primary>
10548 <secondary>in <command>dnsdb</command> lookup</secondary>
10549 </indexterm>
10550 The pseudo-type A+ performs an A6 lookup (if configured) followed by an AAAA
10551 and then an A lookup.  All results are returned; defer processing
10552 (see below) is handled separately for each lookup.  Example:
10553 </para>
10554 <literallayout class="monospaced">
10555 ${lookup dnsdb {&gt;; a+=$sender_helo_name}}
10556 </literallayout>
10557 </section>
10558 <section id="SECID67">
10559 <title>Multiple dnsdb lookups</title>
10560 <para>
10561 In the previous sections, <command>dnsdb</command> lookups for a single domain are described.
10562 However, you can specify a list of domains or IP addresses in a single
10563 <command>dnsdb</command> lookup. The list is specified in the normal Exim way, with colon as
10564 the default separator, but with the ability to change this. For example:
10565 </para>
10566 <literallayout class="monospaced">
10567 ${lookup dnsdb{one.domain.com:two.domain.com}}
10568 ${lookup dnsdb{a=one.host.com:two.host.com}}
10569 ${lookup dnsdb{ptr = &lt;; 1.2.3.4 ; 4.5.6.8}}
10570 </literallayout>
10571 <para>
10572 In order to retain backwards compatibility, there is one special case: if
10573 the lookup type is PTR and no change of separator is specified, Exim looks
10574 to see if the rest of the string is precisely one IPv6 address. In this
10575 case, it does not treat it as a list.
10576 </para>
10577 <para>
10578 The data from each lookup is concatenated, with newline separators by default,
10579 in the same way that multiple DNS records for a single item are handled. A
10580 different separator can be specified, as described above.
10581 </para>
10582 <para>
10583 Modifiers for <command>dnsdb</command> lookups are givien by optional keywords,
10584 each followed by a comma,
10585 that may appear before the record type.
10586 </para>
10587 <para>
10588 The <command>dnsdb</command> lookup fails only if all the DNS lookups fail. If there is a
10589 temporary DNS error for any of them, the behaviour is controlled by
10590 a defer-option modifier.
10591 The possible keywords are
10592 <quote>defer_strict</quote>, <quote>defer_never</quote>, and <quote>defer_lax</quote>.
10593 With <quote>strict</quote> behaviour, any temporary DNS error causes the
10594 whole lookup to defer. With <quote>never</quote> behaviour, a temporary DNS error is
10595 ignored, and the behaviour is as if the DNS lookup failed to find anything.
10596 With <quote>lax</quote> behaviour, all the queries are attempted, but a temporary DNS
10597 error causes the whole lookup to defer only if none of the other lookups
10598 succeed. The default is <quote>lax</quote>, so the following lookups are equivalent:
10599 </para>
10600 <literallayout class="monospaced">
10601 ${lookup dnsdb{defer_lax,a=one.host.com:two.host.com}}
10602 ${lookup dnsdb{a=one.host.com:two.host.com}}
10603 </literallayout>
10604 <para>
10605 Thus, in the default case, as long as at least one of the DNS lookups
10606 yields some data, the lookup succeeds.
10607 </para>
10608 <para>
10609 <indexterm role="concept">
10610 <primary>DNSSEC</primary>
10611 <secondary>dns lookup</secondary>
10612 </indexterm>
10613 Use of <command>DNSSEC</command> is controlled by a dnssec modifier.
10614 The possible keywords are
10615 <quote>dnssec_strict</quote>, <quote>dnssec_lax</quote>, and <quote>dnssec_never</quote>.
10616 With <quote>strict</quote> or <quote>lax</quote> DNSSEC information is requested
10617 with the lookup.
10618 With <quote>strict</quote> a response from the DNS resolver that
10619 is not labelled as authenticated data
10620 is treated as equivalent to a temporary DNS error.
10621 The default is <quote>never</quote>.
10622 </para>
10623 <para>
10624 See also the <varname>$lookup_dnssec_authenticated</varname> variable.
10625 </para>
10626 </section>
10627 <section id="SECTldap">
10628 <title>More about LDAP</title>
10629 <para>
10630 <indexterm role="concept">
10631 <primary>LDAP</primary>
10632 <secondary>lookup, more about</secondary>
10633 </indexterm>
10634 <indexterm role="concept">
10635 <primary>lookup</primary>
10636 <secondary>LDAP</secondary>
10637 </indexterm>
10638 <indexterm role="concept">
10639 <primary>Solaris</primary>
10640 <secondary>LDAP</secondary>
10641 </indexterm>
10642 The original LDAP implementation came from the University of Michigan; this has
10643 become <quote>Open LDAP</quote>, and there are now two different releases. Another
10644 implementation comes from Netscape, and Solaris 7 and subsequent releases
10645 contain inbuilt LDAP support. Unfortunately, though these are all compatible at
10646 the lookup function level, their error handling is different. For this reason
10647 it is necessary to set a compile-time variable when building Exim with LDAP, to
10648 indicate which LDAP library is in use. One of the following should appear in
10649 your <filename>Local/Makefile</filename>:
10650 </para>
10651 <literallayout class="monospaced">
10652 LDAP_LIB_TYPE=UMICHIGAN
10653 LDAP_LIB_TYPE=OPENLDAP1
10654 LDAP_LIB_TYPE=OPENLDAP2
10655 LDAP_LIB_TYPE=NETSCAPE
10656 LDAP_LIB_TYPE=SOLARIS
10657 </literallayout>
10658 <para>
10659 If LDAP_LIB_TYPE is not set, Exim assumes <literal>OPENLDAP1</literal>, which has the
10660 same interface as the University of Michigan version.
10661 </para>
10662 <para>
10663 There are three LDAP lookup types in Exim. These behave slightly differently in
10664 the way they handle the results of a query:
10665 </para>
10666 <itemizedlist>
10667 <listitem>
10668 <para>
10669 <command>ldap</command> requires the result to contain just one entry; if there are more, it
10670 gives an error.
10671 </para>
10672 </listitem>
10673 <listitem>
10674 <para>
10675 <command>ldapdn</command> also requires the result to contain just one entry, but it is the
10676 Distinguished Name that is returned rather than any attribute values.
10677 </para>
10678 </listitem>
10679 <listitem>
10680 <para>
10681 <command>ldapm</command> permits the result to contain more than one entry; the attributes
10682 from all of them are returned.
10683 </para>
10684 </listitem>
10685 </itemizedlist>
10686 <para>
10687 For <command>ldap</command> and <command>ldapm</command>, if a query finds only entries with no attributes,
10688 Exim behaves as if the entry did not exist, and the lookup fails. The format of
10689 the data returned by a successful lookup is described in the next section.
10690 First we explain how LDAP queries are coded.
10691 </para>
10692 </section>
10693 <section id="SECTforldaque">
10694 <title>Format of LDAP queries</title>
10695 <para>
10696 <indexterm role="concept">
10697 <primary>LDAP</primary>
10698 <secondary>query format</secondary>
10699 </indexterm>
10700 An LDAP query takes the form of a URL as defined in RFC 2255. For example, in
10701 the configuration of a <command>redirect</command> router one might have this setting:
10702 </para>
10703 <literallayout class="monospaced">
10704 data = ${lookup ldap \
10705   {ldap:///cn=$local_part,o=University%20of%20Cambridge,\
10706   c=UK?mailbox?base?}}
10707 </literallayout>
10708 <para>
10709 <indexterm role="concept">
10710 <primary>LDAP</primary>
10711 <secondary>with TLS</secondary>
10712 </indexterm>
10713 The URL may begin with <literal>ldap</literal> or <literal>ldaps</literal> if your LDAP library supports
10714 secure (encrypted) LDAP connections. The second of these ensures that an
10715 encrypted TLS connection is used.
10716 </para>
10717 <para>
10718 With sufficiently modern LDAP libraries, Exim supports forcing TLS over regular
10719 LDAP connections, rather than the SSL-on-connect <literal>ldaps</literal>.
10720 See the <option>ldap_start_tls</option> option.
10721 </para>
10722 <para>
10723 Starting with Exim 4.83, the initialization of LDAP with TLS is more tightly
10724 controlled. Every part of the TLS configuration can be configured by settings in
10725 <filename>exim.conf</filename>. Depending on the version of the client libraries installed on
10726 your system, some of the initialization may have required setting options in
10727 <filename>/etc/ldap.conf</filename> or <filename>~/.ldaprc</filename> to get TLS working with self-signed
10728 certificates. This revealed a nuance where the current UID that exim was
10729 running as could affect which config files it read. With Exim 4.83, these
10730 methods become optional, only taking effect if not specifically set in
10731 <filename>exim.conf</filename>.
10732 </para>
10733 </section>
10734 <section id="SECID68">
10735 <title>LDAP quoting</title>
10736 <para>
10737 <indexterm role="concept">
10738 <primary>LDAP</primary>
10739 <secondary>quoting</secondary>
10740 </indexterm>
10741 Two levels of quoting are required in LDAP queries, the first for LDAP itself
10742 and the second because the LDAP query is represented as a URL. Furthermore,
10743 within an LDAP query, two different kinds of quoting are required. For this
10744 reason, there are two different LDAP-specific quoting operators.
10745 </para>
10746 <para>
10747 The <option>quote_ldap</option> operator is designed for use on strings that are part of
10748 filter specifications. Conceptually, it first does the following conversions on
10749 the string:
10750 </para>
10751 <literallayout class="monospaced">
10752 *   =&gt;   \2A
10753 (   =&gt;   \28
10754 )   =&gt;   \29
10755 \   =&gt;   \5C
10756 </literallayout>
10757 <para>
10758 in accordance with RFC 2254. The resulting string is then quoted according
10759 to the rules for URLs, that is, all non-alphanumeric characters except
10760 </para>
10761 <literallayout class="monospaced">
10762 ! $ ' - . _ ( ) * +
10763 </literallayout>
10764 <para>
10765 are converted to their hex values, preceded by a percent sign. For example:
10766 </para>
10767 <literallayout class="monospaced">
10768 ${quote_ldap: a(bc)*, a&lt;yz&gt;; }
10769 </literallayout>
10770 <para>
10771 yields
10772 </para>
10773 <literallayout class="monospaced">
10774 %20a%5C28bc%5C29%5C2A%2C%20a%3Cyz%3E%3B%20
10775 </literallayout>
10776 <para>
10777 Removing the URL quoting, this is (with a leading and a trailing space):
10778 </para>
10779 <literallayout class="monospaced">
10780 a\28bc\29\2A, a&lt;yz&gt;;
10781 </literallayout>
10782 <para>
10783 The <option>quote_ldap_dn</option> operator is designed for use on strings that are part of
10784 base DN specifications in queries. Conceptually, it first converts the string
10785 by inserting a backslash in front of any of the following characters:
10786 </para>
10787 <literallayout class="monospaced">
10788 , + " \ &lt; &gt; ;
10789 </literallayout>
10790 <para>
10791 It also inserts a backslash before any leading spaces or # characters, and
10792 before any trailing spaces. (These rules are in RFC 2253.) The resulting string
10793 is then quoted according to the rules for URLs. For example:
10794 </para>
10795 <literallayout class="monospaced">
10796 ${quote_ldap_dn: a(bc)*, a&lt;yz&gt;; }
10797 </literallayout>
10798 <para>
10799 yields
10800 </para>
10801 <literallayout class="monospaced">
10802 %5C%20a(bc)*%5C%2C%20a%5C%3Cyz%5C%3E%5C%3B%5C%20
10803 </literallayout>
10804 <para>
10805 Removing the URL quoting, this is (with a trailing space):
10806 </para>
10807 <literallayout class="monospaced">
10808 \ a(bc)*\, a\&lt;yz\&gt;\;\
10809 </literallayout>
10810 <para>
10811 There are some further comments about quoting in the section on LDAP
10812 authentication below.
10813 </para>
10814 </section>
10815 <section id="SECID69">
10816 <title>LDAP connections</title>
10817 <para>
10818 <indexterm role="concept">
10819 <primary>LDAP</primary>
10820 <secondary>connections</secondary>
10821 </indexterm>
10822 The connection to an LDAP server may either be over TCP/IP, or, when OpenLDAP
10823 is in use, via a Unix domain socket. The example given above does not specify
10824 an LDAP server. A server that is reached by TCP/IP can be specified in a query
10825 by starting it with
10826 </para>
10827 <literallayout class="monospaced">
10828 ldap://&lt;hostname&gt;:&lt;port&gt;/...
10829 </literallayout>
10830 <para>
10831 If the port (and preceding colon) are omitted, the standard LDAP port (389) is
10832 used. When no server is specified in a query, a list of default servers is
10833 taken from the <option>ldap_default_servers</option> configuration option. This supplies a
10834 colon-separated list of servers which are tried in turn until one successfully
10835 handles a query, or there is a serious error. Successful handling either
10836 returns the requested data, or indicates that it does not exist. Serious errors
10837 are syntactical, or multiple values when only a single value is expected.
10838 Errors which cause the next server to be tried are connection failures, bind
10839 failures, and timeouts.
10840 </para>
10841 <para>
10842 For each server name in the list, a port number can be given. The standard way
10843 of specifying a host and port is to use a colon separator (RFC 1738). Because
10844 <option>ldap_default_servers</option> is a colon-separated list, such colons have to be
10845 doubled. For example
10846 </para>
10847 <literallayout class="monospaced">
10848 ldap_default_servers = ldap1.example.com::145:ldap2.example.com
10849 </literallayout>
10850 <para>
10851 If <option>ldap_default_servers</option> is unset, a URL with no server name is passed
10852 to the LDAP library with no server name, and the library&#x2019;s default (normally
10853 the local host) is used.
10854 </para>
10855 <para>
10856 If you are using the OpenLDAP library, you can connect to an LDAP server using
10857 a Unix domain socket instead of a TCP/IP connection. This is specified by using
10858 <literal>ldapi</literal> instead of <literal>ldap</literal> in LDAP queries. What follows here applies only
10859 to OpenLDAP. If Exim is compiled with a different LDAP library, this feature is
10860 not available.
10861 </para>
10862 <para>
10863 For this type of connection, instead of a host name for the server, a pathname
10864 for the socket is required, and the port number is not relevant. The pathname
10865 can be specified either as an item in <option>ldap_default_servers</option>, or inline in
10866 the query. In the former case, you can have settings such as
10867 </para>
10868 <literallayout class="monospaced">
10869 ldap_default_servers = /tmp/ldap.sock : backup.ldap.your.domain
10870 </literallayout>
10871 <para>
10872 When the pathname is given in the query, you have to escape the slashes as
10873 <literal>%2F</literal> to fit in with the LDAP URL syntax. For example:
10874 </para>
10875 <literallayout class="monospaced">
10876 ${lookup ldap {ldapi://%2Ftmp%2Fldap.sock/o=...
10877 </literallayout>
10878 <para>
10879 When Exim processes an LDAP lookup and finds that the <quote>hostname</quote> is really
10880 a pathname, it uses the Unix domain socket code, even if the query actually
10881 specifies <literal>ldap</literal> or <literal>ldaps</literal>. In particular, no encryption is used for a
10882 socket connection. This behaviour means that you can use a setting of
10883 <option>ldap_default_servers</option> such as in the example above with traditional <literal>ldap</literal>
10884 or <literal>ldaps</literal> queries, and it will work. First, Exim tries a connection via
10885 the Unix domain socket; if that fails, it tries a TCP/IP connection to the
10886 backup host.
10887 </para>
10888 <para>
10889 If an explicit <literal>ldapi</literal> type is given in a query when a host name is
10890 specified, an error is diagnosed. However, if there are more items in
10891 <option>ldap_default_servers</option>, they are tried. In other words:
10892 </para>
10893 <itemizedlist>
10894 <listitem>
10895 <para>
10896 Using a pathname with <literal>ldap</literal> or <literal>ldaps</literal> forces the use of the Unix domain
10897 interface.
10898 </para>
10899 </listitem>
10900 <listitem>
10901 <para>
10902 Using <literal>ldapi</literal> with a host name causes an error.
10903 </para>
10904 </listitem>
10905 </itemizedlist>
10906 <para>
10907 Using <literal>ldapi</literal> with no host or path in the query, and no setting of
10908 <option>ldap_default_servers</option>, does whatever the library does by default.
10909 </para>
10910 </section>
10911 <section id="SECID70">
10912 <title>LDAP authentication and control information</title>
10913 <para>
10914 <indexterm role="concept">
10915 <primary>LDAP</primary>
10916 <secondary>authentication</secondary>
10917 </indexterm>
10918 The LDAP URL syntax provides no way of passing authentication and other control
10919 information to the server. To make this possible, the URL in an LDAP query may
10920 be preceded by any number of &lt;<emphasis>name</emphasis>&gt;=&lt;<emphasis>value</emphasis>&gt; settings, separated by
10921 spaces. If a value contains spaces it must be enclosed in double quotes, and
10922 when double quotes are used, backslash is interpreted in the usual way inside
10923 them. The following names are recognized:
10924 </para>
10925 <literallayout>
10926 <literal>DEREFERENCE</literal>  set the dereferencing parameter
10927 <literal>NETTIME    </literal>  set a timeout for a network operation
10928 <literal>USER       </literal>  set the DN, for authenticating the LDAP bind
10929 <literal>PASS       </literal>  set the password, likewise
10930 <literal>REFERRALS  </literal>  set the referrals parameter
10931 <literal>SERVERS    </literal>  set alternate server list for this query only
10932 <literal>SIZE       </literal>  set the limit for the number of entries returned
10933 <literal>TIME       </literal>  set the maximum waiting time for a query
10934 </literallayout>
10935 <para>
10936 The value of the DEREFERENCE parameter must be one of the words <quote>never</quote>,
10937 <quote>searching</quote>, <quote>finding</quote>, or <quote>always</quote>. The value of the REFERRALS parameter
10938 must be <quote>follow</quote> (the default) or <quote>nofollow</quote>. The latter stops the LDAP
10939 library from trying to follow referrals issued by the LDAP server.
10940 </para>
10941 <para>
10942 The name CONNECT is an obsolete name for NETTIME, retained for
10943 backwards compatibility. This timeout (specified as a number of seconds) is
10944 enforced from the client end for operations that can be carried out over a
10945 network. Specifically, it applies to network connections and calls to the
10946 <emphasis>ldap_result()</emphasis> function. If the value is greater than zero, it is used if
10947 LDAP_OPT_NETWORK_TIMEOUT is defined in the LDAP headers (OpenLDAP), or
10948 if LDAP_X_OPT_CONNECT_TIMEOUT is defined in the LDAP headers (Netscape
10949 SDK 4.1). A value of zero forces an explicit setting of <quote>no timeout</quote> for
10950 Netscape SDK; for OpenLDAP no action is taken.
10951 </para>
10952 <para>
10953 The TIME parameter (also a number of seconds) is passed to the server to
10954 set a server-side limit on the time taken to complete a search.
10955 </para>
10956 <para>
10957 The SERVERS parameter allows you to specify an alternate list of ldap servers
10958 to use for an individual lookup.  The global ldap_servers option provides a
10959 default list of ldap servers, and a single lookup can specify a single ldap
10960 server to use.  But when you need to do a lookup with a list of servers that is
10961 different than the default list (maybe different order, maybe a completely
10962 different set of servers), the SERVERS parameter allows you to specify this
10963 alternate list.
10964 </para>
10965 <para>
10966 Here is an example of an LDAP query in an Exim lookup that uses some of these
10967 values. This is a single line, folded to fit on the page:
10968 </para>
10969 <literallayout class="monospaced">
10970 ${lookup ldap
10971   {user="cn=manager,o=University of Cambridge,c=UK" pass=secret
10972   ldap:///o=University%20of%20Cambridge,c=UK?sn?sub?(cn=foo)}
10973   {$value}fail}
10974 </literallayout>
10975 <para>
10976 The encoding of spaces as <literal>%20</literal> is a URL thing which should not be done for
10977 any of the auxiliary data. Exim configuration settings that include lookups
10978 which contain password information should be preceded by <quote>hide</quote> to prevent
10979 non-admin users from using the <option>-bP</option> option to see their values.
10980 </para>
10981 <para>
10982 The auxiliary data items may be given in any order. The default is no
10983 connection timeout (the system timeout is used), no user or password, no limit
10984 on the number of entries returned, and no time limit on queries.
10985 </para>
10986 <para>
10987 When a DN is quoted in the USER= setting for LDAP authentication, Exim
10988 removes any URL quoting that it may contain before passing it LDAP. Apparently
10989 some libraries do this for themselves, but some do not. Removing the URL
10990 quoting has two advantages:
10991 </para>
10992 <itemizedlist>
10993 <listitem>
10994 <para>
10995 It makes it possible to use the same <option>quote_ldap_dn</option> expansion for USER=
10996 DNs as with DNs inside actual queries.
10997 </para>
10998 </listitem>
10999 <listitem>
11000 <para>
11001 It permits spaces inside USER= DNs.
11002 </para>
11003 </listitem>
11004 </itemizedlist>
11005 <para>
11006 For example, a setting such as
11007 </para>
11008 <literallayout class="monospaced">
11009 USER=cn=${quote_ldap_dn:$1}
11010 </literallayout>
11011 <para>
11012 should work even if <varname>$1</varname> contains spaces.
11013 </para>
11014 <para>
11015 Expanded data for the PASS= value should be quoted using the <option>quote</option>
11016 expansion operator, rather than the LDAP quote operators. The only reason this
11017 field needs quoting is to ensure that it conforms to the Exim syntax, which
11018 does not allow unquoted spaces. For example:
11019 </para>
11020 <literallayout class="monospaced">
11021 PASS=${quote:$3}
11022 </literallayout>
11023 <para>
11024 The LDAP authentication mechanism can be used to check passwords as part of
11025 SMTP authentication. See the <option>ldapauth</option> expansion string condition in chapter
11026 <xref linkend="CHAPexpand"/>.
11027 </para>
11028 </section>
11029 <section id="SECID71">
11030 <title>Format of data returned by LDAP</title>
11031 <para>
11032 <indexterm role="concept">
11033 <primary>LDAP</primary>
11034 <secondary>returned data formats</secondary>
11035 </indexterm>
11036 The <command>ldapdn</command> lookup type returns the Distinguished Name from a single entry
11037 as a sequence of values, for example
11038 </para>
11039 <literallayout class="monospaced">
11040 cn=manager, o=University of Cambridge, c=UK
11041 </literallayout>
11042 <para>
11043 The <command>ldap</command> lookup type generates an error if more than one entry matches the
11044 search filter, whereas <command>ldapm</command> permits this case, and inserts a newline in
11045 the result between the data from different entries. It is possible for multiple
11046 values to be returned for both <command>ldap</command> and <command>ldapm</command>, but in the former case
11047 you know that whatever values are returned all came from a single entry in the
11048 directory.
11049 </para>
11050 <para>
11051 In the common case where you specify a single attribute in your LDAP query, the
11052 result is not quoted, and does not contain the attribute name. If the attribute
11053 has multiple values, they are separated by commas.
11054 </para>
11055 <para>
11056 If you specify multiple attributes, the result contains space-separated, quoted
11057 strings, each preceded by the attribute name and an equals sign. Within the
11058 quotes, the quote character, backslash, and newline are escaped with
11059 backslashes, and commas are used to separate multiple values for the attribute.
11060 Apart from the escaping, the string within quotes takes the same form as the
11061 output when a single attribute is requested. Specifying no attributes is the
11062 same as specifying all of an entry&#x2019;s attributes.
11063 </para>
11064 <para>
11065 Here are some examples of the output format. The first line of each pair is an
11066 LDAP query, and the second is the data that is returned. The attribute called
11067 <option>attr1</option> has two values, whereas <option>attr2</option> has only one value:
11068 </para>
11069 <literallayout class="monospaced">
11070 ldap:///o=base?attr1?sub?(uid=fred)
11071 value1.1, value1.2
11072
11073 ldap:///o=base?attr2?sub?(uid=fred)
11074 value two
11075
11076 ldap:///o=base?attr1,attr2?sub?(uid=fred)
11077 attr1="value1.1, value1.2" attr2="value two"
11078
11079 ldap:///o=base??sub?(uid=fred)
11080 objectClass="top" attr1="value1.1, value1.2" attr2="value two"
11081 </literallayout>
11082 <para>
11083 The <option>extract</option> operator in string expansions can be used to pick out
11084 individual fields from data that consists of <emphasis>key</emphasis>=<emphasis>value</emphasis> pairs. You can
11085 make use of Exim&#x2019;s <option>-be</option> option to run expansion tests and thereby check the
11086 results of LDAP lookups.
11087 </para>
11088 </section>
11089 <section id="SECTnisplus">
11090 <title>More about NIS+</title>
11091 <para>
11092 <indexterm role="concept">
11093 <primary>NIS+ lookup type</primary>
11094 </indexterm>
11095 <indexterm role="concept">
11096 <primary>lookup</primary>
11097 <secondary>NIS+</secondary>
11098 </indexterm>
11099 NIS+ queries consist of a NIS+ <emphasis>indexed name</emphasis> followed by an optional colon
11100 and field name. If this is given, the result of a successful query is the
11101 contents of the named field; otherwise the result consists of a concatenation
11102 of <emphasis>field-name=field-value</emphasis> pairs, separated by spaces. Empty values and
11103 values containing spaces are quoted. For example, the query
11104 </para>
11105 <literallayout class="monospaced">
11106 [name=mg1456],passwd.org_dir
11107 </literallayout>
11108 <para>
11109 might return the string
11110 </para>
11111 <literallayout class="monospaced">
11112 name=mg1456 passwd="" uid=999 gid=999 gcos="Martin Guerre"
11113 home=/home/mg1456 shell=/bin/bash shadow=""
11114 </literallayout>
11115 <para>
11116 (split over two lines here to fit on the page), whereas
11117 </para>
11118 <literallayout class="monospaced">
11119 [name=mg1456],passwd.org_dir:gcos
11120 </literallayout>
11121 <para>
11122 would just return
11123 </para>
11124 <literallayout class="monospaced">
11125 Martin Guerre
11126 </literallayout>
11127 <para>
11128 with no quotes. A NIS+ lookup fails if NIS+ returns more than one table entry
11129 for the given indexed key. The effect of the <option>quote_nisplus</option> expansion
11130 operator is to double any quote characters within the text.
11131 </para>
11132 </section>
11133 <section id="SECTsql">
11134 <title>SQL lookups</title>
11135 <para>
11136 <indexterm role="concept">
11137 <primary>SQL lookup types</primary>
11138 </indexterm>
11139 <indexterm role="concept">
11140 <primary>MySQL</primary>
11141 <secondary>lookup type</secondary>
11142 </indexterm>
11143 <indexterm role="concept">
11144 <primary>PostgreSQL lookup type</primary>
11145 </indexterm>
11146 <indexterm role="concept">
11147 <primary>lookup</primary>
11148 <secondary>MySQL</secondary>
11149 </indexterm>
11150 <indexterm role="concept">
11151 <primary>lookup</primary>
11152 <secondary>PostgreSQL</secondary>
11153 </indexterm>
11154 <indexterm role="concept">
11155 <primary>Oracle</primary>
11156 <secondary>lookup type</secondary>
11157 </indexterm>
11158 <indexterm role="concept">
11159 <primary>lookup</primary>
11160 <secondary>Oracle</secondary>
11161 </indexterm>
11162 <indexterm role="concept">
11163 <primary>InterBase lookup type</primary>
11164 </indexterm>
11165 <indexterm role="concept">
11166 <primary>lookup</primary>
11167 <secondary>InterBase</secondary>
11168 </indexterm>
11169 Exim can support lookups in InterBase, MySQL, Oracle, PostgreSQL, and SQLite
11170 databases. Queries for these databases contain SQL statements, so an example
11171 might be
11172 </para>
11173 <literallayout class="monospaced">
11174 ${lookup mysql{select mailbox from users where id='userx'}\
11175   {$value}fail}
11176 </literallayout>
11177 <para>
11178 If the result of the query contains more than one field, the data for each
11179 field in the row is returned, preceded by its name, so the result of
11180 </para>
11181 <literallayout class="monospaced">
11182 ${lookup pgsql{select home,name from users where id='userx'}\
11183   {$value}}
11184 </literallayout>
11185 <para>
11186 might be
11187 </para>
11188 <literallayout class="monospaced">
11189 home=/home/userx name="Mister X"
11190 </literallayout>
11191 <para>
11192 Empty values and values containing spaces are double quoted, with embedded
11193 quotes escaped by a backslash. If the result of the query contains just one
11194 field, the value is passed back verbatim, without a field name, for example:
11195 </para>
11196 <literallayout class="monospaced">
11197 Mister X
11198 </literallayout>
11199 <para>
11200 If the result of the query yields more than one row, it is all concatenated,
11201 with a newline between the data for each row.
11202 </para>
11203 </section>
11204 <section id="SECID72">
11205 <title>More about MySQL, PostgreSQL, Oracle, and InterBase</title>
11206 <para>
11207 <indexterm role="concept">
11208 <primary>MySQL</primary>
11209 <secondary>lookup type</secondary>
11210 </indexterm>
11211 <indexterm role="concept">
11212 <primary>PostgreSQL lookup type</primary>
11213 </indexterm>
11214 <indexterm role="concept">
11215 <primary>lookup</primary>
11216 <secondary>MySQL</secondary>
11217 </indexterm>
11218 <indexterm role="concept">
11219 <primary>lookup</primary>
11220 <secondary>PostgreSQL</secondary>
11221 </indexterm>
11222 <indexterm role="concept">
11223 <primary>Oracle</primary>
11224 <secondary>lookup type</secondary>
11225 </indexterm>
11226 <indexterm role="concept">
11227 <primary>lookup</primary>
11228 <secondary>Oracle</secondary>
11229 </indexterm>
11230 <indexterm role="concept">
11231 <primary>InterBase lookup type</primary>
11232 </indexterm>
11233 <indexterm role="concept">
11234 <primary>lookup</primary>
11235 <secondary>InterBase</secondary>
11236 </indexterm>
11237 If any MySQL, PostgreSQL, Oracle, or InterBase lookups are used, the
11238 <option>mysql_servers</option>, <option>pgsql_servers</option>, <option>oracle_servers</option>, or <option>ibase_servers</option>
11239 option (as appropriate) must be set to a colon-separated list of server
11240 information.
11241 (For MySQL and PostgreSQL only, the global option need not be set if all
11242 queries contain their own server information &ndash; see section
11243 <xref linkend="SECTspeserque"/>.) Each item in the list is a slash-separated list of four
11244 items: host name, database name, user name, and password. In the case of
11245 Oracle, the host name field is used for the <quote>service name</quote>, and the database
11246 name field is not used and should be empty. For example:
11247 </para>
11248 <literallayout class="monospaced">
11249 hide oracle_servers = oracle.plc.example//userx/abcdwxyz
11250 </literallayout>
11251 <para>
11252 Because password data is sensitive, you should always precede the setting with
11253 <quote>hide</quote>, to prevent non-admin users from obtaining the setting via the <option>-bP</option>
11254 option. Here is an example where two MySQL servers are listed:
11255 </para>
11256 <literallayout class="monospaced">
11257 hide mysql_servers = localhost/users/root/secret:\
11258                      otherhost/users/root/othersecret
11259 </literallayout>
11260 <para>
11261 For MySQL and PostgreSQL, a host may be specified as &lt;<emphasis>name</emphasis>&gt;:&lt;<emphasis>port</emphasis>&gt; but
11262 because this is a colon-separated list, the colon has to be doubled. For each
11263 query, these parameter groups are tried in order until a connection is made and
11264 a query is successfully processed. The result of a query may be that no data is
11265 found, but that is still a successful query. In other words, the list of
11266 servers provides a backup facility, not a list of different places to look.
11267 </para>
11268 <para>
11269 The <option>quote_mysql</option>, <option>quote_pgsql</option>, and <option>quote_oracle</option> expansion operators
11270 convert newline, tab, carriage return, and backspace to \n, \t, \r, and \b
11271 respectively, and the characters single-quote, double-quote, and backslash
11272 itself are escaped with backslashes. The <option>quote_pgsql</option> expansion operator, in
11273 addition, escapes the percent and underscore characters. This cannot be done
11274 for MySQL because these escapes are not recognized in contexts where these
11275 characters are not special.
11276 </para>
11277 </section>
11278 <section id="SECTspeserque">
11279 <title>Specifying the server in the query</title>
11280 <para>
11281 For MySQL and PostgreSQL lookups (but not currently for Oracle and InterBase),
11282 it is possible to specify a list of servers with an individual query. This is
11283 done by starting the query with
11284 </para>
11285 <literallayout>
11286 <literal>servers=</literal><emphasis>server1:server2:server3:...</emphasis><literal>;</literal>
11287 </literallayout>
11288 <para>
11289 Each item in the list may take one of two forms:
11290 </para>
11291 <orderedlist numeration="arabic">
11292 <listitem>
11293 <para>
11294 If it contains no slashes it is assumed to be just a host name. The appropriate
11295 global option (<option>mysql_servers</option> or <option>pgsql_servers</option>) is searched for a host
11296 of the same name, and the remaining parameters (database, user, password) are
11297 taken from there.
11298 </para>
11299 </listitem>
11300 <listitem>
11301 <para>
11302 If it contains any slashes, it is taken as a complete parameter set.
11303 </para>
11304 </listitem>
11305 </orderedlist>
11306 <para>
11307 The list of servers is used in exactly the same way as the global list.
11308 Once a connection to a server has happened and a query has been
11309 successfully executed, processing of the lookup ceases.
11310 </para>
11311 <para>
11312 This feature is intended for use in master/slave situations where updates
11313 are occurring and you want to update the master rather than a slave. If the
11314 master is in the list as a backup for reading, you might have a global setting
11315 like this:
11316 </para>
11317 <literallayout class="monospaced">
11318 mysql_servers = slave1/db/name/pw:\
11319                 slave2/db/name/pw:\
11320                 master/db/name/pw
11321 </literallayout>
11322 <para>
11323 In an updating lookup, you could then write:
11324 </para>
11325 <literallayout class="monospaced">
11326 ${lookup mysql{servers=master; UPDATE ...} }
11327 </literallayout>
11328 <para>
11329 That query would then be sent only to the master server. If, on the other hand,
11330 the master is not to be used for reading, and so is not present in the global
11331 option, you can still update it by a query of this form:
11332 </para>
11333 <literallayout class="monospaced">
11334 ${lookup pgsql{servers=master/db/name/pw; UPDATE ...} }
11335 </literallayout>
11336 </section>
11337 <section id="SECID73">
11338 <title>Special MySQL features</title>
11339 <para>
11340 For MySQL, an empty host name or the use of <quote>localhost</quote> in <option>mysql_servers</option>
11341 causes a connection to the server on the local host by means of a Unix domain
11342 socket. An alternate socket can be specified in parentheses. The full syntax of
11343 each item in <option>mysql_servers</option> is:
11344 </para>
11345 <literallayout>
11346 &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;
11347 </literallayout>
11348 <para>
11349 Any of the three sub-parts of the first field can be omitted. For normal use on
11350 the local host it can be left blank or set to just <quote>localhost</quote>.
11351 </para>
11352 <para>
11353 No database need be supplied &ndash; but if it is absent here, it must be given in
11354 the queries.
11355 </para>
11356 <para>
11357 If a MySQL query is issued that does not request any data (an insert, update,
11358 or delete command), the result of the lookup is the number of rows affected.
11359 </para>
11360 <para>
11361 <emphasis role="bold">Warning</emphasis>: This can be misleading. If an update does not actually change
11362 anything (for example, setting a field to the value it already has), the result
11363 is zero because no rows are affected.
11364 </para>
11365 </section>
11366 <section id="SECID74">
11367 <title>Special PostgreSQL features</title>
11368 <para>
11369 PostgreSQL lookups can also use Unix domain socket connections to the database.
11370 This is usually faster and costs less CPU time than a TCP/IP connection.
11371 However it can be used only if the mail server runs on the same machine as the
11372 database server. A configuration line for PostgreSQL via Unix domain sockets
11373 looks like this:
11374 </para>
11375 <literallayout class="monospaced">
11376 hide pgsql_servers = (/tmp/.s.PGSQL.5432)/db/user/password : ...
11377 </literallayout>
11378 <para>
11379 In other words, instead of supplying a host name, a path to the socket is
11380 given. The path name is enclosed in parentheses so that its slashes aren&#x2019;t
11381 visually confused with the delimiters for the other server parameters.
11382 </para>
11383 <para>
11384 If a PostgreSQL query is issued that does not request any data (an insert,
11385 update, or delete command), the result of the lookup is the number of rows
11386 affected.
11387 </para>
11388 </section>
11389 <section id="SECTsqlite">
11390 <title>More about SQLite</title>
11391 <para>
11392 <indexterm role="concept">
11393 <primary>lookup</primary>
11394 <secondary>SQLite</secondary>
11395 </indexterm>
11396 <indexterm role="concept">
11397 <primary>sqlite lookup type</primary>
11398 </indexterm>
11399 SQLite is different to the other SQL lookups because a file name is required in
11400 addition to the SQL query. An SQLite database is a single file, and there is no
11401 daemon as in the other SQL databases. The interface to Exim requires the name
11402 of the file, as an absolute path, to be given at the start of the query. It is
11403 separated from the query by white space. This means that the path name cannot
11404 contain white space. Here is a lookup expansion example:
11405 </para>
11406 <literallayout class="monospaced">
11407 ${lookup sqlite {/some/thing/sqlitedb \
11408   select name from aliases where id='userx';}}
11409 </literallayout>
11410 <para>
11411 In a list, the syntax is similar. For example:
11412 </para>
11413 <literallayout class="monospaced">
11414 domainlist relay_to_domains = sqlite;/some/thing/sqlitedb \
11415    select * from relays where ip='$sender_host_address';
11416 </literallayout>
11417 <para>
11418 The only character affected by the <option>quote_sqlite</option> operator is a single
11419 quote, which it doubles.
11420 </para>
11421 <para>
11422 The SQLite library handles multiple simultaneous accesses to the database
11423 internally. Multiple readers are permitted, but only one process can
11424 update at once. Attempts to access the database while it is being updated
11425 are rejected after a timeout period, during which the SQLite library
11426 waits for the lock to be released. In Exim, the default timeout is set
11427 to 5 seconds, but it can be changed by means of the <option>sqlite_lock_timeout</option>
11428 option.
11429 <indexterm role="concept" startref="IIDfidalo1" class="endofrange"/>
11430 <indexterm role="concept" startref="IIDfidalo2" class="endofrange"/>
11431 </para>
11432 </section>
11433 </chapter>
11434
11435 <chapter id="CHAPdomhosaddlists">
11436 <title>Domain, host, address, and local part lists</title>
11437 <titleabbrev>Domain, host, and address lists</titleabbrev>
11438 <para>
11439 <indexterm role="concept" id="IIDdohoadli" class="startofrange">
11440 <primary>lists of domains; hosts; etc.</primary>
11441 </indexterm>
11442 A number of Exim configuration options contain lists of domains, hosts,
11443 email addresses, or local parts. For example, the <option>hold_domains</option> option
11444 contains a list of domains whose delivery is currently suspended. These lists
11445 are also used as data in ACL statements (see chapter <xref linkend="CHAPACL"/>), and as
11446 arguments to expansion conditions such as <option>match_domain</option>.
11447 </para>
11448 <para>
11449 Each item in one of these lists is a pattern to be matched against a domain,
11450 host, email address, or local part, respectively. In the sections below, the
11451 different types of pattern for each case are described, but first we cover some
11452 general facilities that apply to all four kinds of list.
11453 </para>
11454 <section id="SECID75">
11455 <title>Expansion of lists</title>
11456 <para>
11457 <indexterm role="concept">
11458 <primary>expansion</primary>
11459 <secondary>of lists</secondary>
11460 </indexterm>
11461 Each list is expanded as a single string before it is used. The result of
11462 expansion must be a list, possibly containing empty items, which is split up
11463 into separate items for matching. By default, colon is the separator character,
11464 but this can be varied if necessary. See sections <xref linkend="SECTlistconstruct"/> and
11465 <xref linkend="SECTempitelis"/> for details of the list syntax; the second of these
11466 discusses the way to specify empty list items.
11467 </para>
11468 <para>
11469 If the string expansion is forced to fail, Exim behaves as if the item it is
11470 testing (domain, host, address, or local part) is not in the list. Other
11471 expansion failures cause temporary errors.
11472 </para>
11473 <para>
11474 If an item in a list is a regular expression, backslashes, dollars and possibly
11475 other special characters in the expression must be protected against
11476 misinterpretation by the string expander. The easiest way to do this is to use
11477 the <literal>\N</literal> expansion feature to indicate that the contents of the regular
11478 expression should not be expanded. For example, in an ACL you might have:
11479 </para>
11480 <literallayout class="monospaced">
11481 deny senders = \N^\d{8}\w@.*\.baddomain\.example$\N : \
11482                ${lookup{$domain}lsearch{/badsenders/bydomain}}
11483 </literallayout>
11484 <para>
11485 The first item is a regular expression that is protected from expansion by
11486 <literal>\N</literal>, whereas the second uses the expansion to obtain a list of unwanted
11487 senders based on the receiving domain.
11488 </para>
11489 </section>
11490 <section id="SECID76">
11491 <title>Negated items in lists</title>
11492 <para>
11493 <indexterm role="concept">
11494 <primary>list</primary>
11495 <secondary>negation</secondary>
11496 </indexterm>
11497 <indexterm role="concept">
11498 <primary>negation</primary>
11499 <secondary>in lists</secondary>
11500 </indexterm>
11501 Items in a list may be positive or negative. Negative items are indicated by a
11502 leading exclamation mark, which may be followed by optional white space. A list
11503 defines a set of items (domains, etc). When Exim processes one of these lists,
11504 it is trying to find out whether a domain, host, address, or local part
11505 (respectively) is in the set that is defined by the list. It works like this:
11506 </para>
11507 <para>
11508 The list is scanned from left to right. If a positive item is matched, the
11509 subject that is being checked is in the set; if a negative item is matched, the
11510 subject is not in the set. If the end of the list is reached without the
11511 subject having matched any of the patterns, it is in the set if the last item
11512 was a negative one, but not if it was a positive one. For example, the list in
11513 </para>
11514 <literallayout class="monospaced">
11515 domainlist relay_to_domains = !a.b.c : *.b.c
11516 </literallayout>
11517 <para>
11518 matches any domain ending in <emphasis>.b.c</emphasis> except for <emphasis>a.b.c</emphasis>. Domains that match
11519 neither <emphasis>a.b.c</emphasis> nor <emphasis>*.b.c</emphasis> do not match, because the last item in the
11520 list is positive. However, if the setting were
11521 </para>
11522 <literallayout class="monospaced">
11523 domainlist relay_to_domains = !a.b.c
11524 </literallayout>
11525 <para>
11526 then all domains other than <emphasis>a.b.c</emphasis> would match because the last item in the
11527 list is negative. In other words, a list that ends with a negative item behaves
11528 as if it had an extra item <literal>:*</literal> on the end.
11529 </para>
11530 <para>
11531 Another way of thinking about positive and negative items in lists is to read
11532 the connector as <quote>or</quote> after a positive item and as <quote>and</quote> after a negative
11533 item.
11534 </para>
11535 </section>
11536 <section id="SECTfilnamlis">
11537 <title>File names in lists</title>
11538 <para>
11539 <indexterm role="concept">
11540 <primary>list</primary>
11541 <secondary>file name in</secondary>
11542 </indexterm>
11543 If an item in a domain, host, address, or local part list is an absolute file
11544 name (beginning with a slash character), each line of the file is read and
11545 processed as if it were an independent item in the list, except that further
11546 file names are not allowed,
11547 and no expansion of the data from the file takes place.
11548 Empty lines in the file are ignored, and the file may also contain comment
11549 lines:
11550 </para>
11551 <itemizedlist>
11552 <listitem>
11553 <para>
11554 For domain and host lists, if a # character appears anywhere in a line of the
11555 file, it and all following characters are ignored.
11556 </para>
11557 </listitem>
11558 <listitem>
11559 <para>
11560 Because local parts may legitimately contain # characters, a comment in an
11561 address list or local part list file is recognized only if # is preceded by
11562 white space or the start of the line. For example:
11563 </para>
11564 <literallayout class="monospaced">
11565 not#comment@x.y.z   # but this is a comment
11566 </literallayout>
11567 </listitem>
11568 </itemizedlist>
11569 <para>
11570 Putting a file name in a list has the same effect as inserting each line of the
11571 file as an item in the list (blank lines and comments excepted). However, there
11572 is one important difference: the file is read each time the list is processed,
11573 so if its contents vary over time, Exim&#x2019;s behaviour changes.
11574 </para>
11575 <para>
11576 If a file name is preceded by an exclamation mark, the sense of any match
11577 within the file is inverted. For example, if
11578 </para>
11579 <literallayout class="monospaced">
11580 hold_domains = !/etc/nohold-domains
11581 </literallayout>
11582 <para>
11583 and the file contains the lines
11584 </para>
11585 <literallayout class="monospaced">
11586 !a.b.c
11587 *.b.c
11588 </literallayout>
11589 <para>
11590 then <emphasis>a.b.c</emphasis> is in the set of domains defined by <option>hold_domains</option>, whereas
11591 any domain matching <literal>*.b.c</literal> is not.
11592 </para>
11593 </section>
11594 <section id="SECID77">
11595 <title>An lsearch file is not an out-of-line list</title>
11596 <para>
11597 As will be described in the sections that follow, lookups can be used in lists
11598 to provide indexed methods of checking list membership. There has been some
11599 confusion about the way <command>lsearch</command> lookups work in lists. Because
11600 an <command>lsearch</command> file contains plain text and is scanned sequentially, it is
11601 sometimes thought that it is allowed to contain wild cards and other kinds of
11602 non-constant pattern. This is not the case. The keys in an <command>lsearch</command> file are
11603 always fixed strings, just as for any other single-key lookup type.
11604 </para>
11605 <para>
11606 If you want to use a file to contain wild-card patterns that form part of a
11607 list, just give the file name on its own, without a search type, as described
11608 in the previous section. You could also use the <command>wildlsearch</command> or
11609 <command>nwildlsearch</command>, but there is no advantage in doing this.
11610 </para>
11611 </section>
11612 <section id="SECTnamedlists">
11613 <title>Named lists</title>
11614 <para>
11615 <indexterm role="concept">
11616 <primary>named lists</primary>
11617 </indexterm>
11618 <indexterm role="concept">
11619 <primary>list</primary>
11620 <secondary>named</secondary>
11621 </indexterm>
11622 A list of domains, hosts, email addresses, or local parts can be given a name
11623 which is then used to refer to the list elsewhere in the configuration. This is
11624 particularly convenient if the same list is required in several different
11625 places. It also allows lists to be given meaningful names, which can improve
11626 the readability of the configuration. For example, it is conventional to define
11627 a domain list called <emphasis>local_domains</emphasis> for all the domains that are handled
11628 locally on a host, using a configuration line such as
11629 </para>
11630 <literallayout class="monospaced">
11631 domainlist local_domains = localhost:my.dom.example
11632 </literallayout>
11633 <para>
11634 Named lists are referenced by giving their name preceded by a plus sign, so,
11635 for example, a router that is intended to handle local domains would be
11636 configured with the line
11637 </para>
11638 <literallayout class="monospaced">
11639 domains = +local_domains
11640 </literallayout>
11641 <para>
11642 The first router in a configuration is often one that handles all domains
11643 except the local ones, using a configuration with a negated item like this:
11644 </para>
11645 <literallayout class="monospaced">
11646 dnslookup:
11647   driver = dnslookup
11648   domains = ! +local_domains
11649   transport = remote_smtp
11650   no_more
11651 </literallayout>
11652 <para>
11653 The four kinds of named list are created by configuration lines starting with
11654 the words <option>domainlist</option>, <option>hostlist</option>, <option>addresslist</option>, or <option>localpartlist</option>,
11655 respectively. Then there follows the name that you are defining, followed by an
11656 equals sign and the list itself. For example:
11657 </para>
11658 <literallayout class="monospaced">
11659 hostlist    relay_from_hosts = 192.168.23.0/24 : my.friend.example
11660 addresslist bad_senders = cdb;/etc/badsenders
11661 </literallayout>
11662 <para>
11663 A named list may refer to other named lists:
11664 </para>
11665 <literallayout class="monospaced">
11666 domainlist  dom1 = first.example : second.example
11667 domainlist  dom2 = +dom1 : third.example
11668 domainlist  dom3 = fourth.example : +dom2 : fifth.example
11669 </literallayout>
11670 <para>
11671 <emphasis role="bold">Warning</emphasis>: If the last item in a referenced list is a negative one, the
11672 effect may not be what you intended, because the negation does not propagate
11673 out to the higher level. For example, consider:
11674 </para>
11675 <literallayout class="monospaced">
11676 domainlist  dom1 = !a.b
11677 domainlist  dom2 = +dom1 : *.b
11678 </literallayout>
11679 <para>
11680 The second list specifies <quote>either in the <option>dom1</option> list or <emphasis>*.b</emphasis></quote>. The first
11681 list specifies just <quote>not <emphasis>a.b</emphasis></quote>, so the domain <emphasis>x.y</emphasis> matches it. That
11682 means it matches the second list as well. The effect is not the same as
11683 </para>
11684 <literallayout class="monospaced">
11685 domainlist  dom2 = !a.b : *.b
11686 </literallayout>
11687 <para>
11688 where <emphasis>x.y</emphasis> does not match. It&#x2019;s best to avoid negation altogether in
11689 referenced lists if you can.
11690 </para>
11691 <para>
11692 Named lists may have a performance advantage. When Exim is routing an
11693 address or checking an incoming message, it caches the result of tests on named
11694 lists. So, if you have a setting such as
11695 </para>
11696 <literallayout class="monospaced">
11697 domains = +local_domains
11698 </literallayout>
11699 <para>
11700 on several of your routers
11701 or in several ACL statements,
11702 the actual test is done only for the first one. However, the caching works only
11703 if there are no expansions within the list itself or any sublists that it
11704 references. In other words, caching happens only for lists that are known to be
11705 the same each time they are referenced.
11706 </para>
11707 <para>
11708 By default, there may be up to 16 named lists of each type. This limit can be
11709 extended by changing a compile-time variable. The use of domain and host lists
11710 is recommended for concepts such as local domains, relay domains, and relay
11711 hosts. The default configuration is set up like this.
11712 </para>
11713 </section>
11714 <section id="SECID78">
11715 <title>Named lists compared with macros</title>
11716 <para>
11717 <indexterm role="concept">
11718 <primary>list</primary>
11719 <secondary>named compared with macro</secondary>
11720 </indexterm>
11721 <indexterm role="concept">
11722 <primary>macro</primary>
11723 <secondary>compared with named list</secondary>
11724 </indexterm>
11725 At first sight, named lists might seem to be no different from macros in the
11726 configuration file. However, macros are just textual substitutions. If you
11727 write
11728 </para>
11729 <literallayout class="monospaced">
11730 ALIST = host1 : host2
11731 auth_advertise_hosts = !ALIST
11732 </literallayout>
11733 <para>
11734 it probably won&#x2019;t do what you want, because that is exactly the same as
11735 </para>
11736 <literallayout class="monospaced">
11737 auth_advertise_hosts = !host1 : host2
11738 </literallayout>
11739 <para>
11740 Notice that the second host name is not negated. However, if you use a host
11741 list, and write
11742 </para>
11743 <literallayout class="monospaced">
11744 hostlist alist = host1 : host2
11745 auth_advertise_hosts = ! +alist
11746 </literallayout>
11747 <para>
11748 the negation applies to the whole list, and so that is equivalent to
11749 </para>
11750 <literallayout class="monospaced">
11751 auth_advertise_hosts = !host1 : !host2
11752 </literallayout>
11753 </section>
11754 <section id="SECID79">
11755 <title>Named list caching</title>
11756 <para>
11757 <indexterm role="concept">
11758 <primary>list</primary>
11759 <secondary>caching of named</secondary>
11760 </indexterm>
11761 <indexterm role="concept">
11762 <primary>caching</primary>
11763 <secondary>named lists</secondary>
11764 </indexterm>
11765 While processing a message, Exim caches the result of checking a named list if
11766 it is sure that the list is the same each time. In practice, this means that
11767 the cache operates only if the list contains no $ characters, which guarantees
11768 that it will not change when it is expanded. Sometimes, however, you may have
11769 an expanded list that you know will be the same each time within a given
11770 message. For example:
11771 </para>
11772 <literallayout class="monospaced">
11773 domainlist special_domains = \
11774            ${lookup{$sender_host_address}cdb{/some/file}}
11775 </literallayout>
11776 <para>
11777 This provides a list of domains that depends only on the sending host&#x2019;s IP
11778 address. If this domain list is referenced a number of times (for example,
11779 in several ACL lines, or in several routers) the result of the check is not
11780 cached by default, because Exim does not know that it is going to be the
11781 same list each time.
11782 </para>
11783 <para>
11784 By appending <literal>_cache</literal> to <literal>domainlist</literal> you can tell Exim to go ahead and
11785 cache the result anyway. For example:
11786 </para>
11787 <literallayout class="monospaced">
11788 domainlist_cache special_domains = ${lookup{...
11789 </literallayout>
11790 <para>
11791 If you do this, you should be absolutely sure that caching is going to do
11792 the right thing in all cases. When in doubt, leave it out.
11793 </para>
11794 </section>
11795 <section id="SECTdomainlist">
11796 <title>Domain lists</title>
11797 <para>
11798 <indexterm role="concept">
11799 <primary>domain list</primary>
11800 <secondary>patterns for</secondary>
11801 </indexterm>
11802 <indexterm role="concept">
11803 <primary>list</primary>
11804 <secondary>domain list</secondary>
11805 </indexterm>
11806 Domain lists contain patterns that are to be matched against a mail domain.
11807 The following types of item may appear in domain lists:
11808 </para>
11809 <itemizedlist>
11810 <listitem>
11811 <para>
11812 <indexterm role="concept">
11813 <primary>primary host name</primary>
11814 </indexterm>
11815 <indexterm role="concept">
11816 <primary>host name</primary>
11817 <secondary>matched in domain list</secondary>
11818 </indexterm>
11819 <indexterm role="option">
11820 <primary><option>primary_hostname</option></primary>
11821 </indexterm>
11822 <indexterm role="concept">
11823 <primary>domain list</primary>
11824 <secondary>matching primary host name</secondary>
11825 </indexterm>
11826 <indexterm role="concept">
11827 <primary>@ in a domain list</primary>
11828 </indexterm>
11829 If a pattern consists of a single @ character, it matches the local host name,
11830 as set by the <option>primary_hostname</option> option (or defaulted). This makes it
11831 possible to use the same configuration file on several different hosts that
11832 differ only in their names.
11833 </para>
11834 </listitem>
11835 <listitem>
11836 <para>
11837 <indexterm role="concept">
11838 <primary>@[] in a domain list</primary>
11839 </indexterm>
11840 <indexterm role="concept">
11841 <primary>domain list</primary>
11842 <secondary>matching local IP interfaces</secondary>
11843 </indexterm>
11844 <indexterm role="concept">
11845 <primary>domain literal</primary>
11846 </indexterm>
11847 If a pattern consists of the string <literal>@[]</literal> it matches an IP address enclosed
11848 in square brackets (as in an email address that contains a domain literal), but
11849 only if that IP address is recognized as local for email routing purposes. The
11850 <option>local_interfaces</option> and <option>extra_local_interfaces</option> options can be used to
11851 control which of a host&#x2019;s several IP addresses are treated as local.
11852 In today&#x2019;s Internet, the use of domain literals is controversial.
11853 </para>
11854 </listitem>
11855 <listitem>
11856 <para>
11857 <indexterm role="concept">
11858 <primary>@mx_any</primary>
11859 </indexterm>
11860 <indexterm role="concept">
11861 <primary>@mx_primary</primary>
11862 </indexterm>
11863 <indexterm role="concept">
11864 <primary>@mx_secondary</primary>
11865 </indexterm>
11866 <indexterm role="concept">
11867 <primary>domain list</primary>
11868 <secondary>matching MX pointers to local host</secondary>
11869 </indexterm>
11870 If a pattern consists of the string <literal>@mx_any</literal> it matches any domain that
11871 has an MX record pointing to the local host or to any host that is listed in
11872 <indexterm role="option">
11873 <primary><option>hosts_treat_as_local</option></primary>
11874 </indexterm>
11875 <option>hosts_treat_as_local</option>. The items <literal>@mx_primary</literal> and <literal>@mx_secondary</literal>
11876 are similar, except that the first matches only when a primary MX target is the
11877 local host, and the second only when no primary MX target is the local host,
11878 but a secondary MX target is. <quote>Primary</quote> means an MX record with the lowest
11879 preference value &ndash; there may of course be more than one of them.
11880 </para>
11881 <para>
11882 The MX lookup that takes place when matching a pattern of this type is
11883 performed with the resolver options for widening names turned off. Thus, for
11884 example, a single-component domain will <emphasis>not</emphasis> be expanded by adding the
11885 resolver&#x2019;s default domain. See the <option>qualify_single</option> and <option>search_parents</option>
11886 options of the <command>dnslookup</command> router for a discussion of domain widening.
11887 </para>
11888 <para>
11889 Sometimes you may want to ignore certain IP addresses when using one of these
11890 patterns. You can specify this by following the pattern with <literal>/ignore=</literal>&lt;<emphasis>ip
11891 list</emphasis>&gt;, where &lt;<emphasis>ip list</emphasis>&gt; is a list of IP addresses. These addresses are
11892 ignored when processing the pattern (compare the <option>ignore_target_hosts</option> option
11893 on a router). For example:
11894 </para>
11895 <literallayout class="monospaced">
11896 domains = @mx_any/ignore=127.0.0.1
11897 </literallayout>
11898 <para>
11899 This example matches any domain that has an MX record pointing to one of
11900 the local host&#x2019;s IP addresses other than 127.0.0.1.
11901 </para>
11902 <para>
11903 The list of IP addresses is in fact processed by the same code that processes
11904 host lists, so it may contain CIDR-coded network specifications and it may also
11905 contain negative items.
11906 </para>
11907 <para>
11908 Because the list of IP addresses is a sublist within a domain list, you have to
11909 be careful about delimiters if there is more than one address. Like any other
11910 list, the default delimiter can be changed. Thus, you might have:
11911 </para>
11912 <literallayout class="monospaced">
11913 domains = @mx_any/ignore=&lt;;127.0.0.1;0.0.0.0 : \
11914           an.other.domain : ...
11915 </literallayout>
11916 <para>
11917 so that the sublist uses semicolons for delimiters. When IPv6 addresses are
11918 involved, it is easiest to change the delimiter for the main list as well:
11919 </para>
11920 <literallayout class="monospaced">
11921 domains = &lt;? @mx_any/ignore=&lt;;127.0.0.1;::1 ? \
11922           an.other.domain ? ...
11923 </literallayout>
11924 </listitem>
11925 <listitem>
11926 <para>
11927 <indexterm role="concept">
11928 <primary>asterisk</primary>
11929 <secondary>in domain list</secondary>
11930 </indexterm>
11931 <indexterm role="concept">
11932 <primary>domain list</primary>
11933 <secondary>asterisk in</secondary>
11934 </indexterm>
11935 <indexterm role="concept">
11936 <primary>domain list</primary>
11937 <secondary>matching <quote>ends with</quote></secondary>
11938 </indexterm>
11939 If a pattern starts with an asterisk, the remaining characters of the pattern
11940 are compared with the terminating characters of the domain. The use of <quote>*</quote> in
11941 domain lists differs from its use in partial matching lookups. In a domain
11942 list, the character following the asterisk need not be a dot, whereas partial
11943 matching works only in terms of dot-separated components. For example, a domain
11944 list item such as <literal>*key.ex</literal> matches <emphasis>donkey.ex</emphasis> as well as
11945 <emphasis>cipher.key.ex</emphasis>.
11946 </para>
11947 </listitem>
11948 <listitem>
11949 <para>
11950 <indexterm role="concept">
11951 <primary>regular expressions</primary>
11952 <secondary>in domain list</secondary>
11953 </indexterm>
11954 <indexterm role="concept">
11955 <primary>domain list</primary>
11956 <secondary>matching regular expression</secondary>
11957 </indexterm>
11958 If a pattern starts with a circumflex character, it is treated as a regular
11959 expression, and matched against the domain using a regular expression matching
11960 function. The circumflex is treated as part of the regular expression.
11961 Email domains are case-independent, so this regular expression match is by
11962 default case-independent, but you can make it case-dependent by starting it
11963 with <literal>(?-i)</literal>. References to descriptions of the syntax of regular expressions
11964 are given in chapter <xref linkend="CHAPregexp"/>.
11965 </para>
11966 <para>
11967 <emphasis role="bold">Warning</emphasis>: Because domain lists are expanded before being processed, you
11968 must escape any backslash and dollar characters in the regular expression, or
11969 use the special <literal>\N</literal> sequence (see chapter <xref linkend="CHAPexpand"/>) to specify that
11970 it is not to be expanded (unless you really do want to build a regular
11971 expression by expansion, of course).
11972 </para>
11973 </listitem>
11974 <listitem>
11975 <para>
11976 <indexterm role="concept">
11977 <primary>lookup</primary>
11978 <secondary>in domain list</secondary>
11979 </indexterm>
11980 <indexterm role="concept">
11981 <primary>domain list</primary>
11982 <secondary>matching by lookup</secondary>
11983 </indexterm>
11984 If a pattern starts with the name of a single-key lookup type followed by a
11985 semicolon (for example, <quote>dbm;</quote> or <quote>lsearch;</quote>), the remainder of the pattern
11986 must be a file name in a suitable format for the lookup type. For example, for
11987 <quote>cdb;</quote> it must be an absolute path:
11988 </para>
11989 <literallayout class="monospaced">
11990 domains = cdb;/etc/mail/local_domains.cdb
11991 </literallayout>
11992 <para>
11993 The appropriate type of lookup is done on the file using the domain name as the
11994 key. In most cases, the data that is looked up is not used; Exim is interested
11995 only in whether or not the key is present in the file. However, when a lookup
11996 is used for the <option>domains</option> option on a router
11997 or a <option>domains</option> condition in an ACL statement, the data is preserved in the
11998 <varname>$domain_data</varname> variable and can be referred to in other router options or
11999 other statements in the same ACL.
12000 </para>
12001 </listitem>
12002 <listitem>
12003 <para>
12004 Any of the single-key lookup type names may be preceded by
12005 <literal>partial</literal>&lt;<emphasis>n</emphasis>&gt;<literal>-</literal>, where the &lt;<emphasis>n</emphasis>&gt; is optional, for example,
12006 </para>
12007 <literallayout class="monospaced">
12008 domains = partial-dbm;/partial/domains
12009 </literallayout>
12010 <para>
12011 This causes partial matching logic to be invoked; a description of how this
12012 works is given in section <xref linkend="SECTpartiallookup"/>.
12013 </para>
12014 </listitem>
12015 <listitem>
12016 <para>
12017 <indexterm role="concept">
12018 <primary>asterisk</primary>
12019 <secondary>in lookup type</secondary>
12020 </indexterm>
12021 Any of the single-key lookup types may be followed by an asterisk. This causes
12022 a default lookup for a key consisting of a single asterisk to be done if the
12023 original lookup fails. This is not a useful feature when using a domain list to
12024 select particular domains (because any domain would match), but it might have
12025 value if the result of the lookup is being used via the <varname>$domain_data</varname>
12026 expansion variable.
12027 </para>
12028 </listitem>
12029 <listitem>
12030 <para>
12031 If the pattern starts with the name of a query-style lookup type followed by a
12032 semicolon (for example, <quote>nisplus;</quote> or <quote>ldap;</quote>), the remainder of the
12033 pattern must be an appropriate query for the lookup type, as described in
12034 chapter <xref linkend="CHAPfdlookup"/>. For example:
12035 </para>
12036 <literallayout class="monospaced">
12037 hold_domains = mysql;select domain from holdlist \
12038   where domain = '${quote_mysql:$domain}';
12039 </literallayout>
12040 <para>
12041 In most cases, the data that is looked up is not used (so for an SQL query, for
12042 example, it doesn&#x2019;t matter what field you select). Exim is interested only in
12043 whether or not the query succeeds. However, when a lookup is used for the
12044 <option>domains</option> option on a router, the data is preserved in the <varname>$domain_data</varname>
12045 variable and can be referred to in other options.
12046 </para>
12047 </listitem>
12048 <listitem>
12049 <para>
12050 <indexterm role="concept">
12051 <primary>domain list</primary>
12052 <secondary>matching literal domain name</secondary>
12053 </indexterm>
12054 If none of the above cases apply, a caseless textual comparison is made
12055 between the pattern and the domain.
12056 </para>
12057 </listitem>
12058 </itemizedlist>
12059 <para>
12060 Here is an example that uses several different kinds of pattern:
12061 </para>
12062 <literallayout class="monospaced">
12063 domainlist funny_domains = \
12064   @ : \
12065   lib.unseen.edu : \
12066   *.foundation.fict.example : \
12067   \N^[1-2]\d{3}\.fict\.example$\N : \
12068   partial-dbm;/opt/data/penguin/book : \
12069   nis;domains.byname : \
12070   nisplus;[name=$domain,status=local],domains.org_dir
12071 </literallayout>
12072 <para>
12073 There are obvious processing trade-offs among the various matching modes. Using
12074 an asterisk is faster than a regular expression, and listing a few names
12075 explicitly probably is too. The use of a file or database lookup is expensive,
12076 but may be the only option if hundreds of names are required. Because the
12077 patterns are tested in order, it makes sense to put the most commonly matched
12078 patterns earlier.
12079 </para>
12080 </section>
12081 <section id="SECThostlist">
12082 <title>Host lists</title>
12083 <para>
12084 <indexterm role="concept">
12085 <primary>host list</primary>
12086 <secondary>patterns in</secondary>
12087 </indexterm>
12088 <indexterm role="concept">
12089 <primary>list</primary>
12090 <secondary>host list</secondary>
12091 </indexterm>
12092 Host lists are used to control what remote hosts are allowed to do. For
12093 example, some hosts may be allowed to use the local host as a relay, and some
12094 may be permitted to use the SMTP ETRN command. Hosts can be identified in
12095 two different ways, by name or by IP address. In a host list, some types of
12096 pattern are matched to a host name, and some are matched to an IP address.
12097 You need to be particularly careful with this when single-key lookups are
12098 involved, to ensure that the right value is being used as the key.
12099 </para>
12100 </section>
12101 <section id="SECID80">
12102 <title>Special host list patterns</title>
12103 <para>
12104 <indexterm role="concept">
12105 <primary>empty item in hosts list</primary>
12106 </indexterm>
12107 <indexterm role="concept">
12108 <primary>host list</primary>
12109 <secondary>empty string in</secondary>
12110 </indexterm>
12111 If a host list item is the empty string, it matches only when no remote host is
12112 involved. This is the case when a message is being received from a local
12113 process using SMTP on the standard input, that is, when a TCP/IP connection is
12114 not used.
12115 </para>
12116 <para>
12117 <indexterm role="concept">
12118 <primary>asterisk</primary>
12119 <secondary>in host list</secondary>
12120 </indexterm>
12121 The special pattern <quote>*</quote> in a host list matches any host or no host. Neither
12122 the IP address nor the name is actually inspected.
12123 </para>
12124 </section>
12125 <section id="SECThoslispatip">
12126 <title>Host list patterns that match by IP address</title>
12127 <para>
12128 <indexterm role="concept">
12129 <primary>host list</primary>
12130 <secondary>matching IP addresses</secondary>
12131 </indexterm>
12132 If an IPv4 host calls an IPv6 host and the call is accepted on an IPv6 socket,
12133 the incoming address actually appears in the IPv6 host as
12134 <literal>::ffff:</literal>&lt;<emphasis>v4address</emphasis>&gt;. When such an address is tested against a host
12135 list, it is converted into a traditional IPv4 address first. (Not all operating
12136 systems accept IPv4 calls on IPv6 sockets, as there have been some security
12137 concerns.)
12138 </para>
12139 <para>
12140 The following types of pattern in a host list check the remote host by
12141 inspecting its IP address:
12142 </para>
12143 <itemizedlist>
12144 <listitem>
12145 <para>
12146 If the pattern is a plain domain name (not a regular expression, not starting
12147 with *, not a lookup of any kind), Exim calls the operating system function
12148 to find the associated IP address(es). Exim uses the newer
12149 <function>getipnodebyname()</function> function when available, otherwise <function>gethostbyname()</function>.
12150 This typically causes a forward DNS lookup of the name. The result is compared
12151 with the IP address of the subject host.
12152 </para>
12153 <para>
12154 If there is a temporary problem (such as a DNS timeout) with the host name
12155 lookup, a temporary error occurs. For example, if the list is being used in an
12156 ACL condition, the ACL gives a <quote>defer</quote> response, usually leading to a
12157 temporary SMTP error code. If no IP address can be found for the host name,
12158 what happens is described in section <xref linkend="SECTbehipnot"/> below.
12159 </para>
12160 </listitem>
12161 <listitem>
12162 <para>
12163 <indexterm role="concept">
12164 <primary>@ in a host list</primary>
12165 </indexterm>
12166 If the pattern is <quote>@</quote>, the primary host name is substituted and used as a
12167 domain name, as just described.
12168 </para>
12169 </listitem>
12170 <listitem>
12171 <para>
12172 If the pattern is an IP address, it is matched against the IP address of the
12173 subject host. IPv4 addresses are given in the normal <quote>dotted-quad</quote> notation.
12174 IPv6 addresses can be given in colon-separated format, but the colons have to
12175 be doubled so as not to be taken as item separators when the default list
12176 separator is used. IPv6 addresses are recognized even when Exim is compiled
12177 without IPv6 support. This means that if they appear in a host list on an
12178 IPv4-only host, Exim will not treat them as host names. They are just addresses
12179 that can never match a client host.
12180 </para>
12181 </listitem>
12182 <listitem>
12183 <para>
12184 <indexterm role="concept">
12185 <primary>@[] in a host list</primary>
12186 </indexterm>
12187 If the pattern is <quote>@[]</quote>, it matches the IP address of any IP interface on
12188 the local host. For example, if the local host is an IPv4 host with one
12189 interface address 10.45.23.56, these two ACL statements have the same effect:
12190 </para>
12191 <literallayout class="monospaced">
12192 accept hosts = 127.0.0.1 : 10.45.23.56
12193 accept hosts = @[]
12194 </literallayout>
12195 </listitem>
12196 <listitem>
12197 <para>
12198 <indexterm role="concept">
12199 <primary>CIDR notation</primary>
12200 </indexterm>
12201 If the pattern is an IP address followed by a slash and a mask length (for
12202 example 10.11.42.0/24), it is matched against the IP address of the subject
12203 host under the given mask. This allows, an entire network of hosts to be
12204 included (or excluded) by a single item. The mask uses CIDR notation; it
12205 specifies the number of address bits that must match, starting from the most
12206 significant end of the address.
12207 </para>
12208 <para>
12209 <emphasis role="bold">Note</emphasis>: The mask is <emphasis>not</emphasis> a count of addresses, nor is it the high number
12210 of a range of addresses. It is the number of bits in the network portion of the
12211 address. The above example specifies a 24-bit netmask, so it matches all 256
12212 addresses in the 10.11.42.0 network. An item such as
12213 </para>
12214 <literallayout class="monospaced">
12215 192.168.23.236/31
12216 </literallayout>
12217 <para>
12218 matches just two addresses, 192.168.23.236 and 192.168.23.237. A mask value of
12219 32 for an IPv4 address is the same as no mask at all; just a single address
12220 matches.
12221 </para>
12222 <para>
12223 Here is another example which shows an IPv4 and an IPv6 network:
12224 </para>
12225 <literallayout class="monospaced">
12226 recipient_unqualified_hosts = 192.168.0.0/16: \
12227                               3ffe::ffff::836f::::/48
12228 </literallayout>
12229 <para>
12230 The doubling of list separator characters applies only when these items
12231 appear inline in a host list. It is not required when indirecting via a file.
12232 For example:
12233 </para>
12234 <literallayout class="monospaced">
12235 recipient_unqualified_hosts = /opt/exim/unqualnets
12236 </literallayout>
12237 <para>
12238 could make use of a file containing
12239 </para>
12240 <literallayout class="monospaced">
12241 172.16.0.0/12
12242 3ffe:ffff:836f::/48
12243 </literallayout>
12244 <para>
12245 to have exactly the same effect as the previous example. When listing IPv6
12246 addresses inline, it is usually more convenient to use the facility for
12247 changing separator characters. This list contains the same two networks:
12248 </para>
12249 <literallayout class="monospaced">
12250 recipient_unqualified_hosts = &lt;; 172.16.0.0/12; \
12251                                  3ffe:ffff:836f::/48
12252 </literallayout>
12253 <para>
12254 The separator is changed to semicolon by the leading <quote>&lt;;</quote> at the start of the
12255 list.
12256 </para>
12257 </listitem>
12258 </itemizedlist>
12259 </section>
12260 <section id="SECThoslispatsikey">
12261 <title>Host list patterns for single-key lookups by host address</title>
12262 <para>
12263 <indexterm role="concept">
12264 <primary>host list</primary>
12265 <secondary>lookup of IP address</secondary>
12266 </indexterm>
12267 When a host is to be identified by a single-key lookup of its complete IP
12268 address, the pattern takes this form:
12269 </para>
12270 <literallayout>
12271 <literal>net-&lt;</literal><emphasis>single-key-search-type</emphasis><literal>&gt;;&lt;</literal><emphasis>search-data</emphasis><literal>&gt;</literal>
12272 </literallayout>
12273 <para>
12274 For example:
12275 </para>
12276 <literallayout class="monospaced">
12277 hosts_lookup = net-cdb;/hosts-by-ip.db
12278 </literallayout>
12279 <para>
12280 The text form of the IP address of the subject host is used as the lookup key.
12281 IPv6 addresses are converted to an unabbreviated form, using lower case
12282 letters, with dots as separators because colon is the key terminator in
12283 <command>lsearch</command> files. [Colons can in fact be used in keys in <command>lsearch</command> files by
12284 quoting the keys, but this is a facility that was added later.] The data
12285 returned by the lookup is not used.
12286 </para>
12287 <para>
12288 <indexterm role="concept">
12289 <primary>IP address</primary>
12290 <secondary>masking</secondary>
12291 </indexterm>
12292 <indexterm role="concept">
12293 <primary>host list</primary>
12294 <secondary>masked IP address</secondary>
12295 </indexterm>
12296 Single-key lookups can also be performed using masked IP addresses, using
12297 patterns of this form:
12298 </para>
12299 <literallayout>
12300 <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>
12301 </literallayout>
12302 <para>
12303 For example:
12304 </para>
12305 <literallayout class="monospaced">
12306 net24-dbm;/networks.db
12307 </literallayout>
12308 <para>
12309 The IP address of the subject host is masked using &lt;<emphasis>number</emphasis>&gt; as the mask
12310 length. A textual string is constructed from the masked value, followed by the
12311 mask, and this is used as the lookup key. For example, if the host&#x2019;s IP address
12312 is 192.168.34.6, the key that is looked up for the above example is
12313 <quote>192.168.34.0/24</quote>.
12314 </para>
12315 <para>
12316 When an IPv6 address is converted to a string, dots are normally used instead
12317 of colons, so that keys in <command>lsearch</command> files need not contain colons (which
12318 terminate <command>lsearch</command> keys). This was implemented some time before the ability
12319 to quote keys was made available in <command>lsearch</command> files. However, the more
12320 recently implemented <command>iplsearch</command> files do require colons in IPv6 keys
12321 (notated using the quoting facility) so as to distinguish them from IPv4 keys.
12322 For this reason, when the lookup type is <command>iplsearch</command>, IPv6 addresses are
12323 converted using colons and not dots. In all cases, full, unabbreviated IPv6
12324 addresses are always used.
12325 </para>
12326 <para>
12327 Ideally, it would be nice to tidy up this anomalous situation by changing to
12328 colons in all cases, given that quoting is now available for <command>lsearch</command>.
12329 However, this would be an incompatible change that might break some existing
12330 configurations.
12331 </para>
12332 <para>
12333 <emphasis role="bold">Warning</emphasis>: Specifying <option>net32-</option> (for an IPv4 address) or <option>net128-</option> (for an
12334 IPv6 address) is not the same as specifying just <option>net-</option> without a number. In
12335 the former case the key strings include the mask value, whereas in the latter
12336 case the IP address is used on its own.
12337 </para>
12338 </section>
12339 <section id="SECThoslispatnam">
12340 <title>Host list patterns that match by host name</title>
12341 <para>
12342 <indexterm role="concept">
12343 <primary>host</primary>
12344 <secondary>lookup failures</secondary>
12345 </indexterm>
12346 <indexterm role="concept">
12347 <primary>unknown host name</primary>
12348 </indexterm>
12349 <indexterm role="concept">
12350 <primary>host list</primary>
12351 <secondary>matching host name</secondary>
12352 </indexterm>
12353 There are several types of pattern that require Exim to know the name of the
12354 remote host. These are either wildcard patterns or lookups by name. (If a
12355 complete hostname is given without any wildcarding, it is used to find an IP
12356 address to match against, as described in section <xref linkend="SECThoslispatip"/>
12357 above.)
12358 </para>
12359 <para>
12360 If the remote host name is not already known when Exim encounters one of these
12361 patterns, it has to be found from the IP address.
12362 Although many sites on the Internet are conscientious about maintaining reverse
12363 DNS data for their hosts, there are also many that do not do this.
12364 Consequently, a name cannot always be found, and this may lead to unwanted
12365 effects. Take care when configuring host lists with wildcarded name patterns.
12366 Consider what will happen if a name cannot be found.
12367 </para>
12368 <para>
12369 Because of the problems of determining host names from IP addresses, matching
12370 against host names is not as common as matching against IP addresses.
12371 </para>
12372 <para>
12373 By default, in order to find a host name, Exim first does a reverse DNS lookup;
12374 if no name is found in the DNS, the system function (<function>gethostbyaddr()</function> or
12375 <function>getipnodebyaddr()</function> if available) is tried. The order in which these lookups
12376 are done can be changed by setting the <option>host_lookup_order</option> option. For
12377 security, once Exim has found one or more names, it looks up the IP addresses
12378 for these names and compares them with the IP address that it started with.
12379 Only those names whose IP addresses match are accepted. Any other names are
12380 discarded. If no names are left, Exim behaves as if the host name cannot be
12381 found. In the most common case there is only one name and one IP address.
12382 </para>
12383 <para>
12384 There are some options that control what happens if a host name cannot be
12385 found. These are described in section <xref linkend="SECTbehipnot"/> below.
12386 </para>
12387 <para>
12388 <indexterm role="concept">
12389 <primary>host</primary>
12390 <secondary>alias for</secondary>
12391 </indexterm>
12392 <indexterm role="concept">
12393 <primary>alias for host</primary>
12394 </indexterm>
12395 As a result of aliasing, hosts may have more than one name. When processing any
12396 of the following types of pattern, all the host&#x2019;s names are checked:
12397 </para>
12398 <itemizedlist>
12399 <listitem>
12400 <para>
12401 <indexterm role="concept">
12402 <primary>asterisk</primary>
12403 <secondary>in host list</secondary>
12404 </indexterm>
12405 If a pattern starts with <quote>*</quote> the remainder of the item must match the end of
12406 the host name. For example, <literal>*.b.c</literal> matches all hosts whose names end in
12407 <emphasis>.b.c</emphasis>. This special simple form is provided because this is a very common
12408 requirement. Other kinds of wildcarding require the use of a regular
12409 expression.
12410 </para>
12411 </listitem>
12412 <listitem>
12413 <para>
12414 <indexterm role="concept">
12415 <primary>regular expressions</primary>
12416 <secondary>in host list</secondary>
12417 </indexterm>
12418 <indexterm role="concept">
12419 <primary>host list</primary>
12420 <secondary>regular expression in</secondary>
12421 </indexterm>
12422 If the item starts with <quote>^</quote> it is taken to be a regular expression which is
12423 matched against the host name. Host names are case-independent, so this regular
12424 expression match is by default case-independent, but you can make it
12425 case-dependent by starting it with <literal>(?-i)</literal>. References to descriptions of the
12426 syntax of regular expressions are given in chapter <xref linkend="CHAPregexp"/>. For
12427 example,
12428 </para>
12429 <literallayout class="monospaced">
12430 ^(a|b)\.c\.d$
12431 </literallayout>
12432 <para>
12433 is a regular expression that matches either of the two hosts <emphasis>a.c.d</emphasis> or
12434 <emphasis>b.c.d</emphasis>. When a regular expression is used in a host list, you must take care
12435 that backslash and dollar characters are not misinterpreted as part of the
12436 string expansion. The simplest way to do this is to use <literal>\N</literal> to mark that
12437 part of the string as non-expandable. For example:
12438 </para>
12439 <literallayout class="monospaced">
12440 sender_unqualified_hosts = \N^(a|b)\.c\.d$\N : ....
12441 </literallayout>
12442 <para>
12443 <emphasis role="bold">Warning</emphasis>: If you want to match a complete host name, you must include the
12444 <literal>$</literal> terminating metacharacter in the regular expression, as in the above
12445 example. Without it, a match at the start of the host name is all that is
12446 required.
12447 </para>
12448 </listitem>
12449 </itemizedlist>
12450 </section>
12451 <section id="SECTbehipnot">
12452 <title>Behaviour when an IP address or name cannot be found</title>
12453 <para>
12454 <indexterm role="concept">
12455 <primary>host</primary>
12456 <secondary>lookup failures, permanent</secondary>
12457 </indexterm>
12458 While processing a host list, Exim may need to look up an IP address from a
12459 name (see section <xref linkend="SECThoslispatip"/>), or it may need to look up a host name
12460 from an IP address (see section <xref linkend="SECThoslispatnam"/>). In either case, the
12461 behaviour when it fails to find the information it is seeking is the same.
12462 </para>
12463 <para>
12464 <emphasis role="bold">Note</emphasis>: This section applies to permanent lookup failures. It does <emphasis>not</emphasis>
12465 apply to temporary DNS errors, whose handling is described in the next section.
12466 </para>
12467 <para>
12468 <indexterm role="concept">
12469 <primary><literal>+include_unknown</literal></primary>
12470 </indexterm>
12471 <indexterm role="concept">
12472 <primary><literal>+ignore_unknown</literal></primary>
12473 </indexterm>
12474 Exim parses a host list from left to right. If it encounters a permanent
12475 lookup failure in any item in the host list before it has found a match,
12476 Exim treats it as a failure and the default behavior is as if the host
12477 does not match the list. This may not always be what you want to happen.
12478 To change Exim&#x2019;s behaviour, the special items <literal>+include_unknown</literal> or
12479 <literal>+ignore_unknown</literal> may appear in the list (at top level &ndash; they are
12480 not recognized in an indirected file).
12481 </para>
12482 <itemizedlist>
12483 <listitem>
12484 <para>
12485 If any item that follows <literal>+include_unknown</literal> requires information that
12486 cannot found, Exim behaves as if the host does match the list. For example,
12487 </para>
12488 <literallayout class="monospaced">
12489 host_reject_connection = +include_unknown:*.enemy.ex
12490 </literallayout>
12491 <para>
12492 rejects connections from any host whose name matches <literal>*.enemy.ex</literal>, and also
12493 any hosts whose name it cannot find.
12494 </para>
12495 </listitem>
12496 <listitem>
12497 <para>
12498 If any item that follows <literal>+ignore_unknown</literal> requires information that cannot
12499 be found, Exim ignores that item and proceeds to the rest of the list. For
12500 example:
12501 </para>
12502 <literallayout class="monospaced">
12503 accept hosts = +ignore_unknown : friend.example : \
12504                192.168.4.5
12505 </literallayout>
12506 <para>
12507 accepts from any host whose name is <emphasis>friend.example</emphasis> and from 192.168.4.5,
12508 whether or not its host name can be found. Without <literal>+ignore_unknown</literal>, if no
12509 name can be found for 192.168.4.5, it is rejected.
12510 </para>
12511 </listitem>
12512 </itemizedlist>
12513 <para>
12514 Both <literal>+include_unknown</literal> and <literal>+ignore_unknown</literal> may appear in the same
12515 list. The effect of each one lasts until the next, or until the end of the
12516 list.
12517 </para>
12518 </section>
12519 <section id="SECTmixwilhos">
12520 <title>Mixing wildcarded host names and addresses in host lists</title>
12521 <para>
12522 <indexterm role="concept">
12523 <primary>host list</primary>
12524 <secondary>mixing names and addresses in</secondary>
12525 </indexterm>
12526 </para>
12527 <para>
12528 This section explains the host/ip processing logic with the same concepts
12529 as the previous section, but specifically addresses what happens when a
12530 wildcarded hostname is one of the items in the hostlist.
12531 </para>
12532 <itemizedlist>
12533 <listitem>
12534 <para>
12535 If you have name lookups or wildcarded host names and
12536 IP addresses in the same host list, you should normally put the IP
12537 addresses first. For example, in an ACL you could have:
12538 </para>
12539 <literallayout class="monospaced">
12540 accept hosts = 10.9.8.7 : *.friend.example
12541 </literallayout>
12542 <para>
12543 The reason you normally would order it this way lies in the
12544 left-to-right way that Exim processes lists.  It can test IP addresses
12545 without doing any DNS lookups, but when it reaches an item that requires
12546 a host name, it fails if it cannot find a host name to compare with the
12547 pattern. If the above list is given in the opposite order, the
12548 <option>accept</option> statement fails for a host whose name cannot be found, even
12549 if its IP address is 10.9.8.7.
12550 </para>
12551 </listitem>
12552 <listitem>
12553 <para>
12554 If you really do want to do the name check first, and still recognize the IP
12555 address, you can rewrite the ACL like this:
12556 </para>
12557 <literallayout class="monospaced">
12558 accept hosts = *.friend.example
12559 accept hosts = 10.9.8.7
12560 </literallayout>
12561 <para>
12562 If the first <option>accept</option> fails, Exim goes on to try the second one. See chapter
12563 <xref linkend="CHAPACL"/> for details of ACLs. Alternatively, you can use
12564 <literal>+ignore_unknown</literal>, which was discussed in depth in the first example in
12565 this section.
12566 </para>
12567 </listitem>
12568 </itemizedlist>
12569 </section>
12570 <section id="SECTtemdnserr">
12571 <title>Temporary DNS errors when looking up host information</title>
12572 <para>
12573 <indexterm role="concept">
12574 <primary>host</primary>
12575 <secondary>lookup failures, temporary</secondary>
12576 </indexterm>
12577 <indexterm role="concept">
12578 <primary><literal>+include_defer</literal></primary>
12579 </indexterm>
12580 <indexterm role="concept">
12581 <primary><literal>+ignore_defer</literal></primary>
12582 </indexterm>
12583 A temporary DNS lookup failure normally causes a defer action (except when
12584 <option>dns_again_means_nonexist</option> converts it into a permanent error). However,
12585 host lists can include <literal>+ignore_defer</literal> and <literal>+include_defer</literal>, analagous to
12586 <literal>+ignore_unknown</literal> and <literal>+include_unknown</literal>, as described in the previous
12587 section. These options should be used with care, probably only in non-critical
12588 host lists such as whitelists.
12589 </para>
12590 </section>
12591 <section id="SECThoslispatnamsk">
12592 <title>Host list patterns for single-key lookups by host name</title>
12593 <para>
12594 <indexterm role="concept">
12595 <primary>unknown host name</primary>
12596 </indexterm>
12597 <indexterm role="concept">
12598 <primary>host list</primary>
12599 <secondary>matching host name</secondary>
12600 </indexterm>
12601 If a pattern is of the form
12602 </para>
12603 <literallayout>
12604 &lt;<emphasis>single-key-search-type</emphasis>&gt;;&lt;<emphasis>search-data</emphasis>&gt;
12605 </literallayout>
12606 <para>
12607 for example
12608 </para>
12609 <literallayout class="monospaced">
12610 dbm;/host/accept/list
12611 </literallayout>
12612 <para>
12613 a single-key lookup is performed, using the host name as its key. If the
12614 lookup succeeds, the host matches the item. The actual data that is looked up
12615 is not used.
12616 </para>
12617 <para>
12618 <emphasis role="bold">Reminder</emphasis>: With this kind of pattern, you must have host <emphasis>names</emphasis> as
12619 keys in the file, not IP addresses. If you want to do lookups based on IP
12620 addresses, you must precede the search type with <quote>net-</quote> (see section
12621 <xref linkend="SECThoslispatsikey"/>). There is, however, no reason why you could not use
12622 two items in the same list, one doing an address lookup and one doing a name
12623 lookup, both using the same file.
12624 </para>
12625 </section>
12626 <section id="SECID81">
12627 <title>Host list patterns for query-style lookups</title>
12628 <para>
12629 If a pattern is of the form
12630 </para>
12631 <literallayout>
12632 &lt;<emphasis>query-style-search-type</emphasis>&gt;;&lt;<emphasis>query</emphasis>&gt;
12633 </literallayout>
12634 <para>
12635 the query is obeyed, and if it succeeds, the host matches the item. The actual
12636 data that is looked up is not used. The variables <varname>$sender_host_address</varname> and
12637 <varname>$sender_host_name</varname> can be used in the query. For example:
12638 </para>
12639 <literallayout class="monospaced">
12640 hosts_lookup = pgsql;\
12641   select ip from hostlist where ip='$sender_host_address'
12642 </literallayout>
12643 <para>
12644 The value of <varname>$sender_host_address</varname> for an IPv6 address contains colons. You
12645 can use the <option>sg</option> expansion item to change this if you need to. If you want to
12646 use masked IP addresses in database queries, you can use the <option>mask</option> expansion
12647 operator.
12648 </para>
12649 <para>
12650 If the query contains a reference to <varname>$sender_host_name</varname>, Exim automatically
12651 looks up the host name if it has not already done so. (See section
12652 <xref linkend="SECThoslispatnam"/> for comments on finding host names.)
12653 </para>
12654 <para>
12655 Historical note: prior to release 4.30, Exim would always attempt to find a
12656 host name before running the query, unless the search type was preceded by
12657 <literal>net-</literal>. This is no longer the case. For backwards compatibility, <literal>net-</literal> is
12658 still recognized for query-style lookups, but its presence or absence has no
12659 effect. (Of course, for single-key lookups, <literal>net-</literal> <emphasis>is</emphasis> important.
12660 See section <xref linkend="SECThoslispatsikey"/>.)
12661 </para>
12662 </section>
12663 <section id="SECTaddresslist">
12664 <title>Address lists</title>
12665 <para>
12666 <indexterm role="concept">
12667 <primary>list</primary>
12668 <secondary>address list</secondary>
12669 </indexterm>
12670 <indexterm role="concept">
12671 <primary>address list</primary>
12672 <secondary>empty item</secondary>
12673 </indexterm>
12674 <indexterm role="concept">
12675 <primary>address list</primary>
12676 <secondary>patterns</secondary>
12677 </indexterm>
12678 Address lists contain patterns that are matched against mail addresses. There
12679 is one special case to be considered: the sender address of a bounce message is
12680 always empty. You can test for this by providing an empty item in an address
12681 list. For example, you can set up a router to process bounce messages by
12682 using this option setting:
12683 </para>
12684 <literallayout class="monospaced">
12685 senders = :
12686 </literallayout>
12687 <para>
12688 The presence of the colon creates an empty item. If you do not provide any
12689 data, the list is empty and matches nothing. The empty sender can also be
12690 detected by a regular expression that matches an empty string,
12691 and by a query-style lookup that succeeds when <varname>$sender_address</varname> is empty.
12692 </para>
12693 <para>
12694 Non-empty items in an address list can be straightforward email addresses. For
12695 example:
12696 </para>
12697 <literallayout class="monospaced">
12698 senders = jbc@askone.example : hs@anacreon.example
12699 </literallayout>
12700 <para>
12701 A certain amount of wildcarding is permitted. If a pattern contains an @
12702 character, but is not a regular expression and does not begin with a
12703 semicolon-terminated lookup type (described below), the local part of the
12704 subject address is compared with the local part of the pattern, which may start
12705 with an asterisk. If the local parts match, the domain is checked in exactly
12706 the same way as for a pattern in a domain list. For example, the domain can be
12707 wildcarded, refer to a named list, or be a lookup:
12708 </para>
12709 <literallayout class="monospaced">
12710 deny senders = *@*.spamming.site:\
12711                *@+hostile_domains:\
12712                bozo@partial-lsearch;/list/of/dodgy/sites:\
12713                *@dbm;/bad/domains.db
12714 </literallayout>
12715 <para>
12716 <indexterm role="concept">
12717 <primary>local part</primary>
12718 <secondary>starting with !</secondary>
12719 </indexterm>
12720 <indexterm role="concept">
12721 <primary>address list</primary>
12722 <secondary>local part starting with !</secondary>
12723 </indexterm>
12724 If a local part that begins with an exclamation mark is required, it has to be
12725 specified using a regular expression, because otherwise the exclamation mark is
12726 treated as a sign of negation, as is standard in lists.
12727 </para>
12728 <para>
12729 If a non-empty pattern that is not a regular expression or a lookup does not
12730 contain an @ character, it is matched against the domain part of the subject
12731 address. The only two formats that are recognized this way are a literal
12732 domain, or a domain pattern that starts with *. In both these cases, the effect
12733 is the same as if <literal>*@</literal> preceded the pattern. For example:
12734 </para>
12735 <literallayout class="monospaced">
12736 deny senders = enemy.domain : *.enemy.domain
12737 </literallayout>
12738 <para>
12739 The following kinds of more complicated address list pattern can match any
12740 address, including the empty address that is characteristic of bounce message
12741 senders:
12742 </para>
12743 <itemizedlist>
12744 <listitem>
12745 <para>
12746 <indexterm role="concept">
12747 <primary>regular expressions</primary>
12748 <secondary>in address list</secondary>
12749 </indexterm>
12750 <indexterm role="concept">
12751 <primary>address list</primary>
12752 <secondary>regular expression in</secondary>
12753 </indexterm>
12754 If (after expansion) a pattern starts with <quote>^</quote>, a regular expression match is
12755 done against the complete address, with the pattern as the regular expression.
12756 You must take care that backslash and dollar characters are not misinterpreted
12757 as part of the string expansion. The simplest way to do this is to use <literal>\N</literal>
12758 to mark that part of the string as non-expandable. For example:
12759 </para>
12760 <literallayout class="monospaced">
12761 deny senders = \N^.*this.*@example\.com$\N : \
12762                \N^\d{8}.+@spamhaus.example$\N : ...
12763 </literallayout>
12764 <para>
12765 The <literal>\N</literal> sequences are removed by the expansion, so these items do indeed
12766 start with <quote>^</quote> by the time they are being interpreted as address patterns.
12767 </para>
12768 </listitem>
12769 <listitem>
12770 <para>
12771 <indexterm role="concept">
12772 <primary>address list</primary>
12773 <secondary>lookup for complete address</secondary>
12774 </indexterm>
12775 Complete addresses can be looked up by using a pattern that starts with a
12776 lookup type terminated by a semicolon, followed by the data for the lookup. For
12777 example:
12778 </para>
12779 <literallayout class="monospaced">
12780 deny senders = cdb;/etc/blocked.senders : \
12781   mysql;select address from blocked where \
12782   address='${quote_mysql:$sender_address}'
12783 </literallayout>
12784 <para>
12785 Both query-style and single-key lookup types can be used. For a single-key
12786 lookup type, Exim uses the complete address as the key. However, empty keys are
12787 not supported for single-key lookups, so a match against the empty address
12788 always fails. This restriction does not apply to query-style lookups.
12789 </para>
12790 <para>
12791 Partial matching for single-key lookups (section <xref linkend="SECTpartiallookup"/>)
12792 cannot be used, and is ignored if specified, with an entry being written to the
12793 panic log.
12794 <indexterm role="concept">
12795 <primary>*@ with single-key lookup</primary>
12796 </indexterm>
12797 However, you can configure lookup defaults, as described in section
12798 <xref linkend="SECTdefaultvaluelookups"/>, but this is useful only for the <quote>*@</quote> type of
12799 default. For example, with this lookup:
12800 </para>
12801 <literallayout class="monospaced">
12802 accept senders = lsearch*@;/some/file
12803 </literallayout>
12804 <para>
12805 the file could contains lines like this:
12806 </para>
12807 <literallayout class="monospaced">
12808 user1@domain1.example
12809 *@domain2.example
12810 </literallayout>
12811 <para>
12812 and for the sender address <emphasis>nimrod@jaeger.example</emphasis>, the sequence of keys
12813 that are tried is:
12814 </para>
12815 <literallayout class="monospaced">
12816 nimrod@jaeger.example
12817 *@jaeger.example
12818 *
12819 </literallayout>
12820 <para>
12821 <emphasis role="bold">Warning 1</emphasis>: Do not include a line keyed by <quote>*</quote> in the file, because that
12822 would mean that every address matches, thus rendering the test useless.
12823 </para>
12824 <para>
12825 <emphasis role="bold">Warning 2</emphasis>: Do not confuse these two kinds of item:
12826 </para>
12827 <literallayout class="monospaced">
12828 deny recipients = dbm*@;/some/file
12829 deny recipients = *@dbm;/some/file
12830 </literallayout>
12831 <para>
12832 The first does a whole address lookup, with defaulting, as just described,
12833 because it starts with a lookup type. The second matches the local part and
12834 domain independently, as described in a bullet point below.
12835 </para>
12836 </listitem>
12837 </itemizedlist>
12838 <para>
12839 The following kinds of address list pattern can match only non-empty addresses.
12840 If the subject address is empty, a match against any of these pattern types
12841 always fails.
12842 </para>
12843 <itemizedlist>
12844 <listitem>
12845 <para>
12846 <indexterm role="concept">
12847 <primary>@@ with single-key lookup</primary>
12848 </indexterm>
12849 <indexterm role="concept">
12850 <primary>address list</primary>
12851 <secondary>@@ lookup type</secondary>
12852 </indexterm>
12853 <indexterm role="concept">
12854 <primary>address list</primary>
12855 <secondary>split local part and domain</secondary>
12856 </indexterm>
12857 If a pattern starts with <quote>@@</quote> followed by a single-key lookup item
12858 (for example, <literal>@@lsearch;/some/file</literal>), the address that is being checked is
12859 split into a local part and a domain. The domain is looked up in the file. If
12860 it is not found, there is no match. If it is found, the data that is looked up
12861 from the file is treated as a colon-separated list of local part patterns, each
12862 of which is matched against the subject local part in turn.
12863 </para>
12864 <para>
12865 <indexterm role="concept">
12866 <primary>asterisk</primary>
12867 <secondary>in address list</secondary>
12868 </indexterm>
12869 The lookup may be a partial one, and/or one involving a search for a default
12870 keyed by <quote>*</quote> (see section <xref linkend="SECTdefaultvaluelookups"/>). The local part
12871 patterns that are looked up can be regular expressions or begin with <quote>*</quote>, or
12872 even be further lookups. They may also be independently negated. For example,
12873 with
12874 </para>
12875 <literallayout class="monospaced">
12876 deny senders = @@dbm;/etc/reject-by-domain
12877 </literallayout>
12878 <para>
12879 the data from which the DBM file is built could contain lines like
12880 </para>
12881 <literallayout class="monospaced">
12882 baddomain.com:  !postmaster : *
12883 </literallayout>
12884 <para>
12885 to reject all senders except <option>postmaster</option> from that domain.
12886 </para>
12887 <para>
12888 <indexterm role="concept">
12889 <primary>local part</primary>
12890 <secondary>starting with !</secondary>
12891 </indexterm>
12892 If a local part that actually begins with an exclamation mark is required, it
12893 has to be specified using a regular expression. In <command>lsearch</command> files, an entry
12894 may be split over several lines by indenting the second and subsequent lines,
12895 but the separating colon must still be included at line breaks. White space
12896 surrounding the colons is ignored. For example:
12897 </para>
12898 <literallayout class="monospaced">
12899 aol.com:  spammer1 : spammer2 : ^[0-9]+$ :
12900   spammer3 : spammer4
12901 </literallayout>
12902 <para>
12903 As in all colon-separated lists in Exim, a colon can be included in an item by
12904 doubling.
12905 </para>
12906 <para>
12907 If the last item in the list starts with a right angle-bracket, the remainder
12908 of the item is taken as a new key to look up in order to obtain a continuation
12909 list of local parts. The new key can be any sequence of characters. Thus one
12910 might have entries like
12911 </para>
12912 <literallayout class="monospaced">
12913 aol.com: spammer1 : spammer 2 : &gt;*
12914 xyz.com: spammer3 : &gt;*
12915 *:       ^\d{8}$
12916 </literallayout>
12917 <para>
12918 in a file that was searched with <option>@@dbm*</option>, to specify a match for 8-digit
12919 local parts for all domains, in addition to the specific local parts listed for
12920 each domain. Of course, using this feature costs another lookup each time a
12921 chain is followed, but the effort needed to maintain the data is reduced.
12922 </para>
12923 <para>
12924 <indexterm role="concept">
12925 <primary>loop</primary>
12926 <secondary>in lookups</secondary>
12927 </indexterm>
12928 It is possible to construct loops using this facility, and in order to catch
12929 them, the chains may be no more than fifty items long.
12930 </para>
12931 </listitem>
12932 <listitem>
12933 <para>
12934 The @@&lt;<emphasis>lookup</emphasis>&gt; style of item can also be used with a query-style
12935 lookup, but in this case, the chaining facility is not available. The lookup
12936 can only return a single list of local parts.
12937 </para>
12938 </listitem>
12939 </itemizedlist>
12940 <para>
12941 <emphasis role="bold">Warning</emphasis>: There is an important difference between the address list items
12942 in these two examples:
12943 </para>
12944 <literallayout class="monospaced">
12945 senders = +my_list
12946 senders = *@+my_list
12947 </literallayout>
12948 <para>
12949 In the first one, <literal>my_list</literal> is a named address list, whereas in the second
12950 example it is a named domain list.
12951 </para>
12952 </section>
12953 <section id="SECTcasletadd">
12954 <title>Case of letters in address lists</title>
12955 <para>
12956 <indexterm role="concept">
12957 <primary>case of local parts</primary>
12958 </indexterm>
12959 <indexterm role="concept">
12960 <primary>address list</primary>
12961 <secondary>case forcing</secondary>
12962 </indexterm>
12963 <indexterm role="concept">
12964 <primary>case forcing in address lists</primary>
12965 </indexterm>
12966 Domains in email addresses are always handled caselessly, but for local parts
12967 case may be significant on some systems (see <option>caseful_local_part</option> for how
12968 Exim deals with this when routing addresses). However, RFC 2505 (<emphasis>Anti-Spam
12969 Recommendations for SMTP MTAs</emphasis>) suggests that matching of addresses to
12970 blocking lists should be done in a case-independent manner. Since most address
12971 lists in Exim are used for this kind of control, Exim attempts to do this by
12972 default.
12973 </para>
12974 <para>
12975 The domain portion of an address is always lowercased before matching it to an
12976 address list. The local part is lowercased by default, and any string
12977 comparisons that take place are done caselessly. This means that the data in
12978 the address list itself, in files included as plain file names, and in any file
12979 that is looked up using the <quote>@@</quote> mechanism, can be in any case. However, the
12980 keys in files that are looked up by a search type other than <command>lsearch</command> (which
12981 works caselessly) must be in lower case, because these lookups are not
12982 case-independent.
12983 </para>
12984 <para>
12985 <indexterm role="concept">
12986 <primary><literal>+caseful</literal></primary>
12987 </indexterm>
12988 To allow for the possibility of caseful address list matching, if an item in
12989 an address list is the string <quote>+caseful</quote>, the original case of the local
12990 part is restored for any comparisons that follow, and string comparisons are no
12991 longer case-independent. This does not affect the domain, which remains in
12992 lower case. However, although independent matches on the domain alone are still
12993 performed caselessly, regular expressions that match against an entire address
12994 become case-sensitive after <quote>+caseful</quote> has been seen.
12995 </para>
12996 </section>
12997 <section id="SECTlocparlis">
12998 <title>Local part lists</title>
12999 <para>
13000 <indexterm role="concept">
13001 <primary>list</primary>
13002 <secondary>local part list</secondary>
13003 </indexterm>
13004 <indexterm role="concept">
13005 <primary>local part</primary>
13006 <secondary>list</secondary>
13007 </indexterm>
13008 Case-sensitivity in local part lists is handled in the same way as for address
13009 lists, as just described. The <quote>+caseful</quote> item can be used if required. In a
13010 setting of the <option>local_parts</option> option in a router with <option>caseful_local_part</option>
13011 set false, the subject is lowercased and the matching is initially
13012 case-insensitive. In this case, <quote>+caseful</quote> will restore case-sensitive
13013 matching in the local part list, but not elsewhere in the router. If
13014 <option>caseful_local_part</option> is set true in a router, matching in the <option>local_parts</option>
13015 option is case-sensitive from the start.
13016 </para>
13017 <para>
13018 If a local part list is indirected to a file (see section <xref linkend="SECTfilnamlis"/>),
13019 comments are handled in the same way as address lists &ndash; they are recognized
13020 only if the # is preceded by white space or the start of the line.
13021 Otherwise, local part lists are matched in the same way as domain lists, except
13022 that the special items that refer to the local host (<literal>@</literal>, <literal>@[]</literal>,
13023 <literal>@mx_any</literal>, <literal>@mx_primary</literal>, and <literal>@mx_secondary</literal>) are not recognized.
13024 Refer to section <xref linkend="SECTdomainlist"/> for details of the other available item
13025 types.
13026 <indexterm role="concept" startref="IIDdohoadli" class="endofrange"/>
13027 </para>
13028 </section>
13029 </chapter>
13030
13031 <chapter id="CHAPexpand">
13032 <title>String expansions</title>
13033 <para>
13034 <indexterm role="concept" id="IIDstrexp" class="startofrange">
13035 <primary>expansion</primary>
13036 <secondary>of strings</secondary>
13037 </indexterm>
13038 Many strings in Exim&#x2019;s run time configuration are expanded before use. Some of
13039 them are expanded every time they are used; others are expanded only once.
13040 </para>
13041 <para>
13042 When a string is being expanded it is copied verbatim from left to right except
13043 when a dollar or backslash character is encountered. A dollar specifies the
13044 start of a portion of the string that is interpreted and replaced as described
13045 below in section <xref linkend="SECTexpansionitems"/> onwards. Backslash is used as an
13046 escape character, as described in the following section.
13047 </para>
13048 <para>
13049 Whether a string is expanded depends upon the context.  Usually this is solely
13050 dependent upon the option for which a value is sought; in this documentation,
13051 options for which string expansion is performed are marked with &dagger; after
13052 the data type.  ACL rules always expand strings.  A couple of expansion
13053 conditions do not expand some of the brace-delimited branches, for security
13054 reasons.
13055 </para>
13056 <section id="SECTlittext">
13057 <title>Literal text in expanded strings</title>
13058 <para>
13059 <indexterm role="concept">
13060 <primary>expansion</primary>
13061 <secondary>including literal text</secondary>
13062 </indexterm>
13063 An uninterpreted dollar can be included in an expanded string by putting a
13064 backslash in front of it. A backslash can be used to prevent any special
13065 character being treated specially in an expansion, including backslash itself.
13066 If the string appears in quotes in the configuration file, two backslashes are
13067 required because the quotes themselves cause interpretation of backslashes when
13068 the string is read in (see section <xref linkend="SECTstrings"/>).
13069 </para>
13070 <para>
13071 <indexterm role="concept">
13072 <primary>expansion</primary>
13073 <secondary>non-expandable substrings</secondary>
13074 </indexterm>
13075 A portion of the string can specified as non-expandable by placing it between
13076 two occurrences of <literal>\N</literal>. This is particularly useful for protecting regular
13077 expressions, which often contain backslashes and dollar signs. For example:
13078 </para>
13079 <literallayout class="monospaced">
13080 deny senders = \N^\d{8}[a-z]@some\.site\.example$\N
13081 </literallayout>
13082 <para>
13083 On encountering the first <literal>\N</literal>, the expander copies subsequent characters
13084 without interpretation until it reaches the next <literal>\N</literal> or the end of the
13085 string.
13086 </para>
13087 </section>
13088 <section id="SECID82">
13089 <title>Character escape sequences in expanded strings</title>
13090 <para>
13091 <indexterm role="concept">
13092 <primary>expansion</primary>
13093 <secondary>escape sequences</secondary>
13094 </indexterm>
13095 A backslash followed by one of the letters <quote>n</quote>, <quote>r</quote>, or <quote>t</quote> in an
13096 expanded string is recognized as an escape sequence for the character newline,
13097 carriage return, or tab, respectively. A backslash followed by up to three
13098 octal digits is recognized as an octal encoding for a single character, and a
13099 backslash followed by <quote>x</quote> and up to two hexadecimal digits is a hexadecimal
13100 encoding.
13101 </para>
13102 <para>
13103 These escape sequences are also recognized in quoted strings when they are read
13104 in. Their interpretation in expansions as well is useful for unquoted strings,
13105 and for other cases such as looked-up strings that are then expanded.
13106 </para>
13107 </section>
13108 <section id="SECID83">
13109 <title>Testing string expansions</title>
13110 <para>
13111 <indexterm role="concept">
13112 <primary>expansion</primary>
13113 <secondary>testing</secondary>
13114 </indexterm>
13115 <indexterm role="concept">
13116 <primary>testing</primary>
13117 <secondary>string expansion</secondary>
13118 </indexterm>
13119 <indexterm role="option">
13120 <primary><option>-be</option></primary>
13121 </indexterm>
13122 Many expansions can be tested by calling Exim with the <option>-be</option> option. This
13123 takes the command arguments, or lines from the standard input if there are no
13124 arguments, runs them through the string expansion code, and writes the results
13125 to the standard output. Variables based on configuration values are set up, but
13126 since no message is being processed, variables such as <varname>$local_part</varname> have no
13127 value. Nevertheless the <option>-be</option> option can be useful for checking out file and
13128 database lookups, and the use of expansion operators such as <option>sg</option>, <option>substr</option>
13129 and <option>nhash</option>.
13130 </para>
13131 <para>
13132 Exim gives up its root privilege when it is called with the <option>-be</option> option, and
13133 instead runs under the uid and gid it was called with, to prevent users from
13134 using <option>-be</option> for reading files to which they do not have access.
13135 </para>
13136 <para>
13137 <indexterm role="option">
13138 <primary><option>-bem</option></primary>
13139 </indexterm>
13140 If you want to test expansions that include variables whose values are taken
13141 from a message, there are two other options that can be used. The <option>-bem</option>
13142 option is like <option>-be</option> except that it is followed by a file name. The file is
13143 read as a message before doing the test expansions. For example:
13144 </para>
13145 <literallayout class="monospaced">
13146 exim -bem /tmp/test.message '$h_subject:'
13147 </literallayout>
13148 <para>
13149 The <option>-Mset</option> option is used in conjunction with <option>-be</option> and is followed by an
13150 Exim message identifier. For example:
13151 </para>
13152 <literallayout class="monospaced">
13153 exim -be -Mset 1GrA8W-0004WS-LQ '$recipients'
13154 </literallayout>
13155 <para>
13156 This loads the message from Exim&#x2019;s spool before doing the test expansions, and
13157 is therefore restricted to admin users.
13158 </para>
13159 </section>
13160 <section id="SECTforexpfai">
13161 <title>Forced expansion failure</title>
13162 <para>
13163 <indexterm role="concept">
13164 <primary>expansion</primary>
13165 <secondary>forced failure</secondary>
13166 </indexterm>
13167 A number of expansions that are described in the following section have
13168 alternative <quote>true</quote> and <quote>false</quote> substrings, enclosed in brace characters
13169 (which are sometimes called <quote>curly brackets</quote>). Which of the two strings is
13170 used depends on some condition that is evaluated as part of the expansion. If,
13171 instead of a <quote>false</quote> substring, the word <quote>fail</quote> is used (not in braces),
13172 the entire string expansion fails in a way that can be detected by the code
13173 that requested the expansion. This is called <quote>forced expansion failure</quote>, and
13174 its consequences depend on the circumstances. In some cases it is no different
13175 from any other expansion failure, but in others a different action may be
13176 taken. Such variations are mentioned in the documentation of the option that is
13177 being expanded.
13178 </para>
13179 </section>
13180 <section id="SECTexpansionitems">
13181 <title>Expansion items</title>
13182 <para>
13183 The following items are recognized in expanded strings. White space may be used
13184 between sub-items that are keywords or substrings enclosed in braces inside an
13185 outer set of braces, to improve readability. <emphasis role="bold">Warning</emphasis>: Within braces,
13186 white space is significant.
13187 </para>
13188 <variablelist>
13189 <varlistentry>
13190 <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>
13191 <listitem>
13192 <para>
13193 <indexterm role="concept">
13194 <primary>expansion</primary>
13195 <secondary>variables</secondary>
13196 </indexterm>
13197 Substitute the contents of the named variable, for example:
13198 </para>
13199 <literallayout class="monospaced">
13200 $local_part
13201 ${domain}
13202 </literallayout>
13203 <para>
13204 The second form can be used to separate the name from subsequent alphanumeric
13205 characters. This form (using braces) is available only for variables; it does
13206 <emphasis>not</emphasis> apply to message headers. The names of the variables are given in
13207 section <xref linkend="SECTexpvar"/> below. If the name of a non-existent variable is
13208 given, the expansion fails.
13209 </para>
13210 </listitem></varlistentry>
13211 <varlistentry>
13212 <term><emphasis role="bold">${</emphasis>&lt;<emphasis>op</emphasis>&gt;<emphasis role="bold">:</emphasis>&lt;<emphasis>string</emphasis>&gt;<emphasis role="bold">}</emphasis></term>
13213 <listitem>
13214 <para>
13215 <indexterm role="concept">
13216 <primary>expansion</primary>
13217 <secondary>operators</secondary>
13218 </indexterm>
13219 The string is first itself expanded, and then the operation specified by
13220 &lt;<emphasis>op</emphasis>&gt; is applied to it. For example:
13221 </para>
13222 <literallayout class="monospaced">
13223 ${lc:$local_part}
13224 </literallayout>
13225 <para>
13226 The string starts with the first character after the colon, which may be
13227 leading white space. A list of operators is given in section <xref linkend="SECTexpop"/>
13228 below. The operator notation is used for simple expansion items that have just
13229 one argument, because it reduces the number of braces and therefore makes the
13230 string easier to understand.
13231 </para>
13232 </listitem></varlistentry>
13233 <varlistentry>
13234 <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>
13235 <listitem>
13236 <para>
13237 This item inserts <quote>basic</quote> header lines. It is described with the <option>header</option>
13238 expansion item below.
13239 </para>
13240 </listitem></varlistentry>
13241 <varlistentry>
13242 <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>
13243 <listitem>
13244 <para>
13245 <indexterm role="concept">
13246 <primary>expansion</primary>
13247 <secondary>calling an acl</secondary>
13248 </indexterm>
13249 <indexterm role="concept">
13250 <primary><option>acl</option></primary>
13251 <secondary>call from expansion</secondary>
13252 </indexterm>
13253 The name and zero to nine argument strings are first expanded separately.  The expanded
13254 arguments are assigned to the variables <varname>$acl_arg1</varname> to <varname>$acl_arg9</varname> in order.
13255 Any unused are made empty.  The variable <varname>$acl_narg</varname> is set to the number of
13256 arguments.  The named ACL (see chapter <xref linkend="CHAPACL"/>) is called
13257 and may use the variables; if another acl expansion is used the values
13258 are restored after it returns.  If the ACL sets
13259 a value using a "message =" modifier and returns accept or deny, the value becomes
13260 the result of the expansion.
13261 If no message is set and the ACL returns accept or deny
13262 the expansion result is an empty string.
13263 If the ACL returns defer the result is a forced-fail.  Otherwise the expansion fails.
13264 </para>
13265 </listitem></varlistentry>
13266 <varlistentry>
13267 <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>
13268 <listitem>
13269 <para>
13270 <indexterm role="concept">
13271 <primary>expansion</primary>
13272 <secondary>extracting cerificate fields</secondary>
13273 </indexterm>
13274 <indexterm role="concept">
13275 <primary><option>certextract</option></primary>
13276 <secondary>certificate fields</secondary>
13277 </indexterm>
13278 <indexterm role="concept">
13279 <primary>certificate</primary>
13280 <secondary>extracting fields</secondary>
13281 </indexterm>
13282 The &lt;<emphasis>certificate</emphasis>&gt; must be a variable of type certificate.
13283 The field name is expanded and used to retrive the relevant field from
13284 the certificate.  Supported fields are:
13285 </para>
13286 <literallayout>
13287 <literal>version        </literal>
13288 <literal>serial_number  </literal>
13289 <literal>subject        </literal> RFC4514 DN
13290 <literal>issuer         </literal> RFC4514 DN
13291 <literal>notbefore      </literal> time
13292 <literal>notafter       </literal> time
13293 <literal>sig_algorithm  </literal>
13294 <literal>signature      </literal>
13295 <literal>subj_altname   </literal> tagged list
13296 <literal>ocsp_uri       </literal> list
13297 <literal>crl_uri        </literal> list
13298 </literallayout>
13299 <para>
13300 If the field is found,
13301 &lt;<emphasis>string2</emphasis>&gt; is expanded, and replaces the whole item;
13302 otherwise &lt;<emphasis>string3</emphasis>&gt; is used. During the expansion of &lt;<emphasis>string2</emphasis>&gt; the
13303 variable <varname>$value</varname> contains the value that has been extracted. Afterwards, it
13304 is restored to any previous value it might have had.
13305 </para>
13306 <para>
13307 If {&lt;<emphasis>string3</emphasis>&gt;} is omitted, the item is replaced by an empty string if the
13308 key is not found. If {&lt;<emphasis>string2</emphasis>&gt;} is also omitted, the value that was
13309 extracted is used.
13310 </para>
13311 <para>
13312 Some field names take optional modifiers, appended and separated by commas.
13313 </para>
13314 <para>
13315 The field selectors marked as "RFC4514" above
13316 output a Distinguished Name string which is
13317 not quite
13318 parseable by Exim as a comma-separated tagged list
13319 (the exceptions being elements containin commas).
13320 RDN elements of a single type may be selected by
13321 a modifier of the type label; if so the expansion
13322 result is a list (newline-separated by default).
13323 The separator may be changed by another modifer of
13324 a right angle-bracket followed immediately by the new separator.
13325 Recognised RDN type labels include "CN", "O", "OU" and "DC".
13326 </para>
13327 <para>
13328 The field selectors marked as "time" above
13329 may output a number of seconds since epoch
13330 if the modifier "int" is used.
13331 </para>
13332 <para>
13333 The field selectors marked as "list" above return a list,
13334 newline-separated by default,
13335 (embedded separator characters in elements are doubled).
13336 The separator may be changed by a modifier of
13337 a right angle-bracket followed immediately by the new separator.
13338 </para>
13339 <para>
13340 The field selectors marked as "tagged" above
13341 prefix each list element with a type string and an equals sign.
13342 Elements of only one type may be selected by a modifier
13343 which is one of "dns", "uri" or "mail";
13344 if so the elenment tags are omitted.
13345 </para>
13346 <para>
13347 If not otherwise noted field values are presented in human-readable form.
13348 </para>
13349 </listitem></varlistentry>
13350 <varlistentry>
13351 <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>
13352 <listitem>
13353 <para>
13354 <indexterm role="concept">
13355 <primary><option>dlfunc</option></primary>
13356 </indexterm>
13357 This expansion dynamically loads and then calls a locally-written C function.
13358 This functionality is available only if Exim is compiled with
13359 </para>
13360 <literallayout class="monospaced">
13361 EXPAND_DLFUNC=yes
13362 </literallayout>
13363 <para>
13364 set in <filename>Local/Makefile</filename>. Once loaded, Exim remembers the dynamically loaded
13365 object so that it doesn&#x2019;t reload the same object file in the same Exim process
13366 (but of course Exim does start new processes frequently).
13367 </para>
13368 <para>
13369 There may be from zero to eight arguments to the function. When compiling
13370 a local function that is to be called in this way, <filename>local_scan.h</filename> should be
13371 included. The Exim variables and functions that are defined by that API
13372 are also available for dynamically loaded functions. The function itself
13373 must have the following type:
13374 </para>
13375 <literallayout class="monospaced">
13376 int dlfunction(uschar **yield, int argc, uschar *argv[])
13377 </literallayout>
13378 <para>
13379 Where <literal>uschar</literal> is a typedef for <literal>unsigned char</literal> in <filename>local_scan.h</filename>. The
13380 function should return one of the following values:
13381 </para>
13382 <para>
13383 <literal>OK</literal>: Success. The string that is placed in the variable <emphasis>yield</emphasis> is put
13384 into the expanded string that is being built.
13385 </para>
13386 <para>
13387 <literal>FAIL</literal>: A non-forced expansion failure occurs, with the error message taken
13388 from <emphasis>yield</emphasis>, if it is set.
13389 </para>
13390 <para>
13391 <literal>FAIL_FORCED</literal>: A forced expansion failure occurs, with the error message
13392 taken from <emphasis>yield</emphasis> if it is set.
13393 </para>
13394 <para>
13395 <literal>ERROR</literal>: Same as <literal>FAIL</literal>, except that a panic log entry is written.
13396 </para>
13397 <para>
13398 When compiling a function that is to be used in this way with gcc,
13399 you need to add <option>-shared</option> to the gcc command. Also, in the Exim build-time
13400 configuration, you must add <option>-export-dynamic</option> to EXTRALIBS.
13401 </para>
13402 </listitem></varlistentry>
13403 <varlistentry>
13404 <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>
13405 <listitem>
13406 <para>
13407 <indexterm role="concept">
13408 <primary>expansion</primary>
13409 <secondary>extracting substrings by key</secondary>
13410 </indexterm>
13411 <indexterm role="concept">
13412 <primary><option>extract</option></primary>
13413 <secondary>substrings by key</secondary>
13414 </indexterm>
13415 The key and &lt;<emphasis>string1</emphasis>&gt; are first expanded separately. Leading and trailing
13416 white space is removed from the key (but not from any of the strings). The key
13417 must not consist entirely of digits. The expanded &lt;<emphasis>string1</emphasis>&gt; must be of the
13418 form:
13419 </para>
13420 <literallayout>
13421 &lt;<emphasis>key1</emphasis>&gt; = &lt;<emphasis>value1</emphasis>&gt;  &lt;<emphasis>key2</emphasis>&gt; = &lt;<emphasis>value2</emphasis>&gt; ...
13422 </literallayout>
13423 <para>
13424 <indexterm role="variable">
13425 <primary><varname>$value</varname></primary>
13426 </indexterm>
13427 where the equals signs and spaces (but not both) are optional. If any of the
13428 values contain white space, they must be enclosed in double quotes, and any
13429 values that are enclosed in double quotes are subject to escape processing as
13430 described in section <xref linkend="SECTstrings"/>. The expanded &lt;<emphasis>string1</emphasis>&gt; is searched
13431 for the value that corresponds to the key. The search is case-insensitive. If
13432 the key is found, &lt;<emphasis>string2</emphasis>&gt; is expanded, and replaces the whole item;
13433 otherwise &lt;<emphasis>string3</emphasis>&gt; is used. During the expansion of &lt;<emphasis>string2</emphasis>&gt; the
13434 variable <varname>$value</varname> contains the value that has been extracted. Afterwards, it
13435 is restored to any previous value it might have had.
13436 </para>
13437 <para>
13438 If {&lt;<emphasis>string3</emphasis>&gt;} is omitted, the item is replaced by an empty string if the
13439 key is not found. If {&lt;<emphasis>string2</emphasis>&gt;} is also omitted, the value that was
13440 extracted is used. Thus, for example, these two expansions are identical, and
13441 yield <quote>2001</quote>:
13442 </para>
13443 <literallayout class="monospaced">
13444 ${extract{gid}{uid=1984 gid=2001}}
13445 ${extract{gid}{uid=1984 gid=2001}{$value}}
13446 </literallayout>
13447 <para>
13448 Instead of {&lt;<emphasis>string3</emphasis>&gt;} the word <quote>fail</quote> (not in curly brackets) can
13449 appear, for example:
13450 </para>
13451 <literallayout class="monospaced">
13452 ${extract{Z}{A=... B=...}{$value} fail }
13453 </literallayout>
13454 <para>
13455 This forces an expansion failure (see section <xref linkend="SECTforexpfai"/>);
13456 {&lt;<emphasis>string2</emphasis>&gt;} must be present for <quote>fail</quote> to be recognized.
13457 </para>
13458 </listitem></varlistentry>
13459 <varlistentry>
13460 <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>
13461 <listitem>
13462 <para>
13463 <indexterm role="concept">
13464 <primary>expansion</primary>
13465 <secondary>extracting substrings by number</secondary>
13466 </indexterm>
13467 <indexterm role="concept">
13468 <primary><option>extract</option></primary>
13469 <secondary>substrings by number</secondary>
13470 </indexterm>
13471 The &lt;<emphasis>number</emphasis>&gt; argument must consist entirely of decimal digits,
13472 apart from leading and trailing white space, which is ignored.
13473 This is what distinguishes this form of <option>extract</option> from the previous kind. It
13474 behaves in the same way, except that, instead of extracting a named field, it
13475 extracts from &lt;<emphasis>string1</emphasis>&gt; the field whose number is given as the first
13476 argument. You can use <varname>$value</varname> in &lt;<emphasis>string2</emphasis>&gt; or <literal>fail</literal> instead of
13477 &lt;<emphasis>string3</emphasis>&gt; as before.
13478 </para>
13479 <para>
13480 The fields in the string are separated by any one of the characters in the
13481 separator string. These may include space or tab characters.
13482 The first field is numbered one. If the number is negative, the fields are
13483 counted from the end of the string, with the rightmost one numbered -1. If the
13484 number given is zero, the entire string is returned. If the modulus of the
13485 number is greater than the number of fields in the string, the result is the
13486 expansion of &lt;<emphasis>string3</emphasis>&gt;, or the empty string if &lt;<emphasis>string3</emphasis>&gt; is not
13487 provided. For example:
13488 </para>
13489 <literallayout class="monospaced">
13490 ${extract{2}{:}{x:42:99:&amp; Mailer::/bin/bash}}
13491 </literallayout>
13492 <para>
13493 yields <quote>42</quote>, and
13494 </para>
13495 <literallayout class="monospaced">
13496 ${extract{-4}{:}{x:42:99:&amp; Mailer::/bin/bash}}
13497 </literallayout>
13498 <para>
13499 yields <quote>99</quote>. Two successive separators mean that the field between them is
13500 empty (for example, the fifth field above).
13501 </para>
13502 </listitem></varlistentry>
13503 <varlistentry>
13504 <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>
13505 <listitem>
13506 <para>
13507 <indexterm role="concept">
13508 <primary>list</primary>
13509 <secondary>selecting by condition</secondary>
13510 </indexterm>
13511 <indexterm role="concept">
13512 <primary>expansion</primary>
13513 <secondary>selecting from list by condition</secondary>
13514 </indexterm>
13515 <indexterm role="variable">
13516 <primary><varname>$item</varname></primary>
13517 </indexterm>
13518 After expansion, &lt;<emphasis>string</emphasis>&gt; is interpreted as a list, colon-separated by
13519 default, but the separator can be changed in the usual way. For each item
13520 in this list, its value is place in <varname>$item</varname>, and then the condition is
13521 evaluated. If the condition is true, <varname>$item</varname> is added to the output as an
13522 item in a new list; if the condition is false, the item is discarded. The
13523 separator used for the output list is the same as the one used for the
13524 input, but a separator setting is not included in the output. For example:
13525 </para>
13526 <literallayout class="monospaced">
13527 ${filter{a:b:c}{!eq{$item}{b}}
13528 </literallayout>
13529 <para>
13530 yields <literal>a:c</literal>. At the end of the expansion, the value of <varname>$item</varname> is restored
13531 to what it was before. See also the <emphasis role="bold">map</emphasis> and <emphasis role="bold">reduce</emphasis> expansion items.
13532 </para>
13533 </listitem></varlistentry>
13534 <varlistentry>
13535 <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>
13536 <listitem>
13537 <para>
13538 <indexterm role="concept">
13539 <primary>hash function</primary>
13540 <secondary>textual</secondary>
13541 </indexterm>
13542 <indexterm role="concept">
13543 <primary>expansion</primary>
13544 <secondary>textual hash</secondary>
13545 </indexterm>
13546 This is a textual hashing function, and was the first to be implemented in
13547 early versions of Exim. In current releases, there are other hashing functions
13548 (numeric, MD5, and SHA-1), which are described below.
13549 </para>
13550 <para>
13551 The first two strings, after expansion, must be numbers. Call them &lt;<emphasis>m</emphasis>&gt; and
13552 &lt;<emphasis>n</emphasis>&gt;. If you are using fixed values for these numbers, that is, if
13553 &lt;<emphasis>string1</emphasis>&gt; and &lt;<emphasis>string2</emphasis>&gt; do not change when they are expanded, you can
13554 use the simpler operator notation that avoids some of the braces:
13555 </para>
13556 <literallayout class="monospaced">
13557 ${hash_&lt;n&gt;_&lt;m&gt;:&lt;string&gt;}
13558 </literallayout>
13559 <para>
13560 The second number is optional (in both notations). If &lt;<emphasis>n</emphasis>&gt; is greater than
13561 or equal to the length of the string, the expansion item returns the string.
13562 Otherwise it computes a new string of length &lt;<emphasis>n</emphasis>&gt; by applying a hashing
13563 function to the string. The new string consists of characters taken from the
13564 first &lt;<emphasis>m</emphasis>&gt; characters of the string
13565 </para>
13566 <literallayout class="monospaced">
13567 abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQWRSTUVWXYZ0123456789
13568 </literallayout>
13569 <para>
13570 If &lt;<emphasis>m</emphasis>&gt; is not present the value 26 is used, so that only lower case
13571 letters appear. For example:
13572 </para>
13573 <literallayout>
13574 <literal>$hash{3}{monty}}           </literal>   yields  <literal>jmg</literal>
13575 <literal>$hash{5}{monty}}           </literal>   yields  <literal>monty</literal>
13576 <literal>$hash{4}{62}{monty python}}</literal>   yields  <literal>fbWx</literal>
13577 </literallayout>
13578 </listitem></varlistentry>
13579 <varlistentry>
13580 <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>
13581 <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>
13582 <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>
13583 <listitem>
13584 <para>
13585 <indexterm role="concept">
13586 <primary>expansion</primary>
13587 <secondary>header insertion</secondary>
13588 </indexterm>
13589 <indexterm role="variable">
13590 <primary><varname>$header_</varname></primary>
13591 </indexterm>
13592 <indexterm role="variable">
13593 <primary><varname>$bheader_</varname></primary>
13594 </indexterm>
13595 <indexterm role="variable">
13596 <primary><varname>$rheader_</varname></primary>
13597 </indexterm>
13598 <indexterm role="concept">
13599 <primary>header lines</primary>
13600 <secondary>in expansion strings</secondary>
13601 </indexterm>
13602 <indexterm role="concept">
13603 <primary>header lines</primary>
13604 <secondary>character sets</secondary>
13605 </indexterm>
13606 <indexterm role="concept">
13607 <primary>header lines</primary>
13608 <secondary>decoding</secondary>
13609 </indexterm>
13610 Substitute the contents of the named message header line, for example
13611 </para>
13612 <literallayout class="monospaced">
13613 $header_reply-to:
13614 </literallayout>
13615 <para>
13616 The newline that terminates a header line is not included in the expansion, but
13617 internal newlines (caused by splitting the header line over several physical
13618 lines) may be present.
13619 </para>
13620 <para>
13621 The difference between <option>rheader</option>, <option>bheader</option>, and <option>header</option> is in the way
13622 the data in the header line is interpreted.
13623 </para>
13624 <itemizedlist>
13625 <listitem>
13626 <para>
13627 <indexterm role="concept">
13628 <primary>white space</primary>
13629 <secondary>in header lines</secondary>
13630 </indexterm>
13631 <option>rheader</option> gives the original <quote>raw</quote> content of the header line, with no
13632 processing at all, and without the removal of leading and trailing white space.
13633 </para>
13634 </listitem>
13635 <listitem>
13636 <para>
13637 <indexterm role="concept">
13638 <primary>base64 encoding</primary>
13639 <secondary>in header lines</secondary>
13640 </indexterm>
13641 <option>bheader</option> removes leading and trailing white space, and then decodes base64
13642 or quoted-printable MIME <quote>words</quote> within the header text, but does no
13643 character set translation. If decoding of what looks superficially like a MIME
13644 <quote>word</quote> fails, the raw string is returned. If decoding
13645 <indexterm role="concept">
13646 <primary>binary zero</primary>
13647 <secondary>in header line</secondary>
13648 </indexterm>
13649 produces a binary zero character, it is replaced by a question mark &ndash; this is
13650 what Exim does for binary zeros that are actually received in header lines.
13651 </para>
13652 </listitem>
13653 <listitem>
13654 <para>
13655 <option>header</option> tries to translate the string as decoded by <option>bheader</option> to a
13656 standard character set. This is an attempt to produce the same string as would
13657 be displayed on a user&#x2019;s MUA. If translation fails, the <option>bheader</option> string is
13658 returned. Translation is attempted only on operating systems that support the
13659 <function>iconv()</function> function. This is indicated by the compile-time macro HAVE_ICONV in
13660 a system Makefile or in <filename>Local/Makefile</filename>.
13661 </para>
13662 </listitem>
13663 </itemizedlist>
13664 <para>
13665 In a filter file, the target character set for <option>header</option> can be specified by a
13666 command of the following form:
13667 </para>
13668 <literallayout class="monospaced">
13669 headers charset "UTF-8"
13670 </literallayout>
13671 <para>
13672 This command affects all references to <varname>$h_</varname> (or <varname>$header_</varname>) expansions in
13673 subsequently obeyed filter commands. In the absence of this command, the target
13674 character set in a filter is taken from the setting of the <option>headers_charset</option>
13675 option in the runtime configuration. The value of this option defaults to the
13676 value of HEADERS_CHARSET in <filename>Local/Makefile</filename>. The ultimate default is
13677 ISO-8859-1.
13678 </para>
13679 <para>
13680 Header names follow the syntax of RFC 2822, which states that they may contain
13681 any printing characters except space and colon. Consequently, curly brackets
13682 <emphasis>do not</emphasis> terminate header names, and should not be used to enclose them as
13683 if they were variables. Attempting to do so causes a syntax error.
13684 </para>
13685 <para>
13686 Only header lines that are common to all copies of a message are visible to
13687 this mechanism. These are the original header lines that are received with the
13688 message, and any that are added by an ACL statement or by a system
13689 filter. Header lines that are added to a particular copy of a message by a
13690 router or transport are not accessible.
13691 </para>
13692 <para>
13693 For incoming SMTP messages, no header lines are visible in ACLs that are obeyed
13694 before the DATA ACL, because the header structure is not set up until the
13695 message is received. Header lines that are added in a RCPT ACL (for example)
13696 are saved until the message&#x2019;s incoming header lines are available, at which
13697 point they are added. When a DATA ACL is running, however, header lines added
13698 by earlier ACLs are visible.
13699 </para>
13700 <para>
13701 Upper case and lower case letters are synonymous in header names. If the
13702 following character is white space, the terminating colon may be omitted, but
13703 this is not recommended, because you may then forget it when it is needed. When
13704 white space terminates the header name, it is included in the expanded string.
13705 If the message does not contain the given header, the expansion item is
13706 replaced by an empty string. (See the <option>def</option> condition in section
13707 <xref linkend="SECTexpcond"/> for a means of testing for the existence of a header.)
13708 </para>
13709 <para>
13710 If there is more than one header with the same name, they are all concatenated
13711 to form the substitution string, up to a maximum length of 64K. Unless
13712 <option>rheader</option> is being used, leading and trailing white space is removed from
13713 each header before concatenation, and a completely empty header is ignored. A
13714 newline character is then inserted between non-empty headers, but there is no
13715 newline at the very end. For the <option>header</option> and <option>bheader</option> expansion, for
13716 those headers that contain lists of addresses, a comma is also inserted at the
13717 junctions between headers. This does not happen for the <option>rheader</option> expansion.
13718 </para>
13719 </listitem></varlistentry>
13720 <varlistentry>
13721 <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>
13722 <listitem>
13723 <para>
13724 <indexterm role="concept">
13725 <primary>expansion</primary>
13726 <secondary>hmac hashing</secondary>
13727 </indexterm>
13728 <indexterm role="concept">
13729 <primary><option>hmac</option></primary>
13730 </indexterm>
13731 This function uses cryptographic hashing (either MD5 or SHA-1) to convert a
13732 shared secret and some text into a message authentication code, as specified in
13733 RFC 2104. This differs from <literal>${md5:secret_text...}</literal> or
13734 <literal>${sha1:secret_text...}</literal> in that the hmac step adds a signature to the
13735 cryptographic hash, allowing for authentication that is not possible with MD5
13736 or SHA-1 alone. The hash name must expand to either <literal>md5</literal> or <literal>sha1</literal> at
13737 present. For example:
13738 </para>
13739 <literallayout class="monospaced">
13740 ${hmac{md5}{somesecret}{$primary_hostname $tod_log}}
13741 </literallayout>
13742 <para>
13743 For the hostname <emphasis>mail.example.com</emphasis> and time 2002-10-17 11:30:59, this
13744 produces:
13745 </para>
13746 <literallayout class="monospaced">
13747 dd97e3ba5d1a61b5006108f8c8252953
13748 </literallayout>
13749 <para>
13750 As an example of how this might be used, you might put in the main part of
13751 an Exim configuration:
13752 </para>
13753 <literallayout class="monospaced">
13754 SPAMSCAN_SECRET=cohgheeLei2thahw
13755 </literallayout>
13756 <para>
13757 In a router or a transport you could then have:
13758 </para>
13759 <literallayout class="monospaced">
13760 headers_add = \
13761   X-Spam-Scanned: ${primary_hostname} ${message_exim_id} \
13762   ${hmac{md5}{SPAMSCAN_SECRET}\
13763   {${primary_hostname},${message_exim_id},$h_message-id:}}
13764 </literallayout>
13765 <para>
13766 Then given a message, you can check where it was scanned by looking at the
13767 <emphasis>X-Spam-Scanned:</emphasis> header line. If you know the secret, you can check that
13768 this header line is authentic by recomputing the authentication code from the
13769 host name, message ID and the <emphasis>Message-id:</emphasis> header line. This can be done
13770 using Exim&#x2019;s <option>-be</option> option, or by other means, for example by using the
13771 <emphasis>hmac_md5_hex()</emphasis> function in Perl.
13772 </para>
13773 </listitem></varlistentry>
13774 <varlistentry>
13775 <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>
13776 <listitem>
13777 <para>
13778 <indexterm role="concept">
13779 <primary>expansion</primary>
13780 <secondary>conditional</secondary>
13781 </indexterm>
13782 <indexterm role="concept">
13783 <primary><option>if</option>, expansion item</primary>
13784 </indexterm>
13785 If &lt;<emphasis>condition</emphasis>&gt; is true, &lt;<emphasis>string1</emphasis>&gt; is expanded and replaces the whole
13786 item; otherwise &lt;<emphasis>string2</emphasis>&gt; is used. The available conditions are described
13787 in section <xref linkend="SECTexpcond"/> below. For example:
13788 </para>
13789 <literallayout class="monospaced">
13790 ${if eq {$local_part}{postmaster} {yes}{no} }
13791 </literallayout>
13792 <para>
13793 The second string need not be present; if it is not and the condition is not
13794 true, the item is replaced with nothing. Alternatively, the word <quote>fail</quote> may
13795 be present instead of the second string (without any curly brackets). In this
13796 case, the expansion is forced to fail if the condition is not true (see section
13797 <xref linkend="SECTforexpfai"/>).
13798 </para>
13799 <para>
13800 If both strings are omitted, the result is the string <literal>true</literal> if the condition
13801 is true, and the empty string if the condition is false. This makes it less
13802 cumbersome to write custom ACL and router conditions. For example, instead of
13803 </para>
13804 <literallayout class="monospaced">
13805 condition = ${if &gt;{$acl_m4}{3}{true}{false}}
13806 </literallayout>
13807 <para>
13808 you can use
13809 </para>
13810 <literallayout class="monospaced">
13811 condition = ${if &gt;{$acl_m4}{3}}
13812 </literallayout>
13813 </listitem></varlistentry>
13814 <varlistentry>
13815 <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>
13816 <listitem>
13817 <para>
13818 <indexterm role="concept">
13819 <primary>expansion</primary>
13820 <secondary>string truncation</secondary>
13821 </indexterm>
13822 <indexterm role="concept">
13823 <primary><option>length</option> expansion item</primary>
13824 </indexterm>
13825 The <option>length</option> item is used to extract the initial portion of a string. Both
13826 strings are expanded, and the first one must yield a number, &lt;<emphasis>n</emphasis>&gt;, say. If
13827 you are using a fixed value for the number, that is, if &lt;<emphasis>string1</emphasis>&gt; does not
13828 change when expanded, you can use the simpler operator notation that avoids
13829 some of the braces:
13830 </para>
13831 <literallayout class="monospaced">
13832 ${length_&lt;n&gt;:&lt;string&gt;}
13833 </literallayout>
13834 <para>
13835 The result of this item is either the first &lt;<emphasis>n</emphasis>&gt; characters or the whole
13836 of &lt;<emphasis>string2</emphasis>&gt;, whichever is the shorter. Do not confuse <option>length</option> with
13837 <option>strlen</option>, which gives the length of a string.
13838 </para>
13839 </listitem></varlistentry>
13840 <varlistentry>
13841 <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>
13842 <listitem>
13843 <para>
13844 <indexterm role="concept">
13845 <primary>expansion</primary>
13846 <secondary>extracting list elements by number</secondary>
13847 </indexterm>
13848 <indexterm role="concept">
13849 <primary><option>listextract</option></primary>
13850 <secondary>extract list elements by number</secondary>
13851 </indexterm>
13852 <indexterm role="concept">
13853 <primary>list</primary>
13854 <secondary>extracting elements by number</secondary>
13855 </indexterm>
13856 The &lt;<emphasis>number</emphasis>&gt; argument must consist entirely of decimal digits,
13857 apart from an optional leading minus,
13858 and leading and trailing white space (which is ignored).
13859 </para>
13860 <para>
13861 After expansion, &lt;<emphasis>string1</emphasis>&gt; is interpreted as a list, colon-separated by
13862 default, but the separator can be changed in the usual way.
13863 </para>
13864 <para>
13865 The first field of the list is numbered one.
13866 If the number is negative, the fields are
13867 counted from the end of the list, with the rightmost one numbered -1.
13868 The numbered element of the list is extracted and placed in <varname>$value</varname>,
13869 then &lt;<emphasis>string2</emphasis>&gt; is expanded as the result.
13870 </para>
13871 <para>
13872 If the modulus of the
13873 number is zero or greater than the number of fields in the string,
13874 the result is the expansion of &lt;<emphasis>string3</emphasis>&gt;.
13875 </para>
13876 <para>
13877 For example:
13878 </para>
13879 <literallayout class="monospaced">
13880 ${listextract{2}{x:42:99}}
13881 </literallayout>
13882 <para>
13883 yields <quote>42</quote>, and
13884 </para>
13885 <literallayout class="monospaced">
13886 ${listextract{-3}{&lt;, x,42,99,&amp; Mailer,,/bin/bash}{result: $value}}
13887 </literallayout>
13888 <para>
13889 yields <quote>result: 99</quote>.
13890 </para>
13891 <para>
13892 If {&lt;<emphasis>string3</emphasis>&gt;} is omitted, an empty string is used for string3.
13893 If {&lt;<emphasis>string2</emphasis>&gt;} is also omitted, the value that was
13894 extracted is used.
13895 You can use <literal>fail</literal> instead of {&lt;<emphasis>string3</emphasis>&gt;} as in a string extract.
13896 </para>
13897 </listitem></varlistentry>
13898 <varlistentry>
13899 <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>
13900 <listitem>
13901 <para>
13902 This is the first of one of two different types of lookup item, which are both
13903 described in the next item.
13904 </para>
13905 </listitem></varlistentry>
13906 <varlistentry>
13907 <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>
13908 <listitem>
13909 <para>
13910 <indexterm role="concept">
13911 <primary>expansion</primary>
13912 <secondary>lookup in</secondary>
13913 </indexterm>
13914 <indexterm role="concept">
13915 <primary>file</primary>
13916 <secondary>lookups</secondary>
13917 </indexterm>
13918 <indexterm role="concept">
13919 <primary>lookup</primary>
13920 <secondary>in expanded string</secondary>
13921 </indexterm>
13922 The two forms of lookup item specify data lookups in files and databases, as
13923 discussed in chapter <xref linkend="CHAPfdlookup"/>. The first form is used for single-key
13924 lookups, and the second is used for query-style lookups. The &lt;<emphasis>key</emphasis>&gt;,
13925 &lt;<emphasis>file</emphasis>&gt;, and &lt;<emphasis>query</emphasis>&gt; strings are expanded before use.
13926 </para>
13927 <para>
13928 If there is any white space in a lookup item which is part of a filter command,
13929 a retry or rewrite rule, a routing rule for the <command>manualroute</command> router, or any
13930 other place where white space is significant, the lookup item must be enclosed
13931 in double quotes. The use of data lookups in users&#x2019; filter files may be locked
13932 out by the system administrator.
13933 </para>
13934 <para>
13935 <indexterm role="variable">
13936 <primary><varname>$value</varname></primary>
13937 </indexterm>
13938 If the lookup succeeds, &lt;<emphasis>string1</emphasis>&gt; is expanded and replaces the entire item.
13939 During its expansion, the variable <varname>$value</varname> contains the data returned by the
13940 lookup. Afterwards it reverts to the value it had previously (at the outer
13941 level it is empty). If the lookup fails, &lt;<emphasis>string2</emphasis>&gt; is expanded and replaces
13942 the entire item. If {&lt;<emphasis>string2</emphasis>&gt;} is omitted, the replacement is the empty
13943 string on failure. If &lt;<emphasis>string2</emphasis>&gt; is provided, it can itself be a nested
13944 lookup, thus providing a mechanism for looking up a default value when the
13945 original lookup fails.
13946 </para>
13947 <para>
13948 If a nested lookup is used as part of &lt;<emphasis>string1</emphasis>&gt;, <varname>$value</varname> contains the
13949 data for the outer lookup while the parameters of the second lookup are
13950 expanded, and also while &lt;<emphasis>string2</emphasis>&gt; of the second lookup is expanded, should
13951 the second lookup fail. Instead of {&lt;<emphasis>string2</emphasis>&gt;} the word <quote>fail</quote> can
13952 appear, and in this case, if the lookup fails, the entire expansion is forced
13953 to fail (see section <xref linkend="SECTforexpfai"/>). If both {&lt;<emphasis>string1</emphasis>&gt;} and
13954 {&lt;<emphasis>string2</emphasis>&gt;} are omitted, the result is the looked up value in the case of a
13955 successful lookup, and nothing in the case of failure.
13956 </para>
13957 <para>
13958 For single-key lookups, the string <quote>partial</quote> is permitted to precede the
13959 search type in order to do partial matching, and * or *@ may follow a search
13960 type to request default lookups if the key does not match (see sections
13961 <xref linkend="SECTdefaultvaluelookups"/> and <xref linkend="SECTpartiallookup"/> for details).
13962 </para>
13963 <para>
13964 <indexterm role="concept">
13965 <primary>numerical variables (<varname>$1</varname> <varname>$2</varname> etc)</primary>
13966 <secondary>in lookup expansion</secondary>
13967 </indexterm>
13968 If a partial search is used, the variables <varname>$1</varname> and <varname>$2</varname> contain the wild
13969 and non-wild parts of the key during the expansion of the replacement text.
13970 They return to their previous values at the end of the lookup item.
13971 </para>
13972 <para>
13973 This example looks up the postmaster alias in the conventional alias file:
13974 </para>
13975 <literallayout class="monospaced">
13976 ${lookup {postmaster} lsearch {/etc/aliases} {$value}}
13977 </literallayout>
13978 <para>
13979 This example uses NIS+ to look up the full name of the user corresponding to
13980 the local part of an address, forcing the expansion to fail if it is not found:
13981 </para>
13982 <literallayout class="monospaced">
13983 ${lookup nisplus {[name=$local_part],passwd.org_dir:gcos} \
13984   {$value}fail}
13985 </literallayout>
13986 </listitem></varlistentry>
13987 <varlistentry>
13988 <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>
13989 <listitem>
13990 <para>
13991 <indexterm role="concept">
13992 <primary>expansion</primary>
13993 <secondary>list creation</secondary>
13994 </indexterm>
13995 <indexterm role="variable">
13996 <primary><varname>$item</varname></primary>
13997 </indexterm>
13998 After expansion, &lt;<emphasis>string1</emphasis>&gt; is interpreted as a list, colon-separated by
13999 default, but the separator can be changed in the usual way. For each item
14000 in this list, its value is place in <varname>$item</varname>, and then &lt;<emphasis>string2</emphasis>&gt; is
14001 expanded and added to the output as an item in a new list. The separator used
14002 for the output list is the same as the one used for the input, but a separator
14003 setting is not included in the output. For example:
14004 </para>
14005 <literallayout class="monospaced">
14006 ${map{a:b:c}{[$item]}} ${map{&lt;- x-y-z}{($item)}}
14007 </literallayout>
14008 <para>
14009 expands to <literal>[a]:[b]:[c] (x)-(y)-(z)</literal>. At the end of the expansion, the
14010 value of <varname>$item</varname> is restored to what it was before. See also the <emphasis role="bold">filter</emphasis>
14011 and <emphasis role="bold">reduce</emphasis> expansion items.
14012 </para>
14013 </listitem></varlistentry>
14014 <varlistentry>
14015 <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>
14016 <listitem>
14017 <para>
14018 <indexterm role="concept">
14019 <primary>expansion</primary>
14020 <secondary>numeric hash</secondary>
14021 </indexterm>
14022 <indexterm role="concept">
14023 <primary>hash function</primary>
14024 <secondary>numeric</secondary>
14025 </indexterm>
14026 The three strings are expanded; the first two must yield numbers. Call them
14027 &lt;<emphasis>n</emphasis>&gt; and &lt;<emphasis>m</emphasis>&gt;. If you are using fixed values for these numbers, that is,
14028 if &lt;<emphasis>string1</emphasis>&gt; and &lt;<emphasis>string2</emphasis>&gt; do not change when they are expanded, you
14029 can use the simpler operator notation that avoids some of the braces:
14030 </para>
14031 <literallayout class="monospaced">
14032 ${nhash_&lt;n&gt;_&lt;m&gt;:&lt;string&gt;}
14033 </literallayout>
14034 <para>
14035 The second number is optional (in both notations). If there is only one number,
14036 the result is a number in the range 0&ndash;&lt;<emphasis>n</emphasis>&gt;-1. Otherwise, the string is
14037 processed by a div/mod hash function that returns two numbers, separated by a
14038 slash, in the ranges 0 to &lt;<emphasis>n</emphasis>&gt;-1 and 0 to &lt;<emphasis>m</emphasis>&gt;-1, respectively. For
14039 example,
14040 </para>
14041 <literallayout class="monospaced">
14042 ${nhash{8}{64}{supercalifragilisticexpialidocious}}
14043 </literallayout>
14044 <para>
14045 returns the string <quote>6/33</quote>.
14046 </para>
14047 </listitem></varlistentry>
14048 <varlistentry>
14049 <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>
14050 <listitem>
14051 <para>
14052 <indexterm role="concept">
14053 <primary>Perl</primary>
14054 <secondary>use in expanded string</secondary>
14055 </indexterm>
14056 <indexterm role="concept">
14057 <primary>expansion</primary>
14058 <secondary>calling Perl from</secondary>
14059 </indexterm>
14060 This item is available only if Exim has been built to include an embedded Perl
14061 interpreter. The subroutine name and the arguments are first separately
14062 expanded, and then the Perl subroutine is called with those arguments. No
14063 additional arguments need be given; the maximum number permitted, including the
14064 name of the subroutine, is nine.
14065 </para>
14066 <para>
14067 The return value of the subroutine is inserted into the expanded string, unless
14068 the return value is <option>undef</option>. In that case, the expansion fails in the same
14069 way as an explicit <quote>fail</quote> on a lookup item. The return value is a scalar.
14070 Whatever you return is evaluated in a scalar context. For example, if you
14071 return the name of a Perl vector, the return value is the size of the vector,
14072 not its contents.
14073 </para>
14074 <para>
14075 If the subroutine exits by calling Perl&#x2019;s <option>die</option> function, the expansion fails
14076 with the error message that was passed to <option>die</option>. More details of the embedded
14077 Perl facility are given in chapter <xref linkend="CHAPperl"/>.
14078 </para>
14079 <para>
14080 The <command>redirect</command> router has an option called <option>forbid_filter_perl</option> which locks
14081 out the use of this expansion item in filter files.
14082 </para>
14083 </listitem></varlistentry>
14084 <varlistentry>
14085 <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>
14086 <listitem>
14087 <para>
14088 <indexterm role="concept">
14089 <primary><option>prvs</option> expansion item</primary>
14090 </indexterm>
14091 The first argument is a complete email address and the second is secret
14092 keystring. The third argument, specifying a key number, is optional. If absent,
14093 it defaults to 0. The result of the expansion is a prvs-signed email address,
14094 to be typically used with the <option>return_path</option> option on an <command>smtp</command> transport
14095 as part of a bounce address tag validation (BATV) scheme. For more discussion
14096 and an example, see section <xref linkend="SECTverifyPRVS"/>.
14097 </para>
14098 </listitem></varlistentry>
14099 <varlistentry>
14100 <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>
14101 <listitem>
14102 <para>
14103 <indexterm role="concept">
14104 <primary><option>prvscheck</option> expansion item</primary>
14105 </indexterm>
14106 This expansion item is the complement of the <option>prvs</option> item. It is used for
14107 checking prvs-signed addresses. If the expansion of the first argument does not
14108 yield a syntactically valid prvs-signed address, the whole item expands to the
14109 empty string. When the first argument does expand to a syntactically valid
14110 prvs-signed address, the second argument is expanded, with the prvs-decoded
14111 version of the address and the key number extracted from the address in the
14112 variables <varname>$prvscheck_address</varname> and <varname>$prvscheck_keynum</varname>, respectively.
14113 </para>
14114 <para>
14115 These two variables can be used in the expansion of the second argument to
14116 retrieve the secret. The validity of the prvs-signed address is then checked
14117 against the secret. The result is stored in the variable <varname>$prvscheck_result</varname>,
14118 which is empty for failure or <quote>1</quote> for success.
14119 </para>
14120 <para>
14121 The third argument is optional; if it is missing, it defaults to an empty
14122 string. This argument is now expanded. If the result is an empty string, the
14123 result of the expansion is the decoded version of the address. This is the case
14124 whether or not the signature was valid. Otherwise, the result of the expansion
14125 is the expansion of the third argument.
14126 </para>
14127 <para>
14128 All three variables can be used in the expansion of the third argument.
14129 However, once the expansion is complete, only <varname>$prvscheck_result</varname> remains set.
14130 For more discussion and an example, see section <xref linkend="SECTverifyPRVS"/>.
14131 </para>
14132 </listitem></varlistentry>
14133 <varlistentry>
14134 <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>
14135 <listitem>
14136 <para>
14137 <indexterm role="concept">
14138 <primary>expansion</primary>
14139 <secondary>inserting an entire file</secondary>
14140 </indexterm>
14141 <indexterm role="concept">
14142 <primary>file</primary>
14143 <secondary>inserting into expansion</secondary>
14144 </indexterm>
14145 <indexterm role="concept">
14146 <primary><option>readfile</option> expansion item</primary>
14147 </indexterm>
14148 The file name and end-of-line string are first expanded separately. The file is
14149 then read, and its contents replace the entire item. All newline characters in
14150 the file are replaced by the end-of-line string if it is present. Otherwise,
14151 newlines are left in the string.
14152 String expansion is not applied to the contents of the file. If you want this,
14153 you must wrap the item in an <option>expand</option> operator. If the file cannot be read,
14154 the string expansion fails.
14155 </para>
14156 <para>
14157 The <command>redirect</command> router has an option called <option>forbid_filter_readfile</option> which
14158 locks out the use of this expansion item in filter files.
14159 </para>
14160 </listitem></varlistentry>
14161 <varlistentry>
14162 <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>
14163 <listitem>
14164 <para>
14165 <indexterm role="concept">
14166 <primary>expansion</primary>
14167 <secondary>inserting from a socket</secondary>
14168 </indexterm>
14169 <indexterm role="concept">
14170 <primary>socket, use of in expansion</primary>
14171 </indexterm>
14172 <indexterm role="concept">
14173 <primary><option>readsocket</option> expansion item</primary>
14174 </indexterm>
14175 This item inserts data from a Unix domain or Internet socket into the expanded
14176 string. The minimal way of using it uses just two arguments, as in these
14177 examples:
14178 </para>
14179 <literallayout class="monospaced">
14180 ${readsocket{/socket/name}{request string}}
14181 ${readsocket{inet:some.host:1234}{request string}}
14182 </literallayout>
14183 <para>
14184 For a Unix domain socket, the first substring must be the path to the socket.
14185 For an Internet socket, the first substring must contain <literal>inet:</literal> followed by
14186 a host name or IP address, followed by a colon and a port, which can be a
14187 number or the name of a TCP port in <filename>/etc/services</filename>. An IP address may
14188 optionally be enclosed in square brackets. This is best for IPv6 addresses. For
14189 example:
14190 </para>
14191 <literallayout class="monospaced">
14192 ${readsocket{inet:[::1]:1234}{request string}}
14193 </literallayout>
14194 <para>
14195 Only a single host name may be given, but if looking it up yields more than
14196 one IP address, they are each tried in turn until a connection is made. For
14197 both kinds of socket, Exim makes a connection, writes the request string
14198 (unless it is an empty string) and reads from the socket until an end-of-file
14199 is read. A timeout of 5 seconds is applied. Additional, optional arguments
14200 extend what can be done. Firstly, you can vary the timeout. For example:
14201 </para>
14202 <literallayout class="monospaced">
14203 ${readsocket{/socket/name}{request string}{3s}}
14204 </literallayout>
14205 <para>
14206 A fourth argument allows you to change any newlines that are in the data
14207 that is read, in the same way as for <option>readfile</option> (see above). This example
14208 turns them into spaces:
14209 </para>
14210 <literallayout class="monospaced">
14211 ${readsocket{inet:127.0.0.1:3294}{request string}{3s}{ }}
14212 </literallayout>
14213 <para>
14214 As with all expansions, the substrings are expanded before the processing
14215 happens. Errors in these sub-expansions cause the expansion to fail. In
14216 addition, the following errors can occur:
14217 </para>
14218 <itemizedlist>
14219 <listitem>
14220 <para>
14221 Failure to create a socket file descriptor;
14222 </para>
14223 </listitem>
14224 <listitem>
14225 <para>
14226 Failure to connect the socket;
14227 </para>
14228 </listitem>
14229 <listitem>
14230 <para>
14231 Failure to write the request string;
14232 </para>
14233 </listitem>
14234 <listitem>
14235 <para>
14236 Timeout on reading from the socket.
14237 </para>
14238 </listitem>
14239 </itemizedlist>
14240 <para>
14241 By default, any of these errors causes the expansion to fail. However, if
14242 you supply a fifth substring, it is expanded and used when any of the above
14243 errors occurs. For example:
14244 </para>
14245 <literallayout class="monospaced">
14246 ${readsocket{/socket/name}{request string}{3s}{\n}\
14247   {socket failure}}
14248 </literallayout>
14249 <para>
14250 You can test for the existence of a Unix domain socket by wrapping this
14251 expansion in <literal>${if exists</literal>, but there is a race condition between that test
14252 and the actual opening of the socket, so it is safer to use the fifth argument
14253 if you want to be absolutely sure of avoiding an expansion error for a
14254 non-existent Unix domain socket, or a failure to connect to an Internet socket.
14255 </para>
14256 <para>
14257 The <command>redirect</command> router has an option called <option>forbid_filter_readsocket</option> which
14258 locks out the use of this expansion item in filter files.
14259 </para>
14260 </listitem></varlistentry>
14261 <varlistentry>
14262 <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>
14263 <listitem>
14264 <para>
14265 <indexterm role="concept">
14266 <primary>expansion</primary>
14267 <secondary>reducing a list to a scalar</secondary>
14268 </indexterm>
14269 <indexterm role="concept">
14270 <primary>list</primary>
14271 <secondary>reducing to a scalar</secondary>
14272 </indexterm>
14273 <indexterm role="variable">
14274 <primary><varname>$value</varname></primary>
14275 </indexterm>
14276 <indexterm role="variable">
14277 <primary><varname>$item</varname></primary>
14278 </indexterm>
14279 This operation reduces a list to a single, scalar string. After expansion,
14280 &lt;<emphasis>string1</emphasis>&gt; is interpreted as a list, colon-separated by default, but the
14281 separator can be changed in the usual way. Then &lt;<emphasis>string2</emphasis>&gt; is expanded and
14282 assigned to the <varname>$value</varname> variable. After this, each item in the &lt;<emphasis>string1</emphasis>&gt;
14283 list is assigned to <varname>$item</varname> in turn, and &lt;<emphasis>string3</emphasis>&gt; is expanded for each of
14284 them. The result of that expansion is assigned to <varname>$value</varname> before the next
14285 iteration. When the end of the list is reached, the final value of <varname>$value</varname> is
14286 added to the expansion output. The <emphasis role="bold">reduce</emphasis> expansion item can be used in a
14287 number of ways. For example, to add up a list of numbers:
14288 </para>
14289 <literallayout class="monospaced">
14290 ${reduce {&lt;, 1,2,3}{0}{${eval:$value+$item}}}
14291 </literallayout>
14292 <para>
14293 The result of that expansion would be <literal>6</literal>. The maximum of a list of numbers
14294 can be found:
14295 </para>
14296 <literallayout class="monospaced">
14297 ${reduce {3:0:9:4:6}{0}{${if &gt;{$item}{$value}{$item}{$value}}}}
14298 </literallayout>
14299 <para>
14300 At the end of a <emphasis role="bold">reduce</emphasis> expansion, the values of <varname>$item</varname> and <varname>$value</varname> are
14301 restored to what they were before. See also the <emphasis role="bold">filter</emphasis> and <emphasis role="bold">map</emphasis>
14302 expansion items.
14303 </para>
14304 </listitem></varlistentry>
14305 <varlistentry>
14306 <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>
14307 <listitem>
14308 <para>
14309 This item inserts <quote>raw</quote> header lines. It is described with the <option>header</option>
14310 expansion item above.
14311 </para>
14312 </listitem></varlistentry>
14313 <varlistentry>
14314 <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>
14315 <listitem>
14316 <para>
14317 <indexterm role="concept">
14318 <primary>expansion</primary>
14319 <secondary>running a command</secondary>
14320 </indexterm>
14321 <indexterm role="concept">
14322 <primary><option>run</option> expansion item</primary>
14323 </indexterm>
14324 The command and its arguments are first expanded as one string. The string is
14325 split apart into individual arguments by spaces, and then the command is run
14326 in a separate process, but under the same uid and gid.  As in other command
14327 executions from Exim, a shell is not used by default. If the command requires
14328 a shell, you must explicitly code it.
14329 </para>
14330 <para>
14331 Since the arguments are split by spaces, when there is a variable expansion
14332 which has an empty result, it will cause the situation that the argument will
14333 simply be omitted when the program is actually executed by Exim. If the
14334 script/program requires a specific number of arguments and the expanded
14335 variable could possibly result in this empty expansion, the variable must be
14336 quoted. This is more difficult if the expanded variable itself could result
14337 in a string containing quotes, because it would interfere with the quotes
14338 around the command arguments. A possible guard against this is to wrap the
14339 variable in the <option>sg</option> operator to change any quote marks to some other
14340 character.
14341 </para>
14342 <para>
14343 The standard input for the command exists, but is empty. The standard output
14344 and standard error are set to the same file descriptor.
14345 <indexterm role="concept">
14346 <primary>return code</primary>
14347 <secondary>from <option>run</option> expansion</secondary>
14348 </indexterm>
14349 <indexterm role="variable">
14350 <primary><varname>$value</varname></primary>
14351 </indexterm>
14352 If the command succeeds (gives a zero return code) &lt;<emphasis>string1</emphasis>&gt; is expanded
14353 and replaces the entire item; during this expansion, the standard output/error
14354 from the command is in the variable <varname>$value</varname>. If the command fails,
14355 &lt;<emphasis>string2</emphasis>&gt;, if present, is expanded and used. Once again, during the
14356 expansion, the standard output/error from the command is in the variable
14357 <varname>$value</varname>.
14358 </para>
14359 <para>
14360 If &lt;<emphasis>string2</emphasis>&gt; is absent, the result is empty. Alternatively, &lt;<emphasis>string2</emphasis>&gt;
14361 can be the word <quote>fail</quote> (not in braces) to force expansion failure if the
14362 command does not succeed. If both strings are omitted, the result is contents
14363 of the standard output/error on success, and nothing on failure.
14364 </para>
14365 <para>
14366 <indexterm role="variable">
14367 <primary><varname>$run_in_acl</varname></primary>
14368 </indexterm>
14369 The standard output/error of the command is put in the variable <varname>$value</varname>.
14370 In this ACL example, the output of a command is logged for the admin to
14371 troubleshoot:
14372 </para>
14373 <literallayout class="monospaced">
14374 warn  condition    = ${run{/usr/bin/id}{yes}{no}}
14375       log_message  = Output of id: $value
14376 </literallayout>
14377 <para>
14378 If the command requires shell idioms, such as the &gt; redirect operator, the
14379 shell must be invoked directly, such as with:
14380 </para>
14381 <literallayout class="monospaced">
14382 ${run{/bin/bash -c "/usr/bin/id &gt;/tmp/id"}{yes}{yes}}
14383 </literallayout>
14384 <para>
14385 <indexterm role="variable">
14386 <primary><varname>$runrc</varname></primary>
14387 </indexterm>
14388 The return code from the command is put in the variable <varname>$runrc</varname>, and this
14389 remains set afterwards, so in a filter file you can do things like this:
14390 </para>
14391 <literallayout class="monospaced">
14392 if "${run{x y z}{}}$runrc" is 1 then ...
14393   elif $runrc is 2 then ...
14394   ...
14395 endif
14396 </literallayout>
14397 <para>
14398 If execution of the command fails (for example, the command does not exist),
14399 the return code is 127 &ndash; the same code that shells use for non-existent
14400 commands.
14401 </para>
14402 <para>
14403 <emphasis role="bold">Warning</emphasis>: In a router or transport, you cannot assume the order in which
14404 option values are expanded, except for those preconditions whose order of
14405 testing is documented. Therefore, you cannot reliably expect to set <varname>$runrc</varname>
14406 by the expansion of one option, and use it in another.
14407 </para>
14408 <para>
14409 The <command>redirect</command> router has an option called <option>forbid_filter_run</option> which locks
14410 out the use of this expansion item in filter files.
14411 </para>
14412 </listitem></varlistentry>
14413 <varlistentry>
14414 <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>
14415 <listitem>
14416 <para>
14417 <indexterm role="concept">
14418 <primary>expansion</primary>
14419 <secondary>string substitution</secondary>
14420 </indexterm>
14421 <indexterm role="concept">
14422 <primary><option>sg</option> expansion item</primary>
14423 </indexterm>
14424 This item works like Perl&#x2019;s substitution operator (s) with the global (/g)
14425 option; hence its name. However, unlike the Perl equivalent, Exim does not
14426 modify the subject string; instead it returns the modified string for insertion
14427 into the overall expansion. The item takes three arguments: the subject string,
14428 a regular expression, and a substitution string. For example:
14429 </para>
14430 <literallayout class="monospaced">
14431 ${sg{abcdefabcdef}{abc}{xyz}}
14432 </literallayout>
14433 <para>
14434 yields <quote>xyzdefxyzdef</quote>. Because all three arguments are expanded before use,
14435 if any $ or \ characters are required in the regular expression or in the
14436 substitution string, they have to be escaped. For example:
14437 </para>
14438 <literallayout class="monospaced">
14439 ${sg{abcdef}{^(...)(...)\$}{\$2\$1}}
14440 </literallayout>
14441 <para>
14442 yields <quote>defabc</quote>, and
14443 </para>
14444 <literallayout class="monospaced">
14445 ${sg{1=A 4=D 3=C}{\N(\d+)=\N}{K\$1=}}
14446 </literallayout>
14447 <para>
14448 yields <quote>K1=A K4=D K3=C</quote>. Note the use of <literal>\N</literal> to protect the contents of
14449 the regular expression from string expansion.
14450 </para>
14451 </listitem></varlistentry>
14452 <varlistentry>
14453 <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>
14454 <listitem>
14455 <para>
14456 <indexterm role="concept">
14457 <primary><option>substr</option> expansion item</primary>
14458 </indexterm>
14459 <indexterm role="concept">
14460 <primary>substring extraction</primary>
14461 </indexterm>
14462 <indexterm role="concept">
14463 <primary>expansion</primary>
14464 <secondary>substring extraction</secondary>
14465 </indexterm>
14466 The three strings are expanded; the first two must yield numbers. Call them
14467 &lt;<emphasis>n</emphasis>&gt; and &lt;<emphasis>m</emphasis>&gt;. If you are using fixed values for these numbers, that is,
14468 if &lt;<emphasis>string1</emphasis>&gt; and &lt;<emphasis>string2</emphasis>&gt; do not change when they are expanded, you
14469 can use the simpler operator notation that avoids some of the braces:
14470 </para>
14471 <literallayout class="monospaced">
14472 ${substr_&lt;n&gt;_&lt;m&gt;:&lt;string&gt;}
14473 </literallayout>
14474 <para>
14475 The second number is optional (in both notations).
14476 If it is absent in the simpler format, the preceding underscore must also be
14477 omitted.
14478 </para>
14479 <para>
14480 The <option>substr</option> item can be used to extract more general substrings than
14481 <option>length</option>. The first number, &lt;<emphasis>n</emphasis>&gt;, is a starting offset, and &lt;<emphasis>m</emphasis>&gt; is the
14482 length required. For example
14483 </para>
14484 <literallayout class="monospaced">
14485 ${substr{3}{2}{$local_part}}
14486 </literallayout>
14487 <para>
14488 If the starting offset is greater than the string length the result is the
14489 null string; if the length plus starting offset is greater than the string
14490 length, the result is the right-hand part of the string, starting from the
14491 given offset. The first character in the string has offset zero.
14492 </para>
14493 <para>
14494 The <option>substr</option> expansion item can take negative offset values to count
14495 from the right-hand end of its operand. The last character is offset -1, the
14496 second-last is offset -2, and so on. Thus, for example,
14497 </para>
14498 <literallayout class="monospaced">
14499 ${substr{-5}{2}{1234567}}
14500 </literallayout>
14501 <para>
14502 yields <quote>34</quote>. If the absolute value of a negative offset is greater than the
14503 length of the string, the substring starts at the beginning of the string, and
14504 the length is reduced by the amount of overshoot. Thus, for example,
14505 </para>
14506 <literallayout class="monospaced">
14507 ${substr{-5}{2}{12}}
14508 </literallayout>
14509 <para>
14510 yields an empty string, but
14511 </para>
14512 <literallayout class="monospaced">
14513 ${substr{-3}{2}{12}}
14514 </literallayout>
14515 <para>
14516 yields <quote>1</quote>.
14517 </para>
14518 <para>
14519 When the second number is omitted from <option>substr</option>, the remainder of the string
14520 is taken if the offset is positive. If it is negative, all characters in the
14521 string preceding the offset point are taken. For example, an offset of -1 and
14522 no length, as in these semantically identical examples:
14523 </para>
14524 <literallayout class="monospaced">
14525 ${substr_-1:abcde}
14526 ${substr{-1}{abcde}}
14527 </literallayout>
14528 <para>
14529 yields all but the last character of the string, that is, <quote>abcd</quote>.
14530 </para>
14531 </listitem></varlistentry>
14532 <varlistentry>
14533 <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>
14534 <listitem>
14535 <para>
14536 <indexterm role="concept">
14537 <primary>expansion</primary>
14538 <secondary>character translation</secondary>
14539 </indexterm>
14540 <indexterm role="concept">
14541 <primary><option>tr</option> expansion item</primary>
14542 </indexterm>
14543 This item does single-character translation on its subject string. The second
14544 argument is a list of characters to be translated in the subject string. Each
14545 matching character is replaced by the corresponding character from the
14546 replacement list. For example
14547 </para>
14548 <literallayout class="monospaced">
14549 ${tr{abcdea}{ac}{13}}
14550 </literallayout>
14551 <para>
14552 yields <literal>1b3de1</literal>. If there are duplicates in the second character string, the
14553 last occurrence is used. If the third string is shorter than the second, its
14554 last character is replicated. However, if it is empty, no translation takes
14555 place.
14556 </para>
14557 </listitem></varlistentry>
14558 </variablelist>
14559 </section>
14560 <section id="SECTexpop">
14561 <title>Expansion operators</title>
14562 <para>
14563 <indexterm role="concept">
14564 <primary>expansion</primary>
14565 <secondary>operators</secondary>
14566 </indexterm>
14567 For expansion items that perform transformations on a single argument string,
14568 the <quote>operator</quote> notation is used because it is simpler and uses fewer braces.
14569 The substring is first expanded before the operation is applied to it. The
14570 following operations can be performed:
14571 </para>
14572 <variablelist>
14573 <varlistentry>
14574 <term><emphasis role="bold">${address:</emphasis>&lt;<emphasis>string</emphasis>&gt;<emphasis role="bold">}</emphasis></term>
14575 <listitem>
14576 <para>
14577 <indexterm role="concept">
14578 <primary>expansion</primary>
14579 <secondary>RFC 2822 address handling</secondary>
14580 </indexterm>
14581 <indexterm role="concept">
14582 <primary><option>address</option> expansion item</primary>
14583 </indexterm>
14584 The string is interpreted as an RFC 2822 address, as it might appear in a
14585 header line, and the effective address is extracted from it. If the string does
14586 not parse successfully, the result is empty.
14587 </para>
14588 </listitem></varlistentry>
14589 <varlistentry>
14590 <term><emphasis role="bold">${addresses:</emphasis>&lt;<emphasis>string</emphasis>&gt;<emphasis role="bold">}</emphasis></term>
14591 <listitem>
14592 <para>
14593 <indexterm role="concept">
14594 <primary>expansion</primary>
14595 <secondary>RFC 2822 address handling</secondary>
14596 </indexterm>
14597 <indexterm role="concept">
14598 <primary><option>addresses</option> expansion item</primary>
14599 </indexterm>
14600 The string (after expansion) is interpreted as a list of addresses in RFC
14601 2822 format, such as can be found in a <emphasis>To:</emphasis> or <emphasis>Cc:</emphasis> header line. The
14602 operative address (<emphasis>local-part@domain</emphasis>) is extracted from each item, and the
14603 result of the expansion is a colon-separated list, with appropriate
14604 doubling of colons should any happen to be present in the email addresses.
14605 Syntactically invalid RFC2822 address items are omitted from the output.
14606 </para>
14607 <para>
14608 It is possible to specify a character other than colon for the output
14609 separator by starting the string with &gt; followed by the new separator
14610 character. For example:
14611 </para>
14612 <literallayout class="monospaced">
14613 ${addresses:&gt;&amp; Chief &lt;ceo@up.stairs&gt;, sec@base.ment (dogsbody)}
14614 </literallayout>
14615 <para>
14616 expands to <literal>ceo@up.stairs&amp;sec@base.ment</literal>. Compare the <emphasis role="bold">address</emphasis> (singular)
14617 expansion item, which extracts the working address from a single RFC2822
14618 address. See the <emphasis role="bold">filter</emphasis>, <emphasis role="bold">map</emphasis>, and <emphasis role="bold">reduce</emphasis> items for ways of
14619 processing lists.
14620 </para>
14621 <para>
14622 To clarify "list of addresses in RFC 2822 format" mentioned above, Exim follows
14623 a strict interpretation of header line formatting.  Exim parses the bare,
14624 unquoted portion of an email address and if it finds a comma, treats it as an
14625 email address seperator. For the example header line:
14626 </para>
14627 <literallayout class="monospaced">
14628 From: =?iso-8859-2?Q?Last=2C_First?= &lt;user@example.com&gt;
14629 </literallayout>
14630 <para>
14631 The first example below demonstrates that Q-encoded email addresses are parsed
14632 properly if it is given the raw header (in this example, <literal>$rheader_from:</literal>).
14633 It does not see the comma because it&#x2019;s still encoded as "=2C".  The second
14634 example below is passed the contents of <literal>$header_from:</literal>, meaning it gets
14635 de-mimed. Exim sees the decoded "," so it treats it as <emphasis role="bold">two</emphasis> email addresses.
14636 The third example shows that the presence of a comma is skipped when it is
14637 quoted.
14638 </para>
14639 <literallayout class="monospaced">
14640 # exim -be '${addresses:From: \
14641 =?iso-8859-2?Q?Last=2C_First?= &lt;user@example.com&gt;}'
14642 user@example.com
14643 # exim -be '${addresses:From: Last, First &lt;user@example.com&gt;}'
14644 Last:user@example.com
14645 # exim -be '${addresses:From: "Last, First" &lt;user@example.com&gt;}'
14646 user@example.com
14647 </literallayout>
14648 </listitem></varlistentry>
14649 <varlistentry>
14650 <term><emphasis role="bold">${base62:</emphasis>&lt;<emphasis>digits</emphasis>&gt;<emphasis role="bold">}</emphasis></term>
14651 <listitem>
14652 <para>
14653 <indexterm role="concept">
14654 <primary><option>base62</option> expansion item</primary>
14655 </indexterm>
14656 <indexterm role="concept">
14657 <primary>expansion</primary>
14658 <secondary>conversion to base 62</secondary>
14659 </indexterm>
14660 The string must consist entirely of decimal digits. The number is converted to
14661 base 62 and output as a string of six characters, including leading zeros. In
14662 the few operating environments where Exim uses base 36 instead of base 62 for
14663 its message identifiers (because those systems do not have case-sensitive file
14664 names), base 36 is used by this operator, despite its name. <emphasis role="bold">Note</emphasis>: Just to
14665 be absolutely clear: this is <emphasis>not</emphasis> base64 encoding.
14666 </para>
14667 </listitem></varlistentry>
14668 <varlistentry>
14669 <term><emphasis role="bold">${base62d:</emphasis>&lt;<emphasis>base-62&nbsp;digits</emphasis>&gt;<emphasis role="bold">}</emphasis></term>
14670 <listitem>
14671 <para>
14672 <indexterm role="concept">
14673 <primary><option>base62d</option> expansion item</primary>
14674 </indexterm>
14675 <indexterm role="concept">
14676 <primary>expansion</primary>
14677 <secondary>conversion to base 62</secondary>
14678 </indexterm>
14679 The string must consist entirely of base-62 digits, or, in operating
14680 environments where Exim uses base 36 instead of base 62 for its message
14681 identifiers, base-36 digits. The number is converted to decimal and output as a
14682 string.
14683 </para>
14684 </listitem></varlistentry>
14685 <varlistentry>
14686 <term><emphasis role="bold">${domain:</emphasis>&lt;<emphasis>string</emphasis>&gt;<emphasis role="bold">}</emphasis></term>
14687 <listitem>
14688 <para>
14689 <indexterm role="concept">
14690 <primary>domain</primary>
14691 <secondary>extraction</secondary>
14692 </indexterm>
14693 <indexterm role="concept">
14694 <primary>expansion</primary>
14695 <secondary>domain extraction</secondary>
14696 </indexterm>
14697 The string is interpreted as an RFC 2822 address and the domain is extracted
14698 from it. If the string does not parse successfully, the result is empty.
14699 </para>
14700 </listitem></varlistentry>
14701 <varlistentry>
14702 <term><emphasis role="bold">${escape:</emphasis>&lt;<emphasis>string</emphasis>&gt;<emphasis role="bold">}</emphasis></term>
14703 <listitem>
14704 <para>
14705 <indexterm role="concept">
14706 <primary>expansion</primary>
14707 <secondary>escaping non-printing characters</secondary>
14708 </indexterm>
14709 <indexterm role="concept">
14710 <primary><option>escape</option> expansion item</primary>
14711 </indexterm>
14712 If the string contains any non-printing characters, they are converted to
14713 escape sequences starting with a backslash. Whether characters with the most
14714 significant bit set (so-called <quote>8-bit characters</quote>) count as printing or not
14715 is controlled by the <option>print_topbitchars</option> option.
14716 </para>
14717 </listitem></varlistentry>
14718 <varlistentry>
14719 <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>
14720 <listitem>
14721 <para>
14722 <indexterm role="concept">
14723 <primary>expansion</primary>
14724 <secondary>expression evaluation</secondary>
14725 </indexterm>
14726 <indexterm role="concept">
14727 <primary>expansion</primary>
14728 <secondary>arithmetic expression</secondary>
14729 </indexterm>
14730 <indexterm role="concept">
14731 <primary><option>eval</option> expansion item</primary>
14732 </indexterm>
14733 These items supports simple arithmetic and bitwise logical operations in
14734 expansion strings. The string (after expansion) must be a conventional
14735 arithmetic expression, but it is limited to basic arithmetic operators, bitwise
14736 logical operators, and parentheses. All operations are carried out using
14737 integer arithmetic. The operator priorities are as follows (the same as in the
14738 C programming language):
14739 </para>
14740 <informaltable frame="none">
14741 <tgroup cols="2" colsep="0" rowsep="0">
14742 <colspec colwidth="70pt" align="left"/>
14743 <colspec colwidth="300pt" align="left"/>
14744 <tbody>
14745 <row>
14746 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<emphasis>highest:</emphasis></entry>
14747 <entry>not (~), negate (-)</entry>
14748 </row>
14749 <row>
14750 <entry>&nbsp;&nbsp;&nbsp;&nbsp;</entry>
14751 <entry>multiply (*), divide (/), remainder (%)</entry>
14752 </row>
14753 <row>
14754 <entry>&nbsp;&nbsp;&nbsp;&nbsp;</entry>
14755 <entry>plus (+), minus (-)</entry>
14756 </row>
14757 <row>
14758 <entry>&nbsp;&nbsp;&nbsp;&nbsp;</entry>
14759 <entry>shift-left (&lt;&lt;), shift-right (&gt;&gt;)</entry>
14760 </row>
14761 <row>
14762 <entry>&nbsp;&nbsp;&nbsp;&nbsp;</entry>
14763 <entry>and (&amp;)</entry>
14764 </row>
14765 <row>
14766 <entry>&nbsp;&nbsp;&nbsp;&nbsp;</entry>
14767 <entry>xor (^)</entry>
14768 </row>
14769 <row>
14770 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<emphasis>lowest:</emphasis></entry>
14771 <entry>or (|)</entry>
14772 </row>
14773 </tbody>
14774 </tgroup>
14775 </informaltable>
14776 <para>
14777 Binary operators with the same priority are evaluated from left to right. White
14778 space is permitted before or after operators.
14779 </para>
14780 <para>
14781 For <option>eval</option>, numbers may be decimal, octal (starting with <quote>0</quote>) or
14782 hexadecimal (starting with <quote>0x</quote>). For <option>eval10</option>, all numbers are taken as
14783 decimal, even if they start with a leading zero; hexadecimal numbers are not
14784 permitted. This can be useful when processing numbers extracted from dates or
14785 times, which often do have leading zeros.
14786 </para>
14787 <para>
14788 A number may be followed by <quote>K</quote>, <quote>M</quote> or <quote>G</quote> to multiply it by 1024, 1024*1024
14789 or 1024*1024*1024,
14790 respectively. Negative numbers are supported. The result of the computation is
14791 a decimal representation of the answer (without <quote>K</quote>, <quote>M</quote> or <quote>G</quote>). For example:
14792 </para>
14793 <literallayout>
14794 <literal>${eval:1+1}            </literal>  yields 2
14795 <literal>${eval:1+2*3}          </literal>  yields 7
14796 <literal>${eval:(1+2)*3}        </literal>  yields 9
14797 <literal>${eval:2+42%5}         </literal>  yields 4
14798 <literal>${eval:0xc&amp;5}          </literal>  yields 4
14799 <literal>${eval:0xc|5}          </literal>  yields 13
14800 <literal>${eval:0xc^5}          </literal>  yields 9
14801 <literal>${eval:0xc&gt;&gt;1}         </literal>  yields 6
14802 <literal>${eval:0xc&lt;&lt;1}         </literal>  yields 24
14803 <literal>${eval:~255&amp;0x1234}    </literal>  yields 4608
14804 <literal>${eval:-(~255&amp;0x1234)} </literal>  yields -4608
14805 </literallayout>
14806 <para>
14807 As a more realistic example, in an ACL you might have
14808 </para>
14809 <literallayout class="monospaced">
14810 deny   message = Too many bad recipients
14811        condition =                    \
14812          ${if and {                   \
14813            {&gt;{$rcpt_count}{10}}       \
14814            {                          \
14815            &lt;                          \
14816              {$recipients_count}      \
14817              {${eval:$rcpt_count/2}}  \
14818            }                          \
14819          }{yes}{no}}
14820 </literallayout>
14821 <para>
14822 The condition is true if there have been more than 10 RCPT commands and
14823 fewer than half of them have resulted in a valid recipient.
14824 </para>
14825 </listitem></varlistentry>
14826 <varlistentry>
14827 <term><emphasis role="bold">${expand:</emphasis>&lt;<emphasis>string</emphasis>&gt;<emphasis role="bold">}</emphasis></term>
14828 <listitem>
14829 <para>
14830 <indexterm role="concept">
14831 <primary>expansion</primary>
14832 <secondary>re-expansion of substring</secondary>
14833 </indexterm>
14834 The <option>expand</option> operator causes a string to be expanded for a second time. For
14835 example,
14836 </para>
14837 <literallayout class="monospaced">
14838 ${expand:${lookup{$domain}dbm{/some/file}{$value}}}
14839 </literallayout>
14840 <para>
14841 first looks up a string in a file while expanding the operand for <option>expand</option>,
14842 and then re-expands what it has found.
14843 </para>
14844 </listitem></varlistentry>
14845 <varlistentry>
14846 <term><emphasis role="bold">${from_utf8:</emphasis>&lt;<emphasis>string</emphasis>&gt;<emphasis role="bold">}</emphasis></term>
14847 <listitem>
14848 <para>
14849 <indexterm role="concept">
14850 <primary>Unicode</primary>
14851 </indexterm>
14852 <indexterm role="concept">
14853 <primary>UTF-8</primary>
14854 <secondary>conversion from</secondary>
14855 </indexterm>
14856 <indexterm role="concept">
14857 <primary>expansion</primary>
14858 <secondary>UTF-8 conversion</secondary>
14859 </indexterm>
14860 <indexterm role="concept">
14861 <primary><option>from_utf8</option> expansion item</primary>
14862 </indexterm>
14863 The world is slowly moving towards Unicode, although there are no standards for
14864 email yet. However, other applications (including some databases) are starting
14865 to store data in Unicode, using UTF-8 encoding. This operator converts from a
14866 UTF-8 string to an ISO-8859-1 string. UTF-8 code values greater than 255 are
14867 converted to underscores. The input must be a valid UTF-8 string. If it is not,
14868 the result is an undefined sequence of bytes.
14869 </para>
14870 <para>
14871 Unicode code points with values less than 256 are compatible with ASCII and
14872 ISO-8859-1 (also known as Latin-1).
14873 For example, character 169 is the copyright symbol in both cases, though the
14874 way it is encoded is different. In UTF-8, more than one byte is needed for
14875 characters with code values greater than 127, whereas ISO-8859-1 is a
14876 single-byte encoding (but thereby limited to 256 characters). This makes
14877 translation from UTF-8 to ISO-8859-1 straightforward.
14878 </para>
14879 </listitem></varlistentry>
14880 <varlistentry>
14881 <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>
14882 <listitem>
14883 <para>
14884 <indexterm role="concept">
14885 <primary>hash function</primary>
14886 <secondary>textual</secondary>
14887 </indexterm>
14888 <indexterm role="concept">
14889 <primary>expansion</primary>
14890 <secondary>textual hash</secondary>
14891 </indexterm>
14892 The <option>hash</option> operator is a simpler interface to the hashing function that can
14893 be used when the two parameters are fixed numbers (as opposed to strings that
14894 change when expanded). The effect is the same as
14895 </para>
14896 <literallayout class="monospaced">
14897 ${hash{&lt;n&gt;}{&lt;m&gt;}{&lt;string&gt;}}
14898 </literallayout>
14899 <para>
14900 See the description of the general <option>hash</option> item above for details. The
14901 abbreviation <option>h</option> can be used when <option>hash</option> is used as an operator.
14902 </para>
14903 </listitem></varlistentry>
14904 <varlistentry>
14905 <term><emphasis role="bold">${hex2b64:</emphasis>&lt;<emphasis>hexstring</emphasis>&gt;<emphasis role="bold">}</emphasis></term>
14906 <listitem>
14907 <para>
14908 <indexterm role="concept">
14909 <primary>base64 encoding</primary>
14910 <secondary>conversion from hex</secondary>
14911 </indexterm>
14912 <indexterm role="concept">
14913 <primary>expansion</primary>
14914 <secondary>hex to base64</secondary>
14915 </indexterm>
14916 <indexterm role="concept">
14917 <primary><option>hex2b64</option> expansion item</primary>
14918 </indexterm>
14919 This operator converts a hex string into one that is base64 encoded. This can
14920 be useful for processing the output of the MD5 and SHA-1 hashing functions.
14921 </para>
14922 </listitem></varlistentry>
14923 <varlistentry>
14924 <term><emphasis role="bold">${hexquote:</emphasis>&lt;<emphasis>string</emphasis>&gt;<emphasis role="bold">}</emphasis></term>
14925 <listitem>
14926 <para>
14927 <indexterm role="concept">
14928 <primary>quoting</primary>
14929 <secondary>hex-encoded unprintable characters</secondary>
14930 </indexterm>
14931 <indexterm role="concept">
14932 <primary><option>hexquote</option> expansion item</primary>
14933 </indexterm>
14934 This operator converts non-printable characters in a string into a hex
14935 escape form. Byte values between 33 (!) and 126 (~) inclusive are left
14936 as is, and other byte values are converted to <literal>\xNN</literal>, for example a
14937 byte value 127 is converted to <literal>\x7f</literal>.
14938 </para>
14939 </listitem></varlistentry>
14940 <varlistentry>
14941 <term><emphasis role="bold">${lc:</emphasis>&lt;<emphasis>string</emphasis>&gt;<emphasis role="bold">}</emphasis></term>
14942 <listitem>
14943 <para>
14944 <indexterm role="concept">
14945 <primary>case forcing in strings</primary>
14946 </indexterm>
14947 <indexterm role="concept">
14948 <primary>string</primary>
14949 <secondary>case forcing</secondary>
14950 </indexterm>
14951 <indexterm role="concept">
14952 <primary>lower casing</primary>
14953 </indexterm>
14954 <indexterm role="concept">
14955 <primary>expansion</primary>
14956 <secondary>case forcing</secondary>
14957 </indexterm>
14958 <indexterm role="concept">
14959 <primary><option>lc</option> expansion item</primary>
14960 </indexterm>
14961 This forces the letters in the string into lower-case, for example:
14962 </para>
14963 <literallayout class="monospaced">
14964 ${lc:$local_part}
14965 </literallayout>
14966 </listitem></varlistentry>
14967 <varlistentry>
14968 <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>
14969 <listitem>
14970 <para>
14971 <indexterm role="concept">
14972 <primary>expansion</primary>
14973 <secondary>string truncation</secondary>
14974 </indexterm>
14975 <indexterm role="concept">
14976 <primary><option>length</option> expansion item</primary>
14977 </indexterm>
14978 The <option>length</option> operator is a simpler interface to the <option>length</option> function that
14979 can be used when the parameter is a fixed number (as opposed to a string that
14980 changes when expanded). The effect is the same as
14981 </para>
14982 <literallayout class="monospaced">
14983 ${length{&lt;number&gt;}{&lt;string&gt;}}
14984 </literallayout>
14985 <para>
14986 See the description of the general <option>length</option> item above for details. Note that
14987 <option>length</option> is not the same as <option>strlen</option>. The abbreviation <option>l</option> can be used
14988 when <option>length</option> is used as an operator.
14989 </para>
14990 </listitem></varlistentry>
14991 <varlistentry>
14992 <term><emphasis role="bold">${listcount:</emphasis>&lt;<emphasis>string</emphasis>&gt;<emphasis role="bold">}</emphasis></term>
14993 <listitem>
14994 <para>
14995 <indexterm role="concept">
14996 <primary>expansion</primary>
14997 <secondary>list item count</secondary>
14998 </indexterm>
14999 <indexterm role="concept">
15000 <primary>list</primary>
15001 <secondary>item count</secondary>
15002 </indexterm>
15003 <indexterm role="concept">
15004 <primary>list</primary>
15005 <secondary>count of items</secondary>
15006 </indexterm>
15007 <indexterm role="concept">
15008 <primary><option>listcount</option> expansion item</primary>
15009 </indexterm>
15010 The string is interpreted as a list and the number of items is returned.
15011 </para>
15012 </listitem></varlistentry>
15013 <varlistentry>
15014 <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>
15015 <listitem>
15016 <para>
15017 <indexterm role="concept">
15018 <primary>expansion</primary>
15019 <secondary>named list</secondary>
15020 </indexterm>
15021 <indexterm role="concept">
15022 <primary><option>listnamed</option> expansion item</primary>
15023 </indexterm>
15024 The name is interpreted as a named list and the content of the list is returned,
15025 expanding any referenced lists, re-quoting as needed for colon-separation.
15026 If the optional type is given it must be one of "a", "d", "h" or "l"
15027 and selects address-, domain-, host- or localpart- lists to search among respectively.
15028 Otherwise all types are searched in an undefined order and the first
15029 matching list is returned.
15030 </para>
15031 </listitem></varlistentry>
15032 <varlistentry>
15033 <term><emphasis role="bold">${local_part:</emphasis>&lt;<emphasis>string</emphasis>&gt;<emphasis role="bold">}</emphasis></term>
15034 <listitem>
15035 <para>
15036 <indexterm role="concept">
15037 <primary>expansion</primary>
15038 <secondary>local part extraction</secondary>
15039 </indexterm>
15040 <indexterm role="concept">
15041 <primary><option>local_part</option> expansion item</primary>
15042 </indexterm>
15043 The string is interpreted as an RFC 2822 address and the local part is
15044 extracted from it. If the string does not parse successfully, the result is
15045 empty.
15046 </para>
15047 </listitem></varlistentry>
15048 <varlistentry>
15049 <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>
15050 <listitem>
15051 <para>
15052 <indexterm role="concept">
15053 <primary>masked IP address</primary>
15054 </indexterm>
15055 <indexterm role="concept">
15056 <primary>IP address</primary>
15057 <secondary>masking</secondary>
15058 </indexterm>
15059 <indexterm role="concept">
15060 <primary>CIDR notation</primary>
15061 </indexterm>
15062 <indexterm role="concept">
15063 <primary>expansion</primary>
15064 <secondary>IP address masking</secondary>
15065 </indexterm>
15066 <indexterm role="concept">
15067 <primary><option>mask</option> expansion item</primary>
15068 </indexterm>
15069 If the form of the string to be operated on is not an IP address followed by a
15070 slash and an integer (that is, a network address in CIDR notation), the
15071 expansion fails. Otherwise, this operator converts the IP address to binary,
15072 masks off the least significant bits according to the bit count, and converts
15073 the result back to text, with mask appended. For example,
15074 </para>
15075 <literallayout class="monospaced">
15076 ${mask:10.111.131.206/28}
15077 </literallayout>
15078 <para>
15079 returns the string <quote>10.111.131.192/28</quote>. Since this operation is expected to
15080 be mostly used for looking up masked addresses in files, the result for an IPv6
15081 address uses dots to separate components instead of colons, because colon
15082 terminates a key string in lsearch files. So, for example,
15083 </para>
15084 <literallayout class="monospaced">
15085 ${mask:3ffe:ffff:836f:0a00:000a:0800:200a:c031/99}
15086 </literallayout>
15087 <para>
15088 returns the string
15089 </para>
15090 <literallayout class="monospaced">
15091 3ffe.ffff.836f.0a00.000a.0800.2000.0000/99
15092 </literallayout>
15093 <para>
15094 Letters in IPv6 addresses are always output in lower case.
15095 </para>
15096 </listitem></varlistentry>
15097 <varlistentry>
15098 <term><emphasis role="bold">${md5:</emphasis>&lt;<emphasis>string</emphasis>&gt;<emphasis role="bold">}</emphasis></term>
15099 <listitem>
15100 <para>
15101 <indexterm role="concept">
15102 <primary>MD5 hash</primary>
15103 </indexterm>
15104 <indexterm role="concept">
15105 <primary>expansion</primary>
15106 <secondary>MD5 hash</secondary>
15107 </indexterm>
15108 <indexterm role="concept">
15109 <primary>certificate fingerprint</primary>
15110 </indexterm>
15111 <indexterm role="concept">
15112 <primary><option>md5</option> expansion item</primary>
15113 </indexterm>
15114 The <option>md5</option> operator computes the MD5 hash value of the string, and returns it
15115 as a 32-digit hexadecimal number, in which any letters are in lower case.
15116 </para>
15117 </listitem></varlistentry>
15118 <varlistentry>
15119 <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>
15120 <listitem>
15121 <para>
15122 <indexterm role="concept">
15123 <primary>expansion</primary>
15124 <secondary>numeric hash</secondary>
15125 </indexterm>
15126 <indexterm role="concept">
15127 <primary>hash function</primary>
15128 <secondary>numeric</secondary>
15129 </indexterm>
15130 The <option>nhash</option> operator is a simpler interface to the numeric hashing function
15131 that can be used when the two parameters are fixed numbers (as opposed to
15132 strings that change when expanded). The effect is the same as
15133 </para>
15134 <literallayout class="monospaced">
15135 ${nhash{&lt;n&gt;}{&lt;m&gt;}{&lt;string&gt;}}
15136 </literallayout>
15137 <para>
15138 See the description of the general <option>nhash</option> item above for details.
15139 </para>
15140 </listitem></varlistentry>
15141 <varlistentry>
15142 <term><emphasis role="bold">${quote:</emphasis>&lt;<emphasis>string</emphasis>&gt;<emphasis role="bold">}</emphasis></term>
15143 <listitem>
15144 <para>
15145 <indexterm role="concept">
15146 <primary>quoting</primary>
15147 <secondary>in string expansions</secondary>
15148 </indexterm>
15149 <indexterm role="concept">
15150 <primary>expansion</primary>
15151 <secondary>quoting</secondary>
15152 </indexterm>
15153 <indexterm role="concept">
15154 <primary><option>quote</option> expansion item</primary>
15155 </indexterm>
15156 The <option>quote</option> operator puts its argument into double quotes if it
15157 is an empty string or
15158 contains anything other than letters, digits, underscores, dots, and hyphens.
15159 Any occurrences of double quotes and backslashes are escaped with a backslash.
15160 Newlines and carriage returns are converted to <literal>\n</literal> and <literal>\r</literal>,
15161 respectively For example,
15162 </para>
15163 <literallayout class="monospaced">
15164 ${quote:ab"*"cd}
15165 </literallayout>
15166 <para>
15167 becomes
15168 </para>
15169 <literallayout class="monospaced">
15170 "ab\"*\"cd"
15171 </literallayout>
15172 <para>
15173 The place where this is useful is when the argument is a substitution from a
15174 variable or a message header.
15175 </para>
15176 </listitem></varlistentry>
15177 <varlistentry>
15178 <term><emphasis role="bold">${quote_local_part:</emphasis>&lt;<emphasis>string</emphasis>&gt;<emphasis role="bold">}</emphasis></term>
15179 <listitem>
15180 <para>
15181 <indexterm role="concept">
15182 <primary><option>quote_local_part</option> expansion item</primary>
15183 </indexterm>
15184 This operator is like <option>quote</option>, except that it quotes the string only if
15185 required to do so by the rules of RFC 2822 for quoting local parts. For
15186 example, a plus sign would not cause quoting (but it would for <option>quote</option>).
15187 If you are creating a new email address from the contents of <varname>$local_part</varname>
15188 (or any other unknown data), you should always use this operator.
15189 </para>
15190 </listitem></varlistentry>
15191 <varlistentry>
15192 <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>
15193 <listitem>
15194 <para>
15195 <indexterm role="concept">
15196 <primary>quoting</primary>
15197 <secondary>lookup-specific</secondary>
15198 </indexterm>
15199 This operator applies lookup-specific quoting rules to the string. Each
15200 query-style lookup type has its own quoting rules which are described with
15201 the lookups in chapter <xref linkend="CHAPfdlookup"/>. For example,
15202 </para>
15203 <literallayout class="monospaced">
15204 ${quote_ldap:two * two}
15205 </literallayout>
15206 <para>
15207 returns
15208 </para>
15209 <literallayout class="monospaced">
15210 two%20%5C2A%20two
15211 </literallayout>
15212 <para>
15213 For single-key lookup types, no quoting is ever necessary and this operator
15214 yields an unchanged string.
15215 </para>
15216 </listitem></varlistentry>
15217 <varlistentry>
15218 <term><emphasis role="bold">${randint:</emphasis>&lt;<emphasis>n</emphasis>&gt;<emphasis role="bold">}</emphasis></term>
15219 <listitem>
15220 <para>
15221 <indexterm role="concept">
15222 <primary>random number</primary>
15223 </indexterm>
15224 This operator returns a somewhat random number which is less than the
15225 supplied number and is at least 0.  The quality of this randomness depends
15226 on how Exim was built; the values are not suitable for keying material.
15227 If Exim is linked against OpenSSL then RAND_pseudo_bytes() is used.
15228 If Exim is linked against GnuTLS then gnutls_rnd(GNUTLS_RND_NONCE) is used,
15229 for versions of GnuTLS with that function.
15230 Otherwise, the implementation may be arc4random(), random() seeded by
15231 srandomdev() or srandom(), or a custom implementation even weaker than
15232 random().
15233 </para>
15234 </listitem></varlistentry>
15235 <varlistentry>
15236 <term><emphasis role="bold">${reverse_ip:</emphasis>&lt;<emphasis>ipaddr</emphasis>&gt;<emphasis role="bold">}</emphasis></term>
15237 <listitem>
15238 <para>
15239 <indexterm role="concept">
15240 <primary>expansion</primary>
15241 <secondary>IP address</secondary>
15242 </indexterm>
15243 This operator reverses an IP address; for IPv4 addresses, the result is in
15244 dotted-quad decimal form, while for IPv6 addreses the result is in
15245 dotted-nibble hexadecimal form.  In both cases, this is the "natural" form
15246 for DNS.  For example,
15247 </para>
15248 <literallayout class="monospaced">
15249 ${reverse_ip:192.0.2.4}
15250 ${reverse_ip:2001:0db8:c42:9:1:abcd:192.0.2.127}
15251 </literallayout>
15252 <para>
15253 returns
15254 </para>
15255 <literallayout class="monospaced">
15256 4.2.0.192
15257 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
15258 </literallayout>
15259 </listitem></varlistentry>
15260 <varlistentry>
15261 <term><emphasis role="bold">${rfc2047:</emphasis>&lt;<emphasis>string</emphasis>&gt;<emphasis role="bold">}</emphasis></term>
15262 <listitem>
15263 <para>
15264 <indexterm role="concept">
15265 <primary>expansion</primary>
15266 <secondary>RFC 2047</secondary>
15267 </indexterm>
15268 <indexterm role="concept">
15269 <primary>RFC 2047</primary>
15270 <secondary>expansion operator</secondary>
15271 </indexterm>
15272 <indexterm role="concept">
15273 <primary><option>rfc2047</option> expansion item</primary>
15274 </indexterm>
15275 This operator encodes text according to the rules of RFC 2047. This is an
15276 encoding that is used in header lines to encode non-ASCII characters. It is
15277 assumed that the input string is in the encoding specified by the
15278 <option>headers_charset</option> option, which defaults to ISO-8859-1. If the string
15279 contains only characters in the range 33&ndash;126, and no instances of the
15280 characters
15281 </para>
15282 <literallayout class="monospaced">
15283 ? = ( ) &lt; &gt; @ , ; : \ " . [ ] _
15284 </literallayout>
15285 <para>
15286 it is not modified. Otherwise, the result is the RFC 2047 encoding of the
15287 string, using as many <quote>encoded words</quote> as necessary to encode all the
15288 characters.
15289 </para>
15290 </listitem></varlistentry>
15291 <varlistentry>
15292 <term><emphasis role="bold">${rfc2047d:</emphasis>&lt;<emphasis>string</emphasis>&gt;<emphasis role="bold">}</emphasis></term>
15293 <listitem>
15294 <para>
15295 <indexterm role="concept">
15296 <primary>expansion</primary>
15297 <secondary>RFC 2047</secondary>
15298 </indexterm>
15299 <indexterm role="concept">
15300 <primary>RFC 2047</primary>
15301 <secondary>decoding</secondary>
15302 </indexterm>
15303 <indexterm role="concept">
15304 <primary><option>rfc2047d</option> expansion item</primary>
15305 </indexterm>
15306 This operator decodes strings that are encoded as per RFC 2047. Binary zero
15307 bytes are replaced by question marks. Characters are converted into the
15308 character set defined by <option>headers_charset</option>. Overlong RFC 2047 <quote>words</quote> are
15309 not recognized unless <option>check_rfc2047_length</option> is set false.
15310 </para>
15311 <para>
15312 <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
15313 access a header line, RFC 2047 decoding is done automatically. You do not need
15314 to use this operator as well.
15315 </para>
15316 </listitem></varlistentry>
15317 <varlistentry>
15318 <term><emphasis role="bold">${rxquote:</emphasis>&lt;<emphasis>string</emphasis>&gt;<emphasis role="bold">}</emphasis></term>
15319 <listitem>
15320 <para>
15321 <indexterm role="concept">
15322 <primary>quoting</primary>
15323 <secondary>in regular expressions</secondary>
15324 </indexterm>
15325 <indexterm role="concept">
15326 <primary>regular expressions</primary>
15327 <secondary>quoting</secondary>
15328 </indexterm>
15329 <indexterm role="concept">
15330 <primary><option>rxquote</option> expansion item</primary>
15331 </indexterm>
15332 The <option>rxquote</option> operator inserts a backslash before any non-alphanumeric
15333 characters in its argument. This is useful when substituting the values of
15334 variables or headers inside regular expressions.
15335 </para>
15336 </listitem></varlistentry>
15337 <varlistentry>
15338 <term><emphasis role="bold">${sha1:</emphasis>&lt;<emphasis>string</emphasis>&gt;<emphasis role="bold">}</emphasis></term>
15339 <listitem>
15340 <para>
15341 <indexterm role="concept">
15342 <primary>SHA-1 hash</primary>
15343 </indexterm>
15344 <indexterm role="concept">
15345 <primary>expansion</primary>
15346 <secondary>SHA-1 hashing</secondary>
15347 </indexterm>
15348 <indexterm role="concept">
15349 <primary>certificate fingerprint</primary>
15350 </indexterm>
15351 <indexterm role="concept">
15352 <primary><option>sha2</option> expansion item</primary>
15353 </indexterm>
15354 The <option>sha1</option> operator computes the SHA-1 hash value of the string, and returns
15355 it as a 40-digit hexadecimal number, in which any letters are in upper case.
15356 </para>
15357 </listitem></varlistentry>
15358 <varlistentry>
15359 <term><emphasis role="bold">${sha256:</emphasis>&lt;<emphasis>certificate</emphasis>&gt;<emphasis role="bold">}</emphasis></term>
15360 <listitem>
15361 <para>
15362 <indexterm role="concept">
15363 <primary>SHA-256 hash</primary>
15364 </indexterm>
15365 <indexterm role="concept">
15366 <primary>certificate fingerprint</primary>
15367 </indexterm>
15368 <indexterm role="concept">
15369 <primary>expansion</primary>
15370 <secondary>SHA-256 hashing</secondary>
15371 </indexterm>
15372 <indexterm role="concept">
15373 <primary><option>sha256</option> expansion item</primary>
15374 </indexterm>
15375 The <option>sha256</option> operator computes the SHA-256 hash fingerprint of the
15376 certificate,
15377 and returns
15378 it as a 64-digit hexadecimal number, in which any letters are in upper case.
15379 Only arguments which are a single variable of certificate type are supported.
15380 </para>
15381 </listitem></varlistentry>
15382 <varlistentry>
15383 <term><emphasis role="bold">${stat:</emphasis>&lt;<emphasis>string</emphasis>&gt;<emphasis role="bold">}</emphasis></term>
15384 <listitem>
15385 <para>
15386 <indexterm role="concept">
15387 <primary>expansion</primary>
15388 <secondary>statting a file</secondary>
15389 </indexterm>
15390 <indexterm role="concept">
15391 <primary>file</primary>
15392 <secondary>extracting characteristics</secondary>
15393 </indexterm>
15394 <indexterm role="concept">
15395 <primary><option>stat</option> expansion item</primary>
15396 </indexterm>
15397 The string, after expansion, must be a file path. A call to the <function>stat()</function>
15398 function is made for this path. If <function>stat()</function> fails, an error occurs and the
15399 expansion fails. If it succeeds, the data from the stat replaces the item, as a
15400 series of &lt;<emphasis>name</emphasis>&gt;=&lt;<emphasis>value</emphasis>&gt; pairs, where the values are all numerical,
15401 except for the value of <quote>smode</quote>. The names are: <quote>mode</quote> (giving the mode as
15402 a 4-digit octal number), <quote>smode</quote> (giving the mode in symbolic format as a
15403 10-character string, as for the <emphasis>ls</emphasis> command), <quote>inode</quote>, <quote>device</quote>,
15404 <quote>links</quote>, <quote>uid</quote>, <quote>gid</quote>, <quote>size</quote>, <quote>atime</quote>, <quote>mtime</quote>, and <quote>ctime</quote>. You
15405 can extract individual fields using the <option>extract</option> expansion item.
15406 </para>
15407 <para>
15408 The use of the <option>stat</option> expansion in users&#x2019; filter files can be locked out by
15409 the system administrator. <emphasis role="bold">Warning</emphasis>: The file size may be incorrect on 32-bit
15410 systems for files larger than 2GB.
15411 </para>
15412 </listitem></varlistentry>
15413 <varlistentry>
15414 <term><emphasis role="bold">${str2b64:</emphasis>&lt;<emphasis>string</emphasis>&gt;<emphasis role="bold">}</emphasis></term>
15415 <listitem>
15416 <para>
15417 <indexterm role="concept">
15418 <primary>expansion</primary>
15419 <secondary>base64 encoding</secondary>
15420 </indexterm>
15421 <indexterm role="concept">
15422 <primary>base64 encoding</primary>
15423 <secondary>in string expansion</secondary>
15424 </indexterm>
15425 <indexterm role="concept">
15426 <primary><option>str2b64</option> expansion item</primary>
15427 </indexterm>
15428 This operator converts a string into one that is base64 encoded.
15429 </para>
15430 </listitem></varlistentry>
15431 <varlistentry>
15432 <term><emphasis role="bold">${strlen:</emphasis>&lt;<emphasis>string</emphasis>&gt;<emphasis role="bold">}</emphasis></term>
15433 <listitem>
15434 <para>
15435 <indexterm role="concept">
15436 <primary>expansion</primary>
15437 <secondary>string length</secondary>
15438 </indexterm>
15439 <indexterm role="concept">
15440 <primary>string</primary>
15441 <secondary>length in expansion</secondary>
15442 </indexterm>
15443 <indexterm role="concept">
15444 <primary><option>strlen</option> expansion item</primary>
15445 </indexterm>
15446 The item is replace by the length of the expanded string, expressed as a
15447 decimal number. <emphasis role="bold">Note</emphasis>: Do not confuse <option>strlen</option> with <option>length</option>.
15448 </para>
15449 </listitem></varlistentry>
15450 <varlistentry>
15451 <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>
15452 <listitem>
15453 <para>
15454 <indexterm role="concept">
15455 <primary><option>substr</option> expansion item</primary>
15456 </indexterm>
15457 <indexterm role="concept">
15458 <primary>substring extraction</primary>
15459 </indexterm>
15460 <indexterm role="concept">
15461 <primary>expansion</primary>
15462 <secondary>substring expansion</secondary>
15463 </indexterm>
15464 The <option>substr</option> operator is a simpler interface to the <option>substr</option> function that
15465 can be used when the two parameters are fixed numbers (as opposed to strings
15466 that change when expanded). The effect is the same as
15467 </para>
15468 <literallayout class="monospaced">
15469 ${substr{&lt;start&gt;}{&lt;length&gt;}{&lt;string&gt;}}
15470 </literallayout>
15471 <para>
15472 See the description of the general <option>substr</option> item above for details. The
15473 abbreviation <option>s</option> can be used when <option>substr</option> is used as an operator.
15474 </para>
15475 </listitem></varlistentry>
15476 <varlistentry>
15477 <term><emphasis role="bold">${time_eval:</emphasis>&lt;<emphasis>string</emphasis>&gt;<emphasis role="bold">}</emphasis></term>
15478 <listitem>
15479 <para>
15480 <indexterm role="concept">
15481 <primary><option>time_eval</option> expansion item</primary>
15482 </indexterm>
15483 <indexterm role="concept">
15484 <primary>time interval</primary>
15485 <secondary>decoding</secondary>
15486 </indexterm>
15487 This item converts an Exim time interval such as <literal>2d4h5m</literal> into a number of
15488 seconds.
15489 </para>
15490 </listitem></varlistentry>
15491 <varlistentry>
15492 <term><emphasis role="bold">${time_interval:</emphasis>&lt;<emphasis>string</emphasis>&gt;<emphasis role="bold">}</emphasis></term>
15493 <listitem>
15494 <para>
15495 <indexterm role="concept">
15496 <primary><option>time_interval</option> expansion item</primary>
15497 </indexterm>
15498 <indexterm role="concept">
15499 <primary>time interval</primary>
15500 <secondary>formatting</secondary>
15501 </indexterm>
15502 The argument (after sub-expansion) must be a sequence of decimal digits that
15503 represents an interval of time as a number of seconds. It is converted into a
15504 number of larger units and output in Exim&#x2019;s normal time format, for example,
15505 <literal>1w3d4h2m6s</literal>.
15506 </para>
15507 </listitem></varlistentry>
15508 <varlistentry>
15509 <term><emphasis role="bold">${uc:</emphasis>&lt;<emphasis>string</emphasis>&gt;<emphasis role="bold">}</emphasis></term>
15510 <listitem>
15511 <para>
15512 <indexterm role="concept">
15513 <primary>case forcing in strings</primary>
15514 </indexterm>
15515 <indexterm role="concept">
15516 <primary>string</primary>
15517 <secondary>case forcing</secondary>
15518 </indexterm>
15519 <indexterm role="concept">
15520 <primary>upper casing</primary>
15521 </indexterm>
15522 <indexterm role="concept">
15523 <primary>expansion</primary>
15524 <secondary>case forcing</secondary>
15525 </indexterm>
15526 <indexterm role="concept">
15527 <primary><option>uc</option> expansion item</primary>
15528 </indexterm>
15529 This forces the letters in the string into upper-case.
15530 </para>
15531 </listitem></varlistentry>
15532 <varlistentry>
15533 <term><emphasis role="bold">${utf8clean:</emphasis>&lt;<emphasis>string</emphasis>&gt;<emphasis role="bold">}</emphasis></term>
15534 <listitem>
15535 <para>
15536 <indexterm role="concept">
15537 <primary>correction of invalid utf-8 sequences in strings</primary>
15538 </indexterm>
15539 <indexterm role="concept">
15540 <primary>utf-8</primary>
15541 <secondary>utf-8 sequences</secondary>
15542 </indexterm>
15543 <indexterm role="concept">
15544 <primary>incorrect utf-8</primary>
15545 </indexterm>
15546 <indexterm role="concept">
15547 <primary>expansion</primary>
15548 <secondary>utf-8 forcing</secondary>
15549 </indexterm>
15550 <indexterm role="concept">
15551 <primary><option>utf8clean</option> expansion item</primary>
15552 </indexterm>
15553 This replaces any invalid utf-8 sequence in the string by the character <literal>?</literal>.
15554 </para>
15555 </listitem></varlistentry>
15556 </variablelist>
15557 </section>
15558 <section id="SECTexpcond">
15559 <title>Expansion conditions</title>
15560 <para>
15561 <indexterm role="concept" id="IIDexpcond" class="startofrange">
15562 <primary>expansion</primary>
15563 <secondary>conditions</secondary>
15564 </indexterm>
15565 The following conditions are available for testing by the <option>${if</option> construct
15566 while expanding strings:
15567 </para>
15568 <variablelist>
15569 <varlistentry>
15570 <term><emphasis role="bold">!</emphasis>&lt;<emphasis>condition</emphasis>&gt;</term>
15571 <listitem>
15572 <para>
15573 <indexterm role="concept">
15574 <primary>expansion</primary>
15575 <secondary>negating a condition</secondary>
15576 </indexterm>
15577 <indexterm role="concept">
15578 <primary>negation</primary>
15579 <secondary>in expansion condition</secondary>
15580 </indexterm>
15581 Preceding any condition with an exclamation mark negates the result of the
15582 condition.
15583 </para>
15584 </listitem></varlistentry>
15585 <varlistentry>
15586 <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>
15587 <listitem>
15588 <para>
15589 <indexterm role="concept">
15590 <primary>numeric comparison</primary>
15591 </indexterm>
15592 <indexterm role="concept">
15593 <primary>expansion</primary>
15594 <secondary>numeric comparison</secondary>
15595 </indexterm>
15596 There are a number of symbolic operators for doing numeric comparisons. They
15597 are:
15598 </para>
15599 <literallayout>
15600 <literal>=   </literal>   equal
15601 <literal>==  </literal>   equal
15602 <literal>&gt;   </literal>   greater
15603 <literal>&gt;=  </literal>   greater or equal
15604 <literal>&lt;   </literal>   less
15605 <literal>&lt;=  </literal>   less or equal
15606 </literallayout>
15607 <para>
15608 For example:
15609 </para>
15610 <literallayout class="monospaced">
15611 ${if &gt;{$message_size}{10M} ...
15612 </literallayout>
15613 <para>
15614 Note that the general negation operator provides for inequality testing. The
15615 two strings must take the form of optionally signed decimal integers,
15616 optionally followed by one of the letters <quote>K</quote>, <quote>M</quote> or <quote>G</quote> (in either upper or
15617 lower case), signifying multiplication by 1024, 1024*1024 or 1024*1024*1024, respectively.
15618 As a special case, the numerical value of an empty string is taken as
15619 zero.
15620 </para>
15621 <para>
15622 In all cases, a relative comparator OP is testing if &lt;<emphasis>string1</emphasis>&gt; OP
15623 &lt;<emphasis>string2</emphasis>&gt;; the above example is checking if <varname>$message_size</varname> is larger than
15624 10M, not if 10M is larger than <varname>$message_size</varname>.
15625 </para>
15626 </listitem></varlistentry>
15627 <varlistentry>
15628 <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>
15629 <listitem>
15630 <para>
15631 <indexterm role="concept">
15632 <primary>expansion</primary>
15633 <secondary>calling an acl</secondary>
15634 </indexterm>
15635 <indexterm role="concept">
15636 <primary><option>acl</option></primary>
15637 <secondary>expansion condition</secondary>
15638 </indexterm>
15639 The name and zero to nine argument strings are first expanded separately.  The expanded
15640 arguments are assigned to the variables <varname>$acl_arg1</varname> to <varname>$acl_arg9</varname> in order.
15641 Any unused are made empty.  The variable <varname>$acl_narg</varname> is set to the number of
15642 arguments.  The named ACL (see chapter <xref linkend="CHAPACL"/>) is called
15643 and may use the variables; if another acl expansion is used the values
15644 are restored after it returns.  If the ACL sets
15645 a value using a "message =" modifier the variable $value becomes
15646 the result of the expansion, otherwise it is empty.
15647 If the ACL returns accept the condition is true; if deny, false.
15648 If the ACL returns defer the result is a forced-fail.
15649 </para>
15650 </listitem></varlistentry>
15651 <varlistentry>
15652 <term><emphasis role="bold">bool&nbsp;{</emphasis>&lt;<emphasis>string</emphasis>&gt;<emphasis role="bold">}</emphasis></term>
15653 <listitem>
15654 <para>
15655 <indexterm role="concept">
15656 <primary>expansion</primary>
15657 <secondary>boolean parsing</secondary>
15658 </indexterm>
15659 <indexterm role="concept">
15660 <primary><option>bool</option> expansion condition</primary>
15661 </indexterm>
15662 This condition turns a string holding a true or false representation into
15663 a boolean state.  It parses <quote>true</quote>, <quote>false</quote>, <quote>yes</quote> and <quote>no</quote>
15664 (case-insensitively); also integer numbers map to true if non-zero,
15665 false if zero.
15666 An empty string is treated as false.
15667 Leading and trailing whitespace is ignored;
15668 thus a string consisting only of whitespace is false.
15669 All other string values will result in expansion failure.
15670 </para>
15671 <para>
15672 When combined with ACL variables, this expansion condition will let you
15673 make decisions in one place and act on those decisions in another place.
15674 For example:
15675 </para>
15676 <literallayout class="monospaced">
15677 ${if bool{$acl_m_privileged_sender} ...
15678 </literallayout>
15679 </listitem></varlistentry>
15680 <varlistentry>
15681 <term><emphasis role="bold">bool_lax&nbsp;{</emphasis>&lt;<emphasis>string</emphasis>&gt;<emphasis role="bold">}</emphasis></term>
15682 <listitem>
15683 <para>
15684 <indexterm role="concept">
15685 <primary>expansion</primary>
15686 <secondary>boolean parsing</secondary>
15687 </indexterm>
15688 <indexterm role="concept">
15689 <primary><option>bool_lax</option> expansion condition</primary>
15690 </indexterm>
15691 Like <option>bool</option>, this condition turns a string into a boolean state.  But
15692 where <option>bool</option> accepts a strict set of strings, <option>bool_lax</option> uses the same
15693 loose definition that the Router <option>condition</option> option uses.  The empty string
15694 and the values <quote>false</quote>, <quote>no</quote> and <quote>0</quote> map to false, all others map to
15695 true.  Leading and trailing whitespace is ignored.
15696 </para>
15697 <para>
15698 Note that where <quote>bool{00}</quote> is false, <quote>bool_lax{00}</quote> is true.
15699 </para>
15700 </listitem></varlistentry>
15701 <varlistentry>
15702 <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>
15703 <listitem>
15704 <para>
15705 <indexterm role="concept">
15706 <primary>expansion</primary>
15707 <secondary>encrypted comparison</secondary>
15708 </indexterm>
15709 <indexterm role="concept">
15710 <primary>encrypted strings, comparing</primary>
15711 </indexterm>
15712 <indexterm role="concept">
15713 <primary><option>crypteq</option> expansion condition</primary>
15714 </indexterm>
15715 This condition is included in the Exim binary if it is built to support any
15716 authentication mechanisms (see chapter <xref linkend="CHAPSMTPAUTH"/>). Otherwise, it is
15717 necessary to define SUPPORT_CRYPTEQ in <filename>Local/Makefile</filename> to get <option>crypteq</option>
15718 included in the binary.
15719 </para>
15720 <para>
15721 The <option>crypteq</option> condition has two arguments. The first is encrypted and
15722 compared against the second, which is already encrypted. The second string may
15723 be in the LDAP form for storing encrypted strings, which starts with the
15724 encryption type in curly brackets, followed by the data. If the second string
15725 does not begin with <quote>{</quote> it is assumed to be encrypted with <function>crypt()</function> or
15726 <function>crypt16()</function> (see below), since such strings cannot begin with <quote>{</quote>.
15727 Typically this will be a field from a password file. An example of an encrypted
15728 string in LDAP form is:
15729 </para>
15730 <literallayout class="monospaced">
15731 {md5}CY9rzUYh03PK3k6DJie09g==
15732 </literallayout>
15733 <para>
15734 If such a string appears directly in an expansion, the curly brackets have to
15735 be quoted, because they are part of the expansion syntax. For example:
15736 </para>
15737 <literallayout class="monospaced">
15738 ${if crypteq {test}{\{md5\}CY9rzUYh03PK3k6DJie09g==}{yes}{no}}
15739 </literallayout>
15740 <para>
15741 The following encryption types (whose names are matched case-independently) are
15742 supported:
15743 </para>
15744 <itemizedlist>
15745 <listitem>
15746 <para>
15747 <indexterm role="concept">
15748 <primary>MD5 hash</primary>
15749 </indexterm>
15750 <indexterm role="concept">
15751 <primary>base64 encoding</primary>
15752 <secondary>in encrypted password</secondary>
15753 </indexterm>
15754 <option>{md5}</option> computes the MD5 digest of the first string, and expresses this as
15755 printable characters to compare with the remainder of the second string. If the
15756 length of the comparison string is 24, Exim assumes that it is base64 encoded
15757 (as in the above example). If the length is 32, Exim assumes that it is a
15758 hexadecimal encoding of the MD5 digest. If the length not 24 or 32, the
15759 comparison fails.
15760 </para>
15761 </listitem>
15762 <listitem>
15763 <para>
15764 <indexterm role="concept">
15765 <primary>SHA-1 hash</primary>
15766 </indexterm>
15767 <option>{sha1}</option> computes the SHA-1 digest of the first string, and expresses this as
15768 printable characters to compare with the remainder of the second string. If the
15769 length of the comparison string is 28, Exim assumes that it is base64 encoded.
15770 If the length is 40, Exim assumes that it is a hexadecimal encoding of the
15771 SHA-1 digest. If the length is not 28 or 40, the comparison fails.
15772 </para>
15773 </listitem>
15774 <listitem>
15775 <para>
15776 <indexterm role="concept">
15777 <primary><function>crypt()</function></primary>
15778 </indexterm>
15779 <option>{crypt}</option> calls the <function>crypt()</function> function, which traditionally used to use
15780 only the first eight characters of the password. However, in modern operating
15781 systems this is no longer true, and in many cases the entire password is used,
15782 whatever its length.
15783 </para>
15784 </listitem>
15785 <listitem>
15786 <para>
15787 <indexterm role="concept">
15788 <primary><function>crypt16()</function></primary>
15789 </indexterm>
15790 <option>{crypt16}</option> calls the <function>crypt16()</function> function, which was originally created to
15791 use up to 16 characters of the password in some operating systems. Again, in
15792 modern operating systems, more characters may be used.
15793 </para>
15794 </listitem>
15795 </itemizedlist>
15796 <para>
15797 Exim has its own version of <function>crypt16()</function>, which is just a double call to
15798 <function>crypt()</function>. For operating systems that have their own version, setting
15799 HAVE_CRYPT16 in <filename>Local/Makefile</filename> when building Exim causes it to use the
15800 operating system version instead of its own. This option is set by default in
15801 the OS-dependent <filename>Makefile</filename> for those operating systems that are known to
15802 support <function>crypt16()</function>.
15803 </para>
15804 <para>
15805 Some years after Exim&#x2019;s <function>crypt16()</function> was implemented, a user discovered that
15806 it was not using the same algorithm as some operating systems&#x2019; versions. It
15807 turns out that as well as <function>crypt16()</function> there is a function called
15808 <function>bigcrypt()</function> in some operating systems. This may or may not use the same
15809 algorithm, and both of them may be different to Exim&#x2019;s built-in <function>crypt16()</function>.
15810 </para>
15811 <para>
15812 However, since there is now a move away from the traditional <function>crypt()</function>
15813 functions towards using SHA1 and other algorithms, tidying up this area of
15814 Exim is seen as very low priority.
15815 </para>
15816 <para>
15817 If you do not put a encryption type (in curly brackets) in a <option>crypteq</option>
15818 comparison, the default is usually either <literal>{crypt}</literal> or <literal>{crypt16}</literal>, as
15819 determined by the setting of DEFAULT_CRYPT in <filename>Local/Makefile</filename>. The default
15820 default is <literal>{crypt}</literal>. Whatever the default, you can always use either
15821 function by specifying it explicitly in curly brackets.
15822 </para>
15823 </listitem></varlistentry>
15824 <varlistentry>
15825 <term><emphasis role="bold">def:</emphasis>&lt;<emphasis>variable&nbsp;name</emphasis>&gt;</term>
15826 <listitem>
15827 <para>
15828 <indexterm role="concept">
15829 <primary>expansion</primary>
15830 <secondary>checking for empty variable</secondary>
15831 </indexterm>
15832 <indexterm role="concept">
15833 <primary><option>def</option> expansion condition</primary>
15834 </indexterm>
15835 The <option>def</option> condition must be followed by the name of one of the expansion
15836 variables defined in section <xref linkend="SECTexpvar"/>. The condition is true if the
15837 variable does not contain the empty string. For example:
15838 </para>
15839 <literallayout class="monospaced">
15840 ${if def:sender_ident {from $sender_ident}}
15841 </literallayout>
15842 <para>
15843 Note that the variable name is given without a leading <option>$</option> character. If the
15844 variable does not exist, the expansion fails.
15845 </para>
15846 </listitem></varlistentry>
15847 <varlistentry>
15848 <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>
15849 <listitem>
15850 <para>
15851 <indexterm role="concept">
15852 <primary>expansion</primary>
15853 <secondary>checking header line existence</secondary>
15854 </indexterm>
15855 This condition is true if a message is being processed and the named header
15856 exists in the message. For example,
15857 </para>
15858 <literallayout class="monospaced">
15859 ${if def:header_reply-to:{$h_reply-to:}{$h_from:}}
15860 </literallayout>
15861 <para>
15862 <emphasis role="bold">Note</emphasis>: No <option>$</option> appears before <option>header_</option> or <option>h_</option> in the condition, and
15863 the header name must be terminated by a colon if white space does not follow.
15864 </para>
15865 </listitem></varlistentry>
15866 <varlistentry>
15867 <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>
15868 <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>
15869 <listitem>
15870 <para>
15871 <indexterm role="concept">
15872 <primary>string</primary>
15873 <secondary>comparison</secondary>
15874 </indexterm>
15875 <indexterm role="concept">
15876 <primary>expansion</primary>
15877 <secondary>string comparison</secondary>
15878 </indexterm>
15879 <indexterm role="concept">
15880 <primary><option>eq</option> expansion condition</primary>
15881 </indexterm>
15882 <indexterm role="concept">
15883 <primary><option>eqi</option> expansion condition</primary>
15884 </indexterm>
15885 The two substrings are first expanded. The condition is true if the two
15886 resulting strings are identical. For <option>eq</option> the comparison includes the case of
15887 letters, whereas for <option>eqi</option> the comparison is case-independent.
15888 </para>
15889 </listitem></varlistentry>
15890 <varlistentry>
15891 <term><emphasis role="bold">exists&nbsp;{</emphasis>&lt;<emphasis>file&nbsp;name</emphasis>&gt;<emphasis role="bold">}</emphasis></term>
15892 <listitem>
15893 <para>
15894 <indexterm role="concept">
15895 <primary>expansion</primary>
15896 <secondary>file existence test</secondary>
15897 </indexterm>
15898 <indexterm role="concept">
15899 <primary>file</primary>
15900 <secondary>existence test</secondary>
15901 </indexterm>
15902 <indexterm role="concept">
15903 <primary><option>exists</option>, expansion condition</primary>
15904 </indexterm>
15905 The substring is first expanded and then interpreted as an absolute path. The
15906 condition is true if the named file (or directory) exists. The existence test
15907 is done by calling the <function>stat()</function> function. The use of the <option>exists</option> test in
15908 users&#x2019; filter files may be locked out by the system administrator.
15909 </para>
15910 </listitem></varlistentry>
15911 <varlistentry>
15912 <term><emphasis role="bold">first_delivery</emphasis></term>
15913 <listitem>
15914 <para>
15915 <indexterm role="concept">
15916 <primary>delivery</primary>
15917 <secondary>first</secondary>
15918 </indexterm>
15919 <indexterm role="concept">
15920 <primary>first delivery</primary>
15921 </indexterm>
15922 <indexterm role="concept">
15923 <primary>expansion</primary>
15924 <secondary>first delivery test</secondary>
15925 </indexterm>
15926 <indexterm role="concept">
15927 <primary><option>first_delivery</option> expansion condition</primary>
15928 </indexterm>
15929 This condition, which has no data, is true during a message&#x2019;s first delivery
15930 attempt. It is false during any subsequent delivery attempts.
15931 </para>
15932 </listitem></varlistentry>
15933 <varlistentry>
15934 <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>
15935 <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>
15936 <listitem>
15937 <para>
15938 <indexterm role="concept">
15939 <primary>list</primary>
15940 <secondary>iterative conditions</secondary>
15941 </indexterm>
15942 <indexterm role="concept">
15943 <primary>expansion</primary>
15944 <secondary><emphasis role="bold">forall</emphasis> condition</secondary>
15945 </indexterm>
15946 <indexterm role="concept">
15947 <primary>expansion</primary>
15948 <secondary><emphasis role="bold">forany</emphasis> condition</secondary>
15949 </indexterm>
15950 <indexterm role="variable">
15951 <primary><varname>$item</varname></primary>
15952 </indexterm>
15953 These conditions iterate over a list. The first argument is expanded to form
15954 the list. By default, the list separator is a colon, but it can be changed by
15955 the normal method. The second argument is interpreted as a condition that is to
15956 be applied to each item in the list in turn. During the interpretation of the
15957 condition, the current list item is placed in a variable called <varname>$item</varname>.
15958 </para>
15959 <itemizedlist>
15960 <listitem>
15961 <para>
15962 For <emphasis role="bold">forany</emphasis>, interpretation stops if the condition is true for any item, and
15963 the result of the whole condition is true. If the condition is false for all
15964 items in the list, the overall condition is false.
15965 </para>
15966 </listitem>
15967 <listitem>
15968 <para>
15969 For <emphasis role="bold">forall</emphasis>, interpretation stops if the condition is false for any item,
15970 and the result of the whole condition is false. If the condition is true for
15971 all items in the list, the overall condition is true.
15972 </para>
15973 </listitem>
15974 </itemizedlist>
15975 <para>
15976 Note that negation of <emphasis role="bold">forany</emphasis> means that the condition must be false for all
15977 items for the overall condition to succeed, and negation of <emphasis role="bold">forall</emphasis> means
15978 that the condition must be false for at least one item. In this example, the
15979 list separator is changed to a comma:
15980 </para>
15981 <literallayout class="monospaced">
15982 ${if forany{&lt;, $recipients}{match{$item}{^user3@}}{yes}{no}}
15983 </literallayout>
15984 <para>
15985 The value of <varname>$item</varname> is saved and restored while <emphasis role="bold">forany</emphasis> or <emphasis role="bold">forall</emphasis> is
15986 being processed, to enable these expansion items to be nested.
15987 </para>
15988 <para>
15989 To scan a named list, expand it with the <emphasis role="bold">listnamed</emphasis> operator.
15990 </para>
15991 </listitem></varlistentry>
15992 <varlistentry>
15993 <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>
15994 <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>
15995 <listitem>
15996 <para>
15997 <indexterm role="concept">
15998 <primary>string</primary>
15999 <secondary>comparison</secondary>
16000 </indexterm>
16001 <indexterm role="concept">
16002 <primary>expansion</primary>
16003 <secondary>string comparison</secondary>
16004 </indexterm>
16005 <indexterm role="concept">
16006 <primary><option>ge</option> expansion condition</primary>
16007 </indexterm>
16008 <indexterm role="concept">
16009 <primary><option>gei</option> expansion condition</primary>
16010 </indexterm>
16011 The two substrings are first expanded. The condition is true if the first
16012 string is lexically greater than or equal to the second string. For <option>ge</option> the
16013 comparison includes the case of letters, whereas for <option>gei</option> the comparison is
16014 case-independent.
16015 </para>
16016 </listitem></varlistentry>
16017 <varlistentry>
16018 <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>
16019 <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>
16020 <listitem>
16021 <para>
16022 <indexterm role="concept">
16023 <primary>string</primary>
16024 <secondary>comparison</secondary>
16025 </indexterm>
16026 <indexterm role="concept">
16027 <primary>expansion</primary>
16028 <secondary>string comparison</secondary>
16029 </indexterm>
16030 <indexterm role="concept">
16031 <primary><option>gt</option> expansion condition</primary>
16032 </indexterm>
16033 <indexterm role="concept">
16034 <primary><option>gti</option> expansion condition</primary>
16035 </indexterm>
16036 The two substrings are first expanded. The condition is true if the first
16037 string is lexically greater than the second string. For <option>gt</option> the comparison
16038 includes the case of letters, whereas for <option>gti</option> the comparison is
16039 case-independent.
16040 </para>
16041 </listitem></varlistentry>
16042 <varlistentry>
16043 <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>
16044 <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>
16045 <listitem>
16046 <para>
16047 <indexterm role="concept">
16048 <primary>string</primary>
16049 <secondary>comparison</secondary>
16050 </indexterm>
16051 <indexterm role="concept">
16052 <primary>list</primary>
16053 <secondary>iterative conditions</secondary>
16054 </indexterm>
16055 Both strings are expanded; the second string is treated as a list of simple
16056 strings; if the first string is a member of the second, then the condition
16057 is true.
16058 </para>
16059 <para>
16060 These are simpler to use versions of the more powerful <emphasis role="bold">forany</emphasis> condition.
16061 Examples, and the <emphasis role="bold">forany</emphasis> equivalents:
16062 </para>
16063 <literallayout class="monospaced">
16064 ${if inlist{needle}{foo:needle:bar}}
16065   ${if forany{foo:needle:bar}{eq{$item}{needle}}}
16066 ${if inlisti{Needle}{fOo:NeeDLE:bAr}}
16067   ${if forany{fOo:NeeDLE:bAr}{eqi{$item}{Needle}}}
16068 </literallayout>
16069 </listitem></varlistentry>
16070 <varlistentry>
16071 <term><emphasis role="bold">isip&nbsp;{</emphasis>&lt;<emphasis>string</emphasis>&gt;<emphasis role="bold">}</emphasis></term>
16072 <term><emphasis role="bold">isip4&nbsp;{</emphasis>&lt;<emphasis>string</emphasis>&gt;<emphasis role="bold">}</emphasis></term>
16073 <term><emphasis role="bold">isip6&nbsp;{</emphasis>&lt;<emphasis>string</emphasis>&gt;<emphasis role="bold">}</emphasis></term>
16074 <listitem>
16075 <para>
16076 <indexterm role="concept">
16077 <primary>IP address</primary>
16078 <secondary>testing string format</secondary>
16079 </indexterm>
16080 <indexterm role="concept">
16081 <primary>string</primary>
16082 <secondary>testing for IP address</secondary>
16083 </indexterm>
16084 <indexterm role="concept">
16085 <primary><option>isip</option> expansion condition</primary>
16086 </indexterm>
16087 <indexterm role="concept">
16088 <primary><option>isip4</option> expansion condition</primary>
16089 </indexterm>
16090 <indexterm role="concept">
16091 <primary><option>isip6</option> expansion condition</primary>
16092 </indexterm>
16093 The substring is first expanded, and then tested to see if it has the form of
16094 an IP address. Both IPv4 and IPv6 addresses are valid for <option>isip</option>, whereas
16095 <option>isip4</option> and <option>isip6</option> test specifically for IPv4 or IPv6 addresses.
16096 </para>
16097 <para>
16098 For an IPv4 address, the test is for four dot-separated components, each of
16099 which consists of from one to three digits. For an IPv6 address, up to eight
16100 colon-separated components are permitted, each containing from one to four
16101 hexadecimal digits. There may be fewer than eight components if an empty
16102 component (adjacent colons) is present. Only one empty component is permitted.
16103 </para>
16104 <para>
16105 <emphasis role="bold">Note</emphasis>: The checks are just on the form of the address; actual numerical
16106 values are not considered. Thus, for example, 999.999.999.999 passes the IPv4
16107 check. The main use of these tests is to distinguish between IP addresses and
16108 host names, or between IPv4 and IPv6 addresses. For example, you could use
16109 </para>
16110 <literallayout class="monospaced">
16111 ${if isip4{$sender_host_address}...
16112 </literallayout>
16113 <para>
16114 to test which IP version an incoming SMTP connection is using.
16115 </para>
16116 </listitem></varlistentry>
16117 <varlistentry>
16118 <term><emphasis role="bold">ldapauth&nbsp;{</emphasis>&lt;<emphasis>ldap&nbsp;query</emphasis>&gt;<emphasis role="bold">}</emphasis></term>
16119 <listitem>
16120 <para>
16121 <indexterm role="concept">
16122 <primary>LDAP</primary>
16123 <secondary>use for authentication</secondary>
16124 </indexterm>
16125 <indexterm role="concept">
16126 <primary>expansion</primary>
16127 <secondary>LDAP authentication test</secondary>
16128 </indexterm>
16129 <indexterm role="concept">
16130 <primary><option>ldapauth</option> expansion condition</primary>
16131 </indexterm>
16132 This condition supports user authentication using LDAP. See section
16133 <xref linkend="SECTldap"/> for details of how to use LDAP in lookups and the syntax of
16134 queries. For this use, the query must contain a user name and password. The
16135 query itself is not used, and can be empty. The condition is true if the
16136 password is not empty, and the user name and password are accepted by the LDAP
16137 server. An empty password is rejected without calling LDAP because LDAP binds
16138 with an empty password are considered anonymous regardless of the username, and
16139 will succeed in most configurations. See chapter <xref linkend="CHAPSMTPAUTH"/> for details
16140 of SMTP authentication, and chapter <xref linkend="CHAPplaintext"/> for an example of how
16141 this can be used.
16142 </para>
16143 </listitem></varlistentry>
16144 <varlistentry>
16145 <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>
16146 <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>
16147 <listitem>
16148 <para>
16149 <indexterm role="concept">
16150 <primary>string</primary>
16151 <secondary>comparison</secondary>
16152 </indexterm>
16153 <indexterm role="concept">
16154 <primary>expansion</primary>
16155 <secondary>string comparison</secondary>
16156 </indexterm>
16157 <indexterm role="concept">
16158 <primary><option>le</option> expansion condition</primary>
16159 </indexterm>
16160 <indexterm role="concept">
16161 <primary><option>lei</option> expansion condition</primary>
16162 </indexterm>
16163 The two substrings are first expanded. The condition is true if the first
16164 string is lexically less than or equal to the second string. For <option>le</option> the
16165 comparison includes the case of letters, whereas for <option>lei</option> the comparison is
16166 case-independent.
16167 </para>
16168 </listitem></varlistentry>
16169 <varlistentry>
16170 <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>
16171 <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>
16172 <listitem>
16173 <para>
16174 <indexterm role="concept">
16175 <primary>string</primary>
16176 <secondary>comparison</secondary>
16177 </indexterm>
16178 <indexterm role="concept">
16179 <primary>expansion</primary>
16180 <secondary>string comparison</secondary>
16181 </indexterm>
16182 <indexterm role="concept">
16183 <primary><option>lt</option> expansion condition</primary>
16184 </indexterm>
16185 <indexterm role="concept">
16186 <primary><option>lti</option> expansion condition</primary>
16187 </indexterm>
16188 The two substrings are first expanded. The condition is true if the first
16189 string is lexically less than the second string. For <option>lt</option> the comparison
16190 includes the case of letters, whereas for <option>lti</option> the comparison is
16191 case-independent.
16192 </para>
16193 </listitem></varlistentry>
16194 <varlistentry>
16195 <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>
16196 <listitem>
16197 <para>
16198 <indexterm role="concept">
16199 <primary>expansion</primary>
16200 <secondary>regular expression comparison</secondary>
16201 </indexterm>
16202 <indexterm role="concept">
16203 <primary>regular expressions</primary>
16204 <secondary>match in expanded string</secondary>
16205 </indexterm>
16206 <indexterm role="concept">
16207 <primary><option>match</option> expansion condition</primary>
16208 </indexterm>
16209 The two substrings are first expanded. The second is then treated as a regular
16210 expression and applied to the first. Because of the pre-expansion, if the
16211 regular expression contains dollar, or backslash characters, they must be
16212 escaped. Care must also be taken if the regular expression contains braces
16213 (curly brackets). A closing brace must be escaped so that it is not taken as a
16214 premature termination of &lt;<emphasis>string2</emphasis>&gt;. The easiest approach is to use the
16215 <literal>\N</literal> feature to disable expansion of the regular expression.
16216 For example,
16217 </para>
16218 <literallayout class="monospaced">
16219 ${if match {$local_part}{\N^\d{3}\N} ...
16220 </literallayout>
16221 <para>
16222 If the whole expansion string is in double quotes, further escaping of
16223 backslashes is also required.
16224 </para>
16225 <para>
16226 The condition is true if the regular expression match succeeds.
16227 The regular expression is not required to begin with a circumflex
16228 metacharacter, but if there is no circumflex, the expression is not anchored,
16229 and it may match anywhere in the subject, not just at the start. If you want
16230 the pattern to match at the end of the subject, you must include the <literal>$</literal>
16231 metacharacter at an appropriate point.
16232 </para>
16233 <para>
16234 <indexterm role="concept">
16235 <primary>numerical variables (<varname>$1</varname> <varname>$2</varname> etc)</primary>
16236 <secondary>in <option>if</option> expansion</secondary>
16237 </indexterm>
16238 At the start of an <option>if</option> expansion the values of the numeric variable
16239 substitutions <varname>$1</varname> etc. are remembered. Obeying a <option>match</option> condition that
16240 succeeds causes them to be reset to the substrings of that condition and they
16241 will have these values during the expansion of the success string. At the end
16242 of the <option>if</option> expansion, the previous values are restored. After testing a
16243 combination of conditions using <option>or</option>, the subsequent values of the numeric
16244 variables are those of the condition that succeeded.
16245 </para>
16246 </listitem></varlistentry>
16247 <varlistentry>
16248 <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>
16249 <listitem>
16250 <para>
16251 <indexterm role="concept">
16252 <primary><option>match_address</option> expansion condition</primary>
16253 </indexterm>
16254 See <emphasis role="bold">match_local_part</emphasis>.
16255 </para>
16256 </listitem></varlistentry>
16257 <varlistentry>
16258 <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>
16259 <listitem>
16260 <para>
16261 <indexterm role="concept">
16262 <primary><option>match_domain</option> expansion condition</primary>
16263 </indexterm>
16264 See <emphasis role="bold">match_local_part</emphasis>.
16265 </para>
16266 </listitem></varlistentry>
16267 <varlistentry>
16268 <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>
16269 <listitem>
16270 <para>
16271 <indexterm role="concept">
16272 <primary><option>match_ip</option> expansion condition</primary>
16273 </indexterm>
16274 This condition matches an IP address to a list of IP address patterns. It must
16275 be followed by two argument strings. The first (after expansion) must be an IP
16276 address or an empty string. The second (not expanded) is a restricted host
16277 list that can match only an IP address, not a host name. For example:
16278 </para>
16279 <literallayout class="monospaced">
16280 ${if match_ip{$sender_host_address}{1.2.3.4:5.6.7.8}{...}{...}}
16281 </literallayout>
16282 <para>
16283 The specific types of host list item that are permitted in the list are:
16284 </para>
16285 <itemizedlist>
16286 <listitem>
16287 <para>
16288 An IP address, optionally with a CIDR mask.
16289 </para>
16290 </listitem>
16291 <listitem>
16292 <para>
16293 A single asterisk, which matches any IP address.
16294 </para>
16295 </listitem>
16296 <listitem>
16297 <para>
16298 An empty item, which matches only if the IP address is empty. This could be
16299 useful for testing for a locally submitted message or one from specific hosts
16300 in a single test such as
16301 </para>
16302 <literallayout class="monospaced">
16303   ${if match_ip{$sender_host_address}{:4.3.2.1:...}{...}{...}}
16304 </literallayout>
16305 <para>
16306 where the first item in the list is the empty string.
16307 </para>
16308 </listitem>
16309 <listitem>
16310 <para>
16311 The item @[] matches any of the local host&#x2019;s interface addresses.
16312 </para>
16313 </listitem>
16314 <listitem>
16315 <para>
16316 Single-key lookups are assumed to be like <quote>net-</quote> style lookups in host lists,
16317 even if <literal>net-</literal> is not specified. There is never any attempt to turn the IP
16318 address into a host name. The most common type of linear search for
16319 <emphasis role="bold">match_ip</emphasis> is likely to be <emphasis role="bold">iplsearch</emphasis>, in which the file can contain CIDR
16320 masks. For example:
16321 </para>
16322 <literallayout class="monospaced">
16323   ${if match_ip{$sender_host_address}{iplsearch;/some/file}...
16324 </literallayout>
16325 <para>
16326 It is of course possible to use other kinds of lookup, and in such a case, you
16327 do need to specify the <literal>net-</literal> prefix if you want to specify a specific
16328 address mask, for example:
16329 </para>
16330 <literallayout class="monospaced">
16331   ${if match_ip{$sender_host_address}{net24-dbm;/some/file}...
16332 </literallayout>
16333 <para>
16334 However, unless you are combining a <option>match_ip</option> condition with others, it is
16335 just as easy to use the fact that a lookup is itself a condition, and write:
16336 </para>
16337 <literallayout class="monospaced">
16338   ${lookup{${mask:$sender_host_address/24}}dbm{/a/file}...
16339 </literallayout>
16340 </listitem>
16341 </itemizedlist>
16342 <para>
16343 Note that &lt;<emphasis>string2</emphasis>&gt; is not itself subject to string expansion, unless
16344 Exim was built with the EXPAND_LISTMATCH_RHS option.
16345 </para>
16346 <para>
16347 Consult section <xref linkend="SECThoslispatip"/> for further details of these patterns.
16348 </para>
16349 </listitem></varlistentry>
16350 <varlistentry>
16351 <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>
16352 <listitem>
16353 <para>
16354 <indexterm role="concept">
16355 <primary>domain list</primary>
16356 <secondary>in expansion condition</secondary>
16357 </indexterm>
16358 <indexterm role="concept">
16359 <primary>address list</primary>
16360 <secondary>in expansion condition</secondary>
16361 </indexterm>
16362 <indexterm role="concept">
16363 <primary>local part</primary>
16364 <secondary>list, in expansion condition</secondary>
16365 </indexterm>
16366 <indexterm role="concept">
16367 <primary><option>match_local_part</option> expansion condition</primary>
16368 </indexterm>
16369 This condition, together with <option>match_address</option> and <option>match_domain</option>, make it
16370 possible to test domain, address, and local part lists within expansions. Each
16371 condition requires two arguments: an item and a list to match. A trivial
16372 example is:
16373 </para>
16374 <literallayout class="monospaced">
16375 ${if match_domain{a.b.c}{x.y.z:a.b.c:p.q.r}{yes}{no}}
16376 </literallayout>
16377 <para>
16378 In each case, the second argument may contain any of the allowable items for a
16379 list of the appropriate type. Also, because the second argument (after
16380 expansion) is a standard form of list, it is possible to refer to a named list.
16381 Thus, you can use conditions like this:
16382 </para>
16383 <literallayout class="monospaced">
16384 ${if match_domain{$domain}{+local_domains}{...
16385 </literallayout>
16386 <para>
16387 <indexterm role="concept">
16388 <primary><literal>+caseful</literal></primary>
16389 </indexterm>
16390 For address lists, the matching starts off caselessly, but the <literal>+caseful</literal>
16391 item can be used, as in all address lists, to cause subsequent items to
16392 have their local parts matched casefully. Domains are always matched
16393 caselessly.
16394 </para>
16395 <para>
16396 Note that &lt;<emphasis>string2</emphasis>&gt; is not itself subject to string expansion, unless
16397 Exim was built with the EXPAND_LISTMATCH_RHS option.
16398 </para>
16399 <para>
16400 <emphasis role="bold">Note</emphasis>: Host lists are <emphasis>not</emphasis> supported in this way. This is because
16401 hosts have two identities: a name and an IP address, and it is not clear
16402 how to specify cleanly how such a test would work. However, IP addresses can be
16403 matched using <option>match_ip</option>.
16404 </para>
16405 </listitem></varlistentry>
16406 <varlistentry>
16407 <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>
16408 <listitem>
16409 <para>
16410 <indexterm role="concept">
16411 <primary>PAM authentication</primary>
16412 </indexterm>
16413 <indexterm role="concept">
16414 <primary>AUTH</primary>
16415 <secondary>with PAM</secondary>
16416 </indexterm>
16417 <indexterm role="concept">
16418 <primary>Solaris</primary>
16419 <secondary>PAM support</secondary>
16420 </indexterm>
16421 <indexterm role="concept">
16422 <primary>expansion</primary>
16423 <secondary>PAM authentication test</secondary>
16424 </indexterm>
16425 <indexterm role="concept">
16426 <primary><option>pam</option> expansion condition</primary>
16427 </indexterm>
16428 <emphasis>Pluggable Authentication Modules</emphasis>
16429 (<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
16430 available in the latest releases of Solaris and in some GNU/Linux
16431 distributions. The Exim support, which is intended for use in conjunction with
16432 the SMTP AUTH command, is available only if Exim is compiled with
16433 </para>
16434 <literallayout class="monospaced">
16435 SUPPORT_PAM=yes
16436 </literallayout>
16437 <para>
16438 in <filename>Local/Makefile</filename>. You probably need to add <option>-lpam</option> to EXTRALIBS, and
16439 in some releases of GNU/Linux <option>-ldl</option> is also needed.
16440 </para>
16441 <para>
16442 The argument string is first expanded, and the result must be a
16443 colon-separated list of strings. Leading and trailing white space is ignored.
16444 The PAM module is initialized with the service name <quote>exim</quote> and the user name
16445 taken from the first item in the colon-separated data string (&lt;<emphasis>string1</emphasis>&gt;).
16446 The remaining items in the data string are passed over in response to requests
16447 from the authentication function. In the simple case there will only be one
16448 request, for a password, so the data consists of just two strings.
16449 </para>
16450 <para>
16451 There can be problems if any of the strings are permitted to contain colon
16452 characters. In the usual way, these have to be doubled to avoid being taken as
16453 separators. If the data is being inserted from a variable, the <option>sg</option> expansion
16454 item can be used to double any existing colons. For example, the configuration
16455 of a LOGIN authenticator might contain this setting:
16456 </para>
16457 <literallayout class="monospaced">
16458 server_condition = ${if pam{$auth1:${sg{$auth2}{:}{::}}}}
16459 </literallayout>
16460 <para>
16461 For a PLAIN authenticator you could use:
16462 </para>
16463 <literallayout class="monospaced">
16464 server_condition = ${if pam{$auth2:${sg{$auth3}{:}{::}}}}
16465 </literallayout>
16466 <para>
16467 In some operating systems, PAM authentication can be done only from a process
16468 running as root. Since Exim is running as the Exim user when receiving
16469 messages, this means that PAM cannot be used directly in those systems.
16470 A patched version of the <emphasis>pam_unix</emphasis> module that comes with the
16471 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>.
16472 The patched module allows one special uid/gid combination, in addition to root,
16473 to authenticate. If you build the patched module to allow the Exim user and
16474 group, PAM can then be used from an Exim authenticator.
16475 </para>
16476 </listitem></varlistentry>
16477 <varlistentry>
16478 <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>
16479 <listitem>
16480 <para>
16481 <indexterm role="concept">
16482 <primary><emphasis>pwcheck</emphasis> daemon</primary>
16483 </indexterm>
16484 <indexterm role="concept">
16485 <primary>Cyrus</primary>
16486 </indexterm>
16487 <indexterm role="concept">
16488 <primary>expansion</primary>
16489 <secondary><emphasis>pwcheck</emphasis> authentication test</secondary>
16490 </indexterm>
16491 <indexterm role="concept">
16492 <primary><option>pwcheck</option> expansion condition</primary>
16493 </indexterm>
16494 This condition supports user authentication using the Cyrus <emphasis>pwcheck</emphasis> daemon.
16495 This is one way of making it possible for passwords to be checked by a process
16496 that is not running as root. <emphasis role="bold">Note</emphasis>: The use of <emphasis>pwcheck</emphasis> is now
16497 deprecated. Its replacement is <emphasis>saslauthd</emphasis> (see below).
16498 </para>
16499 <para>
16500 The pwcheck support is not included in Exim by default. You need to specify
16501 the location of the pwcheck daemon&#x2019;s socket in <filename>Local/Makefile</filename> before
16502 building Exim. For example:
16503 </para>
16504 <literallayout class="monospaced">
16505 CYRUS_PWCHECK_SOCKET=/var/pwcheck/pwcheck
16506 </literallayout>
16507 <para>
16508 You do not need to install the full Cyrus software suite in order to use
16509 the pwcheck daemon. You can compile and install just the daemon alone
16510 from the Cyrus SASL library. Ensure that <emphasis>exim</emphasis> is the only user that has
16511 access to the <filename>/var/pwcheck</filename> directory.
16512 </para>
16513 <para>
16514 The <option>pwcheck</option> condition takes one argument, which must be the user name and
16515 password, separated by a colon. For example, in a LOGIN authenticator
16516 configuration, you might have this:
16517 </para>
16518 <literallayout class="monospaced">
16519 server_condition = ${if pwcheck{$auth1:$auth2}}
16520 </literallayout>
16521 <para>
16522 Again, for a PLAIN authenticator configuration, this would be:
16523 </para>
16524 <literallayout class="monospaced">
16525 server_condition = ${if pwcheck{$auth2:$auth3}}
16526 </literallayout>
16527 </listitem></varlistentry>
16528 <varlistentry>
16529 <term><emphasis role="bold">queue_running</emphasis></term>
16530 <listitem>
16531 <para>
16532 <indexterm role="concept">
16533 <primary>queue runner</primary>
16534 <secondary>detecting when delivering from</secondary>
16535 </indexterm>
16536 <indexterm role="concept">
16537 <primary>expansion</primary>
16538 <secondary>queue runner test</secondary>
16539 </indexterm>
16540 <indexterm role="concept">
16541 <primary><option>queue_running</option> expansion condition</primary>
16542 </indexterm>
16543 This condition, which has no data, is true during delivery attempts that are
16544 initiated by queue runner processes, and false otherwise.
16545 </para>
16546 </listitem></varlistentry>
16547 <varlistentry>
16548 <term><emphasis role="bold">radius&nbsp;{</emphasis>&lt;<emphasis>authentication&nbsp;string</emphasis>&gt;<emphasis role="bold">}</emphasis></term>
16549 <listitem>
16550 <para>
16551 <indexterm role="concept">
16552 <primary>Radius</primary>
16553 </indexterm>
16554 <indexterm role="concept">
16555 <primary>expansion</primary>
16556 <secondary>Radius authentication</secondary>
16557 </indexterm>
16558 <indexterm role="concept">
16559 <primary><option>radius</option> expansion condition</primary>
16560 </indexterm>
16561 Radius authentication (RFC 2865) is supported in a similar way to PAM. You must
16562 set RADIUS_CONFIG_FILE in <filename>Local/Makefile</filename> to specify the location of
16563 the Radius client configuration file in order to build Exim with Radius
16564 support.
16565 </para>
16566 <para>
16567 With just that one setting, Exim expects to be linked with the <option>radiusclient</option>
16568 library, using the original API. If you are using release 0.4.0 or later of
16569 this library, you need to set
16570 </para>
16571 <literallayout class="monospaced">
16572 RADIUS_LIB_TYPE=RADIUSCLIENTNEW
16573 </literallayout>
16574 <para>
16575 in <filename>Local/Makefile</filename> when building Exim. You can also link Exim with the
16576 <option>libradius</option> library that comes with FreeBSD. To do this, set
16577 </para>
16578 <literallayout class="monospaced">
16579 RADIUS_LIB_TYPE=RADLIB
16580 </literallayout>
16581 <para>
16582 in <filename>Local/Makefile</filename>, in addition to setting RADIUS_CONFIGURE_FILE.
16583 You may also have to supply a suitable setting in EXTRALIBS so that the
16584 Radius library can be found when Exim is linked.
16585 </para>
16586 <para>
16587 The string specified by RADIUS_CONFIG_FILE is expanded and passed to the
16588 Radius client library, which calls the Radius server. The condition is true if
16589 the authentication is successful. For example:
16590 </para>
16591 <literallayout class="monospaced">
16592 server_condition = ${if radius{&lt;arguments&gt;}}
16593 </literallayout>
16594 </listitem></varlistentry>
16595 <varlistentry>
16596 <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>
16597 <listitem>
16598 <para>
16599 <indexterm role="concept">
16600 <primary><emphasis>saslauthd</emphasis> daemon</primary>
16601 </indexterm>
16602 <indexterm role="concept">
16603 <primary>Cyrus</primary>
16604 </indexterm>
16605 <indexterm role="concept">
16606 <primary>expansion</primary>
16607 <secondary><emphasis>saslauthd</emphasis> authentication test</secondary>
16608 </indexterm>
16609 <indexterm role="concept">
16610 <primary><option>saslauthd</option> expansion condition</primary>
16611 </indexterm>
16612 This condition supports user authentication using the Cyrus <emphasis>saslauthd</emphasis>
16613 daemon. This replaces the older <emphasis>pwcheck</emphasis> daemon, which is now deprecated.
16614 Using this daemon is one way of making it possible for passwords to be checked
16615 by a process that is not running as root.
16616 </para>
16617 <para>
16618 The saslauthd support is not included in Exim by default. You need to specify
16619 the location of the saslauthd daemon&#x2019;s socket in <filename>Local/Makefile</filename> before
16620 building Exim. For example:
16621 </para>
16622 <literallayout class="monospaced">
16623 CYRUS_SASLAUTHD_SOCKET=/var/state/saslauthd/mux
16624 </literallayout>
16625 <para>
16626 You do not need to install the full Cyrus software suite in order to use
16627 the saslauthd daemon. You can compile and install just the daemon alone
16628 from the Cyrus SASL library.
16629 </para>
16630 <para>
16631 Up to four arguments can be supplied to the <option>saslauthd</option> condition, but only
16632 two are mandatory. For example:
16633 </para>
16634 <literallayout class="monospaced">
16635 server_condition = ${if saslauthd{{$auth1}{$auth2}}}
16636 </literallayout>
16637 <para>
16638 The service and the realm are optional (which is why the arguments are enclosed
16639 in their own set of braces). For details of the meaning of the service and
16640 realm, and how to run the daemon, consult the Cyrus documentation.
16641 </para>
16642 </listitem></varlistentry>
16643 </variablelist>
16644 </section>
16645 <section id="SECID84">
16646 <title>Combining expansion conditions</title>
16647 <para>
16648 <indexterm role="concept">
16649 <primary>expansion</primary>
16650 <secondary>combining conditions</secondary>
16651 </indexterm>
16652 Several conditions can be tested at once by combining them using the <option>and</option>
16653 and <option>or</option> combination conditions. Note that <option>and</option> and <option>or</option> are complete
16654 conditions on their own, and precede their lists of sub-conditions. Each
16655 sub-condition must be enclosed in braces within the overall braces that contain
16656 the list. No repetition of <option>if</option> is used.
16657 </para>
16658 <variablelist>
16659 <varlistentry>
16660 <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>
16661 <listitem>
16662 <para>
16663 <indexterm role="concept">
16664 <primary><quote>or</quote> expansion condition</primary>
16665 </indexterm>
16666 <indexterm role="concept">
16667 <primary>expansion</primary>
16668 <secondary><quote>or</quote> of conditions</secondary>
16669 </indexterm>
16670 The sub-conditions are evaluated from left to right. The condition is true if
16671 any one of the sub-conditions is true.
16672 For example,
16673 </para>
16674 <literallayout class="monospaced">
16675 ${if or {{eq{$local_part}{spqr}}{eq{$domain}{testing.com}}}...
16676 </literallayout>
16677 <para>
16678 When a true sub-condition is found, the following ones are parsed but not
16679 evaluated. If there are several <quote>match</quote> sub-conditions the values of the
16680 numeric variables afterwards are taken from the first one that succeeds.
16681 </para>
16682 </listitem></varlistentry>
16683 <varlistentry>
16684 <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>
16685 <listitem>
16686 <para>
16687 <indexterm role="concept">
16688 <primary><quote>and</quote> expansion condition</primary>
16689 </indexterm>
16690 <indexterm role="concept">
16691 <primary>expansion</primary>
16692 <secondary><quote>and</quote> of conditions</secondary>
16693 </indexterm>
16694 The sub-conditions are evaluated from left to right. The condition is true if
16695 all of the sub-conditions are true. If there are several <quote>match</quote>
16696 sub-conditions, the values of the numeric variables afterwards are taken from
16697 the last one. When a false sub-condition is found, the following ones are
16698 parsed but not evaluated.
16699 </para>
16700 </listitem></varlistentry>
16701 </variablelist>
16702 <para>
16703 <indexterm role="concept" startref="IIDexpcond" class="endofrange"/>
16704 </para>
16705 </section>
16706 <section id="SECTexpvar">
16707 <title>Expansion variables</title>
16708 <para>
16709 <indexterm role="concept">
16710 <primary>expansion</primary>
16711 <secondary>variables, list of</secondary>
16712 </indexterm>
16713 This section contains an alphabetical list of all the expansion variables. Some
16714 of them are available only when Exim is compiled with specific options such as
16715 support for TLS or the content scanning extension.
16716 </para>
16717 <variablelist>
16718 <varlistentry>
16719 <term><varname>$0</varname>, <varname>$1</varname>, etc</term>
16720 <listitem>
16721 <para>
16722 <indexterm role="concept">
16723 <primary>numerical variables (<varname>$1</varname> <varname>$2</varname> etc)</primary>
16724 </indexterm>
16725 When a <option>match</option> expansion condition succeeds, these variables contain the
16726 captured substrings identified by the regular expression during subsequent
16727 processing of the success string of the containing <option>if</option> expansion item.
16728 However, they do not retain their values afterwards; in fact, their previous
16729 values are restored at the end of processing an <option>if</option> item. The numerical
16730 variables may also be set externally by some other matching process which
16731 precedes the expansion of the string. For example, the commands available in
16732 Exim filter files include an <option>if</option> command with its own regular expression
16733 matching condition.
16734 </para>
16735 </listitem></varlistentry>
16736 <varlistentry revisionflag="changed">
16737 <term><varname>$acl_arg1</varname>, <varname>$acl_arg2</varname>, etc</term>
16738 <listitem>
16739 <para revisionflag="changed">
16740 Within an acl condition, expansion condition or expansion item
16741 any arguments are copied to these variables,
16742 any unused variables being made empty.
16743 </para>
16744 </listitem></varlistentry>
16745 <varlistentry>
16746 <term><varname>$acl_c...</varname></term>
16747 <listitem>
16748 <para>
16749 Values can be placed in these variables by the <option>set</option> modifier in an ACL. They
16750 can be given any name that starts with <varname>$acl_c</varname> and is at least six characters
16751 long, but the sixth character must be either a digit or an underscore. For
16752 example: <varname>$acl_c5</varname>, <varname>$acl_c_mycount</varname>. The values of the <varname>$acl_c...</varname>
16753 variables persist throughout the lifetime of an SMTP connection. They can be
16754 used to pass information between ACLs and between different invocations of the
16755 same ACL. When a message is received, the values of these variables are saved
16756 with the message, and can be accessed by filters, routers, and transports
16757 during subsequent delivery.
16758 </para>
16759 </listitem></varlistentry>
16760 <varlistentry>
16761 <term><varname>$acl_m...</varname></term>
16762 <listitem>
16763 <para>
16764 These variables are like the <varname>$acl_c...</varname> variables, except that their values
16765 are reset after a message has been received. Thus, if several messages are
16766 received in one SMTP connection, <varname>$acl_m...</varname> values are not passed on from one
16767 message to the next, as <varname>$acl_c...</varname> values are. The <varname>$acl_m...</varname> variables are
16768 also reset by MAIL, RSET, EHLO, HELO, and after starting a TLS session. When a
16769 message is received, the values of these variables are saved with the message,
16770 and can be accessed by filters, routers, and transports during subsequent
16771 delivery.
16772 </para>
16773 </listitem></varlistentry>
16774 <varlistentry revisionflag="changed">
16775 <term><varname>$acl_narg</varname></term>
16776 <listitem>
16777 <para revisionflag="changed">
16778 Within an acl condition, expansion condition or expansion item
16779 this variable has the number of arguments.
16780 </para>
16781 </listitem></varlistentry>
16782 <varlistentry>
16783 <term><varname>$acl_verify_message</varname></term>
16784 <listitem>
16785 <para>
16786 <indexterm role="variable">
16787 <primary><varname>$acl_verify_message</varname></primary>
16788 </indexterm>
16789 After an address verification has failed, this variable contains the failure
16790 message. It retains its value for use in subsequent modifiers. The message can
16791 be preserved by coding like this:
16792 </para>
16793 <literallayout class="monospaced">
16794 warn !verify = sender
16795      set acl_m0 = $acl_verify_message
16796 </literallayout>
16797 <para>
16798 You can use <varname>$acl_verify_message</varname> during the expansion of the <option>message</option> or
16799 <option>log_message</option> modifiers, to include information about the verification
16800 failure.
16801 </para>
16802 </listitem></varlistentry>
16803 <varlistentry>
16804 <term><varname>$address_data</varname></term>
16805 <listitem>
16806 <para>
16807 <indexterm role="variable">
16808 <primary><varname>$address_data</varname></primary>
16809 </indexterm>
16810 This variable is set by means of the <option>address_data</option> option in routers. The
16811 value then remains with the address while it is processed by subsequent routers
16812 and eventually a transport. If the transport is handling multiple addresses,
16813 the value from the first address is used. See chapter <xref linkend="CHAProutergeneric"/>
16814 for more details. <emphasis role="bold">Note</emphasis>: The contents of <varname>$address_data</varname> are visible in
16815 user filter files.
16816 </para>
16817 <para>
16818 If <varname>$address_data</varname> is set when the routers are called from an ACL to verify
16819 a recipient address, the final value is still in the variable for subsequent
16820 conditions and modifiers of the ACL statement. If routing the address caused it
16821 to be redirected to just one address, the child address is also routed as part
16822 of the verification, and in this case the final value of <varname>$address_data</varname> is
16823 from the child&#x2019;s routing.
16824 </para>
16825 <para>
16826 If <varname>$address_data</varname> is set when the routers are called from an ACL to verify a
16827 sender address, the final value is also preserved, but this time in
16828 <varname>$sender_address_data</varname>, to distinguish it from data from a recipient
16829 address.
16830 </para>
16831 <para>
16832 In both cases (recipient and sender verification), the value does not persist
16833 after the end of the current ACL statement. If you want to preserve
16834 these values for longer, you can save them in ACL variables.
16835 </para>
16836 </listitem></varlistentry>
16837 <varlistentry>
16838 <term><varname>$address_file</varname></term>
16839 <listitem>
16840 <para>
16841 <indexterm role="variable">
16842 <primary><varname>$address_file</varname></primary>
16843 </indexterm>
16844 When, as a result of aliasing, forwarding, or filtering, a message is directed
16845 to a specific file, this variable holds the name of the file when the transport
16846 is running. At other times, the variable is empty. For example, using the
16847 default configuration, if user <option>r2d2</option> has a <filename>.forward</filename> file containing
16848 </para>
16849 <literallayout class="monospaced">
16850 /home/r2d2/savemail
16851 </literallayout>
16852 <para>
16853 then when the <command>address_file</command> transport is running, <varname>$address_file</varname>
16854 contains the text string <literal>/home/r2d2/savemail</literal>.
16855 <indexterm role="concept">
16856 <primary>Sieve filter</primary>
16857 <secondary>value of <varname>$address_file</varname></secondary>
16858 </indexterm>
16859 For Sieve filters, the value may be <quote>inbox</quote> or a relative folder name. It is
16860 then up to the transport configuration to generate an appropriate absolute path
16861 to the relevant file.
16862 </para>
16863 </listitem></varlistentry>
16864 <varlistentry>
16865 <term><varname>$address_pipe</varname></term>
16866 <listitem>
16867 <para>
16868 <indexterm role="variable">
16869 <primary><varname>$address_pipe</varname></primary>
16870 </indexterm>
16871 When, as a result of aliasing or forwarding, a message is directed to a pipe,
16872 this variable holds the pipe command when the transport is running.
16873 </para>
16874 </listitem></varlistentry>
16875 <varlistentry>
16876 <term><varname>$auth1</varname> &ndash; <varname>$auth3</varname></term>
16877 <listitem>
16878 <para>
16879 <indexterm role="variable">
16880 <primary><varname>$auth1</varname>, <varname>$auth2</varname>, etc</primary>
16881 </indexterm>
16882 These variables are used in SMTP authenticators (see chapters
16883 <xref linkend="CHAPplaintext"/>&ndash;<xref linkend="CHAPspa"/>). Elsewhere, they are empty.
16884 </para>
16885 </listitem></varlistentry>
16886 <varlistentry>
16887 <term><varname>$authenticated_id</varname></term>
16888 <listitem>
16889 <para>
16890 <indexterm role="concept">
16891 <primary>authentication</primary>
16892 <secondary>id</secondary>
16893 </indexterm>
16894 <indexterm role="variable">
16895 <primary><varname>$authenticated_id</varname></primary>
16896 </indexterm>
16897 When a server successfully authenticates a client it may be configured to
16898 preserve some of the authentication information in the variable
16899 <varname>$authenticated_id</varname> (see chapter <xref linkend="CHAPSMTPAUTH"/>). For example, a
16900 user/password authenticator configuration might preserve the user name for use
16901 in the routers. Note that this is not the same information that is saved in
16902 <varname>$sender_host_authenticated</varname>.
16903 When a message is submitted locally (that is, not over a TCP connection)
16904 the value of <varname>$authenticated_id</varname> is normally the login name of the calling
16905 process. However, a trusted user can override this by means of the <option>-oMai</option>
16906 command line option.
16907 </para>
16908 </listitem></varlistentry>
16909 <varlistentry>
16910 <term><varname>$authenticated_fail_id</varname></term>
16911 <listitem>
16912 <para>
16913 <indexterm role="concept">
16914 <primary>authentication</primary>
16915 <secondary>fail</secondary>
16916 </indexterm>
16917 <indexterm role="variable">
16918 <primary><varname>$authenticated_fail_id</varname></primary>
16919 </indexterm>
16920 When an authentication attempt fails, the variable <varname>$authenticated_fail_id</varname>
16921 will contain the failed authentication id. If more than one authentication
16922 id is attempted, it will contain only the last one. The variable is
16923 available for processing in the ACL&#x2019;s, generally the quit or notquit ACL.
16924 A message to a local recipient could still be accepted without requiring
16925 authentication, which means this variable could also be visible in all of
16926 the ACL&#x2019;s as well.
16927 </para>
16928 </listitem></varlistentry>
16929 <varlistentry>
16930 <term><varname>$authenticated_sender</varname></term>
16931 <listitem>
16932 <para>
16933 <indexterm role="concept">
16934 <primary>sender</primary>
16935 <secondary>authenticated</secondary>
16936 </indexterm>
16937 <indexterm role="concept">
16938 <primary>authentication</primary>
16939 <secondary>sender</secondary>
16940 </indexterm>
16941 <indexterm role="concept">
16942 <primary>AUTH</primary>
16943 <secondary>on MAIL command</secondary>
16944 </indexterm>
16945 <indexterm role="variable">
16946 <primary><varname>$authenticated_sender</varname></primary>
16947 </indexterm>
16948 When acting as a server, Exim takes note of the AUTH= parameter on an incoming
16949 SMTP MAIL command if it believes the sender is sufficiently trusted, as
16950 described in section <xref linkend="SECTauthparamail"/>. Unless the data is the string
16951 <quote>&lt;&gt;</quote>, it is set as the authenticated sender of the message, and the value is
16952 available during delivery in the <varname>$authenticated_sender</varname> variable. If the
16953 sender is not trusted, Exim accepts the syntax of AUTH=, but ignores the data.
16954 </para>
16955 <para>
16956 <indexterm role="variable">
16957 <primary><varname>$qualify_domain</varname></primary>
16958 </indexterm>
16959 When a message is submitted locally (that is, not over a TCP connection), the
16960 value of <varname>$authenticated_sender</varname> is an address constructed from the login
16961 name of the calling process and <varname>$qualify_domain</varname>, except that a trusted user
16962 can override this by means of the <option>-oMas</option> command line option.
16963 </para>
16964 </listitem></varlistentry>
16965 <varlistentry>
16966 <term><varname>$authentication_failed</varname></term>
16967 <listitem>
16968 <para>
16969 <indexterm role="concept">
16970 <primary>authentication</primary>
16971 <secondary>failure</secondary>
16972 </indexterm>
16973 <indexterm role="variable">
16974 <primary><varname>$authentication_failed</varname></primary>
16975 </indexterm>
16976 This variable is set to <quote>1</quote> in an Exim server if a client issues an AUTH
16977 command that does not succeed. Otherwise it is set to <quote>0</quote>. This makes it
16978 possible to distinguish between <quote>did not try to authenticate</quote>
16979 (<varname>$sender_host_authenticated</varname> is empty and <varname>$authentication_failed</varname> is set to
16980 <quote>0</quote>) and <quote>tried to authenticate but failed</quote> (<varname>$sender_host_authenticated</varname>
16981 is empty and <varname>$authentication_failed</varname> is set to <quote>1</quote>). Failure includes any
16982 negative response to an AUTH command, including (for example) an attempt to use
16983 an undefined mechanism.
16984 </para>
16985 </listitem></varlistentry>
16986 <varlistentry>
16987 <term><varname>$av_failed</varname></term>
16988 <listitem>
16989 <para>
16990 <indexterm role="concept">
16991 <primary>content scanning</primary>
16992 <secondary>AV scanner failure</secondary>
16993 </indexterm>
16994 This variable is available when Exim is compiled with the content-scanning
16995 extension. It is set to <quote>0</quote> by default, but will be set to <quote>1</quote> if any
16996 problem occurs with the virus scanner (specified by <option>av_scanner</option>) during
16997 the ACL malware condition.
16998 </para>
16999 </listitem></varlistentry>
17000 <varlistentry>
17001 <term><varname>$body_linecount</varname></term>
17002 <listitem>
17003 <para>
17004 <indexterm role="concept">
17005 <primary>message body</primary>
17006 <secondary>line count</secondary>
17007 </indexterm>
17008 <indexterm role="concept">
17009 <primary>body of message</primary>
17010 <secondary>line count</secondary>
17011 </indexterm>
17012 <indexterm role="variable">
17013 <primary><varname>$body_linecount</varname></primary>
17014 </indexterm>
17015 When a message is being received or delivered, this variable contains the
17016 number of lines in the message&#x2019;s body. See also <varname>$message_linecount</varname>.
17017 </para>
17018 </listitem></varlistentry>
17019 <varlistentry>
17020 <term><varname>$body_zerocount</varname></term>
17021 <listitem>
17022 <para>
17023 <indexterm role="concept">
17024 <primary>message body</primary>
17025 <secondary>binary zero count</secondary>
17026 </indexterm>
17027 <indexterm role="concept">
17028 <primary>body of message</primary>
17029 <secondary>binary zero count</secondary>
17030 </indexterm>
17031 <indexterm role="concept">
17032 <primary>binary zero</primary>
17033 <secondary>in message body</secondary>
17034 </indexterm>
17035 <indexterm role="variable">
17036 <primary><varname>$body_zerocount</varname></primary>
17037 </indexterm>
17038 When a message is being received or delivered, this variable contains the
17039 number of binary zero bytes (ASCII NULs) in the message&#x2019;s body.
17040 </para>
17041 </listitem></varlistentry>
17042 <varlistentry>
17043 <term><varname>$bounce_recipient</varname></term>
17044 <listitem>
17045 <para>
17046 <indexterm role="variable">
17047 <primary><varname>$bounce_recipient</varname></primary>
17048 </indexterm>
17049 This is set to the recipient address of a bounce message while Exim is creating
17050 it. It is useful if a customized bounce message text file is in use (see
17051 chapter <xref linkend="CHAPemsgcust"/>).
17052 </para>
17053 </listitem></varlistentry>
17054 <varlistentry>
17055 <term><varname>$bounce_return_size_limit</varname></term>
17056 <listitem>
17057 <para>
17058 <indexterm role="variable">
17059 <primary><varname>$bounce_return_size_limit</varname></primary>
17060 </indexterm>
17061 This contains the value set in the <option>bounce_return_size_limit</option> option, rounded
17062 up to a multiple of 1000. It is useful when a customized error message text
17063 file is in use (see chapter <xref linkend="CHAPemsgcust"/>).
17064 </para>
17065 </listitem></varlistentry>
17066 <varlistentry>
17067 <term><varname>$caller_gid</varname></term>
17068 <listitem>
17069 <para>
17070 <indexterm role="concept">
17071 <primary>gid (group id)</primary>
17072 <secondary>caller</secondary>
17073 </indexterm>
17074 <indexterm role="variable">
17075 <primary><varname>$caller_gid</varname></primary>
17076 </indexterm>
17077 The real group id under which the process that called Exim was running. This is
17078 not the same as the group id of the originator of a message (see
17079 <varname>$originator_gid</varname>). If Exim re-execs itself, this variable in the new
17080 incarnation normally contains the Exim gid.
17081 </para>
17082 </listitem></varlistentry>
17083 <varlistentry>
17084 <term><varname>$caller_uid</varname></term>
17085 <listitem>
17086 <para>
17087 <indexterm role="concept">
17088 <primary>uid (user id)</primary>
17089 <secondary>caller</secondary>
17090 </indexterm>
17091 <indexterm role="variable">
17092 <primary><varname>$caller_uid</varname></primary>
17093 </indexterm>
17094 The real user id under which the process that called Exim was running. This is
17095 not the same as the user id of the originator of a message (see
17096 <varname>$originator_uid</varname>). If Exim re-execs itself, this variable in the new
17097 incarnation normally contains the Exim uid.
17098 </para>
17099 </listitem></varlistentry>
17100 <varlistentry>
17101 <term><varname>$compile_date</varname></term>
17102 <listitem>
17103 <para>
17104 <indexterm role="variable">
17105 <primary><varname>$compile_date</varname></primary>
17106 </indexterm>
17107 The date on which the Exim binary was compiled.
17108 </para>
17109 </listitem></varlistentry>
17110 <varlistentry>
17111 <term><varname>$compile_number</varname></term>
17112 <listitem>
17113 <para>
17114 <indexterm role="variable">
17115 <primary><varname>$compile_number</varname></primary>
17116 </indexterm>
17117 The building process for Exim keeps a count of the number
17118 of times it has been compiled. This serves to distinguish different
17119 compilations of the same version of the program.
17120 </para>
17121 </listitem></varlistentry>
17122 <varlistentry>
17123 <term><varname>$demime_errorlevel</varname></term>
17124 <listitem>
17125 <para>
17126 <indexterm role="variable">
17127 <primary><varname>$demime_errorlevel</varname></primary>
17128 </indexterm>
17129 This variable is available when Exim is compiled with
17130 the content-scanning extension and the obsolete <option>demime</option> condition. For
17131 details, see section <xref linkend="SECTdemimecond"/>.
17132 </para>
17133 </listitem></varlistentry>
17134 <varlistentry>
17135 <term><varname>$demime_reason</varname></term>
17136 <listitem>
17137 <para>
17138 <indexterm role="variable">
17139 <primary><varname>$demime_reason</varname></primary>
17140 </indexterm>
17141 This variable is available when Exim is compiled with the
17142 content-scanning extension and the obsolete <option>demime</option> condition. For details,
17143 see section <xref linkend="SECTdemimecond"/>.
17144 </para>
17145 </listitem></varlistentry>
17146 <varlistentry>
17147 <term><varname>$dnslist_domain</varname></term>
17148 <term><varname>$dnslist_matched</varname></term>
17149 <term><varname>$dnslist_text</varname></term>
17150 <term><varname>$dnslist_value</varname></term>
17151 <listitem>
17152 <para>
17153 <indexterm role="variable">
17154 <primary><varname>$dnslist_domain</varname></primary>
17155 </indexterm>
17156 <indexterm role="variable">
17157 <primary><varname>$dnslist_matched</varname></primary>
17158 </indexterm>
17159 <indexterm role="variable">
17160 <primary><varname>$dnslist_text</varname></primary>
17161 </indexterm>
17162 <indexterm role="variable">
17163 <primary><varname>$dnslist_value</varname></primary>
17164 </indexterm>
17165 <indexterm role="concept">
17166 <primary>black list (DNS)</primary>
17167 </indexterm>
17168 When a DNS (black) list lookup succeeds, these variables are set to contain
17169 the following data from the lookup: the list&#x2019;s domain name, the key that was
17170 looked up, the contents of any associated TXT record, and the value from the
17171 main A record. See section <xref linkend="SECID204"/> for more details.
17172 </para>
17173 </listitem></varlistentry>
17174 <varlistentry>
17175 <term><varname>$domain</varname></term>
17176 <listitem>
17177 <para>
17178 <indexterm role="variable">
17179 <primary><varname>$domain</varname></primary>
17180 </indexterm>
17181 When an address is being routed, or delivered on its own, this variable
17182 contains the domain. Uppercase letters in the domain are converted into lower
17183 case for <varname>$domain</varname>.
17184 </para>
17185 <para>
17186 Global address rewriting happens when a message is received, so the value of
17187 <varname>$domain</varname> during routing and delivery is the value after rewriting. <varname>$domain</varname>
17188 is set during user filtering, but not during system filtering, because a
17189 message may have many recipients and the system filter is called just once.
17190 </para>
17191 <para>
17192 When more than one address is being delivered at once (for example, several
17193 RCPT commands in one SMTP delivery), <varname>$domain</varname> is set only if they all
17194 have the same domain. Transports can be restricted to handling only one domain
17195 at a time if the value of <varname>$domain</varname> is required at transport time &ndash; this is
17196 the default for local transports. For further details of the environment in
17197 which local transports are run, see chapter <xref linkend="CHAPenvironment"/>.
17198 </para>
17199 <para>
17200 <indexterm role="option">
17201 <primary><option>delay_warning_condition</option></primary>
17202 </indexterm>
17203 At the end of a delivery, if all deferred addresses have the same domain, it is
17204 set in <varname>$domain</varname> during the expansion of <option>delay_warning_condition</option>.
17205 </para>
17206 <para>
17207 The <varname>$domain</varname> variable is also used in some other circumstances:
17208 </para>
17209 <itemizedlist>
17210 <listitem>
17211 <para>
17212 When an ACL is running for a RCPT command, <varname>$domain</varname> contains the domain of
17213 the recipient address. The domain of the <emphasis>sender</emphasis> address is in
17214 <varname>$sender_address_domain</varname> at both MAIL time and at RCPT time. <varname>$domain</varname> is not
17215 normally set during the running of the MAIL ACL. However, if the sender address
17216 is verified with a callout during the MAIL ACL, the sender domain is placed in
17217 <varname>$domain</varname> during the expansions of <option>hosts</option>, <option>interface</option>, and <option>port</option> in
17218 the <command>smtp</command> transport.
17219 </para>
17220 </listitem>
17221 <listitem>
17222 <para>
17223 When a rewrite item is being processed (see chapter <xref linkend="CHAPrewrite"/>),
17224 <varname>$domain</varname> contains the domain portion of the address that is being rewritten;
17225 it can be used in the expansion of the replacement address, for example, to
17226 rewrite domains by file lookup.
17227 </para>
17228 </listitem>
17229 <listitem>
17230 <para>
17231 With one important exception, whenever a domain list is being scanned,
17232 <varname>$domain</varname> contains the subject domain. <emphasis role="bold">Exception</emphasis>: When a domain list in
17233 a <option>sender_domains</option> condition in an ACL is being processed, the subject domain
17234 is in <varname>$sender_address_domain</varname> and not in <varname>$domain</varname>. It works this way so
17235 that, in a RCPT ACL, the sender domain list can be dependent on the
17236 recipient domain (which is what is in <varname>$domain</varname> at this time).
17237 </para>
17238 </listitem>
17239 <listitem>
17240 <para>
17241 <indexterm role="concept">
17242 <primary>ETRN</primary>
17243 <secondary>value of <varname>$domain</varname></secondary>
17244 </indexterm>
17245 <indexterm role="option">
17246 <primary><option>smtp_etrn_command</option></primary>
17247 </indexterm>
17248 When the <option>smtp_etrn_command</option> option is being expanded, <varname>$domain</varname> contains
17249 the complete argument of the ETRN command (see section <xref linkend="SECTETRN"/>).
17250 </para>
17251 </listitem>
17252 </itemizedlist>
17253 </listitem></varlistentry>
17254 <varlistentry>
17255 <term><varname>$domain_data</varname></term>
17256 <listitem>
17257 <para>
17258 <indexterm role="variable">
17259 <primary><varname>$domain_data</varname></primary>
17260 </indexterm>
17261 When the <option>domains</option> option on a router matches a domain by
17262 means of a lookup, the data read by the lookup is available during the running
17263 of the router as <varname>$domain_data</varname>. In addition, if the driver routes the
17264 address to a transport, the value is available in that transport. If the
17265 transport is handling multiple addresses, the value from the first address is
17266 used.
17267 </para>
17268 <para>
17269 <varname>$domain_data</varname> is also set when the <option>domains</option> condition in an ACL matches a
17270 domain by means of a lookup. The data read by the lookup is available during
17271 the rest of the ACL statement. In all other situations, this variable expands
17272 to nothing.
17273 </para>
17274 </listitem></varlistentry>
17275 <varlistentry>
17276 <term><varname>$exim_gid</varname></term>
17277 <listitem>
17278 <para>
17279 <indexterm role="variable">
17280 <primary><varname>$exim_gid</varname></primary>
17281 </indexterm>
17282 This variable contains the numerical value of the Exim group id.
17283 </para>
17284 </listitem></varlistentry>
17285 <varlistentry>
17286 <term><varname>$exim_path</varname></term>
17287 <listitem>
17288 <para>
17289 <indexterm role="variable">
17290 <primary><varname>$exim_path</varname></primary>
17291 </indexterm>
17292 This variable contains the path to the Exim binary.
17293 </para>
17294 </listitem></varlistentry>
17295 <varlistentry>
17296 <term><varname>$exim_uid</varname></term>
17297 <listitem>
17298 <para>
17299 <indexterm role="variable">
17300 <primary><varname>$exim_uid</varname></primary>
17301 </indexterm>
17302 This variable contains the numerical value of the Exim user id.
17303 </para>
17304 </listitem></varlistentry>
17305 <varlistentry>
17306 <term><varname>$found_extension</varname></term>
17307 <listitem>
17308 <para>
17309 <indexterm role="variable">
17310 <primary><varname>$found_extension</varname></primary>
17311 </indexterm>
17312 This variable is available when Exim is compiled with the
17313 content-scanning extension and the obsolete <option>demime</option> condition. For details,
17314 see section <xref linkend="SECTdemimecond"/>.
17315 </para>
17316 </listitem></varlistentry>
17317 <varlistentry>
17318 <term><varname>$header_</varname>&lt;<emphasis>name</emphasis>&gt;</term>
17319 <listitem>
17320 <para>
17321 This is not strictly an expansion variable. It is expansion syntax for
17322 inserting the message header line with the given name. Note that the name must
17323 be terminated by colon or white space, because it may contain a wide variety of
17324 characters. Note also that braces must <emphasis>not</emphasis> be used.
17325 </para>
17326 </listitem></varlistentry>
17327 <varlistentry>
17328 <term><varname>$headers_added</varname></term>
17329 <listitem>
17330 <para>
17331 <indexterm role="variable">
17332 <primary><varname>$headers_added</varname></primary>
17333 </indexterm>
17334 Within an ACL this variable contains the headers added so far by
17335 the ACL modifier add_header (section <xref linkend="SECTaddheadacl"/>).
17336 The headers are a newline-separated list.
17337 </para>
17338 </listitem></varlistentry>
17339 <varlistentry>
17340 <term><varname>$home</varname></term>
17341 <listitem>
17342 <para>
17343 <indexterm role="variable">
17344 <primary><varname>$home</varname></primary>
17345 </indexterm>
17346 When the <option>check_local_user</option> option is set for a router, the user&#x2019;s home
17347 directory is placed in <varname>$home</varname> when the check succeeds. In particular, this
17348 means it is set during the running of users&#x2019; filter files. A router may also
17349 explicitly set a home directory for use by a transport; this can be overridden
17350 by a setting on the transport itself.
17351 </para>
17352 <para>
17353 When running a filter test via the <option>-bf</option> option, <varname>$home</varname> is set to the value
17354 of the environment variable HOME.
17355 </para>
17356 </listitem></varlistentry>
17357 <varlistentry>
17358 <term><varname>$host</varname></term>
17359 <listitem>
17360 <para>
17361 <indexterm role="variable">
17362 <primary><varname>$host</varname></primary>
17363 </indexterm>
17364 If a router assigns an address to a transport (any transport), and passes a
17365 list of hosts with the address, the value of <varname>$host</varname> when the transport starts
17366 to run is the name of the first host on the list. Note that this applies both
17367 to local and remote transports.
17368 </para>
17369 <para>
17370 <indexterm role="concept">
17371 <primary>transport</primary>
17372 <secondary>filter</secondary>
17373 </indexterm>
17374 <indexterm role="concept">
17375 <primary>filter</primary>
17376 <secondary>transport filter</secondary>
17377 </indexterm>
17378 For the <command>smtp</command> transport, if there is more than one host, the value of
17379 <varname>$host</varname> changes as the transport works its way through the list. In
17380 particular, when the <command>smtp</command> transport is expanding its options for encryption
17381 using TLS, or for specifying a transport filter (see chapter
17382 <xref linkend="CHAPtransportgeneric"/>), <varname>$host</varname> contains the name of the host to which it
17383 is connected.
17384 </para>
17385 <para>
17386 When used in the client part of an authenticator configuration (see chapter
17387 <xref linkend="CHAPSMTPAUTH"/>), <varname>$host</varname> contains the name of the server to which the
17388 client is connected.
17389 </para>
17390 </listitem></varlistentry>
17391 <varlistentry>
17392 <term><varname>$host_address</varname></term>
17393 <listitem>
17394 <para>
17395 <indexterm role="variable">
17396 <primary><varname>$host_address</varname></primary>
17397 </indexterm>
17398 This variable is set to the remote host&#x2019;s IP address whenever <varname>$host</varname> is set
17399 for a remote connection. It is also set to the IP address that is being checked
17400 when the <option>ignore_target_hosts</option> option is being processed.
17401 </para>
17402 </listitem></varlistentry>
17403 <varlistentry>
17404 <term><varname>$host_data</varname></term>
17405 <listitem>
17406 <para>
17407 <indexterm role="variable">
17408 <primary><varname>$host_data</varname></primary>
17409 </indexterm>
17410 If a <option>hosts</option> condition in an ACL is satisfied by means of a lookup, the
17411 result of the lookup is made available in the <varname>$host_data</varname> variable. This
17412 allows you, for example, to do things like this:
17413 </para>
17414 <literallayout class="monospaced">
17415 deny  hosts = net-lsearch;/some/file
17416 message = $host_data
17417 </literallayout>
17418 </listitem></varlistentry>
17419 <varlistentry>
17420 <term><varname>$host_lookup_deferred</varname></term>
17421 <listitem>
17422 <para>
17423 <indexterm role="concept">
17424 <primary>host name</primary>
17425 <secondary>lookup, failure of</secondary>
17426 </indexterm>
17427 <indexterm role="variable">
17428 <primary><varname>$host_lookup_deferred</varname></primary>
17429 </indexterm>
17430 This variable normally contains <quote>0</quote>, as does <varname>$host_lookup_failed</varname>. When a
17431 message comes from a remote host and there is an attempt to look up the host&#x2019;s
17432 name from its IP address, and the attempt is not successful, one of these
17433 variables is set to <quote>1</quote>.
17434 </para>
17435 <itemizedlist>
17436 <listitem>
17437 <para>
17438 If the lookup receives a definite negative response (for example, a DNS lookup
17439 succeeded, but no records were found), <varname>$host_lookup_failed</varname> is set to <quote>1</quote>.
17440 </para>
17441 </listitem>
17442 <listitem>
17443 <para>
17444 If there is any kind of problem during the lookup, such that Exim cannot
17445 tell whether or not the host name is defined (for example, a timeout for a DNS
17446 lookup), <varname>$host_lookup_deferred</varname> is set to <quote>1</quote>.
17447 </para>
17448 </listitem>
17449 </itemizedlist>
17450 <para>
17451 Looking up a host&#x2019;s name from its IP address consists of more than just a
17452 single reverse lookup. Exim checks that a forward lookup of at least one of the
17453 names it receives from a reverse lookup yields the original IP address. If this
17454 is not the case, Exim does not accept the looked up name(s), and
17455 <varname>$host_lookup_failed</varname> is set to <quote>1</quote>. Thus, being able to find a name from an
17456 IP address (for example, the existence of a PTR record in the DNS) is not
17457 sufficient on its own for the success of a host name lookup. If the reverse
17458 lookup succeeds, but there is a lookup problem such as a timeout when checking
17459 the result, the name is not accepted, and <varname>$host_lookup_deferred</varname> is set to
17460 <quote>1</quote>. See also <varname>$sender_host_name</varname>.
17461 </para>
17462 </listitem></varlistentry>
17463 <varlistentry>
17464 <term><varname>$host_lookup_failed</varname></term>
17465 <listitem>
17466 <para>
17467 <indexterm role="variable">
17468 <primary><varname>$host_lookup_failed</varname></primary>
17469 </indexterm>
17470 See <varname>$host_lookup_deferred</varname>.
17471 </para>
17472 </listitem></varlistentry>
17473 <varlistentry>
17474 <term><varname>$inode</varname></term>
17475 <listitem>
17476 <para>
17477 <indexterm role="variable">
17478 <primary><varname>$inode</varname></primary>
17479 </indexterm>
17480 The only time this variable is set is while expanding the <option>directory_file</option>
17481 option in the <command>appendfile</command> transport. The variable contains the inode number
17482 of the temporary file which is about to be renamed. It can be used to construct
17483 a unique name for the file.
17484 </para>
17485 </listitem></varlistentry>
17486 <varlistentry>
17487 <term><varname>$interface_address</varname></term>
17488 <listitem>
17489 <para>
17490 <indexterm role="variable">
17491 <primary><varname>$interface_address</varname></primary>
17492 </indexterm>
17493 This is an obsolete name for <varname>$received_ip_address</varname>.
17494 </para>
17495 </listitem></varlistentry>
17496 <varlistentry>
17497 <term><varname>$interface_port</varname></term>
17498 <listitem>
17499 <para>
17500 <indexterm role="variable">
17501 <primary><varname>$interface_port</varname></primary>
17502 </indexterm>
17503 This is an obsolete name for <varname>$received_port</varname>.
17504 </para>
17505 </listitem></varlistentry>
17506 <varlistentry>
17507 <term><varname>$item</varname></term>
17508 <listitem>
17509 <para>
17510 <indexterm role="variable">
17511 <primary><varname>$item</varname></primary>
17512 </indexterm>
17513 This variable is used during the expansion of <emphasis role="bold">forall</emphasis> and <emphasis role="bold">forany</emphasis>
17514 conditions (see section <xref linkend="SECTexpcond"/>), and <emphasis role="bold">filter</emphasis>, <emphasis role="bold">map</emphasis>, and
17515 <emphasis role="bold">reduce</emphasis> items (see section <xref linkend="SECTexpcond"/>). In other circumstances, it is
17516 empty.
17517 </para>
17518 </listitem></varlistentry>
17519 <varlistentry>
17520 <term><varname>$ldap_dn</varname></term>
17521 <listitem>
17522 <para>
17523 <indexterm role="variable">
17524 <primary><varname>$ldap_dn</varname></primary>
17525 </indexterm>
17526 This variable, which is available only when Exim is compiled with LDAP support,
17527 contains the DN from the last entry in the most recently successful LDAP
17528 lookup.
17529 </para>
17530 </listitem></varlistentry>
17531 <varlistentry>
17532 <term><varname>$load_average</varname></term>
17533 <listitem>
17534 <para>
17535 <indexterm role="variable">
17536 <primary><varname>$load_average</varname></primary>
17537 </indexterm>
17538 This variable contains the system load average, multiplied by 1000 so that it
17539 is an integer. For example, if the load average is 0.21, the value of the
17540 variable is 210. The value is recomputed every time the variable is referenced.
17541 </para>
17542 </listitem></varlistentry>
17543 <varlistentry>
17544 <term><varname>$local_part</varname></term>
17545 <listitem>
17546 <para>
17547 <indexterm role="variable">
17548 <primary><varname>$local_part</varname></primary>
17549 </indexterm>
17550 When an address is being routed, or delivered on its own, this
17551 variable contains the local part. When a number of addresses are being
17552 delivered together (for example, multiple RCPT commands in an SMTP
17553 session), <varname>$local_part</varname> is not set.
17554 </para>
17555 <para>
17556 Global address rewriting happens when a message is received, so the value of
17557 <varname>$local_part</varname> during routing and delivery is the value after rewriting.
17558 <varname>$local_part</varname> is set during user filtering, but not during system filtering,
17559 because a message may have many recipients and the system filter is called just
17560 once.
17561 </para>
17562 <para>
17563 <indexterm role="variable">
17564 <primary><varname>$local_part_prefix</varname></primary>
17565 </indexterm>
17566 <indexterm role="variable">
17567 <primary><varname>$local_part_suffix</varname></primary>
17568 </indexterm>
17569 If a local part prefix or suffix has been recognized, it is not included in the
17570 value of <varname>$local_part</varname> during routing and subsequent delivery. The values of
17571 any prefix or suffix are in <varname>$local_part_prefix</varname> and
17572 <varname>$local_part_suffix</varname>, respectively.
17573 </para>
17574 <para>
17575 When a message is being delivered to a file, pipe, or autoreply transport as a
17576 result of aliasing or forwarding, <varname>$local_part</varname> is set to the local part of
17577 the parent address, not to the file name or command (see <varname>$address_file</varname> and
17578 <varname>$address_pipe</varname>).
17579 </para>
17580 <para>
17581 When an ACL is running for a RCPT command, <varname>$local_part</varname> contains the
17582 local part of the recipient address.
17583 </para>
17584 <para>
17585 When a rewrite item is being processed (see chapter <xref linkend="CHAPrewrite"/>),
17586 <varname>$local_part</varname> contains the local part of the address that is being rewritten;
17587 it can be used in the expansion of the replacement address, for example.
17588 </para>
17589 <para>
17590 In all cases, all quoting is removed from the local part. For example, for both
17591 the addresses
17592 </para>
17593 <literallayout class="monospaced">
17594 "abc:xyz"@test.example
17595 abc\:xyz@test.example
17596 </literallayout>
17597 <para>
17598 the value of <varname>$local_part</varname> is
17599 </para>
17600 <literallayout class="monospaced">
17601 abc:xyz
17602 </literallayout>
17603 <para>
17604 If you use <varname>$local_part</varname> to create another address, you should always wrap it
17605 inside a quoting operator. For example, in a <command>redirect</command> router you could
17606 have:
17607 </para>
17608 <literallayout class="monospaced">
17609 data = ${quote_local_part:$local_part}@new.domain.example
17610 </literallayout>
17611 <para>
17612 <emphasis role="bold">Note</emphasis>: The value of <varname>$local_part</varname> is normally lower cased. If you want
17613 to process local parts in a case-dependent manner in a router, you can set the
17614 <option>caseful_local_part</option> option (see chapter <xref linkend="CHAProutergeneric"/>).
17615 </para>
17616 </listitem></varlistentry>
17617 <varlistentry>
17618 <term><varname>$local_part_data</varname></term>
17619 <listitem>
17620 <para>
17621 <indexterm role="variable">
17622 <primary><varname>$local_part_data</varname></primary>
17623 </indexterm>
17624 When the <option>local_parts</option> option on a router matches a local part by means of a
17625 lookup, the data read by the lookup is available during the running of the
17626 router as <varname>$local_part_data</varname>. In addition, if the driver routes the address
17627 to a transport, the value is available in that transport. If the transport is
17628 handling multiple addresses, the value from the first address is used.
17629 </para>
17630 <para>
17631 <varname>$local_part_data</varname> is also set when the <option>local_parts</option> condition in an ACL
17632 matches a local part by means of a lookup. The data read by the lookup is
17633 available during the rest of the ACL statement. In all other situations, this
17634 variable expands to nothing.
17635 </para>
17636 </listitem></varlistentry>
17637 <varlistentry>
17638 <term><varname>$local_part_prefix</varname></term>
17639 <listitem>
17640 <para>
17641 <indexterm role="variable">
17642 <primary><varname>$local_part_prefix</varname></primary>
17643 </indexterm>
17644 When an address is being routed or delivered, and a
17645 specific prefix for the local part was recognized, it is available in this
17646 variable, having been removed from <varname>$local_part</varname>.
17647 </para>
17648 </listitem></varlistentry>
17649 <varlistentry>
17650 <term><varname>$local_part_suffix</varname></term>
17651 <listitem>
17652 <para>
17653 <indexterm role="variable">
17654 <primary><varname>$local_part_suffix</varname></primary>
17655 </indexterm>
17656 When an address is being routed or delivered, and a
17657 specific suffix for the local part was recognized, it is available in this
17658 variable, having been removed from <varname>$local_part</varname>.
17659 </para>
17660 </listitem></varlistentry>
17661 <varlistentry>
17662 <term><varname>$local_scan_data</varname></term>
17663 <listitem>
17664 <para>
17665 <indexterm role="variable">
17666 <primary><varname>$local_scan_data</varname></primary>
17667 </indexterm>
17668 This variable contains the text returned by the <function>local_scan()</function> function when
17669 a message is received. See chapter <xref linkend="CHAPlocalscan"/> for more details.
17670 </para>
17671 </listitem></varlistentry>
17672 <varlistentry>
17673 <term><varname>$local_user_gid</varname></term>
17674 <listitem>
17675 <para>
17676 <indexterm role="variable">
17677 <primary><varname>$local_user_gid</varname></primary>
17678 </indexterm>
17679 See <varname>$local_user_uid</varname>.
17680 </para>
17681 </listitem></varlistentry>
17682 <varlistentry>
17683 <term><varname>$local_user_uid</varname></term>
17684 <listitem>
17685 <para>
17686 <indexterm role="variable">
17687 <primary><varname>$local_user_uid</varname></primary>
17688 </indexterm>
17689 This variable and <varname>$local_user_gid</varname> are set to the uid and gid after the
17690 <option>check_local_user</option> router precondition succeeds. This means that their values
17691 are available for the remaining preconditions (<option>senders</option>, <option>require_files</option>,
17692 and <option>condition</option>), for the <option>address_data</option> expansion, and for any
17693 router-specific expansions. At all other times, the values in these variables
17694 are <literal>(uid_t)(-1)</literal> and <literal>(gid_t)(-1)</literal>, respectively.
17695 </para>
17696 </listitem></varlistentry>
17697 <varlistentry>
17698 <term><varname>$localhost_number</varname></term>
17699 <listitem>
17700 <para>
17701 <indexterm role="variable">
17702 <primary><varname>$localhost_number</varname></primary>
17703 </indexterm>
17704 This contains the expanded value of the
17705 <option>localhost_number</option> option. The expansion happens after the main options have
17706 been read.
17707 </para>
17708 </listitem></varlistentry>
17709 <varlistentry>
17710 <term><varname>$log_inodes</varname></term>
17711 <listitem>
17712 <para>
17713 <indexterm role="variable">
17714 <primary><varname>$log_inodes</varname></primary>
17715 </indexterm>
17716 The number of free inodes in the disk partition where Exim&#x2019;s
17717 log files are being written. The value is recalculated whenever the variable is
17718 referenced. If the relevant file system does not have the concept of inodes,
17719 the value of is -1. See also the <option>check_log_inodes</option> option.
17720 </para>
17721 </listitem></varlistentry>
17722 <varlistentry>
17723 <term><varname>$log_space</varname></term>
17724 <listitem>
17725 <para>
17726 <indexterm role="variable">
17727 <primary><varname>$log_space</varname></primary>
17728 </indexterm>
17729 The amount of free space (as a number of kilobytes) in the disk
17730 partition where Exim&#x2019;s log files are being written. The value is recalculated
17731 whenever the variable is referenced. If the operating system does not have the
17732 ability to find the amount of free space (only true for experimental systems),
17733 the space value is -1. See also the <option>check_log_space</option> option.
17734 </para>
17735 </listitem></varlistentry>
17736 <varlistentry>
17737 <term><varname>$lookup_dnssec_authenticated</varname></term>
17738 <listitem>
17739 <para>
17740 <indexterm role="variable">
17741 <primary><varname>$lookup_dnssec_authenticated</varname></primary>
17742 </indexterm>
17743 This variable is set after a DNS lookup done by
17744 a dnsdb lookup expansion, dnslookup router or smtp transport.
17745 It will be empty if <command>DNSSEC</command> was not requested,
17746 <quote>no</quote> if the result was not labelled as authenticated data
17747 and <quote>yes</quote> if it was.
17748 </para>
17749 </listitem></varlistentry>
17750 <varlistentry>
17751 <term><varname>$mailstore_basename</varname></term>
17752 <listitem>
17753 <para>
17754 <indexterm role="variable">
17755 <primary><varname>$mailstore_basename</varname></primary>
17756 </indexterm>
17757 This variable is set only when doing deliveries in <quote>mailstore</quote> format in the
17758 <command>appendfile</command> transport. During the expansion of the <option>mailstore_prefix</option>,
17759 <option>mailstore_suffix</option>, <option>message_prefix</option>, and <option>message_suffix</option> options, it
17760 contains the basename of the files that are being written, that is, the name
17761 without the <quote>.tmp</quote>, <quote>.env</quote>, or <quote>.msg</quote> suffix. At all other times, this
17762 variable is empty.
17763 </para>
17764 </listitem></varlistentry>
17765 <varlistentry>
17766 <term><varname>$malware_name</varname></term>
17767 <listitem>
17768 <para>
17769 <indexterm role="variable">
17770 <primary><varname>$malware_name</varname></primary>
17771 </indexterm>
17772 This variable is available when Exim is compiled with the
17773 content-scanning extension. It is set to the name of the virus that was found
17774 when the ACL <option>malware</option> condition is true (see section <xref linkend="SECTscanvirus"/>).
17775 </para>
17776 </listitem></varlistentry>
17777 <varlistentry>
17778 <term><varname>$max_received_linelength</varname></term>
17779 <listitem>
17780 <para>
17781 <indexterm role="variable">
17782 <primary><varname>$max_received_linelength</varname></primary>
17783 </indexterm>
17784 <indexterm role="concept">
17785 <primary>maximum</primary>
17786 <secondary>line length</secondary>
17787 </indexterm>
17788 <indexterm role="concept">
17789 <primary>line length</primary>
17790 <secondary>maximum</secondary>
17791 </indexterm>
17792 This variable contains the number of bytes in the longest line that was
17793 received as part of the message, not counting the line termination
17794 character(s).
17795 </para>
17796 </listitem></varlistentry>
17797 <varlistentry>
17798 <term><varname>$message_age</varname></term>
17799 <listitem>
17800 <para>
17801 <indexterm role="concept">
17802 <primary>message</primary>
17803 <secondary>age of</secondary>
17804 </indexterm>
17805 <indexterm role="variable">
17806 <primary><varname>$message_age</varname></primary>
17807 </indexterm>
17808 This variable is set at the start of a delivery attempt to contain the number
17809 of seconds since the message was received. It does not change during a single
17810 delivery attempt.
17811 </para>
17812 </listitem></varlistentry>
17813 <varlistentry>
17814 <term><varname>$message_body</varname></term>
17815 <listitem>
17816 <para>
17817 <indexterm role="concept">
17818 <primary>body of message</primary>
17819 <secondary>expansion variable</secondary>
17820 </indexterm>
17821 <indexterm role="concept">
17822 <primary>message body</primary>
17823 <secondary>in expansion</secondary>
17824 </indexterm>
17825 <indexterm role="concept">
17826 <primary>binary zero</primary>
17827 <secondary>in message body</secondary>
17828 </indexterm>
17829 <indexterm role="variable">
17830 <primary><varname>$message_body</varname></primary>
17831 </indexterm>
17832 <indexterm role="option">
17833 <primary><option>message_body_visible</option></primary>
17834 </indexterm>
17835 This variable contains the initial portion of a message&#x2019;s body while it is
17836 being delivered, and is intended mainly for use in filter files. The maximum
17837 number of characters of the body that are put into the variable is set by the
17838 <option>message_body_visible</option> configuration option; the default is 500.
17839 </para>
17840 <para>
17841 <indexterm role="option">
17842 <primary><option>message_body_newlines</option></primary>
17843 </indexterm>
17844 By default, newlines are converted into spaces in <varname>$message_body</varname>, to make it
17845 easier to search for phrases that might be split over a line break. However,
17846 this can be disabled by setting <option>message_body_newlines</option> to be true. Binary
17847 zeros are always converted into spaces.
17848 </para>
17849 </listitem></varlistentry>
17850 <varlistentry>
17851 <term><varname>$message_body_end</varname></term>
17852 <listitem>
17853 <para>
17854 <indexterm role="concept">
17855 <primary>body of message</primary>
17856 <secondary>expansion variable</secondary>
17857 </indexterm>
17858 <indexterm role="concept">
17859 <primary>message body</primary>
17860 <secondary>in expansion</secondary>
17861 </indexterm>
17862 <indexterm role="variable">
17863 <primary><varname>$message_body_end</varname></primary>
17864 </indexterm>
17865 This variable contains the final portion of a message&#x2019;s
17866 body while it is being delivered. The format and maximum size are as for
17867 <varname>$message_body</varname>.
17868 </para>
17869 </listitem></varlistentry>
17870 <varlistentry>
17871 <term><varname>$message_body_size</varname></term>
17872 <listitem>
17873 <para>
17874 <indexterm role="concept">
17875 <primary>body of message</primary>
17876 <secondary>size</secondary>
17877 </indexterm>
17878 <indexterm role="concept">
17879 <primary>message body</primary>
17880 <secondary>size</secondary>
17881 </indexterm>
17882 <indexterm role="variable">
17883 <primary><varname>$message_body_size</varname></primary>
17884 </indexterm>
17885 When a message is being delivered, this variable contains the size of the body
17886 in bytes. The count starts from the character after the blank line that
17887 separates the body from the header. Newlines are included in the count. See
17888 also <varname>$message_size</varname>, <varname>$body_linecount</varname>, and <varname>$body_zerocount</varname>.
17889 </para>
17890 </listitem></varlistentry>
17891 <varlistentry>
17892 <term><varname>$message_exim_id</varname></term>
17893 <listitem>
17894 <para>
17895 <indexterm role="variable">
17896 <primary><varname>$message_exim_id</varname></primary>
17897 </indexterm>
17898 When a message is being received or delivered, this variable contains the
17899 unique message id that is generated and used by Exim to identify the message.
17900 An id is not created for a message until after its header has been successfully
17901 received. <emphasis role="bold">Note</emphasis>: This is <emphasis>not</emphasis> the contents of the <emphasis>Message-ID:</emphasis> header
17902 line; it is the local id that Exim assigns to the message, for example:
17903 <literal>1BXTIK-0001yO-VA</literal>.
17904 </para>
17905 </listitem></varlistentry>
17906 <varlistentry>
17907 <term><varname>$message_headers</varname></term>
17908 <listitem>
17909 <para>
17910 <indexterm role="variable">
17911 <primary><varname>$message_headers</varname></primary>
17912 </indexterm>
17913 This variable contains a concatenation of all the header lines when a message
17914 is being processed, except for lines added by routers or transports. The header
17915 lines are separated by newline characters. Their contents are decoded in the
17916 same way as a header line that is inserted by <option>bheader</option>.
17917 </para>
17918 </listitem></varlistentry>
17919 <varlistentry>
17920 <term><varname>$message_headers_raw</varname></term>
17921 <listitem>
17922 <para>
17923 <indexterm role="variable">
17924 <primary><varname>$message_headers_raw</varname></primary>
17925 </indexterm>
17926 This variable is like <varname>$message_headers</varname> except that no processing of the
17927 contents of header lines is done.
17928 </para>
17929 </listitem></varlistentry>
17930 <varlistentry>
17931 <term><varname>$message_id</varname></term>
17932 <listitem>
17933 <para>
17934 This is an old name for <varname>$message_exim_id</varname>, which is now deprecated.
17935 </para>
17936 </listitem></varlistentry>
17937 <varlistentry>
17938 <term><varname>$message_linecount</varname></term>
17939 <listitem>
17940 <para>
17941 <indexterm role="variable">
17942 <primary><varname>$message_linecount</varname></primary>
17943 </indexterm>
17944 This variable contains the total number of lines in the header and body of the
17945 message. Compare <varname>$body_linecount</varname>, which is the count for the body only.
17946 During the DATA and content-scanning ACLs, <varname>$message_linecount</varname> contains the
17947 number of lines received. Before delivery happens (that is, before filters,
17948 routers, and transports run) the count is increased to include the
17949 <emphasis>Received:</emphasis> header line that Exim standardly adds, and also any other header
17950 lines that are added by ACLs. The blank line that separates the message header
17951 from the body is not counted.
17952 </para>
17953 <para>
17954 As with the special case of <varname>$message_size</varname>, during the expansion of the
17955 appendfile transport&#x2019;s maildir_tag option in maildir format, the value of
17956 <varname>$message_linecount</varname> is the precise size of the number of newlines in the
17957 file that has been written (minus one for the blank line between the
17958 header and the body).
17959 </para>
17960 <para>
17961 Here is an example of the use of this variable in a DATA ACL:
17962 </para>
17963 <literallayout class="monospaced">
17964 deny message   = Too many lines in message header
17965      condition = \
17966       ${if &lt;{250}{${eval:$message_linecount - $body_linecount}}}
17967 </literallayout>
17968 <para>
17969 In the MAIL and RCPT ACLs, the value is zero because at that stage the
17970 message has not yet been received.
17971 </para>
17972 </listitem></varlistentry>
17973 <varlistentry>
17974 <term><varname>$message_size</varname></term>
17975 <listitem>
17976 <para>
17977 <indexterm role="concept">
17978 <primary>size</primary>
17979 <secondary>of message</secondary>
17980 </indexterm>
17981 <indexterm role="concept">
17982 <primary>message</primary>
17983 <secondary>size</secondary>
17984 </indexterm>
17985 <indexterm role="variable">
17986 <primary><varname>$message_size</varname></primary>
17987 </indexterm>
17988 When a message is being processed, this variable contains its size in bytes. In
17989 most cases, the size includes those headers that were received with the
17990 message, but not those (such as <emphasis>Envelope-to:</emphasis>) that are added to individual
17991 deliveries as they are written. However, there is one special case: during the
17992 expansion of the <option>maildir_tag</option> option in the <command>appendfile</command> transport while
17993 doing a delivery in maildir format, the value of <varname>$message_size</varname> is the
17994 precise size of the file that has been written. See also
17995 <varname>$message_body_size</varname>, <varname>$body_linecount</varname>, and <varname>$body_zerocount</varname>.
17996 </para>
17997 <para>
17998 <indexterm role="concept">
17999 <primary>RCPT</primary>
18000 <secondary>value of <varname>$message_size</varname></secondary>
18001 </indexterm>
18002 While running a per message ACL (mail/rcpt/predata), <varname>$message_size</varname>
18003 contains the size supplied on the MAIL command, or -1 if no size was given. The
18004 value may not, of course, be truthful.
18005 </para>
18006 </listitem></varlistentry>
18007 <varlistentry>
18008 <term><varname>$mime_</varname><emphasis>xxx</emphasis></term>
18009 <listitem>
18010 <para>
18011 A number of variables whose names start with <varname>$mime</varname> are
18012 available when Exim is compiled with the content-scanning extension. For
18013 details, see section <xref linkend="SECTscanmimepart"/>.
18014 </para>
18015 </listitem></varlistentry>
18016 <varlistentry>
18017 <term><varname>$n0</varname> &ndash; <varname>$n9</varname></term>
18018 <listitem>
18019 <para>
18020 These variables are counters that can be incremented by means
18021 of the <option>add</option> command in filter files.
18022 </para>
18023 </listitem></varlistentry>
18024 <varlistentry>
18025 <term><varname>$original_domain</varname></term>
18026 <listitem>
18027 <para>
18028 <indexterm role="variable">
18029 <primary><varname>$domain</varname></primary>
18030 </indexterm>
18031 <indexterm role="variable">
18032 <primary><varname>$original_domain</varname></primary>
18033 </indexterm>
18034 When a top-level address is being processed for delivery, this contains the
18035 same value as <varname>$domain</varname>. However, if a <quote>child</quote> address (for example,
18036 generated by an alias, forward, or filter file) is being processed, this
18037 variable contains the domain of the original address (lower cased). This
18038 differs from <varname>$parent_domain</varname> only when there is more than one level of
18039 aliasing or forwarding. When more than one address is being delivered in a
18040 single transport run, <varname>$original_domain</varname> is not set.
18041 </para>
18042 <para>
18043 If a new address is created by means of a <option>deliver</option> command in a system
18044 filter, it is set up with an artificial <quote>parent</quote> address. This has the local
18045 part <emphasis>system-filter</emphasis> and the default qualify domain.
18046 </para>
18047 </listitem></varlistentry>
18048 <varlistentry>
18049 <term><varname>$original_local_part</varname></term>
18050 <listitem>
18051 <para>
18052 <indexterm role="variable">
18053 <primary><varname>$local_part</varname></primary>
18054 </indexterm>
18055 <indexterm role="variable">
18056 <primary><varname>$original_local_part</varname></primary>
18057 </indexterm>
18058 When a top-level address is being processed for delivery, this contains the
18059 same value as <varname>$local_part</varname>, unless a prefix or suffix was removed from the
18060 local part, because <varname>$original_local_part</varname> always contains the full local
18061 part. When a <quote>child</quote> address (for example, generated by an alias, forward, or
18062 filter file) is being processed, this variable contains the full local part of
18063 the original address.
18064 </para>
18065 <para>
18066 If the router that did the redirection processed the local part
18067 case-insensitively, the value in <varname>$original_local_part</varname> is in lower case.
18068 This variable differs from <varname>$parent_local_part</varname> only when there is more than
18069 one level of aliasing or forwarding. When more than one address is being
18070 delivered in a single transport run, <varname>$original_local_part</varname> is not set.
18071 </para>
18072 <para>
18073 If a new address is created by means of a <option>deliver</option> command in a system
18074 filter, it is set up with an artificial <quote>parent</quote> address. This has the local
18075 part <emphasis>system-filter</emphasis> and the default qualify domain.
18076 </para>
18077 </listitem></varlistentry>
18078 <varlistentry>
18079 <term><varname>$originator_gid</varname></term>
18080 <listitem>
18081 <para>
18082 <indexterm role="concept">
18083 <primary>gid (group id)</primary>
18084 <secondary>of originating user</secondary>
18085 </indexterm>
18086 <indexterm role="concept">
18087 <primary>sender</primary>
18088 <secondary>gid</secondary>
18089 </indexterm>
18090 <indexterm role="variable">
18091 <primary><varname>$caller_gid</varname></primary>
18092 </indexterm>
18093 <indexterm role="variable">
18094 <primary><varname>$originator_gid</varname></primary>
18095 </indexterm>
18096 This variable contains the value of <varname>$caller_gid</varname> that was set when the
18097 message was received. For messages received via the command line, this is the
18098 gid of the sending user. For messages received by SMTP over TCP/IP, this is
18099 normally the gid of the Exim user.
18100 </para>
18101 </listitem></varlistentry>
18102 <varlistentry>
18103 <term><varname>$originator_uid</varname></term>
18104 <listitem>
18105 <para>
18106 <indexterm role="concept">
18107 <primary>uid (user id)</primary>
18108 <secondary>of originating user</secondary>
18109 </indexterm>
18110 <indexterm role="concept">
18111 <primary>sender</primary>
18112 <secondary>uid</secondary>
18113 </indexterm>
18114 <indexterm role="variable">
18115 <primary><varname>$caller_uid</varname></primary>
18116 </indexterm>
18117 <indexterm role="variable">
18118 <primary><varname>$originaltor_uid</varname></primary>
18119 </indexterm>
18120 The value of <varname>$caller_uid</varname> that was set when the message was received. For
18121 messages received via the command line, this is the uid of the sending user.
18122 For messages received by SMTP over TCP/IP, this is normally the uid of the Exim
18123 user.
18124 </para>
18125 </listitem></varlistentry>
18126 <varlistentry>
18127 <term><varname>$parent_domain</varname></term>
18128 <listitem>
18129 <para>
18130 <indexterm role="variable">
18131 <primary><varname>$parent_domain</varname></primary>
18132 </indexterm>
18133 This variable is similar to <varname>$original_domain</varname> (see
18134 above), except that it refers to the immediately preceding parent address.
18135 </para>
18136 </listitem></varlistentry>
18137 <varlistentry>
18138 <term><varname>$parent_local_part</varname></term>
18139 <listitem>
18140 <para>
18141 <indexterm role="variable">
18142 <primary><varname>$parent_local_part</varname></primary>
18143 </indexterm>
18144 This variable is similar to <varname>$original_local_part</varname>
18145 (see above), except that it refers to the immediately preceding parent address.
18146 </para>
18147 </listitem></varlistentry>
18148 <varlistentry>
18149 <term><varname>$pid</varname></term>
18150 <listitem>
18151 <para>
18152 <indexterm role="concept">
18153 <primary>pid (process id)</primary>
18154 <secondary>of current process</secondary>
18155 </indexterm>
18156 <indexterm role="variable">
18157 <primary><varname>$pid</varname></primary>
18158 </indexterm>
18159 This variable contains the current process id.
18160 </para>
18161 </listitem></varlistentry>
18162 <varlistentry>
18163 <term><varname>$pipe_addresses</varname></term>
18164 <listitem>
18165 <para>
18166 <indexterm role="concept">
18167 <primary>filter</primary>
18168 <secondary>transport filter</secondary>
18169 </indexterm>
18170 <indexterm role="concept">
18171 <primary>transport</primary>
18172 <secondary>filter</secondary>
18173 </indexterm>
18174 <indexterm role="variable">
18175 <primary><varname>$pipe_addresses</varname></primary>
18176 </indexterm>
18177 This is not an expansion variable, but is mentioned here because the string
18178 <literal>$pipe_addresses</literal> is handled specially in the command specification for the
18179 <command>pipe</command> transport (chapter <xref linkend="CHAPpipetransport"/>) and in transport filters
18180 (described under <option>transport_filter</option> in chapter <xref linkend="CHAPtransportgeneric"/>).
18181 It cannot be used in general expansion strings, and provokes an <quote>unknown
18182 variable</quote> error if encountered.
18183 </para>
18184 </listitem></varlistentry>
18185 <varlistentry>
18186 <term><varname>$primary_hostname</varname></term>
18187 <listitem>
18188 <para>
18189 <indexterm role="variable">
18190 <primary><varname>$primary_hostname</varname></primary>
18191 </indexterm>
18192 This variable contains the value set by <option>primary_hostname</option> in the
18193 configuration file, or read by the <function>uname()</function> function. If <function>uname()</function> returns
18194 a single-component name, Exim calls <function>gethostbyname()</function> (or
18195 <function>getipnodebyname()</function> where available) in an attempt to acquire a fully
18196 qualified host name. See also <varname>$smtp_active_hostname</varname>.
18197 </para>
18198 </listitem></varlistentry>
18199 <varlistentry>
18200 <term><varname>$prvscheck_address</varname></term>
18201 <listitem>
18202 <para>
18203 This variable is used in conjunction with the <option>prvscheck</option> expansion item,
18204 which is described in sections <xref linkend="SECTexpansionitems"/> and
18205 <xref linkend="SECTverifyPRVS"/>.
18206 </para>
18207 </listitem></varlistentry>
18208 <varlistentry>
18209 <term><varname>$prvscheck_keynum</varname></term>
18210 <listitem>
18211 <para>
18212 This variable is used in conjunction with the <option>prvscheck</option> expansion item,
18213 which is described in sections <xref linkend="SECTexpansionitems"/> and
18214 <xref linkend="SECTverifyPRVS"/>.
18215 </para>
18216 </listitem></varlistentry>
18217 <varlistentry>
18218 <term><varname>$prvscheck_result</varname></term>
18219 <listitem>
18220 <para>
18221 This variable is used in conjunction with the <option>prvscheck</option> expansion item,
18222 which is described in sections <xref linkend="SECTexpansionitems"/> and
18223 <xref linkend="SECTverifyPRVS"/>.
18224 </para>
18225 </listitem></varlistentry>
18226 <varlistentry>
18227 <term><varname>$qualify_domain</varname></term>
18228 <listitem>
18229 <para>
18230 <indexterm role="variable">
18231 <primary><varname>$qualify_domain</varname></primary>
18232 </indexterm>
18233 The value set for the <option>qualify_domain</option> option in the configuration file.
18234 </para>
18235 </listitem></varlistentry>
18236 <varlistentry>
18237 <term><varname>$qualify_recipient</varname></term>
18238 <listitem>
18239 <para>
18240 <indexterm role="variable">
18241 <primary><varname>$qualify_recipient</varname></primary>
18242 </indexterm>
18243 The value set for the <option>qualify_recipient</option> option in the configuration file,
18244 or if not set, the value of <varname>$qualify_domain</varname>.
18245 </para>
18246 </listitem></varlistentry>
18247 <varlistentry>
18248 <term><varname>$rcpt_count</varname></term>
18249 <listitem>
18250 <para>
18251 <indexterm role="variable">
18252 <primary><varname>$rcpt_count</varname></primary>
18253 </indexterm>
18254 When a message is being received by SMTP, this variable contains the number of
18255 RCPT commands received for the current message. If this variable is used in a
18256 RCPT ACL, its value includes the current command.
18257 </para>
18258 </listitem></varlistentry>
18259 <varlistentry>
18260 <term><varname>$rcpt_defer_count</varname></term>
18261 <listitem>
18262 <para>
18263 <indexterm role="variable">
18264 <primary><varname>$rcpt_defer_count</varname></primary>
18265 </indexterm>
18266 <indexterm role="concept">
18267 <primary>4<emphasis>xx</emphasis> responses</primary>
18268 <secondary>count of</secondary>
18269 </indexterm>
18270 When a message is being received by SMTP, this variable contains the number of
18271 RCPT commands in the current message that have previously been rejected with a
18272 temporary (4<emphasis>xx</emphasis>) response.
18273 </para>
18274 </listitem></varlistentry>
18275 <varlistentry>
18276 <term><varname>$rcpt_fail_count</varname></term>
18277 <listitem>
18278 <para>
18279 <indexterm role="variable">
18280 <primary><varname>$rcpt_fail_count</varname></primary>
18281 </indexterm>
18282 When a message is being received by SMTP, this variable contains the number of
18283 RCPT commands in the current message that have previously been rejected with a
18284 permanent (5<emphasis>xx</emphasis>) response.
18285 </para>
18286 </listitem></varlistentry>
18287 <varlistentry>
18288 <term><varname>$received_count</varname></term>
18289 <listitem>
18290 <para>
18291 <indexterm role="variable">
18292 <primary><varname>$received_count</varname></primary>
18293 </indexterm>
18294 This variable contains the number of <emphasis>Received:</emphasis> header lines in the message,
18295 including the one added by Exim (so its value is always greater than zero). It
18296 is available in the DATA ACL, the non-SMTP ACL, and while routing and
18297 delivering.
18298 </para>
18299 </listitem></varlistentry>
18300 <varlistentry>
18301 <term><varname>$received_for</varname></term>
18302 <listitem>
18303 <para>
18304 <indexterm role="variable">
18305 <primary><varname>$received_for</varname></primary>
18306 </indexterm>
18307 If there is only a single recipient address in an incoming message, this
18308 variable contains that address when the <emphasis>Received:</emphasis> header line is being
18309 built. The value is copied after recipient rewriting has happened, but before
18310 the <function>local_scan()</function> function is run.
18311 </para>
18312 </listitem></varlistentry>
18313 <varlistentry>
18314 <term><varname>$received_ip_address</varname></term>
18315 <listitem>
18316 <para>
18317 <indexterm role="variable">
18318 <primary><varname>$received_ip_address</varname></primary>
18319 </indexterm>
18320 As soon as an Exim server starts processing an incoming TCP/IP connection, this
18321 variable is set to the address of the local IP interface, and <varname>$received_port</varname>
18322 is set to the local port number. (The remote IP address and port are in
18323 <varname>$sender_host_address</varname> and <varname>$sender_host_port</varname>.) When testing with <option>-bh</option>,
18324 the port value is -1 unless it has been set using the <option>-oMi</option> command line
18325 option.
18326 </para>
18327 <para>
18328 As well as being useful in ACLs (including the <quote>connect</quote> ACL), these variable
18329 could be used, for example, to make the file name for a TLS certificate depend
18330 on which interface and/or port is being used for the incoming connection. The
18331 values of <varname>$received_ip_address</varname> and <varname>$received_port</varname> are saved with any
18332 messages that are received, thus making these variables available at delivery
18333 time.
18334 </para>
18335 <para>
18336 <emphasis role="bold">Note:</emphasis> There are no equivalent variables for outgoing connections, because
18337 the values are unknown (unless they are explicitly set by options of the
18338 <command>smtp</command> transport).
18339 </para>
18340 </listitem></varlistentry>
18341 <varlistentry>
18342 <term><varname>$received_port</varname></term>
18343 <listitem>
18344 <para>
18345 <indexterm role="variable">
18346 <primary><varname>$received_port</varname></primary>
18347 </indexterm>
18348 See <varname>$received_ip_address</varname>.
18349 </para>
18350 </listitem></varlistentry>
18351 <varlistentry>
18352 <term><varname>$received_protocol</varname></term>
18353 <listitem>
18354 <para>
18355 <indexterm role="variable">
18356 <primary><varname>$received_protocol</varname></primary>
18357 </indexterm>
18358 When a message is being processed, this variable contains the name of the
18359 protocol by which it was received. Most of the names used by Exim are defined
18360 by RFCs 821, 2821, and 3848. They start with <quote>smtp</quote> (the client used HELO) or
18361 <quote>esmtp</quote> (the client used EHLO). This can be followed by <quote>s</quote> for secure
18362 (encrypted) and/or <quote>a</quote> for authenticated. Thus, for example, if the protocol
18363 is set to <quote>esmtpsa</quote>, the message was received over an encrypted SMTP
18364 connection and the client was successfully authenticated.
18365 </para>
18366 <para>
18367 Exim uses the protocol name <quote>smtps</quote> for the case when encryption is
18368 automatically set up on connection without the use of STARTTLS (see
18369 <option>tls_on_connect_ports</option>), and the client uses HELO to initiate the
18370 encrypted SMTP session. The name <quote>smtps</quote> is also used for the rare situation
18371 where the client initially uses EHLO, sets up an encrypted connection using
18372 STARTTLS, and then uses HELO afterwards.
18373 </para>
18374 <para>
18375 The <option>-oMr</option> option provides a way of specifying a custom protocol name for
18376 messages that are injected locally by trusted callers. This is commonly used to
18377 identify messages that are being re-injected after some kind of scanning.
18378 </para>
18379 </listitem></varlistentry>
18380 <varlistentry>
18381 <term><varname>$received_time</varname></term>
18382 <listitem>
18383 <para>
18384 <indexterm role="variable">
18385 <primary><varname>$received_time</varname></primary>
18386 </indexterm>
18387 This variable contains the date and time when the current message was received,
18388 as a number of seconds since the start of the Unix epoch.
18389 </para>
18390 </listitem></varlistentry>
18391 <varlistentry>
18392 <term><varname>$recipient_data</varname></term>
18393 <listitem>
18394 <para>
18395 <indexterm role="variable">
18396 <primary><varname>$recipient_data</varname></primary>
18397 </indexterm>
18398 This variable is set after an indexing lookup success in an ACL <option>recipients</option>
18399 condition. It contains the data from the lookup, and the value remains set
18400 until the next <option>recipients</option> test. Thus, you can do things like this:
18401 </para>
18402 <literallayout>
18403 <literal>require recipients  = cdb*@;/some/file</literal>
18404 <literal>deny    </literal><emphasis>some further test involving</emphasis> <literal>$recipient_data</literal>
18405 </literallayout>
18406 <para>
18407 <emphasis role="bold">Warning</emphasis>: This variable is set only when a lookup is used as an indexing
18408 method in the address list, using the semicolon syntax as in the example above.
18409 The variable is not set for a lookup that is used as part of the string
18410 expansion that all such lists undergo before being interpreted.
18411 </para>
18412 </listitem></varlistentry>
18413 <varlistentry>
18414 <term><varname>$recipient_verify_failure</varname></term>
18415 <listitem>
18416 <para>
18417 <indexterm role="variable">
18418 <primary><varname>$recipient_verify_failure</varname></primary>
18419 </indexterm>
18420 In an ACL, when a recipient verification fails, this variable contains
18421 information about the failure. It is set to one of the following words:
18422 </para>
18423 <itemizedlist>
18424 <listitem>
18425 <para>
18426 <quote>qualify</quote>: The address was unqualified (no domain), and the message
18427 was neither local nor came from an exempted host.
18428 </para>
18429 </listitem>
18430 <listitem>
18431 <para>
18432 <quote>route</quote>: Routing failed.
18433 </para>
18434 </listitem>
18435 <listitem>
18436 <para>
18437 <quote>mail</quote>: Routing succeeded, and a callout was attempted; rejection occurred at
18438 or before the MAIL command (that is, on initial connection, HELO, or
18439 MAIL).
18440 </para>
18441 </listitem>
18442 <listitem>
18443 <para>
18444 <quote>recipient</quote>: The RCPT command in a callout was rejected.
18445 </para>
18446 </listitem>
18447 <listitem>
18448 <para>
18449 <quote>postmaster</quote>: The postmaster check in a callout was rejected.
18450 </para>
18451 </listitem>
18452 </itemizedlist>
18453 <para>
18454 The main use of this variable is expected to be to distinguish between
18455 rejections of MAIL and rejections of RCPT.
18456 </para>
18457 </listitem></varlistentry>
18458 <varlistentry>
18459 <term><varname>$recipients</varname></term>
18460 <listitem>
18461 <para>
18462 <indexterm role="variable">
18463 <primary><varname>$recipients</varname></primary>
18464 </indexterm>
18465 This variable contains a list of envelope recipients for a message. A comma and
18466 a space separate the addresses in the replacement text. However, the variable
18467 is not generally available, to prevent exposure of Bcc recipients in
18468 unprivileged users&#x2019; filter files. You can use <varname>$recipients</varname> only in these
18469 cases:
18470 </para>
18471 <orderedlist numeration="arabic">
18472 <listitem>
18473 <para>
18474 In a system filter file.
18475 </para>
18476 </listitem>
18477 <listitem>
18478 <para>
18479 In the ACLs associated with the DATA command and with non-SMTP messages, that
18480 is, the ACLs defined by <option>acl_smtp_predata</option>, <option>acl_smtp_data</option>,
18481 <option>acl_smtp_mime</option>, <option>acl_not_smtp_start</option>, <option>acl_not_smtp</option>, and
18482 <option>acl_not_smtp_mime</option>.
18483 </para>
18484 </listitem>
18485 <listitem>
18486 <para>
18487 From within a <function>local_scan()</function> function.
18488 </para>
18489 </listitem>
18490 </orderedlist>
18491 </listitem></varlistentry>
18492 <varlistentry>
18493 <term><varname>$recipients_count</varname></term>
18494 <listitem>
18495 <para>
18496 <indexterm role="variable">
18497 <primary><varname>$recipients_count</varname></primary>
18498 </indexterm>
18499 When a message is being processed, this variable contains the number of
18500 envelope recipients that came with the message. Duplicates are not excluded
18501 from the count. While a message is being received over SMTP, the number
18502 increases for each accepted recipient. It can be referenced in an ACL.
18503 </para>
18504 </listitem></varlistentry>
18505 <varlistentry>
18506 <term><varname>$regex_match_string</varname></term>
18507 <listitem>
18508 <para>
18509 <indexterm role="variable">
18510 <primary><varname>$regex_match_string</varname></primary>
18511 </indexterm>
18512 This variable is set to contain the matching regular expression after a
18513 <option>regex</option> ACL condition has matched (see section <xref linkend="SECTscanregex"/>).
18514 </para>
18515 </listitem></varlistentry>
18516 <varlistentry>
18517 <term><varname>$reply_address</varname></term>
18518 <listitem>
18519 <para>
18520 <indexterm role="variable">
18521 <primary><varname>$reply_address</varname></primary>
18522 </indexterm>
18523 When a message is being processed, this variable contains the contents of the
18524 <emphasis>Reply-To:</emphasis> header line if one exists and it is not empty, or otherwise the
18525 contents of the <emphasis>From:</emphasis> header line. Apart from the removal of leading
18526 white space, the value is not processed in any way. In particular, no RFC 2047
18527 decoding or character code translation takes place.
18528 </para>
18529 </listitem></varlistentry>
18530 <varlistentry>
18531 <term><varname>$return_path</varname></term>
18532 <listitem>
18533 <para>
18534 <indexterm role="variable">
18535 <primary><varname>$return_path</varname></primary>
18536 </indexterm>
18537 When a message is being delivered, this variable contains the return path &ndash;
18538 the sender field that will be sent as part of the envelope. It is not enclosed
18539 in &lt;&gt; characters. At the start of routing an address, <varname>$return_path</varname> has the
18540 same value as <varname>$sender_address</varname>, but if, for example, an incoming message to a
18541 mailing list has been expanded by a router which specifies a different address
18542 for bounce messages, <varname>$return_path</varname> subsequently contains the new bounce
18543 address, whereas <varname>$sender_address</varname> always contains the original sender address
18544 that was received with the message. In other words, <varname>$sender_address</varname> contains
18545 the incoming envelope sender, and <varname>$return_path</varname> contains the outgoing
18546 envelope sender.
18547 </para>
18548 </listitem></varlistentry>
18549 <varlistentry>
18550 <term><varname>$return_size_limit</varname></term>
18551 <listitem>
18552 <para>
18553 <indexterm role="variable">
18554 <primary><varname>$return_size_limit</varname></primary>
18555 </indexterm>
18556 This is an obsolete name for <varname>$bounce_return_size_limit</varname>.
18557 </para>
18558 </listitem></varlistentry>
18559 <varlistentry>
18560 <term><varname>$router_name</varname></term>
18561 <listitem>
18562 <para>
18563 <indexterm role="concept">
18564 <primary>router</primary>
18565 <secondary>name</secondary>
18566 </indexterm>
18567 <indexterm role="concept">
18568 <primary>name</primary>
18569 <secondary>of router</secondary>
18570 </indexterm>
18571 <indexterm role="variable">
18572 <primary><varname>$router_name</varname></primary>
18573 </indexterm>
18574 During the running of a router this variable contains its name.
18575 </para>
18576 </listitem></varlistentry>
18577 <varlistentry>
18578 <term><varname>$runrc</varname></term>
18579 <listitem>
18580 <para>
18581 <indexterm role="concept">
18582 <primary>return code</primary>
18583 <secondary>from <option>run</option> expansion</secondary>
18584 </indexterm>
18585 <indexterm role="variable">
18586 <primary><varname>$runrc</varname></primary>
18587 </indexterm>
18588 This variable contains the return code from a command that is run by the
18589 <option>${run...}</option> expansion item. <emphasis role="bold">Warning</emphasis>: In a router or transport, you cannot
18590 assume the order in which option values are expanded, except for those
18591 preconditions whose order of testing is documented. Therefore, you cannot
18592 reliably expect to set <varname>$runrc</varname> by the expansion of one option, and use it in
18593 another.
18594 </para>
18595 </listitem></varlistentry>
18596 <varlistentry>
18597 <term><varname>$self_hostname</varname></term>
18598 <listitem>
18599 <para>
18600 <indexterm role="option">
18601 <primary><option>self</option></primary>
18602 <secondary>value of host name</secondary>
18603 </indexterm>
18604 <indexterm role="variable">
18605 <primary><varname>$self_hostname</varname></primary>
18606 </indexterm>
18607 When an address is routed to a supposedly remote host that turns out to be the
18608 local host, what happens is controlled by the <option>self</option> generic router option.
18609 One of its values causes the address to be passed to another router. When this
18610 happens, <varname>$self_hostname</varname> is set to the name of the local host that the
18611 original router encountered. In other circumstances its contents are null.
18612 </para>
18613 </listitem></varlistentry>
18614 <varlistentry>
18615 <term><varname>$sender_address</varname></term>
18616 <listitem>
18617 <para>
18618 <indexterm role="variable">
18619 <primary><varname>$sender_address</varname></primary>
18620 </indexterm>
18621 When a message is being processed, this variable contains the sender&#x2019;s address
18622 that was received in the message&#x2019;s envelope. The case of letters in the address
18623 is retained, in both the local part and the domain. For bounce messages, the
18624 value of this variable is the empty string. See also <varname>$return_path</varname>.
18625 </para>
18626 </listitem></varlistentry>
18627 <varlistentry>
18628 <term><varname>$sender_address_data</varname></term>
18629 <listitem>
18630 <para>
18631 <indexterm role="variable">
18632 <primary><varname>$address_data</varname></primary>
18633 </indexterm>
18634 <indexterm role="variable">
18635 <primary><varname>$sender_address_data</varname></primary>
18636 </indexterm>
18637 If <varname>$address_data</varname> is set when the routers are called from an ACL to verify a
18638 sender address, the final value is preserved in <varname>$sender_address_data</varname>, to
18639 distinguish it from data from a recipient address. The value does not persist
18640 after the end of the current ACL statement. If you want to preserve it for
18641 longer, you can save it in an ACL variable.
18642 </para>
18643 </listitem></varlistentry>
18644 <varlistentry>
18645 <term><varname>$sender_address_domain</varname></term>
18646 <listitem>
18647 <para>
18648 <indexterm role="variable">
18649 <primary><varname>$sender_address_domain</varname></primary>
18650 </indexterm>
18651 The domain portion of <varname>$sender_address</varname>.
18652 </para>
18653 </listitem></varlistentry>
18654 <varlistentry>
18655 <term><varname>$sender_address_local_part</varname></term>
18656 <listitem>
18657 <para>
18658 <indexterm role="variable">
18659 <primary><varname>$sender_address_local_part</varname></primary>
18660 </indexterm>
18661 The local part portion of <varname>$sender_address</varname>.
18662 </para>
18663 </listitem></varlistentry>
18664 <varlistentry>
18665 <term><varname>$sender_data</varname></term>
18666 <listitem>
18667 <para>
18668 <indexterm role="variable">
18669 <primary><varname>$sender_data</varname></primary>
18670 </indexterm>
18671 This variable is set after a lookup success in an ACL <option>senders</option> condition or
18672 in a router <option>senders</option> option. It contains the data from the lookup, and the
18673 value remains set until the next <option>senders</option> test. Thus, you can do things like
18674 this:
18675 </para>
18676 <literallayout>
18677 <literal>require senders      = cdb*@;/some/file</literal>
18678 <literal>deny    </literal><emphasis>some further test involving</emphasis> <literal>$sender_data</literal>
18679 </literallayout>
18680 <para>
18681 <emphasis role="bold">Warning</emphasis>: This variable is set only when a lookup is used as an indexing
18682 method in the address list, using the semicolon syntax as in the example above.
18683 The variable is not set for a lookup that is used as part of the string
18684 expansion that all such lists undergo before being interpreted.
18685 </para>
18686 </listitem></varlistentry>
18687 <varlistentry>
18688 <term><varname>$sender_fullhost</varname></term>
18689 <listitem>
18690 <para>
18691 <indexterm role="variable">
18692 <primary><varname>$sender_fullhost</varname></primary>
18693 </indexterm>
18694 When a message is received from a remote host, this variable contains the host
18695 name and IP address in a single string. It ends with the IP address in square
18696 brackets, followed by a colon and a port number if the logging of ports is
18697 enabled. The format of the rest of the string depends on whether the host
18698 issued a HELO or EHLO SMTP command, and whether the host name was verified by
18699 looking up its IP address. (Looking up the IP address can be forced by the
18700 <option>host_lookup</option> option, independent of verification.) A plain host name at the
18701 start of the string is a verified host name; if this is not present,
18702 verification either failed or was not requested. A host name in parentheses is
18703 the argument of a HELO or EHLO command. This is omitted if it is identical to
18704 the verified host name or to the host&#x2019;s IP address in square brackets.
18705 </para>
18706 </listitem></varlistentry>
18707 <varlistentry>
18708 <term><varname>$sender_helo_name</varname></term>
18709 <listitem>
18710 <para>
18711 <indexterm role="variable">
18712 <primary><varname>$sender_helo_name</varname></primary>
18713 </indexterm>
18714 When a message is received from a remote host that has issued a HELO or EHLO
18715 command, the argument of that command is placed in this variable. It is also
18716 set if HELO or EHLO is used when a message is received using SMTP locally via
18717 the <option>-bs</option> or <option>-bS</option> options.
18718 </para>
18719 </listitem></varlistentry>
18720 <varlistentry>
18721 <term><varname>$sender_host_address</varname></term>
18722 <listitem>
18723 <para>
18724 <indexterm role="variable">
18725 <primary><varname>$sender_host_address</varname></primary>
18726 </indexterm>
18727 When a message is received from a remote host, this variable contains that
18728 host&#x2019;s IP address. For locally submitted messages, it is empty.
18729 </para>
18730 </listitem></varlistentry>
18731 <varlistentry>
18732 <term><varname>$sender_host_authenticated</varname></term>
18733 <listitem>
18734 <para>
18735 <indexterm role="variable">
18736 <primary><varname>$sender_host_authenticated</varname></primary>
18737 </indexterm>
18738 This variable contains the name (not the public name) of the authenticator
18739 driver that successfully authenticated the client from which the message was
18740 received. It is empty if there was no successful authentication. See also
18741 <varname>$authenticated_id</varname>.
18742 </para>
18743 </listitem></varlistentry>
18744 <varlistentry>
18745 <term><varname>$sender_host_dnssec</varname></term>
18746 <listitem>
18747 <para>
18748 <indexterm role="variable">
18749 <primary><varname>$sender_host_dnssec</varname></primary>
18750 </indexterm>
18751 If an attempt to populate <varname>$sender_host_name</varname> has been made
18752 (by reference, <option>hosts_lookup</option> or
18753 otherwise) then this boolean will have been set true if, and only if, the
18754 resolver library states that the reverse DNS was authenticated data.  At all
18755 other times, this variable is false.
18756 </para>
18757 <para>
18758 It is likely that you will need to coerce DNSSEC support on in the resolver
18759 library, by setting:
18760 </para>
18761 <literallayout class="monospaced">
18762 dns_dnssec_ok = 1
18763 </literallayout>
18764 <para>
18765 Exim does not perform DNSSEC validation itself, instead leaving that to a
18766 validating resolver (eg, unbound, or bind with suitable configuration).
18767 </para>
18768 <para>
18769 Exim does not (currently) check to see if the forward DNS was also secured
18770 with DNSSEC, only the reverse DNS.
18771 </para>
18772 <para>
18773 If you have changed <option>host_lookup_order</option> so that <literal>bydns</literal> is not the first
18774 mechanism in the list, then this variable will be false.
18775 </para>
18776 </listitem></varlistentry>
18777 <varlistentry>
18778 <term><varname>$sender_host_name</varname></term>
18779 <listitem>
18780 <para>
18781 <indexterm role="variable">
18782 <primary><varname>$sender_host_name</varname></primary>
18783 </indexterm>
18784 When a message is received from a remote host, this variable contains the
18785 host&#x2019;s name as obtained by looking up its IP address. For messages received by
18786 other means, this variable is empty.
18787 </para>
18788 <para>
18789 <indexterm role="variable">
18790 <primary><varname>$host_lookup_failed</varname></primary>
18791 </indexterm>
18792 If the host name has not previously been looked up, a reference to
18793 <varname>$sender_host_name</varname> triggers a lookup (for messages from remote hosts).
18794 A looked up name is accepted only if it leads back to the original IP address
18795 via a forward lookup. If either the reverse or the forward lookup fails to find
18796 any data, or if the forward lookup does not yield the original IP address,
18797 <varname>$sender_host_name</varname> remains empty, and <varname>$host_lookup_failed</varname> is set to <quote>1</quote>.
18798 </para>
18799 <para>
18800 <indexterm role="variable">
18801 <primary><varname>$host_lookup_deferred</varname></primary>
18802 </indexterm>
18803 However, if either of the lookups cannot be completed (for example, there is a
18804 DNS timeout), <varname>$host_lookup_deferred</varname> is set to <quote>1</quote>, and
18805 <varname>$host_lookup_failed</varname> remains set to <quote>0</quote>.
18806 </para>
18807 <para>
18808 Once <varname>$host_lookup_failed</varname> is set to <quote>1</quote>, Exim does not try to look up the
18809 host name again if there is a subsequent reference to <varname>$sender_host_name</varname>
18810 in the same Exim process, but it does try again if <varname>$host_lookup_deferred</varname>
18811 is set to <quote>1</quote>.
18812 </para>
18813 <para>
18814 Exim does not automatically look up every calling host&#x2019;s name. If you want
18815 maximum efficiency, you should arrange your configuration so that it avoids
18816 these lookups altogether. The lookup happens only if one or more of the
18817 following are true:
18818 </para>
18819 <itemizedlist>
18820 <listitem>
18821 <para>
18822 A string containing <varname>$sender_host_name</varname> is expanded.
18823 </para>
18824 </listitem>
18825 <listitem>
18826 <para>
18827 The calling host matches the list in <option>host_lookup</option>. In the default
18828 configuration, this option is set to *, so it must be changed if lookups are
18829 to be avoided. (In the code, the default for <option>host_lookup</option> is unset.)
18830 </para>
18831 </listitem>
18832 <listitem>
18833 <para>
18834 Exim needs the host name in order to test an item in a host list. The items
18835 that require this are described in sections <xref linkend="SECThoslispatnam"/> and
18836 <xref linkend="SECThoslispatnamsk"/>.
18837 </para>
18838 </listitem>
18839 <listitem>
18840 <para>
18841 The calling host matches <option>helo_try_verify_hosts</option> or <option>helo_verify_hosts</option>.
18842 In this case, the host name is required to compare with the name quoted in any
18843 EHLO or HELO commands that the client issues.
18844 </para>
18845 </listitem>
18846 <listitem>
18847 <para>
18848 The remote host issues a EHLO or HELO command that quotes one of the
18849 domains in <option>helo_lookup_domains</option>. The default value of this option is
18850 </para>
18851 <literallayout class="monospaced">
18852   helo_lookup_domains = @ : @[]
18853 </literallayout>
18854 <para>
18855 which causes a lookup if a remote host (incorrectly) gives the server&#x2019;s name or
18856 IP address in an EHLO or HELO command.
18857 </para>
18858 </listitem>
18859 </itemizedlist>
18860 </listitem></varlistentry>
18861 <varlistentry>
18862 <term><varname>$sender_host_port</varname></term>
18863 <listitem>
18864 <para>
18865 <indexterm role="variable">
18866 <primary><varname>$sender_host_port</varname></primary>
18867 </indexterm>
18868 When a message is received from a remote host, this variable contains the port
18869 number that was used on the remote host.
18870 </para>
18871 </listitem></varlistentry>
18872 <varlistentry>
18873 <term><varname>$sender_ident</varname></term>
18874 <listitem>
18875 <para>
18876 <indexterm role="variable">
18877 <primary><varname>$sender_ident</varname></primary>
18878 </indexterm>
18879 When a message is received from a remote host, this variable contains the
18880 identification received in response to an RFC 1413 request. When a message has
18881 been received locally, this variable contains the login name of the user that
18882 called Exim.
18883 </para>
18884 </listitem></varlistentry>
18885 <varlistentry>
18886 <term><varname>$sender_rate_</varname><emphasis>xxx</emphasis></term>
18887 <listitem>
18888 <para>
18889 A number of variables whose names begin <varname>$sender_rate_</varname> are set as part of the
18890 <option>ratelimit</option> ACL condition. Details are given in section
18891 <xref linkend="SECTratelimiting"/>.
18892 </para>
18893 </listitem></varlistentry>
18894 <varlistentry>
18895 <term><varname>$sender_rcvhost</varname></term>
18896 <listitem>
18897 <para>
18898 <indexterm role="concept">
18899 <primary>DNS</primary>
18900 <secondary>reverse lookup</secondary>
18901 </indexterm>
18902 <indexterm role="concept">
18903 <primary>reverse DNS lookup</primary>
18904 </indexterm>
18905 <indexterm role="variable">
18906 <primary><varname>$sender_rcvhost</varname></primary>
18907 </indexterm>
18908 This is provided specifically for use in <emphasis>Received:</emphasis> headers. It starts with
18909 either the verified host name (as obtained from a reverse DNS lookup) or, if
18910 there is no verified host name, the IP address in square brackets. After that
18911 there may be text in parentheses. When the first item is a verified host name,
18912 the first thing in the parentheses is the IP address in square brackets,
18913 followed by a colon and a port number if port logging is enabled. When the
18914 first item is an IP address, the port is recorded as <quote>port=<emphasis>xxxx</emphasis></quote> inside
18915 the parentheses.
18916 </para>
18917 <para>
18918 There may also be items of the form <quote>helo=<emphasis>xxxx</emphasis></quote> if HELO or EHLO
18919 was used and its argument was not identical to the real host name or IP
18920 address, and <quote>ident=<emphasis>xxxx</emphasis></quote> if an RFC 1413 ident string is available. If
18921 all three items are present in the parentheses, a newline and tab are inserted
18922 into the string, to improve the formatting of the <emphasis>Received:</emphasis> header.
18923 </para>
18924 </listitem></varlistentry>
18925 <varlistentry>
18926 <term><varname>$sender_verify_failure</varname></term>
18927 <listitem>
18928 <para>
18929 <indexterm role="variable">
18930 <primary><varname>$sender_verify_failure</varname></primary>
18931 </indexterm>
18932 In an ACL, when a sender verification fails, this variable contains information
18933 about the failure. The details are the same as for
18934 <varname>$recipient_verify_failure</varname>.
18935 </para>
18936 </listitem></varlistentry>
18937 <varlistentry>
18938 <term><varname>$sending_ip_address</varname></term>
18939 <listitem>
18940 <para>
18941 <indexterm role="variable">
18942 <primary><varname>$sending_ip_address</varname></primary>
18943 </indexterm>
18944 This variable is set whenever an outgoing SMTP connection to another host has
18945 been set up. It contains the IP address of the local interface that is being
18946 used. This is useful if a host that has more than one IP address wants to take
18947 on different personalities depending on which one is being used. For incoming
18948 connections, see <varname>$received_ip_address</varname>.
18949 </para>
18950 </listitem></varlistentry>
18951 <varlistentry>
18952 <term><varname>$sending_port</varname></term>
18953 <listitem>
18954 <para>
18955 <indexterm role="variable">
18956 <primary><varname>$sending_port</varname></primary>
18957 </indexterm>
18958 This variable is set whenever an outgoing SMTP connection to another host has
18959 been set up. It contains the local port that is being used. For incoming
18960 connections, see <varname>$received_port</varname>.
18961 </para>
18962 </listitem></varlistentry>
18963 <varlistentry>
18964 <term><varname>$smtp_active_hostname</varname></term>
18965 <listitem>
18966 <para>
18967 <indexterm role="variable">
18968 <primary><varname>$smtp_active_hostname</varname></primary>
18969 </indexterm>
18970 During an incoming SMTP session, this variable contains the value of the active
18971 host name, as specified by the <option>smtp_active_hostname</option> option. The value of
18972 <varname>$smtp_active_hostname</varname> is saved with any message that is received, so its
18973 value can be consulted during routing and delivery.
18974 </para>
18975 </listitem></varlistentry>
18976 <varlistentry>
18977 <term><varname>$smtp_command</varname></term>
18978 <listitem>
18979 <para>
18980 <indexterm role="variable">
18981 <primary><varname>$smtp_command</varname></primary>
18982 </indexterm>
18983 During the processing of an incoming SMTP command, this variable contains the
18984 entire command. This makes it possible to distinguish between HELO and EHLO in
18985 the HELO ACL, and also to distinguish between commands such as these:
18986 </para>
18987 <literallayout class="monospaced">
18988 MAIL FROM:&lt;&gt;
18989 MAIL FROM: &lt;&gt;
18990 </literallayout>
18991 <para>
18992 For a MAIL command, extra parameters such as SIZE can be inspected. For a RCPT
18993 command, the address in <varname>$smtp_command</varname> is the original address before any
18994 rewriting, whereas the values in <varname>$local_part</varname> and <varname>$domain</varname> are taken from
18995 the address after SMTP-time rewriting.
18996 </para>
18997 </listitem></varlistentry>
18998 <varlistentry>
18999 <term><varname>$smtp_command_argument</varname></term>
19000 <listitem>
19001 <para>
19002 <indexterm role="concept">
19003 <primary>SMTP</primary>
19004 <secondary>command, argument for</secondary>
19005 </indexterm>
19006 <indexterm role="variable">
19007 <primary><varname>$smtp_command_argument</varname></primary>
19008 </indexterm>
19009 While an ACL is running to check an SMTP command, this variable contains the
19010 argument, that is, the text that follows the command name, with leading white
19011 space removed. Following the introduction of <varname>$smtp_command</varname>, this variable is
19012 somewhat redundant, but is retained for backwards compatibility.
19013 </para>
19014 </listitem></varlistentry>
19015 <varlistentry>
19016 <term><varname>$smtp_count_at_connection_start</varname></term>
19017 <listitem>
19018 <para>
19019 <indexterm role="variable">
19020 <primary><varname>$smtp_count_at_connection_start</varname></primary>
19021 </indexterm>
19022 This variable is set greater than zero only in processes spawned by the Exim
19023 daemon for handling incoming SMTP connections. The name is deliberately long,
19024 in order to emphasize what the contents are. When the daemon accepts a new
19025 connection, it increments this variable. A copy of the variable is passed to
19026 the child process that handles the connection, but its value is fixed, and
19027 never changes. It is only an approximation of how many incoming connections
19028 there actually are, because many other connections may come and go while a
19029 single connection is being processed. When a child process terminates, the
19030 daemon decrements its copy of the variable.
19031 </para>
19032 </listitem></varlistentry>
19033 <varlistentry>
19034 <term><varname>$sn0</varname> &ndash; <varname>$sn9</varname></term>
19035 <listitem>
19036 <para>
19037 These variables are copies of the values of the <varname>$n0</varname> &ndash; <varname>$n9</varname> accumulators
19038 that were current at the end of the system filter file. This allows a system
19039 filter file to set values that can be tested in users&#x2019; filter files. For
19040 example, a system filter could set a value indicating how likely it is that a
19041 message is junk mail.
19042 </para>
19043 </listitem></varlistentry>
19044 <varlistentry>
19045 <term><varname>$spam_</varname><emphasis>xxx</emphasis></term>
19046 <listitem>
19047 <para>
19048 A number of variables whose names start with <varname>$spam</varname> are available when Exim
19049 is compiled with the content-scanning extension. For details, see section
19050 <xref linkend="SECTscanspamass"/>.
19051 </para>
19052 </listitem></varlistentry>
19053 <varlistentry>
19054 <term><varname>$spool_directory</varname></term>
19055 <listitem>
19056 <para>
19057 <indexterm role="variable">
19058 <primary><varname>$spool_directory</varname></primary>
19059 </indexterm>
19060 The name of Exim&#x2019;s spool directory.
19061 </para>
19062 </listitem></varlistentry>
19063 <varlistentry>
19064 <term><varname>$spool_inodes</varname></term>
19065 <listitem>
19066 <para>
19067 <indexterm role="variable">
19068 <primary><varname>$spool_inodes</varname></primary>
19069 </indexterm>
19070 The number of free inodes in the disk partition where Exim&#x2019;s spool files are
19071 being written. The value is recalculated whenever the variable is referenced.
19072 If the relevant file system does not have the concept of inodes, the value of
19073 is -1. See also the <option>check_spool_inodes</option> option.
19074 </para>
19075 </listitem></varlistentry>
19076 <varlistentry>
19077 <term><varname>$spool_space</varname></term>
19078 <listitem>
19079 <para>
19080 <indexterm role="variable">
19081 <primary><varname>$spool_space</varname></primary>
19082 </indexterm>
19083 The amount of free space (as a number of kilobytes) in the disk partition where
19084 Exim&#x2019;s spool files are being written. The value is recalculated whenever the
19085 variable is referenced. If the operating system does not have the ability to
19086 find the amount of free space (only true for experimental systems), the space
19087 value is -1. For example, to check in an ACL that there is at least 50
19088 megabytes free on the spool, you could write:
19089 </para>
19090 <literallayout class="monospaced">
19091 condition = ${if &gt; {$spool_space}{50000}}
19092 </literallayout>
19093 <para>
19094 See also the <option>check_spool_space</option> option.
19095 </para>
19096 </listitem></varlistentry>
19097 <varlistentry>
19098 <term><varname>$thisaddress</varname></term>
19099 <listitem>
19100 <para>
19101 <indexterm role="variable">
19102 <primary><varname>$thisaddress</varname></primary>
19103 </indexterm>
19104 This variable is set only during the processing of the <option>foranyaddress</option>
19105 command in a filter file. Its use is explained in the description of that
19106 command, which can be found in the separate document entitled <emphasis>Exim&#x2019;s
19107 interfaces to mail filtering</emphasis>.
19108 </para>
19109 </listitem></varlistentry>
19110 <varlistentry>
19111 <term><varname>$tls_in_bits</varname></term>
19112 <listitem>
19113 <para>
19114 <indexterm role="variable">
19115 <primary><varname>$tls_in_bits</varname></primary>
19116 </indexterm>
19117 Contains an approximation of the TLS cipher&#x2019;s bit-strength
19118 on the inbound connection; the meaning of
19119 this depends upon the TLS implementation used.
19120 If TLS has not been negotiated, the value will be 0.
19121 The value of this is automatically fed into the Cyrus SASL authenticator
19122 when acting as a server, to specify the "external SSF" (a SASL term).
19123 </para>
19124 <para>
19125 The deprecated <varname>$tls_bits</varname> variable refers to the inbound side
19126 except when used in the context of an outbound SMTP delivery, when it refers to
19127 the outbound.
19128 </para>
19129 </listitem></varlistentry>
19130 <varlistentry>
19131 <term><varname>$tls_out_bits</varname></term>
19132 <listitem>
19133 <para>
19134 <indexterm role="variable">
19135 <primary><varname>$tls_out_bits</varname></primary>
19136 </indexterm>
19137 Contains an approximation of the TLS cipher&#x2019;s bit-strength
19138 on an outbound SMTP connection; the meaning of
19139 this depends upon the TLS implementation used.
19140 If TLS has not been negotiated, the value will be 0.
19141 </para>
19142 </listitem></varlistentry>
19143 <varlistentry>
19144 <term><varname>$tls_in_ourcert</varname></term>
19145 <listitem>
19146 <para>
19147 <indexterm role="variable">
19148 <primary><varname>$tls_in_ourcert</varname></primary>
19149 </indexterm>
19150 This variable refers to the certificate presented to the peer of an
19151 inbound connection when the message was received.
19152 It is only useful as the argument of a
19153 <option>certextract</option> expansion item, <option>md5</option> or <option>sha1</option> operator,
19154 or a <option>def</option> condition.
19155 </para>
19156 </listitem></varlistentry>
19157 <varlistentry>
19158 <term><varname>$tls_in_peercert</varname></term>
19159 <listitem>
19160 <para>
19161 <indexterm role="variable">
19162 <primary><varname>$tls_in_peercert</varname></primary>
19163 </indexterm>
19164 This variable refers to the certificate presented by the peer of an
19165 inbound connection when the message was received.
19166 It is only useful as the argument of a
19167 <option>certextract</option> expansion item, <option>md5</option> or <option>sha1</option> operator,
19168 or a <option>def</option> condition.
19169 </para>
19170 </listitem></varlistentry>
19171 <varlistentry>
19172 <term><varname>$tls_out_ourcert</varname></term>
19173 <listitem>
19174 <para>
19175 <indexterm role="variable">
19176 <primary><varname>$tls_out_ourcert</varname></primary>
19177 </indexterm>
19178 This variable refers to the certificate presented to the peer of an
19179 outbound connection.  It is only useful as the argument of a
19180 <option>certextract</option> expansion item, <option>md5</option> or <option>sha1</option> operator,
19181 or a <option>def</option> condition.
19182 </para>
19183 </listitem></varlistentry>
19184 <varlistentry>
19185 <term><varname>$tls_out_peercert</varname></term>
19186 <listitem>
19187 <para>
19188 <indexterm role="variable">
19189 <primary><varname>$tls_out_peercert</varname></primary>
19190 </indexterm>
19191 This variable refers to the certificate presented by the peer of an
19192 outbound connection.  It is only useful as the argument of a
19193 <option>certextract</option> expansion item, <option>md5</option> or <option>sha1</option> operator,
19194 or a <option>def</option> condition.
19195 </para>
19196 </listitem></varlistentry>
19197 <varlistentry>
19198 <term><varname>$tls_in_certificate_verified</varname></term>
19199 <listitem>
19200 <para>
19201 <indexterm role="variable">
19202 <primary><varname>$tls_in_certificate_verified</varname></primary>
19203 </indexterm>
19204 This variable is set to <quote>1</quote> if a TLS certificate was verified when the
19205 message was received, and <quote>0</quote> otherwise.
19206 </para>
19207 <para>
19208 The deprecated <varname>$tls_certificate_verfied</varname> variable refers to the inbound side
19209 except when used in the context of an outbound SMTP delivery, when it refers to
19210 the outbound.
19211 </para>
19212 </listitem></varlistentry>
19213 <varlistentry>
19214 <term><varname>$tls_out_certificate_verified</varname></term>
19215 <listitem>
19216 <para>
19217 <indexterm role="variable">
19218 <primary><varname>$tls_out_certificate_verified</varname></primary>
19219 </indexterm>
19220 This variable is set to <quote>1</quote> if a TLS certificate was verified when an
19221 outbound SMTP connection was made,
19222 and <quote>0</quote> otherwise.
19223 </para>
19224 </listitem></varlistentry>
19225 <varlistentry>
19226 <term><varname>$tls_in_cipher</varname></term>
19227 <listitem>
19228 <para>
19229 <indexterm role="variable">
19230 <primary><varname>$tls_in_cipher</varname></primary>
19231 </indexterm>
19232 <indexterm role="variable">
19233 <primary><varname>$tls_cipher</varname></primary>
19234 </indexterm>
19235 When a message is received from a remote host over an encrypted SMTP
19236 connection, this variable is set to the cipher suite that was negotiated, for
19237 example DES-CBC3-SHA. In other circumstances, in particular, for message
19238 received over unencrypted connections, the variable is empty. Testing
19239 <varname>$tls_cipher</varname> for emptiness is one way of distinguishing between encrypted and
19240 non-encrypted connections during ACL processing.
19241 </para>
19242 <para>
19243 The deprecated <varname>$tls_cipher</varname> variable is the same as <varname>$tls_in_cipher</varname> during message reception,
19244 but in the context of an outward SMTP delivery taking place via the <command>smtp</command> transport
19245 becomes the same as <varname>$tls_out_cipher</varname>.
19246 </para>
19247 </listitem></varlistentry>
19248 <varlistentry>
19249 <term><varname>$tls_out_cipher</varname></term>
19250 <listitem>
19251 <para>
19252 <indexterm role="variable">
19253 <primary><varname>$tls_out_cipher</varname></primary>
19254 </indexterm>
19255 This variable is
19256 cleared before any outgoing SMTP connection is made,
19257 and then set to the outgoing cipher suite if one is negotiated. See chapter
19258 <xref linkend="CHAPTLS"/> for details of TLS support and chapter <xref linkend="CHAPsmtptrans"/> for
19259 details of the <command>smtp</command> transport.
19260 </para>
19261 </listitem></varlistentry>
19262 <varlistentry revisionflag="changed">
19263 <term><varname>$tls_in_ocsp</varname></term>
19264 <listitem>
19265 <para revisionflag="changed">
19266 <indexterm role="variable">
19267 <primary><varname>$tls_in_ocsp</varname></primary>
19268 </indexterm>
19269 When a message is received from a remote client connection
19270 the result of any OCSP request from the client is encoded in this variable:
19271 </para>
19272 <literallayout class="monospaced" revisionflag="changed">
19273 0 OCSP proof was not requested (default value)
19274 1 No response to request
19275 2 Response not verified
19276 3 Verification failed
19277 4 Verification succeeded
19278 </literallayout>
19279 </listitem></varlistentry>
19280 <varlistentry revisionflag="changed">
19281 <term><varname>$tls_out_ocsp</varname></term>
19282 <listitem>
19283 <para revisionflag="changed">
19284 <indexterm role="variable">
19285 <primary><varname>$tls_out_ocsp</varname></primary>
19286 </indexterm>
19287 When a message is sent to a remote host connection
19288 the result of any OCSP request made is encoded in this variable.
19289 See <varname>$tls_in_ocsp</varname> for values.
19290 </para>
19291 </listitem></varlistentry>
19292 <varlistentry>
19293 <term><varname>$tls_in_peerdn</varname></term>
19294 <listitem>
19295 <para>
19296 <indexterm role="variable">
19297 <primary><varname>$tls_in_peerdn</varname></primary>
19298 </indexterm>
19299 <indexterm role="variable">
19300 <primary><varname>$tls_peerdn</varname></primary>
19301 </indexterm>
19302 When a message is received from a remote host over an encrypted SMTP
19303 connection, and Exim is configured to request a certificate from the client,
19304 the value of the Distinguished Name of the certificate is made available in the
19305 <varname>$tls_in_peerdn</varname> during subsequent processing.
19306 </para>
19307 <para>
19308 The deprecated <varname>$tls_peerdn</varname> variable refers to the inbound side
19309 except when used in the context of an outbound SMTP delivery, when it refers to
19310 the outbound.
19311 </para>
19312 </listitem></varlistentry>
19313 <varlistentry>
19314 <term><varname>$tls_out_peerdn</varname></term>
19315 <listitem>
19316 <para>
19317 <indexterm role="variable">
19318 <primary><varname>$tls_out_peerdn</varname></primary>
19319 </indexterm>
19320 When a message is being delivered to a remote host over an encrypted SMTP
19321 connection, and Exim is configured to request a certificate from the server,
19322 the value of the Distinguished Name of the certificate is made available in the
19323 <varname>$tls_out_peerdn</varname> during subsequent processing.
19324 </para>
19325 </listitem></varlistentry>
19326 <varlistentry>
19327 <term><varname>$tls_in_sni</varname></term>
19328 <listitem>
19329 <para>
19330 <indexterm role="variable">
19331 <primary><varname>$tls_in_sni</varname></primary>
19332 </indexterm>
19333 <indexterm role="variable">
19334 <primary><varname>$tls_sni</varname></primary>
19335 </indexterm>
19336 <indexterm role="concept">
19337 <primary>TLS</primary>
19338 <secondary>Server Name Indication</secondary>
19339 </indexterm>
19340 When a TLS session is being established, if the client sends the Server
19341 Name Indication extension, the value will be placed in this variable.
19342 If the variable appears in <option>tls_certificate</option> then this option and
19343 some others, described in <xref linkend="SECTtlssni"/>,
19344 will be re-expanded early in the TLS session, to permit
19345 a different certificate to be presented (and optionally a different key to be
19346 used) to the client, based upon the value of the SNI extension.
19347 </para>
19348 <para>
19349 The deprecated <varname>$tls_sni</varname> variable refers to the inbound side
19350 except when used in the context of an outbound SMTP delivery, when it refers to
19351 the outbound.
19352 </para>
19353 </listitem></varlistentry>
19354 <varlistentry>
19355 <term><varname>$tls_out_sni</varname></term>
19356 <listitem>
19357 <para>
19358 <indexterm role="variable">
19359 <primary><varname>$tls_out_sni</varname></primary>
19360 </indexterm>
19361 <indexterm role="concept">
19362 <primary>TLS</primary>
19363 <secondary>Server Name Indication</secondary>
19364 </indexterm>
19365 During outbound
19366 SMTP deliveries, this variable reflects the value of the <option>tls_sni</option> option on
19367 the transport.
19368 </para>
19369 </listitem></varlistentry>
19370 <varlistentry>
19371 <term><varname>$tod_bsdinbox</varname></term>
19372 <listitem>
19373 <para>
19374 <indexterm role="variable">
19375 <primary><varname>$tod_bsdinbox</varname></primary>
19376 </indexterm>
19377 The time of day and the date, in the format required for BSD-style mailbox
19378 files, for example: Thu Oct 17 17:14:09 1995.
19379 </para>
19380 </listitem></varlistentry>
19381 <varlistentry>
19382 <term><varname>$tod_epoch</varname></term>
19383 <listitem>
19384 <para>
19385 <indexterm role="variable">
19386 <primary><varname>$tod_epoch</varname></primary>
19387 </indexterm>
19388 The time and date as a number of seconds since the start of the Unix epoch.
19389 </para>
19390 </listitem></varlistentry>
19391 <varlistentry>
19392 <term><varname>$tod_epoch_l</varname></term>
19393 <listitem>
19394 <para>
19395 <indexterm role="variable">
19396 <primary><varname>$tod_epoch_l</varname></primary>
19397 </indexterm>
19398 The time and date as a number of microseconds since the start of the Unix epoch.
19399 </para>
19400 </listitem></varlistentry>
19401 <varlistentry>
19402 <term><varname>$tod_full</varname></term>
19403 <listitem>
19404 <para>
19405 <indexterm role="variable">
19406 <primary><varname>$tod_full</varname></primary>
19407 </indexterm>
19408 A full version of the time and date, for example: Wed, 16 Oct 1995 09:51:40
19409 +0100. The timezone is always given as a numerical offset from UTC, with
19410 positive values used for timezones that are ahead (east) of UTC, and negative
19411 values for those that are behind (west).
19412 </para>
19413 </listitem></varlistentry>
19414 <varlistentry>
19415 <term><varname>$tod_log</varname></term>
19416 <listitem>
19417 <para>
19418 <indexterm role="variable">
19419 <primary><varname>$tod_log</varname></primary>
19420 </indexterm>
19421 The time and date in the format used for writing Exim&#x2019;s log files, for example:
19422 1995-10-12 15:32:29, but without a timezone.
19423 </para>
19424 </listitem></varlistentry>
19425 <varlistentry>
19426 <term><varname>$tod_logfile</varname></term>
19427 <listitem>
19428 <para>
19429 <indexterm role="variable">
19430 <primary><varname>$tod_logfile</varname></primary>
19431 </indexterm>
19432 This variable contains the date in the format yyyymmdd. This is the format that
19433 is used for datestamping log files when <option>log_file_path</option> contains the <literal>%D</literal>
19434 flag.
19435 </para>
19436 </listitem></varlistentry>
19437 <varlistentry>
19438 <term><varname>$tod_zone</varname></term>
19439 <listitem>
19440 <para>
19441 <indexterm role="variable">
19442 <primary><varname>$tod_zone</varname></primary>
19443 </indexterm>
19444 This variable contains the numerical value of the local timezone, for example:
19445 -0500.
19446 </para>
19447 </listitem></varlistentry>
19448 <varlistentry>
19449 <term><varname>$tod_zulu</varname></term>
19450 <listitem>
19451 <para>
19452 <indexterm role="variable">
19453 <primary><varname>$tod_zulu</varname></primary>
19454 </indexterm>
19455 This variable contains the UTC date and time in <quote>Zulu</quote> format, as specified
19456 by ISO 8601, for example: 20030221154023Z.
19457 </para>
19458 </listitem></varlistentry>
19459 <varlistentry>
19460 <term><varname>$transport_name</varname></term>
19461 <listitem>
19462 <para>
19463 <indexterm role="concept">
19464 <primary>transport</primary>
19465 <secondary>name</secondary>
19466 </indexterm>
19467 <indexterm role="concept">
19468 <primary>name</primary>
19469 <secondary>of transport</secondary>
19470 </indexterm>
19471 <indexterm role="variable">
19472 <primary><varname>$transport_name</varname></primary>
19473 </indexterm>
19474 During the running of a transport, this variable contains its name.
19475 </para>
19476 </listitem></varlistentry>
19477 <varlistentry>
19478 <term><varname>$value</varname></term>
19479 <listitem>
19480 <para>
19481 <indexterm role="variable">
19482 <primary><varname>$value</varname></primary>
19483 </indexterm>
19484 This variable contains the result of an expansion lookup, extraction operation,
19485 or external command, as described above. It is also used during a
19486 <emphasis role="bold">reduce</emphasis> expansion.
19487 </para>
19488 </listitem></varlistentry>
19489 <varlistentry>
19490 <term><varname>$version_number</varname></term>
19491 <listitem>
19492 <para>
19493 <indexterm role="variable">
19494 <primary><varname>$version_number</varname></primary>
19495 </indexterm>
19496 The version number of Exim.
19497 </para>
19498 </listitem></varlistentry>
19499 <varlistentry>
19500 <term><varname>$warn_message_delay</varname></term>
19501 <listitem>
19502 <para>
19503 <indexterm role="variable">
19504 <primary><varname>$warn_message_delay</varname></primary>
19505 </indexterm>
19506 This variable is set only during the creation of a message warning about a
19507 delivery delay. Details of its use are explained in section <xref linkend="SECTcustwarn"/>.
19508 </para>
19509 </listitem></varlistentry>
19510 <varlistentry>
19511 <term><varname>$warn_message_recipients</varname></term>
19512 <listitem>
19513 <para>
19514 <indexterm role="variable">
19515 <primary><varname>$warn_message_recipients</varname></primary>
19516 </indexterm>
19517 This variable is set only during the creation of a message warning about a
19518 delivery delay. Details of its use are explained in section <xref linkend="SECTcustwarn"/>.
19519 </para>
19520 </listitem></varlistentry>
19521 </variablelist>
19522 <para>
19523 <indexterm role="concept" startref="IIDstrexp" class="endofrange"/>
19524 </para>
19525 </section>
19526 </chapter>
19527
19528 <chapter id="CHAPperl">
19529 <title>Embedded Perl</title>
19530 <para>
19531 <indexterm role="concept" id="IIDperl" class="startofrange">
19532 <primary>Perl</primary>
19533 <secondary>calling from Exim</secondary>
19534 </indexterm>
19535 Exim can be built to include an embedded Perl interpreter. When this is done,
19536 Perl subroutines can be called as part of the string expansion process. To make
19537 use of the Perl support, you need version 5.004 or later of Perl installed on
19538 your system. To include the embedded interpreter in the Exim binary, include
19539 the line
19540 </para>
19541 <literallayout class="monospaced">
19542 EXIM_PERL = perl.o
19543 </literallayout>
19544 <para>
19545 in your <filename>Local/Makefile</filename> and then build Exim in the normal way.
19546 </para>
19547 <section id="SECID85">
19548 <title>Setting up so Perl can be used</title>
19549 <para>
19550 <indexterm role="option">
19551 <primary><option>perl_startup</option></primary>
19552 </indexterm>
19553 Access to Perl subroutines is via a global configuration option called
19554 <option>perl_startup</option> and an expansion string operator <option>${perl ...}</option>. If there is
19555 no <option>perl_startup</option> option in the Exim configuration file then no Perl
19556 interpreter is started and there is almost no overhead for Exim (since none of
19557 the Perl library will be paged in unless used). If there is a <option>perl_startup</option>
19558 option then the associated value is taken to be Perl code which is executed in
19559 a newly created Perl interpreter.
19560 </para>
19561 <para>
19562 The value of <option>perl_startup</option> is not expanded in the Exim sense, so you do not
19563 need backslashes before any characters to escape special meanings. The option
19564 should usually be something like
19565 </para>
19566 <literallayout class="monospaced">
19567 perl_startup = do '/etc/exim.pl'
19568 </literallayout>
19569 <para>
19570 where <filename>/etc/exim.pl</filename> is Perl code which defines any subroutines you want to
19571 use from Exim. Exim can be configured either to start up a Perl interpreter as
19572 soon as it is entered, or to wait until the first time it is needed. Starting
19573 the interpreter at the beginning ensures that it is done while Exim still has
19574 its setuid privilege, but can impose an unnecessary overhead if Perl is not in
19575 fact used in a particular run. Also, note that this does not mean that Exim is
19576 necessarily running as root when Perl is called at a later time. By default,
19577 the interpreter is started only when it is needed, but this can be changed in
19578 two ways:
19579 </para>
19580 <itemizedlist>
19581 <listitem>
19582 <para>
19583 <indexterm role="option">
19584 <primary><option>perl_at_start</option></primary>
19585 </indexterm>
19586 Setting <option>perl_at_start</option> (a boolean option) in the configuration requests
19587 a startup when Exim is entered.
19588 </para>
19589 </listitem>
19590 <listitem>
19591 <para>
19592 The command line option <option>-ps</option> also requests a startup when Exim is entered,
19593 overriding the setting of <option>perl_at_start</option>.
19594 </para>
19595 </listitem>
19596 </itemizedlist>
19597 <para>
19598 There is also a command line option <option>-pd</option> (for delay) which suppresses the
19599 initial startup, even if <option>perl_at_start</option> is set.
19600 </para>
19601 </section>
19602 <section id="SECID86">
19603 <title>Calling Perl subroutines</title>
19604 <para>
19605 When the configuration file includes a <option>perl_startup</option> option you can make use
19606 of the string expansion item to call the Perl subroutines that are defined
19607 by the <option>perl_startup</option> code. The operator is used in any of the following
19608 forms:
19609 </para>
19610 <literallayout class="monospaced">
19611 ${perl{foo}}
19612 ${perl{foo}{argument}}
19613 ${perl{foo}{argument1}{argument2} ... }
19614 </literallayout>
19615 <para>
19616 which calls the subroutine <option>foo</option> with the given arguments. A maximum of eight
19617 arguments may be passed. Passing more than this results in an expansion failure
19618 with an error message of the form
19619 </para>
19620 <literallayout class="monospaced">
19621 Too many arguments passed to Perl subroutine "foo" (max is 8)
19622 </literallayout>
19623 <para>
19624 The return value of the Perl subroutine is evaluated in a scalar context before
19625 it is passed back to Exim to be inserted into the expanded string. If the
19626 return value is <emphasis>undef</emphasis>, the expansion is forced to fail in the same way as
19627 an explicit <quote>fail</quote> on an <option>if</option> or <option>lookup</option> item. If the subroutine aborts
19628 by obeying Perl&#x2019;s <option>die</option> function, the expansion fails with the error message
19629 that was passed to <option>die</option>.
19630 </para>
19631 </section>
19632 <section id="SECID87">
19633 <title>Calling Exim functions from Perl</title>
19634 <para>
19635 Within any Perl code called from Exim, the function <emphasis>Exim::expand_string()</emphasis>
19636 is available to call back into Exim&#x2019;s string expansion function. For example,
19637 the Perl code
19638 </para>
19639 <literallayout class="monospaced">
19640 my $lp = Exim::expand_string('$local_part');
19641 </literallayout>
19642 <para>
19643 makes the current Exim <varname>$local_part</varname> available in the Perl variable <varname>$lp</varname>.
19644 Note those are single quotes and not double quotes to protect against
19645 <varname>$local_part</varname> being interpolated as a Perl variable.
19646 </para>
19647 <para>
19648 If the string expansion is forced to fail by a <quote>fail</quote> item, the result of
19649 <emphasis>Exim::expand_string()</emphasis> is <option>undef</option>. If there is a syntax error in the
19650 expansion string, the Perl call from the original expansion string fails with
19651 an appropriate error message, in the same way as if <option>die</option> were used.
19652 </para>
19653 <para>
19654 <indexterm role="concept">
19655 <primary>debugging</primary>
19656 <secondary>from embedded Perl</secondary>
19657 </indexterm>
19658 <indexterm role="concept">
19659 <primary>log</primary>
19660 <secondary>writing from embedded Perl</secondary>
19661 </indexterm>
19662 Two other Exim functions are available for use from within Perl code.
19663 <emphasis>Exim::debug_write()</emphasis> writes a string to the standard error stream if Exim&#x2019;s
19664 debugging is enabled. If you want a newline at the end, you must supply it.
19665 <emphasis>Exim::log_write()</emphasis> writes a string to Exim&#x2019;s main log, adding a leading
19666 timestamp. In this case, you should not supply a terminating newline.
19667 </para>
19668 </section>
19669 <section id="SECID88">
19670 <title>Use of standard output and error by Perl</title>
19671 <para>
19672 <indexterm role="concept">
19673 <primary>Perl</primary>
19674 <secondary>standard output and error</secondary>
19675 </indexterm>
19676 You should not write to the standard error or output streams from within your
19677 Perl code, as it is not defined how these are set up. In versions of Exim
19678 before 4.50, it is possible for the standard output or error to refer to the
19679 SMTP connection during message reception via the daemon. Writing to this stream
19680 is certain to cause chaos. From Exim 4.50 onwards, the standard output and
19681 error streams are connected to <filename>/dev/null</filename> in the daemon. The chaos is
19682 avoided, but the output is lost.
19683 </para>
19684 <para>
19685 <indexterm role="concept">
19686 <primary>Perl</primary>
19687 <secondary>use of <option>warn</option></secondary>
19688 </indexterm>
19689 The Perl <option>warn</option> statement writes to the standard error stream by default.
19690 Calls to <option>warn</option> may be embedded in Perl modules that you use, but over which
19691 you have no control. When Exim starts up the Perl interpreter, it arranges for
19692 output from the <option>warn</option> statement to be written to the Exim main log. You can
19693 change this by including appropriate Perl magic somewhere in your Perl code.
19694 For example, to discard <option>warn</option> output completely, you need this:
19695 </para>
19696 <literallayout class="monospaced">
19697 $SIG{__WARN__} = sub { };
19698 </literallayout>
19699 <para>
19700 Whenever a <option>warn</option> is obeyed, the anonymous subroutine is called. In this
19701 example, the code for the subroutine is empty, so it does nothing, but you can
19702 include any Perl code that you like. The text of the <option>warn</option> message is passed
19703 as the first subroutine argument.
19704 <indexterm role="concept" startref="IIDperl" class="endofrange"/>
19705 </para>
19706 </section>
19707 </chapter>
19708
19709 <chapter id="CHAPinterfaces">
19710 <title>Starting the daemon and the use of network interfaces</title>
19711 <titleabbrev>Starting the daemon</titleabbrev>
19712 <para>
19713 <indexterm role="concept">
19714 <primary>daemon</primary>
19715 <secondary>starting</secondary>
19716 </indexterm>
19717 <indexterm role="concept">
19718 <primary>interface</primary>
19719 <secondary>listening</secondary>
19720 </indexterm>
19721 <indexterm role="concept">
19722 <primary>network interface</primary>
19723 </indexterm>
19724 <indexterm role="concept">
19725 <primary>interface</primary>
19726 <secondary>network</secondary>
19727 </indexterm>
19728 <indexterm role="concept">
19729 <primary>IP address</primary>
19730 <secondary>for listening</secondary>
19731 </indexterm>
19732 <indexterm role="concept">
19733 <primary>daemon</primary>
19734 <secondary>listening IP addresses</secondary>
19735 </indexterm>
19736 <indexterm role="concept">
19737 <primary>TCP/IP</primary>
19738 <secondary>setting listening interfaces</secondary>
19739 </indexterm>
19740 <indexterm role="concept">
19741 <primary>TCP/IP</primary>
19742 <secondary>setting listening ports</secondary>
19743 </indexterm>
19744 A host that is connected to a TCP/IP network may have one or more physical
19745 hardware network interfaces. Each of these interfaces may be configured as one
19746 or more <quote>logical</quote> interfaces, which are the entities that a program actually
19747 works with. Each of these logical interfaces is associated with an IP address.
19748 In addition, TCP/IP software supports <quote>loopback</quote> interfaces (127.0.0.1 in
19749 IPv4 and ::1 in IPv6), which do not use any physical hardware. Exim requires
19750 knowledge about the host&#x2019;s interfaces for use in three different circumstances:
19751 </para>
19752 <orderedlist numeration="arabic">
19753 <listitem>
19754 <para>
19755 When a listening daemon is started, Exim needs to know which interfaces
19756 and ports to listen on.
19757 </para>
19758 </listitem>
19759 <listitem>
19760 <para>
19761 When Exim is routing an address, it needs to know which IP addresses
19762 are associated with local interfaces. This is required for the correct
19763 processing of MX lists by removing the local host and others with the
19764 same or higher priority values. Also, Exim needs to detect cases
19765 when an address is routed to an IP address that in fact belongs to the
19766 local host. Unless the <option>self</option> router option or the <option>allow_localhost</option>
19767 option of the smtp transport is set (as appropriate), this is treated
19768 as an error situation.
19769 </para>
19770 </listitem>
19771 <listitem>
19772 <para>
19773 When Exim connects to a remote host, it may need to know which interface to use
19774 for the outgoing connection.
19775 </para>
19776 </listitem>
19777 </orderedlist>
19778 <para>
19779 Exim&#x2019;s default behaviour is likely to be appropriate in the vast majority
19780 of cases. If your host has only one interface, and you want all its IP
19781 addresses to be treated in the same way, and you are using only the
19782 standard SMTP port, you should not need to take any special action. The
19783 rest of this chapter does not apply to you.
19784 </para>
19785 <para>
19786 In a more complicated situation you may want to listen only on certain
19787 interfaces, or on different ports, and for this reason there are a number of
19788 options that can be used to influence Exim&#x2019;s behaviour. The rest of this
19789 chapter describes how they operate.
19790 </para>
19791 <para>
19792 When a message is received over TCP/IP, the interface and port that were
19793 actually used are set in <varname>$received_ip_address</varname> and <varname>$received_port</varname>.
19794 </para>
19795 <section id="SECID89">
19796 <title>Starting a listening daemon</title>
19797 <para>
19798 When a listening daemon is started (by means of the <option>-bd</option> command line
19799 option), the interfaces and ports on which it listens are controlled by the
19800 following options:
19801 </para>
19802 <itemizedlist>
19803 <listitem>
19804 <para>
19805 <option>daemon_smtp_ports</option> contains a list of default ports
19806 or service names.
19807 (For backward compatibility, this option can also be specified in the singular.)
19808 </para>
19809 </listitem>
19810 <listitem>
19811 <para>
19812 <option>local_interfaces</option> contains list of interface IP addresses on which to
19813 listen. Each item may optionally also specify a port.
19814 </para>
19815 </listitem>
19816 </itemizedlist>
19817 <para>
19818 The default list separator in both cases is a colon, but this can be changed as
19819 described in section <xref linkend="SECTlistconstruct"/>. When IPv6 addresses are involved,
19820 it is usually best to change the separator to avoid having to double all the
19821 colons. For example:
19822 </para>
19823 <literallayout class="monospaced">
19824 local_interfaces = &lt;; 127.0.0.1 ; \
19825                       192.168.23.65 ; \
19826                       ::1 ; \
19827                       3ffe:ffff:836f::fe86:a061
19828 </literallayout>
19829 <para>
19830 There are two different formats for specifying a port along with an IP address
19831 in <option>local_interfaces</option>:
19832 </para>
19833 <orderedlist numeration="arabic">
19834 <listitem>
19835 <para>
19836 The port is added onto the address with a dot separator. For example, to listen
19837 on port 1234 on two different IP addresses:
19838 </para>
19839 <literallayout class="monospaced">
19840 local_interfaces = &lt;; 192.168.23.65.1234 ; \
19841                       3ffe:ffff:836f::fe86:a061.1234
19842 </literallayout>
19843 </listitem>
19844 <listitem>
19845 <para>
19846 The IP address is enclosed in square brackets, and the port is added
19847 with a colon separator, for example:
19848 </para>
19849 <literallayout class="monospaced">
19850 local_interfaces = &lt;; [192.168.23.65]:1234 ; \
19851                       [3ffe:ffff:836f::fe86:a061]:1234
19852 </literallayout>
19853 </listitem>
19854 </orderedlist>
19855 <para>
19856 When a port is not specified, the value of <option>daemon_smtp_ports</option> is used. The
19857 default setting contains just one port:
19858 </para>
19859 <literallayout class="monospaced">
19860 daemon_smtp_ports = smtp
19861 </literallayout>
19862 <para>
19863 If more than one port is listed, each interface that does not have its own port
19864 specified listens on all of them. Ports that are listed in
19865 <option>daemon_smtp_ports</option> can be identified either by name (defined in
19866 <filename>/etc/services</filename>) or by number. However, when ports are given with individual
19867 IP addresses in <option>local_interfaces</option>, only numbers (not names) can be used.
19868 </para>
19869 </section>
19870 <section id="SECID90">
19871 <title>Special IP listening addresses</title>
19872 <para>
19873 The addresses 0.0.0.0 and ::0 are treated specially. They are interpreted
19874 as <quote>all IPv4 interfaces</quote> and <quote>all IPv6 interfaces</quote>, respectively. In each
19875 case, Exim tells the TCP/IP stack to <quote>listen on all IPv<emphasis>x</emphasis> interfaces</quote>
19876 instead of setting up separate listening sockets for each interface. The
19877 default value of <option>local_interfaces</option> is
19878 </para>
19879 <literallayout class="monospaced">
19880 local_interfaces = 0.0.0.0
19881 </literallayout>
19882 <para>
19883 when Exim is built without IPv6 support; otherwise it is:
19884 </para>
19885 <literallayout class="monospaced">
19886 local_interfaces = &lt;; ::0 ; 0.0.0.0
19887 </literallayout>
19888 <para>
19889 Thus, by default, Exim listens on all available interfaces, on the SMTP port.
19890 </para>
19891 </section>
19892 <section id="SECID91">
19893 <title>Overriding local_interfaces and daemon_smtp_ports</title>
19894 <para>
19895 The <option>-oX</option> command line option can be used to override the values of
19896 <option>daemon_smtp_ports</option> and/or <option>local_interfaces</option> for a particular daemon
19897 instance. Another way of doing this would be to use macros and the <option>-D</option>
19898 option. However, <option>-oX</option> can be used by any admin user, whereas modification of
19899 the runtime configuration by <option>-D</option> is allowed only when the caller is root or
19900 exim.
19901 </para>
19902 <para>
19903 The value of <option>-oX</option> is a list of items. The default colon separator can be
19904 changed in the usual way if required. If there are any items that do not
19905 contain dots or colons (that is, are not IP addresses), the value of
19906 <option>daemon_smtp_ports</option> is replaced by the list of those items. If there are any
19907 items that do contain dots or colons, the value of <option>local_interfaces</option> is
19908 replaced by those items. Thus, for example,
19909 </para>
19910 <literallayout class="monospaced">
19911 -oX 1225
19912 </literallayout>
19913 <para>
19914 overrides <option>daemon_smtp_ports</option>, but leaves <option>local_interfaces</option> unchanged,
19915 whereas
19916 </para>
19917 <literallayout class="monospaced">
19918 -oX 192.168.34.5.1125
19919 </literallayout>
19920 <para>
19921 overrides <option>local_interfaces</option>, leaving <option>daemon_smtp_ports</option> unchanged.
19922 (However, since <option>local_interfaces</option> now contains no items without ports, the
19923 value of <option>daemon_smtp_ports</option> is no longer relevant in this example.)
19924 </para>
19925 </section>
19926 <section id="SECTsupobssmt">
19927 <title>Support for the obsolete SSMTP (or SMTPS) protocol</title>
19928 <para>
19929 <indexterm role="concept">
19930 <primary>ssmtp protocol</primary>
19931 </indexterm>
19932 <indexterm role="concept">
19933 <primary>smtps protocol</primary>
19934 </indexterm>
19935 <indexterm role="concept">
19936 <primary>SMTP</primary>
19937 <secondary>ssmtp protocol</secondary>
19938 </indexterm>
19939 <indexterm role="concept">
19940 <primary>SMTP</primary>
19941 <secondary>smtps protocol</secondary>
19942 </indexterm>
19943 Exim supports the obsolete SSMTP protocol (also known as SMTPS) that was used
19944 before the STARTTLS command was standardized for SMTP. Some legacy clients
19945 still use this protocol. If the <option>tls_on_connect_ports</option> option is set to a
19946 list of port numbers or service names,
19947 connections to those ports must use SSMTP. The most
19948 common use of this option is expected to be
19949 </para>
19950 <literallayout class="monospaced">
19951 tls_on_connect_ports = 465
19952 </literallayout>
19953 <para>
19954 because 465 is the usual port number used by the legacy clients. There is also
19955 a command line option <option>-tls-on-connect</option>, which forces all ports to behave in
19956 this way when a daemon is started.
19957 </para>
19958 <para>
19959 <emphasis role="bold">Warning</emphasis>: Setting <option>tls_on_connect_ports</option> does not of itself cause the
19960 daemon to listen on those ports. You must still specify them in
19961 <option>daemon_smtp_ports</option>, <option>local_interfaces</option>, or the <option>-oX</option> option. (This is
19962 because <option>tls_on_connect_ports</option> applies to <option>inetd</option> connections as well as to
19963 connections via the daemon.)
19964 </para>
19965 </section>
19966 <section id="SECID92">
19967 <title>IPv6 address scopes</title>
19968 <para>
19969 <indexterm role="concept">
19970 <primary>IPv6</primary>
19971 <secondary>address scopes</secondary>
19972 </indexterm>
19973 IPv6 addresses have <quote>scopes</quote>, and a host with multiple hardware interfaces
19974 can, in principle, have the same link-local IPv6 address on different
19975 interfaces. Thus, additional information is needed, over and above the IP
19976 address, to distinguish individual interfaces. A convention of using a
19977 percent sign followed by something (often the interface name) has been
19978 adopted in some cases, leading to addresses like this:
19979 </para>
19980 <literallayout class="monospaced">
19981 fe80::202:b3ff:fe03:45c1%eth0
19982 </literallayout>
19983 <para>
19984 To accommodate this usage, a percent sign followed by an arbitrary string is
19985 allowed at the end of an IPv6 address. By default, Exim calls <function>getaddrinfo()</function>
19986 to convert a textual IPv6 address for actual use. This function recognizes the
19987 percent convention in operating systems that support it, and it processes the
19988 address appropriately. Unfortunately, some older libraries have problems with
19989 <function>getaddrinfo()</function>. If
19990 </para>
19991 <literallayout class="monospaced">
19992 IPV6_USE_INET_PTON=yes
19993 </literallayout>
19994 <para>
19995 is set in <filename>Local/Makefile</filename> (or an OS-dependent Makefile) when Exim is built,
19996 Exim uses <emphasis>inet_pton()</emphasis> to convert a textual IPv6 address for actual use,
19997 instead of <function>getaddrinfo()</function>. (Before version 4.14, it always used this
19998 function.) Of course, this means that the additional functionality of
19999 <function>getaddrinfo()</function> &ndash; recognizing scoped addresses &ndash; is lost.
20000 </para>
20001 </section>
20002 <section id="SECID93">
20003 <title>Disabling IPv6</title>
20004 <para>
20005 <indexterm role="concept">
20006 <primary>IPv6</primary>
20007 <secondary>disabling</secondary>
20008 </indexterm>
20009 Sometimes it happens that an Exim binary that was compiled with IPv6 support is
20010 run on a host whose kernel does not support IPv6. The binary will fall back to
20011 using IPv4, but it may waste resources looking up AAAA records, and trying to
20012 connect to IPv6 addresses, causing delays to mail delivery. If you set the
20013 <indexterm role="option">
20014 <primary><option>disable_ipv6</option></primary>
20015 </indexterm>
20016 <option>disable_ipv6</option> option true, even if the Exim binary has IPv6 support, no IPv6
20017 activities take place. AAAA records are never looked up, and any IPv6 addresses
20018 that are listed in <option>local_interfaces</option>, data for the <command>manualroute</command> router,
20019 etc. are ignored. If IP literals are enabled, the <command>ipliteral</command> router declines
20020 to handle IPv6 literal addresses.
20021 </para>
20022 <para>
20023 On the other hand, when IPv6 is in use, there may be times when you want to
20024 disable it for certain hosts or domains. You can use the <option>dns_ipv4_lookup</option>
20025 option to globally suppress the lookup of AAAA records for specified domains,
20026 and you can use the <option>ignore_target_hosts</option> generic router option to ignore
20027 IPv6 addresses in an individual router.
20028 </para>
20029 </section>
20030 <section id="SECID94">
20031 <title>Examples of starting a listening daemon</title>
20032 <para>
20033 The default case in an IPv6 environment is
20034 </para>
20035 <literallayout class="monospaced">
20036 daemon_smtp_ports = smtp
20037 local_interfaces = &lt;; ::0 ; 0.0.0.0
20038 </literallayout>
20039 <para>
20040 This specifies listening on the smtp port on all IPv6 and IPv4 interfaces.
20041 Either one or two sockets may be used, depending on the characteristics of
20042 the TCP/IP stack. (This is complicated and messy; for more information,
20043 read the comments in the <filename>daemon.c</filename> source file.)
20044 </para>
20045 <para>
20046 To specify listening on ports 25 and 26 on all interfaces:
20047 </para>
20048 <literallayout class="monospaced">
20049 daemon_smtp_ports = 25 : 26
20050 </literallayout>
20051 <para>
20052 (leaving <option>local_interfaces</option> at the default setting) or, more explicitly:
20053 </para>
20054 <literallayout class="monospaced">
20055 local_interfaces = &lt;; ::0.25     ; ::0.26 \
20056                       0.0.0.0.25 ; 0.0.0.0.26
20057 </literallayout>
20058 <para>
20059 To listen on the default port on all IPv4 interfaces, and on port 26 on the
20060 IPv4 loopback address only:
20061 </para>
20062 <literallayout class="monospaced">
20063 local_interfaces = 0.0.0.0 : 127.0.0.1.26
20064 </literallayout>
20065 <para>
20066 To specify listening on the default port on specific interfaces only:
20067 </para>
20068 <literallayout class="monospaced">
20069 local_interfaces = 10.0.0.67 : 192.168.34.67
20070 </literallayout>
20071 <para>
20072 <emphasis role="bold">Warning</emphasis>: Such a setting excludes listening on the loopback interfaces.
20073 </para>
20074 </section>
20075 <section id="SECTreclocipadd">
20076 <title>Recognizing the local host</title>
20077 <para>
20078 The <option>local_interfaces</option> option is also used when Exim needs to determine
20079 whether or not an IP address refers to the local host. That is, the IP
20080 addresses of all the interfaces on which a daemon is listening are always
20081 treated as local.
20082 </para>
20083 <para>
20084 For this usage, port numbers in <option>local_interfaces</option> are ignored. If either of
20085 the items 0.0.0.0 or ::0 are encountered, Exim gets a complete list of
20086 available interfaces from the operating system, and extracts the relevant
20087 (that is, IPv4 or IPv6) addresses to use for checking.
20088 </para>
20089 <para>
20090 Some systems set up large numbers of virtual interfaces in order to provide
20091 many virtual web servers. In this situation, you may want to listen for
20092 email on only a few of the available interfaces, but nevertheless treat all
20093 interfaces as local when routing. You can do this by setting
20094 <option>extra_local_interfaces</option> to a list of IP addresses, possibly including the
20095 <quote>all</quote> wildcard values. These addresses are recognized as local, but are not
20096 used for listening. Consider this example:
20097 </para>
20098 <literallayout class="monospaced">
20099 local_interfaces = &lt;; 127.0.0.1 ; ::1 ; \
20100                       192.168.53.235 ; \
20101                       3ffe:2101:12:1:a00:20ff:fe86:a061
20102
20103 extra_local_interfaces = &lt;; ::0 ; 0.0.0.0
20104 </literallayout>
20105 <para>
20106 The daemon listens on the loopback interfaces and just one IPv4 and one IPv6
20107 address, but all available interface addresses are treated as local when
20108 Exim is routing.
20109 </para>
20110 <para>
20111 In some environments the local host name may be in an MX list, but with an IP
20112 address that is not assigned to any local interface. In other cases it may be
20113 desirable to treat other host names as if they referred to the local host. Both
20114 these cases can be handled by setting the <option>hosts_treat_as_local</option> option.
20115 This contains host names rather than IP addresses. When a host is referenced
20116 during routing, either via an MX record or directly, it is treated as the local
20117 host if its name matches <option>hosts_treat_as_local</option>, or if any of its IP
20118 addresses match <option>local_interfaces</option> or <option>extra_local_interfaces</option>.
20119 </para>
20120 </section>
20121 <section id="SECID95">
20122 <title>Delivering to a remote host</title>
20123 <para>
20124 Delivery to a remote host is handled by the smtp transport. By default, it
20125 allows the system&#x2019;s TCP/IP functions to choose which interface to use (if
20126 there is more than one) when connecting to a remote host. However, the
20127 <option>interface</option> option can be set to specify which interface is used. See the
20128 description of the smtp transport in chapter <xref linkend="CHAPsmtptrans"/> for more
20129 details.
20130 </para>
20131 </section>
20132 </chapter>
20133
20134 <chapter id="CHAPmainconfig">
20135 <title>Main configuration</title>
20136 <para>
20137 <indexterm role="concept" id="IIDconfima" class="startofrange">
20138 <primary>configuration file</primary>
20139 <secondary>main section</secondary>
20140 </indexterm>
20141 <indexterm role="concept" id="IIDmaiconf" class="startofrange">
20142 <primary>main configuration</primary>
20143 </indexterm>
20144 The first part of the run time configuration file contains three types of item:
20145 </para>
20146 <itemizedlist>
20147 <listitem>
20148 <para>
20149 Macro definitions: These lines start with an upper case letter. See section
20150 <xref linkend="SECTmacrodefs"/> for details of macro processing.
20151 </para>
20152 </listitem>
20153 <listitem>
20154 <para>
20155 Named list definitions: These lines start with one of the words <quote>domainlist</quote>,
20156 <quote>hostlist</quote>, <quote>addresslist</quote>, or <quote>localpartlist</quote>. Their use is described in
20157 section <xref linkend="SECTnamedlists"/>.
20158 </para>
20159 </listitem>
20160 <listitem>
20161 <para>
20162 Main configuration settings: Each setting occupies one line of the file
20163 (with possible continuations). If any setting is preceded by the word
20164 <quote>hide</quote>, the <option>-bP</option> command line option displays its value to admin users
20165 only. See section <xref linkend="SECTcos"/> for a description of the syntax of these option
20166 settings.
20167 </para>
20168 </listitem>
20169 </itemizedlist>
20170 <para>
20171 This chapter specifies all the main configuration options, along with their
20172 types and default values. For ease of finding a particular option, they appear
20173 in alphabetical order in section <xref linkend="SECTalomo"/> below. However, because there
20174 are now so many options, they are first listed briefly in functional groups, as
20175 an aid to finding the name of the option you are looking for. Some options are
20176 listed in more than one group.
20177 </para>
20178 <section id="SECID96">
20179 <title>Miscellaneous</title>
20180 <informaltable frame="none">
20181 <tgroup cols="2" colsep="0" rowsep="0">
20182 <colspec colwidth="196pt" align="left"/>
20183 <colspec colwidth="254pt" align="left"/>
20184 <tbody>
20185 <row>
20186 <entry><option>bi_command</option></entry>
20187 <entry>to run for <option>-bi</option> command line option</entry>
20188 </row>
20189 <row>
20190 <entry><option>disable_ipv6</option></entry>
20191 <entry>do no IPv6 processing</entry>
20192 </row>
20193 <row>
20194 <entry><option>keep_malformed</option></entry>
20195 <entry>for broken files &ndash; should not happen</entry>
20196 </row>
20197 <row>
20198 <entry><option>localhost_number</option></entry>
20199 <entry>for unique message ids in clusters</entry>
20200 </row>
20201 <row>
20202 <entry><option>message_body_newlines</option></entry>
20203 <entry>retain newlines in <varname>$message_body</varname></entry>
20204 </row>
20205 <row>
20206 <entry><option>message_body_visible</option></entry>
20207 <entry>how much to show in <varname>$message_body</varname></entry>
20208 </row>
20209 <row>
20210 <entry><option>mua_wrapper</option></entry>
20211 <entry>run in <quote>MUA wrapper</quote> mode</entry>
20212 </row>
20213 <row>
20214 <entry><option>print_topbitchars</option></entry>
20215 <entry>top-bit characters are printing</entry>
20216 </row>
20217 <row>
20218 <entry><option>timezone</option></entry>
20219 <entry>force time zone</entry>
20220 </row>
20221 </tbody>
20222 </tgroup>
20223 </informaltable>
20224 </section>
20225 <section id="SECID97">
20226 <title>Exim parameters</title>
20227 <informaltable frame="none">
20228 <tgroup cols="2" colsep="0" rowsep="0">
20229 <colspec colwidth="196pt" align="left"/>
20230 <colspec colwidth="254pt" align="left"/>
20231 <tbody>
20232 <row>
20233 <entry><option>exim_group</option></entry>
20234 <entry>override compiled-in value</entry>
20235 </row>
20236 <row>
20237 <entry><option>exim_path</option></entry>
20238 <entry>override compiled-in value</entry>
20239 </row>
20240 <row>
20241 <entry><option>exim_user</option></entry>
20242 <entry>override compiled-in value</entry>
20243 </row>
20244 <row>
20245 <entry><option>primary_hostname</option></entry>
20246 <entry>default from <function>uname()</function></entry>
20247 </row>
20248 <row>
20249 <entry><option>split_spool_directory</option></entry>
20250 <entry>use multiple directories</entry>
20251 </row>
20252 <row>
20253 <entry><option>spool_directory</option></entry>
20254 <entry>override compiled-in value</entry>
20255 </row>
20256 </tbody>
20257 </tgroup>
20258 </informaltable>
20259 </section>
20260 <section id="SECID98">
20261 <title>Privilege controls</title>
20262 <informaltable frame="none">
20263 <tgroup cols="2" colsep="0" rowsep="0">
20264 <colspec colwidth="196pt" align="left"/>
20265 <colspec colwidth="254pt" align="left"/>
20266 <tbody>
20267 <row>
20268 <entry><option>admin_groups</option></entry>
20269 <entry>groups that are Exim admin users</entry>
20270 </row>
20271 <row>
20272 <entry><option>deliver_drop_privilege</option></entry>
20273 <entry>drop root for delivery processes</entry>
20274 </row>
20275 <row>
20276 <entry><option>local_from_check</option></entry>
20277 <entry>insert <emphasis>Sender:</emphasis> if necessary</entry>
20278 </row>
20279 <row>
20280 <entry><option>local_from_prefix</option></entry>
20281 <entry>for testing <emphasis>From:</emphasis> for local sender</entry>
20282 </row>
20283 <row>
20284 <entry><option>local_from_suffix</option></entry>
20285 <entry>for testing <emphasis>From:</emphasis> for local sender</entry>
20286 </row>
20287 <row>
20288 <entry><option>local_sender_retain</option></entry>
20289 <entry>keep <emphasis>Sender:</emphasis> from untrusted user</entry>
20290 </row>
20291 <row>
20292 <entry><option>never_users</option></entry>
20293 <entry>do not run deliveries as these</entry>
20294 </row>
20295 <row>
20296 <entry><option>prod_requires_admin</option></entry>
20297 <entry>forced delivery requires admin user</entry>
20298 </row>
20299 <row>
20300 <entry><option>queue_list_requires_admin</option></entry>
20301 <entry>queue listing requires admin user</entry>
20302 </row>
20303 <row>
20304 <entry><option>trusted_groups</option></entry>
20305 <entry>groups that are trusted</entry>
20306 </row>
20307 <row>
20308 <entry><option>trusted_users</option></entry>
20309 <entry>users that are trusted</entry>
20310 </row>
20311 </tbody>
20312 </tgroup>
20313 </informaltable>
20314 </section>
20315 <section id="SECID99">
20316 <title>Logging</title>
20317 <informaltable frame="none">
20318 <tgroup cols="2" colsep="0" rowsep="0">
20319 <colspec colwidth="196pt" align="left"/>
20320 <colspec colwidth="254pt" align="left"/>
20321 <tbody>
20322 <row>
20323 <entry><option>hosts_connection_nolog</option></entry>
20324 <entry>exemption from connect logging</entry>
20325 </row>
20326 <row>
20327 <entry><option>log_file_path</option></entry>
20328 <entry>override compiled-in value</entry>
20329 </row>
20330 <row>
20331 <entry><option>log_selector</option></entry>
20332 <entry>set/unset optional logging</entry>
20333 </row>
20334 <row>
20335 <entry><option>log_timezone</option></entry>
20336 <entry>add timezone to log lines</entry>
20337 </row>
20338 <row>
20339 <entry><option>message_logs</option></entry>
20340 <entry>create per-message logs</entry>
20341 </row>
20342 <row>
20343 <entry><option>preserve_message_logs</option></entry>
20344 <entry>after message completion</entry>
20345 </row>
20346 <row>
20347 <entry><option>process_log_path</option></entry>
20348 <entry>for SIGUSR1 and <emphasis>exiwhat</emphasis></entry>
20349 </row>
20350 <row>
20351 <entry><option>syslog_duplication</option></entry>
20352 <entry>controls duplicate log lines on syslog</entry>
20353 </row>
20354 <row>
20355 <entry><option>syslog_facility</option></entry>
20356 <entry>set syslog <quote>facility</quote> field</entry>
20357 </row>
20358 <row>
20359 <entry><option>syslog_processname</option></entry>
20360 <entry>set syslog <quote>ident</quote> field</entry>
20361 </row>
20362 <row>
20363 <entry><option>syslog_timestamp</option></entry>
20364 <entry>timestamp syslog lines</entry>
20365 </row>
20366 <row>
20367 <entry><option>write_rejectlog</option></entry>
20368 <entry>control use of message log</entry>
20369 </row>
20370 </tbody>
20371 </tgroup>
20372 </informaltable>
20373 </section>
20374 <section id="SECID100">
20375 <title>Frozen messages</title>
20376 <informaltable frame="none">
20377 <tgroup cols="2" colsep="0" rowsep="0">
20378 <colspec colwidth="196pt" align="left"/>
20379 <colspec colwidth="254pt" align="left"/>
20380 <tbody>
20381 <row>
20382 <entry><option>auto_thaw</option></entry>
20383 <entry>sets time for retrying frozen messages</entry>
20384 </row>
20385 <row>
20386 <entry><option>freeze_tell</option></entry>
20387 <entry>send message when freezing</entry>
20388 </row>
20389 <row>
20390 <entry><option>move_frozen_messages</option></entry>
20391 <entry>to another directory</entry>
20392 </row>
20393 <row>
20394 <entry><option>timeout_frozen_after</option></entry>
20395 <entry>keep frozen messages only so long</entry>
20396 </row>
20397 </tbody>
20398 </tgroup>
20399 </informaltable>
20400 </section>
20401 <section id="SECID101">
20402 <title>Data lookups</title>
20403 <informaltable frame="none">
20404 <tgroup cols="2" colsep="0" rowsep="0">
20405 <colspec colwidth="196pt" align="left"/>
20406 <colspec colwidth="254pt" align="left"/>
20407 <tbody>
20408 <row>
20409 <entry><option>ibase_servers</option></entry>
20410 <entry>InterBase servers</entry>
20411 </row>
20412 <row>
20413 <entry><option>ldap_ca_cert_dir</option></entry>
20414 <entry>dir of CA certs to verify LDAP server&#x2019;s</entry>
20415 </row>
20416 <row>
20417 <entry><option>ldap_ca_cert_file</option></entry>
20418 <entry>file of CA certs to verify LDAP server&#x2019;s</entry>
20419 </row>
20420 <row>
20421 <entry><option>ldap_cert_file</option></entry>
20422 <entry>client cert file for LDAP</entry>
20423 </row>
20424 <row>
20425 <entry><option>ldap_cert_key</option></entry>
20426 <entry>client key file for LDAP</entry>
20427 </row>
20428 <row>
20429 <entry><option>ldap_cipher_suite</option></entry>
20430 <entry>TLS negotiation preference control</entry>
20431 </row>
20432 <row>
20433 <entry><option>ldap_default_servers</option></entry>
20434 <entry>used if no server in query</entry>
20435 </row>
20436 <row>
20437 <entry><option>ldap_require_cert</option></entry>
20438 <entry>action to take without LDAP server cert</entry>
20439 </row>
20440 <row>
20441 <entry><option>ldap_start_tls</option></entry>
20442 <entry>require TLS within LDAP</entry>
20443 </row>
20444 <row>
20445 <entry><option>ldap_version</option></entry>
20446 <entry>set protocol version</entry>
20447 </row>
20448 <row>
20449 <entry><option>lookup_open_max</option></entry>
20450 <entry>lookup files held open</entry>
20451 </row>
20452 <row>
20453 <entry><option>mysql_servers</option></entry>
20454 <entry>default MySQL servers</entry>
20455 </row>
20456 <row>
20457 <entry><option>oracle_servers</option></entry>
20458 <entry>Oracle servers</entry>
20459 </row>
20460 <row>
20461 <entry><option>pgsql_servers</option></entry>
20462 <entry>default PostgreSQL servers</entry>
20463 </row>
20464 <row>
20465 <entry><option>sqlite_lock_timeout</option></entry>
20466 <entry>as it says</entry>
20467 </row>
20468 </tbody>
20469 </tgroup>
20470 </informaltable>
20471 </section>
20472 <section id="SECID102">
20473 <title>Message ids</title>
20474 <informaltable frame="none">
20475 <tgroup cols="2" colsep="0" rowsep="0">
20476 <colspec colwidth="196pt" align="left"/>
20477 <colspec colwidth="254pt" align="left"/>
20478 <tbody>
20479 <row>
20480 <entry><option>message_id_header_domain</option></entry>
20481 <entry>used to build <emphasis>Message-ID:</emphasis> header</entry>
20482 </row>
20483 <row>
20484 <entry><option>message_id_header_text</option></entry>
20485 <entry>ditto</entry>
20486 </row>
20487 </tbody>
20488 </tgroup>
20489 </informaltable>
20490 </section>
20491 <section id="SECID103">
20492 <title>Embedded Perl Startup</title>
20493 <informaltable frame="none">
20494 <tgroup cols="2" colsep="0" rowsep="0">
20495 <colspec colwidth="196pt" align="left"/>
20496 <colspec colwidth="254pt" align="left"/>
20497 <tbody>
20498 <row>
20499 <entry><option>perl_at_start</option></entry>
20500 <entry>always start the interpreter</entry>
20501 </row>
20502 <row>
20503 <entry><option>perl_startup</option></entry>
20504 <entry>code to obey when starting Perl</entry>
20505 </row>
20506 </tbody>
20507 </tgroup>
20508 </informaltable>
20509 </section>
20510 <section id="SECID104">
20511 <title>Daemon</title>
20512 <informaltable frame="none">
20513 <tgroup cols="2" colsep="0" rowsep="0">
20514 <colspec colwidth="196pt" align="left"/>
20515 <colspec colwidth="254pt" align="left"/>
20516 <tbody>
20517 <row>
20518 <entry><option>daemon_smtp_ports</option></entry>
20519 <entry>default ports</entry>
20520 </row>
20521 <row>
20522 <entry><option>daemon_startup_retries</option></entry>
20523 <entry>number of times to retry</entry>
20524 </row>
20525 <row>
20526 <entry><option>daemon_startup_sleep</option></entry>
20527 <entry>time to sleep between tries</entry>
20528 </row>
20529 <row>
20530 <entry><option>extra_local_interfaces</option></entry>
20531 <entry>not necessarily listened on</entry>
20532 </row>
20533 <row>
20534 <entry><option>local_interfaces</option></entry>
20535 <entry>on which to listen, with optional ports</entry>
20536 </row>
20537 <row>
20538 <entry><option>pid_file_path</option></entry>
20539 <entry>override compiled-in value</entry>
20540 </row>
20541 <row>
20542 <entry><option>queue_run_max</option></entry>
20543 <entry>maximum simultaneous queue runners</entry>
20544 </row>
20545 </tbody>
20546 </tgroup>
20547 </informaltable>
20548 </section>
20549 <section id="SECID105">
20550 <title>Resource control</title>
20551 <informaltable frame="none">
20552 <tgroup cols="2" colsep="0" rowsep="0">
20553 <colspec colwidth="196pt" align="left"/>
20554 <colspec colwidth="254pt" align="left"/>
20555 <tbody>
20556 <row>
20557 <entry><option>check_log_inodes</option></entry>
20558 <entry>before accepting a message</entry>
20559 </row>
20560 <row>
20561 <entry><option>check_log_space</option></entry>
20562 <entry>before accepting a message</entry>
20563 </row>
20564 <row>
20565 <entry><option>check_spool_inodes</option></entry>
20566 <entry>before accepting a message</entry>
20567 </row>
20568 <row>
20569 <entry><option>check_spool_space</option></entry>
20570 <entry>before accepting a message</entry>
20571 </row>
20572 <row>
20573 <entry><option>deliver_queue_load_max</option></entry>
20574 <entry>no queue deliveries if load high</entry>
20575 </row>
20576 <row>
20577 <entry><option>queue_only_load</option></entry>
20578 <entry>queue incoming if load high</entry>
20579 </row>
20580 <row>
20581 <entry><option>queue_only_load_latch</option></entry>
20582 <entry>don&#x2019;t re-evaluate load for each message</entry>
20583 </row>
20584 <row>
20585 <entry><option>queue_run_max</option></entry>
20586 <entry>maximum simultaneous queue runners</entry>
20587 </row>
20588 <row>
20589 <entry><option>remote_max_parallel</option></entry>
20590 <entry>parallel SMTP delivery per message</entry>
20591 </row>
20592 <row>
20593 <entry><option>smtp_accept_max</option></entry>
20594 <entry>simultaneous incoming connections</entry>
20595 </row>
20596 <row>
20597 <entry><option>smtp_accept_max_nonmail</option></entry>
20598 <entry>non-mail commands</entry>
20599 </row>
20600 <row>
20601 <entry><option>smtp_accept_max_nonmail_hosts</option></entry>
20602 <entry>hosts to which the limit applies</entry>
20603 </row>
20604 <row>
20605 <entry><option>smtp_accept_max_per_connection</option></entry>
20606 <entry>messages per connection</entry>
20607 </row>
20608 <row>
20609 <entry><option>smtp_accept_max_per_host</option></entry>
20610 <entry>connections from one host</entry>
20611 </row>
20612 <row>
20613 <entry><option>smtp_accept_queue</option></entry>
20614 <entry>queue mail if more connections</entry>
20615 </row>
20616 <row>
20617 <entry><option>smtp_accept_queue_per_connection</option></entry>
20618 <entry>queue if more messages per connection</entry>
20619 </row>
20620 <row>
20621 <entry><option>smtp_accept_reserve</option></entry>
20622 <entry>only reserve hosts if more connections</entry>
20623 </row>
20624 <row>
20625 <entry><option>smtp_check_spool_space</option></entry>
20626 <entry>from SIZE on MAIL command</entry>
20627 </row>
20628 <row>
20629 <entry><option>smtp_connect_backlog</option></entry>
20630 <entry>passed to TCP/IP stack</entry>
20631 </row>
20632 <row>
20633 <entry><option>smtp_load_reserve</option></entry>
20634 <entry>SMTP from reserved hosts if load high</entry>
20635 </row>
20636 <row>
20637 <entry><option>smtp_reserve_hosts</option></entry>
20638 <entry>these are the reserve hosts</entry>
20639 </row>
20640 </tbody>
20641 </tgroup>
20642 </informaltable>
20643 </section>
20644 <section id="SECID106">
20645 <title>Policy controls</title>
20646 <informaltable frame="none">
20647 <tgroup cols="2" colsep="0" rowsep="0">
20648 <colspec colwidth="196pt" align="left"/>
20649 <colspec colwidth="254pt" align="left"/>
20650 <tbody>
20651 <row>
20652 <entry><option>acl_not_smtp</option></entry>
20653 <entry>ACL for non-SMTP messages</entry>
20654 </row>
20655 <row>
20656 <entry><option>acl_not_smtp_mime</option></entry>
20657 <entry>ACL for non-SMTP MIME parts</entry>
20658 </row>
20659 <row>
20660 <entry><option>acl_not_smtp_start</option></entry>
20661 <entry>ACL for start of non-SMTP message</entry>
20662 </row>
20663 <row>
20664 <entry><option>acl_smtp_auth</option></entry>
20665 <entry>ACL for AUTH</entry>
20666 </row>
20667 <row>
20668 <entry><option>acl_smtp_connect</option></entry>
20669 <entry>ACL for connection</entry>
20670 </row>
20671 <row>
20672 <entry><option>acl_smtp_data</option></entry>
20673 <entry>ACL for DATA</entry>
20674 </row>
20675 <row>
20676 <entry><option>acl_smtp_data_prdr</option></entry>
20677 <entry>ACL for DATA, per-recipient</entry>
20678 </row>
20679 <row>
20680 <entry><option>acl_smtp_dkim</option></entry>
20681 <entry>ACL for DKIM verification</entry>
20682 </row>
20683 <row>
20684 <entry><option>acl_smtp_etrn</option></entry>
20685 <entry>ACL for ETRN</entry>
20686 </row>
20687 <row>
20688 <entry><option>acl_smtp_expn</option></entry>
20689 <entry>ACL for EXPN</entry>
20690 </row>
20691 <row>
20692 <entry><option>acl_smtp_helo</option></entry>
20693 <entry>ACL for EHLO or HELO</entry>
20694 </row>
20695 <row>
20696 <entry><option>acl_smtp_mail</option></entry>
20697 <entry>ACL for MAIL</entry>
20698 </row>
20699 <row>
20700 <entry><option>acl_smtp_mailauth</option></entry>
20701 <entry>ACL for AUTH on MAIL command</entry>
20702 </row>
20703 <row>
20704 <entry><option>acl_smtp_mime</option></entry>
20705 <entry>ACL for MIME parts</entry>
20706 </row>
20707 <row>
20708 <entry><option>acl_smtp_predata</option></entry>
20709 <entry>ACL for start of data</entry>
20710 </row>
20711 <row>
20712 <entry><option>acl_smtp_quit</option></entry>
20713 <entry>ACL for QUIT</entry>
20714 </row>
20715 <row>
20716 <entry><option>acl_smtp_rcpt</option></entry>
20717 <entry>ACL for RCPT</entry>
20718 </row>
20719 <row>
20720 <entry><option>acl_smtp_starttls</option></entry>
20721 <entry>ACL for STARTTLS</entry>
20722 </row>
20723 <row>
20724 <entry><option>acl_smtp_vrfy</option></entry>
20725 <entry>ACL for VRFY</entry>
20726 </row>
20727 <row>
20728 <entry><option>av_scanner</option></entry>
20729 <entry>specify virus scanner</entry>
20730 </row>
20731 <row>
20732 <entry><option>check_rfc2047_length</option></entry>
20733 <entry>check length of RFC 2047 <quote>encoded words</quote></entry>
20734 </row>
20735 <row>
20736 <entry><option>dns_csa_search_limit</option></entry>
20737 <entry>control CSA parent search depth</entry>
20738 </row>
20739 <row>
20740 <entry><option>dns_csa_use_reverse</option></entry>
20741 <entry>en/disable CSA IP reverse search</entry>
20742 </row>
20743 <row>
20744 <entry><option>header_maxsize</option></entry>
20745 <entry>total size of message header</entry>
20746 </row>
20747 <row>
20748 <entry><option>header_line_maxsize</option></entry>
20749 <entry>individual header line limit</entry>
20750 </row>
20751 <row>
20752 <entry><option>helo_accept_junk_hosts</option></entry>
20753 <entry>allow syntactic junk from these hosts</entry>
20754 </row>
20755 <row>
20756 <entry><option>helo_allow_chars</option></entry>
20757 <entry>allow illegal chars in HELO names</entry>
20758 </row>
20759 <row>
20760 <entry><option>helo_lookup_domains</option></entry>
20761 <entry>lookup hostname for these HELO names</entry>
20762 </row>
20763 <row>
20764 <entry><option>helo_try_verify_hosts</option></entry>
20765 <entry>HELO soft-checked for these hosts</entry>
20766 </row>
20767 <row>
20768 <entry><option>helo_verify_hosts</option></entry>
20769 <entry>HELO hard-checked for these hosts</entry>
20770 </row>
20771 <row>
20772 <entry><option>host_lookup</option></entry>
20773 <entry>host name looked up for these hosts</entry>
20774 </row>
20775 <row>
20776 <entry><option>host_lookup_order</option></entry>
20777 <entry>order of DNS and local name lookups</entry>
20778 </row>
20779 <row>
20780 <entry><option>host_reject_connection</option></entry>
20781 <entry>reject connection from these hosts</entry>
20782 </row>
20783 <row>
20784 <entry><option>hosts_treat_as_local</option></entry>
20785 <entry>useful in some cluster configurations</entry>
20786 </row>
20787 <row>
20788 <entry><option>local_scan_timeout</option></entry>
20789 <entry>timeout for <function>local_scan()</function></entry>
20790 </row>
20791 <row>
20792 <entry><option>message_size_limit</option></entry>
20793 <entry>for all messages</entry>
20794 </row>
20795 <row>
20796 <entry><option>percent_hack_domains</option></entry>
20797 <entry>recognize %-hack for these domains</entry>
20798 </row>
20799 <row>
20800 <entry><option>spamd_address</option></entry>
20801 <entry>set interface to SpamAssassin</entry>
20802 </row>
20803 <row>
20804 <entry><option>strict_acl_vars</option></entry>
20805 <entry>object to unset ACL variables</entry>
20806 </row>
20807 </tbody>
20808 </tgroup>
20809 </informaltable>
20810 </section>
20811 <section id="SECID107">
20812 <title>Callout cache</title>
20813 <informaltable frame="none">
20814 <tgroup cols="2" colsep="0" rowsep="0">
20815 <colspec colwidth="196pt" align="left"/>
20816 <colspec colwidth="254pt" align="left"/>
20817 <tbody>
20818 <row>
20819 <entry><option>callout_domain_negative_expire</option></entry>
20820 <entry>timeout for negative domain cache item</entry>
20821 </row>
20822 <row>
20823 <entry><option>callout_domain_positive_expire</option></entry>
20824 <entry>timeout for positive domain cache item</entry>
20825 </row>
20826 <row>
20827 <entry><option>callout_negative_expire</option></entry>
20828 <entry>timeout for negative address cache item</entry>
20829 </row>
20830 <row>
20831 <entry><option>callout_positive_expire</option></entry>
20832 <entry>timeout for positive address cache item</entry>
20833 </row>
20834 <row>
20835 <entry><option>callout_random_local_part</option></entry>
20836 <entry>string to use for <quote>random</quote> testing</entry>
20837 </row>
20838 </tbody>
20839 </tgroup>
20840 </informaltable>
20841 </section>
20842 <section id="SECID108">
20843 <title>TLS</title>
20844 <informaltable frame="none">
20845 <tgroup cols="2" colsep="0" rowsep="0">
20846 <colspec colwidth="196pt" align="left"/>
20847 <colspec colwidth="254pt" align="left"/>
20848 <tbody>
20849 <row>
20850 <entry><option>gnutls_compat_mode</option></entry>
20851 <entry>use GnuTLS compatibility mode</entry>
20852 </row>
20853 <row>
20854 <entry><option>gnutls_allow_auto_pkcs11</option></entry>
20855 <entry>allow GnuTLS to autoload PKCS11 modules</entry>
20856 </row>
20857 <row>
20858 <entry><option>openssl_options</option></entry>
20859 <entry>adjust OpenSSL compatibility options</entry>
20860 </row>
20861 <row>
20862 <entry><option>tls_advertise_hosts</option></entry>
20863 <entry>advertise TLS to these hosts</entry>
20864 </row>
20865 <row>
20866 <entry><option>tls_certificate</option></entry>
20867 <entry>location of server certificate</entry>
20868 </row>
20869 <row>
20870 <entry><option>tls_crl</option></entry>
20871 <entry>certificate revocation list</entry>
20872 </row>
20873 <row>
20874 <entry><option>tls_dh_max_bits</option></entry>
20875 <entry>clamp D-H bit count suggestion</entry>
20876 </row>
20877 <row>
20878 <entry><option>tls_dhparam</option></entry>
20879 <entry>DH parameters for server</entry>
20880 </row>
20881 <row>
20882 <entry><option>tls_ocsp_file</option></entry>
20883 <entry>location of server certificate status proof</entry>
20884 </row>
20885 <row>
20886 <entry><option>tls_on_connect_ports</option></entry>
20887 <entry>specify SSMTP (SMTPS) ports</entry>
20888 </row>
20889 <row>
20890 <entry><option>tls_privatekey</option></entry>
20891 <entry>location of server private key</entry>
20892 </row>
20893 <row>
20894 <entry><option>tls_remember_esmtp</option></entry>
20895 <entry>don&#x2019;t reset after starting TLS</entry>
20896 </row>
20897 <row>
20898 <entry><option>tls_require_ciphers</option></entry>
20899 <entry>specify acceptable ciphers</entry>
20900 </row>
20901 <row>
20902 <entry><option>tls_try_verify_hosts</option></entry>
20903 <entry>try to verify client certificate</entry>
20904 </row>
20905 <row>
20906 <entry><option>tls_verify_certificates</option></entry>
20907 <entry>expected client certificates</entry>
20908 </row>
20909 <row>
20910 <entry><option>tls_verify_hosts</option></entry>
20911 <entry>insist on client certificate verify</entry>
20912 </row>
20913 </tbody>
20914 </tgroup>
20915 </informaltable>
20916 </section>
20917 <section id="SECID109">
20918 <title>Local user handling</title>
20919 <informaltable frame="none">
20920 <tgroup cols="2" colsep="0" rowsep="0">
20921 <colspec colwidth="196pt" align="left"/>
20922 <colspec colwidth="254pt" align="left"/>
20923 <tbody>
20924 <row>
20925 <entry><option>finduser_retries</option></entry>
20926 <entry>useful in NIS environments</entry>
20927 </row>
20928 <row>
20929 <entry><option>gecos_name</option></entry>
20930 <entry>used when creating <emphasis>Sender:</emphasis></entry>
20931 </row>
20932 <row>
20933 <entry><option>gecos_pattern</option></entry>
20934 <entry>ditto</entry>
20935 </row>
20936 <row>
20937 <entry><option>max_username_length</option></entry>
20938 <entry>for systems that truncate</entry>
20939 </row>
20940 <row>
20941 <entry><option>unknown_login</option></entry>
20942 <entry>used when no login name found</entry>
20943 </row>
20944 <row>
20945 <entry><option>unknown_username</option></entry>
20946 <entry>ditto</entry>
20947 </row>
20948 <row>
20949 <entry><option>uucp_from_pattern</option></entry>
20950 <entry>for recognizing <quote>From </quote> lines</entry>
20951 </row>
20952 <row>
20953 <entry><option>uucp_from_sender</option></entry>
20954 <entry>ditto</entry>
20955 </row>
20956 </tbody>
20957 </tgroup>
20958 </informaltable>
20959 </section>
20960 <section id="SECID110">
20961 <title>All incoming messages (SMTP and non-SMTP)</title>
20962 <informaltable frame="none">
20963 <tgroup cols="2" colsep="0" rowsep="0">
20964 <colspec colwidth="196pt" align="left"/>
20965 <colspec colwidth="254pt" align="left"/>
20966 <tbody>
20967 <row>
20968 <entry><option>header_maxsize</option></entry>
20969 <entry>total size of message header</entry>
20970 </row>
20971 <row>
20972 <entry><option>header_line_maxsize</option></entry>
20973 <entry>individual header line limit</entry>
20974 </row>
20975 <row>
20976 <entry><option>message_size_limit</option></entry>
20977 <entry>applies to all messages</entry>
20978 </row>
20979 <row>
20980 <entry><option>percent_hack_domains</option></entry>
20981 <entry>recognize %-hack for these domains</entry>
20982 </row>
20983 <row>
20984 <entry><option>received_header_text</option></entry>
20985 <entry>expanded to make <emphasis>Received:</emphasis></entry>
20986 </row>
20987 <row>
20988 <entry><option>received_headers_max</option></entry>
20989 <entry>for mail loop detection</entry>
20990 </row>
20991 <row>
20992 <entry><option>recipients_max</option></entry>
20993 <entry>limit per message</entry>
20994 </row>
20995 <row>
20996 <entry><option>recipients_max_reject</option></entry>
20997 <entry>permanently reject excess recipients</entry>
20998 </row>
20999 </tbody>
21000 </tgroup>
21001 </informaltable>
21002 </section>
21003 <section id="SECID111">
21004 <title>Non-SMTP incoming messages</title>
21005 <informaltable frame="none">
21006 <tgroup cols="2" colsep="0" rowsep="0">
21007 <colspec colwidth="196pt" align="left"/>
21008 <colspec colwidth="254pt" align="left"/>
21009 <tbody>
21010 <row>
21011 <entry><option>receive_timeout</option></entry>
21012 <entry>for non-SMTP messages</entry>
21013 </row>
21014 </tbody>
21015 </tgroup>
21016 </informaltable>
21017 </section>
21018 <section id="SECID112">
21019 <title>Incoming SMTP messages</title>
21020 <para>
21021 See also the <emphasis>Policy controls</emphasis> section above.
21022 </para>
21023 <informaltable frame="none">
21024 <tgroup cols="2" colsep="0" rowsep="0">
21025 <colspec colwidth="196pt" align="left"/>
21026 <colspec colwidth="254pt" align="left"/>
21027 <tbody>
21028 <row>
21029 <entry><option>host_lookup</option></entry>
21030 <entry>host name looked up for these hosts</entry>
21031 </row>
21032 <row>
21033 <entry><option>host_lookup_order</option></entry>
21034 <entry>order of DNS and local name lookups</entry>
21035 </row>
21036 <row>
21037 <entry><option>recipient_unqualified_hosts</option></entry>
21038 <entry>may send unqualified recipients</entry>
21039 </row>
21040 <row>
21041 <entry><option>rfc1413_hosts</option></entry>
21042 <entry>make ident calls to these hosts</entry>
21043 </row>
21044 <row>
21045 <entry><option>rfc1413_query_timeout</option></entry>
21046 <entry>zero disables ident calls</entry>
21047 </row>
21048 <row>
21049 <entry><option>sender_unqualified_hosts</option></entry>
21050 <entry>may send unqualified senders</entry>
21051 </row>
21052 <row>
21053 <entry><option>smtp_accept_keepalive</option></entry>
21054 <entry>some TCP/IP magic</entry>
21055 </row>
21056 <row>
21057 <entry><option>smtp_accept_max</option></entry>
21058 <entry>simultaneous incoming connections</entry>
21059 </row>
21060 <row>
21061 <entry><option>smtp_accept_max_nonmail</option></entry>
21062 <entry>non-mail commands</entry>
21063 </row>
21064 <row>
21065 <entry><option>smtp_accept_max_nonmail_hosts</option></entry>
21066 <entry>hosts to which the limit applies</entry>
21067 </row>
21068 <row>
21069 <entry><option>smtp_accept_max_per_connection</option></entry>
21070 <entry>messages per connection</entry>
21071 </row>
21072 <row>
21073 <entry><option>smtp_accept_max_per_host</option></entry>
21074 <entry>connections from one host</entry>
21075 </row>
21076 <row>
21077 <entry><option>smtp_accept_queue</option></entry>
21078 <entry>queue mail if more connections</entry>
21079 </row>
21080 <row>
21081 <entry><option>smtp_accept_queue_per_connection</option></entry>
21082 <entry>queue if more messages per connection</entry>
21083 </row>
21084 <row>
21085 <entry><option>smtp_accept_reserve</option></entry>
21086 <entry>only reserve hosts if more connections</entry>
21087 </row>
21088 <row>
21089 <entry><option>smtp_active_hostname</option></entry>
21090 <entry>host name to use in messages</entry>
21091 </row>
21092 <row>
21093 <entry><option>smtp_banner</option></entry>
21094 <entry>text for welcome banner</entry>
21095 </row>
21096 <row>
21097 <entry><option>smtp_check_spool_space</option></entry>
21098 <entry>from SIZE on MAIL command</entry>
21099 </row>
21100 <row>
21101 <entry><option>smtp_connect_backlog</option></entry>
21102 <entry>passed to TCP/IP stack</entry>
21103 </row>
21104 <row>
21105 <entry><option>smtp_enforce_sync</option></entry>
21106 <entry>of SMTP command/responses</entry>
21107 </row>
21108 <row>
21109 <entry><option>smtp_etrn_command</option></entry>
21110 <entry>what to run for ETRN</entry>
21111 </row>
21112 <row>
21113 <entry><option>smtp_etrn_serialize</option></entry>
21114 <entry>only one at once</entry>
21115 </row>
21116 <row>
21117 <entry><option>smtp_load_reserve</option></entry>
21118 <entry>only reserve hosts if this load</entry>
21119 </row>
21120 <row>
21121 <entry><option>smtp_max_unknown_commands</option></entry>
21122 <entry>before dropping connection</entry>
21123 </row>
21124 <row>
21125 <entry><option>smtp_ratelimit_hosts</option></entry>
21126 <entry>apply ratelimiting to these hosts</entry>
21127 </row>
21128 <row>
21129 <entry><option>smtp_ratelimit_mail</option></entry>
21130 <entry>ratelimit for MAIL commands</entry>
21131 </row>
21132 <row>
21133 <entry><option>smtp_ratelimit_rcpt</option></entry>
21134 <entry>ratelimit for RCPT commands</entry>
21135 </row>
21136 <row>
21137 <entry><option>smtp_receive_timeout</option></entry>
21138 <entry>per command or data line</entry>
21139 </row>
21140 <row>
21141 <entry><option>smtp_reserve_hosts</option></entry>
21142 <entry>these are the reserve hosts</entry>
21143 </row>
21144 <row>
21145 <entry><option>smtp_return_error_details</option></entry>
21146 <entry>give detail on rejections</entry>
21147 </row>
21148 </tbody>
21149 </tgroup>
21150 </informaltable>
21151 </section>
21152 <section id="SECID113">
21153 <title>SMTP extensions</title>
21154 <informaltable frame="none">
21155 <tgroup cols="2" colsep="0" rowsep="0">
21156 <colspec colwidth="196pt" align="left"/>
21157 <colspec colwidth="254pt" align="left"/>
21158 <tbody>
21159 <row>
21160 <entry><option>accept_8bitmime</option></entry>
21161 <entry>advertise 8BITMIME</entry>
21162 </row>
21163 <row>
21164 <entry><option>auth_advertise_hosts</option></entry>
21165 <entry>advertise AUTH to these hosts</entry>
21166 </row>
21167 <row>
21168 <entry><option>ignore_fromline_hosts</option></entry>
21169 <entry>allow <quote>From </quote> from these hosts</entry>
21170 </row>
21171 <row>
21172 <entry><option>ignore_fromline_local</option></entry>
21173 <entry>allow <quote>From </quote> from local SMTP</entry>
21174 </row>
21175 <row>
21176 <entry><option>pipelining_advertise_hosts</option></entry>
21177 <entry>advertise pipelining to these hosts</entry>
21178 </row>
21179 <row>
21180 <entry><option>prdr_enable</option></entry>
21181 <entry>advertise PRDR to all hosts</entry>
21182 </row>
21183 <row>
21184 <entry><option>tls_advertise_hosts</option></entry>
21185 <entry>advertise TLS to these hosts</entry>
21186 </row>
21187 </tbody>
21188 </tgroup>
21189 </informaltable>
21190 </section>
21191 <section id="SECID114">
21192 <title>Processing messages</title>
21193 <informaltable frame="none">
21194 <tgroup cols="2" colsep="0" rowsep="0">
21195 <colspec colwidth="196pt" align="left"/>
21196 <colspec colwidth="254pt" align="left"/>
21197 <tbody>
21198 <row>
21199 <entry><option>allow_domain_literals</option></entry>
21200 <entry>recognize domain literal syntax</entry>
21201 </row>
21202 <row>
21203 <entry><option>allow_mx_to_ip</option></entry>
21204 <entry>allow MX to point to IP address</entry>
21205 </row>
21206 <row>
21207 <entry><option>allow_utf8_domains</option></entry>
21208 <entry>in addresses</entry>
21209 </row>
21210 <row>
21211 <entry><option>check_rfc2047_length</option></entry>
21212 <entry>check length of RFC 2047 <quote>encoded words</quote></entry>
21213 </row>
21214 <row>
21215 <entry><option>delivery_date_remove</option></entry>
21216 <entry>from incoming messages</entry>
21217 </row>
21218 <row>
21219 <entry><option>envelope_to_remove</option></entry>
21220 <entry>from incoming messages</entry>
21221 </row>
21222 <row>
21223 <entry><option>extract_addresses_remove_arguments</option></entry>
21224 <entry>affects <option>-t</option> processing</entry>
21225 </row>
21226 <row>
21227 <entry><option>headers_charset</option></entry>
21228 <entry>default for translations</entry>
21229 </row>
21230 <row>
21231 <entry><option>qualify_domain</option></entry>
21232 <entry>default for senders</entry>
21233 </row>
21234 <row>
21235 <entry><option>qualify_recipient</option></entry>
21236 <entry>default for recipients</entry>
21237 </row>
21238 <row>
21239 <entry><option>return_path_remove</option></entry>
21240 <entry>from incoming messages</entry>
21241 </row>
21242 <row>
21243 <entry><option>strip_excess_angle_brackets</option></entry>
21244 <entry>in addresses</entry>
21245 </row>
21246 <row>
21247 <entry><option>strip_trailing_dot</option></entry>
21248 <entry>at end of addresses</entry>
21249 </row>
21250 <row>
21251 <entry><option>untrusted_set_sender</option></entry>
21252 <entry>untrusted can set envelope sender</entry>
21253 </row>
21254 </tbody>
21255 </tgroup>
21256 </informaltable>
21257 </section>
21258 <section id="SECID115">
21259 <title>System filter</title>
21260 <informaltable frame="none">
21261 <tgroup cols="2" colsep="0" rowsep="0">
21262 <colspec colwidth="196pt" align="left"/>
21263 <colspec colwidth="254pt" align="left"/>
21264 <tbody>
21265 <row>
21266 <entry><option>system_filter</option></entry>
21267 <entry>locate system filter</entry>
21268 </row>
21269 <row>
21270 <entry><option>system_filter_directory_transport</option></entry>
21271 <entry>transport for delivery to a directory</entry>
21272 </row>
21273 <row>
21274 <entry><option>system_filter_file_transport</option></entry>
21275 <entry>transport for delivery to a file</entry>
21276 </row>
21277 <row>
21278 <entry><option>system_filter_group</option></entry>
21279 <entry>group for filter running</entry>
21280 </row>
21281 <row>
21282 <entry><option>system_filter_pipe_transport</option></entry>
21283 <entry>transport for delivery to a pipe</entry>
21284 </row>
21285 <row>
21286 <entry><option>system_filter_reply_transport</option></entry>
21287 <entry>transport for autoreply delivery</entry>
21288 </row>
21289 <row>
21290 <entry><option>system_filter_user</option></entry>
21291 <entry>user for filter running</entry>
21292 </row>
21293 </tbody>
21294 </tgroup>
21295 </informaltable>
21296 </section>
21297 <section id="SECID116">
21298 <title>Routing and delivery</title>
21299 <informaltable frame="none">
21300 <tgroup cols="2" colsep="0" rowsep="0">
21301 <colspec colwidth="196pt" align="left"/>
21302 <colspec colwidth="254pt" align="left"/>
21303 <tbody>
21304 <row>
21305 <entry><option>disable_ipv6</option></entry>
21306 <entry>do no IPv6 processing</entry>
21307 </row>
21308 <row>
21309 <entry><option>dns_again_means_nonexist</option></entry>
21310 <entry>for broken domains</entry>
21311 </row>
21312 <row>
21313 <entry><option>dns_check_names_pattern</option></entry>
21314 <entry>pre-DNS syntax check</entry>
21315 </row>
21316 <row>
21317 <entry><option>dns_dnssec_ok</option></entry>
21318 <entry>parameter for resolver</entry>
21319 </row>
21320 <row>
21321 <entry><option>dns_ipv4_lookup</option></entry>
21322 <entry>only v4 lookup for these domains</entry>
21323 </row>
21324 <row>
21325 <entry><option>dns_retrans</option></entry>
21326 <entry>parameter for resolver</entry>
21327 </row>
21328 <row>
21329 <entry><option>dns_retry</option></entry>
21330 <entry>parameter for resolver</entry>
21331 </row>
21332 <row>
21333 <entry><option>dns_use_edns0</option></entry>
21334 <entry>parameter for resolver</entry>
21335 </row>
21336 <row>
21337 <entry><option>hold_domains</option></entry>
21338 <entry>hold delivery for these domains</entry>
21339 </row>
21340 <row>
21341 <entry><option>local_interfaces</option></entry>
21342 <entry>for routing checks</entry>
21343 </row>
21344 <row>
21345 <entry><option>queue_domains</option></entry>
21346 <entry>no immediate delivery for these</entry>
21347 </row>
21348 <row>
21349 <entry><option>queue_only</option></entry>
21350 <entry>no immediate delivery at all</entry>
21351 </row>
21352 <row>
21353 <entry><option>queue_only_file</option></entry>
21354 <entry>no immediate delivery if file exists</entry>
21355 </row>
21356 <row>
21357 <entry><option>queue_only_load</option></entry>
21358 <entry>no immediate delivery if load is high</entry>
21359 </row>
21360 <row>
21361 <entry><option>queue_only_load_latch</option></entry>
21362 <entry>don&#x2019;t re-evaluate load for each message</entry>
21363 </row>
21364 <row>
21365 <entry><option>queue_only_override</option></entry>
21366 <entry>allow command line to override</entry>
21367 </row>
21368 <row>
21369 <entry><option>queue_run_in_order</option></entry>
21370 <entry>order of arrival</entry>
21371 </row>
21372 <row>
21373 <entry><option>queue_run_max</option></entry>
21374 <entry>of simultaneous queue runners</entry>
21375 </row>
21376 <row>
21377 <entry><option>queue_smtp_domains</option></entry>
21378 <entry>no immediate SMTP delivery for these</entry>
21379 </row>
21380 <row>
21381 <entry><option>remote_max_parallel</option></entry>
21382 <entry>parallel SMTP delivery per message</entry>
21383 </row>
21384 <row>
21385 <entry><option>remote_sort_domains</option></entry>
21386 <entry>order of remote deliveries</entry>
21387 </row>
21388 <row>
21389 <entry><option>retry_data_expire</option></entry>
21390 <entry>timeout for retry data</entry>
21391 </row>
21392 <row>
21393 <entry><option>retry_interval_max</option></entry>
21394 <entry>safety net for retry rules</entry>
21395 </row>
21396 </tbody>
21397 </tgroup>
21398 </informaltable>
21399 </section>
21400 <section id="SECID117">
21401 <title>Bounce and warning messages</title>
21402 <informaltable frame="none">
21403 <tgroup cols="2" colsep="0" rowsep="0">
21404 <colspec colwidth="196pt" align="left"/>
21405 <colspec colwidth="254pt" align="left"/>
21406 <tbody>
21407 <row>
21408 <entry><option>bounce_message_file</option></entry>
21409 <entry>content of bounce</entry>
21410 </row>
21411 <row>
21412 <entry><option>bounce_message_text</option></entry>
21413 <entry>content of bounce</entry>
21414 </row>
21415 <row>
21416 <entry><option>bounce_return_body</option></entry>
21417 <entry>include body if returning message</entry>
21418 </row>
21419 <row>
21420 <entry><option>bounce_return_message</option></entry>
21421 <entry>include original message in bounce</entry>
21422 </row>
21423 <row>
21424 <entry><option>bounce_return_size_limit</option></entry>
21425 <entry>limit on returned message</entry>
21426 </row>
21427 <row>
21428 <entry><option>bounce_sender_authentication</option></entry>
21429 <entry>send authenticated sender with bounce</entry>
21430 </row>
21431 <row>
21432 <entry><option>dsn_from</option></entry>
21433 <entry>set <emphasis>From:</emphasis> contents in bounces</entry>
21434 </row>
21435 <row>
21436 <entry><option>errors_copy</option></entry>
21437 <entry>copy bounce messages</entry>
21438 </row>
21439 <row>
21440 <entry><option>errors_reply_to</option></entry>
21441 <entry><emphasis>Reply-to:</emphasis> in bounces</entry>
21442 </row>
21443 <row>
21444 <entry><option>delay_warning</option></entry>
21445 <entry>time schedule</entry>
21446 </row>
21447 <row>
21448 <entry><option>delay_warning_condition</option></entry>
21449 <entry>condition for warning messages</entry>
21450 </row>
21451 <row>
21452 <entry><option>ignore_bounce_errors_after</option></entry>
21453 <entry>discard undeliverable bounces</entry>
21454 </row>
21455 <row>
21456 <entry><option>smtp_return_error_details</option></entry>
21457 <entry>give detail on rejections</entry>
21458 </row>
21459 <row>
21460 <entry><option>warn_message_file</option></entry>
21461 <entry>content of warning message</entry>
21462 </row>
21463 </tbody>
21464 </tgroup>
21465 </informaltable>
21466 </section>
21467 <section id="SECTalomo">
21468 <title>Alphabetical list of main options</title>
21469 <para>
21470 Those options that undergo string expansion before use are marked with
21471 &dagger;.
21472 </para>
21473 <para>
21474 <indexterm role="option">
21475 <primary><option>accept_8bitmime</option></primary>
21476 </indexterm>
21477 </para>
21478 <informaltable frame="all">
21479 <tgroup cols="4" colsep="0" rowsep="0">
21480 <colspec colwidth="8*" align="left"/>
21481 <colspec colwidth="6*" align="center"/>
21482 <colspec colwidth="6*" align="center"/>
21483 <colspec colwidth="6*" align="right"/>
21484 <tbody>
21485 <row>
21486 <entry><option>accept_8bitmime</option></entry>
21487 <entry>Use: <emphasis>main</emphasis></entry>
21488 <entry>Type: <emphasis>boolean</emphasis></entry>
21489 <entry>Default: <emphasis>true</emphasis></entry>
21490 </row>
21491 </tbody>
21492 </tgroup>
21493 </informaltable>
21494 <para>
21495 <indexterm role="concept">
21496 <primary>8BITMIME</primary>
21497 </indexterm>
21498 <indexterm role="concept">
21499 <primary>8-bit characters</primary>
21500 </indexterm>
21501 <indexterm role="concept">
21502 <primary>log</primary>
21503 <secondary>selectors</secondary>
21504 </indexterm>
21505 <indexterm role="concept">
21506 <primary>log</primary>
21507 <secondary>8BITMIME</secondary>
21508 </indexterm>
21509 This option causes Exim to send 8BITMIME in its response to an SMTP
21510 EHLO command, and to accept the BODY= parameter on MAIL commands.
21511 However, though Exim is 8-bit clean, it is not a protocol converter, and it
21512 takes no steps to do anything special with messages received by this route.
21513 </para>
21514 <para>
21515 Historically Exim kept this option off by default, but the maintainers
21516 feel that in today&#x2019;s Internet, this causes more problems than it solves.
21517 It now defaults to true.
21518 A more detailed analysis of the issues is provided by Dan Bernstein:
21519 </para>
21520 <literallayout>
21521 <emphasis role="bold"><ulink url="http://cr.yp.to/smtp/8bitmime.html">http://cr.yp.to/smtp/8bitmime.html</ulink></emphasis>
21522 </literallayout>
21523 <para>
21524 To log received 8BITMIME status use
21525 </para>
21526 <literallayout class="monospaced">
21527 log_selector = +8bitmime
21528 </literallayout>
21529 <para>
21530 <indexterm role="option">
21531 <primary><option>acl_not_smtp</option></primary>
21532 </indexterm>
21533 </para>
21534 <informaltable frame="all">
21535 <tgroup cols="4" colsep="0" rowsep="0">
21536 <colspec colwidth="8*" align="left"/>
21537 <colspec colwidth="6*" align="center"/>
21538 <colspec colwidth="6*" align="center"/>
21539 <colspec colwidth="6*" align="right"/>
21540 <tbody>
21541 <row>
21542 <entry><option>acl_not_smtp</option></entry>
21543 <entry>Use: <emphasis>main</emphasis></entry>
21544 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
21545 <entry>Default: <emphasis>unset</emphasis></entry>
21546 </row>
21547 </tbody>
21548 </tgroup>
21549 </informaltable>
21550 <para>
21551 <indexterm role="concept">
21552 <primary>access control lists (ACLs)</primary>
21553 <secondary>for non-SMTP messages</secondary>
21554 </indexterm>
21555 <indexterm role="concept">
21556 <primary>non-SMTP messages</primary>
21557 <secondary>ACLs for</secondary>
21558 </indexterm>
21559 This option defines the ACL that is run when a non-SMTP message has been
21560 read and is on the point of being accepted. See chapter <xref linkend="CHAPACL"/> for
21561 further details.
21562 </para>
21563 <para>
21564 <indexterm role="option">
21565 <primary><option>acl_not_smtp_mime</option></primary>
21566 </indexterm>
21567 </para>
21568 <informaltable frame="all">
21569 <tgroup cols="4" colsep="0" rowsep="0">
21570 <colspec colwidth="8*" align="left"/>
21571 <colspec colwidth="6*" align="center"/>
21572 <colspec colwidth="6*" align="center"/>
21573 <colspec colwidth="6*" align="right"/>
21574 <tbody>
21575 <row>
21576 <entry><option>acl_not_smtp_mime</option></entry>
21577 <entry>Use: <emphasis>main</emphasis></entry>
21578 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
21579 <entry>Default: <emphasis>unset</emphasis></entry>
21580 </row>
21581 </tbody>
21582 </tgroup>
21583 </informaltable>
21584 <para>
21585 This option defines the ACL that is run for individual MIME parts of non-SMTP
21586 messages. It operates in exactly the same way as <option>acl_smtp_mime</option> operates for
21587 SMTP messages.
21588 </para>
21589 <para>
21590 <indexterm role="option">
21591 <primary><option>acl_not_smtp_start</option></primary>
21592 </indexterm>
21593 </para>
21594 <informaltable frame="all">
21595 <tgroup cols="4" colsep="0" rowsep="0">
21596 <colspec colwidth="8*" align="left"/>
21597 <colspec colwidth="6*" align="center"/>
21598 <colspec colwidth="6*" align="center"/>
21599 <colspec colwidth="6*" align="right"/>
21600 <tbody>
21601 <row>
21602 <entry><option>acl_not_smtp_start</option></entry>
21603 <entry>Use: <emphasis>main</emphasis></entry>
21604 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
21605 <entry>Default: <emphasis>unset</emphasis></entry>
21606 </row>
21607 </tbody>
21608 </tgroup>
21609 </informaltable>
21610 <para>
21611 <indexterm role="concept">
21612 <primary>access control lists (ACLs)</primary>
21613 <secondary>at start of non-SMTP message</secondary>
21614 </indexterm>
21615 <indexterm role="concept">
21616 <primary>non-SMTP messages</primary>
21617 <secondary>ACLs for</secondary>
21618 </indexterm>
21619 This option defines the ACL that is run before Exim starts reading a
21620 non-SMTP message. See chapter <xref linkend="CHAPACL"/> for further details.
21621 </para>
21622 <para>
21623 <indexterm role="option">
21624 <primary><option>acl_smtp_auth</option></primary>
21625 </indexterm>
21626 </para>
21627 <informaltable frame="all">
21628 <tgroup cols="4" colsep="0" rowsep="0">
21629 <colspec colwidth="8*" align="left"/>
21630 <colspec colwidth="6*" align="center"/>
21631 <colspec colwidth="6*" align="center"/>
21632 <colspec colwidth="6*" align="right"/>
21633 <tbody>
21634 <row>
21635 <entry><option>acl_smtp_auth</option></entry>
21636 <entry>Use: <emphasis>main</emphasis></entry>
21637 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
21638 <entry>Default: <emphasis>unset</emphasis></entry>
21639 </row>
21640 </tbody>
21641 </tgroup>
21642 </informaltable>
21643 <para>
21644 <indexterm role="concept">
21645 <primary>access control lists (ACLs)</primary>
21646 <secondary>setting up for SMTP commands</secondary>
21647 </indexterm>
21648 <indexterm role="concept">
21649 <primary>AUTH</primary>
21650 <secondary>ACL for</secondary>
21651 </indexterm>
21652 This option defines the ACL that is run when an SMTP AUTH command is
21653 received. See chapter <xref linkend="CHAPACL"/> for further details.
21654 </para>
21655 <para>
21656 <indexterm role="option">
21657 <primary><option>acl_smtp_connect</option></primary>
21658 </indexterm>
21659 </para>
21660 <informaltable frame="all">
21661 <tgroup cols="4" colsep="0" rowsep="0">
21662 <colspec colwidth="8*" align="left"/>
21663 <colspec colwidth="6*" align="center"/>
21664 <colspec colwidth="6*" align="center"/>
21665 <colspec colwidth="6*" align="right"/>
21666 <tbody>
21667 <row>
21668 <entry><option>acl_smtp_connect</option></entry>
21669 <entry>Use: <emphasis>main</emphasis></entry>
21670 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
21671 <entry>Default: <emphasis>unset</emphasis></entry>
21672 </row>
21673 </tbody>
21674 </tgroup>
21675 </informaltable>
21676 <para>
21677 <indexterm role="concept">
21678 <primary>access control lists (ACLs)</primary>
21679 <secondary>on SMTP connection</secondary>
21680 </indexterm>
21681 This option defines the ACL that is run when an SMTP connection is received.
21682 See chapter <xref linkend="CHAPACL"/> for further details.
21683 </para>
21684 <para>
21685 <indexterm role="option">
21686 <primary><option>acl_smtp_data</option></primary>
21687 </indexterm>
21688 </para>
21689 <informaltable frame="all">
21690 <tgroup cols="4" colsep="0" rowsep="0">
21691 <colspec colwidth="8*" align="left"/>
21692 <colspec colwidth="6*" align="center"/>
21693 <colspec colwidth="6*" align="center"/>
21694 <colspec colwidth="6*" align="right"/>
21695 <tbody>
21696 <row>
21697 <entry><option>acl_smtp_data</option></entry>
21698 <entry>Use: <emphasis>main</emphasis></entry>
21699 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
21700 <entry>Default: <emphasis>unset</emphasis></entry>
21701 </row>
21702 </tbody>
21703 </tgroup>
21704 </informaltable>
21705 <para>
21706 <indexterm role="concept">
21707 <primary>DATA</primary>
21708 <secondary>ACL for</secondary>
21709 </indexterm>
21710 This option defines the ACL that is run after an SMTP DATA command has been
21711 processed and the message itself has been received, but before the final
21712 acknowledgment is sent. See chapter <xref linkend="CHAPACL"/> for further details.
21713 </para>
21714 <para>
21715 <indexterm role="option">
21716 <primary><option>acl_smtp_data_prdr</option></primary>
21717 </indexterm>
21718 </para>
21719 <informaltable frame="all">
21720 <tgroup cols="4" colsep="0" rowsep="0">
21721 <colspec colwidth="8*" align="left"/>
21722 <colspec colwidth="6*" align="center"/>
21723 <colspec colwidth="6*" align="center"/>
21724 <colspec colwidth="6*" align="right"/>
21725 <tbody>
21726 <row>
21727 <entry><option>acl_smtp_data_prdr</option></entry>
21728 <entry>Use: <emphasis>main</emphasis></entry>
21729 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
21730 <entry>Default: <emphasis>unset</emphasis></entry>
21731 </row>
21732 </tbody>
21733 </tgroup>
21734 </informaltable>
21735 <para>
21736 <indexterm role="concept">
21737 <primary>DATA</primary>
21738 <secondary>ACL for</secondary>
21739 </indexterm>
21740 <indexterm role="concept">
21741 <primary>access control lists (ACLs)</primary>
21742 <secondary>PRDR-related</secondary>
21743 </indexterm>
21744 <indexterm role="concept">
21745 <primary>access control lists (ACLs)</primary>
21746 <secondary>per-user data processing</secondary>
21747 </indexterm>
21748 This option defines the ACL that,
21749 if the PRDR feature has been negotiated,
21750 is run for each recipient after an SMTP DATA command has been
21751 processed and the message itself has been received, but before the
21752 acknowledgment is sent. See chapter <xref linkend="CHAPACL"/> for further details.
21753 </para>
21754 <para>
21755 <indexterm role="option">
21756 <primary><option>acl_smtp_etrn</option></primary>
21757 </indexterm>
21758 </para>
21759 <informaltable frame="all">
21760 <tgroup cols="4" colsep="0" rowsep="0">
21761 <colspec colwidth="8*" align="left"/>
21762 <colspec colwidth="6*" align="center"/>
21763 <colspec colwidth="6*" align="center"/>
21764 <colspec colwidth="6*" align="right"/>
21765 <tbody>
21766 <row>
21767 <entry><option>acl_smtp_etrn</option></entry>
21768 <entry>Use: <emphasis>main</emphasis></entry>
21769 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
21770 <entry>Default: <emphasis>unset</emphasis></entry>
21771 </row>
21772 </tbody>
21773 </tgroup>
21774 </informaltable>
21775 <para>
21776 <indexterm role="concept">
21777 <primary>ETRN</primary>
21778 <secondary>ACL for</secondary>
21779 </indexterm>
21780 This option defines the ACL that is run when an SMTP ETRN command is
21781 received. See chapter <xref linkend="CHAPACL"/> for further details.
21782 </para>
21783 <para>
21784 <indexterm role="option">
21785 <primary><option>acl_smtp_expn</option></primary>
21786 </indexterm>
21787 </para>
21788 <informaltable frame="all">
21789 <tgroup cols="4" colsep="0" rowsep="0">
21790 <colspec colwidth="8*" align="left"/>
21791 <colspec colwidth="6*" align="center"/>
21792 <colspec colwidth="6*" align="center"/>
21793 <colspec colwidth="6*" align="right"/>
21794 <tbody>
21795 <row>
21796 <entry><option>acl_smtp_expn</option></entry>
21797 <entry>Use: <emphasis>main</emphasis></entry>
21798 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
21799 <entry>Default: <emphasis>unset</emphasis></entry>
21800 </row>
21801 </tbody>
21802 </tgroup>
21803 </informaltable>
21804 <para>
21805 <indexterm role="concept">
21806 <primary>EXPN</primary>
21807 <secondary>ACL for</secondary>
21808 </indexterm>
21809 This option defines the ACL that is run when an SMTP EXPN command is
21810 received. See chapter <xref linkend="CHAPACL"/> for further details.
21811 </para>
21812 <para>
21813 <indexterm role="option">
21814 <primary><option>acl_smtp_helo</option></primary>
21815 </indexterm>
21816 </para>
21817 <informaltable frame="all">
21818 <tgroup cols="4" colsep="0" rowsep="0">
21819 <colspec colwidth="8*" align="left"/>
21820 <colspec colwidth="6*" align="center"/>
21821 <colspec colwidth="6*" align="center"/>
21822 <colspec colwidth="6*" align="right"/>
21823 <tbody>
21824 <row>
21825 <entry><option>acl_smtp_helo</option></entry>
21826 <entry>Use: <emphasis>main</emphasis></entry>
21827 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
21828 <entry>Default: <emphasis>unset</emphasis></entry>
21829 </row>
21830 </tbody>
21831 </tgroup>
21832 </informaltable>
21833 <para>
21834 <indexterm role="concept">
21835 <primary>EHLO</primary>
21836 <secondary>ACL for</secondary>
21837 </indexterm>
21838 <indexterm role="concept">
21839 <primary>HELO</primary>
21840 <secondary>ACL for</secondary>
21841 </indexterm>
21842 This option defines the ACL that is run when an SMTP EHLO or HELO
21843 command is received. See chapter <xref linkend="CHAPACL"/> for further details.
21844 </para>
21845 <para>
21846 <indexterm role="option">
21847 <primary><option>acl_smtp_mail</option></primary>
21848 </indexterm>
21849 </para>
21850 <informaltable frame="all">
21851 <tgroup cols="4" colsep="0" rowsep="0">
21852 <colspec colwidth="8*" align="left"/>
21853 <colspec colwidth="6*" align="center"/>
21854 <colspec colwidth="6*" align="center"/>
21855 <colspec colwidth="6*" align="right"/>
21856 <tbody>
21857 <row>
21858 <entry><option>acl_smtp_mail</option></entry>
21859 <entry>Use: <emphasis>main</emphasis></entry>
21860 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
21861 <entry>Default: <emphasis>unset</emphasis></entry>
21862 </row>
21863 </tbody>
21864 </tgroup>
21865 </informaltable>
21866 <para>
21867 <indexterm role="concept">
21868 <primary>MAIL</primary>
21869 <secondary>ACL for</secondary>
21870 </indexterm>
21871 This option defines the ACL that is run when an SMTP MAIL command is
21872 received. See chapter <xref linkend="CHAPACL"/> for further details.
21873 </para>
21874 <para>
21875 <indexterm role="option">
21876 <primary><option>acl_smtp_mailauth</option></primary>
21877 </indexterm>
21878 </para>
21879 <informaltable frame="all">
21880 <tgroup cols="4" colsep="0" rowsep="0">
21881 <colspec colwidth="8*" align="left"/>
21882 <colspec colwidth="6*" align="center"/>
21883 <colspec colwidth="6*" align="center"/>
21884 <colspec colwidth="6*" align="right"/>
21885 <tbody>
21886 <row>
21887 <entry><option>acl_smtp_mailauth</option></entry>
21888 <entry>Use: <emphasis>main</emphasis></entry>
21889 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
21890 <entry>Default: <emphasis>unset</emphasis></entry>
21891 </row>
21892 </tbody>
21893 </tgroup>
21894 </informaltable>
21895 <para>
21896 <indexterm role="concept">
21897 <primary>AUTH</primary>
21898 <secondary>on MAIL command</secondary>
21899 </indexterm>
21900 This option defines the ACL that is run when there is an AUTH parameter on
21901 a MAIL command. See chapter <xref linkend="CHAPACL"/> for details of ACLs, and chapter
21902 <xref linkend="CHAPSMTPAUTH"/> for details of authentication.
21903 </para>
21904 <para>
21905 <indexterm role="option">
21906 <primary><option>acl_smtp_mime</option></primary>
21907 </indexterm>
21908 </para>
21909 <informaltable frame="all">
21910 <tgroup cols="4" colsep="0" rowsep="0">
21911 <colspec colwidth="8*" align="left"/>
21912 <colspec colwidth="6*" align="center"/>
21913 <colspec colwidth="6*" align="center"/>
21914 <colspec colwidth="6*" align="right"/>
21915 <tbody>
21916 <row>
21917 <entry><option>acl_smtp_mime</option></entry>
21918 <entry>Use: <emphasis>main</emphasis></entry>
21919 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
21920 <entry>Default: <emphasis>unset</emphasis></entry>
21921 </row>
21922 </tbody>
21923 </tgroup>
21924 </informaltable>
21925 <para>
21926 <indexterm role="concept">
21927 <primary>MIME content scanning</primary>
21928 <secondary>ACL for</secondary>
21929 </indexterm>
21930 This option is available when Exim is built with the content-scanning
21931 extension. It defines the ACL that is run for each MIME part in a message. See
21932 section <xref linkend="SECTscanmimepart"/> for details.
21933 </para>
21934 <para>
21935 <indexterm role="option">
21936 <primary><option>acl_smtp_predata</option></primary>
21937 </indexterm>
21938 </para>
21939 <informaltable frame="all">
21940 <tgroup cols="4" colsep="0" rowsep="0">
21941 <colspec colwidth="8*" align="left"/>
21942 <colspec colwidth="6*" align="center"/>
21943 <colspec colwidth="6*" align="center"/>
21944 <colspec colwidth="6*" align="right"/>
21945 <tbody>
21946 <row>
21947 <entry><option>acl_smtp_predata</option></entry>
21948 <entry>Use: <emphasis>main</emphasis></entry>
21949 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
21950 <entry>Default: <emphasis>unset</emphasis></entry>
21951 </row>
21952 </tbody>
21953 </tgroup>
21954 </informaltable>
21955 <para>
21956 This option defines the ACL that is run when an SMTP DATA command is
21957 received, before the message itself is received. See chapter <xref linkend="CHAPACL"/> for
21958 further details.
21959 </para>
21960 <para>
21961 <indexterm role="option">
21962 <primary><option>acl_smtp_quit</option></primary>
21963 </indexterm>
21964 </para>
21965 <informaltable frame="all">
21966 <tgroup cols="4" colsep="0" rowsep="0">
21967 <colspec colwidth="8*" align="left"/>
21968 <colspec colwidth="6*" align="center"/>
21969 <colspec colwidth="6*" align="center"/>
21970 <colspec colwidth="6*" align="right"/>
21971 <tbody>
21972 <row>
21973 <entry><option>acl_smtp_quit</option></entry>
21974 <entry>Use: <emphasis>main</emphasis></entry>
21975 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
21976 <entry>Default: <emphasis>unset</emphasis></entry>
21977 </row>
21978 </tbody>
21979 </tgroup>
21980 </informaltable>
21981 <para>
21982 <indexterm role="concept">
21983 <primary>QUIT, ACL for</primary>
21984 </indexterm>
21985 This option defines the ACL that is run when an SMTP QUIT command is
21986 received. See chapter <xref linkend="CHAPACL"/> for further details.
21987 </para>
21988 <para>
21989 <indexterm role="option">
21990 <primary><option>acl_smtp_rcpt</option></primary>
21991 </indexterm>
21992 </para>
21993 <informaltable frame="all">
21994 <tgroup cols="4" colsep="0" rowsep="0">
21995 <colspec colwidth="8*" align="left"/>
21996 <colspec colwidth="6*" align="center"/>
21997 <colspec colwidth="6*" align="center"/>
21998 <colspec colwidth="6*" align="right"/>
21999 <tbody>
22000 <row>
22001 <entry><option>acl_smtp_rcpt</option></entry>
22002 <entry>Use: <emphasis>main</emphasis></entry>
22003 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
22004 <entry>Default: <emphasis>unset</emphasis></entry>
22005 </row>
22006 </tbody>
22007 </tgroup>
22008 </informaltable>
22009 <para>
22010 <indexterm role="concept">
22011 <primary>RCPT</primary>
22012 <secondary>ACL for</secondary>
22013 </indexterm>
22014 This option defines the ACL that is run when an SMTP RCPT command is
22015 received. See chapter <xref linkend="CHAPACL"/> for further details.
22016 </para>
22017 <para>
22018 <indexterm role="option">
22019 <primary><option>acl_smtp_starttls</option></primary>
22020 </indexterm>
22021 </para>
22022 <informaltable frame="all">
22023 <tgroup cols="4" colsep="0" rowsep="0">
22024 <colspec colwidth="8*" align="left"/>
22025 <colspec colwidth="6*" align="center"/>
22026 <colspec colwidth="6*" align="center"/>
22027 <colspec colwidth="6*" align="right"/>
22028 <tbody>
22029 <row>
22030 <entry><option>acl_smtp_starttls</option></entry>
22031 <entry>Use: <emphasis>main</emphasis></entry>
22032 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
22033 <entry>Default: <emphasis>unset</emphasis></entry>
22034 </row>
22035 </tbody>
22036 </tgroup>
22037 </informaltable>
22038 <para>
22039 <indexterm role="concept">
22040 <primary>STARTTLS, ACL for</primary>
22041 </indexterm>
22042 This option defines the ACL that is run when an SMTP STARTTLS command is
22043 received. See chapter <xref linkend="CHAPACL"/> for further details.
22044 </para>
22045 <para>
22046 <indexterm role="option">
22047 <primary><option>acl_smtp_vrfy</option></primary>
22048 </indexterm>
22049 </para>
22050 <informaltable frame="all">
22051 <tgroup cols="4" colsep="0" rowsep="0">
22052 <colspec colwidth="8*" align="left"/>
22053 <colspec colwidth="6*" align="center"/>
22054 <colspec colwidth="6*" align="center"/>
22055 <colspec colwidth="6*" align="right"/>
22056 <tbody>
22057 <row>
22058 <entry><option>acl_smtp_vrfy</option></entry>
22059 <entry>Use: <emphasis>main</emphasis></entry>
22060 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
22061 <entry>Default: <emphasis>unset</emphasis></entry>
22062 </row>
22063 </tbody>
22064 </tgroup>
22065 </informaltable>
22066 <para>
22067 <indexterm role="concept">
22068 <primary>VRFY</primary>
22069 <secondary>ACL for</secondary>
22070 </indexterm>
22071 This option defines the ACL that is run when an SMTP VRFY command is
22072 received. See chapter <xref linkend="CHAPACL"/> for further details.
22073 </para>
22074 <para>
22075 <indexterm role="option">
22076 <primary><option>admin_groups</option></primary>
22077 </indexterm>
22078 </para>
22079 <informaltable frame="all">
22080 <tgroup cols="4" colsep="0" rowsep="0">
22081 <colspec colwidth="8*" align="left"/>
22082 <colspec colwidth="6*" align="center"/>
22083 <colspec colwidth="6*" align="center"/>
22084 <colspec colwidth="6*" align="right"/>
22085 <tbody>
22086 <row>
22087 <entry><option>admin_groups</option></entry>
22088 <entry>Use: <emphasis>main</emphasis></entry>
22089 <entry>Type: <emphasis>string list</emphasis>&dagger;<emphasis></emphasis></entry>
22090 <entry>Default: <emphasis>unset</emphasis></entry>
22091 </row>
22092 </tbody>
22093 </tgroup>
22094 </informaltable>
22095 <para>
22096 <indexterm role="concept">
22097 <primary>admin user</primary>
22098 </indexterm>
22099 This option is expanded just once, at the start of Exim&#x2019;s processing. If the
22100 current group or any of the supplementary groups of an Exim caller is in this
22101 colon-separated list, the caller has admin privileges. If all your system
22102 programmers are in a specific group, for example, you can give them all Exim
22103 admin privileges by putting that group in <option>admin_groups</option>. However, this does
22104 not permit them to read Exim&#x2019;s spool files (whose group owner is the Exim gid).
22105 To permit this, you have to add individuals to the Exim group.
22106 </para>
22107 <para>
22108 <indexterm role="option">
22109 <primary><option>allow_domain_literals</option></primary>
22110 </indexterm>
22111 </para>
22112 <informaltable frame="all">
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>allow_domain_literals</option></entry>
22121 <entry>Use: <emphasis>main</emphasis></entry>
22122 <entry>Type: <emphasis>boolean</emphasis></entry>
22123 <entry>Default: <emphasis>false</emphasis></entry>
22124 </row>
22125 </tbody>
22126 </tgroup>
22127 </informaltable>
22128 <para>
22129 <indexterm role="concept">
22130 <primary>domain literal</primary>
22131 </indexterm>
22132 If this option is set, the RFC 2822 domain literal format is permitted in
22133 email addresses. The option is not set by default, because the domain literal
22134 format is not normally required these days, and few people know about it. It
22135 has, however, been exploited by mail abusers.
22136 </para>
22137 <para>
22138 Unfortunately, it seems that some DNS black list maintainers are using this
22139 format to report black listing to postmasters. If you want to accept messages
22140 addressed to your hosts by IP address, you need to set
22141 <option>allow_domain_literals</option> true, and also to add <literal>@[]</literal> to the list of local
22142 domains (defined in the named domain list <option>local_domains</option> in the default
22143 configuration). This <quote>magic string</quote> matches the domain literal form of all
22144 the local host&#x2019;s IP addresses.
22145 </para>
22146 <para>
22147 <indexterm role="option">
22148 <primary><option>allow_mx_to_ip</option></primary>
22149 </indexterm>
22150 </para>
22151 <informaltable frame="all">
22152 <tgroup cols="4" colsep="0" rowsep="0">
22153 <colspec colwidth="8*" align="left"/>
22154 <colspec colwidth="6*" align="center"/>
22155 <colspec colwidth="6*" align="center"/>
22156 <colspec colwidth="6*" align="right"/>
22157 <tbody>
22158 <row>
22159 <entry><option>allow_mx_to_ip</option></entry>
22160 <entry>Use: <emphasis>main</emphasis></entry>
22161 <entry>Type: <emphasis>boolean</emphasis></entry>
22162 <entry>Default: <emphasis>false</emphasis></entry>
22163 </row>
22164 </tbody>
22165 </tgroup>
22166 </informaltable>
22167 <para>
22168 <indexterm role="concept">
22169 <primary>MX record</primary>
22170 <secondary>pointing to IP address</secondary>
22171 </indexterm>
22172 It appears that more and more DNS zone administrators are breaking the rules
22173 and putting domain names that look like IP addresses on the right hand side of
22174 MX records. Exim follows the rules and rejects this, giving an error message
22175 that explains the mis-configuration. However, some other MTAs support this
22176 practice, so to avoid <quote>Why can&#x2019;t Exim do this?</quote> complaints,
22177 <option>allow_mx_to_ip</option> exists, in order to enable this heinous activity. It is not
22178 recommended, except when you have no other choice.
22179 </para>
22180 <para>
22181 <indexterm role="option">
22182 <primary><option>allow_utf8_domains</option></primary>
22183 </indexterm>
22184 </para>
22185 <informaltable frame="all">
22186 <tgroup cols="4" colsep="0" rowsep="0">
22187 <colspec colwidth="8*" align="left"/>
22188 <colspec colwidth="6*" align="center"/>
22189 <colspec colwidth="6*" align="center"/>
22190 <colspec colwidth="6*" align="right"/>
22191 <tbody>
22192 <row>
22193 <entry><option>allow_utf8_domains</option></entry>
22194 <entry>Use: <emphasis>main</emphasis></entry>
22195 <entry>Type: <emphasis>boolean</emphasis></entry>
22196 <entry>Default: <emphasis>false</emphasis></entry>
22197 </row>
22198 </tbody>
22199 </tgroup>
22200 </informaltable>
22201 <para>
22202 <indexterm role="concept">
22203 <primary>domain</primary>
22204 <secondary>UTF-8 characters in</secondary>
22205 </indexterm>
22206 <indexterm role="concept">
22207 <primary>UTF-8</primary>
22208 <secondary>in domain name</secondary>
22209 </indexterm>
22210 Lots of discussion is going on about internationalized domain names. One
22211 camp is strongly in favour of just using UTF-8 characters, and it seems
22212 that at least two other MTAs permit this. This option allows Exim users to
22213 experiment if they wish.
22214 </para>
22215 <para>
22216 If it is set true, Exim&#x2019;s domain parsing function allows valid
22217 UTF-8 multicharacters to appear in domain name components, in addition to
22218 letters, digits, and hyphens. However, just setting this option is not
22219 enough; if you want to look up these domain names in the DNS, you must also
22220 adjust the value of <option>dns_check_names_pattern</option> to match the extended form. A
22221 suitable setting is:
22222 </para>
22223 <literallayout class="monospaced">
22224 dns_check_names_pattern = (?i)^(?&gt;(?(1)\.|())[a-z0-9\xc0-\xff]\
22225   (?&gt;[-a-z0-9\x80-\xff]*[a-z0-9\x80-\xbf])?)+$
22226 </literallayout>
22227 <para>
22228 Alternatively, you can just disable this feature by setting
22229 </para>
22230 <literallayout class="monospaced">
22231 dns_check_names_pattern =
22232 </literallayout>
22233 <para>
22234 That is, set the option to an empty string so that no check is done.
22235 </para>
22236 <para>
22237 <indexterm role="option">
22238 <primary><option>auth_advertise_hosts</option></primary>
22239 </indexterm>
22240 </para>
22241 <informaltable frame="all">
22242 <tgroup cols="4" colsep="0" rowsep="0">
22243 <colspec colwidth="8*" align="left"/>
22244 <colspec colwidth="6*" align="center"/>
22245 <colspec colwidth="6*" align="center"/>
22246 <colspec colwidth="6*" align="right"/>
22247 <tbody>
22248 <row>
22249 <entry><option>auth_advertise_hosts</option></entry>
22250 <entry>Use: <emphasis>main</emphasis></entry>
22251 <entry>Type: <emphasis>host list</emphasis>&dagger;<emphasis></emphasis></entry>
22252 <entry>Default: <emphasis>*</emphasis></entry>
22253 </row>
22254 </tbody>
22255 </tgroup>
22256 </informaltable>
22257 <para>
22258 <indexterm role="concept">
22259 <primary>authentication</primary>
22260 <secondary>advertising</secondary>
22261 </indexterm>
22262 <indexterm role="concept">
22263 <primary>AUTH</primary>
22264 <secondary>advertising</secondary>
22265 </indexterm>
22266 If any server authentication mechanisms are configured, Exim advertises them in
22267 response to an EHLO command only if the calling host matches this list.
22268 Otherwise, Exim does not advertise AUTH.
22269 Exim does not accept AUTH commands from clients to which it has not
22270 advertised the availability of AUTH. The advertising of individual
22271 authentication mechanisms can be controlled by the use of the
22272 <option>server_advertise_condition</option> generic authenticator option on the individual
22273 authenticators. See chapter <xref linkend="CHAPSMTPAUTH"/> for further details.
22274 </para>
22275 <para>
22276 Certain mail clients (for example, Netscape) require the user to provide a name
22277 and password for authentication if AUTH is advertised, even though it may
22278 not be needed (the host may accept messages from hosts on its local LAN without
22279 authentication, for example). The <option>auth_advertise_hosts</option> option can be used
22280 to make these clients more friendly by excluding them from the set of hosts to
22281 which Exim advertises AUTH.
22282 </para>
22283 <para>
22284 <indexterm role="concept">
22285 <primary>AUTH</primary>
22286 <secondary>advertising when encrypted</secondary>
22287 </indexterm>
22288 If you want to advertise the availability of AUTH only when the connection
22289 is encrypted using TLS, you can make use of the fact that the value of this
22290 option is expanded, with a setting like this:
22291 </para>
22292 <literallayout class="monospaced">
22293 auth_advertise_hosts = ${if eq{$tls_in_cipher}{}{}{*}}
22294 </literallayout>
22295 <para>
22296 <indexterm role="variable">
22297 <primary><varname>$tls_in_cipher</varname></primary>
22298 </indexterm>
22299 If <varname>$tls_in_cipher</varname> is empty, the session is not encrypted, and the result of
22300 the expansion is empty, thus matching no hosts. Otherwise, the result of the
22301 expansion is *, which matches all hosts.
22302 </para>
22303 <para>
22304 <indexterm role="option">
22305 <primary><option>auto_thaw</option></primary>
22306 </indexterm>
22307 </para>
22308 <informaltable frame="all">
22309 <tgroup cols="4" colsep="0" rowsep="0">
22310 <colspec colwidth="8*" align="left"/>
22311 <colspec colwidth="6*" align="center"/>
22312 <colspec colwidth="6*" align="center"/>
22313 <colspec colwidth="6*" align="right"/>
22314 <tbody>
22315 <row>
22316 <entry><option>auto_thaw</option></entry>
22317 <entry>Use: <emphasis>main</emphasis></entry>
22318 <entry>Type: <emphasis>time</emphasis></entry>
22319 <entry>Default: <emphasis>0s</emphasis></entry>
22320 </row>
22321 </tbody>
22322 </tgroup>
22323 </informaltable>
22324 <para>
22325 <indexterm role="concept">
22326 <primary>thawing messages</primary>
22327 </indexterm>
22328 <indexterm role="concept">
22329 <primary>unfreezing messages</primary>
22330 </indexterm>
22331 If this option is set to a time greater than zero, a queue runner will try a
22332 new delivery attempt on any frozen message, other than a bounce message, if
22333 this much time has passed since it was frozen. This may result in the message
22334 being re-frozen if nothing has changed since the last attempt. It is a way of
22335 saying <quote>keep on trying, even though there are big problems</quote>.
22336 </para>
22337 <para>
22338 <emphasis role="bold">Note</emphasis>: This is an old option, which predates <option>timeout_frozen_after</option> and
22339 <option>ignore_bounce_errors_after</option>. It is retained for compatibility, but it is not
22340 thought to be very useful any more, and its use should probably be avoided.
22341 </para>
22342 <para>
22343 <indexterm role="option">
22344 <primary><option>av_scanner</option></primary>
22345 </indexterm>
22346 </para>
22347 <informaltable frame="all">
22348 <tgroup cols="4" colsep="0" rowsep="0">
22349 <colspec colwidth="8*" align="left"/>
22350 <colspec colwidth="6*" align="center"/>
22351 <colspec colwidth="6*" align="center"/>
22352 <colspec colwidth="6*" align="right"/>
22353 <tbody>
22354 <row>
22355 <entry><option>av_scanner</option></entry>
22356 <entry>Use: <emphasis>main</emphasis></entry>
22357 <entry>Type: <emphasis>string</emphasis></entry>
22358 <entry>Default: <emphasis>see below</emphasis></entry>
22359 </row>
22360 </tbody>
22361 </tgroup>
22362 </informaltable>
22363 <para>
22364 This option is available if Exim is built with the content-scanning extension.
22365 It specifies which anti-virus scanner to use. The default value is:
22366 </para>
22367 <literallayout class="monospaced">
22368 sophie:/var/run/sophie
22369 </literallayout>
22370 <para>
22371 If the value of <option>av_scanner</option> starts with a dollar character, it is expanded
22372 before use. See section <xref linkend="SECTscanvirus"/> for further details.
22373 </para>
22374 <para>
22375 <indexterm role="option">
22376 <primary><option>bi_command</option></primary>
22377 </indexterm>
22378 </para>
22379 <informaltable frame="all">
22380 <tgroup cols="4" colsep="0" rowsep="0">
22381 <colspec colwidth="8*" align="left"/>
22382 <colspec colwidth="6*" align="center"/>
22383 <colspec colwidth="6*" align="center"/>
22384 <colspec colwidth="6*" align="right"/>
22385 <tbody>
22386 <row>
22387 <entry><option>bi_command</option></entry>
22388 <entry>Use: <emphasis>main</emphasis></entry>
22389 <entry>Type: <emphasis>string</emphasis></entry>
22390 <entry>Default: <emphasis>unset</emphasis></entry>
22391 </row>
22392 </tbody>
22393 </tgroup>
22394 </informaltable>
22395 <para>
22396 <indexterm role="option">
22397 <primary><option>-bi</option></primary>
22398 </indexterm>
22399 This option supplies the name of a command that is run when Exim is called with
22400 the <option>-bi</option> option (see chapter <xref linkend="CHAPcommandline"/>). The string value is
22401 just the command name, it is not a complete command line. If an argument is
22402 required, it must come from the <option>-oA</option> command line option.
22403 </para>
22404 <para>
22405 <indexterm role="option">
22406 <primary><option>bounce_message_file</option></primary>
22407 </indexterm>
22408 </para>
22409 <informaltable frame="all">
22410 <tgroup cols="4" colsep="0" rowsep="0">
22411 <colspec colwidth="8*" align="left"/>
22412 <colspec colwidth="6*" align="center"/>
22413 <colspec colwidth="6*" align="center"/>
22414 <colspec colwidth="6*" align="right"/>
22415 <tbody>
22416 <row>
22417 <entry><option>bounce_message_file</option></entry>
22418 <entry>Use: <emphasis>main</emphasis></entry>
22419 <entry>Type: <emphasis>string</emphasis></entry>
22420 <entry>Default: <emphasis>unset</emphasis></entry>
22421 </row>
22422 </tbody>
22423 </tgroup>
22424 </informaltable>
22425 <para>
22426 <indexterm role="concept">
22427 <primary>bounce message</primary>
22428 <secondary>customizing</secondary>
22429 </indexterm>
22430 <indexterm role="concept">
22431 <primary>customizing</primary>
22432 <secondary>bounce message</secondary>
22433 </indexterm>
22434 This option defines a template file containing paragraphs of text to be used
22435 for constructing bounce messages.  Details of the file&#x2019;s contents are given in
22436 chapter <xref linkend="CHAPemsgcust"/>. See also <option>warn_message_file</option>.
22437 </para>
22438 <para>
22439 <indexterm role="option">
22440 <primary><option>bounce_message_text</option></primary>
22441 </indexterm>
22442 </para>
22443 <informaltable frame="all">
22444 <tgroup cols="4" colsep="0" rowsep="0">
22445 <colspec colwidth="8*" align="left"/>
22446 <colspec colwidth="6*" align="center"/>
22447 <colspec colwidth="6*" align="center"/>
22448 <colspec colwidth="6*" align="right"/>
22449 <tbody>
22450 <row>
22451 <entry><option>bounce_message_text</option></entry>
22452 <entry>Use: <emphasis>main</emphasis></entry>
22453 <entry>Type: <emphasis>string</emphasis></entry>
22454 <entry>Default: <emphasis>unset</emphasis></entry>
22455 </row>
22456 </tbody>
22457 </tgroup>
22458 </informaltable>
22459 <para>
22460 When this option is set, its contents are included in the default bounce
22461 message immediately after <quote>This message was created automatically by mail
22462 delivery software.</quote> It is not used if <option>bounce_message_file</option> is set.
22463 </para>
22464 <para>
22465 <indexterm role="option">
22466 <primary><option>bounce_return_body</option></primary>
22467 </indexterm>
22468 </para>
22469 <informaltable frame="all">
22470 <tgroup cols="4" colsep="0" rowsep="0">
22471 <colspec colwidth="8*" align="left"/>
22472 <colspec colwidth="6*" align="center"/>
22473 <colspec colwidth="6*" align="center"/>
22474 <colspec colwidth="6*" align="right"/>
22475 <tbody>
22476 <row>
22477 <entry><option>bounce_return_body</option></entry>
22478 <entry>Use: <emphasis>main</emphasis></entry>
22479 <entry>Type: <emphasis>boolean</emphasis></entry>
22480 <entry>Default: <emphasis>true</emphasis></entry>
22481 </row>
22482 </tbody>
22483 </tgroup>
22484 </informaltable>
22485 <para>
22486 <indexterm role="concept">
22487 <primary>bounce message</primary>
22488 <secondary>including body</secondary>
22489 </indexterm>
22490 This option controls whether the body of an incoming message is included in a
22491 bounce message when <option>bounce_return_message</option> is true. The default setting
22492 causes the entire message, both header and body, to be returned (subject to the
22493 value of <option>bounce_return_size_limit</option>). If this option is false, only the
22494 message header is included. In the case of a non-SMTP message containing an
22495 error that is detected during reception, only those header lines preceding the
22496 point at which the error was detected are returned.
22497 <indexterm role="concept">
22498 <primary>bounce message</primary>
22499 <secondary>including original</secondary>
22500 </indexterm>
22501 </para>
22502 <para>
22503 <indexterm role="option">
22504 <primary><option>bounce_return_message</option></primary>
22505 </indexterm>
22506 </para>
22507 <informaltable frame="all">
22508 <tgroup cols="4" colsep="0" rowsep="0">
22509 <colspec colwidth="8*" align="left"/>
22510 <colspec colwidth="6*" align="center"/>
22511 <colspec colwidth="6*" align="center"/>
22512 <colspec colwidth="6*" align="right"/>
22513 <tbody>
22514 <row>
22515 <entry><option>bounce_return_message</option></entry>
22516 <entry>Use: <emphasis>main</emphasis></entry>
22517 <entry>Type: <emphasis>boolean</emphasis></entry>
22518 <entry>Default: <emphasis>true</emphasis></entry>
22519 </row>
22520 </tbody>
22521 </tgroup>
22522 </informaltable>
22523 <para>
22524 If this option is set false, none of the original message is included in
22525 bounce messages generated by Exim. See also <option>bounce_return_size_limit</option> and
22526 <option>bounce_return_body</option>.
22527 </para>
22528 <para>
22529 <indexterm role="option">
22530 <primary><option>bounce_return_size_limit</option></primary>
22531 </indexterm>
22532 </para>
22533 <informaltable frame="all">
22534 <tgroup cols="4" colsep="0" rowsep="0">
22535 <colspec colwidth="8*" align="left"/>
22536 <colspec colwidth="6*" align="center"/>
22537 <colspec colwidth="6*" align="center"/>
22538 <colspec colwidth="6*" align="right"/>
22539 <tbody>
22540 <row>
22541 <entry><option>bounce_return_size_limit</option></entry>
22542 <entry>Use: <emphasis>main</emphasis></entry>
22543 <entry>Type: <emphasis>integer</emphasis></entry>
22544 <entry>Default: <emphasis>100K</emphasis></entry>
22545 </row>
22546 </tbody>
22547 </tgroup>
22548 </informaltable>
22549 <para>
22550 <indexterm role="concept">
22551 <primary>size</primary>
22552 <secondary>of bounce, limit</secondary>
22553 </indexterm>
22554 <indexterm role="concept">
22555 <primary>bounce message</primary>
22556 <secondary>size limit</secondary>
22557 </indexterm>
22558 <indexterm role="concept">
22559 <primary>limit</primary>
22560 <secondary>bounce message size</secondary>
22561 </indexterm>
22562 This option sets a limit in bytes on the size of messages that are returned to
22563 senders as part of bounce messages when <option>bounce_return_message</option> is true. The
22564 limit should be less than the value of the global <option>message_size_limit</option> and of
22565 any <option>message_size_limit</option> settings on transports, to allow for the bounce text
22566 that Exim generates. If this option is set to zero there is no limit.
22567 </para>
22568 <para>
22569 When the body of any message that is to be included in a bounce message is
22570 greater than the limit, it is truncated, and a comment pointing this out is
22571 added at the top. The actual cutoff may be greater than the value given, owing
22572 to the use of buffering for transferring the message in chunks (typically 8K in
22573 size). The idea is to save bandwidth on those undeliverable 15-megabyte
22574 messages.
22575 </para>
22576 <para>
22577 <indexterm role="option">
22578 <primary><option>bounce_sender_authentication</option></primary>
22579 </indexterm>
22580 </para>
22581 <informaltable frame="all">
22582 <tgroup cols="4" colsep="0" rowsep="0">
22583 <colspec colwidth="8*" align="left"/>
22584 <colspec colwidth="6*" align="center"/>
22585 <colspec colwidth="6*" align="center"/>
22586 <colspec colwidth="6*" align="right"/>
22587 <tbody>
22588 <row>
22589 <entry><option>bounce_sender_authentication</option></entry>
22590 <entry>Use: <emphasis>main</emphasis></entry>
22591 <entry>Type: <emphasis>string</emphasis></entry>
22592 <entry>Default: <emphasis>unset</emphasis></entry>
22593 </row>
22594 </tbody>
22595 </tgroup>
22596 </informaltable>
22597 <para>
22598 <indexterm role="concept">
22599 <primary>bounce message</primary>
22600 <secondary>sender authentication</secondary>
22601 </indexterm>
22602 <indexterm role="concept">
22603 <primary>authentication</primary>
22604 <secondary>bounce message</secondary>
22605 </indexterm>
22606 <indexterm role="concept">
22607 <primary>AUTH</primary>
22608 <secondary>on bounce message</secondary>
22609 </indexterm>
22610 This option provides an authenticated sender address that is sent with any
22611 bounce messages generated by Exim that are sent over an authenticated SMTP
22612 connection. A typical setting might be:
22613 </para>
22614 <literallayout class="monospaced">
22615 bounce_sender_authentication = mailer-daemon@my.domain.example
22616 </literallayout>
22617 <para>
22618 which would cause bounce messages to be sent using the SMTP command:
22619 </para>
22620 <literallayout class="monospaced">
22621 MAIL FROM:&lt;&gt; AUTH=mailer-daemon@my.domain.example
22622 </literallayout>
22623 <para>
22624 The value of <option>bounce_sender_authentication</option> must always be a complete email
22625 address.
22626 </para>
22627 <para>
22628 <indexterm role="option">
22629 <primary><option>callout_domain_negative_expire</option></primary>
22630 </indexterm>
22631 </para>
22632 <informaltable frame="all">
22633 <tgroup cols="4" colsep="0" rowsep="0">
22634 <colspec colwidth="8*" align="left"/>
22635 <colspec colwidth="6*" align="center"/>
22636 <colspec colwidth="6*" align="center"/>
22637 <colspec colwidth="6*" align="right"/>
22638 <tbody>
22639 <row>
22640 <entry><option>callout_domain_negative_expire</option></entry>
22641 <entry>Use: <emphasis>main</emphasis></entry>
22642 <entry>Type: <emphasis>time</emphasis></entry>
22643 <entry>Default: <emphasis>3h</emphasis></entry>
22644 </row>
22645 </tbody>
22646 </tgroup>
22647 </informaltable>
22648 <para>
22649 <indexterm role="concept">
22650 <primary>caching</primary>
22651 <secondary>callout timeouts</secondary>
22652 </indexterm>
22653 <indexterm role="concept">
22654 <primary>callout</primary>
22655 <secondary>caching timeouts</secondary>
22656 </indexterm>
22657 This option specifies the expiry time for negative callout cache data for a
22658 domain. See section <xref linkend="SECTcallver"/> for details of callout verification, and
22659 section <xref linkend="SECTcallvercache"/> for details of the caching.
22660 </para>
22661 <para>
22662 <indexterm role="option">
22663 <primary><option>callout_domain_positive_expire</option></primary>
22664 </indexterm>
22665 </para>
22666 <informaltable frame="all">
22667 <tgroup cols="4" colsep="0" rowsep="0">
22668 <colspec colwidth="8*" align="left"/>
22669 <colspec colwidth="6*" align="center"/>
22670 <colspec colwidth="6*" align="center"/>
22671 <colspec colwidth="6*" align="right"/>
22672 <tbody>
22673 <row>
22674 <entry><option>callout_domain_positive_expire</option></entry>
22675 <entry>Use: <emphasis>main</emphasis></entry>
22676 <entry>Type: <emphasis>time</emphasis></entry>
22677 <entry>Default: <emphasis>7d</emphasis></entry>
22678 </row>
22679 </tbody>
22680 </tgroup>
22681 </informaltable>
22682 <para>
22683 This option specifies the expiry time for positive callout cache data for a
22684 domain. See section <xref linkend="SECTcallver"/> for details of callout verification, and
22685 section <xref linkend="SECTcallvercache"/> for details of the caching.
22686 </para>
22687 <para>
22688 <indexterm role="option">
22689 <primary><option>callout_negative_expire</option></primary>
22690 </indexterm>
22691 </para>
22692 <informaltable frame="all">
22693 <tgroup cols="4" colsep="0" rowsep="0">
22694 <colspec colwidth="8*" align="left"/>
22695 <colspec colwidth="6*" align="center"/>
22696 <colspec colwidth="6*" align="center"/>
22697 <colspec colwidth="6*" align="right"/>
22698 <tbody>
22699 <row>
22700 <entry><option>callout_negative_expire</option></entry>
22701 <entry>Use: <emphasis>main</emphasis></entry>
22702 <entry>Type: <emphasis>time</emphasis></entry>
22703 <entry>Default: <emphasis>2h</emphasis></entry>
22704 </row>
22705 </tbody>
22706 </tgroup>
22707 </informaltable>
22708 <para>
22709 This option specifies the expiry time for negative callout cache data for an
22710 address. See section <xref linkend="SECTcallver"/> for details of callout verification, and
22711 section <xref linkend="SECTcallvercache"/> for details of the caching.
22712 </para>
22713 <para>
22714 <indexterm role="option">
22715 <primary><option>callout_positive_expire</option></primary>
22716 </indexterm>
22717 </para>
22718 <informaltable frame="all">
22719 <tgroup cols="4" colsep="0" rowsep="0">
22720 <colspec colwidth="8*" align="left"/>
22721 <colspec colwidth="6*" align="center"/>
22722 <colspec colwidth="6*" align="center"/>
22723 <colspec colwidth="6*" align="right"/>
22724 <tbody>
22725 <row>
22726 <entry><option>callout_positive_expire</option></entry>
22727 <entry>Use: <emphasis>main</emphasis></entry>
22728 <entry>Type: <emphasis>time</emphasis></entry>
22729 <entry>Default: <emphasis>24h</emphasis></entry>
22730 </row>
22731 </tbody>
22732 </tgroup>
22733 </informaltable>
22734 <para>
22735 This option specifies the expiry time for positive callout cache data for an
22736 address. See section <xref linkend="SECTcallver"/> for details of callout verification, and
22737 section <xref linkend="SECTcallvercache"/> for details of the caching.
22738 </para>
22739 <para>
22740 <indexterm role="option">
22741 <primary><option>callout_random_local_part</option></primary>
22742 </indexterm>
22743 </para>
22744 <informaltable frame="all">
22745 <tgroup cols="4" colsep="0" rowsep="0">
22746 <colspec colwidth="8*" align="left"/>
22747 <colspec colwidth="6*" align="center"/>
22748 <colspec colwidth="6*" align="center"/>
22749 <colspec colwidth="6*" align="right"/>
22750 <tbody>
22751 <row>
22752 <entry><option>callout_random_local_part</option></entry>
22753 <entry>Use: <emphasis>main</emphasis></entry>
22754 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
22755 <entry>Default: <emphasis>see below</emphasis></entry>
22756 </row>
22757 </tbody>
22758 </tgroup>
22759 </informaltable>
22760 <para>
22761 This option defines the <quote>random</quote> local part that can be used as part of
22762 callout verification. The default value is
22763 </para>
22764 <literallayout class="monospaced">
22765 $primary_hostname-$tod_epoch-testing
22766 </literallayout>
22767 <para>
22768 See section <xref linkend="CALLaddparcall"/> for details of how this value is used.
22769 </para>
22770 <para>
22771 <indexterm role="option">
22772 <primary><option>check_log_inodes</option></primary>
22773 </indexterm>
22774 </para>
22775 <informaltable frame="all">
22776 <tgroup cols="4" colsep="0" rowsep="0">
22777 <colspec colwidth="8*" align="left"/>
22778 <colspec colwidth="6*" align="center"/>
22779 <colspec colwidth="6*" align="center"/>
22780 <colspec colwidth="6*" align="right"/>
22781 <tbody>
22782 <row>
22783 <entry><option>check_log_inodes</option></entry>
22784 <entry>Use: <emphasis>main</emphasis></entry>
22785 <entry>Type: <emphasis>integer</emphasis></entry>
22786 <entry>Default: <emphasis>0</emphasis></entry>
22787 </row>
22788 </tbody>
22789 </tgroup>
22790 </informaltable>
22791 <para>
22792 See <option>check_spool_space</option> below.
22793 </para>
22794 <para>
22795 <indexterm role="option">
22796 <primary><option>check_log_space</option></primary>
22797 </indexterm>
22798 </para>
22799 <informaltable frame="all">
22800 <tgroup cols="4" colsep="0" rowsep="0">
22801 <colspec colwidth="8*" align="left"/>
22802 <colspec colwidth="6*" align="center"/>
22803 <colspec colwidth="6*" align="center"/>
22804 <colspec colwidth="6*" align="right"/>
22805 <tbody>
22806 <row>
22807 <entry><option>check_log_space</option></entry>
22808 <entry>Use: <emphasis>main</emphasis></entry>
22809 <entry>Type: <emphasis>integer</emphasis></entry>
22810 <entry>Default: <emphasis>0</emphasis></entry>
22811 </row>
22812 </tbody>
22813 </tgroup>
22814 </informaltable>
22815 <para>
22816 See <option>check_spool_space</option> below.
22817 </para>
22818 <para>
22819 <indexterm role="option">
22820 <primary><option>check_rfc2047_length</option></primary>
22821 </indexterm>
22822 <indexterm role="concept">
22823 <primary>RFC 2047</primary>
22824 <secondary>disabling length check</secondary>
22825 </indexterm>
22826 <indexterm role="option">
22827 <primary><option>check_rfc2047_length</option></primary>
22828 </indexterm>
22829 </para>
22830 <informaltable frame="all">
22831 <tgroup cols="4" colsep="0" rowsep="0">
22832 <colspec colwidth="8*" align="left"/>
22833 <colspec colwidth="6*" align="center"/>
22834 <colspec colwidth="6*" align="center"/>
22835 <colspec colwidth="6*" align="right"/>
22836 <tbody>
22837 <row>
22838 <entry><option>check_rfc2047_length</option></entry>
22839 <entry>Use: <emphasis>main</emphasis></entry>
22840 <entry>Type: <emphasis>boolean</emphasis></entry>
22841 <entry>Default: <emphasis>true</emphasis></entry>
22842 </row>
22843 </tbody>
22844 </tgroup>
22845 </informaltable>
22846 <para>
22847 RFC 2047 defines a way of encoding non-ASCII characters in headers using a
22848 system of <quote>encoded words</quote>. The RFC specifies a maximum length for an encoded
22849 word; strings to be encoded that exceed this length are supposed to use
22850 multiple encoded words. By default, Exim does not recognize encoded words that
22851 exceed the maximum length. However, it seems that some software, in violation
22852 of the RFC, generates overlong encoded words. If <option>check_rfc2047_length</option> is
22853 set false, Exim recognizes encoded words of any length.
22854 </para>
22855 <para>
22856 <indexterm role="option">
22857 <primary><option>check_spool_inodes</option></primary>
22858 </indexterm>
22859 </para>
22860 <informaltable frame="all">
22861 <tgroup cols="4" colsep="0" rowsep="0">
22862 <colspec colwidth="8*" align="left"/>
22863 <colspec colwidth="6*" align="center"/>
22864 <colspec colwidth="6*" align="center"/>
22865 <colspec colwidth="6*" align="right"/>
22866 <tbody>
22867 <row>
22868 <entry><option>check_spool_inodes</option></entry>
22869 <entry>Use: <emphasis>main</emphasis></entry>
22870 <entry>Type: <emphasis>integer</emphasis></entry>
22871 <entry>Default: <emphasis>0</emphasis></entry>
22872 </row>
22873 </tbody>
22874 </tgroup>
22875 </informaltable>
22876 <para>
22877 See <option>check_spool_space</option> below.
22878 </para>
22879 <para>
22880 <indexterm role="option">
22881 <primary><option>check_spool_space</option></primary>
22882 </indexterm>
22883 </para>
22884 <informaltable frame="all">
22885 <tgroup cols="4" colsep="0" rowsep="0">
22886 <colspec colwidth="8*" align="left"/>
22887 <colspec colwidth="6*" align="center"/>
22888 <colspec colwidth="6*" align="center"/>
22889 <colspec colwidth="6*" align="right"/>
22890 <tbody>
22891 <row>
22892 <entry><option>check_spool_space</option></entry>
22893 <entry>Use: <emphasis>main</emphasis></entry>
22894 <entry>Type: <emphasis>integer</emphasis></entry>
22895 <entry>Default: <emphasis>0</emphasis></entry>
22896 </row>
22897 </tbody>
22898 </tgroup>
22899 </informaltable>
22900 <para>
22901 <indexterm role="concept">
22902 <primary>checking disk space</primary>
22903 </indexterm>
22904 <indexterm role="concept">
22905 <primary>disk space, checking</primary>
22906 </indexterm>
22907 <indexterm role="concept">
22908 <primary>spool directory</primary>
22909 <secondary>checking space</secondary>
22910 </indexterm>
22911 The four <option>check_...</option> options allow for checking of disk resources before a
22912 message is accepted.
22913 </para>
22914 <para>
22915 <indexterm role="variable">
22916 <primary><varname>$log_inodes</varname></primary>
22917 </indexterm>
22918 <indexterm role="variable">
22919 <primary><varname>$log_space</varname></primary>
22920 </indexterm>
22921 <indexterm role="variable">
22922 <primary><varname>$spool_inodes</varname></primary>
22923 </indexterm>
22924 <indexterm role="variable">
22925 <primary><varname>$spool_space</varname></primary>
22926 </indexterm>
22927 When any of these options are set, they apply to all incoming messages. If you
22928 want to apply different checks to different kinds of message, you can do so by
22929 testing the variables <varname>$log_inodes</varname>, <varname>$log_space</varname>, <varname>$spool_inodes</varname>, and
22930 <varname>$spool_space</varname> in an ACL with appropriate additional conditions.
22931 </para>
22932 <para>
22933 <option>check_spool_space</option> and <option>check_spool_inodes</option> check the spool partition if
22934 either value is greater than zero, for example:
22935 </para>
22936 <literallayout class="monospaced">
22937 check_spool_space = 10M
22938 check_spool_inodes = 100
22939 </literallayout>
22940 <para>
22941 The spool partition is the one that contains the directory defined by
22942 SPOOL_DIRECTORY in <filename>Local/Makefile</filename>. It is used for holding messages in
22943 transit.
22944 </para>
22945 <para>
22946 <option>check_log_space</option> and <option>check_log_inodes</option>  check the partition in which log
22947 files are written if either is greater than zero. These should be set only if
22948 <option>log_file_path</option> and <option>spool_directory</option> refer to different partitions.
22949 </para>
22950 <para>
22951 If there is less space or fewer inodes than requested, Exim refuses to accept
22952 incoming mail. In the case of SMTP input this is done by giving a 452 temporary
22953 error response to the MAIL command. If ESMTP is in use and there was a
22954 SIZE parameter on the MAIL command, its value is added to the
22955 <option>check_spool_space</option> value, and the check is performed even if
22956 <option>check_spool_space</option> is zero, unless <option>no_smtp_check_spool_space</option> is set.
22957 </para>
22958 <para>
22959 The values for <option>check_spool_space</option> and <option>check_log_space</option> are held as a
22960 number of kilobytes. If a non-multiple of 1024 is specified, it is rounded up.
22961 </para>
22962 <para>
22963 For non-SMTP input and for batched SMTP input, the test is done at start-up; on
22964 failure a message is written to stderr and Exim exits with a non-zero code, as
22965 it obviously cannot send an error message of any kind.
22966 </para>
22967 <para>
22968 <indexterm role="option">
22969 <primary><option>daemon_smtp_ports</option></primary>
22970 </indexterm>
22971 </para>
22972 <informaltable frame="all">
22973 <tgroup cols="4" colsep="0" rowsep="0">
22974 <colspec colwidth="8*" align="left"/>
22975 <colspec colwidth="6*" align="center"/>
22976 <colspec colwidth="6*" align="center"/>
22977 <colspec colwidth="6*" align="right"/>
22978 <tbody>
22979 <row>
22980 <entry><option>daemon_smtp_ports</option></entry>
22981 <entry>Use: <emphasis>main</emphasis></entry>
22982 <entry>Type: <emphasis>string</emphasis></entry>
22983 <entry>Default: <emphasis><literal>smtp</literal></emphasis></entry>
22984 </row>
22985 </tbody>
22986 </tgroup>
22987 </informaltable>
22988 <para>
22989 <indexterm role="concept">
22990 <primary>port</primary>
22991 <secondary>for daemon</secondary>
22992 </indexterm>
22993 <indexterm role="concept">
22994 <primary>TCP/IP</primary>
22995 <secondary>setting listening ports</secondary>
22996 </indexterm>
22997 This option specifies one or more default SMTP ports on which the Exim daemon
22998 listens. See chapter <xref linkend="CHAPinterfaces"/> for details of how it is used. For
22999 backward compatibility, <option>daemon_smtp_port</option> (singular) is a synonym.
23000 </para>
23001 <para>
23002 <indexterm role="option">
23003 <primary><option>daemon_startup_retries</option></primary>
23004 </indexterm>
23005 </para>
23006 <informaltable frame="all">
23007 <tgroup cols="4" colsep="0" rowsep="0">
23008 <colspec colwidth="8*" align="left"/>
23009 <colspec colwidth="6*" align="center"/>
23010 <colspec colwidth="6*" align="center"/>
23011 <colspec colwidth="6*" align="right"/>
23012 <tbody>
23013 <row>
23014 <entry><option>daemon_startup_retries</option></entry>
23015 <entry>Use: <emphasis>main</emphasis></entry>
23016 <entry>Type: <emphasis>integer</emphasis></entry>
23017 <entry>Default: <emphasis>9</emphasis></entry>
23018 </row>
23019 </tbody>
23020 </tgroup>
23021 </informaltable>
23022 <para>
23023 <indexterm role="concept">
23024 <primary>daemon startup, retrying</primary>
23025 </indexterm>
23026 This option, along with <option>daemon_startup_sleep</option>, controls the retrying done by
23027 the daemon at startup when it cannot immediately bind a listening socket
23028 (typically because the socket is already in use): <option>daemon_startup_retries</option>
23029 defines the number of retries after the first failure, and
23030 <option>daemon_startup_sleep</option> defines the length of time to wait between retries.
23031 </para>
23032 <para>
23033 <indexterm role="option">
23034 <primary><option>daemon_startup_sleep</option></primary>
23035 </indexterm>
23036 </para>
23037 <informaltable frame="all">
23038 <tgroup cols="4" colsep="0" rowsep="0">
23039 <colspec colwidth="8*" align="left"/>
23040 <colspec colwidth="6*" align="center"/>
23041 <colspec colwidth="6*" align="center"/>
23042 <colspec colwidth="6*" align="right"/>
23043 <tbody>
23044 <row>
23045 <entry><option>daemon_startup_sleep</option></entry>
23046 <entry>Use: <emphasis>main</emphasis></entry>
23047 <entry>Type: <emphasis>time</emphasis></entry>
23048 <entry>Default: <emphasis>30s</emphasis></entry>
23049 </row>
23050 </tbody>
23051 </tgroup>
23052 </informaltable>
23053 <para>
23054 See <option>daemon_startup_retries</option>.
23055 </para>
23056 <para>
23057 <indexterm role="option">
23058 <primary><option>delay_warning</option></primary>
23059 </indexterm>
23060 </para>
23061 <informaltable frame="all">
23062 <tgroup cols="4" colsep="0" rowsep="0">
23063 <colspec colwidth="8*" align="left"/>
23064 <colspec colwidth="6*" align="center"/>
23065 <colspec colwidth="6*" align="center"/>
23066 <colspec colwidth="6*" align="right"/>
23067 <tbody>
23068 <row>
23069 <entry><option>delay_warning</option></entry>
23070 <entry>Use: <emphasis>main</emphasis></entry>
23071 <entry>Type: <emphasis>time list</emphasis></entry>
23072 <entry>Default: <emphasis>24h</emphasis></entry>
23073 </row>
23074 </tbody>
23075 </tgroup>
23076 </informaltable>
23077 <para>
23078 <indexterm role="concept">
23079 <primary>warning of delay</primary>
23080 </indexterm>
23081 <indexterm role="concept">
23082 <primary>delay warning, specifying</primary>
23083 </indexterm>
23084 When a message is delayed, Exim sends a warning message to the sender at
23085 intervals specified by this option. The data is a colon-separated list of times
23086 after which to send warning messages. If the value of the option is an empty
23087 string or a zero time, no warnings are sent. Up to 10 times may be given. If a
23088 message has been on the queue for longer than the last time, the last interval
23089 between the times is used to compute subsequent warning times. For example,
23090 with
23091 </para>
23092 <literallayout class="monospaced">
23093 delay_warning = 4h:8h:24h
23094 </literallayout>
23095 <para>
23096 the first message is sent after 4 hours, the second after 8 hours, and
23097 the third one after 24 hours. After that, messages are sent every 16 hours,
23098 because that is the interval between the last two times on the list. If you set
23099 just one time, it specifies the repeat interval. For example, with:
23100 </para>
23101 <literallayout class="monospaced">
23102 delay_warning = 6h
23103 </literallayout>
23104 <para>
23105 messages are repeated every six hours. To stop warnings after a given time, set
23106 a very large time at the end of the list. For example:
23107 </para>
23108 <literallayout class="monospaced">
23109 delay_warning = 2h:12h:99d
23110 </literallayout>
23111 <para>
23112 Note that the option is only evaluated at the time a delivery attempt fails,
23113 which depends on retry and queue-runner configuration.
23114 Typically retries will be configured more frequently than warning messages.
23115 </para>
23116 <para>
23117 <indexterm role="option">
23118 <primary><option>delay_warning_condition</option></primary>
23119 </indexterm>
23120 </para>
23121 <informaltable frame="all">
23122 <tgroup cols="4" colsep="0" rowsep="0">
23123 <colspec colwidth="8*" align="left"/>
23124 <colspec colwidth="6*" align="center"/>
23125 <colspec colwidth="6*" align="center"/>
23126 <colspec colwidth="6*" align="right"/>
23127 <tbody>
23128 <row>
23129 <entry><option>delay_warning_condition</option></entry>
23130 <entry>Use: <emphasis>main</emphasis></entry>
23131 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
23132 <entry>Default: <emphasis>see below</emphasis></entry>
23133 </row>
23134 </tbody>
23135 </tgroup>
23136 </informaltable>
23137 <para>
23138 <indexterm role="variable">
23139 <primary><varname>$domain</varname></primary>
23140 </indexterm>
23141 The string is expanded at the time a warning message might be sent. If all the
23142 deferred addresses have the same domain, it is set in <varname>$domain</varname> during the
23143 expansion. Otherwise <varname>$domain</varname> is empty. If the result of the expansion is a
23144 forced failure, an empty string, or a string matching any of <quote>0</quote>, <quote>no</quote> or
23145 <quote>false</quote> (the comparison being done caselessly) then the warning message is
23146 not sent. The default is:
23147 </para>
23148 <literallayout class="monospaced">
23149 delay_warning_condition = ${if or {\
23150   { !eq{$h_list-id:$h_list-post:$h_list-subscribe:}{} }\
23151   { match{$h_precedence:}{(?i)bulk|list|junk} }\
23152   { match{$h_auto-submitted:}{(?i)auto-generated|auto-replied} }\
23153   } {no}{yes}}
23154 </literallayout>
23155 <para>
23156 This suppresses the sending of warnings for messages that contain <emphasis>List-ID:</emphasis>,
23157 <emphasis>List-Post:</emphasis>, or <emphasis>List-Subscribe:</emphasis> headers, or have <quote>bulk</quote>, <quote>list</quote> or
23158 <quote>junk</quote> in a <emphasis>Precedence:</emphasis> header, or have <quote>auto-generated</quote> or
23159 <quote>auto-replied</quote> in an <emphasis>Auto-Submitted:</emphasis> header.
23160 </para>
23161 <para>
23162 <indexterm role="option">
23163 <primary><option>deliver_drop_privilege</option></primary>
23164 </indexterm>
23165 </para>
23166 <informaltable frame="all">
23167 <tgroup cols="4" colsep="0" rowsep="0">
23168 <colspec colwidth="8*" align="left"/>
23169 <colspec colwidth="6*" align="center"/>
23170 <colspec colwidth="6*" align="center"/>
23171 <colspec colwidth="6*" align="right"/>
23172 <tbody>
23173 <row>
23174 <entry><option>deliver_drop_privilege</option></entry>
23175 <entry>Use: <emphasis>main</emphasis></entry>
23176 <entry>Type: <emphasis>boolean</emphasis></entry>
23177 <entry>Default: <emphasis>false</emphasis></entry>
23178 </row>
23179 </tbody>
23180 </tgroup>
23181 </informaltable>
23182 <para>
23183 <indexterm role="concept">
23184 <primary>unprivileged delivery</primary>
23185 </indexterm>
23186 <indexterm role="concept">
23187 <primary>delivery</primary>
23188 <secondary>unprivileged</secondary>
23189 </indexterm>
23190 If this option is set true, Exim drops its root privilege at the start of a
23191 delivery process, and runs as the Exim user throughout. This severely restricts
23192 the kinds of local delivery that are possible, but is viable in certain types
23193 of configuration. There is a discussion about the use of root privilege in
23194 chapter <xref linkend="CHAPsecurity"/>.
23195 </para>
23196 <para>
23197 <indexterm role="option">
23198 <primary><option>deliver_queue_load_max</option></primary>
23199 </indexterm>
23200 </para>
23201 <informaltable frame="all">
23202 <tgroup cols="4" colsep="0" rowsep="0">
23203 <colspec colwidth="8*" align="left"/>
23204 <colspec colwidth="6*" align="center"/>
23205 <colspec colwidth="6*" align="center"/>
23206 <colspec colwidth="6*" align="right"/>
23207 <tbody>
23208 <row>
23209 <entry><option>deliver_queue_load_max</option></entry>
23210 <entry>Use: <emphasis>main</emphasis></entry>
23211 <entry>Type: <emphasis>fixed-point</emphasis></entry>
23212 <entry>Default: <emphasis>unset</emphasis></entry>
23213 </row>
23214 </tbody>
23215 </tgroup>
23216 </informaltable>
23217 <para>
23218 <indexterm role="concept">
23219 <primary>load average</primary>
23220 </indexterm>
23221 <indexterm role="concept">
23222 <primary>queue runner</primary>
23223 <secondary>abandoning</secondary>
23224 </indexterm>
23225 When this option is set, a queue run is abandoned if the system load average
23226 becomes greater than the value of the option. The option has no effect on
23227 ancient operating systems on which Exim cannot determine the load average.
23228 See also <option>queue_only_load</option> and <option>smtp_load_reserve</option>.
23229 </para>
23230 <para>
23231 <indexterm role="option">
23232 <primary><option>delivery_date_remove</option></primary>
23233 </indexterm>
23234 </para>
23235 <informaltable frame="all">
23236 <tgroup cols="4" colsep="0" rowsep="0">
23237 <colspec colwidth="8*" align="left"/>
23238 <colspec colwidth="6*" align="center"/>
23239 <colspec colwidth="6*" align="center"/>
23240 <colspec colwidth="6*" align="right"/>
23241 <tbody>
23242 <row>
23243 <entry><option>delivery_date_remove</option></entry>
23244 <entry>Use: <emphasis>main</emphasis></entry>
23245 <entry>Type: <emphasis>boolean</emphasis></entry>
23246 <entry>Default: <emphasis>true</emphasis></entry>
23247 </row>
23248 </tbody>
23249 </tgroup>
23250 </informaltable>
23251 <para>
23252 <indexterm role="concept">
23253 <primary><emphasis>Delivery-date:</emphasis> header line</primary>
23254 </indexterm>
23255 Exim&#x2019;s transports have an option for adding a <emphasis>Delivery-date:</emphasis> header to a
23256 message when it is delivered, in exactly the same way as <emphasis>Return-path:</emphasis> is
23257 handled. <emphasis>Delivery-date:</emphasis> records the actual time of delivery. Such headers
23258 should not be present in incoming messages, and this option causes them to be
23259 removed at the time the message is received, to avoid any problems that might
23260 occur when a delivered message is subsequently sent on to some other recipient.
23261 </para>
23262 <para>
23263 <indexterm role="option">
23264 <primary><option>disable_fsync</option></primary>
23265 </indexterm>
23266 </para>
23267 <informaltable frame="all">
23268 <tgroup cols="4" colsep="0" rowsep="0">
23269 <colspec colwidth="8*" align="left"/>
23270 <colspec colwidth="6*" align="center"/>
23271 <colspec colwidth="6*" align="center"/>
23272 <colspec colwidth="6*" align="right"/>
23273 <tbody>
23274 <row>
23275 <entry><option>disable_fsync</option></entry>
23276 <entry>Use: <emphasis>main</emphasis></entry>
23277 <entry>Type: <emphasis>boolean</emphasis></entry>
23278 <entry>Default: <emphasis>false</emphasis></entry>
23279 </row>
23280 </tbody>
23281 </tgroup>
23282 </informaltable>
23283 <para>
23284 <indexterm role="concept">
23285 <primary><function>fsync()</function>, disabling</primary>
23286 </indexterm>
23287 This option is available only if Exim was built with the compile-time option
23288 ENABLE_DISABLE_FSYNC. When this is not set, a reference to <option>disable_fsync</option> in
23289 a runtime configuration generates an <quote>unknown option</quote> error. You should not
23290 build Exim with ENABLE_DISABLE_FSYNC or set <option>disable_fsync</option> unless you
23291 really, really, really understand what you are doing. <emphasis>No pre-compiled
23292 distributions of Exim should ever make this option available.</emphasis>
23293 </para>
23294 <para>
23295 When <option>disable_fsync</option> is set true, Exim no longer calls <function>fsync()</function> to force
23296 updated files&#x2019; data to be written to disc before continuing. Unexpected events
23297 such as crashes and power outages may cause data to be lost or scrambled.
23298 Here be Dragons. <emphasis role="bold">Beware.</emphasis>
23299 </para>
23300 <para>
23301 <indexterm role="option">
23302 <primary><option>disable_ipv6</option></primary>
23303 </indexterm>
23304 </para>
23305 <informaltable frame="all">
23306 <tgroup cols="4" colsep="0" rowsep="0">
23307 <colspec colwidth="8*" align="left"/>
23308 <colspec colwidth="6*" align="center"/>
23309 <colspec colwidth="6*" align="center"/>
23310 <colspec colwidth="6*" align="right"/>
23311 <tbody>
23312 <row>
23313 <entry><option>disable_ipv6</option></entry>
23314 <entry>Use: <emphasis>main</emphasis></entry>
23315 <entry>Type: <emphasis>boolean</emphasis></entry>
23316 <entry>Default: <emphasis>false</emphasis></entry>
23317 </row>
23318 </tbody>
23319 </tgroup>
23320 </informaltable>
23321 <para>
23322 <indexterm role="concept">
23323 <primary>IPv6</primary>
23324 <secondary>disabling</secondary>
23325 </indexterm>
23326 If this option is set true, even if the Exim binary has IPv6 support, no IPv6
23327 activities take place. AAAA records are never looked up, and any IPv6 addresses
23328 that are listed in <option>local_interfaces</option>, data for the <option>manualroute</option> router,
23329 etc. are ignored. If IP literals are enabled, the <command>ipliteral</command> router declines
23330 to handle IPv6 literal addresses.
23331 </para>
23332 <para>
23333 <indexterm role="option">
23334 <primary><option>dns_again_means_nonexist</option></primary>
23335 </indexterm>
23336 </para>
23337 <informaltable frame="all">
23338 <tgroup cols="4" colsep="0" rowsep="0">
23339 <colspec colwidth="8*" align="left"/>
23340 <colspec colwidth="6*" align="center"/>
23341 <colspec colwidth="6*" align="center"/>
23342 <colspec colwidth="6*" align="right"/>
23343 <tbody>
23344 <row>
23345 <entry><option>dns_again_means_nonexist</option></entry>
23346 <entry>Use: <emphasis>main</emphasis></entry>
23347 <entry>Type: <emphasis>domain list</emphasis>&dagger;<emphasis></emphasis></entry>
23348 <entry>Default: <emphasis>unset</emphasis></entry>
23349 </row>
23350 </tbody>
23351 </tgroup>
23352 </informaltable>
23353 <para>
23354 <indexterm role="concept">
23355 <primary>DNS</primary>
23356 <secondary><quote>try again</quote> response; overriding</secondary>
23357 </indexterm>
23358 DNS lookups give a <quote>try again</quote> response for the DNS errors
23359 <quote>non-authoritative host not found</quote> and <quote>SERVERFAIL</quote>. This can cause Exim to
23360 keep trying to deliver a message, or to give repeated temporary errors to
23361 incoming mail. Sometimes the effect is caused by a badly set up name server and
23362 may persist for a long time. If a domain which exhibits this problem matches
23363 anything in <option>dns_again_means_nonexist</option>, it is treated as if it did not exist.
23364 This option should be used with care. You can make it apply to reverse lookups
23365 by a setting such as this:
23366 </para>
23367 <literallayout class="monospaced">
23368 dns_again_means_nonexist = *.in-addr.arpa
23369 </literallayout>
23370 <para>
23371 This option applies to all DNS lookups that Exim does. It also applies when the
23372 <function>gethostbyname()</function> or <function>getipnodebyname()</function> functions give temporary errors,
23373 since these are most likely to be caused by DNS lookup problems. The
23374 <command>dnslookup</command> router has some options of its own for controlling what happens
23375 when lookups for MX or SRV records give temporary errors. These more specific
23376 options are applied after this global option.
23377 </para>
23378 <para>
23379 <indexterm role="option">
23380 <primary><option>dns_check_names_pattern</option></primary>
23381 </indexterm>
23382 </para>
23383 <informaltable frame="all">
23384 <tgroup cols="4" colsep="0" rowsep="0">
23385 <colspec colwidth="8*" align="left"/>
23386 <colspec colwidth="6*" align="center"/>
23387 <colspec colwidth="6*" align="center"/>
23388 <colspec colwidth="6*" align="right"/>
23389 <tbody>
23390 <row>
23391 <entry><option>dns_check_names_pattern</option></entry>
23392 <entry>Use: <emphasis>main</emphasis></entry>
23393 <entry>Type: <emphasis>string</emphasis></entry>
23394 <entry>Default: <emphasis>see below</emphasis></entry>
23395 </row>
23396 </tbody>
23397 </tgroup>
23398 </informaltable>
23399 <para>
23400 <indexterm role="concept">
23401 <primary>DNS</primary>
23402 <secondary>pre-check of name syntax</secondary>
23403 </indexterm>
23404 When this option is set to a non-empty string, it causes Exim to check domain
23405 names for characters that are not allowed in host names before handing them to
23406 the DNS resolver, because some resolvers give temporary errors for names that
23407 contain unusual characters. If a domain name contains any unwanted characters,
23408 a <quote>not found</quote> result is forced, and the resolver is not called. The check is
23409 done by matching the domain name against a regular expression, which is the
23410 value of this option. The default pattern is
23411 </para>
23412 <literallayout class="monospaced">
23413 dns_check_names_pattern = \
23414   (?i)^(?&gt;(?(1)\.|())[^\W_](?&gt;[a-z0-9/-]*[^\W_])?)+$
23415 </literallayout>
23416 <para>
23417 which permits only letters, digits, slashes, and hyphens in components, but
23418 they must start and end with a letter or digit. Slashes are not, in fact,
23419 permitted in host names, but they are found in certain NS records (which can be
23420 accessed in Exim by using a <option>dnsdb</option> lookup). If you set
23421 <option>allow_utf8_domains</option>, you must modify this pattern, or set the option to an
23422 empty string.
23423 </para>
23424 <para>
23425 <indexterm role="option">
23426 <primary><option>dns_csa_search_limit</option></primary>
23427 </indexterm>
23428 </para>
23429 <informaltable frame="all">
23430 <tgroup cols="4" colsep="0" rowsep="0">
23431 <colspec colwidth="8*" align="left"/>
23432 <colspec colwidth="6*" align="center"/>
23433 <colspec colwidth="6*" align="center"/>
23434 <colspec colwidth="6*" align="right"/>
23435 <tbody>
23436 <row>
23437 <entry><option>dns_csa_search_limit</option></entry>
23438 <entry>Use: <emphasis>main</emphasis></entry>
23439 <entry>Type: <emphasis>integer</emphasis></entry>
23440 <entry>Default: <emphasis>5</emphasis></entry>
23441 </row>
23442 </tbody>
23443 </tgroup>
23444 </informaltable>
23445 <para>
23446 This option controls the depth of parental searching for CSA SRV records in the
23447 DNS, as described in more detail in section <xref linkend="SECTverifyCSA"/>.
23448 </para>
23449 <para>
23450 <indexterm role="option">
23451 <primary><option>dns_csa_use_reverse</option></primary>
23452 </indexterm>
23453 </para>
23454 <informaltable frame="all">
23455 <tgroup cols="4" colsep="0" rowsep="0">
23456 <colspec colwidth="8*" align="left"/>
23457 <colspec colwidth="6*" align="center"/>
23458 <colspec colwidth="6*" align="center"/>
23459 <colspec colwidth="6*" align="right"/>
23460 <tbody>
23461 <row>
23462 <entry><option>dns_csa_use_reverse</option></entry>
23463 <entry>Use: <emphasis>main</emphasis></entry>
23464 <entry>Type: <emphasis>boolean</emphasis></entry>
23465 <entry>Default: <emphasis>true</emphasis></entry>
23466 </row>
23467 </tbody>
23468 </tgroup>
23469 </informaltable>
23470 <para>
23471 This option controls whether or not an IP address, given as a CSA domain, is
23472 reversed and looked up in the reverse DNS, as described in more detail in
23473 section <xref linkend="SECTverifyCSA"/>.
23474 </para>
23475 <para>
23476 <indexterm role="option">
23477 <primary><option>dns_dnssec_ok</option></primary>
23478 </indexterm>
23479 </para>
23480 <informaltable frame="all">
23481 <tgroup cols="4" colsep="0" rowsep="0">
23482 <colspec colwidth="8*" align="left"/>
23483 <colspec colwidth="6*" align="center"/>
23484 <colspec colwidth="6*" align="center"/>
23485 <colspec colwidth="6*" align="right"/>
23486 <tbody>
23487 <row>
23488 <entry><option>dns_dnssec_ok</option></entry>
23489 <entry>Use: <emphasis>main</emphasis></entry>
23490 <entry>Type: <emphasis>integer</emphasis></entry>
23491 <entry>Default: <emphasis>-1</emphasis></entry>
23492 </row>
23493 </tbody>
23494 </tgroup>
23495 </informaltable>
23496 <para>
23497 <indexterm role="concept">
23498 <primary>DNS</primary>
23499 <secondary>resolver options</secondary>
23500 </indexterm>
23501 <indexterm role="concept">
23502 <primary>DNS</primary>
23503 <secondary>DNSSEC</secondary>
23504 </indexterm>
23505 If this option is set to a non-negative number then Exim will initialise the
23506 DNS resolver library to either use or not use DNSSEC, overriding the system
23507 default. A value of 0 coerces DNSSEC off, a value of 1 coerces DNSSEC on.
23508 </para>
23509 <para>
23510 If the resolver library does not support DNSSEC then this option has no effect.
23511 </para>
23512 <para>
23513 <indexterm role="option">
23514 <primary><option>dns_ipv4_lookup</option></primary>
23515 </indexterm>
23516 </para>
23517 <informaltable frame="all">
23518 <tgroup cols="4" colsep="0" rowsep="0">
23519 <colspec colwidth="8*" align="left"/>
23520 <colspec colwidth="6*" align="center"/>
23521 <colspec colwidth="6*" align="center"/>
23522 <colspec colwidth="6*" align="right"/>
23523 <tbody>
23524 <row>
23525 <entry><option>dns_ipv4_lookup</option></entry>
23526 <entry>Use: <emphasis>main</emphasis></entry>
23527 <entry>Type: <emphasis>domain list</emphasis>&dagger;<emphasis></emphasis></entry>
23528 <entry>Default: <emphasis>unset</emphasis></entry>
23529 </row>
23530 </tbody>
23531 </tgroup>
23532 </informaltable>
23533 <para>
23534 <indexterm role="concept">
23535 <primary>IPv6</primary>
23536 <secondary>DNS lookup for AAAA records</secondary>
23537 </indexterm>
23538 <indexterm role="concept">
23539 <primary>DNS</primary>
23540 <secondary>IPv6 lookup for AAAA records</secondary>
23541 </indexterm>
23542 When Exim is compiled with IPv6 support and <option>disable_ipv6</option> is not set, it
23543 looks for IPv6 address records (AAAA records) as well as IPv4 address records
23544 (A records) when trying to find IP addresses for hosts, unless the host&#x2019;s
23545 domain matches this list.
23546 </para>
23547 <para>
23548 This is a fudge to help with name servers that give big delays or otherwise do
23549 not work for the AAAA record type. In due course, when the world&#x2019;s name
23550 servers have all been upgraded, there should be no need for this option.
23551 </para>
23552 <para>
23553 <indexterm role="option">
23554 <primary><option>dns_retrans</option></primary>
23555 </indexterm>
23556 </para>
23557 <informaltable frame="all">
23558 <tgroup cols="4" colsep="0" rowsep="0">
23559 <colspec colwidth="8*" align="left"/>
23560 <colspec colwidth="6*" align="center"/>
23561 <colspec colwidth="6*" align="center"/>
23562 <colspec colwidth="6*" align="right"/>
23563 <tbody>
23564 <row>
23565 <entry><option>dns_retrans</option></entry>
23566 <entry>Use: <emphasis>main</emphasis></entry>
23567 <entry>Type: <emphasis>time</emphasis></entry>
23568 <entry>Default: <emphasis>0s</emphasis></entry>
23569 </row>
23570 </tbody>
23571 </tgroup>
23572 </informaltable>
23573 <para>
23574 <indexterm role="concept">
23575 <primary>DNS</primary>
23576 <secondary>resolver options</secondary>
23577 </indexterm>
23578 The options <option>dns_retrans</option> and <option>dns_retry</option> can be used to set the
23579 retransmission and retry parameters for DNS lookups. Values of zero (the
23580 defaults) leave the system default settings unchanged. The first value is the
23581 time between retries, and the second is the number of retries. It isn&#x2019;t
23582 totally clear exactly how these settings affect the total time a DNS lookup may
23583 take. I haven&#x2019;t found any documentation about timeouts on DNS lookups; these
23584 parameter values are available in the external resolver interface structure,
23585 but nowhere does it seem to describe how they are used or what you might want
23586 to set in them.
23587 </para>
23588 <para>
23589 <indexterm role="option">
23590 <primary><option>dns_retry</option></primary>
23591 </indexterm>
23592 </para>
23593 <informaltable frame="all">
23594 <tgroup cols="4" colsep="0" rowsep="0">
23595 <colspec colwidth="8*" align="left"/>
23596 <colspec colwidth="6*" align="center"/>
23597 <colspec colwidth="6*" align="center"/>
23598 <colspec colwidth="6*" align="right"/>
23599 <tbody>
23600 <row>
23601 <entry><option>dns_retry</option></entry>
23602 <entry>Use: <emphasis>main</emphasis></entry>
23603 <entry>Type: <emphasis>integer</emphasis></entry>
23604 <entry>Default: <emphasis>0</emphasis></entry>
23605 </row>
23606 </tbody>
23607 </tgroup>
23608 </informaltable>
23609 <para>
23610 See <option>dns_retrans</option> above.
23611 </para>
23612 <para>
23613 <indexterm role="option">
23614 <primary><option>dns_use_edns0</option></primary>
23615 </indexterm>
23616 </para>
23617 <informaltable frame="all">
23618 <tgroup cols="4" colsep="0" rowsep="0">
23619 <colspec colwidth="8*" align="left"/>
23620 <colspec colwidth="6*" align="center"/>
23621 <colspec colwidth="6*" align="center"/>
23622 <colspec colwidth="6*" align="right"/>
23623 <tbody>
23624 <row>
23625 <entry><option>dns_use_edns0</option></entry>
23626 <entry>Use: <emphasis>main</emphasis></entry>
23627 <entry>Type: <emphasis>integer</emphasis></entry>
23628 <entry>Default: <emphasis>-1</emphasis></entry>
23629 </row>
23630 </tbody>
23631 </tgroup>
23632 </informaltable>
23633 <para>
23634 <indexterm role="concept">
23635 <primary>DNS</primary>
23636 <secondary>resolver options</secondary>
23637 </indexterm>
23638 <indexterm role="concept">
23639 <primary>DNS</primary>
23640 <secondary>EDNS0</secondary>
23641 </indexterm>
23642 If this option is set to a non-negative number then Exim will initialise the
23643 DNS resolver library to either use or not use EDNS0 extensions, overriding
23644 the system default. A value of 0 coerces EDNS0 off, a value of 1 coerces EDNS0
23645 on.
23646 </para>
23647 <para>
23648 If the resolver library does not support EDNS0 then this option has no effect.
23649 </para>
23650 <para>
23651 <indexterm role="option">
23652 <primary><option>drop_cr</option></primary>
23653 </indexterm>
23654 </para>
23655 <informaltable frame="all">
23656 <tgroup cols="4" colsep="0" rowsep="0">
23657 <colspec colwidth="8*" align="left"/>
23658 <colspec colwidth="6*" align="center"/>
23659 <colspec colwidth="6*" align="center"/>
23660 <colspec colwidth="6*" align="right"/>
23661 <tbody>
23662 <row>
23663 <entry><option>drop_cr</option></entry>
23664 <entry>Use: <emphasis>main</emphasis></entry>
23665 <entry>Type: <emphasis>boolean</emphasis></entry>
23666 <entry>Default: <emphasis>false</emphasis></entry>
23667 </row>
23668 </tbody>
23669 </tgroup>
23670 </informaltable>
23671 <para>
23672 This is an obsolete option that is now a no-op. It used to affect the way Exim
23673 handled CR and LF characters in incoming messages. What happens now is
23674 described in section <xref linkend="SECTlineendings"/>.
23675 </para>
23676 <para>
23677 <indexterm role="option">
23678 <primary><option>dsn_from</option></primary>
23679 </indexterm>
23680 </para>
23681 <informaltable frame="all">
23682 <tgroup cols="4" colsep="0" rowsep="0">
23683 <colspec colwidth="8*" align="left"/>
23684 <colspec colwidth="6*" align="center"/>
23685 <colspec colwidth="6*" align="center"/>
23686 <colspec colwidth="6*" align="right"/>
23687 <tbody>
23688 <row>
23689 <entry><option>dsn_from</option></entry>
23690 <entry>Use: <emphasis>main</emphasis></entry>
23691 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
23692 <entry>Default: <emphasis>see below</emphasis></entry>
23693 </row>
23694 </tbody>
23695 </tgroup>
23696 </informaltable>
23697 <para>
23698 <indexterm role="concept">
23699 <primary><emphasis>From:</emphasis> header line</primary>
23700 <secondary>in bounces</secondary>
23701 </indexterm>
23702 <indexterm role="concept">
23703 <primary>bounce messages</primary>
23704 <secondary><emphasis>From:</emphasis> line, specifying</secondary>
23705 </indexterm>
23706 This option can be used to vary the contents of <emphasis>From:</emphasis> header lines in
23707 bounces and other automatically generated messages (<quote>Delivery Status
23708 Notifications</quote> &ndash; hence the name of the option). The default setting is:
23709 </para>
23710 <literallayout class="monospaced">
23711 dsn_from = Mail Delivery System &lt;Mailer-Daemon@$qualify_domain&gt;
23712 </literallayout>
23713 <para>
23714 The value is expanded every time it is needed. If the expansion fails, a
23715 panic is logged, and the default value is used.
23716 </para>
23717 <para>
23718 <indexterm role="option">
23719 <primary><option>envelope_to_remove</option></primary>
23720 </indexterm>
23721 </para>
23722 <informaltable frame="all">
23723 <tgroup cols="4" colsep="0" rowsep="0">
23724 <colspec colwidth="8*" align="left"/>
23725 <colspec colwidth="6*" align="center"/>
23726 <colspec colwidth="6*" align="center"/>
23727 <colspec colwidth="6*" align="right"/>
23728 <tbody>
23729 <row>
23730 <entry><option>envelope_to_remove</option></entry>
23731 <entry>Use: <emphasis>main</emphasis></entry>
23732 <entry>Type: <emphasis>boolean</emphasis></entry>
23733 <entry>Default: <emphasis>true</emphasis></entry>
23734 </row>
23735 </tbody>
23736 </tgroup>
23737 </informaltable>
23738 <para>
23739 <indexterm role="concept">
23740 <primary><emphasis>Envelope-to:</emphasis> header line</primary>
23741 </indexterm>
23742 Exim&#x2019;s transports have an option for adding an <emphasis>Envelope-to:</emphasis> header to a
23743 message when it is delivered, in exactly the same way as <emphasis>Return-path:</emphasis> is
23744 handled. <emphasis>Envelope-to:</emphasis> records the original recipient address from the
23745 messages&#x2019;s envelope that caused the delivery to happen. Such headers should not
23746 be present in incoming messages, and this option causes them to be removed at
23747 the time the message is received, to avoid any problems that might occur when a
23748 delivered message is subsequently sent on to some other recipient.
23749 </para>
23750 <para>
23751 <indexterm role="option">
23752 <primary><option>errors_copy</option></primary>
23753 </indexterm>
23754 </para>
23755 <informaltable frame="all">
23756 <tgroup cols="4" colsep="0" rowsep="0">
23757 <colspec colwidth="8*" align="left"/>
23758 <colspec colwidth="6*" align="center"/>
23759 <colspec colwidth="6*" align="center"/>
23760 <colspec colwidth="6*" align="right"/>
23761 <tbody>
23762 <row>
23763 <entry><option>errors_copy</option></entry>
23764 <entry>Use: <emphasis>main</emphasis></entry>
23765 <entry>Type: <emphasis>string list</emphasis>&dagger;<emphasis></emphasis></entry>
23766 <entry>Default: <emphasis>unset</emphasis></entry>
23767 </row>
23768 </tbody>
23769 </tgroup>
23770 </informaltable>
23771 <para>
23772 <indexterm role="concept">
23773 <primary>bounce message</primary>
23774 <secondary>copy to other address</secondary>
23775 </indexterm>
23776 <indexterm role="concept">
23777 <primary>copy of bounce message</primary>
23778 </indexterm>
23779 Setting this option causes Exim to send bcc copies of bounce messages that it
23780 generates to other addresses. <emphasis role="bold">Note</emphasis>: This does not apply to bounce messages
23781 coming from elsewhere. The value of the option is a colon-separated list of
23782 items. Each item consists of a pattern, terminated by white space, followed by
23783 a comma-separated list of email addresses. If a pattern contains spaces, it
23784 must be enclosed in double quotes.
23785 </para>
23786 <para>
23787 Each pattern is processed in the same way as a single item in an address list
23788 (see section <xref linkend="SECTaddresslist"/>). When a pattern matches the recipient of
23789 the bounce message, the message is copied to the addresses on the list. The
23790 items are scanned in order, and once a matching one is found, no further items
23791 are examined. For example:
23792 </para>
23793 <literallayout class="monospaced">
23794 errors_copy = spqr@mydomain   postmaster@mydomain.example :\
23795               rqps@mydomain   hostmaster@mydomain.example,\
23796                               postmaster@mydomain.example
23797 </literallayout>
23798 <para>
23799 <indexterm role="variable">
23800 <primary><varname>$domain</varname></primary>
23801 </indexterm>
23802 <indexterm role="variable">
23803 <primary><varname>$local_part</varname></primary>
23804 </indexterm>
23805 The address list is expanded before use. The expansion variables <varname>$local_part</varname>
23806 and <varname>$domain</varname> are set from the original recipient of the error message, and if
23807 there was any wildcard matching in the pattern, the expansion
23808 <indexterm role="concept">
23809 <primary>numerical variables (<varname>$1</varname> <varname>$2</varname> etc)</primary>
23810 <secondary>in <option>errors_copy</option></secondary>
23811 </indexterm>
23812 variables <varname>$0</varname>, <varname>$1</varname>, etc. are set in the normal way.
23813 </para>
23814 <para>
23815 <indexterm role="option">
23816 <primary><option>errors_reply_to</option></primary>
23817 </indexterm>
23818 </para>
23819 <informaltable frame="all">
23820 <tgroup cols="4" colsep="0" rowsep="0">
23821 <colspec colwidth="8*" align="left"/>
23822 <colspec colwidth="6*" align="center"/>
23823 <colspec colwidth="6*" align="center"/>
23824 <colspec colwidth="6*" align="right"/>
23825 <tbody>
23826 <row>
23827 <entry><option>errors_reply_to</option></entry>
23828 <entry>Use: <emphasis>main</emphasis></entry>
23829 <entry>Type: <emphasis>string</emphasis></entry>
23830 <entry>Default: <emphasis>unset</emphasis></entry>
23831 </row>
23832 </tbody>
23833 </tgroup>
23834 </informaltable>
23835 <para>
23836 <indexterm role="concept">
23837 <primary>bounce message</primary>
23838 <secondary><emphasis>Reply-to:</emphasis> in</secondary>
23839 </indexterm>
23840 By default, Exim&#x2019;s bounce and delivery warning messages contain the header line
23841 </para>
23842 <literallayout>
23843 <literal>From: Mail Delivery System &lt;Mailer-Daemon@</literal><emphasis>qualify-domain</emphasis><literal>&gt;</literal>
23844 </literallayout>
23845 <para>
23846 <indexterm role="option">
23847 <primary><option>quota_warn_message</option></primary>
23848 </indexterm>
23849 where <emphasis>qualify-domain</emphasis> is the value of the <option>qualify_domain</option> option.
23850 A warning message that is generated by the <option>quota_warn_message</option> option in an
23851 <command>appendfile</command> transport may contain its own <emphasis>From:</emphasis> header line that
23852 overrides the default.
23853 </para>
23854 <para>
23855 Experience shows that people reply to bounce messages. If the
23856 <option>errors_reply_to</option> option is set, a <emphasis>Reply-To:</emphasis> header is added to bounce
23857 and warning messages. For example:
23858 </para>
23859 <literallayout class="monospaced">
23860 errors_reply_to = postmaster@my.domain.example
23861 </literallayout>
23862 <para>
23863 The value of the option is not expanded. It must specify a valid RFC 2822
23864 address. However, if a warning message that is generated by the
23865 <option>quota_warn_message</option> option in an <command>appendfile</command> transport contain its
23866 own <emphasis>Reply-To:</emphasis> header line, the value of the <option>errors_reply_to</option> option is
23867 not used.
23868 </para>
23869 <para>
23870 <indexterm role="option">
23871 <primary><option>exim_group</option></primary>
23872 </indexterm>
23873 </para>
23874 <informaltable frame="all">
23875 <tgroup cols="4" colsep="0" rowsep="0">
23876 <colspec colwidth="8*" align="left"/>
23877 <colspec colwidth="6*" align="center"/>
23878 <colspec colwidth="6*" align="center"/>
23879 <colspec colwidth="6*" align="right"/>
23880 <tbody>
23881 <row>
23882 <entry><option>exim_group</option></entry>
23883 <entry>Use: <emphasis>main</emphasis></entry>
23884 <entry>Type: <emphasis>string</emphasis></entry>
23885 <entry>Default: <emphasis>compile-time configured</emphasis></entry>
23886 </row>
23887 </tbody>
23888 </tgroup>
23889 </informaltable>
23890 <para>
23891 <indexterm role="concept">
23892 <primary>gid (group id)</primary>
23893 <secondary>Exim&#x2019;s own</secondary>
23894 </indexterm>
23895 <indexterm role="concept">
23896 <primary>Exim group</primary>
23897 </indexterm>
23898 This option changes the gid under which Exim runs when it gives up root
23899 privilege. The default value is compiled into the binary. The value of this
23900 option is used only when <option>exim_user</option> is also set. Unless it consists entirely
23901 of digits, the string is looked up using <function>getgrnam()</function>, and failure causes a
23902 configuration error. See chapter <xref linkend="CHAPsecurity"/> for a discussion of
23903 security issues.
23904 </para>
23905 <para>
23906 <indexterm role="option">
23907 <primary><option>exim_path</option></primary>
23908 </indexterm>
23909 </para>
23910 <informaltable frame="all">
23911 <tgroup cols="4" colsep="0" rowsep="0">
23912 <colspec colwidth="8*" align="left"/>
23913 <colspec colwidth="6*" align="center"/>
23914 <colspec colwidth="6*" align="center"/>
23915 <colspec colwidth="6*" align="right"/>
23916 <tbody>
23917 <row>
23918 <entry><option>exim_path</option></entry>
23919 <entry>Use: <emphasis>main</emphasis></entry>
23920 <entry>Type: <emphasis>string</emphasis></entry>
23921 <entry>Default: <emphasis>see below</emphasis></entry>
23922 </row>
23923 </tbody>
23924 </tgroup>
23925 </informaltable>
23926 <para>
23927 <indexterm role="concept">
23928 <primary>Exim binary, path name</primary>
23929 </indexterm>
23930 This option specifies the path name of the Exim binary, which is used when Exim
23931 needs to re-exec itself. The default is set up to point to the file <emphasis>exim</emphasis> in
23932 the directory configured at compile time by the BIN_DIRECTORY setting. It
23933 is necessary to change <option>exim_path</option> if, exceptionally, Exim is run from some
23934 other place.
23935 <emphasis role="bold">Warning</emphasis>: Do not use a macro to define the value of this option, because
23936 you will break those Exim utilities that scan the configuration file to find
23937 where the binary is. (They then use the <option>-bP</option> option to extract option
23938 settings such as the value of <option>spool_directory</option>.)
23939 </para>
23940 <para>
23941 <indexterm role="option">
23942 <primary><option>exim_user</option></primary>
23943 </indexterm>
23944 </para>
23945 <informaltable frame="all">
23946 <tgroup cols="4" colsep="0" rowsep="0">
23947 <colspec colwidth="8*" align="left"/>
23948 <colspec colwidth="6*" align="center"/>
23949 <colspec colwidth="6*" align="center"/>
23950 <colspec colwidth="6*" align="right"/>
23951 <tbody>
23952 <row>
23953 <entry><option>exim_user</option></entry>
23954 <entry>Use: <emphasis>main</emphasis></entry>
23955 <entry>Type: <emphasis>string</emphasis></entry>
23956 <entry>Default: <emphasis>compile-time configured</emphasis></entry>
23957 </row>
23958 </tbody>
23959 </tgroup>
23960 </informaltable>
23961 <para>
23962 <indexterm role="concept">
23963 <primary>uid (user id)</primary>
23964 <secondary>Exim&#x2019;s own</secondary>
23965 </indexterm>
23966 <indexterm role="concept">
23967 <primary>Exim user</primary>
23968 </indexterm>
23969 This option changes the uid under which Exim runs when it gives up root
23970 privilege. The default value is compiled into the binary. Ownership of the run
23971 time configuration file and the use of the <option>-C</option> and <option>-D</option> command line
23972 options is checked against the values in the binary, not what is set here.
23973 </para>
23974 <para>
23975 Unless it consists entirely of digits, the string is looked up using
23976 <function>getpwnam()</function>, and failure causes a configuration error. If <option>exim_group</option> is
23977 not also supplied, the gid is taken from the result of <function>getpwnam()</function> if it is
23978 used. See chapter <xref linkend="CHAPsecurity"/> for a discussion of security issues.
23979 </para>
23980 <para>
23981 <indexterm role="option">
23982 <primary><option>extra_local_interfaces</option></primary>
23983 </indexterm>
23984 </para>
23985 <informaltable frame="all">
23986 <tgroup cols="4" colsep="0" rowsep="0">
23987 <colspec colwidth="8*" align="left"/>
23988 <colspec colwidth="6*" align="center"/>
23989 <colspec colwidth="6*" align="center"/>
23990 <colspec colwidth="6*" align="right"/>
23991 <tbody>
23992 <row>
23993 <entry><option>extra_local_interfaces</option></entry>
23994 <entry>Use: <emphasis>main</emphasis></entry>
23995 <entry>Type: <emphasis>string list</emphasis></entry>
23996 <entry>Default: <emphasis>unset</emphasis></entry>
23997 </row>
23998 </tbody>
23999 </tgroup>
24000 </informaltable>
24001 <para>
24002 This option defines network interfaces that are to be considered local when
24003 routing, but which are not used for listening by the daemon. See section
24004 <xref linkend="SECTreclocipadd"/> for details.
24005 </para>
24006 <para>
24007 <indexterm role="option">
24008 <primary><option>extract_addresses_remove_arguments</option></primary>
24009 </indexterm>
24010 </para>
24011 <informaltable frame="all">
24012 <tgroup cols="4" colsep="0" rowsep="0">
24013 <colspec colwidth="8*" align="left"/>
24014 <colspec colwidth="6*" align="center"/>
24015 <colspec colwidth="6*" align="center"/>
24016 <colspec colwidth="6*" align="right"/>
24017 <tbody>
24018 <row>
24019 <entry><option>extract_addresses_remove_ &nbsp;&nbsp;arguments</option></entry>
24020 <entry>Use: <emphasis>main</emphasis></entry>
24021 <entry>Type: <emphasis>boolean</emphasis></entry>
24022 <entry>Default: <emphasis>true</emphasis></entry>
24023 </row>
24024 </tbody>
24025 </tgroup>
24026 </informaltable>
24027 <para>
24028 <indexterm role="option">
24029 <primary><option>-t</option></primary>
24030 </indexterm>
24031 <indexterm role="concept">
24032 <primary>command line</primary>
24033 <secondary>addresses with <option>-t</option></secondary>
24034 </indexterm>
24035 <indexterm role="concept">
24036 <primary>Sendmail compatibility</primary>
24037 <secondary><option>-t</option> option</secondary>
24038 </indexterm>
24039 According to some Sendmail documentation (Sun, IRIX, HP-UX), if any addresses
24040 are present on the command line when the <option>-t</option> option is used to build an
24041 envelope from a message&#x2019;s <emphasis>To:</emphasis>, <emphasis>Cc:</emphasis> and <emphasis>Bcc:</emphasis> headers, the command
24042 line addresses are removed from the recipients list. This is also how Smail
24043 behaves. However, other Sendmail documentation (the O&#x2019;Reilly book) states that
24044 command line addresses are added to those obtained from the header lines. When
24045 <option>extract_addresses_remove_arguments</option> is true (the default), Exim subtracts
24046 argument headers. If it is set false, Exim adds rather than removes argument
24047 addresses.
24048 </para>
24049 <para>
24050 <indexterm role="option">
24051 <primary><option>finduser_retries</option></primary>
24052 </indexterm>
24053 </para>
24054 <informaltable frame="all">
24055 <tgroup cols="4" colsep="0" rowsep="0">
24056 <colspec colwidth="8*" align="left"/>
24057 <colspec colwidth="6*" align="center"/>
24058 <colspec colwidth="6*" align="center"/>
24059 <colspec colwidth="6*" align="right"/>
24060 <tbody>
24061 <row>
24062 <entry><option>finduser_retries</option></entry>
24063 <entry>Use: <emphasis>main</emphasis></entry>
24064 <entry>Type: <emphasis>integer</emphasis></entry>
24065 <entry>Default: <emphasis>0</emphasis></entry>
24066 </row>
24067 </tbody>
24068 </tgroup>
24069 </informaltable>
24070 <para>
24071 <indexterm role="concept">
24072 <primary>NIS, retrying user lookups</primary>
24073 </indexterm>
24074 On systems running NIS or other schemes in which user and group information is
24075 distributed from a remote system, there can be times when <function>getpwnam()</function> and
24076 related functions fail, even when given valid data, because things time out.
24077 Unfortunately these failures cannot be distinguished from genuine <quote>not found</quote>
24078 errors. If <option>finduser_retries</option> is set greater than zero, Exim will try that
24079 many extra times to find a user or a group, waiting for one second between
24080 retries.
24081 </para>
24082 <para>
24083 <indexterm role="concept">
24084 <primary><filename>/etc/passwd</filename></primary>
24085 <secondary>multiple reading of</secondary>
24086 </indexterm>
24087 You should not set this option greater than zero if your user information is in
24088 a traditional <filename>/etc/passwd</filename> file, because it will cause Exim needlessly to
24089 search the file multiple times for non-existent users, and also cause delay.
24090 </para>
24091 <para>
24092 <indexterm role="option">
24093 <primary><option>freeze_tell</option></primary>
24094 </indexterm>
24095 </para>
24096 <informaltable frame="all">
24097 <tgroup cols="4" colsep="0" rowsep="0">
24098 <colspec colwidth="8*" align="left"/>
24099 <colspec colwidth="6*" align="center"/>
24100 <colspec colwidth="6*" align="center"/>
24101 <colspec colwidth="6*" align="right"/>
24102 <tbody>
24103 <row>
24104 <entry><option>freeze_tell</option></entry>
24105 <entry>Use: <emphasis>main</emphasis></entry>
24106 <entry>Type: <emphasis>string list, comma separated</emphasis></entry>
24107 <entry>Default: <emphasis>unset</emphasis></entry>
24108 </row>
24109 </tbody>
24110 </tgroup>
24111 </informaltable>
24112 <para>
24113 <indexterm role="concept">
24114 <primary>freezing messages</primary>
24115 <secondary>sending a message when freezing</secondary>
24116 </indexterm>
24117 On encountering certain errors, or when configured to do so in a system filter,
24118 ACL, or special router, Exim freezes a message. This means that no further
24119 delivery attempts take place until an administrator thaws the message, or the
24120 <option>auto_thaw</option>, <option>ignore_bounce_errors_after</option>, or <option>timeout_frozen_after</option>
24121 feature cause it to be processed. If <option>freeze_tell</option> is set, Exim generates a
24122 warning message whenever it freezes something, unless the message it is
24123 freezing is a locally-generated bounce message. (Without this exception there
24124 is the possibility of looping.) The warning message is sent to the addresses
24125 supplied as the comma-separated value of this option. If several of the
24126 message&#x2019;s addresses cause freezing, only a single message is sent. If the
24127 freezing was automatic, the reason(s) for freezing can be found in the message
24128 log. If you configure freezing in a filter or ACL, you must arrange for any
24129 logging that you require.
24130 </para>
24131 <para>
24132 <indexterm role="option">
24133 <primary><option>gecos_name</option></primary>
24134 </indexterm>
24135 </para>
24136 <informaltable frame="all">
24137 <tgroup cols="4" colsep="0" rowsep="0">
24138 <colspec colwidth="8*" align="left"/>
24139 <colspec colwidth="6*" align="center"/>
24140 <colspec colwidth="6*" align="center"/>
24141 <colspec colwidth="6*" align="right"/>
24142 <tbody>
24143 <row>
24144 <entry><option>gecos_name</option></entry>
24145 <entry>Use: <emphasis>main</emphasis></entry>
24146 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
24147 <entry>Default: <emphasis>unset</emphasis></entry>
24148 </row>
24149 </tbody>
24150 </tgroup>
24151 </informaltable>
24152 <para>
24153 <indexterm role="concept">
24154 <primary>HP-UX</primary>
24155 </indexterm>
24156 <indexterm role="concept">
24157 <primary><quote>gecos</quote> field, parsing</primary>
24158 </indexterm>
24159 Some operating systems, notably HP-UX, use the <quote>gecos</quote> field in the system
24160 password file to hold other information in addition to users&#x2019; real names. Exim
24161 looks up this field for use when it is creating <emphasis>Sender:</emphasis> or <emphasis>From:</emphasis>
24162 headers. If either <option>gecos_pattern</option> or <option>gecos_name</option> are unset, the contents
24163 of the field are used unchanged, except that, if an ampersand is encountered,
24164 it is replaced by the user&#x2019;s login name with the first character forced to
24165 upper case, since this is a convention that is observed on many systems.
24166 </para>
24167 <para>
24168 When these options are set, <option>gecos_pattern</option> is treated as a regular
24169 expression that is to be applied to the field (again with &amp; replaced by the
24170 login name), and if it matches, <option>gecos_name</option> is expanded and used as the
24171 user&#x2019;s name.
24172 </para>
24173 <para>
24174 <indexterm role="concept">
24175 <primary>numerical variables (<varname>$1</varname> <varname>$2</varname> etc)</primary>
24176 <secondary>in <option>gecos_name</option></secondary>
24177 </indexterm>
24178 Numeric variables such as <varname>$1</varname>, <varname>$2</varname>, etc. can be used in the expansion to
24179 pick up sub-fields that were matched by the pattern. In HP-UX, where the user&#x2019;s
24180 name terminates at the first comma, the following can be used:
24181 </para>
24182 <literallayout class="monospaced">
24183 gecos_pattern = ([^,]*)
24184 gecos_name = $1
24185 </literallayout>
24186 <para>
24187 <indexterm role="option">
24188 <primary><option>gecos_pattern</option></primary>
24189 </indexterm>
24190 </para>
24191 <informaltable frame="all">
24192 <tgroup cols="4" colsep="0" rowsep="0">
24193 <colspec colwidth="8*" align="left"/>
24194 <colspec colwidth="6*" align="center"/>
24195 <colspec colwidth="6*" align="center"/>
24196 <colspec colwidth="6*" align="right"/>
24197 <tbody>
24198 <row>
24199 <entry><option>gecos_pattern</option></entry>
24200 <entry>Use: <emphasis>main</emphasis></entry>
24201 <entry>Type: <emphasis>string</emphasis></entry>
24202 <entry>Default: <emphasis>unset</emphasis></entry>
24203 </row>
24204 </tbody>
24205 </tgroup>
24206 </informaltable>
24207 <para>
24208 See <option>gecos_name</option> above.
24209 </para>
24210 <para>
24211 <indexterm role="option">
24212 <primary><option>gnutls_compat_mode</option></primary>
24213 </indexterm>
24214 </para>
24215 <informaltable frame="all">
24216 <tgroup cols="4" colsep="0" rowsep="0">
24217 <colspec colwidth="8*" align="left"/>
24218 <colspec colwidth="6*" align="center"/>
24219 <colspec colwidth="6*" align="center"/>
24220 <colspec colwidth="6*" align="right"/>
24221 <tbody>
24222 <row>
24223 <entry><option>gnutls_compat_mode</option></entry>
24224 <entry>Use: <emphasis>main</emphasis></entry>
24225 <entry>Type: <emphasis>boolean</emphasis></entry>
24226 <entry>Default: <emphasis>unset</emphasis></entry>
24227 </row>
24228 </tbody>
24229 </tgroup>
24230 </informaltable>
24231 <para>
24232 This option controls whether GnuTLS is used in compatibility mode in an Exim
24233 server. This reduces security slightly, but improves interworking with older
24234 implementations of TLS.
24235 </para>
24236 <para>
24237 option gnutls_allow_auto_pkcs11 main boolean unset
24238 This option will let GnuTLS (2.12.0 or later) autoload PKCS11 modules with
24239 the p11-kit configuration files in <filename>/etc/pkcs11/modules/</filename>.
24240 </para>
24241 <para>
24242 See
24243 <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>
24244 for documentation.
24245 </para>
24246 <para>
24247 <indexterm role="option">
24248 <primary><option>headers_charset</option></primary>
24249 </indexterm>
24250 </para>
24251 <informaltable frame="all">
24252 <tgroup cols="4" colsep="0" rowsep="0">
24253 <colspec colwidth="8*" align="left"/>
24254 <colspec colwidth="6*" align="center"/>
24255 <colspec colwidth="6*" align="center"/>
24256 <colspec colwidth="6*" align="right"/>
24257 <tbody>
24258 <row>
24259 <entry><option>headers_charset</option></entry>
24260 <entry>Use: <emphasis>main</emphasis></entry>
24261 <entry>Type: <emphasis>string</emphasis></entry>
24262 <entry>Default: <emphasis>see below</emphasis></entry>
24263 </row>
24264 </tbody>
24265 </tgroup>
24266 </informaltable>
24267 <para>
24268 This option sets a default character set for translating from encoded MIME
24269 <quote>words</quote> in header lines, when referenced by an <varname>$h_xxx</varname> expansion item. The
24270 default is the value of HEADERS_CHARSET in <filename>Local/Makefile</filename>. The
24271 ultimate default is ISO-8859-1. For more details see the description of header
24272 insertions in section <xref linkend="SECTexpansionitems"/>.
24273 </para>
24274 <para>
24275 <indexterm role="option">
24276 <primary><option>header_maxsize</option></primary>
24277 </indexterm>
24278 </para>
24279 <informaltable frame="all">
24280 <tgroup cols="4" colsep="0" rowsep="0">
24281 <colspec colwidth="8*" align="left"/>
24282 <colspec colwidth="6*" align="center"/>
24283 <colspec colwidth="6*" align="center"/>
24284 <colspec colwidth="6*" align="right"/>
24285 <tbody>
24286 <row>
24287 <entry><option>header_maxsize</option></entry>
24288 <entry>Use: <emphasis>main</emphasis></entry>
24289 <entry>Type: <emphasis>integer</emphasis></entry>
24290 <entry>Default: <emphasis>see below</emphasis></entry>
24291 </row>
24292 </tbody>
24293 </tgroup>
24294 </informaltable>
24295 <para>
24296 <indexterm role="concept">
24297 <primary>header section</primary>
24298 <secondary>maximum size of</secondary>
24299 </indexterm>
24300 <indexterm role="concept">
24301 <primary>limit</primary>
24302 <secondary>size of message header section</secondary>
24303 </indexterm>
24304 This option controls the overall maximum size of a message&#x2019;s header
24305 section. The default is the value of HEADER_MAXSIZE in
24306 <filename>Local/Makefile</filename>; the default for that is 1M. Messages with larger header
24307 sections are rejected.
24308 </para>
24309 <para>
24310 <indexterm role="option">
24311 <primary><option>header_line_maxsize</option></primary>
24312 </indexterm>
24313 </para>
24314 <informaltable frame="all">
24315 <tgroup cols="4" colsep="0" rowsep="0">
24316 <colspec colwidth="8*" align="left"/>
24317 <colspec colwidth="6*" align="center"/>
24318 <colspec colwidth="6*" align="center"/>
24319 <colspec colwidth="6*" align="right"/>
24320 <tbody>
24321 <row>
24322 <entry><option>header_line_maxsize</option></entry>
24323 <entry>Use: <emphasis>main</emphasis></entry>
24324 <entry>Type: <emphasis>integer</emphasis></entry>
24325 <entry>Default: <emphasis>0</emphasis></entry>
24326 </row>
24327 </tbody>
24328 </tgroup>
24329 </informaltable>
24330 <para>
24331 <indexterm role="concept">
24332 <primary>header lines</primary>
24333 <secondary>maximum size of</secondary>
24334 </indexterm>
24335 <indexterm role="concept">
24336 <primary>limit</primary>
24337 <secondary>size of one header line</secondary>
24338 </indexterm>
24339 This option limits the length of any individual header line in a message, after
24340 all the continuations have been joined together. Messages with individual
24341 header lines that are longer than the limit are rejected. The default value of
24342 zero means <quote>no limit</quote>.
24343 </para>
24344 <para>
24345 <indexterm role="option">
24346 <primary><option>helo_accept_junk_hosts</option></primary>
24347 </indexterm>
24348 </para>
24349 <informaltable frame="all">
24350 <tgroup cols="4" colsep="0" rowsep="0">
24351 <colspec colwidth="8*" align="left"/>
24352 <colspec colwidth="6*" align="center"/>
24353 <colspec colwidth="6*" align="center"/>
24354 <colspec colwidth="6*" align="right"/>
24355 <tbody>
24356 <row>
24357 <entry><option>helo_accept_junk_hosts</option></entry>
24358 <entry>Use: <emphasis>main</emphasis></entry>
24359 <entry>Type: <emphasis>host list</emphasis>&dagger;<emphasis></emphasis></entry>
24360 <entry>Default: <emphasis>unset</emphasis></entry>
24361 </row>
24362 </tbody>
24363 </tgroup>
24364 </informaltable>
24365 <para>
24366 <indexterm role="concept">
24367 <primary>HELO</primary>
24368 <secondary>accepting junk data</secondary>
24369 </indexterm>
24370 <indexterm role="concept">
24371 <primary>EHLO</primary>
24372 <secondary>accepting junk data</secondary>
24373 </indexterm>
24374 Exim checks the syntax of HELO and EHLO commands for incoming SMTP
24375 mail, and gives an error response for invalid data. Unfortunately, there are
24376 some SMTP clients that send syntactic junk. They can be accommodated by setting
24377 this option. Note that this is a syntax check only. See <option>helo_verify_hosts</option>
24378 if you want to do semantic checking.
24379 See also <option>helo_allow_chars</option> for a way of extending the permitted character
24380 set.
24381 </para>
24382 <para>
24383 <indexterm role="option">
24384 <primary><option>helo_allow_chars</option></primary>
24385 </indexterm>
24386 </para>
24387 <informaltable frame="all">
24388 <tgroup cols="4" colsep="0" rowsep="0">
24389 <colspec colwidth="8*" align="left"/>
24390 <colspec colwidth="6*" align="center"/>
24391 <colspec colwidth="6*" align="center"/>
24392 <colspec colwidth="6*" align="right"/>
24393 <tbody>
24394 <row>
24395 <entry><option>helo_allow_chars</option></entry>
24396 <entry>Use: <emphasis>main</emphasis></entry>
24397 <entry>Type: <emphasis>string</emphasis></entry>
24398 <entry>Default: <emphasis>unset</emphasis></entry>
24399 </row>
24400 </tbody>
24401 </tgroup>
24402 </informaltable>
24403 <para>
24404 <indexterm role="concept">
24405 <primary>HELO</primary>
24406 <secondary>underscores in</secondary>
24407 </indexterm>
24408 <indexterm role="concept">
24409 <primary>EHLO</primary>
24410 <secondary>underscores in</secondary>
24411 </indexterm>
24412 <indexterm role="concept">
24413 <primary>underscore in EHLO/HELO</primary>
24414 </indexterm>
24415 This option can be set to a string of rogue characters that are permitted in
24416 all EHLO and HELO names in addition to the standard letters, digits,
24417 hyphens, and dots. If you really must allow underscores, you can set
24418 </para>
24419 <literallayout class="monospaced">
24420 helo_allow_chars = _
24421 </literallayout>
24422 <para>
24423 Note that the value is one string, not a list.
24424 </para>
24425 <para>
24426 <indexterm role="option">
24427 <primary><option>helo_lookup_domains</option></primary>
24428 </indexterm>
24429 </para>
24430 <informaltable frame="all">
24431 <tgroup cols="4" colsep="0" rowsep="0">
24432 <colspec colwidth="8*" align="left"/>
24433 <colspec colwidth="6*" align="center"/>
24434 <colspec colwidth="6*" align="center"/>
24435 <colspec colwidth="6*" align="right"/>
24436 <tbody>
24437 <row>
24438 <entry><option>helo_lookup_domains</option></entry>
24439 <entry>Use: <emphasis>main</emphasis></entry>
24440 <entry>Type: <emphasis>domain list</emphasis>&dagger;<emphasis></emphasis></entry>
24441 <entry>Default: <emphasis><literal>@:@[]</literal></emphasis></entry>
24442 </row>
24443 </tbody>
24444 </tgroup>
24445 </informaltable>
24446 <para>
24447 <indexterm role="concept">
24448 <primary>HELO</primary>
24449 <secondary>forcing reverse lookup</secondary>
24450 </indexterm>
24451 <indexterm role="concept">
24452 <primary>EHLO</primary>
24453 <secondary>forcing reverse lookup</secondary>
24454 </indexterm>
24455 If the domain given by a client in a HELO or EHLO command matches this
24456 list, a reverse lookup is done in order to establish the host&#x2019;s true name. The
24457 default forces a lookup if the client host gives the server&#x2019;s name or any of
24458 its IP addresses (in brackets), something that broken clients have been seen to
24459 do.
24460 </para>
24461 <para>
24462 <indexterm role="option">
24463 <primary><option>helo_try_verify_hosts</option></primary>
24464 </indexterm>
24465 </para>
24466 <informaltable frame="all">
24467 <tgroup cols="4" colsep="0" rowsep="0">
24468 <colspec colwidth="8*" align="left"/>
24469 <colspec colwidth="6*" align="center"/>
24470 <colspec colwidth="6*" align="center"/>
24471 <colspec colwidth="6*" align="right"/>
24472 <tbody>
24473 <row>
24474 <entry><option>helo_try_verify_hosts</option></entry>
24475 <entry>Use: <emphasis>main</emphasis></entry>
24476 <entry>Type: <emphasis>host list</emphasis>&dagger;<emphasis></emphasis></entry>
24477 <entry>Default: <emphasis>unset</emphasis></entry>
24478 </row>
24479 </tbody>
24480 </tgroup>
24481 </informaltable>
24482 <para>
24483 <indexterm role="concept">
24484 <primary>HELO verifying</primary>
24485 <secondary>optional</secondary>
24486 </indexterm>
24487 <indexterm role="concept">
24488 <primary>EHLO</primary>
24489 <secondary>verifying, optional</secondary>
24490 </indexterm>
24491 By default, Exim just checks the syntax of HELO and EHLO commands (see
24492 <option>helo_accept_junk_hosts</option> and <option>helo_allow_chars</option>). However, some sites like
24493 to do more extensive checking of the data supplied by these commands. The ACL
24494 condition <literal>verify = helo</literal> is provided to make this possible.
24495 Formerly, it was necessary also to set this option (<option>helo_try_verify_hosts</option>)
24496 to force the check to occur. From release 4.53 onwards, this is no longer
24497 necessary. If the check has not been done before <literal>verify = helo</literal> is
24498 encountered, it is done at that time. Consequently, this option is obsolete.
24499 Its specification is retained here for backwards compatibility.
24500 </para>
24501 <para>
24502 When an EHLO or HELO command is received, if the calling host matches
24503 <option>helo_try_verify_hosts</option>, Exim checks that the host name given in the HELO or
24504 EHLO command either:
24505 </para>
24506 <itemizedlist>
24507 <listitem>
24508 <para>
24509 is an IP literal matching the calling address of the host, or
24510 </para>
24511 </listitem>
24512 <listitem>
24513 <para>
24514 <indexterm role="concept">
24515 <primary>DNS</primary>
24516 <secondary>reverse lookup</secondary>
24517 </indexterm>
24518 <indexterm role="concept">
24519 <primary>reverse DNS lookup</primary>
24520 </indexterm>
24521 matches the host name that Exim obtains by doing a reverse lookup of the
24522 calling host address, or
24523 </para>
24524 </listitem>
24525 <listitem>
24526 <para>
24527 when looked up using <function>gethostbyname()</function> (or <function>getipnodebyname()</function> when
24528 available) yields the calling host address.
24529 </para>
24530 </listitem>
24531 </itemizedlist>
24532 <para>
24533 However, the EHLO or HELO command is not rejected if any of the checks
24534 fail. Processing continues, but the result of the check is remembered, and can
24535 be detected later in an ACL by the <literal>verify = helo</literal> condition.
24536 </para>
24537 <para>
24538 <indexterm role="option">
24539 <primary><option>helo_verify_hosts</option></primary>
24540 </indexterm>
24541 </para>
24542 <informaltable frame="all">
24543 <tgroup cols="4" colsep="0" rowsep="0">
24544 <colspec colwidth="8*" align="left"/>
24545 <colspec colwidth="6*" align="center"/>
24546 <colspec colwidth="6*" align="center"/>
24547 <colspec colwidth="6*" align="right"/>
24548 <tbody>
24549 <row>
24550 <entry><option>helo_verify_hosts</option></entry>
24551 <entry>Use: <emphasis>main</emphasis></entry>
24552 <entry>Type: <emphasis>host list</emphasis>&dagger;<emphasis></emphasis></entry>
24553 <entry>Default: <emphasis>unset</emphasis></entry>
24554 </row>
24555 </tbody>
24556 </tgroup>
24557 </informaltable>
24558 <para>
24559 <indexterm role="concept">
24560 <primary>HELO verifying</primary>
24561 <secondary>mandatory</secondary>
24562 </indexterm>
24563 <indexterm role="concept">
24564 <primary>EHLO</primary>
24565 <secondary>verifying, mandatory</secondary>
24566 </indexterm>
24567 Like <option>helo_try_verify_hosts</option>, this option is obsolete, and retained only for
24568 backwards compatibility. For hosts that match this option, Exim checks the host
24569 name given in the HELO or EHLO in the same way as for
24570 <option>helo_try_verify_hosts</option>. If the check fails, the HELO or EHLO command is
24571 rejected with a 550 error, and entries are written to the main and reject logs.
24572 If a MAIL command is received before EHLO or HELO, it is rejected with a 503
24573 error.
24574 </para>
24575 <para>
24576 <indexterm role="option">
24577 <primary><option>hold_domains</option></primary>
24578 </indexterm>
24579 </para>
24580 <informaltable frame="all">
24581 <tgroup cols="4" colsep="0" rowsep="0">
24582 <colspec colwidth="8*" align="left"/>
24583 <colspec colwidth="6*" align="center"/>
24584 <colspec colwidth="6*" align="center"/>
24585 <colspec colwidth="6*" align="right"/>
24586 <tbody>
24587 <row>
24588 <entry><option>hold_domains</option></entry>
24589 <entry>Use: <emphasis>main</emphasis></entry>
24590 <entry>Type: <emphasis>domain list</emphasis>&dagger;<emphasis></emphasis></entry>
24591 <entry>Default: <emphasis>unset</emphasis></entry>
24592 </row>
24593 </tbody>
24594 </tgroup>
24595 </informaltable>
24596 <para>
24597 <indexterm role="concept">
24598 <primary>domain</primary>
24599 <secondary>delaying delivery</secondary>
24600 </indexterm>
24601 <indexterm role="concept">
24602 <primary>delivery</primary>
24603 <secondary>delaying certain domains</secondary>
24604 </indexterm>
24605 This option allows mail for particular domains to be held on the queue
24606 manually. The option is overridden if a message delivery is forced with the
24607 <option>-M</option>, <option>-qf</option>, <option>-Rf</option> or <option>-Sf</option> options, and also while testing or
24608 verifying addresses using <option>-bt</option> or <option>-bv</option>. Otherwise, if a domain matches an
24609 item in <option>hold_domains</option>, no routing or delivery for that address is done, and
24610 it is deferred every time the message is looked at.
24611 </para>
24612 <para>
24613 This option is intended as a temporary operational measure for delaying the
24614 delivery of mail while some problem is being sorted out, or some new
24615 configuration tested. If you just want to delay the processing of some
24616 domains until a queue run occurs, you should use <option>queue_domains</option> or
24617 <option>queue_smtp_domains</option>, not <option>hold_domains</option>.
24618 </para>
24619 <para>
24620 A setting of <option>hold_domains</option> does not override Exim&#x2019;s code for removing
24621 messages from the queue if they have been there longer than the longest retry
24622 time in any retry rule. If you want to hold messages for longer than the normal
24623 retry times, insert a dummy retry rule with a long retry time.
24624 </para>
24625 <para>
24626 <indexterm role="option">
24627 <primary><option>host_lookup</option></primary>
24628 </indexterm>
24629 </para>
24630 <informaltable frame="all">
24631 <tgroup cols="4" colsep="0" rowsep="0">
24632 <colspec colwidth="8*" align="left"/>
24633 <colspec colwidth="6*" align="center"/>
24634 <colspec colwidth="6*" align="center"/>
24635 <colspec colwidth="6*" align="right"/>
24636 <tbody>
24637 <row>
24638 <entry><option>host_lookup</option></entry>
24639 <entry>Use: <emphasis>main</emphasis></entry>
24640 <entry>Type: <emphasis>host list</emphasis>&dagger;<emphasis></emphasis></entry>
24641 <entry>Default: <emphasis>unset</emphasis></entry>
24642 </row>
24643 </tbody>
24644 </tgroup>
24645 </informaltable>
24646 <para>
24647 <indexterm role="concept">
24648 <primary>host name</primary>
24649 <secondary>lookup, forcing</secondary>
24650 </indexterm>
24651 Exim does not look up the name of a calling host from its IP address unless it
24652 is required to compare against some host list, or the host matches
24653 <option>helo_try_verify_hosts</option> or <option>helo_verify_hosts</option>, or the host matches this
24654 option (which normally contains IP addresses rather than host names). The
24655 default configuration file contains
24656 </para>
24657 <literallayout class="monospaced">
24658 host_lookup = *
24659 </literallayout>
24660 <para>
24661 which causes a lookup to happen for all hosts. If the expense of these lookups
24662 is felt to be too great, the setting can be changed or removed.
24663 </para>
24664 <para>
24665 After a successful reverse lookup, Exim does a forward lookup on the name it
24666 has obtained, to verify that it yields the IP address that it started with. If
24667 this check fails, Exim behaves as if the name lookup failed.
24668 </para>
24669 <para>
24670 <indexterm role="variable">
24671 <primary><varname>$host_lookup_failed</varname></primary>
24672 </indexterm>
24673 <indexterm role="variable">
24674 <primary><varname>$sender_host_name</varname></primary>
24675 </indexterm>
24676 After any kind of failure, the host name (in <varname>$sender_host_name</varname>) remains
24677 unset, and <varname>$host_lookup_failed</varname> is set to the string <quote>1</quote>. See also
24678 <option>dns_again_means_nonexist</option>, <option>helo_lookup_domains</option>, and
24679 <literal>verify = reverse_host_lookup</literal> in ACLs.
24680 </para>
24681 <para>
24682 <indexterm role="option">
24683 <primary><option>host_lookup_order</option></primary>
24684 </indexterm>
24685 </para>
24686 <informaltable frame="all">
24687 <tgroup cols="4" colsep="0" rowsep="0">
24688 <colspec colwidth="8*" align="left"/>
24689 <colspec colwidth="6*" align="center"/>
24690 <colspec colwidth="6*" align="center"/>
24691 <colspec colwidth="6*" align="right"/>
24692 <tbody>
24693 <row>
24694 <entry><option>host_lookup_order</option></entry>
24695 <entry>Use: <emphasis>main</emphasis></entry>
24696 <entry>Type: <emphasis>string list</emphasis></entry>
24697 <entry>Default: <emphasis><literal>bydns:byaddr</literal></emphasis></entry>
24698 </row>
24699 </tbody>
24700 </tgroup>
24701 </informaltable>
24702 <para>
24703 This option specifies the order of different lookup methods when Exim is trying
24704 to find a host name from an IP address. The default is to do a DNS lookup
24705 first, and then to try a local lookup (using <function>gethostbyaddr()</function> or equivalent)
24706 if that fails. You can change the order of these lookups, or omit one entirely,
24707 if you want.
24708 </para>
24709 <para>
24710 <emphasis role="bold">Warning</emphasis>: The <quote>byaddr</quote> method does not always yield aliases when there are
24711 multiple PTR records in the DNS and the IP address is not listed in
24712 <filename>/etc/hosts</filename>. Different operating systems give different results in this
24713 case. That is why the default tries a DNS lookup first.
24714 </para>
24715 <para>
24716 <indexterm role="option">
24717 <primary><option>host_reject_connection</option></primary>
24718 </indexterm>
24719 </para>
24720 <informaltable frame="all">
24721 <tgroup cols="4" colsep="0" rowsep="0">
24722 <colspec colwidth="8*" align="left"/>
24723 <colspec colwidth="6*" align="center"/>
24724 <colspec colwidth="6*" align="center"/>
24725 <colspec colwidth="6*" align="right"/>
24726 <tbody>
24727 <row>
24728 <entry><option>host_reject_connection</option></entry>
24729 <entry>Use: <emphasis>main</emphasis></entry>
24730 <entry>Type: <emphasis>host list</emphasis>&dagger;<emphasis></emphasis></entry>
24731 <entry>Default: <emphasis>unset</emphasis></entry>
24732 </row>
24733 </tbody>
24734 </tgroup>
24735 </informaltable>
24736 <para>
24737 <indexterm role="concept">
24738 <primary>host</primary>
24739 <secondary>rejecting connections from</secondary>
24740 </indexterm>
24741 If this option is set, incoming SMTP calls from the hosts listed are rejected
24742 as soon as the connection is made.
24743 This option is obsolete, and retained only for backward compatibility, because
24744 nowadays the ACL specified by <option>acl_smtp_connect</option> can also reject incoming
24745 connections immediately.
24746 </para>
24747 <para>
24748 The ability to give an immediate rejection (either by this option or using an
24749 ACL) is provided for use in unusual cases. Many hosts will just try again,
24750 sometimes without much delay. Normally, it is better to use an ACL to reject
24751 incoming messages at a later stage, such as after RCPT commands. See
24752 chapter <xref linkend="CHAPACL"/>.
24753 </para>
24754 <para>
24755 <indexterm role="option">
24756 <primary><option>hosts_connection_nolog</option></primary>
24757 </indexterm>
24758 </para>
24759 <informaltable frame="all">
24760 <tgroup cols="4" colsep="0" rowsep="0">
24761 <colspec colwidth="8*" align="left"/>
24762 <colspec colwidth="6*" align="center"/>
24763 <colspec colwidth="6*" align="center"/>
24764 <colspec colwidth="6*" align="right"/>
24765 <tbody>
24766 <row>
24767 <entry><option>hosts_connection_nolog</option></entry>
24768 <entry>Use: <emphasis>main</emphasis></entry>
24769 <entry>Type: <emphasis>host list</emphasis>&dagger;<emphasis></emphasis></entry>
24770 <entry>Default: <emphasis>unset</emphasis></entry>
24771 </row>
24772 </tbody>
24773 </tgroup>
24774 </informaltable>
24775 <para>
24776 <indexterm role="concept">
24777 <primary>host</primary>
24778 <secondary>not logging connections from</secondary>
24779 </indexterm>
24780 This option defines a list of hosts for which connection logging does not
24781 happen, even though the <option>smtp_connection</option> log selector is set. For example,
24782 you might want not to log SMTP connections from local processes, or from
24783 127.0.0.1, or from your local LAN. This option is consulted in the main loop of
24784 the daemon; you should therefore strive to restrict its value to a short inline
24785 list of IP addresses and networks. To disable logging SMTP connections from
24786 local processes, you must create a host list with an empty item. For example:
24787 </para>
24788 <literallayout class="monospaced">
24789 hosts_connection_nolog = :
24790 </literallayout>
24791 <para>
24792 If the <option>smtp_connection</option> log selector is not set, this option has no effect.
24793 </para>
24794 <para>
24795 <indexterm role="option">
24796 <primary><option>hosts_treat_as_local</option></primary>
24797 </indexterm>
24798 </para>
24799 <informaltable frame="all">
24800 <tgroup cols="4" colsep="0" rowsep="0">
24801 <colspec colwidth="8*" align="left"/>
24802 <colspec colwidth="6*" align="center"/>
24803 <colspec colwidth="6*" align="center"/>
24804 <colspec colwidth="6*" align="right"/>
24805 <tbody>
24806 <row>
24807 <entry><option>hosts_treat_as_local</option></entry>
24808 <entry>Use: <emphasis>main</emphasis></entry>
24809 <entry>Type: <emphasis>domain list</emphasis>&dagger;<emphasis></emphasis></entry>
24810 <entry>Default: <emphasis>unset</emphasis></entry>
24811 </row>
24812 </tbody>
24813 </tgroup>
24814 </informaltable>
24815 <para>
24816 <indexterm role="concept">
24817 <primary>local host</primary>
24818 <secondary>domains treated as</secondary>
24819 </indexterm>
24820 <indexterm role="concept">
24821 <primary>host</primary>
24822 <secondary>treated as local</secondary>
24823 </indexterm>
24824 If this option is set, any host names that match the domain list are treated as
24825 if they were the local host when Exim is scanning host lists obtained from MX
24826 records
24827 or other sources. Note that the value of this option is a domain list, not a
24828 host list, because it is always used to check host names, not IP addresses.
24829 </para>
24830 <para>
24831 This option also applies when Exim is matching the special items
24832 <literal>@mx_any</literal>, <literal>@mx_primary</literal>, and <literal>@mx_secondary</literal> in a domain list (see
24833 section <xref linkend="SECTdomainlist"/>), and when checking the <option>hosts</option> option in the
24834 <command>smtp</command> transport for the local host (see the <option>allow_localhost</option> option in
24835 that transport). See also <option>local_interfaces</option>, <option>extra_local_interfaces</option>, and
24836 chapter <xref linkend="CHAPinterfaces"/>, which contains a discussion about local network
24837 interfaces and recognizing the local host.
24838 </para>
24839 <para>
24840 <indexterm role="option">
24841 <primary><option>ibase_servers</option></primary>
24842 </indexterm>
24843 </para>
24844 <informaltable frame="all">
24845 <tgroup cols="4" colsep="0" rowsep="0">
24846 <colspec colwidth="8*" align="left"/>
24847 <colspec colwidth="6*" align="center"/>
24848 <colspec colwidth="6*" align="center"/>
24849 <colspec colwidth="6*" align="right"/>
24850 <tbody>
24851 <row>
24852 <entry><option>ibase_servers</option></entry>
24853 <entry>Use: <emphasis>main</emphasis></entry>
24854 <entry>Type: <emphasis>string list</emphasis></entry>
24855 <entry>Default: <emphasis>unset</emphasis></entry>
24856 </row>
24857 </tbody>
24858 </tgroup>
24859 </informaltable>
24860 <para>
24861 <indexterm role="concept">
24862 <primary>InterBase</primary>
24863 <secondary>server list</secondary>
24864 </indexterm>
24865 This option provides a list of InterBase servers and associated connection data,
24866 to be used in conjunction with <command>ibase</command> lookups (see section <xref linkend="SECID72"/>).
24867 The option is available only if Exim has been built with InterBase support.
24868 </para>
24869 <para>
24870 <indexterm role="option">
24871 <primary><option>ignore_bounce_errors_after</option></primary>
24872 </indexterm>
24873 </para>
24874 <informaltable frame="all">
24875 <tgroup cols="4" colsep="0" rowsep="0">
24876 <colspec colwidth="8*" align="left"/>
24877 <colspec colwidth="6*" align="center"/>
24878 <colspec colwidth="6*" align="center"/>
24879 <colspec colwidth="6*" align="right"/>
24880 <tbody>
24881 <row>
24882 <entry><option>ignore_bounce_errors_after</option></entry>
24883 <entry>Use: <emphasis>main</emphasis></entry>
24884 <entry>Type: <emphasis>time</emphasis></entry>
24885 <entry>Default: <emphasis>10w</emphasis></entry>
24886 </row>
24887 </tbody>
24888 </tgroup>
24889 </informaltable>
24890 <para>
24891 <indexterm role="concept">
24892 <primary>bounce message</primary>
24893 <secondary>discarding</secondary>
24894 </indexterm>
24895 <indexterm role="concept">
24896 <primary>discarding bounce message</primary>
24897 </indexterm>
24898 This option affects the processing of bounce messages that cannot be delivered,
24899 that is, those that suffer a permanent delivery failure. (Bounce messages that
24900 suffer temporary delivery failures are of course retried in the usual way.)
24901 </para>
24902 <para>
24903 After a permanent delivery failure, bounce messages are frozen,
24904 because there is no sender to whom they can be returned. When a frozen bounce
24905 message has been on the queue for more than the given time, it is unfrozen at
24906 the next queue run, and a further delivery is attempted. If delivery fails
24907 again, the bounce message is discarded. This makes it possible to keep failed
24908 bounce messages around for a shorter time than the normal maximum retry time
24909 for frozen messages. For example,
24910 </para>
24911 <literallayout class="monospaced">
24912 ignore_bounce_errors_after = 12h
24913 </literallayout>
24914 <para>
24915 retries failed bounce message deliveries after 12 hours, discarding any further
24916 failures. If the value of this option is set to a zero time period, bounce
24917 failures are discarded immediately. Setting a very long time (as in the default
24918 value) has the effect of disabling this option. For ways of automatically
24919 dealing with other kinds of frozen message, see <option>auto_thaw</option> and
24920 <option>timeout_frozen_after</option>.
24921 </para>
24922 <para>
24923 <indexterm role="option">
24924 <primary><option>ignore_fromline_hosts</option></primary>
24925 </indexterm>
24926 </para>
24927 <informaltable frame="all">
24928 <tgroup cols="4" colsep="0" rowsep="0">
24929 <colspec colwidth="8*" align="left"/>
24930 <colspec colwidth="6*" align="center"/>
24931 <colspec colwidth="6*" align="center"/>
24932 <colspec colwidth="6*" align="right"/>
24933 <tbody>
24934 <row>
24935 <entry><option>ignore_fromline_hosts</option></entry>
24936 <entry>Use: <emphasis>main</emphasis></entry>
24937 <entry>Type: <emphasis>host list</emphasis>&dagger;<emphasis></emphasis></entry>
24938 <entry>Default: <emphasis>unset</emphasis></entry>
24939 </row>
24940 </tbody>
24941 </tgroup>
24942 </informaltable>
24943 <para>
24944 <indexterm role="concept">
24945 <primary><quote>From</quote> line</primary>
24946 </indexterm>
24947 <indexterm role="concept">
24948 <primary>UUCP</primary>
24949 <secondary><quote>From</quote> line</secondary>
24950 </indexterm>
24951 Some broken SMTP clients insist on sending a UUCP-like <quote>From&nbsp;</quote> line before
24952 the headers of a message. By default this is treated as the start of the
24953 message&#x2019;s body, which means that any following headers are not recognized as
24954 such. Exim can be made to ignore it by setting <option>ignore_fromline_hosts</option> to
24955 match those hosts that insist on sending it. If the sender is actually a local
24956 process rather than a remote host, and is using <option>-bs</option> to inject the messages,
24957 <option>ignore_fromline_local</option> must be set to achieve this effect.
24958 </para>
24959 <para>
24960 <indexterm role="option">
24961 <primary><option>ignore_fromline_local</option></primary>
24962 </indexterm>
24963 </para>
24964 <informaltable frame="all">
24965 <tgroup cols="4" colsep="0" rowsep="0">
24966 <colspec colwidth="8*" align="left"/>
24967 <colspec colwidth="6*" align="center"/>
24968 <colspec colwidth="6*" align="center"/>
24969 <colspec colwidth="6*" align="right"/>
24970 <tbody>
24971 <row>
24972 <entry><option>ignore_fromline_local</option></entry>
24973 <entry>Use: <emphasis>main</emphasis></entry>
24974 <entry>Type: <emphasis>boolean</emphasis></entry>
24975 <entry>Default: <emphasis>false</emphasis></entry>
24976 </row>
24977 </tbody>
24978 </tgroup>
24979 </informaltable>
24980 <para>
24981 See <option>ignore_fromline_hosts</option> above.
24982 </para>
24983 <para>
24984 <indexterm role="option">
24985 <primary><option>keep_malformed</option></primary>
24986 </indexterm>
24987 </para>
24988 <informaltable frame="all">
24989 <tgroup cols="4" colsep="0" rowsep="0">
24990 <colspec colwidth="8*" align="left"/>
24991 <colspec colwidth="6*" align="center"/>
24992 <colspec colwidth="6*" align="center"/>
24993 <colspec colwidth="6*" align="right"/>
24994 <tbody>
24995 <row>
24996 <entry><option>keep_malformed</option></entry>
24997 <entry>Use: <emphasis>main</emphasis></entry>
24998 <entry>Type: <emphasis>time</emphasis></entry>
24999 <entry>Default: <emphasis>4d</emphasis></entry>
25000 </row>
25001 </tbody>
25002 </tgroup>
25003 </informaltable>
25004 <para>
25005 This option specifies the length of time to keep messages whose spool files
25006 have been corrupted in some way. This should, of course, never happen. At the
25007 next attempt to deliver such a message, it gets removed. The incident is
25008 logged.
25009 </para>
25010 <para>
25011 <indexterm role="option">
25012 <primary><option>ldap_ca_cert_dir</option></primary>
25013 </indexterm>
25014 </para>
25015 <informaltable frame="all">
25016 <tgroup cols="4" colsep="0" rowsep="0">
25017 <colspec colwidth="8*" align="left"/>
25018 <colspec colwidth="6*" align="center"/>
25019 <colspec colwidth="6*" align="center"/>
25020 <colspec colwidth="6*" align="right"/>
25021 <tbody>
25022 <row>
25023 <entry><option>ldap_ca_cert_dir</option></entry>
25024 <entry>Use: <emphasis>main</emphasis></entry>
25025 <entry>Type: <emphasis>string</emphasis></entry>
25026 <entry>Default: <emphasis>unset</emphasis></entry>
25027 </row>
25028 </tbody>
25029 </tgroup>
25030 </informaltable>
25031 <para>
25032 <indexterm role="concept">
25033 <primary>LDAP</primary>
25034 <secondary>,</secondary>
25035 </indexterm>
25036 This option indicates which directory contains CA certificates for verifying
25037 a TLS certificate presented by an LDAP server.
25038 While Exim does not provide a default value, your SSL library may.
25039 Analogous to <option>tls_verify_certificates</option> but as a client-side option for LDAP
25040 and constrained to be a directory.
25041 </para>
25042 <para>
25043 <indexterm role="option">
25044 <primary><option>ldap_ca_cert_file</option></primary>
25045 </indexterm>
25046 </para>
25047 <informaltable frame="all">
25048 <tgroup cols="4" colsep="0" rowsep="0">
25049 <colspec colwidth="8*" align="left"/>
25050 <colspec colwidth="6*" align="center"/>
25051 <colspec colwidth="6*" align="center"/>
25052 <colspec colwidth="6*" align="right"/>
25053 <tbody>
25054 <row>
25055 <entry><option>ldap_ca_cert_file</option></entry>
25056 <entry>Use: <emphasis>main</emphasis></entry>
25057 <entry>Type: <emphasis>string</emphasis></entry>
25058 <entry>Default: <emphasis>unset</emphasis></entry>
25059 </row>
25060 </tbody>
25061 </tgroup>
25062 </informaltable>
25063 <para>
25064 <indexterm role="concept">
25065 <primary>LDAP</primary>
25066 <secondary>,</secondary>
25067 </indexterm>
25068 This option indicates which file contains CA certificates for verifying
25069 a TLS certificate presented by an LDAP server.
25070 While Exim does not provide a default value, your SSL library may.
25071 Analogous to <option>tls_verify_certificates</option> but as a client-side option for LDAP
25072 and constrained to be a file.
25073 </para>
25074 <para>
25075 <indexterm role="option">
25076 <primary><option>ldap_cert_file</option></primary>
25077 </indexterm>
25078 </para>
25079 <informaltable frame="all">
25080 <tgroup cols="4" colsep="0" rowsep="0">
25081 <colspec colwidth="8*" align="left"/>
25082 <colspec colwidth="6*" align="center"/>
25083 <colspec colwidth="6*" align="center"/>
25084 <colspec colwidth="6*" align="right"/>
25085 <tbody>
25086 <row>
25087 <entry><option>ldap_cert_file</option></entry>
25088 <entry>Use: <emphasis>main</emphasis></entry>
25089 <entry>Type: <emphasis>string</emphasis></entry>
25090 <entry>Default: <emphasis>unset</emphasis></entry>
25091 </row>
25092 </tbody>
25093 </tgroup>
25094 </informaltable>
25095 <para>
25096 <indexterm role="concept">
25097 <primary>LDAP</primary>
25098 <secondary>TLS client certificate file</secondary>
25099 </indexterm>
25100 This option indicates which file contains an TLS client certificate which
25101 Exim should present to the LDAP server during TLS negotiation.
25102 Should be used together with <option>ldap_cert_key</option>.
25103 </para>
25104 <para>
25105 <indexterm role="option">
25106 <primary><option>ldap_cert_key</option></primary>
25107 </indexterm>
25108 </para>
25109 <informaltable frame="all">
25110 <tgroup cols="4" colsep="0" rowsep="0">
25111 <colspec colwidth="8*" align="left"/>
25112 <colspec colwidth="6*" align="center"/>
25113 <colspec colwidth="6*" align="center"/>
25114 <colspec colwidth="6*" align="right"/>
25115 <tbody>
25116 <row>
25117 <entry><option>ldap_cert_key</option></entry>
25118 <entry>Use: <emphasis>main</emphasis></entry>
25119 <entry>Type: <emphasis>string</emphasis></entry>
25120 <entry>Default: <emphasis>unset</emphasis></entry>
25121 </row>
25122 </tbody>
25123 </tgroup>
25124 </informaltable>
25125 <para>
25126 <indexterm role="concept">
25127 <primary>LDAP</primary>
25128 <secondary>TLS client key file</secondary>
25129 </indexterm>
25130 This option indicates which file contains the secret/private key to use
25131 to prove identity to the LDAP server during TLS negotiation.
25132 Should be used together with <option>ldap_cert_file</option>, which contains the
25133 identity to be proven.
25134 </para>
25135 <para>
25136 <indexterm role="option">
25137 <primary><option>ldap_cipher_suite</option></primary>
25138 </indexterm>
25139 </para>
25140 <informaltable frame="all">
25141 <tgroup cols="4" colsep="0" rowsep="0">
25142 <colspec colwidth="8*" align="left"/>
25143 <colspec colwidth="6*" align="center"/>
25144 <colspec colwidth="6*" align="center"/>
25145 <colspec colwidth="6*" align="right"/>
25146 <tbody>
25147 <row>
25148 <entry><option>ldap_cipher_suite</option></entry>
25149 <entry>Use: <emphasis>main</emphasis></entry>
25150 <entry>Type: <emphasis>string</emphasis></entry>
25151 <entry>Default: <emphasis>unset</emphasis></entry>
25152 </row>
25153 </tbody>
25154 </tgroup>
25155 </informaltable>
25156 <para>
25157 <indexterm role="concept">
25158 <primary>LDAP</primary>
25159 <secondary>TLS cipher suite</secondary>
25160 </indexterm>
25161 This controls the TLS cipher-suite negotiation during TLS negotiation with
25162 the LDAP server.  See <xref linkend="SECTreqciphssl"/> for more details of the format of
25163 cipher-suite options with OpenSSL (as used by LDAP client libraries).
25164 </para>
25165 <para>
25166 <indexterm role="option">
25167 <primary><option>ldap_default_servers</option></primary>
25168 </indexterm>
25169 </para>
25170 <informaltable frame="all">
25171 <tgroup cols="4" colsep="0" rowsep="0">
25172 <colspec colwidth="8*" align="left"/>
25173 <colspec colwidth="6*" align="center"/>
25174 <colspec colwidth="6*" align="center"/>
25175 <colspec colwidth="6*" align="right"/>
25176 <tbody>
25177 <row>
25178 <entry><option>ldap_default_servers</option></entry>
25179 <entry>Use: <emphasis>main</emphasis></entry>
25180 <entry>Type: <emphasis>string list</emphasis></entry>
25181 <entry>Default: <emphasis>unset</emphasis></entry>
25182 </row>
25183 </tbody>
25184 </tgroup>
25185 </informaltable>
25186 <para>
25187 <indexterm role="concept">
25188 <primary>LDAP</primary>
25189 <secondary>default servers</secondary>
25190 </indexterm>
25191 This option provides a list of LDAP servers which are tried in turn when an
25192 LDAP query does not contain a server. See section <xref linkend="SECTforldaque"/> for
25193 details of LDAP queries. This option is available only when Exim has been built
25194 with LDAP support.
25195 </para>
25196 <para>
25197 <indexterm role="option">
25198 <primary><option>ldap_require_cert</option></primary>
25199 </indexterm>
25200 </para>
25201 <informaltable frame="all">
25202 <tgroup cols="4" colsep="0" rowsep="0">
25203 <colspec colwidth="8*" align="left"/>
25204 <colspec colwidth="6*" align="center"/>
25205 <colspec colwidth="6*" align="center"/>
25206 <colspec colwidth="6*" align="right"/>
25207 <tbody>
25208 <row>
25209 <entry><option>ldap_require_cert</option></entry>
25210 <entry>Use: <emphasis>main</emphasis></entry>
25211 <entry>Type: <emphasis>string</emphasis></entry>
25212 <entry>Default: <emphasis>unset.</emphasis></entry>
25213 </row>
25214 </tbody>
25215 </tgroup>
25216 </informaltable>
25217 <para>
25218 <indexterm role="concept">
25219 <primary>LDAP</primary>
25220 <secondary>policy for LDAP server TLS cert presentation</secondary>
25221 </indexterm>
25222 This should be one of the values "hard", "demand", "allow", "try" or "never".
25223 A value other than one of these is interpreted as "never".
25224 See the entry "TLS_REQCERT" in your system man page for ldap.conf(5).
25225 Although Exim does not set a default, the LDAP library probably defaults
25226 to hard/demand.
25227 </para>
25228 <para>
25229 <indexterm role="option">
25230 <primary><option>ldap_start_tls</option></primary>
25231 </indexterm>
25232 </para>
25233 <informaltable frame="all">
25234 <tgroup cols="4" colsep="0" rowsep="0">
25235 <colspec colwidth="8*" align="left"/>
25236 <colspec colwidth="6*" align="center"/>
25237 <colspec colwidth="6*" align="center"/>
25238 <colspec colwidth="6*" align="right"/>
25239 <tbody>
25240 <row>
25241 <entry><option>ldap_start_tls</option></entry>
25242 <entry>Use: <emphasis>main</emphasis></entry>
25243 <entry>Type: <emphasis>boolean</emphasis></entry>
25244 <entry>Default: <emphasis>false</emphasis></entry>
25245 </row>
25246 </tbody>
25247 </tgroup>
25248 </informaltable>
25249 <para>
25250 <indexterm role="concept">
25251 <primary>LDAP</primary>
25252 <secondary>whether or not to negotiate TLS</secondary>
25253 </indexterm>
25254 If set, Exim will attempt to negotiate TLS with the LDAP server when
25255 connecting on a regular LDAP port.  This is the LDAP equivalent of SMTP&#x2019;s
25256 "STARTTLS".  This is distinct from using "ldaps", which is the LDAP form
25257 of SSL-on-connect.
25258 In the event of failure to negotiate TLS, the action taken is controlled
25259 by <option>ldap_require_cert</option>.
25260 </para>
25261 <para>
25262 <indexterm role="option">
25263 <primary><option>ldap_version</option></primary>
25264 </indexterm>
25265 </para>
25266 <informaltable frame="all">
25267 <tgroup cols="4" colsep="0" rowsep="0">
25268 <colspec colwidth="8*" align="left"/>
25269 <colspec colwidth="6*" align="center"/>
25270 <colspec colwidth="6*" align="center"/>
25271 <colspec colwidth="6*" align="right"/>
25272 <tbody>
25273 <row>
25274 <entry><option>ldap_version</option></entry>
25275 <entry>Use: <emphasis>main</emphasis></entry>
25276 <entry>Type: <emphasis>integer</emphasis></entry>
25277 <entry>Default: <emphasis>unset</emphasis></entry>
25278 </row>
25279 </tbody>
25280 </tgroup>
25281 </informaltable>
25282 <para>
25283 <indexterm role="concept">
25284 <primary>LDAP</primary>
25285 <secondary>protocol version, forcing</secondary>
25286 </indexterm>
25287 This option can be used to force Exim to set a specific protocol version for
25288 LDAP. If it option is unset, it is shown by the <option>-bP</option> command line option as
25289 -1. When this is the case, the default is 3 if LDAP_VERSION3 is defined in
25290 the LDAP headers; otherwise it is 2. This option is available only when Exim
25291 has been built with LDAP support.
25292 </para>
25293 <para>
25294 <indexterm role="option">
25295 <primary><option>local_from_check</option></primary>
25296 </indexterm>
25297 </para>
25298 <informaltable frame="all">
25299 <tgroup cols="4" colsep="0" rowsep="0">
25300 <colspec colwidth="8*" align="left"/>
25301 <colspec colwidth="6*" align="center"/>
25302 <colspec colwidth="6*" align="center"/>
25303 <colspec colwidth="6*" align="right"/>
25304 <tbody>
25305 <row>
25306 <entry><option>local_from_check</option></entry>
25307 <entry>Use: <emphasis>main</emphasis></entry>
25308 <entry>Type: <emphasis>boolean</emphasis></entry>
25309 <entry>Default: <emphasis>true</emphasis></entry>
25310 </row>
25311 </tbody>
25312 </tgroup>
25313 </informaltable>
25314 <para>
25315 <indexterm role="concept">
25316 <primary><emphasis>Sender:</emphasis> header line</primary>
25317 <secondary>disabling addition of</secondary>
25318 </indexterm>
25319 <indexterm role="concept">
25320 <primary><emphasis>From:</emphasis> header line</primary>
25321 <secondary>disabling checking of</secondary>
25322 </indexterm>
25323 When a message is submitted locally (that is, not over a TCP/IP connection) by
25324 an untrusted user, Exim removes any existing <emphasis>Sender:</emphasis> header line, and
25325 checks that the <emphasis>From:</emphasis> header line matches the login of the calling user and
25326 the domain specified by <option>qualify_domain</option>.
25327 </para>
25328 <para>
25329 <emphasis role="bold">Note</emphasis>: An unqualified address (no domain) in the <emphasis>From:</emphasis> header in a
25330 locally submitted message is automatically qualified by Exim, unless the
25331 <option>-bnq</option> command line option is used.
25332 </para>
25333 <para>
25334 You can use <option>local_from_prefix</option> and <option>local_from_suffix</option> to permit affixes
25335 on the local part. If the <emphasis>From:</emphasis> header line does not match, Exim adds a
25336 <emphasis>Sender:</emphasis> header with an address constructed from the calling user&#x2019;s login
25337 and the default qualify domain.
25338 </para>
25339 <para>
25340 If <option>local_from_check</option> is set false, the <emphasis>From:</emphasis> header check is disabled,
25341 and no <emphasis>Sender:</emphasis> header is ever added. If, in addition, you want to retain
25342 <emphasis>Sender:</emphasis> header lines supplied by untrusted users, you must also set
25343 <option>local_sender_retain</option> to be true.
25344 </para>
25345 <para>
25346 <indexterm role="concept">
25347 <primary>envelope sender</primary>
25348 </indexterm>
25349 These options affect only the header lines in the message. The envelope sender
25350 is still forced to be the login id at the qualify domain unless
25351 <option>untrusted_set_sender</option> permits the user to supply an envelope sender.
25352 </para>
25353 <para>
25354 For messages received over TCP/IP, an ACL can specify <quote>submission mode</quote> to
25355 request similar header line checking. See section <xref linkend="SECTthesenhea"/>, which
25356 has more details about <emphasis>Sender:</emphasis> processing.
25357 </para>
25358 <para>
25359 <indexterm role="option">
25360 <primary><option>local_from_prefix</option></primary>
25361 </indexterm>
25362 </para>
25363 <informaltable frame="all">
25364 <tgroup cols="4" colsep="0" rowsep="0">
25365 <colspec colwidth="8*" align="left"/>
25366 <colspec colwidth="6*" align="center"/>
25367 <colspec colwidth="6*" align="center"/>
25368 <colspec colwidth="6*" align="right"/>
25369 <tbody>
25370 <row>
25371 <entry><option>local_from_prefix</option></entry>
25372 <entry>Use: <emphasis>main</emphasis></entry>
25373 <entry>Type: <emphasis>string</emphasis></entry>
25374 <entry>Default: <emphasis>unset</emphasis></entry>
25375 </row>
25376 </tbody>
25377 </tgroup>
25378 </informaltable>
25379 <para>
25380 When Exim checks the <emphasis>From:</emphasis> header line of locally submitted messages for
25381 matching the login id (see <option>local_from_check</option> above), it can be configured to
25382 ignore certain prefixes and suffixes in the local part of the address. This is
25383 done by setting <option>local_from_prefix</option> and/or <option>local_from_suffix</option> to
25384 appropriate lists, in the same form as the <option>local_part_prefix</option> and
25385 <option>local_part_suffix</option> router options (see chapter <xref linkend="CHAProutergeneric"/>). For
25386 example, if
25387 </para>
25388 <literallayout class="monospaced">
25389 local_from_prefix = *-
25390 </literallayout>
25391 <para>
25392 is set, a <emphasis>From:</emphasis> line containing
25393 </para>
25394 <literallayout class="monospaced">
25395 From: anything-user@your.domain.example
25396 </literallayout>
25397 <para>
25398 will not cause a <emphasis>Sender:</emphasis> header to be added if <emphasis>user@your.domain.example</emphasis>
25399 matches the actual sender address that is constructed from the login name and
25400 qualify domain.
25401 </para>
25402 <para>
25403 <indexterm role="option">
25404 <primary><option>local_from_suffix</option></primary>
25405 </indexterm>
25406 </para>
25407 <informaltable frame="all">
25408 <tgroup cols="4" colsep="0" rowsep="0">
25409 <colspec colwidth="8*" align="left"/>
25410 <colspec colwidth="6*" align="center"/>
25411 <colspec colwidth="6*" align="center"/>
25412 <colspec colwidth="6*" align="right"/>
25413 <tbody>
25414 <row>
25415 <entry><option>local_from_suffix</option></entry>
25416 <entry>Use: <emphasis>main</emphasis></entry>
25417 <entry>Type: <emphasis>string</emphasis></entry>
25418 <entry>Default: <emphasis>unset</emphasis></entry>
25419 </row>
25420 </tbody>
25421 </tgroup>
25422 </informaltable>
25423 <para>
25424 See <option>local_from_prefix</option> above.
25425 </para>
25426 <para>
25427 <indexterm role="option">
25428 <primary><option>local_interfaces</option></primary>
25429 </indexterm>
25430 </para>
25431 <informaltable frame="all">
25432 <tgroup cols="4" colsep="0" rowsep="0">
25433 <colspec colwidth="8*" align="left"/>
25434 <colspec colwidth="6*" align="center"/>
25435 <colspec colwidth="6*" align="center"/>
25436 <colspec colwidth="6*" align="right"/>
25437 <tbody>
25438 <row>
25439 <entry><option>local_interfaces</option></entry>
25440 <entry>Use: <emphasis>main</emphasis></entry>
25441 <entry>Type: <emphasis>string list</emphasis></entry>
25442 <entry>Default: <emphasis>see below</emphasis></entry>
25443 </row>
25444 </tbody>
25445 </tgroup>
25446 </informaltable>
25447 <para>
25448 This option controls which network interfaces are used by the daemon for
25449 listening; they are also used to identify the local host when routing. Chapter
25450 <xref linkend="CHAPinterfaces"/> contains a full description of this option and the related
25451 options <option>daemon_smtp_ports</option>, <option>extra_local_interfaces</option>,
25452 <option>hosts_treat_as_local</option>, and <option>tls_on_connect_ports</option>. The default value for
25453 <option>local_interfaces</option> is
25454 </para>
25455 <literallayout class="monospaced">
25456 local_interfaces = 0.0.0.0
25457 </literallayout>
25458 <para>
25459 when Exim is built without IPv6 support; otherwise it is
25460 </para>
25461 <literallayout class="monospaced">
25462 local_interfaces = &lt;; ::0 ; 0.0.0.0
25463 </literallayout>
25464 <para>
25465 <indexterm role="option">
25466 <primary><option>local_scan_timeout</option></primary>
25467 </indexterm>
25468 </para>
25469 <informaltable frame="all">
25470 <tgroup cols="4" colsep="0" rowsep="0">
25471 <colspec colwidth="8*" align="left"/>
25472 <colspec colwidth="6*" align="center"/>
25473 <colspec colwidth="6*" align="center"/>
25474 <colspec colwidth="6*" align="right"/>
25475 <tbody>
25476 <row>
25477 <entry><option>local_scan_timeout</option></entry>
25478 <entry>Use: <emphasis>main</emphasis></entry>
25479 <entry>Type: <emphasis>time</emphasis></entry>
25480 <entry>Default: <emphasis>5m</emphasis></entry>
25481 </row>
25482 </tbody>
25483 </tgroup>
25484 </informaltable>
25485 <para>
25486 <indexterm role="concept">
25487 <primary>timeout</primary>
25488 <secondary>for <function>local_scan()</function> function</secondary>
25489 </indexterm>
25490 <indexterm role="concept">
25491 <primary><function>local_scan()</function> function</primary>
25492 <secondary>timeout</secondary>
25493 </indexterm>
25494 This timeout applies to the <function>local_scan()</function> function (see chapter
25495 <xref linkend="CHAPlocalscan"/>). Zero means <quote>no timeout</quote>. If the timeout is exceeded,
25496 the incoming message is rejected with a temporary error if it is an SMTP
25497 message. For a non-SMTP message, the message is dropped and Exim ends with a
25498 non-zero code. The incident is logged on the main and reject logs.
25499 </para>
25500 <para>
25501 <indexterm role="option">
25502 <primary><option>local_sender_retain</option></primary>
25503 </indexterm>
25504 </para>
25505 <informaltable frame="all">
25506 <tgroup cols="4" colsep="0" rowsep="0">
25507 <colspec colwidth="8*" align="left"/>
25508 <colspec colwidth="6*" align="center"/>
25509 <colspec colwidth="6*" align="center"/>
25510 <colspec colwidth="6*" align="right"/>
25511 <tbody>
25512 <row>
25513 <entry><option>local_sender_retain</option></entry>
25514 <entry>Use: <emphasis>main</emphasis></entry>
25515 <entry>Type: <emphasis>boolean</emphasis></entry>
25516 <entry>Default: <emphasis>false</emphasis></entry>
25517 </row>
25518 </tbody>
25519 </tgroup>
25520 </informaltable>
25521 <para>
25522 <indexterm role="concept">
25523 <primary><emphasis>Sender:</emphasis> header line</primary>
25524 <secondary>retaining from local submission</secondary>
25525 </indexterm>
25526 When a message is submitted locally (that is, not over a TCP/IP connection) by
25527 an untrusted user, Exim removes any existing <emphasis>Sender:</emphasis> header line. If you
25528 do not want this to happen, you must set <option>local_sender_retain</option>, and you must
25529 also set <option>local_from_check</option> to be false (Exim will complain if you do not).
25530 See also the ACL modifier <literal>control = suppress_local_fixups</literal>. Section
25531 <xref linkend="SECTthesenhea"/> has more details about <emphasis>Sender:</emphasis> processing.
25532 </para>
25533 <para>
25534 <indexterm role="option">
25535 <primary><option>localhost_number</option></primary>
25536 </indexterm>
25537 </para>
25538 <informaltable frame="all">
25539 <tgroup cols="4" colsep="0" rowsep="0">
25540 <colspec colwidth="8*" align="left"/>
25541 <colspec colwidth="6*" align="center"/>
25542 <colspec colwidth="6*" align="center"/>
25543 <colspec colwidth="6*" align="right"/>
25544 <tbody>
25545 <row>
25546 <entry><option>localhost_number</option></entry>
25547 <entry>Use: <emphasis>main</emphasis></entry>
25548 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
25549 <entry>Default: <emphasis>unset</emphasis></entry>
25550 </row>
25551 </tbody>
25552 </tgroup>
25553 </informaltable>
25554 <para>
25555 <indexterm role="concept">
25556 <primary>host</primary>
25557 <secondary>locally unique number for</secondary>
25558 </indexterm>
25559 <indexterm role="concept">
25560 <primary>message ids</primary>
25561 <secondary>with multiple hosts</secondary>
25562 </indexterm>
25563 <indexterm role="variable">
25564 <primary><varname>$localhost_number</varname></primary>
25565 </indexterm>
25566 Exim&#x2019;s message ids are normally unique only within the local host. If
25567 uniqueness among a set of hosts is required, each host must set a different
25568 value for the <option>localhost_number</option> option. The string is expanded immediately
25569 after reading the configuration file (so that a number can be computed from the
25570 host name, for example) and the result of the expansion must be a number in the
25571 range 0&ndash;16 (or 0&ndash;10 on operating systems with case-insensitive file
25572 systems). This is available in subsequent string expansions via the variable
25573 <varname>$localhost_number</varname>. When <option>localhost_number is set</option>, the final two
25574 characters of the message id, instead of just being a fractional part of the
25575 time, are computed from the time and the local host number as described in
25576 section <xref linkend="SECTmessiden"/>.
25577 </para>
25578 <para>
25579 <indexterm role="option">
25580 <primary><option>log_file_path</option></primary>
25581 </indexterm>
25582 </para>
25583 <informaltable frame="all">
25584 <tgroup cols="4" colsep="0" rowsep="0">
25585 <colspec colwidth="8*" align="left"/>
25586 <colspec colwidth="6*" align="center"/>
25587 <colspec colwidth="6*" align="center"/>
25588 <colspec colwidth="6*" align="right"/>
25589 <tbody>
25590 <row>
25591 <entry><option>log_file_path</option></entry>
25592 <entry>Use: <emphasis>main</emphasis></entry>
25593 <entry>Type: <emphasis>string list</emphasis>&dagger;<emphasis></emphasis></entry>
25594 <entry>Default: <emphasis>set at compile time</emphasis></entry>
25595 </row>
25596 </tbody>
25597 </tgroup>
25598 </informaltable>
25599 <para>
25600 <indexterm role="concept">
25601 <primary>log</primary>
25602 <secondary>file path for</secondary>
25603 </indexterm>
25604 This option sets the path which is used to determine the names of Exim&#x2019;s log
25605 files, or indicates that logging is to be to syslog, or both. It is expanded
25606 when Exim is entered, so it can, for example, contain a reference to the host
25607 name. If no specific path is set for the log files at compile or run time, they
25608 are written in a sub-directory called <filename>log</filename> in Exim&#x2019;s spool directory.
25609 Chapter <xref linkend="CHAPlog"/> contains further details about Exim&#x2019;s logging, and
25610 section <xref linkend="SECTwhelogwri"/> describes how the contents of <option>log_file_path</option> are
25611 used. If this string is fixed at your installation (contains no expansion
25612 variables) it is recommended that you do not set this option in the
25613 configuration file, but instead supply the path using LOG_FILE_PATH in
25614 <filename>Local/Makefile</filename> so that it is available to Exim for logging errors detected
25615 early on &ndash; in particular, failure to read the configuration file.
25616 </para>
25617 <para>
25618 <indexterm role="option">
25619 <primary><option>log_selector</option></primary>
25620 </indexterm>
25621 </para>
25622 <informaltable frame="all">
25623 <tgroup cols="4" colsep="0" rowsep="0">
25624 <colspec colwidth="8*" align="left"/>
25625 <colspec colwidth="6*" align="center"/>
25626 <colspec colwidth="6*" align="center"/>
25627 <colspec colwidth="6*" align="right"/>
25628 <tbody>
25629 <row>
25630 <entry><option>log_selector</option></entry>
25631 <entry>Use: <emphasis>main</emphasis></entry>
25632 <entry>Type: <emphasis>string</emphasis></entry>
25633 <entry>Default: <emphasis>unset</emphasis></entry>
25634 </row>
25635 </tbody>
25636 </tgroup>
25637 </informaltable>
25638 <para>
25639 <indexterm role="concept">
25640 <primary>log</primary>
25641 <secondary>selectors</secondary>
25642 </indexterm>
25643 This option can be used to reduce or increase the number of things that Exim
25644 writes to its log files. Its argument is made up of names preceded by plus or
25645 minus characters. For example:
25646 </para>
25647 <literallayout class="monospaced">
25648 log_selector = +arguments -retry_defer
25649 </literallayout>
25650 <para>
25651 A list of possible names and what they control is given in the chapter on
25652 logging, in section <xref linkend="SECTlogselector"/>.
25653 </para>
25654 <para>
25655 <indexterm role="option">
25656 <primary><option>log_timezone</option></primary>
25657 </indexterm>
25658 </para>
25659 <informaltable frame="all">
25660 <tgroup cols="4" colsep="0" rowsep="0">
25661 <colspec colwidth="8*" align="left"/>
25662 <colspec colwidth="6*" align="center"/>
25663 <colspec colwidth="6*" align="center"/>
25664 <colspec colwidth="6*" align="right"/>
25665 <tbody>
25666 <row>
25667 <entry><option>log_timezone</option></entry>
25668 <entry>Use: <emphasis>main</emphasis></entry>
25669 <entry>Type: <emphasis>boolean</emphasis></entry>
25670 <entry>Default: <emphasis>false</emphasis></entry>
25671 </row>
25672 </tbody>
25673 </tgroup>
25674 </informaltable>
25675 <para>
25676 <indexterm role="concept">
25677 <primary>log</primary>
25678 <secondary>timezone for entries</secondary>
25679 </indexterm>
25680 <indexterm role="variable">
25681 <primary><varname>$tod_log</varname></primary>
25682 </indexterm>
25683 <indexterm role="variable">
25684 <primary><varname>$tod_zone</varname></primary>
25685 </indexterm>
25686 By default, the timestamps on log lines are in local time without the
25687 timezone. This means that if your timezone changes twice a year, the timestamps
25688 in log lines are ambiguous for an hour when the clocks go back. One way of
25689 avoiding this problem is to set the timezone to UTC. An alternative is to set
25690 <option>log_timezone</option> true. This turns on the addition of the timezone offset to
25691 timestamps in log lines. Turning on this option can add quite a lot to the size
25692 of log files because each line is extended by 6 characters. Note that the
25693 <varname>$tod_log</varname> variable contains the log timestamp without the zone, but there is
25694 another variable called <varname>$tod_zone</varname> that contains just the timezone offset.
25695 </para>
25696 <para>
25697 <indexterm role="option">
25698 <primary><option>lookup_open_max</option></primary>
25699 </indexterm>
25700 </para>
25701 <informaltable frame="all">
25702 <tgroup cols="4" colsep="0" rowsep="0">
25703 <colspec colwidth="8*" align="left"/>
25704 <colspec colwidth="6*" align="center"/>
25705 <colspec colwidth="6*" align="center"/>
25706 <colspec colwidth="6*" align="right"/>
25707 <tbody>
25708 <row>
25709 <entry><option>lookup_open_max</option></entry>
25710 <entry>Use: <emphasis>main</emphasis></entry>
25711 <entry>Type: <emphasis>integer</emphasis></entry>
25712 <entry>Default: <emphasis>25</emphasis></entry>
25713 </row>
25714 </tbody>
25715 </tgroup>
25716 </informaltable>
25717 <para>
25718 <indexterm role="concept">
25719 <primary>too many open files</primary>
25720 </indexterm>
25721 <indexterm role="concept">
25722 <primary>open files, too many</primary>
25723 </indexterm>
25724 <indexterm role="concept">
25725 <primary>file</primary>
25726 <secondary>too many open</secondary>
25727 </indexterm>
25728 <indexterm role="concept">
25729 <primary>lookup</primary>
25730 <secondary>maximum open files</secondary>
25731 </indexterm>
25732 <indexterm role="concept">
25733 <primary>limit</primary>
25734 <secondary>open files for lookups</secondary>
25735 </indexterm>
25736 This option limits the number of simultaneously open files for single-key
25737 lookups that use regular files (that is, <command>lsearch</command>, <command>dbm</command>, and <command>cdb</command>).
25738 Exim normally keeps these files open during routing, because often the same
25739 file is required several times. If the limit is reached, Exim closes the least
25740 recently used file. Note that if you are using the <emphasis>ndbm</emphasis> library, it
25741 actually opens two files for each logical DBM database, though it still counts
25742 as one for the purposes of <option>lookup_open_max</option>. If you are getting <quote>too many
25743 open files</quote> errors with NDBM, you need to reduce the value of
25744 <option>lookup_open_max</option>.
25745 </para>
25746 <para>
25747 <indexterm role="option">
25748 <primary><option>max_username_length</option></primary>
25749 </indexterm>
25750 </para>
25751 <informaltable frame="all">
25752 <tgroup cols="4" colsep="0" rowsep="0">
25753 <colspec colwidth="8*" align="left"/>
25754 <colspec colwidth="6*" align="center"/>
25755 <colspec colwidth="6*" align="center"/>
25756 <colspec colwidth="6*" align="right"/>
25757 <tbody>
25758 <row>
25759 <entry><option>max_username_length</option></entry>
25760 <entry>Use: <emphasis>main</emphasis></entry>
25761 <entry>Type: <emphasis>integer</emphasis></entry>
25762 <entry>Default: <emphasis>0</emphasis></entry>
25763 </row>
25764 </tbody>
25765 </tgroup>
25766 </informaltable>
25767 <para>
25768 <indexterm role="concept">
25769 <primary>length of login name</primary>
25770 </indexterm>
25771 <indexterm role="concept">
25772 <primary>user name</primary>
25773 <secondary>maximum length</secondary>
25774 </indexterm>
25775 <indexterm role="concept">
25776 <primary>limit</primary>
25777 <secondary>user name length</secondary>
25778 </indexterm>
25779 Some operating systems are broken in that they truncate long arguments to
25780 <function>getpwnam()</function> to eight characters, instead of returning <quote>no such user</quote>. If
25781 this option is set greater than zero, any attempt to call <function>getpwnam()</function> with
25782 an argument that is longer behaves as if <function>getpwnam()</function> failed.
25783 </para>
25784 <para>
25785 <indexterm role="option">
25786 <primary><option>message_body_newlines</option></primary>
25787 </indexterm>
25788 </para>
25789 <informaltable frame="all">
25790 <tgroup cols="4" colsep="0" rowsep="0">
25791 <colspec colwidth="8*" align="left"/>
25792 <colspec colwidth="6*" align="center"/>
25793 <colspec colwidth="6*" align="center"/>
25794 <colspec colwidth="6*" align="right"/>
25795 <tbody>
25796 <row>
25797 <entry><option>message_body_newlines</option></entry>
25798 <entry>Use: <emphasis>main</emphasis></entry>
25799 <entry>Type: <emphasis>bool</emphasis></entry>
25800 <entry>Default: <emphasis>false</emphasis></entry>
25801 </row>
25802 </tbody>
25803 </tgroup>
25804 </informaltable>
25805 <para>
25806 <indexterm role="concept">
25807 <primary>message body</primary>
25808 <secondary>newlines in variables</secondary>
25809 </indexterm>
25810 <indexterm role="concept">
25811 <primary>newline</primary>
25812 <secondary>in message body variables</secondary>
25813 </indexterm>
25814 <indexterm role="variable">
25815 <primary><varname>$message_body</varname></primary>
25816 </indexterm>
25817 <indexterm role="variable">
25818 <primary><varname>$message_body_end</varname></primary>
25819 </indexterm>
25820 By default, newlines in the message body are replaced by spaces when setting
25821 the <varname>$message_body</varname> and <varname>$message_body_end</varname> expansion variables. If this
25822 option is set true, this no longer happens.
25823 </para>
25824 <para>
25825 <indexterm role="option">
25826 <primary><option>message_body_visible</option></primary>
25827 </indexterm>
25828 </para>
25829 <informaltable frame="all">
25830 <tgroup cols="4" colsep="0" rowsep="0">
25831 <colspec colwidth="8*" align="left"/>
25832 <colspec colwidth="6*" align="center"/>
25833 <colspec colwidth="6*" align="center"/>
25834 <colspec colwidth="6*" align="right"/>
25835 <tbody>
25836 <row>
25837 <entry><option>message_body_visible</option></entry>
25838 <entry>Use: <emphasis>main</emphasis></entry>
25839 <entry>Type: <emphasis>integer</emphasis></entry>
25840 <entry>Default: <emphasis>500</emphasis></entry>
25841 </row>
25842 </tbody>
25843 </tgroup>
25844 </informaltable>
25845 <para>
25846 <indexterm role="concept">
25847 <primary>body of message</primary>
25848 <secondary>visible size</secondary>
25849 </indexterm>
25850 <indexterm role="concept">
25851 <primary>message body</primary>
25852 <secondary>visible size</secondary>
25853 </indexterm>
25854 <indexterm role="variable">
25855 <primary><varname>$message_body</varname></primary>
25856 </indexterm>
25857 <indexterm role="variable">
25858 <primary><varname>$message_body_end</varname></primary>
25859 </indexterm>
25860 This option specifies how much of a message&#x2019;s body is to be included in the
25861 <varname>$message_body</varname> and <varname>$message_body_end</varname> expansion variables.
25862 </para>
25863 <para>
25864 <indexterm role="option">
25865 <primary><option>message_id_header_domain</option></primary>
25866 </indexterm>
25867 </para>
25868 <informaltable frame="all">
25869 <tgroup cols="4" colsep="0" rowsep="0">
25870 <colspec colwidth="8*" align="left"/>
25871 <colspec colwidth="6*" align="center"/>
25872 <colspec colwidth="6*" align="center"/>
25873 <colspec colwidth="6*" align="right"/>
25874 <tbody>
25875 <row>
25876 <entry><option>message_id_header_domain</option></entry>
25877 <entry>Use: <emphasis>main</emphasis></entry>
25878 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
25879 <entry>Default: <emphasis>unset</emphasis></entry>
25880 </row>
25881 </tbody>
25882 </tgroup>
25883 </informaltable>
25884 <para>
25885 <indexterm role="concept">
25886 <primary><emphasis>Message-ID:</emphasis> header line</primary>
25887 </indexterm>
25888 If this option is set, the string is expanded and used as the right hand side
25889 (domain) of the <emphasis>Message-ID:</emphasis> header that Exim creates if a
25890 locally-originated incoming message does not have one. <quote>Locally-originated</quote>
25891 means <quote>not received over TCP/IP.</quote>
25892 Otherwise, the primary host name is used.
25893 Only letters, digits, dot and hyphen are accepted; any other characters are
25894 replaced by hyphens. If the expansion is forced to fail, or if the result is an
25895 empty string, the option is ignored.
25896 </para>
25897 <para>
25898 <indexterm role="option">
25899 <primary><option>message_id_header_text</option></primary>
25900 </indexterm>
25901 </para>
25902 <informaltable frame="all">
25903 <tgroup cols="4" colsep="0" rowsep="0">
25904 <colspec colwidth="8*" align="left"/>
25905 <colspec colwidth="6*" align="center"/>
25906 <colspec colwidth="6*" align="center"/>
25907 <colspec colwidth="6*" align="right"/>
25908 <tbody>
25909 <row>
25910 <entry><option>message_id_header_text</option></entry>
25911 <entry>Use: <emphasis>main</emphasis></entry>
25912 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
25913 <entry>Default: <emphasis>unset</emphasis></entry>
25914 </row>
25915 </tbody>
25916 </tgroup>
25917 </informaltable>
25918 <para>
25919 If this variable is set, the string is expanded and used to augment the text of
25920 the <emphasis>Message-id:</emphasis> header that Exim creates if a locally-originated incoming
25921 message does not have one. The text of this header is required by RFC 2822 to
25922 take the form of an address. By default, Exim uses its internal message id as
25923 the local part, and the primary host name as the domain. If this option is set,
25924 it is expanded, and provided the expansion is not forced to fail, and does not
25925 yield an empty string, the result is inserted into the header immediately
25926 before the @, separated from the internal message id by a dot. Any characters
25927 that are illegal in an address are automatically converted into hyphens. This
25928 means that variables such as <varname>$tod_log</varname> can be used, because the spaces and
25929 colons will become hyphens.
25930 </para>
25931 <para>
25932 <indexterm role="option">
25933 <primary><option>message_logs</option></primary>
25934 </indexterm>
25935 </para>
25936 <informaltable frame="all">
25937 <tgroup cols="4" colsep="0" rowsep="0">
25938 <colspec colwidth="8*" align="left"/>
25939 <colspec colwidth="6*" align="center"/>
25940 <colspec colwidth="6*" align="center"/>
25941 <colspec colwidth="6*" align="right"/>
25942 <tbody>
25943 <row>
25944 <entry><option>message_logs</option></entry>
25945 <entry>Use: <emphasis>main</emphasis></entry>
25946 <entry>Type: <emphasis>boolean</emphasis></entry>
25947 <entry>Default: <emphasis>true</emphasis></entry>
25948 </row>
25949 </tbody>
25950 </tgroup>
25951 </informaltable>
25952 <para>
25953 <indexterm role="concept">
25954 <primary>message logs</primary>
25955 <secondary>disabling</secondary>
25956 </indexterm>
25957 <indexterm role="concept">
25958 <primary>log</primary>
25959 <secondary>message log; disabling</secondary>
25960 </indexterm>
25961 If this option is turned off, per-message log files are not created in the
25962 <filename>msglog</filename> spool sub-directory. This reduces the amount of disk I/O required by
25963 Exim, by reducing the number of files involved in handling a message from a
25964 minimum of four (header spool file, body spool file, delivery journal, and
25965 per-message log) to three. The other major I/O activity is Exim&#x2019;s main log,
25966 which is not affected by this option.
25967 </para>
25968 <para>
25969 <indexterm role="option">
25970 <primary><option>message_size_limit</option></primary>
25971 </indexterm>
25972 </para>
25973 <informaltable frame="all">
25974 <tgroup cols="4" colsep="0" rowsep="0">
25975 <colspec colwidth="8*" align="left"/>
25976 <colspec colwidth="6*" align="center"/>
25977 <colspec colwidth="6*" align="center"/>
25978 <colspec colwidth="6*" align="right"/>
25979 <tbody>
25980 <row>
25981 <entry><option>message_size_limit</option></entry>
25982 <entry>Use: <emphasis>main</emphasis></entry>
25983 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
25984 <entry>Default: <emphasis>50M</emphasis></entry>
25985 </row>
25986 </tbody>
25987 </tgroup>
25988 </informaltable>
25989 <para>
25990 <indexterm role="concept">
25991 <primary>message</primary>
25992 <secondary>size limit</secondary>
25993 </indexterm>
25994 <indexterm role="concept">
25995 <primary>limit</primary>
25996 <secondary>message size</secondary>
25997 </indexterm>
25998 <indexterm role="concept">
25999 <primary>size</primary>
26000 <secondary>of message, limit</secondary>
26001 </indexterm>
26002 This option limits the maximum size of message that Exim will process. The
26003 value is expanded for each incoming connection so, for example, it can be made
26004 to depend on the IP address of the remote host for messages arriving via
26005 TCP/IP. After expansion, the value must be a sequence of decimal digits,
26006 optionally followed by K or M.
26007 </para>
26008 <para>
26009 <emphasis role="bold">Note</emphasis>: This limit cannot be made to depend on a message&#x2019;s sender or any
26010 other properties of an individual message, because it has to be advertised in
26011 the server&#x2019;s response to EHLO. String expansion failure causes a temporary
26012 error. A value of zero means no limit, but its use is not recommended. See also
26013 <option>bounce_return_size_limit</option>.
26014 </para>
26015 <para>
26016 Incoming SMTP messages are failed with a 552 error if the limit is
26017 exceeded; locally-generated messages either get a stderr message or a delivery
26018 failure message to the sender, depending on the <option>-oe</option> setting. Rejection of
26019 an oversized message is logged in both the main and the reject logs. See also
26020 the generic transport option <option>message_size_limit</option>, which limits the size of
26021 message that an individual transport can process.
26022 </para>
26023 <para>
26024 If you use a virus-scanner and set this option to to a value larger than the
26025 maximum size that your virus-scanner is configured to support, you may get
26026 failures triggered by large mails.  The right size to configure for the
26027 virus-scanner depends upon what data is passed and the options in use but it&#x2019;s
26028 probably safest to just set it to a little larger than this value.  Eg, with a
26029 default Exim message size of 50M and a default ClamAV StreamMaxLength of 10M,
26030 some problems may result.
26031 </para>
26032 <para>
26033 A value of 0 will disable size limit checking; Exim will still advertise the
26034 SIZE extension in an EHLO response, but without a limit, so as to permit
26035 SMTP clients to still indicate the message size along with the MAIL verb.
26036 </para>
26037 <para>
26038 <indexterm role="option">
26039 <primary><option>move_frozen_messages</option></primary>
26040 </indexterm>
26041 </para>
26042 <informaltable frame="all">
26043 <tgroup cols="4" colsep="0" rowsep="0">
26044 <colspec colwidth="8*" align="left"/>
26045 <colspec colwidth="6*" align="center"/>
26046 <colspec colwidth="6*" align="center"/>
26047 <colspec colwidth="6*" align="right"/>
26048 <tbody>
26049 <row>
26050 <entry><option>move_frozen_messages</option></entry>
26051 <entry>Use: <emphasis>main</emphasis></entry>
26052 <entry>Type: <emphasis>boolean</emphasis></entry>
26053 <entry>Default: <emphasis>false</emphasis></entry>
26054 </row>
26055 </tbody>
26056 </tgroup>
26057 </informaltable>
26058 <para>
26059 <indexterm role="concept">
26060 <primary>frozen messages</primary>
26061 <secondary>moving</secondary>
26062 </indexterm>
26063 This option, which is available only if Exim has been built with the setting
26064 </para>
26065 <literallayout class="monospaced">
26066 SUPPORT_MOVE_FROZEN_MESSAGES=yes
26067 </literallayout>
26068 <para>
26069 in <filename>Local/Makefile</filename>, causes frozen messages and their message logs to be
26070 moved from the <filename>input</filename> and <filename>msglog</filename> directories on the spool to <filename>Finput</filename>
26071 and <filename>Fmsglog</filename>, respectively. There is currently no support in Exim or the
26072 standard utilities for handling such moved messages, and they do not show up in
26073 lists generated by <option>-bp</option> or by the Exim monitor.
26074 </para>
26075 <para>
26076 <indexterm role="option">
26077 <primary><option>mua_wrapper</option></primary>
26078 </indexterm>
26079 </para>
26080 <informaltable frame="all">
26081 <tgroup cols="4" colsep="0" rowsep="0">
26082 <colspec colwidth="8*" align="left"/>
26083 <colspec colwidth="6*" align="center"/>
26084 <colspec colwidth="6*" align="center"/>
26085 <colspec colwidth="6*" align="right"/>
26086 <tbody>
26087 <row>
26088 <entry><option>mua_wrapper</option></entry>
26089 <entry>Use: <emphasis>main</emphasis></entry>
26090 <entry>Type: <emphasis>boolean</emphasis></entry>
26091 <entry>Default: <emphasis>false</emphasis></entry>
26092 </row>
26093 </tbody>
26094 </tgroup>
26095 </informaltable>
26096 <para>
26097 Setting this option true causes Exim to run in a very restrictive mode in which
26098 it passes messages synchronously to a smart host. Chapter <xref linkend="CHAPnonqueueing"/>
26099 contains a full description of this facility.
26100 </para>
26101 <para>
26102 <indexterm role="option">
26103 <primary><option>mysql_servers</option></primary>
26104 </indexterm>
26105 </para>
26106 <informaltable frame="all">
26107 <tgroup cols="4" colsep="0" rowsep="0">
26108 <colspec colwidth="8*" align="left"/>
26109 <colspec colwidth="6*" align="center"/>
26110 <colspec colwidth="6*" align="center"/>
26111 <colspec colwidth="6*" align="right"/>
26112 <tbody>
26113 <row>
26114 <entry><option>mysql_servers</option></entry>
26115 <entry>Use: <emphasis>main</emphasis></entry>
26116 <entry>Type: <emphasis>string list</emphasis></entry>
26117 <entry>Default: <emphasis>unset</emphasis></entry>
26118 </row>
26119 </tbody>
26120 </tgroup>
26121 </informaltable>
26122 <para>
26123 <indexterm role="concept">
26124 <primary>MySQL</primary>
26125 <secondary>server list</secondary>
26126 </indexterm>
26127 This option provides a list of MySQL servers and associated connection data, to
26128 be used in conjunction with <command>mysql</command> lookups (see section <xref linkend="SECID72"/>). The
26129 option is available only if Exim has been built with MySQL support.
26130 </para>
26131 <para>
26132 <indexterm role="option">
26133 <primary><option>never_users</option></primary>
26134 </indexterm>
26135 </para>
26136 <informaltable frame="all">
26137 <tgroup cols="4" colsep="0" rowsep="0">
26138 <colspec colwidth="8*" align="left"/>
26139 <colspec colwidth="6*" align="center"/>
26140 <colspec colwidth="6*" align="center"/>
26141 <colspec colwidth="6*" align="right"/>
26142 <tbody>
26143 <row>
26144 <entry><option>never_users</option></entry>
26145 <entry>Use: <emphasis>main</emphasis></entry>
26146 <entry>Type: <emphasis>string list</emphasis>&dagger;<emphasis></emphasis></entry>
26147 <entry>Default: <emphasis>unset</emphasis></entry>
26148 </row>
26149 </tbody>
26150 </tgroup>
26151 </informaltable>
26152 <para>
26153 This option is expanded just once, at the start of Exim&#x2019;s processing. Local
26154 message deliveries are normally run in processes that are setuid to the
26155 recipient, and remote deliveries are normally run under Exim&#x2019;s own uid and gid.
26156 It is usually desirable to prevent any deliveries from running as root, as a
26157 safety precaution.
26158 </para>
26159 <para>
26160 When Exim is built, an option called FIXED_NEVER_USERS can be set to a
26161 list of users that must not be used for local deliveries. This list is fixed in
26162 the binary and cannot be overridden by the configuration file. By default, it
26163 contains just the single user name <quote>root</quote>. The <option>never_users</option> runtime option
26164 can be used to add more users to the fixed list.
26165 </para>
26166 <para>
26167 If a message is to be delivered as one of the users on the fixed list or the
26168 <option>never_users</option> list, an error occurs, and delivery is deferred. A common
26169 example is
26170 </para>
26171 <literallayout class="monospaced">
26172 never_users = root:daemon:bin
26173 </literallayout>
26174 <para>
26175 Including root is redundant if it is also on the fixed list, but it does no
26176 harm. This option overrides the <option>pipe_as_creator</option> option of the <command>pipe</command>
26177 transport driver.
26178 </para>
26179 <para>
26180 <indexterm role="option">
26181 <primary><option>openssl_options</option></primary>
26182 </indexterm>
26183 </para>
26184 <informaltable frame="all">
26185 <tgroup cols="4" colsep="0" rowsep="0">
26186 <colspec colwidth="8*" align="left"/>
26187 <colspec colwidth="6*" align="center"/>
26188 <colspec colwidth="6*" align="center"/>
26189 <colspec colwidth="6*" align="right"/>
26190 <tbody>
26191 <row>
26192 <entry><option>openssl_options</option></entry>
26193 <entry>Use: <emphasis>main</emphasis></entry>
26194 <entry>Type: <emphasis>string list</emphasis></entry>
26195 <entry>Default: <emphasis>+no_sslv2</emphasis></entry>
26196 </row>
26197 </tbody>
26198 </tgroup>
26199 </informaltable>
26200 <para>
26201 <indexterm role="concept">
26202 <primary>OpenSSL </primary>
26203 <secondary>compatibility</secondary>
26204 </indexterm>
26205 This option allows an administrator to adjust the SSL options applied
26206 by OpenSSL to connections.  It is given as a space-separated list of items,
26207 each one to be +added or -subtracted from the current value.
26208 </para>
26209 <para>
26210 This option is only available if Exim is built against OpenSSL.  The values
26211 available for this option vary according to the age of your OpenSSL install.
26212 The <quote>all</quote> value controls a subset of flags which are available, typically
26213 the bug workaround options.  The <emphasis>SSL_CTX_set_options</emphasis> man page will
26214 list the values known on your system and Exim should support all the
26215 <quote>bug workaround</quote> options and many of the <quote>modifying</quote> options.  The Exim
26216 names lose the leading <quote>SSL_OP_</quote> and are lower-cased.
26217 </para>
26218 <para>
26219 Note that adjusting the options can have severe impact upon the security of
26220 SSL as used by Exim.  It is possible to disable safety checks and shoot
26221 yourself in the foot in various unpleasant ways.  This option should not be
26222 adjusted lightly.  An unrecognised item will be detected at startup, by
26223 invoking Exim with the <option>-bV</option> flag.
26224 </para>
26225 <para>
26226 Historical note: prior to release 4.80, Exim defaulted this value to
26227 "+dont_insert_empty_fragments", which may still be needed for compatibility
26228 with some clients, but which lowers security by increasing exposure to
26229 some now infamous attacks.
26230 </para>
26231 <para>
26232 An example:
26233 </para>
26234 <literallayout class="monospaced">
26235 # Make both old MS and old Eudora happy:
26236 openssl_options = -all +microsoft_big_sslv3_buffer \
26237                        +dont_insert_empty_fragments
26238 </literallayout>
26239 <para>
26240 Possible options may include:
26241 </para>
26242 <itemizedlist>
26243 <listitem>
26244 <para>
26245 <literal>all</literal>
26246 </para>
26247 </listitem>
26248 <listitem>
26249 <para>
26250 <literal>allow_unsafe_legacy_renegotiation</literal>
26251 </para>
26252 </listitem>
26253 <listitem>
26254 <para>
26255 <literal>cipher_server_preference</literal>
26256 </para>
26257 </listitem>
26258 <listitem>
26259 <para>
26260 <literal>dont_insert_empty_fragments</literal>
26261 </para>
26262 </listitem>
26263 <listitem>
26264 <para>
26265 <literal>ephemeral_rsa</literal>
26266 </para>
26267 </listitem>
26268 <listitem>
26269 <para>
26270 <literal>legacy_server_connect</literal>
26271 </para>
26272 </listitem>
26273 <listitem>
26274 <para>
26275 <literal>microsoft_big_sslv3_buffer</literal>
26276 </para>
26277 </listitem>
26278 <listitem>
26279 <para>
26280 <literal>microsoft_sess_id_bug</literal>
26281 </para>
26282 </listitem>
26283 <listitem>
26284 <para>
26285 <literal>msie_sslv2_rsa_padding</literal>
26286 </para>
26287 </listitem>
26288 <listitem>
26289 <para>
26290 <literal>netscape_challenge_bug</literal>
26291 </para>
26292 </listitem>
26293 <listitem>
26294 <para>
26295 <literal>netscape_reuse_cipher_change_bug</literal>
26296 </para>
26297 </listitem>
26298 <listitem>
26299 <para>
26300 <literal>no_compression</literal>
26301 </para>
26302 </listitem>
26303 <listitem>
26304 <para>
26305 <literal>no_session_resumption_on_renegotiation</literal>
26306 </para>
26307 </listitem>
26308 <listitem>
26309 <para>
26310 <literal>no_sslv2</literal>
26311 </para>
26312 </listitem>
26313 <listitem>
26314 <para>
26315 <literal>no_sslv3</literal>
26316 </para>
26317 </listitem>
26318 <listitem>
26319 <para>
26320 <literal>no_ticket</literal>
26321 </para>
26322 </listitem>
26323 <listitem>
26324 <para>
26325 <literal>no_tlsv1</literal>
26326 </para>
26327 </listitem>
26328 <listitem>
26329 <para>
26330 <literal>no_tlsv1_1</literal>
26331 </para>
26332 </listitem>
26333 <listitem>
26334 <para>
26335 <literal>no_tlsv1_2</literal>
26336 </para>
26337 </listitem>
26338 <listitem>
26339 <para>
26340 <literal>safari_ecdhe_ecdsa_bug</literal>
26341 </para>
26342 </listitem>
26343 <listitem>
26344 <para>
26345 <literal>single_dh_use</literal>
26346 </para>
26347 </listitem>
26348 <listitem>
26349 <para>
26350 <literal>single_ecdh_use</literal>
26351 </para>
26352 </listitem>
26353 <listitem>
26354 <para>
26355 <literal>ssleay_080_client_dh_bug</literal>
26356 </para>
26357 </listitem>
26358 <listitem>
26359 <para>
26360 <literal>sslref2_reuse_cert_type_bug</literal>
26361 </para>
26362 </listitem>
26363 <listitem>
26364 <para>
26365 <literal>tls_block_padding_bug</literal>
26366 </para>
26367 </listitem>
26368 <listitem>
26369 <para>
26370 <literal>tls_d5_bug</literal>
26371 </para>
26372 </listitem>
26373 <listitem>
26374 <para>
26375 <literal>tls_rollback_bug</literal>
26376 </para>
26377 </listitem>
26378 </itemizedlist>
26379 <para>
26380 As an aside, the <literal>safari_ecdhe_ecdsa_bug</literal> item is a misnomer and affects
26381 all clients connecting using the MacOS SecureTransport TLS facility prior
26382 to MacOS 10.8.4, including email clients.  If you see old MacOS clients failing
26383 to negotiate TLS then this option value might help, provided that your OpenSSL
26384 release is new enough to contain this work-around.  This may be a situation
26385 where you have to upgrade OpenSSL to get buggy clients working.
26386 </para>
26387 <para>
26388 <indexterm role="option">
26389 <primary><option>oracle_servers</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>oracle_servers</option></entry>
26401 <entry>Use: <emphasis>main</emphasis></entry>
26402 <entry>Type: <emphasis>string list</emphasis></entry>
26403 <entry>Default: <emphasis>unset</emphasis></entry>
26404 </row>
26405 </tbody>
26406 </tgroup>
26407 </informaltable>
26408 <para>
26409 <indexterm role="concept">
26410 <primary>Oracle</primary>
26411 <secondary>server list</secondary>
26412 </indexterm>
26413 This option provides a list of Oracle servers and associated connection data,
26414 to be used in conjunction with <command>oracle</command> lookups (see section <xref linkend="SECID72"/>).
26415 The option is available only if Exim has been built with Oracle support.
26416 </para>
26417 <para>
26418 <indexterm role="option">
26419 <primary><option>percent_hack_domains</option></primary>
26420 </indexterm>
26421 </para>
26422 <informaltable frame="all">
26423 <tgroup cols="4" colsep="0" rowsep="0">
26424 <colspec colwidth="8*" align="left"/>
26425 <colspec colwidth="6*" align="center"/>
26426 <colspec colwidth="6*" align="center"/>
26427 <colspec colwidth="6*" align="right"/>
26428 <tbody>
26429 <row>
26430 <entry><option>percent_hack_domains</option></entry>
26431 <entry>Use: <emphasis>main</emphasis></entry>
26432 <entry>Type: <emphasis>domain list</emphasis>&dagger;<emphasis></emphasis></entry>
26433 <entry>Default: <emphasis>unset</emphasis></entry>
26434 </row>
26435 </tbody>
26436 </tgroup>
26437 </informaltable>
26438 <para>
26439 <indexterm role="concept">
26440 <primary><quote>percent hack</quote></primary>
26441 </indexterm>
26442 <indexterm role="concept">
26443 <primary>source routing</primary>
26444 <secondary>in email address</secondary>
26445 </indexterm>
26446 <indexterm role="concept">
26447 <primary>address</primary>
26448 <secondary>source-routed</secondary>
26449 </indexterm>
26450 The <quote>percent hack</quote> is the convention whereby a local part containing a
26451 percent sign is re-interpreted as a new email address, with the percent
26452 replaced by @. This is sometimes called <quote>source routing</quote>, though that term is
26453 also applied to RFC 2822 addresses that begin with an @ character. If this
26454 option is set, Exim implements the percent facility for those domains listed,
26455 but no others. This happens before an incoming SMTP address is tested against
26456 an ACL.
26457 </para>
26458 <para>
26459 <emphasis role="bold">Warning</emphasis>: The <quote>percent hack</quote> has often been abused by people who are
26460 trying to get round relaying restrictions. For this reason, it is best avoided
26461 if at all possible. Unfortunately, a number of less security-conscious MTAs
26462 implement it unconditionally. If you are running Exim on a gateway host, and
26463 routing mail through to internal MTAs without processing the local parts, it is
26464 a good idea to reject recipient addresses with percent characters in their
26465 local parts. Exim&#x2019;s default configuration does this.
26466 </para>
26467 <para>
26468 <indexterm role="option">
26469 <primary><option>perl_at_start</option></primary>
26470 </indexterm>
26471 </para>
26472 <informaltable frame="all">
26473 <tgroup cols="4" colsep="0" rowsep="0">
26474 <colspec colwidth="8*" align="left"/>
26475 <colspec colwidth="6*" align="center"/>
26476 <colspec colwidth="6*" align="center"/>
26477 <colspec colwidth="6*" align="right"/>
26478 <tbody>
26479 <row>
26480 <entry><option>perl_at_start</option></entry>
26481 <entry>Use: <emphasis>main</emphasis></entry>
26482 <entry>Type: <emphasis>boolean</emphasis></entry>
26483 <entry>Default: <emphasis>false</emphasis></entry>
26484 </row>
26485 </tbody>
26486 </tgroup>
26487 </informaltable>
26488 <para>
26489 This option is available only when Exim is built with an embedded Perl
26490 interpreter. See chapter <xref linkend="CHAPperl"/> for details of its use.
26491 </para>
26492 <para>
26493 <indexterm role="option">
26494 <primary><option>perl_startup</option></primary>
26495 </indexterm>
26496 </para>
26497 <informaltable frame="all">
26498 <tgroup cols="4" colsep="0" rowsep="0">
26499 <colspec colwidth="8*" align="left"/>
26500 <colspec colwidth="6*" align="center"/>
26501 <colspec colwidth="6*" align="center"/>
26502 <colspec colwidth="6*" align="right"/>
26503 <tbody>
26504 <row>
26505 <entry><option>perl_startup</option></entry>
26506 <entry>Use: <emphasis>main</emphasis></entry>
26507 <entry>Type: <emphasis>string</emphasis></entry>
26508 <entry>Default: <emphasis>unset</emphasis></entry>
26509 </row>
26510 </tbody>
26511 </tgroup>
26512 </informaltable>
26513 <para>
26514 This option is available only when Exim is built with an embedded Perl
26515 interpreter. See chapter <xref linkend="CHAPperl"/> for details of its use.
26516 </para>
26517 <para>
26518 <indexterm role="option">
26519 <primary><option>pgsql_servers</option></primary>
26520 </indexterm>
26521 </para>
26522 <informaltable frame="all">
26523 <tgroup cols="4" colsep="0" rowsep="0">
26524 <colspec colwidth="8*" align="left"/>
26525 <colspec colwidth="6*" align="center"/>
26526 <colspec colwidth="6*" align="center"/>
26527 <colspec colwidth="6*" align="right"/>
26528 <tbody>
26529 <row>
26530 <entry><option>pgsql_servers</option></entry>
26531 <entry>Use: <emphasis>main</emphasis></entry>
26532 <entry>Type: <emphasis>string list</emphasis></entry>
26533 <entry>Default: <emphasis>unset</emphasis></entry>
26534 </row>
26535 </tbody>
26536 </tgroup>
26537 </informaltable>
26538 <para>
26539 <indexterm role="concept">
26540 <primary>PostgreSQL lookup type</primary>
26541 <secondary>server list</secondary>
26542 </indexterm>
26543 This option provides a list of PostgreSQL servers and associated connection
26544 data, to be used in conjunction with <command>pgsql</command> lookups (see section
26545 <xref linkend="SECID72"/>). The option is available only if Exim has been built with
26546 PostgreSQL support.
26547 </para>
26548 <para>
26549 <indexterm role="option">
26550 <primary><option>pid_file_path</option></primary>
26551 </indexterm>
26552 </para>
26553 <informaltable frame="all">
26554 <tgroup cols="4" colsep="0" rowsep="0">
26555 <colspec colwidth="8*" align="left"/>
26556 <colspec colwidth="6*" align="center"/>
26557 <colspec colwidth="6*" align="center"/>
26558 <colspec colwidth="6*" align="right"/>
26559 <tbody>
26560 <row>
26561 <entry><option>pid_file_path</option></entry>
26562 <entry>Use: <emphasis>main</emphasis></entry>
26563 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
26564 <entry>Default: <emphasis>set at compile time</emphasis></entry>
26565 </row>
26566 </tbody>
26567 </tgroup>
26568 </informaltable>
26569 <para>
26570 <indexterm role="concept">
26571 <primary>daemon</primary>
26572 <secondary>pid file path</secondary>
26573 </indexterm>
26574 <indexterm role="concept">
26575 <primary>pid file, path for</primary>
26576 </indexterm>
26577 This option sets the name of the file to which the Exim daemon writes its
26578 process id. The string is expanded, so it can contain, for example, references
26579 to the host name:
26580 </para>
26581 <literallayout class="monospaced">
26582 pid_file_path = /var/log/$primary_hostname/exim.pid
26583 </literallayout>
26584 <para>
26585 If no path is set, the pid is written to the file <filename>exim-daemon.pid</filename> in Exim&#x2019;s
26586 spool directory.
26587 The value set by the option can be overridden by the <option>-oP</option> command line
26588 option. A pid file is not written if a <quote>non-standard</quote> daemon is run by means
26589 of the <option>-oX</option> option, unless a path is explicitly supplied by <option>-oP</option>.
26590 </para>
26591 <para>
26592 <indexterm role="option">
26593 <primary><option>pipelining_advertise_hosts</option></primary>
26594 </indexterm>
26595 </para>
26596 <informaltable frame="all">
26597 <tgroup cols="4" colsep="0" rowsep="0">
26598 <colspec colwidth="8*" align="left"/>
26599 <colspec colwidth="6*" align="center"/>
26600 <colspec colwidth="6*" align="center"/>
26601 <colspec colwidth="6*" align="right"/>
26602 <tbody>
26603 <row>
26604 <entry><option>pipelining_advertise_hosts</option></entry>
26605 <entry>Use: <emphasis>main</emphasis></entry>
26606 <entry>Type: <emphasis>host list</emphasis>&dagger;<emphasis></emphasis></entry>
26607 <entry>Default: <emphasis>*</emphasis></entry>
26608 </row>
26609 </tbody>
26610 </tgroup>
26611 </informaltable>
26612 <para>
26613 <indexterm role="concept">
26614 <primary>PIPELINING</primary>
26615 <secondary>suppressing advertising</secondary>
26616 </indexterm>
26617 This option can be used to suppress the advertisement of the SMTP
26618 PIPELINING extension to specific hosts. See also the <emphasis role="bold">no_pipelining</emphasis>
26619 control in section <xref linkend="SECTcontrols"/>. When PIPELINING is not advertised and
26620 <option>smtp_enforce_sync</option> is true, an Exim server enforces strict synchronization
26621 for each SMTP command and response. When PIPELINING is advertised, Exim assumes
26622 that clients will use it; <quote>out of order</quote> commands that are <quote>expected</quote> do
26623 not count as protocol errors (see <option>smtp_max_synprot_errors</option>).
26624 </para>
26625 <para>
26626 <indexterm role="option">
26627 <primary><option>prdr_enable</option></primary>
26628 </indexterm>
26629 </para>
26630 <informaltable frame="all">
26631 <tgroup cols="4" colsep="0" rowsep="0">
26632 <colspec colwidth="8*" align="left"/>
26633 <colspec colwidth="6*" align="center"/>
26634 <colspec colwidth="6*" align="center"/>
26635 <colspec colwidth="6*" align="right"/>
26636 <tbody>
26637 <row>
26638 <entry><option>prdr_enable</option></entry>
26639 <entry>Use: <emphasis>main</emphasis></entry>
26640 <entry>Type: <emphasis>boolean</emphasis></entry>
26641 <entry>Default: <emphasis>false</emphasis></entry>
26642 </row>
26643 </tbody>
26644 </tgroup>
26645 </informaltable>
26646 <para>
26647 <indexterm role="concept">
26648 <primary>PRDR</primary>
26649 <secondary>enabling on server</secondary>
26650 </indexterm>
26651 This option can be used to enable the Per-Recipient Data Response extension
26652 to SMTP, defined by Eric Hall.
26653 If the option is set, PRDR is advertised by Exim when operating as a server.
26654 If the client requests PRDR, and more than one recipient, for a message 
26655 an additional ACL is called for each recipient after the message content
26656 is recieved.  See section <xref linkend="SECTPRDRACL"/>.
26657 </para>
26658 <para>
26659 <indexterm role="option">
26660 <primary><option>preserve_message_logs</option></primary>
26661 </indexterm>
26662 </para>
26663 <informaltable frame="all">
26664 <tgroup cols="4" colsep="0" rowsep="0">
26665 <colspec colwidth="8*" align="left"/>
26666 <colspec colwidth="6*" align="center"/>
26667 <colspec colwidth="6*" align="center"/>
26668 <colspec colwidth="6*" align="right"/>
26669 <tbody>
26670 <row>
26671 <entry><option>preserve_message_logs</option></entry>
26672 <entry>Use: <emphasis>main</emphasis></entry>
26673 <entry>Type: <emphasis>boolean</emphasis></entry>
26674 <entry>Default: <emphasis>false</emphasis></entry>
26675 </row>
26676 </tbody>
26677 </tgroup>
26678 </informaltable>
26679 <para>
26680 <indexterm role="concept">
26681 <primary>message logs</primary>
26682 <secondary>preserving</secondary>
26683 </indexterm>
26684 If this option is set, message log files are not deleted when messages are
26685 completed. Instead, they are moved to a sub-directory of the spool directory
26686 called <filename>msglog.OLD</filename>, where they remain available for statistical or debugging
26687 purposes. This is a dangerous option to set on systems with any appreciable
26688 volume of mail. Use with care!
26689 </para>
26690 <para>
26691 <indexterm role="option">
26692 <primary><option>primary_hostname</option></primary>
26693 </indexterm>
26694 </para>
26695 <informaltable frame="all">
26696 <tgroup cols="4" colsep="0" rowsep="0">
26697 <colspec colwidth="8*" align="left"/>
26698 <colspec colwidth="6*" align="center"/>
26699 <colspec colwidth="6*" align="center"/>
26700 <colspec colwidth="6*" align="right"/>
26701 <tbody>
26702 <row>
26703 <entry><option>primary_hostname</option></entry>
26704 <entry>Use: <emphasis>main</emphasis></entry>
26705 <entry>Type: <emphasis>string</emphasis></entry>
26706 <entry>Default: <emphasis>see below</emphasis></entry>
26707 </row>
26708 </tbody>
26709 </tgroup>
26710 </informaltable>
26711 <para>
26712 <indexterm role="concept">
26713 <primary>name</primary>
26714 <secondary>of local host</secondary>
26715 </indexterm>
26716 <indexterm role="concept">
26717 <primary>host</primary>
26718 <secondary>name of local</secondary>
26719 </indexterm>
26720 <indexterm role="concept">
26721 <primary>local host</primary>
26722 <secondary>name of</secondary>
26723 </indexterm>
26724 <indexterm role="variable">
26725 <primary><varname>$primary_hostname</varname></primary>
26726 </indexterm>
26727 This specifies the name of the current host. It is used in the default EHLO or
26728 HELO command for outgoing SMTP messages (changeable via the <option>helo_data</option>
26729 option in the <command>smtp</command> transport), and as the default for <option>qualify_domain</option>.
26730 The value is also used by default in some SMTP response messages from an Exim
26731 server. This can be changed dynamically by setting <option>smtp_active_hostname</option>.
26732 </para>
26733 <para>
26734 If <option>primary_hostname</option> is not set, Exim calls <function>uname()</function> to find the host
26735 name. If this fails, Exim panics and dies. If the name returned by <function>uname()</function>
26736 contains only one component, Exim passes it to <function>gethostbyname()</function> (or
26737 <function>getipnodebyname()</function> when available) in order to obtain the fully qualified
26738 version. The variable <varname>$primary_hostname</varname> contains the host name, whether set
26739 explicitly by this option, or defaulted.
26740 </para>
26741 <para>
26742 <indexterm role="option">
26743 <primary><option>print_topbitchars</option></primary>
26744 </indexterm>
26745 </para>
26746 <informaltable frame="all">
26747 <tgroup cols="4" colsep="0" rowsep="0">
26748 <colspec colwidth="8*" align="left"/>
26749 <colspec colwidth="6*" align="center"/>
26750 <colspec colwidth="6*" align="center"/>
26751 <colspec colwidth="6*" align="right"/>
26752 <tbody>
26753 <row>
26754 <entry><option>print_topbitchars</option></entry>
26755 <entry>Use: <emphasis>main</emphasis></entry>
26756 <entry>Type: <emphasis>boolean</emphasis></entry>
26757 <entry>Default: <emphasis>false</emphasis></entry>
26758 </row>
26759 </tbody>
26760 </tgroup>
26761 </informaltable>
26762 <para>
26763 <indexterm role="concept">
26764 <primary>printing characters</primary>
26765 </indexterm>
26766 <indexterm role="concept">
26767 <primary>8-bit characters</primary>
26768 </indexterm>
26769 By default, Exim considers only those characters whose codes lie in the range
26770 32&ndash;126 to be printing characters. In a number of circumstances (for example,
26771 when writing log entries) non-printing characters are converted into escape
26772 sequences, primarily to avoid messing up the layout. If <option>print_topbitchars</option>
26773 is set, code values of 128 and above are also considered to be printing
26774 characters.
26775 </para>
26776 <para>
26777 This option also affects the header syntax checks performed by the
26778 <command>autoreply</command> transport, and whether Exim uses RFC 2047 encoding of
26779 the user&#x2019;s full name when constructing From: and Sender: addresses (as
26780 described in section <xref linkend="SECTconstr"/>). Setting this option can cause
26781 Exim to generate eight bit message headers that do not conform to the
26782 standards.
26783 </para>
26784 <para>
26785 <indexterm role="option">
26786 <primary><option>process_log_path</option></primary>
26787 </indexterm>
26788 </para>
26789 <informaltable frame="all">
26790 <tgroup cols="4" colsep="0" rowsep="0">
26791 <colspec colwidth="8*" align="left"/>
26792 <colspec colwidth="6*" align="center"/>
26793 <colspec colwidth="6*" align="center"/>
26794 <colspec colwidth="6*" align="right"/>
26795 <tbody>
26796 <row>
26797 <entry><option>process_log_path</option></entry>
26798 <entry>Use: <emphasis>main</emphasis></entry>
26799 <entry>Type: <emphasis>string</emphasis></entry>
26800 <entry>Default: <emphasis>unset</emphasis></entry>
26801 </row>
26802 </tbody>
26803 </tgroup>
26804 </informaltable>
26805 <para>
26806 <indexterm role="concept">
26807 <primary>process log path</primary>
26808 </indexterm>
26809 <indexterm role="concept">
26810 <primary>log</primary>
26811 <secondary>process log</secondary>
26812 </indexterm>
26813 <indexterm role="concept">
26814 <primary><emphasis>exiwhat</emphasis></primary>
26815 </indexterm>
26816 This option sets the name of the file to which an Exim process writes its
26817 <quote>process log</quote> when sent a USR1 signal. This is used by the <emphasis>exiwhat</emphasis>
26818 utility script. If this option is unset, the file called <filename>exim-process.info</filename>
26819 in Exim&#x2019;s spool directory is used. The ability to specify the name explicitly
26820 can be useful in environments where two different Exims are running, using
26821 different spool directories.
26822 </para>
26823 <para>
26824 <indexterm role="option">
26825 <primary><option>prod_requires_admin</option></primary>
26826 </indexterm>
26827 </para>
26828 <informaltable frame="all">
26829 <tgroup cols="4" colsep="0" rowsep="0">
26830 <colspec colwidth="8*" align="left"/>
26831 <colspec colwidth="6*" align="center"/>
26832 <colspec colwidth="6*" align="center"/>
26833 <colspec colwidth="6*" align="right"/>
26834 <tbody>
26835 <row>
26836 <entry><option>prod_requires_admin</option></entry>
26837 <entry>Use: <emphasis>main</emphasis></entry>
26838 <entry>Type: <emphasis>boolean</emphasis></entry>
26839 <entry>Default: <emphasis>true</emphasis></entry>
26840 </row>
26841 </tbody>
26842 </tgroup>
26843 </informaltable>
26844 <para>
26845 <indexterm role="option">
26846 <primary><option>-M</option></primary>
26847 </indexterm>
26848 <indexterm role="option">
26849 <primary><option>-R</option></primary>
26850 </indexterm>
26851 <indexterm role="option">
26852 <primary><option>-q</option></primary>
26853 </indexterm>
26854 The <option>-M</option>, <option>-R</option>, and <option>-q</option> command-line options require the caller to be an
26855 admin user unless <option>prod_requires_admin</option> is set false. See also
26856 <option>queue_list_requires_admin</option>.
26857 </para>
26858 <para>
26859 <indexterm role="option">
26860 <primary><option>qualify_domain</option></primary>
26861 </indexterm>
26862 </para>
26863 <informaltable frame="all">
26864 <tgroup cols="4" colsep="0" rowsep="0">
26865 <colspec colwidth="8*" align="left"/>
26866 <colspec colwidth="6*" align="center"/>
26867 <colspec colwidth="6*" align="center"/>
26868 <colspec colwidth="6*" align="right"/>
26869 <tbody>
26870 <row>
26871 <entry><option>qualify_domain</option></entry>
26872 <entry>Use: <emphasis>main</emphasis></entry>
26873 <entry>Type: <emphasis>string</emphasis></entry>
26874 <entry>Default: <emphasis>see below</emphasis></entry>
26875 </row>
26876 </tbody>
26877 </tgroup>
26878 </informaltable>
26879 <para>
26880 <indexterm role="concept">
26881 <primary>domain</primary>
26882 <secondary>for qualifying addresses</secondary>
26883 </indexterm>
26884 <indexterm role="concept">
26885 <primary>address</primary>
26886 <secondary>qualification</secondary>
26887 </indexterm>
26888 This option specifies the domain name that is added to any envelope sender
26889 addresses that do not have a domain qualification. It also applies to
26890 recipient addresses if <option>qualify_recipient</option> is not set. Unqualified addresses
26891 are accepted by default only for locally-generated messages. Qualification is
26892 also applied to addresses in header lines such as <emphasis>From:</emphasis> and <emphasis>To:</emphasis> for
26893 locally-generated messages, unless the <option>-bnq</option> command line option is used.
26894 </para>
26895 <para>
26896 Messages from external sources must always contain fully qualified addresses,
26897 unless the sending host matches <option>sender_unqualified_hosts</option> or
26898 <option>recipient_unqualified_hosts</option> (as appropriate), in which case incoming
26899 addresses are qualified with <option>qualify_domain</option> or <option>qualify_recipient</option> as
26900 necessary. Internally, Exim always works with fully qualified envelope
26901 addresses. If <option>qualify_domain</option> is not set, it defaults to the
26902 <option>primary_hostname</option> value.
26903 </para>
26904 <para>
26905 <indexterm role="option">
26906 <primary><option>qualify_recipient</option></primary>
26907 </indexterm>
26908 </para>
26909 <informaltable frame="all">
26910 <tgroup cols="4" colsep="0" rowsep="0">
26911 <colspec colwidth="8*" align="left"/>
26912 <colspec colwidth="6*" align="center"/>
26913 <colspec colwidth="6*" align="center"/>
26914 <colspec colwidth="6*" align="right"/>
26915 <tbody>
26916 <row>
26917 <entry><option>qualify_recipient</option></entry>
26918 <entry>Use: <emphasis>main</emphasis></entry>
26919 <entry>Type: <emphasis>string</emphasis></entry>
26920 <entry>Default: <emphasis>see below</emphasis></entry>
26921 </row>
26922 </tbody>
26923 </tgroup>
26924 </informaltable>
26925 <para>
26926 This option allows you to specify a different domain for qualifying recipient
26927 addresses to the one that is used for senders. See <option>qualify_domain</option> above.
26928 </para>
26929 <para>
26930 <indexterm role="option">
26931 <primary><option>queue_domains</option></primary>
26932 </indexterm>
26933 </para>
26934 <informaltable frame="all">
26935 <tgroup cols="4" colsep="0" rowsep="0">
26936 <colspec colwidth="8*" align="left"/>
26937 <colspec colwidth="6*" align="center"/>
26938 <colspec colwidth="6*" align="center"/>
26939 <colspec colwidth="6*" align="right"/>
26940 <tbody>
26941 <row>
26942 <entry><option>queue_domains</option></entry>
26943 <entry>Use: <emphasis>main</emphasis></entry>
26944 <entry>Type: <emphasis>domain list</emphasis>&dagger;<emphasis></emphasis></entry>
26945 <entry>Default: <emphasis>unset</emphasis></entry>
26946 </row>
26947 </tbody>
26948 </tgroup>
26949 </informaltable>
26950 <para>
26951 <indexterm role="concept">
26952 <primary>domain</primary>
26953 <secondary>specifying non-immediate delivery</secondary>
26954 </indexterm>
26955 <indexterm role="concept">
26956 <primary>queueing incoming messages</primary>
26957 </indexterm>
26958 <indexterm role="concept">
26959 <primary>message</primary>
26960 <secondary>queueing certain domains</secondary>
26961 </indexterm>
26962 This option lists domains for which immediate delivery is not required.
26963 A delivery process is started whenever a message is received, but only those
26964 domains that do not match are processed. All other deliveries wait until the
26965 next queue run. See also <option>hold_domains</option> and <option>queue_smtp_domains</option>.
26966 </para>
26967 <para>
26968 <indexterm role="option">
26969 <primary><option>queue_list_requires_admin</option></primary>
26970 </indexterm>
26971 </para>
26972 <informaltable frame="all">
26973 <tgroup cols="4" colsep="0" rowsep="0">
26974 <colspec colwidth="8*" align="left"/>
26975 <colspec colwidth="6*" align="center"/>
26976 <colspec colwidth="6*" align="center"/>
26977 <colspec colwidth="6*" align="right"/>
26978 <tbody>
26979 <row>
26980 <entry><option>queue_list_requires_admin</option></entry>
26981 <entry>Use: <emphasis>main</emphasis></entry>
26982 <entry>Type: <emphasis>boolean</emphasis></entry>
26983 <entry>Default: <emphasis>true</emphasis></entry>
26984 </row>
26985 </tbody>
26986 </tgroup>
26987 </informaltable>
26988 <para>
26989 <indexterm role="option">
26990 <primary><option>-bp</option></primary>
26991 </indexterm>
26992 The <option>-bp</option> command-line option, which lists the messages that are on the
26993 queue, requires the caller to be an admin user unless
26994 <option>queue_list_requires_admin</option> is set false. See also <option>prod_requires_admin</option>.
26995 </para>
26996 <para>
26997 <indexterm role="option">
26998 <primary><option>queue_only</option></primary>
26999 </indexterm>
27000 </para>
27001 <informaltable frame="all">
27002 <tgroup cols="4" colsep="0" rowsep="0">
27003 <colspec colwidth="8*" align="left"/>
27004 <colspec colwidth="6*" align="center"/>
27005 <colspec colwidth="6*" align="center"/>
27006 <colspec colwidth="6*" align="right"/>
27007 <tbody>
27008 <row>
27009 <entry><option>queue_only</option></entry>
27010 <entry>Use: <emphasis>main</emphasis></entry>
27011 <entry>Type: <emphasis>boolean</emphasis></entry>
27012 <entry>Default: <emphasis>false</emphasis></entry>
27013 </row>
27014 </tbody>
27015 </tgroup>
27016 </informaltable>
27017 <para>
27018 <indexterm role="concept">
27019 <primary>queueing incoming messages</primary>
27020 </indexterm>
27021 <indexterm role="concept">
27022 <primary>message</primary>
27023 <secondary>queueing unconditionally</secondary>
27024 </indexterm>
27025 If <option>queue_only</option> is set, a delivery process is not automatically started
27026 whenever a message is received. Instead, the message waits on the queue for the
27027 next queue run. Even if <option>queue_only</option> is false, incoming messages may not get
27028 delivered immediately when certain conditions (such as heavy load) occur.
27029 </para>
27030 <para>
27031 The <option>-odq</option> command line has the same effect as <option>queue_only</option>. The <option>-odb</option>
27032 and <option>-odi</option> command line options override <option>queue_only</option> unless
27033 <option>queue_only_override</option> is set false. See also <option>queue_only_file</option>,
27034 <option>queue_only_load</option>, and <option>smtp_accept_queue</option>.
27035 </para>
27036 <para>
27037 <indexterm role="option">
27038 <primary><option>queue_only_file</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>queue_only_file</option></entry>
27050 <entry>Use: <emphasis>main</emphasis></entry>
27051 <entry>Type: <emphasis>string</emphasis></entry>
27052 <entry>Default: <emphasis>unset</emphasis></entry>
27053 </row>
27054 </tbody>
27055 </tgroup>
27056 </informaltable>
27057 <para>
27058 <indexterm role="concept">
27059 <primary>queueing incoming messages</primary>
27060 </indexterm>
27061 <indexterm role="concept">
27062 <primary>message</primary>
27063 <secondary>queueing by file existence</secondary>
27064 </indexterm>
27065 This option can be set to a colon-separated list of absolute path names, each
27066 one optionally preceded by <quote>smtp</quote>. When Exim is receiving a message,
27067 it tests for the existence of each listed path using a call to <function>stat()</function>. For
27068 each path that exists, the corresponding queueing option is set.
27069 For paths with no prefix, <option>queue_only</option> is set; for paths prefixed by
27070 <quote>smtp</quote>, <option>queue_smtp_domains</option> is set to match all domains. So, for example,
27071 </para>
27072 <literallayout class="monospaced">
27073 queue_only_file = smtp/some/file
27074 </literallayout>
27075 <para>
27076 causes Exim to behave as if <option>queue_smtp_domains</option> were set to <quote>*</quote> whenever
27077 <filename>/some/file</filename> exists.
27078 </para>
27079 <para>
27080 <indexterm role="option">
27081 <primary><option>queue_only_load</option></primary>
27082 </indexterm>
27083 </para>
27084 <informaltable frame="all">
27085 <tgroup cols="4" colsep="0" rowsep="0">
27086 <colspec colwidth="8*" align="left"/>
27087 <colspec colwidth="6*" align="center"/>
27088 <colspec colwidth="6*" align="center"/>
27089 <colspec colwidth="6*" align="right"/>
27090 <tbody>
27091 <row>
27092 <entry><option>queue_only_load</option></entry>
27093 <entry>Use: <emphasis>main</emphasis></entry>
27094 <entry>Type: <emphasis>fixed-point</emphasis></entry>
27095 <entry>Default: <emphasis>unset</emphasis></entry>
27096 </row>
27097 </tbody>
27098 </tgroup>
27099 </informaltable>
27100 <para>
27101 <indexterm role="concept">
27102 <primary>load average</primary>
27103 </indexterm>
27104 <indexterm role="concept">
27105 <primary>queueing incoming messages</primary>
27106 </indexterm>
27107 <indexterm role="concept">
27108 <primary>message</primary>
27109 <secondary>queueing by load</secondary>
27110 </indexterm>
27111 If the system load average is higher than this value, incoming messages from
27112 all sources are queued, and no automatic deliveries are started. If this
27113 happens during local or remote SMTP input, all subsequent messages received on
27114 the same SMTP connection are queued by default, whatever happens to the load in
27115 the meantime, but this can be changed by setting <option>queue_only_load_latch</option>
27116 false.
27117 </para>
27118 <para>
27119 Deliveries will subsequently be performed by queue runner processes. This
27120 option has no effect on ancient operating systems on which Exim cannot
27121 determine the load average. See also <option>deliver_queue_load_max</option> and
27122 <option>smtp_load_reserve</option>.
27123 </para>
27124 <para>
27125 <indexterm role="option">
27126 <primary><option>queue_only_load_latch</option></primary>
27127 </indexterm>
27128 </para>
27129 <informaltable frame="all">
27130 <tgroup cols="4" colsep="0" rowsep="0">
27131 <colspec colwidth="8*" align="left"/>
27132 <colspec colwidth="6*" align="center"/>
27133 <colspec colwidth="6*" align="center"/>
27134 <colspec colwidth="6*" align="right"/>
27135 <tbody>
27136 <row>
27137 <entry><option>queue_only_load_latch</option></entry>
27138 <entry>Use: <emphasis>main</emphasis></entry>
27139 <entry>Type: <emphasis>boolean</emphasis></entry>
27140 <entry>Default: <emphasis>true</emphasis></entry>
27141 </row>
27142 </tbody>
27143 </tgroup>
27144 </informaltable>
27145 <para>
27146 <indexterm role="concept">
27147 <primary>load average</primary>
27148 <secondary>re-evaluating per message</secondary>
27149 </indexterm>
27150 When this option is true (the default), once one message has been queued
27151 because the load average is higher than the value set by <option>queue_only_load</option>,
27152 all subsequent messages received on the same SMTP connection are also queued.
27153 This is a deliberate choice; even though the load average may fall below the
27154 threshold, it doesn&#x2019;t seem right to deliver later messages on the same
27155 connection when not delivering earlier ones. However, there are special
27156 circumstances such as very long-lived connections from scanning appliances
27157 where this is not the best strategy. In such cases, <option>queue_only_load_latch</option>
27158 should be set false. This causes the value of the load average to be
27159 re-evaluated for each message.
27160 </para>
27161 <para>
27162 <indexterm role="option">
27163 <primary><option>queue_only_override</option></primary>
27164 </indexterm>
27165 </para>
27166 <informaltable frame="all">
27167 <tgroup cols="4" colsep="0" rowsep="0">
27168 <colspec colwidth="8*" align="left"/>
27169 <colspec colwidth="6*" align="center"/>
27170 <colspec colwidth="6*" align="center"/>
27171 <colspec colwidth="6*" align="right"/>
27172 <tbody>
27173 <row>
27174 <entry><option>queue_only_override</option></entry>
27175 <entry>Use: <emphasis>main</emphasis></entry>
27176 <entry>Type: <emphasis>boolean</emphasis></entry>
27177 <entry>Default: <emphasis>true</emphasis></entry>
27178 </row>
27179 </tbody>
27180 </tgroup>
27181 </informaltable>
27182 <para>
27183 <indexterm role="concept">
27184 <primary>queueing incoming messages</primary>
27185 </indexterm>
27186 When this option is true, the <option>-od</option><emphasis>x</emphasis> command line options override the
27187 setting of <option>queue_only</option> or <option>queue_only_file</option> in the configuration file. If
27188 <option>queue_only_override</option> is set false, the <option>-od</option><emphasis>x</emphasis> options cannot be used
27189 to override; they are accepted, but ignored.
27190 </para>
27191 <para>
27192 <indexterm role="option">
27193 <primary><option>queue_run_in_order</option></primary>
27194 </indexterm>
27195 </para>
27196 <informaltable frame="all">
27197 <tgroup cols="4" colsep="0" rowsep="0">
27198 <colspec colwidth="8*" align="left"/>
27199 <colspec colwidth="6*" align="center"/>
27200 <colspec colwidth="6*" align="center"/>
27201 <colspec colwidth="6*" align="right"/>
27202 <tbody>
27203 <row>
27204 <entry><option>queue_run_in_order</option></entry>
27205 <entry>Use: <emphasis>main</emphasis></entry>
27206 <entry>Type: <emphasis>boolean</emphasis></entry>
27207 <entry>Default: <emphasis>false</emphasis></entry>
27208 </row>
27209 </tbody>
27210 </tgroup>
27211 </informaltable>
27212 <para>
27213 <indexterm role="concept">
27214 <primary>queue runner</primary>
27215 <secondary>processing messages in order</secondary>
27216 </indexterm>
27217 If this option is set, queue runs happen in order of message arrival instead of
27218 in an arbitrary order. For this to happen, a complete list of the entire queue
27219 must be set up before the deliveries start. When the queue is all held in a
27220 single directory (the default), a single list is created for both the ordered
27221 and the non-ordered cases. However, if <option>split_spool_directory</option> is set, a
27222 single list is not created when <option>queue_run_in_order</option> is false. In this case,
27223 the sub-directories are processed one at a time (in a random order), and this
27224 avoids setting up one huge list for the whole queue. Thus, setting
27225 <option>queue_run_in_order</option> with <option>split_spool_directory</option> may degrade performance
27226 when the queue is large, because of the extra work in setting up the single,
27227 large list. In most situations, <option>queue_run_in_order</option> should not be set.
27228 </para>
27229 <para>
27230 <indexterm role="option">
27231 <primary><option>queue_run_max</option></primary>
27232 </indexterm>
27233 </para>
27234 <informaltable frame="all">
27235 <tgroup cols="4" colsep="0" rowsep="0">
27236 <colspec colwidth="8*" align="left"/>
27237 <colspec colwidth="6*" align="center"/>
27238 <colspec colwidth="6*" align="center"/>
27239 <colspec colwidth="6*" align="right"/>
27240 <tbody>
27241 <row>
27242 <entry><option>queue_run_max</option></entry>
27243 <entry>Use: <emphasis>main</emphasis></entry>
27244 <entry>Type: <emphasis>integer</emphasis></entry>
27245 <entry>Default: <emphasis>5</emphasis></entry>
27246 </row>
27247 </tbody>
27248 </tgroup>
27249 </informaltable>
27250 <para>
27251 <indexterm role="concept">
27252 <primary>queue runner</primary>
27253 <secondary>maximum number of</secondary>
27254 </indexterm>
27255 This controls the maximum number of queue runner processes that an Exim daemon
27256 can run simultaneously. This does not mean that it starts them all at once,
27257 but rather that if the maximum number are still running when the time comes to
27258 start another one, it refrains from starting another one. This can happen with
27259 very large queues and/or very sluggish deliveries. This option does not,
27260 however, interlock with other processes, so additional queue runners can be
27261 started by other means, or by killing and restarting the daemon.
27262 </para>
27263 <para>
27264 Setting this option to zero does not suppress queue runs; rather, it disables
27265 the limit, allowing any number of simultaneous queue runner processes to be
27266 run. If you do not want queue runs to occur, omit the <option>-q</option><emphasis>xx</emphasis> setting on
27267 the daemon&#x2019;s command line.
27268 </para>
27269 <para>
27270 <indexterm role="option">
27271 <primary><option>queue_smtp_domains</option></primary>
27272 </indexterm>
27273 </para>
27274 <informaltable frame="all">
27275 <tgroup cols="4" colsep="0" rowsep="0">
27276 <colspec colwidth="8*" align="left"/>
27277 <colspec colwidth="6*" align="center"/>
27278 <colspec colwidth="6*" align="center"/>
27279 <colspec colwidth="6*" align="right"/>
27280 <tbody>
27281 <row>
27282 <entry><option>queue_smtp_domains</option></entry>
27283 <entry>Use: <emphasis>main</emphasis></entry>
27284 <entry>Type: <emphasis>domain list</emphasis>&dagger;<emphasis></emphasis></entry>
27285 <entry>Default: <emphasis>unset</emphasis></entry>
27286 </row>
27287 </tbody>
27288 </tgroup>
27289 </informaltable>
27290 <para>
27291 <indexterm role="concept">
27292 <primary>queueing incoming messages</primary>
27293 </indexterm>
27294 <indexterm role="concept">
27295 <primary>message</primary>
27296 <secondary>queueing remote deliveries</secondary>
27297 </indexterm>
27298 When this option is set, a delivery process is started whenever a message is
27299 received, routing is performed, and local deliveries take place.
27300 However, if any SMTP deliveries are required for domains that match
27301 <option>queue_smtp_domains</option>, they are not immediately delivered, but instead the
27302 message waits on the queue for the next queue run. Since routing of the message
27303 has taken place, Exim knows to which remote hosts it must be delivered, and so
27304 when the queue run happens, multiple messages for the same host are delivered
27305 over a single SMTP connection. The <option>-odqs</option> command line option causes all
27306 SMTP deliveries to be queued in this way, and is equivalent to setting
27307 <option>queue_smtp_domains</option> to <quote>*</quote>. See also <option>hold_domains</option> and
27308 <option>queue_domains</option>.
27309 </para>
27310 <para>
27311 <indexterm role="option">
27312 <primary><option>receive_timeout</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>receive_timeout</option></entry>
27324 <entry>Use: <emphasis>main</emphasis></entry>
27325 <entry>Type: <emphasis>time</emphasis></entry>
27326 <entry>Default: <emphasis>0s</emphasis></entry>
27327 </row>
27328 </tbody>
27329 </tgroup>
27330 </informaltable>
27331 <para>
27332 <indexterm role="concept">
27333 <primary>timeout</primary>
27334 <secondary>for non-SMTP input</secondary>
27335 </indexterm>
27336 This option sets the timeout for accepting a non-SMTP message, that is, the
27337 maximum time that Exim waits when reading a message on the standard input. If
27338 the value is zero, it will wait for ever. This setting is overridden by the
27339 <option>-or</option> command line option. The timeout for incoming SMTP messages is
27340 controlled by <option>smtp_receive_timeout</option>.
27341 </para>
27342 <para>
27343 <indexterm role="option">
27344 <primary><option>received_header_text</option></primary>
27345 </indexterm>
27346 </para>
27347 <informaltable frame="all">
27348 <tgroup cols="4" colsep="0" rowsep="0">
27349 <colspec colwidth="8*" align="left"/>
27350 <colspec colwidth="6*" align="center"/>
27351 <colspec colwidth="6*" align="center"/>
27352 <colspec colwidth="6*" align="right"/>
27353 <tbody>
27354 <row>
27355 <entry><option>received_header_text</option></entry>
27356 <entry>Use: <emphasis>main</emphasis></entry>
27357 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
27358 <entry>Default: <emphasis>see below</emphasis></entry>
27359 </row>
27360 </tbody>
27361 </tgroup>
27362 </informaltable>
27363 <para>
27364 <indexterm role="concept">
27365 <primary>customizing</primary>
27366 <secondary><emphasis>Received:</emphasis> header</secondary>
27367 </indexterm>
27368 <indexterm role="concept">
27369 <primary><emphasis>Received:</emphasis> header line</primary>
27370 <secondary>customizing</secondary>
27371 </indexterm>
27372 This string defines the contents of the <emphasis>Received:</emphasis> message header that is
27373 added to each message, except for the timestamp, which is automatically added
27374 on at the end (preceded by a semicolon). The string is expanded each time it is
27375 used. If the expansion yields an empty string, no <emphasis>Received:</emphasis> header line is
27376 added to the message. Otherwise, the string should start with the text
27377 <quote>Received:</quote> and conform to the RFC 2822 specification for <emphasis>Received:</emphasis>
27378 header lines. The default setting is:
27379 </para>
27380 <literallayout class="monospaced">
27381 received_header_text = Received: \
27382   ${if def:sender_rcvhost {from $sender_rcvhost\n\t}\
27383   {${if def:sender_ident \
27384   {from ${quote_local_part:$sender_ident} }}\
27385   ${if def:sender_helo_name {(helo=$sender_helo_name)\n\t}}}}\
27386   by $primary_hostname \
27387   ${if def:received_protocol {with $received_protocol}} \
27388   ${if def:tls_in_cipher {($tls_in_cipher)\n\t}}\
27389   (Exim $version_number)\n\t\
27390   ${if def:sender_address \
27391   {(envelope-from &lt;$sender_address&gt;)\n\t}}\
27392   id $message_exim_id\
27393   ${if def:received_for {\n\tfor $received_for}}
27394 </literallayout>
27395 <para>
27396 The reference to the TLS cipher is omitted when Exim is built without TLS
27397 support. The use of conditional expansions ensures that this works for both
27398 locally generated messages and messages received from remote hosts, giving
27399 header lines such as the following:
27400 </para>
27401 <literallayout class="monospaced">
27402 Received: from scrooge.carol.example ([192.168.12.25] ident=root)
27403 by marley.carol.example with esmtp (Exim 4.00)
27404 (envelope-from &lt;bob@carol.example&gt;)
27405 id 16IOWa-00019l-00
27406 for chas@dickens.example; Tue, 25 Dec 2001 14:43:44 +0000
27407 Received: by scrooge.carol.example with local (Exim 4.00)
27408 id 16IOWW-000083-00; Tue, 25 Dec 2001 14:43:41 +0000
27409 </literallayout>
27410 <para>
27411 Until the body of the message has been received, the timestamp is the time when
27412 the message started to be received. Once the body has arrived, and all policy
27413 checks have taken place, the timestamp is updated to the time at which the
27414 message was accepted.
27415 </para>
27416 <para>
27417 <indexterm role="option">
27418 <primary><option>received_headers_max</option></primary>
27419 </indexterm>
27420 </para>
27421 <informaltable frame="all">
27422 <tgroup cols="4" colsep="0" rowsep="0">
27423 <colspec colwidth="8*" align="left"/>
27424 <colspec colwidth="6*" align="center"/>
27425 <colspec colwidth="6*" align="center"/>
27426 <colspec colwidth="6*" align="right"/>
27427 <tbody>
27428 <row>
27429 <entry><option>received_headers_max</option></entry>
27430 <entry>Use: <emphasis>main</emphasis></entry>
27431 <entry>Type: <emphasis>integer</emphasis></entry>
27432 <entry>Default: <emphasis>30</emphasis></entry>
27433 </row>
27434 </tbody>
27435 </tgroup>
27436 </informaltable>
27437 <para>
27438 <indexterm role="concept">
27439 <primary>loop</primary>
27440 <secondary>prevention</secondary>
27441 </indexterm>
27442 <indexterm role="concept">
27443 <primary>mail loop prevention</primary>
27444 </indexterm>
27445 <indexterm role="concept">
27446 <primary><emphasis>Received:</emphasis> header line</primary>
27447 <secondary>counting</secondary>
27448 </indexterm>
27449 When a message is to be delivered, the number of <emphasis>Received:</emphasis> headers is
27450 counted, and if it is greater than this parameter, a mail loop is assumed to
27451 have occurred, the delivery is abandoned, and an error message is generated.
27452 This applies to both local and remote deliveries.
27453 </para>
27454 <para>
27455 <indexterm role="option">
27456 <primary><option>recipient_unqualified_hosts</option></primary>
27457 </indexterm>
27458 </para>
27459 <informaltable frame="all">
27460 <tgroup cols="4" colsep="0" rowsep="0">
27461 <colspec colwidth="8*" align="left"/>
27462 <colspec colwidth="6*" align="center"/>
27463 <colspec colwidth="6*" align="center"/>
27464 <colspec colwidth="6*" align="right"/>
27465 <tbody>
27466 <row>
27467 <entry><option>recipient_unqualified_hosts</option></entry>
27468 <entry>Use: <emphasis>main</emphasis></entry>
27469 <entry>Type: <emphasis>host list</emphasis>&dagger;<emphasis></emphasis></entry>
27470 <entry>Default: <emphasis>unset</emphasis></entry>
27471 </row>
27472 </tbody>
27473 </tgroup>
27474 </informaltable>
27475 <para>
27476 <indexterm role="concept">
27477 <primary>unqualified addresses</primary>
27478 </indexterm>
27479 <indexterm role="concept">
27480 <primary>host</primary>
27481 <secondary>unqualified addresses from</secondary>
27482 </indexterm>
27483 This option lists those hosts from which Exim is prepared to accept unqualified
27484 recipient addresses in message envelopes. The addresses are made fully
27485 qualified by the addition of the <option>qualify_recipient</option> value. This option also
27486 affects message header lines. Exim does not reject unqualified recipient
27487 addresses in headers, but it qualifies them only if the message came from a
27488 host that matches <option>recipient_unqualified_hosts</option>,
27489 or if the message was submitted locally (not using TCP/IP), and the <option>-bnq</option>
27490 option was not set.
27491 </para>
27492 <para>
27493 <indexterm role="option">
27494 <primary><option>recipients_max</option></primary>
27495 </indexterm>
27496 </para>
27497 <informaltable frame="all">
27498 <tgroup cols="4" colsep="0" rowsep="0">
27499 <colspec colwidth="8*" align="left"/>
27500 <colspec colwidth="6*" align="center"/>
27501 <colspec colwidth="6*" align="center"/>
27502 <colspec colwidth="6*" align="right"/>
27503 <tbody>
27504 <row>
27505 <entry><option>recipients_max</option></entry>
27506 <entry>Use: <emphasis>main</emphasis></entry>
27507 <entry>Type: <emphasis>integer</emphasis></entry>
27508 <entry>Default: <emphasis>0</emphasis></entry>
27509 </row>
27510 </tbody>
27511 </tgroup>
27512 </informaltable>
27513 <para>
27514 <indexterm role="concept">
27515 <primary>limit</primary>
27516 <secondary>number of recipients</secondary>
27517 </indexterm>
27518 <indexterm role="concept">
27519 <primary>recipient</primary>
27520 <secondary>maximum number</secondary>
27521 </indexterm>
27522 If this option is set greater than zero, it specifies the maximum number of
27523 original recipients for any message. Additional recipients that are generated
27524 by aliasing or forwarding do not count. SMTP messages get a 452 response for
27525 all recipients over the limit; earlier recipients are delivered as normal.
27526 Non-SMTP messages with too many recipients are failed, and no deliveries are
27527 done.
27528 </para>
27529 <para>
27530 <indexterm role="concept">
27531 <primary>RCPT</primary>
27532 <secondary>maximum number of incoming</secondary>
27533 </indexterm>
27534 <emphasis role="bold">Note</emphasis>: The RFCs specify that an SMTP server should accept at least 100
27535 RCPT commands in a single message.
27536 </para>
27537 <para>
27538 <indexterm role="option">
27539 <primary><option>recipients_max_reject</option></primary>
27540 </indexterm>
27541 </para>
27542 <informaltable frame="all">
27543 <tgroup cols="4" colsep="0" rowsep="0">
27544 <colspec colwidth="8*" align="left"/>
27545 <colspec colwidth="6*" align="center"/>
27546 <colspec colwidth="6*" align="center"/>
27547 <colspec colwidth="6*" align="right"/>
27548 <tbody>
27549 <row>
27550 <entry><option>recipients_max_reject</option></entry>
27551 <entry>Use: <emphasis>main</emphasis></entry>
27552 <entry>Type: <emphasis>boolean</emphasis></entry>
27553 <entry>Default: <emphasis>false</emphasis></entry>
27554 </row>
27555 </tbody>
27556 </tgroup>
27557 </informaltable>
27558 <para>
27559 If this option is set true, Exim rejects SMTP messages containing too many
27560 recipients by giving 552 errors to the surplus RCPT commands, and a 554
27561 error to the eventual DATA command. Otherwise (the default) it gives a 452
27562 error to the surplus RCPT commands and accepts the message on behalf of the
27563 initial set of recipients. The remote server should then re-send the message
27564 for the remaining recipients at a later time.
27565 </para>
27566 <para>
27567 <indexterm role="option">
27568 <primary><option>remote_max_parallel</option></primary>
27569 </indexterm>
27570 </para>
27571 <informaltable frame="all">
27572 <tgroup cols="4" colsep="0" rowsep="0">
27573 <colspec colwidth="8*" align="left"/>
27574 <colspec colwidth="6*" align="center"/>
27575 <colspec colwidth="6*" align="center"/>
27576 <colspec colwidth="6*" align="right"/>
27577 <tbody>
27578 <row>
27579 <entry><option>remote_max_parallel</option></entry>
27580 <entry>Use: <emphasis>main</emphasis></entry>
27581 <entry>Type: <emphasis>integer</emphasis></entry>
27582 <entry>Default: <emphasis>2</emphasis></entry>
27583 </row>
27584 </tbody>
27585 </tgroup>
27586 </informaltable>
27587 <para>
27588 <indexterm role="concept">
27589 <primary>delivery</primary>
27590 <secondary>parallelism for remote</secondary>
27591 </indexterm>
27592 This option controls parallel delivery of one message to a number of remote
27593 hosts. If the value is less than 2, parallel delivery is disabled, and Exim
27594 does all the remote deliveries for a message one by one. Otherwise, if a single
27595 message has to be delivered to more than one remote host, or if several copies
27596 have to be sent to the same remote host, up to <option>remote_max_parallel</option>
27597 deliveries are done simultaneously. If more than <option>remote_max_parallel</option>
27598 deliveries are required, the maximum number of processes are started, and as
27599 each one finishes, another is begun. The order of starting processes is the
27600 same as if sequential delivery were being done, and can be controlled by the
27601 <option>remote_sort_domains</option> option. If parallel delivery takes place while running
27602 with debugging turned on, the debugging output from each delivery process is
27603 tagged with its process id.
27604 </para>
27605 <para>
27606 This option controls only the maximum number of parallel deliveries for one
27607 message in one Exim delivery process. Because Exim has no central queue
27608 manager, there is no way of controlling the total number of simultaneous
27609 deliveries if the configuration allows a delivery attempt as soon as a message
27610 is received.
27611 </para>
27612 <para>
27613 <indexterm role="concept">
27614 <primary>number of deliveries</primary>
27615 </indexterm>
27616 <indexterm role="concept">
27617 <primary>delivery</primary>
27618 <secondary>maximum number of</secondary>
27619 </indexterm>
27620 If you want to control the total number of deliveries on the system, you
27621 need to set the <option>queue_only</option> option. This ensures that all incoming messages
27622 are added to the queue without starting a delivery process. Then set up an Exim
27623 daemon to start queue runner processes at appropriate intervals (probably
27624 fairly often, for example, every minute), and limit the total number of queue
27625 runners by setting the <option>queue_run_max</option> parameter. Because each queue runner
27626 delivers only one message at a time, the maximum number of deliveries that can
27627 then take place at once is <option>queue_run_max</option> multiplied by
27628 <option>remote_max_parallel</option>.
27629 </para>
27630 <para>
27631 If it is purely remote deliveries you want to control, use
27632 <option>queue_smtp_domains</option> instead of <option>queue_only</option>. This has the added benefit of
27633 doing the SMTP routing before queueing, so that several messages for the same
27634 host will eventually get delivered down the same connection.
27635 </para>
27636 <para>
27637 <indexterm role="option">
27638 <primary><option>remote_sort_domains</option></primary>
27639 </indexterm>
27640 </para>
27641 <informaltable frame="all">
27642 <tgroup cols="4" colsep="0" rowsep="0">
27643 <colspec colwidth="8*" align="left"/>
27644 <colspec colwidth="6*" align="center"/>
27645 <colspec colwidth="6*" align="center"/>
27646 <colspec colwidth="6*" align="right"/>
27647 <tbody>
27648 <row>
27649 <entry><option>remote_sort_domains</option></entry>
27650 <entry>Use: <emphasis>main</emphasis></entry>
27651 <entry>Type: <emphasis>domain list</emphasis>&dagger;<emphasis></emphasis></entry>
27652 <entry>Default: <emphasis>unset</emphasis></entry>
27653 </row>
27654 </tbody>
27655 </tgroup>
27656 </informaltable>
27657 <para>
27658 <indexterm role="concept">
27659 <primary>sorting remote deliveries</primary>
27660 </indexterm>
27661 <indexterm role="concept">
27662 <primary>delivery</primary>
27663 <secondary>sorting remote</secondary>
27664 </indexterm>
27665 When there are a number of remote deliveries for a message, they are sorted by
27666 domain into the order given by this list. For example,
27667 </para>
27668 <literallayout class="monospaced">
27669 remote_sort_domains = *.cam.ac.uk:*.uk
27670 </literallayout>
27671 <para>
27672 would attempt to deliver to all addresses in the <emphasis>cam.ac.uk</emphasis> domain first,
27673 then to those in the <option>uk</option> domain, then to any others.
27674 </para>
27675 <para>
27676 <indexterm role="option">
27677 <primary><option>retry_data_expire</option></primary>
27678 </indexterm>
27679 </para>
27680 <informaltable frame="all">
27681 <tgroup cols="4" colsep="0" rowsep="0">
27682 <colspec colwidth="8*" align="left"/>
27683 <colspec colwidth="6*" align="center"/>
27684 <colspec colwidth="6*" align="center"/>
27685 <colspec colwidth="6*" align="right"/>
27686 <tbody>
27687 <row>
27688 <entry><option>retry_data_expire</option></entry>
27689 <entry>Use: <emphasis>main</emphasis></entry>
27690 <entry>Type: <emphasis>time</emphasis></entry>
27691 <entry>Default: <emphasis>7d</emphasis></entry>
27692 </row>
27693 </tbody>
27694 </tgroup>
27695 </informaltable>
27696 <para>
27697 <indexterm role="concept">
27698 <primary>hints database</primary>
27699 <secondary>data expiry</secondary>
27700 </indexterm>
27701 This option sets a <quote>use before</quote> time on retry information in Exim&#x2019;s hints
27702 database. Any older retry data is ignored. This means that, for example, once a
27703 host has not been tried for 7 days, Exim behaves as if it has no knowledge of
27704 past failures.
27705 </para>
27706 <para>
27707 <indexterm role="option">
27708 <primary><option>retry_interval_max</option></primary>
27709 </indexterm>
27710 </para>
27711 <informaltable frame="all">
27712 <tgroup cols="4" colsep="0" rowsep="0">
27713 <colspec colwidth="8*" align="left"/>
27714 <colspec colwidth="6*" align="center"/>
27715 <colspec colwidth="6*" align="center"/>
27716 <colspec colwidth="6*" align="right"/>
27717 <tbody>
27718 <row>
27719 <entry><option>retry_interval_max</option></entry>
27720 <entry>Use: <emphasis>main</emphasis></entry>
27721 <entry>Type: <emphasis>time</emphasis></entry>
27722 <entry>Default: <emphasis>24h</emphasis></entry>
27723 </row>
27724 </tbody>
27725 </tgroup>
27726 </informaltable>
27727 <para>
27728 <indexterm role="concept">
27729 <primary>retry</primary>
27730 <secondary>limit on interval</secondary>
27731 </indexterm>
27732 <indexterm role="concept">
27733 <primary>limit</primary>
27734 <secondary>on retry interval</secondary>
27735 </indexterm>
27736 Chapter <xref linkend="CHAPretry"/> describes Exim&#x2019;s mechanisms for controlling the
27737 intervals between delivery attempts for messages that cannot be delivered
27738 straight away. This option sets an overall limit to the length of time between
27739 retries. It cannot be set greater than 24 hours; any attempt to do so forces
27740 the default value.
27741 </para>
27742 <para>
27743 <indexterm role="option">
27744 <primary><option>return_path_remove</option></primary>
27745 </indexterm>
27746 </para>
27747 <informaltable frame="all">
27748 <tgroup cols="4" colsep="0" rowsep="0">
27749 <colspec colwidth="8*" align="left"/>
27750 <colspec colwidth="6*" align="center"/>
27751 <colspec colwidth="6*" align="center"/>
27752 <colspec colwidth="6*" align="right"/>
27753 <tbody>
27754 <row>
27755 <entry><option>return_path_remove</option></entry>
27756 <entry>Use: <emphasis>main</emphasis></entry>
27757 <entry>Type: <emphasis>boolean</emphasis></entry>
27758 <entry>Default: <emphasis>true</emphasis></entry>
27759 </row>
27760 </tbody>
27761 </tgroup>
27762 </informaltable>
27763 <para>
27764 <indexterm role="concept">
27765 <primary><emphasis>Return-path:</emphasis> header line</primary>
27766 <secondary>removing</secondary>
27767 </indexterm>
27768 RFC 2821, section 4.4, states that an SMTP server must insert a
27769 <emphasis>Return-path:</emphasis> header line into a message when it makes a <quote>final delivery</quote>.
27770 The <emphasis>Return-path:</emphasis> header preserves the sender address as received in the
27771 MAIL command. This description implies that this header should not be present
27772 in an incoming message. If <option>return_path_remove</option> is true, any existing
27773 <emphasis>Return-path:</emphasis> headers are removed from messages at the time they are
27774 received. Exim&#x2019;s transports have options for adding <emphasis>Return-path:</emphasis> headers at
27775 the time of delivery. They are normally used only for final local deliveries.
27776 </para>
27777 <para>
27778 <indexterm role="option">
27779 <primary><option>return_size_limit</option></primary>
27780 </indexterm>
27781 </para>
27782 <informaltable frame="all">
27783 <tgroup cols="4" colsep="0" rowsep="0">
27784 <colspec colwidth="8*" align="left"/>
27785 <colspec colwidth="6*" align="center"/>
27786 <colspec colwidth="6*" align="center"/>
27787 <colspec colwidth="6*" align="right"/>
27788 <tbody>
27789 <row>
27790 <entry><option>return_size_limit</option></entry>
27791 <entry>Use: <emphasis>main</emphasis></entry>
27792 <entry>Type: <emphasis>integer</emphasis></entry>
27793 <entry>Default: <emphasis>100K</emphasis></entry>
27794 </row>
27795 </tbody>
27796 </tgroup>
27797 </informaltable>
27798 <para>
27799 This option is an obsolete synonym for <option>bounce_return_size_limit</option>.
27800 </para>
27801 <para>
27802 <indexterm role="option">
27803 <primary><option>rfc1413_hosts</option></primary>
27804 </indexterm>
27805 </para>
27806 <informaltable frame="all">
27807 <tgroup cols="4" colsep="0" rowsep="0">
27808 <colspec colwidth="8*" align="left"/>
27809 <colspec colwidth="6*" align="center"/>
27810 <colspec colwidth="6*" align="center"/>
27811 <colspec colwidth="6*" align="right"/>
27812 <tbody>
27813 <row>
27814 <entry><option>rfc1413_hosts</option></entry>
27815 <entry>Use: <emphasis>main</emphasis></entry>
27816 <entry>Type: <emphasis>host list</emphasis>&dagger;<emphasis></emphasis></entry>
27817 <entry>Default: <emphasis>*</emphasis></entry>
27818 </row>
27819 </tbody>
27820 </tgroup>
27821 </informaltable>
27822 <para>
27823 <indexterm role="concept">
27824 <primary>RFC 1413</primary>
27825 </indexterm>
27826 <indexterm role="concept">
27827 <primary>host</primary>
27828 <secondary>for RFC 1413 calls</secondary>
27829 </indexterm>
27830 RFC 1413 identification calls are made to any client host which matches an item
27831 in the list.
27832 </para>
27833 <para>
27834 <indexterm role="option">
27835 <primary><option>rfc1413_query_timeout</option></primary>
27836 </indexterm>
27837 </para>
27838 <informaltable frame="all">
27839 <tgroup cols="4" colsep="0" rowsep="0">
27840 <colspec colwidth="8*" align="left"/>
27841 <colspec colwidth="6*" align="center"/>
27842 <colspec colwidth="6*" align="center"/>
27843 <colspec colwidth="6*" align="right"/>
27844 <tbody>
27845 <row>
27846 <entry><option>rfc1413_query_timeout</option></entry>
27847 <entry>Use: <emphasis>main</emphasis></entry>
27848 <entry>Type: <emphasis>time</emphasis></entry>
27849 <entry>Default: <emphasis>5s</emphasis></entry>
27850 </row>
27851 </tbody>
27852 </tgroup>
27853 </informaltable>
27854 <para>
27855 <indexterm role="concept">
27856 <primary>RFC 1413</primary>
27857 <secondary>query timeout</secondary>
27858 </indexterm>
27859 <indexterm role="concept">
27860 <primary>timeout</primary>
27861 <secondary>for RFC 1413 call</secondary>
27862 </indexterm>
27863 This sets the timeout on RFC 1413 identification calls. If it is set to zero,
27864 no RFC 1413 calls are ever made.
27865 </para>
27866 <para>
27867 <indexterm role="option">
27868 <primary><option>sender_unqualified_hosts</option></primary>
27869 </indexterm>
27870 </para>
27871 <informaltable frame="all">
27872 <tgroup cols="4" colsep="0" rowsep="0">
27873 <colspec colwidth="8*" align="left"/>
27874 <colspec colwidth="6*" align="center"/>
27875 <colspec colwidth="6*" align="center"/>
27876 <colspec colwidth="6*" align="right"/>
27877 <tbody>
27878 <row>
27879 <entry><option>sender_unqualified_hosts</option></entry>
27880 <entry>Use: <emphasis>main</emphasis></entry>
27881 <entry>Type: <emphasis>host list</emphasis>&dagger;<emphasis></emphasis></entry>
27882 <entry>Default: <emphasis>unset</emphasis></entry>
27883 </row>
27884 </tbody>
27885 </tgroup>
27886 </informaltable>
27887 <para>
27888 <indexterm role="concept">
27889 <primary>unqualified addresses</primary>
27890 </indexterm>
27891 <indexterm role="concept">
27892 <primary>host</primary>
27893 <secondary>unqualified addresses from</secondary>
27894 </indexterm>
27895 This option lists those hosts from which Exim is prepared to accept unqualified
27896 sender addresses. The addresses are made fully qualified by the addition of
27897 <option>qualify_domain</option>. This option also affects message header lines. Exim does
27898 not reject unqualified addresses in headers that contain sender addresses, but
27899 it qualifies them only if the message came from a host that matches
27900 <option>sender_unqualified_hosts</option>, or if the message was submitted locally (not
27901 using TCP/IP), and the <option>-bnq</option> option was not set.
27902 </para>
27903 <para>
27904 <indexterm role="option">
27905 <primary><option>smtp_accept_keepalive</option></primary>
27906 </indexterm>
27907 </para>
27908 <informaltable frame="all">
27909 <tgroup cols="4" colsep="0" rowsep="0">
27910 <colspec colwidth="8*" align="left"/>
27911 <colspec colwidth="6*" align="center"/>
27912 <colspec colwidth="6*" align="center"/>
27913 <colspec colwidth="6*" align="right"/>
27914 <tbody>
27915 <row>
27916 <entry><option>smtp_accept_keepalive</option></entry>
27917 <entry>Use: <emphasis>main</emphasis></entry>
27918 <entry>Type: <emphasis>boolean</emphasis></entry>
27919 <entry>Default: <emphasis>true</emphasis></entry>
27920 </row>
27921 </tbody>
27922 </tgroup>
27923 </informaltable>
27924 <para>
27925 <indexterm role="concept">
27926 <primary>keepalive</primary>
27927 <secondary>on incoming connection</secondary>
27928 </indexterm>
27929 This option controls the setting of the SO_KEEPALIVE option on incoming
27930 TCP/IP socket connections. When set, it causes the kernel to probe idle
27931 connections periodically, by sending packets with <quote>old</quote> sequence numbers. The
27932 other end of the connection should send an acknowledgment if the connection is
27933 still okay or a reset if the connection has been aborted. The reason for doing
27934 this is that it has the beneficial effect of freeing up certain types of
27935 connection that can get stuck when the remote host is disconnected without
27936 tidying up the TCP/IP call properly. The keepalive mechanism takes several
27937 hours to detect unreachable hosts.
27938 </para>
27939 <para>
27940 <indexterm role="option">
27941 <primary><option>smtp_accept_max</option></primary>
27942 </indexterm>
27943 </para>
27944 <informaltable frame="all">
27945 <tgroup cols="4" colsep="0" rowsep="0">
27946 <colspec colwidth="8*" align="left"/>
27947 <colspec colwidth="6*" align="center"/>
27948 <colspec colwidth="6*" align="center"/>
27949 <colspec colwidth="6*" align="right"/>
27950 <tbody>
27951 <row>
27952 <entry><option>smtp_accept_max</option></entry>
27953 <entry>Use: <emphasis>main</emphasis></entry>
27954 <entry>Type: <emphasis>integer</emphasis></entry>
27955 <entry>Default: <emphasis>20</emphasis></entry>
27956 </row>
27957 </tbody>
27958 </tgroup>
27959 </informaltable>
27960 <para>
27961 <indexterm role="concept">
27962 <primary>limit</primary>
27963 <secondary>incoming SMTP connections</secondary>
27964 </indexterm>
27965 <indexterm role="concept">
27966 <primary>SMTP</primary>
27967 <secondary>incoming connection count</secondary>
27968 </indexterm>
27969 <indexterm role="concept">
27970 <primary>inetd</primary>
27971 </indexterm>
27972 This option specifies the maximum number of simultaneous incoming SMTP calls
27973 that Exim will accept. It applies only to the listening daemon; there is no
27974 control (in Exim) when incoming SMTP is being handled by <emphasis>inetd</emphasis>. If the
27975 value is set to zero, no limit is applied. However, it is required to be
27976 non-zero if either <option>smtp_accept_max_per_host</option> or <option>smtp_accept_queue</option> is
27977 set. See also <option>smtp_accept_reserve</option> and <option>smtp_load_reserve</option>.
27978 </para>
27979 <para>
27980 A new SMTP connection is immediately rejected if the <option>smtp_accept_max</option> limit
27981 has been reached. If not, Exim first checks <option>smtp_accept_max_per_host</option>. If
27982 that limit has not been reached for the client host, <option>smtp_accept_reserve</option>
27983 and <option>smtp_load_reserve</option> are then checked before accepting the connection.
27984 </para>
27985 <para>
27986 <indexterm role="option">
27987 <primary><option>smtp_accept_max_nonmail</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>smtp_accept_max_nonmail</option></entry>
27999 <entry>Use: <emphasis>main</emphasis></entry>
28000 <entry>Type: <emphasis>integer</emphasis></entry>
28001 <entry>Default: <emphasis>10</emphasis></entry>
28002 </row>
28003 </tbody>
28004 </tgroup>
28005 </informaltable>
28006 <para>
28007 <indexterm role="concept">
28008 <primary>limit</primary>
28009 <secondary>non-mail SMTP commands</secondary>
28010 </indexterm>
28011 <indexterm role="concept">
28012 <primary>SMTP</primary>
28013 <secondary>limiting non-mail commands</secondary>
28014 </indexterm>
28015 Exim counts the number of <quote>non-mail</quote> commands in an SMTP session, and drops
28016 the connection if there are too many. This option defines <quote>too many</quote>. The
28017 check catches some denial-of-service attacks, repeated failing AUTHs, or a mad
28018 client looping sending EHLO, for example. The check is applied only if the
28019 client host matches <option>smtp_accept_max_nonmail_hosts</option>.
28020 </para>
28021 <para>
28022 When a new message is expected, one occurrence of RSET is not counted. This
28023 allows a client to send one RSET between messages (this is not necessary,
28024 but some clients do it). Exim also allows one uncounted occurrence of HELO
28025 or EHLO, and one occurrence of STARTTLS between messages. After
28026 starting up a TLS session, another EHLO is expected, and so it too is not
28027 counted. The first occurrence of AUTH in a connection, or immediately
28028 following STARTTLS is not counted. Otherwise, all commands other than
28029 MAIL, RCPT, DATA, and QUIT are counted.
28030 </para>
28031 <para>
28032 <indexterm role="option">
28033 <primary><option>smtp_accept_max_nonmail_hosts</option></primary>
28034 </indexterm>
28035 </para>
28036 <informaltable frame="all">
28037 <tgroup cols="4" colsep="0" rowsep="0">
28038 <colspec colwidth="8*" align="left"/>
28039 <colspec colwidth="6*" align="center"/>
28040 <colspec colwidth="6*" align="center"/>
28041 <colspec colwidth="6*" align="right"/>
28042 <tbody>
28043 <row>
28044 <entry><option>smtp_accept_max_nonmail_hosts</option></entry>
28045 <entry>Use: <emphasis>main</emphasis></entry>
28046 <entry>Type: <emphasis>host list</emphasis>&dagger;<emphasis></emphasis></entry>
28047 <entry>Default: <emphasis>*</emphasis></entry>
28048 </row>
28049 </tbody>
28050 </tgroup>
28051 </informaltable>
28052 <para>
28053 You can control which hosts are subject to the <option>smtp_accept_max_nonmail</option>
28054 check by setting this option. The default value makes it apply to all hosts. By
28055 changing the value, you can exclude any badly-behaved hosts that you have to
28056 live with.
28057 </para>
28058 <para>
28059 <indexterm role="option">
28060 <primary><option>smtp_accept_max_per_connection</option></primary>
28061 </indexterm>
28062 </para>
28063 <informaltable frame="all">
28064 <tgroup cols="4" colsep="0" rowsep="0">
28065 <colspec colwidth="8*" align="left"/>
28066 <colspec colwidth="6*" align="center"/>
28067 <colspec colwidth="6*" align="center"/>
28068 <colspec colwidth="6*" align="right"/>
28069 <tbody>
28070 <row>
28071 <entry><option>smtp_accept_max_per_connection</option></entry>
28072 <entry>Use: <emphasis>main</emphasis></entry>
28073 <entry>Type: <emphasis>integer</emphasis></entry>
28074 <entry>Default: <emphasis>1000</emphasis></entry>
28075 </row>
28076 </tbody>
28077 </tgroup>
28078 </informaltable>
28079 <para>
28080 <indexterm role="concept">
28081 <primary>SMTP</primary>
28082 <secondary>limiting incoming message count</secondary>
28083 </indexterm>
28084 <indexterm role="concept">
28085 <primary>limit</primary>
28086 <secondary>messages per SMTP connection</secondary>
28087 </indexterm>
28088 The value of this option limits the number of MAIL commands that Exim is
28089 prepared to accept over a single SMTP connection, whether or not each command
28090 results in the transfer of a message. After the limit is reached, a 421
28091 response is given to subsequent MAIL commands. This limit is a safety
28092 precaution against a client that goes mad (incidents of this type have been
28093 seen).
28094 </para>
28095 <para>
28096 <indexterm role="option">
28097 <primary><option>smtp_accept_max_per_host</option></primary>
28098 </indexterm>
28099 </para>
28100 <informaltable frame="all">
28101 <tgroup cols="4" colsep="0" rowsep="0">
28102 <colspec colwidth="8*" align="left"/>
28103 <colspec colwidth="6*" align="center"/>
28104 <colspec colwidth="6*" align="center"/>
28105 <colspec colwidth="6*" align="right"/>
28106 <tbody>
28107 <row>
28108 <entry><option>smtp_accept_max_per_host</option></entry>
28109 <entry>Use: <emphasis>main</emphasis></entry>
28110 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
28111 <entry>Default: <emphasis>unset</emphasis></entry>
28112 </row>
28113 </tbody>
28114 </tgroup>
28115 </informaltable>
28116 <para>
28117 <indexterm role="concept">
28118 <primary>limit</primary>
28119 <secondary>SMTP connections from one host</secondary>
28120 </indexterm>
28121 <indexterm role="concept">
28122 <primary>host</primary>
28123 <secondary>limiting SMTP connections from</secondary>
28124 </indexterm>
28125 This option restricts the number of simultaneous IP connections from a single
28126 host (strictly, from a single IP address) to the Exim daemon. The option is
28127 expanded, to enable different limits to be applied to different hosts by
28128 reference to <varname>$sender_host_address</varname>. Once the limit is reached, additional
28129 connection attempts from the same host are rejected with error code 421. This
28130 is entirely independent of <option>smtp_accept_reserve</option>. The option&#x2019;s default value
28131 of zero imposes no limit. If this option is set greater than zero, it is
28132 required that <option>smtp_accept_max</option> be non-zero.
28133 </para>
28134 <para>
28135 <emphasis role="bold">Warning</emphasis>: When setting this option you should not use any expansion
28136 constructions that take an appreciable amount of time. The expansion and test
28137 happen in the main daemon loop, in order to reject additional connections
28138 without forking additional processes (otherwise a denial-of-service attack
28139 could cause a vast number or processes to be created). While the daemon is
28140 doing this processing, it cannot accept any other incoming connections.
28141 </para>
28142 <para>
28143 <indexterm role="option">
28144 <primary><option>smtp_accept_queue</option></primary>
28145 </indexterm>
28146 </para>
28147 <informaltable frame="all">
28148 <tgroup cols="4" colsep="0" rowsep="0">
28149 <colspec colwidth="8*" align="left"/>
28150 <colspec colwidth="6*" align="center"/>
28151 <colspec colwidth="6*" align="center"/>
28152 <colspec colwidth="6*" align="right"/>
28153 <tbody>
28154 <row>
28155 <entry><option>smtp_accept_queue</option></entry>
28156 <entry>Use: <emphasis>main</emphasis></entry>
28157 <entry>Type: <emphasis>integer</emphasis></entry>
28158 <entry>Default: <emphasis>0</emphasis></entry>
28159 </row>
28160 </tbody>
28161 </tgroup>
28162 </informaltable>
28163 <para>
28164 <indexterm role="concept">
28165 <primary>SMTP</primary>
28166 <secondary>incoming connection count</secondary>
28167 </indexterm>
28168 <indexterm role="concept">
28169 <primary>queueing incoming messages</primary>
28170 </indexterm>
28171 <indexterm role="concept">
28172 <primary>message</primary>
28173 <secondary>queueing by SMTP connection count</secondary>
28174 </indexterm>
28175 If the number of simultaneous incoming SMTP connections being handled via the
28176 listening daemon exceeds this value, messages received by SMTP are just placed
28177 on the queue; no delivery processes are started automatically. The count is
28178 fixed at the start of an SMTP connection. It cannot be updated in the
28179 subprocess that receives messages, and so the queueing or not queueing applies
28180 to all messages received in the same connection.
28181 </para>
28182 <para>
28183 A value of zero implies no limit, and clearly any non-zero value is useful only
28184 if it is less than the <option>smtp_accept_max</option> value (unless that is zero). See
28185 also <option>queue_only</option>, <option>queue_only_load</option>, <option>queue_smtp_domains</option>, and the
28186 various <option>-od</option><emphasis>x</emphasis> command line options.
28187 </para>
28188 <para>
28189 <indexterm role="option">
28190 <primary><option>smtp_accept_queue_per_connection</option></primary>
28191 </indexterm>
28192 </para>
28193 <informaltable frame="all">
28194 <tgroup cols="4" colsep="0" rowsep="0">
28195 <colspec colwidth="8*" align="left"/>
28196 <colspec colwidth="6*" align="center"/>
28197 <colspec colwidth="6*" align="center"/>
28198 <colspec colwidth="6*" align="right"/>
28199 <tbody>
28200 <row>
28201 <entry><option>smtp_accept_queue_per_connection</option></entry>
28202 <entry>Use: <emphasis>main</emphasis></entry>
28203 <entry>Type: <emphasis>integer</emphasis></entry>
28204 <entry>Default: <emphasis>10</emphasis></entry>
28205 </row>
28206 </tbody>
28207 </tgroup>
28208 </informaltable>
28209 <para>
28210 <indexterm role="concept">
28211 <primary>queueing incoming messages</primary>
28212 </indexterm>
28213 <indexterm role="concept">
28214 <primary>message</primary>
28215 <secondary>queueing by message count</secondary>
28216 </indexterm>
28217 This option limits the number of delivery processes that Exim starts
28218 automatically when receiving messages via SMTP, whether via the daemon or by
28219 the use of <option>-bs</option> or <option>-bS</option>. If the value of the option is greater than zero,
28220 and the number of messages received in a single SMTP session exceeds this
28221 number, subsequent messages are placed on the queue, but no delivery processes
28222 are started. This helps to limit the number of Exim processes when a server
28223 restarts after downtime and there is a lot of mail waiting for it on other
28224 systems. On large systems, the default should probably be increased, and on
28225 dial-in client systems it should probably be set to zero (that is, disabled).
28226 </para>
28227 <para>
28228 <indexterm role="option">
28229 <primary><option>smtp_accept_reserve</option></primary>
28230 </indexterm>
28231 </para>
28232 <informaltable frame="all">
28233 <tgroup cols="4" colsep="0" rowsep="0">
28234 <colspec colwidth="8*" align="left"/>
28235 <colspec colwidth="6*" align="center"/>
28236 <colspec colwidth="6*" align="center"/>
28237 <colspec colwidth="6*" align="right"/>
28238 <tbody>
28239 <row>
28240 <entry><option>smtp_accept_reserve</option></entry>
28241 <entry>Use: <emphasis>main</emphasis></entry>
28242 <entry>Type: <emphasis>integer</emphasis></entry>
28243 <entry>Default: <emphasis>0</emphasis></entry>
28244 </row>
28245 </tbody>
28246 </tgroup>
28247 </informaltable>
28248 <para>
28249 <indexterm role="concept">
28250 <primary>SMTP</primary>
28251 <secondary>incoming call count</secondary>
28252 </indexterm>
28253 <indexterm role="concept">
28254 <primary>host</primary>
28255 <secondary>reserved</secondary>
28256 </indexterm>
28257 When <option>smtp_accept_max</option> is set greater than zero, this option specifies a
28258 number of SMTP connections that are reserved for connections from the hosts
28259 that are specified in <option>smtp_reserve_hosts</option>. The value set in
28260 <option>smtp_accept_max</option> includes this reserve pool. The specified hosts are not
28261 restricted to this number of connections; the option specifies a minimum number
28262 of connection slots for them, not a maximum. It is a guarantee that this group
28263 of hosts can always get at least <option>smtp_accept_reserve</option> connections. However,
28264 the limit specified by <option>smtp_accept_max_per_host</option> is still applied to each
28265 individual host.
28266 </para>
28267 <para>
28268 For example, if <option>smtp_accept_max</option> is set to 50 and <option>smtp_accept_reserve</option> is
28269 set to 5, once there are 45 active connections (from any hosts), new
28270 connections are accepted only from hosts listed in <option>smtp_reserve_hosts</option>,
28271 provided the other criteria for acceptance are met.
28272 </para>
28273 <para>
28274 <indexterm role="option">
28275 <primary><option>smtp_active_hostname</option></primary>
28276 </indexterm>
28277 </para>
28278 <informaltable frame="all">
28279 <tgroup cols="4" colsep="0" rowsep="0">
28280 <colspec colwidth="8*" align="left"/>
28281 <colspec colwidth="6*" align="center"/>
28282 <colspec colwidth="6*" align="center"/>
28283 <colspec colwidth="6*" align="right"/>
28284 <tbody>
28285 <row>
28286 <entry><option>smtp_active_hostname</option></entry>
28287 <entry>Use: <emphasis>main</emphasis></entry>
28288 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
28289 <entry>Default: <emphasis>unset</emphasis></entry>
28290 </row>
28291 </tbody>
28292 </tgroup>
28293 </informaltable>
28294 <para>
28295 <indexterm role="concept">
28296 <primary>host</primary>
28297 <secondary>name in SMTP responses</secondary>
28298 </indexterm>
28299 <indexterm role="concept">
28300 <primary>SMTP</primary>
28301 <secondary>host name in responses</secondary>
28302 </indexterm>
28303 <indexterm role="variable">
28304 <primary><varname>$primary_hostname</varname></primary>
28305 </indexterm>
28306 This option is provided for multi-homed servers that want to masquerade as
28307 several different hosts. At the start of an incoming SMTP connection, its value
28308 is expanded and used instead of the value of <varname>$primary_hostname</varname> in SMTP
28309 responses. For example, it is used as domain name in the response to an
28310 incoming HELO or EHLO command.
28311 </para>
28312 <para>
28313 <indexterm role="variable">
28314 <primary><varname>$smtp_active_hostname</varname></primary>
28315 </indexterm>
28316 The active hostname is placed in the <varname>$smtp_active_hostname</varname> variable, which
28317 is saved with any messages that are received. It is therefore available for use
28318 in routers and transports when the message is later delivered.
28319 </para>
28320 <para>
28321 If this option is unset, or if its expansion is forced to fail, or if the
28322 expansion results in an empty string, the value of <varname>$primary_hostname</varname> is
28323 used. Other expansion failures cause a message to be written to the main and
28324 panic logs, and the SMTP command receives a temporary error. Typically, the
28325 value of <option>smtp_active_hostname</option> depends on the incoming interface address.
28326 For example:
28327 </para>
28328 <literallayout class="monospaced">
28329 smtp_active_hostname = ${if eq{$received_ip_address}{10.0.0.1}\
28330   {cox.mydomain}{box.mydomain}}
28331 </literallayout>
28332 <para>
28333 Although <varname>$smtp_active_hostname</varname> is primarily concerned with incoming
28334 messages, it is also used as the default for HELO commands in callout
28335 verification if there is no remote transport from which to obtain a
28336 <option>helo_data</option> value.
28337 </para>
28338 <para>
28339 <indexterm role="option">
28340 <primary><option>smtp_banner</option></primary>
28341 </indexterm>
28342 </para>
28343 <informaltable frame="all">
28344 <tgroup cols="4" colsep="0" rowsep="0">
28345 <colspec colwidth="8*" align="left"/>
28346 <colspec colwidth="6*" align="center"/>
28347 <colspec colwidth="6*" align="center"/>
28348 <colspec colwidth="6*" align="right"/>
28349 <tbody>
28350 <row>
28351 <entry><option>smtp_banner</option></entry>
28352 <entry>Use: <emphasis>main</emphasis></entry>
28353 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
28354 <entry>Default: <emphasis>see below</emphasis></entry>
28355 </row>
28356 </tbody>
28357 </tgroup>
28358 </informaltable>
28359 <para>
28360 <indexterm role="concept">
28361 <primary>SMTP</primary>
28362 <secondary>welcome banner</secondary>
28363 </indexterm>
28364 <indexterm role="concept">
28365 <primary>banner for SMTP</primary>
28366 </indexterm>
28367 <indexterm role="concept">
28368 <primary>welcome banner for SMTP</primary>
28369 </indexterm>
28370 <indexterm role="concept">
28371 <primary>customizing</primary>
28372 <secondary>SMTP banner</secondary>
28373 </indexterm>
28374 This string, which is expanded every time it is used, is output as the initial
28375 positive response to an SMTP connection. The default setting is:
28376 </para>
28377 <literallayout class="monospaced">
28378 smtp_banner = $smtp_active_hostname ESMTP Exim \
28379   $version_number $tod_full
28380 </literallayout>
28381 <para>
28382 Failure to expand the string causes a panic error. If you want to create a
28383 multiline response to the initial SMTP connection, use <quote>\n</quote> in the string at
28384 appropriate points, but not at the end. Note that the 220 code is not included
28385 in this string. Exim adds it automatically (several times in the case of a
28386 multiline response).
28387 </para>
28388 <para>
28389 <indexterm role="option">
28390 <primary><option>smtp_check_spool_space</option></primary>
28391 </indexterm>
28392 </para>
28393 <informaltable frame="all">
28394 <tgroup cols="4" colsep="0" rowsep="0">
28395 <colspec colwidth="8*" align="left"/>
28396 <colspec colwidth="6*" align="center"/>
28397 <colspec colwidth="6*" align="center"/>
28398 <colspec colwidth="6*" align="right"/>
28399 <tbody>
28400 <row>
28401 <entry><option>smtp_check_spool_space</option></entry>
28402 <entry>Use: <emphasis>main</emphasis></entry>
28403 <entry>Type: <emphasis>boolean</emphasis></entry>
28404 <entry>Default: <emphasis>true</emphasis></entry>
28405 </row>
28406 </tbody>
28407 </tgroup>
28408 </informaltable>
28409 <para>
28410 <indexterm role="concept">
28411 <primary>checking disk space</primary>
28412 </indexterm>
28413 <indexterm role="concept">
28414 <primary>disk space, checking</primary>
28415 </indexterm>
28416 <indexterm role="concept">
28417 <primary>spool directory</primary>
28418 <secondary>checking space</secondary>
28419 </indexterm>
28420 When this option is set, if an incoming SMTP session encounters the SIZE
28421 option on a MAIL command, it checks that there is enough space in the
28422 spool directory&#x2019;s partition to accept a message of that size, while still
28423 leaving free the amount specified by <option>check_spool_space</option> (even if that value
28424 is zero). If there isn&#x2019;t enough space, a temporary error code is returned.
28425 </para>
28426 <para>
28427 <indexterm role="option">
28428 <primary><option>smtp_connect_backlog</option></primary>
28429 </indexterm>
28430 </para>
28431 <informaltable frame="all">
28432 <tgroup cols="4" colsep="0" rowsep="0">
28433 <colspec colwidth="8*" align="left"/>
28434 <colspec colwidth="6*" align="center"/>
28435 <colspec colwidth="6*" align="center"/>
28436 <colspec colwidth="6*" align="right"/>
28437 <tbody>
28438 <row>
28439 <entry><option>smtp_connect_backlog</option></entry>
28440 <entry>Use: <emphasis>main</emphasis></entry>
28441 <entry>Type: <emphasis>integer</emphasis></entry>
28442 <entry>Default: <emphasis>20</emphasis></entry>
28443 </row>
28444 </tbody>
28445 </tgroup>
28446 </informaltable>
28447 <para>
28448 <indexterm role="concept">
28449 <primary>connection backlog</primary>
28450 </indexterm>
28451 <indexterm role="concept">
28452 <primary>SMTP</primary>
28453 <secondary>connection backlog</secondary>
28454 </indexterm>
28455 <indexterm role="concept">
28456 <primary>backlog of connections</primary>
28457 </indexterm>
28458 This option specifies a maximum number of waiting SMTP connections. Exim passes
28459 this value to the TCP/IP system when it sets up its listener. Once this number
28460 of connections are waiting for the daemon&#x2019;s attention, subsequent connection
28461 attempts are refused at the TCP/IP level. At least, that is what the manuals
28462 say; in some circumstances such connection attempts have been observed to time
28463 out instead. For large systems it is probably a good idea to increase the
28464 value (to 50, say). It also gives some protection against denial-of-service
28465 attacks by SYN flooding.
28466 </para>
28467 <para>
28468 <indexterm role="option">
28469 <primary><option>smtp_enforce_sync</option></primary>
28470 </indexterm>
28471 </para>
28472 <informaltable frame="all">
28473 <tgroup cols="4" colsep="0" rowsep="0">
28474 <colspec colwidth="8*" align="left"/>
28475 <colspec colwidth="6*" align="center"/>
28476 <colspec colwidth="6*" align="center"/>
28477 <colspec colwidth="6*" align="right"/>
28478 <tbody>
28479 <row>
28480 <entry><option>smtp_enforce_sync</option></entry>
28481 <entry>Use: <emphasis>main</emphasis></entry>
28482 <entry>Type: <emphasis>boolean</emphasis></entry>
28483 <entry>Default: <emphasis>true</emphasis></entry>
28484 </row>
28485 </tbody>
28486 </tgroup>
28487 </informaltable>
28488 <para>
28489 <indexterm role="concept">
28490 <primary>SMTP</primary>
28491 <secondary>synchronization checking</secondary>
28492 </indexterm>
28493 <indexterm role="concept">
28494 <primary>synchronization checking in SMTP</primary>
28495 </indexterm>
28496 The SMTP protocol specification requires the client to wait for a response from
28497 the server at certain points in the dialogue. Without PIPELINING these
28498 synchronization points are after every command; with PIPELINING they are
28499 fewer, but they still exist.
28500 </para>
28501 <para>
28502 Some spamming sites send out a complete set of SMTP commands without waiting
28503 for any response. Exim protects against this by rejecting a message if the
28504 client has sent further input when it should not have. The error response <quote>554
28505 SMTP synchronization error</quote> is sent, and the connection is dropped. Testing
28506 for this error cannot be perfect because of transmission delays (unexpected
28507 input may be on its way but not yet received when Exim checks). However, it
28508 does detect many instances.
28509 </para>
28510 <para>
28511 The check can be globally disabled by setting <option>smtp_enforce_sync</option> false.
28512 If you want to disable the check selectively (for example, only for certain
28513 hosts), you can do so by an appropriate use of a <option>control</option> modifier in an ACL
28514 (see section <xref linkend="SECTcontrols"/>). See also <option>pipelining_advertise_hosts</option>.
28515 </para>
28516 <para>
28517 <indexterm role="option">
28518 <primary><option>smtp_etrn_command</option></primary>
28519 </indexterm>
28520 </para>
28521 <informaltable frame="all">
28522 <tgroup cols="4" colsep="0" rowsep="0">
28523 <colspec colwidth="8*" align="left"/>
28524 <colspec colwidth="6*" align="center"/>
28525 <colspec colwidth="6*" align="center"/>
28526 <colspec colwidth="6*" align="right"/>
28527 <tbody>
28528 <row>
28529 <entry><option>smtp_etrn_command</option></entry>
28530 <entry>Use: <emphasis>main</emphasis></entry>
28531 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
28532 <entry>Default: <emphasis>unset</emphasis></entry>
28533 </row>
28534 </tbody>
28535 </tgroup>
28536 </informaltable>
28537 <para>
28538 <indexterm role="concept">
28539 <primary>ETRN</primary>
28540 <secondary>command to be run</secondary>
28541 </indexterm>
28542 <indexterm role="variable">
28543 <primary><varname>$domain</varname></primary>
28544 </indexterm>
28545 If this option is set, the given command is run whenever an SMTP ETRN
28546 command is received from a host that is permitted to issue such commands (see
28547 chapter <xref linkend="CHAPACL"/>). The string is split up into separate arguments which
28548 are independently expanded. The expansion variable <varname>$domain</varname> is set to the
28549 argument of the ETRN command, and no syntax checking is done on it. For
28550 example:
28551 </para>
28552 <literallayout class="monospaced">
28553 smtp_etrn_command = /etc/etrn_command $domain \
28554                     $sender_host_address
28555 </literallayout>
28556 <para>
28557 A new process is created to run the command, but Exim does not wait for it to
28558 complete. Consequently, its status cannot be checked. If the command cannot be
28559 run, a line is written to the panic log, but the ETRN caller still receives
28560 a 250 success response. Exim is normally running under its own uid when
28561 receiving SMTP, so it is not possible for it to change the uid before running
28562 the command.
28563 </para>
28564 <para>
28565 <indexterm role="option">
28566 <primary><option>smtp_etrn_serialize</option></primary>
28567 </indexterm>
28568 </para>
28569 <informaltable frame="all">
28570 <tgroup cols="4" colsep="0" rowsep="0">
28571 <colspec colwidth="8*" align="left"/>
28572 <colspec colwidth="6*" align="center"/>
28573 <colspec colwidth="6*" align="center"/>
28574 <colspec colwidth="6*" align="right"/>
28575 <tbody>
28576 <row>
28577 <entry><option>smtp_etrn_serialize</option></entry>
28578 <entry>Use: <emphasis>main</emphasis></entry>
28579 <entry>Type: <emphasis>boolean</emphasis></entry>
28580 <entry>Default: <emphasis>true</emphasis></entry>
28581 </row>
28582 </tbody>
28583 </tgroup>
28584 </informaltable>
28585 <para>
28586 <indexterm role="concept">
28587 <primary>ETRN</primary>
28588 <secondary>serializing</secondary>
28589 </indexterm>
28590 When this option is set, it prevents the simultaneous execution of more than
28591 one identical command as a result of ETRN in an SMTP connection. See
28592 section <xref linkend="SECTETRN"/> for details.
28593 </para>
28594 <para>
28595 <indexterm role="option">
28596 <primary><option>smtp_load_reserve</option></primary>
28597 </indexterm>
28598 </para>
28599 <informaltable frame="all">
28600 <tgroup cols="4" colsep="0" rowsep="0">
28601 <colspec colwidth="8*" align="left"/>
28602 <colspec colwidth="6*" align="center"/>
28603 <colspec colwidth="6*" align="center"/>
28604 <colspec colwidth="6*" align="right"/>
28605 <tbody>
28606 <row>
28607 <entry><option>smtp_load_reserve</option></entry>
28608 <entry>Use: <emphasis>main</emphasis></entry>
28609 <entry>Type: <emphasis>fixed-point</emphasis></entry>
28610 <entry>Default: <emphasis>unset</emphasis></entry>
28611 </row>
28612 </tbody>
28613 </tgroup>
28614 </informaltable>
28615 <para>
28616 <indexterm role="concept">
28617 <primary>load average</primary>
28618 </indexterm>
28619 If the system load average ever gets higher than this, incoming SMTP calls are
28620 accepted only from those hosts that match an entry in <option>smtp_reserve_hosts</option>.
28621 If <option>smtp_reserve_hosts</option> is not set, no incoming SMTP calls are accepted when
28622 the load is over the limit. The option has no effect on ancient operating
28623 systems on which Exim cannot determine the load average. See also
28624 <option>deliver_queue_load_max</option> and <option>queue_only_load</option>.
28625 </para>
28626 <para>
28627 <indexterm role="option">
28628 <primary><option>smtp_max_synprot_errors</option></primary>
28629 </indexterm>
28630 </para>
28631 <informaltable frame="all">
28632 <tgroup cols="4" colsep="0" rowsep="0">
28633 <colspec colwidth="8*" align="left"/>
28634 <colspec colwidth="6*" align="center"/>
28635 <colspec colwidth="6*" align="center"/>
28636 <colspec colwidth="6*" align="right"/>
28637 <tbody>
28638 <row>
28639 <entry><option>smtp_max_synprot_errors</option></entry>
28640 <entry>Use: <emphasis>main</emphasis></entry>
28641 <entry>Type: <emphasis>integer</emphasis></entry>
28642 <entry>Default: <emphasis>3</emphasis></entry>
28643 </row>
28644 </tbody>
28645 </tgroup>
28646 </informaltable>
28647 <para>
28648 <indexterm role="concept">
28649 <primary>SMTP</primary>
28650 <secondary>limiting syntax and protocol errors</secondary>
28651 </indexterm>
28652 <indexterm role="concept">
28653 <primary>limit</primary>
28654 <secondary>SMTP syntax and protocol errors</secondary>
28655 </indexterm>
28656 Exim rejects SMTP commands that contain syntax or protocol errors. In
28657 particular, a syntactically invalid email address, as in this command:
28658 </para>
28659 <literallayout class="monospaced">
28660 RCPT TO:&lt;abc xyz@a.b.c&gt;
28661 </literallayout>
28662 <para>
28663 causes immediate rejection of the command, before any other tests are done.
28664 (The ACL cannot be run if there is no valid address to set up for it.) An
28665 example of a protocol error is receiving RCPT before MAIL. If there are
28666 too many syntax or protocol errors in one SMTP session, the connection is
28667 dropped. The limit is set by this option.
28668 </para>
28669 <para>
28670 <indexterm role="concept">
28671 <primary>PIPELINING</primary>
28672 <secondary>expected errors</secondary>
28673 </indexterm>
28674 When the PIPELINING extension to SMTP is in use, some protocol errors are
28675 <quote>expected</quote>, for instance, a RCPT command after a rejected MAIL command.
28676 Exim assumes that PIPELINING will be used if it advertises it (see
28677 <option>pipelining_advertise_hosts</option>), and in this situation, <quote>expected</quote> errors do
28678 not count towards the limit.
28679 </para>
28680 <para>
28681 <indexterm role="option">
28682 <primary><option>smtp_max_unknown_commands</option></primary>
28683 </indexterm>
28684 </para>
28685 <informaltable frame="all">
28686 <tgroup cols="4" colsep="0" rowsep="0">
28687 <colspec colwidth="8*" align="left"/>
28688 <colspec colwidth="6*" align="center"/>
28689 <colspec colwidth="6*" align="center"/>
28690 <colspec colwidth="6*" align="right"/>
28691 <tbody>
28692 <row>
28693 <entry><option>smtp_max_unknown_commands</option></entry>
28694 <entry>Use: <emphasis>main</emphasis></entry>
28695 <entry>Type: <emphasis>integer</emphasis></entry>
28696 <entry>Default: <emphasis>3</emphasis></entry>
28697 </row>
28698 </tbody>
28699 </tgroup>
28700 </informaltable>
28701 <para>
28702 <indexterm role="concept">
28703 <primary>SMTP</primary>
28704 <secondary>limiting unknown commands</secondary>
28705 </indexterm>
28706 <indexterm role="concept">
28707 <primary>limit</primary>
28708 <secondary>unknown SMTP commands</secondary>
28709 </indexterm>
28710 If there are too many unrecognized commands in an incoming SMTP session, an
28711 Exim server drops the connection. This is a defence against some kinds of abuse
28712 that subvert web
28713 clients
28714 into making connections to SMTP ports; in these circumstances, a number of
28715 non-SMTP command lines are sent first.
28716 </para>
28717 <para>
28718 <indexterm role="option">
28719 <primary><option>smtp_ratelimit_hosts</option></primary>
28720 </indexterm>
28721 </para>
28722 <informaltable frame="all">
28723 <tgroup cols="4" colsep="0" rowsep="0">
28724 <colspec colwidth="8*" align="left"/>
28725 <colspec colwidth="6*" align="center"/>
28726 <colspec colwidth="6*" align="center"/>
28727 <colspec colwidth="6*" align="right"/>
28728 <tbody>
28729 <row>
28730 <entry><option>smtp_ratelimit_hosts</option></entry>
28731 <entry>Use: <emphasis>main</emphasis></entry>
28732 <entry>Type: <emphasis>host list</emphasis>&dagger;<emphasis></emphasis></entry>
28733 <entry>Default: <emphasis>unset</emphasis></entry>
28734 </row>
28735 </tbody>
28736 </tgroup>
28737 </informaltable>
28738 <para>
28739 <indexterm role="concept">
28740 <primary>SMTP</primary>
28741 <secondary>rate limiting</secondary>
28742 </indexterm>
28743 <indexterm role="concept">
28744 <primary>limit</primary>
28745 <secondary>rate of message arrival</secondary>
28746 </indexterm>
28747 <indexterm role="concept">
28748 <primary>RCPT</primary>
28749 <secondary>rate limiting</secondary>
28750 </indexterm>
28751 Some sites find it helpful to be able to limit the rate at which certain hosts
28752 can send them messages, and the rate at which an individual message can specify
28753 recipients.
28754 </para>
28755 <para>
28756 Exim has two rate-limiting facilities. This section describes the older
28757 facility, which can limit rates within a single connection. The newer
28758 <option>ratelimit</option> ACL condition can limit rates across all connections. See section
28759 <xref linkend="SECTratelimiting"/> for details of the newer facility.
28760 </para>
28761 <para>
28762 When a host matches <option>smtp_ratelimit_hosts</option>, the values of
28763 <option>smtp_ratelimit_mail</option> and <option>smtp_ratelimit_rcpt</option> are used to control the
28764 rate of acceptance of MAIL and RCPT commands in a single SMTP session,
28765 respectively. Each option, if set, must contain a set of four comma-separated
28766 values:
28767 </para>
28768 <itemizedlist>
28769 <listitem>
28770 <para>
28771 A threshold, before which there is no rate limiting.
28772 </para>
28773 </listitem>
28774 <listitem>
28775 <para>
28776 An initial time delay. Unlike other times in Exim, numbers with decimal
28777 fractional parts are allowed here.
28778 </para>
28779 </listitem>
28780 <listitem>
28781 <para>
28782 A factor by which to increase the delay each time.
28783 </para>
28784 </listitem>
28785 <listitem>
28786 <para>
28787 A maximum value for the delay. This should normally be less than 5 minutes,
28788 because after that time, the client is liable to timeout the SMTP command.
28789 </para>
28790 </listitem>
28791 </itemizedlist>
28792 <para>
28793 For example, these settings have been used successfully at the site which
28794 first suggested this feature, for controlling mail from their customers:
28795 </para>
28796 <literallayout class="monospaced">
28797 smtp_ratelimit_mail = 2,0.5s,1.05,4m
28798 smtp_ratelimit_rcpt = 4,0.25s,1.015,4m
28799 </literallayout>
28800 <para>
28801 The first setting specifies delays that are applied to MAIL commands after
28802 two have been received over a single connection. The initial delay is 0.5
28803 seconds, increasing by a factor of 1.05 each time. The second setting applies
28804 delays to RCPT commands when more than four occur in a single message.
28805 </para>
28806 <para>
28807 <indexterm role="option">
28808 <primary><option>smtp_ratelimit_mail</option></primary>
28809 </indexterm>
28810 </para>
28811 <informaltable frame="all">
28812 <tgroup cols="4" colsep="0" rowsep="0">
28813 <colspec colwidth="8*" align="left"/>
28814 <colspec colwidth="6*" align="center"/>
28815 <colspec colwidth="6*" align="center"/>
28816 <colspec colwidth="6*" align="right"/>
28817 <tbody>
28818 <row>
28819 <entry><option>smtp_ratelimit_mail</option></entry>
28820 <entry>Use: <emphasis>main</emphasis></entry>
28821 <entry>Type: <emphasis>string</emphasis></entry>
28822 <entry>Default: <emphasis>unset</emphasis></entry>
28823 </row>
28824 </tbody>
28825 </tgroup>
28826 </informaltable>
28827 <para>
28828 See <option>smtp_ratelimit_hosts</option> above.
28829 </para>
28830 <para>
28831 <indexterm role="option">
28832 <primary><option>smtp_ratelimit_rcpt</option></primary>
28833 </indexterm>
28834 </para>
28835 <informaltable frame="all">
28836 <tgroup cols="4" colsep="0" rowsep="0">
28837 <colspec colwidth="8*" align="left"/>
28838 <colspec colwidth="6*" align="center"/>
28839 <colspec colwidth="6*" align="center"/>
28840 <colspec colwidth="6*" align="right"/>
28841 <tbody>
28842 <row>
28843 <entry><option>smtp_ratelimit_rcpt</option></entry>
28844 <entry>Use: <emphasis>main</emphasis></entry>
28845 <entry>Type: <emphasis>string</emphasis></entry>
28846 <entry>Default: <emphasis>unset</emphasis></entry>
28847 </row>
28848 </tbody>
28849 </tgroup>
28850 </informaltable>
28851 <para>
28852 See <option>smtp_ratelimit_hosts</option> above.
28853 </para>
28854 <para>
28855 <indexterm role="option">
28856 <primary><option>smtp_receive_timeout</option></primary>
28857 </indexterm>
28858 </para>
28859 <informaltable frame="all">
28860 <tgroup cols="4" colsep="0" rowsep="0">
28861 <colspec colwidth="8*" align="left"/>
28862 <colspec colwidth="6*" align="center"/>
28863 <colspec colwidth="6*" align="center"/>
28864 <colspec colwidth="6*" align="right"/>
28865 <tbody>
28866 <row>
28867 <entry><option>smtp_receive_timeout</option></entry>
28868 <entry>Use: <emphasis>main</emphasis></entry>
28869 <entry>Type: <emphasis>time</emphasis></entry>
28870 <entry>Default: <emphasis>5m</emphasis></entry>
28871 </row>
28872 </tbody>
28873 </tgroup>
28874 </informaltable>
28875 <para>
28876 <indexterm role="concept">
28877 <primary>timeout</primary>
28878 <secondary>for SMTP input</secondary>
28879 </indexterm>
28880 <indexterm role="concept">
28881 <primary>SMTP</primary>
28882 <secondary>input timeout</secondary>
28883 </indexterm>
28884 This sets a timeout value for SMTP reception. It applies to all forms of SMTP
28885 input, including batch SMTP. If a line of input (either an SMTP command or a
28886 data line) is not received within this time, the SMTP connection is dropped and
28887 the message is abandoned.
28888 A line is written to the log containing one of the following messages:
28889 </para>
28890 <literallayout class="monospaced">
28891 SMTP command timeout on connection from...
28892 SMTP data timeout on connection from...
28893 </literallayout>
28894 <para>
28895 The former means that Exim was expecting to read an SMTP command; the latter
28896 means that it was in the DATA phase, reading the contents of a message.
28897 </para>
28898 <para>
28899 <indexterm role="option">
28900 <primary><option>-os</option></primary>
28901 </indexterm>
28902 The value set by this option can be overridden by the
28903 <option>-os</option> command-line option. A setting of zero time disables the timeout, but
28904 this should never be used for SMTP over TCP/IP. (It can be useful in some cases
28905 of local input using <option>-bs</option> or <option>-bS</option>.) For non-SMTP input, the reception
28906 timeout is controlled by <option>receive_timeout</option> and <option>-or</option>.
28907 </para>
28908 <para>
28909 <indexterm role="option">
28910 <primary><option>smtp_reserve_hosts</option></primary>
28911 </indexterm>
28912 </para>
28913 <informaltable frame="all">
28914 <tgroup cols="4" colsep="0" rowsep="0">
28915 <colspec colwidth="8*" align="left"/>
28916 <colspec colwidth="6*" align="center"/>
28917 <colspec colwidth="6*" align="center"/>
28918 <colspec colwidth="6*" align="right"/>
28919 <tbody>
28920 <row>
28921 <entry><option>smtp_reserve_hosts</option></entry>
28922 <entry>Use: <emphasis>main</emphasis></entry>
28923 <entry>Type: <emphasis>host list</emphasis>&dagger;<emphasis></emphasis></entry>
28924 <entry>Default: <emphasis>unset</emphasis></entry>
28925 </row>
28926 </tbody>
28927 </tgroup>
28928 </informaltable>
28929 <para>
28930 This option defines hosts for which SMTP connections are reserved; see
28931 <option>smtp_accept_reserve</option> and <option>smtp_load_reserve</option> above.
28932 </para>
28933 <para>
28934 <indexterm role="option">
28935 <primary><option>smtp_return_error_details</option></primary>
28936 </indexterm>
28937 </para>
28938 <informaltable frame="all">
28939 <tgroup cols="4" colsep="0" rowsep="0">
28940 <colspec colwidth="8*" align="left"/>
28941 <colspec colwidth="6*" align="center"/>
28942 <colspec colwidth="6*" align="center"/>
28943 <colspec colwidth="6*" align="right"/>
28944 <tbody>
28945 <row>
28946 <entry><option>smtp_return_error_details</option></entry>
28947 <entry>Use: <emphasis>main</emphasis></entry>
28948 <entry>Type: <emphasis>boolean</emphasis></entry>
28949 <entry>Default: <emphasis>false</emphasis></entry>
28950 </row>
28951 </tbody>
28952 </tgroup>
28953 </informaltable>
28954 <para>
28955 <indexterm role="concept">
28956 <primary>SMTP</primary>
28957 <secondary>details policy failures</secondary>
28958 </indexterm>
28959 <indexterm role="concept">
28960 <primary>policy control</primary>
28961 <secondary>rejection, returning details</secondary>
28962 </indexterm>
28963 In the default state, Exim uses bland messages such as
28964 <quote>Administrative prohibition</quote> when it rejects SMTP commands for policy
28965 reasons. Many sysadmins like this because it gives away little information
28966 to spammers. However, some other sysadmins who are applying strict checking
28967 policies want to give out much fuller information about failures. Setting
28968 <option>smtp_return_error_details</option> true causes Exim to be more forthcoming. For
28969 example, instead of <quote>Administrative prohibition</quote>, it might give:
28970 </para>
28971 <literallayout class="monospaced">
28972 550-Rejected after DATA: '&gt;' missing at end of address:
28973 550 failing address in "From" header is: &lt;user@dom.ain
28974 </literallayout>
28975 <para>
28976 <indexterm role="option">
28977 <primary><option>spamd_address</option></primary>
28978 </indexterm>
28979 </para>
28980 <informaltable frame="all">
28981 <tgroup cols="4" colsep="0" rowsep="0">
28982 <colspec colwidth="8*" align="left"/>
28983 <colspec colwidth="6*" align="center"/>
28984 <colspec colwidth="6*" align="center"/>
28985 <colspec colwidth="6*" align="right"/>
28986 <tbody>
28987 <row>
28988 <entry><option>spamd_address</option></entry>
28989 <entry>Use: <emphasis>main</emphasis></entry>
28990 <entry>Type: <emphasis>string</emphasis></entry>
28991 <entry>Default: <emphasis>see below</emphasis></entry>
28992 </row>
28993 </tbody>
28994 </tgroup>
28995 </informaltable>
28996 <para>
28997 This option is available when Exim is compiled with the content-scanning
28998 extension. It specifies how Exim connects to SpamAssassin&#x2019;s <option>spamd</option> daemon.
28999 The default value is
29000 </para>
29001 <literallayout class="monospaced">
29002 127.0.0.1 783
29003 </literallayout>
29004 <para>
29005 See section <xref linkend="SECTscanspamass"/> for more details.
29006 </para>
29007 <para>
29008 <indexterm role="option">
29009 <primary><option>split_spool_directory</option></primary>
29010 </indexterm>
29011 </para>
29012 <informaltable frame="all">
29013 <tgroup cols="4" colsep="0" rowsep="0">
29014 <colspec colwidth="8*" align="left"/>
29015 <colspec colwidth="6*" align="center"/>
29016 <colspec colwidth="6*" align="center"/>
29017 <colspec colwidth="6*" align="right"/>
29018 <tbody>
29019 <row>
29020 <entry><option>split_spool_directory</option></entry>
29021 <entry>Use: <emphasis>main</emphasis></entry>
29022 <entry>Type: <emphasis>boolean</emphasis></entry>
29023 <entry>Default: <emphasis>false</emphasis></entry>
29024 </row>
29025 </tbody>
29026 </tgroup>
29027 </informaltable>
29028 <para>
29029 <indexterm role="concept">
29030 <primary>multiple spool directories</primary>
29031 </indexterm>
29032 <indexterm role="concept">
29033 <primary>spool directory</primary>
29034 <secondary>split</secondary>
29035 </indexterm>
29036 <indexterm role="concept">
29037 <primary>directories, multiple</primary>
29038 </indexterm>
29039 If this option is set, it causes Exim to split its input directory into 62
29040 subdirectories, each with a single alphanumeric character as its name. The
29041 sixth character of the message id is used to allocate messages to
29042 subdirectories; this is the least significant base-62 digit of the time of
29043 arrival of the message.
29044 </para>
29045 <para>
29046 Splitting up the spool in this way may provide better performance on systems
29047 where there are long mail queues, by reducing the number of files in any one
29048 directory. The msglog directory is also split up in a similar way to the input
29049 directory; however, if <option>preserve_message_logs</option> is set, all old msglog files
29050 are still placed in the single directory <filename>msglog.OLD</filename>.
29051 </para>
29052 <para>
29053 It is not necessary to take any special action for existing messages when
29054 changing <option>split_spool_directory</option>. Exim notices messages that are in the
29055 <quote>wrong</quote> place, and continues to process them. If the option is turned off
29056 after a period of being on, the subdirectories will eventually empty and be
29057 automatically deleted.
29058 </para>
29059 <para>
29060 When <option>split_spool_directory</option> is set, the behaviour of queue runner processes
29061 changes. Instead of creating a list of all messages in the queue, and then
29062 trying to deliver each one in turn, it constructs a list of those in one
29063 sub-directory and tries to deliver them, before moving on to the next
29064 sub-directory. The sub-directories are processed in a random order. This
29065 spreads out the scanning of the input directories, and uses less memory. It is
29066 particularly beneficial when there are lots of messages on the queue. However,
29067 if <option>queue_run_in_order</option> is set, none of this new processing happens. The
29068 entire queue has to be scanned and sorted before any deliveries can start.
29069 </para>
29070 <para>
29071 <indexterm role="option">
29072 <primary><option>spool_directory</option></primary>
29073 </indexterm>
29074 </para>
29075 <informaltable frame="all">
29076 <tgroup cols="4" colsep="0" rowsep="0">
29077 <colspec colwidth="8*" align="left"/>
29078 <colspec colwidth="6*" align="center"/>
29079 <colspec colwidth="6*" align="center"/>
29080 <colspec colwidth="6*" align="right"/>
29081 <tbody>
29082 <row>
29083 <entry><option>spool_directory</option></entry>
29084 <entry>Use: <emphasis>main</emphasis></entry>
29085 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
29086 <entry>Default: <emphasis>set at compile time</emphasis></entry>
29087 </row>
29088 </tbody>
29089 </tgroup>
29090 </informaltable>
29091 <para>
29092 <indexterm role="concept">
29093 <primary>spool directory</primary>
29094 <secondary>path to</secondary>
29095 </indexterm>
29096 This defines the directory in which Exim keeps its spool, that is, the messages
29097 it is waiting to deliver. The default value is taken from the compile-time
29098 configuration setting, if there is one. If not, this option must be set. The
29099 string is expanded, so it can contain, for example, a reference to
29100 <varname>$primary_hostname</varname>.
29101 </para>
29102 <para>
29103 If the spool directory name is fixed on your installation, it is recommended
29104 that you set it at build time rather than from this option, particularly if the
29105 log files are being written to the spool directory (see <option>log_file_path</option>).
29106 Otherwise log files cannot be used for errors that are detected early on, such
29107 as failures in the configuration file.
29108 </para>
29109 <para>
29110 By using this option to override the compiled-in path, it is possible to run
29111 tests of Exim without using the standard spool.
29112 </para>
29113 <para>
29114 <indexterm role="option">
29115 <primary><option>sqlite_lock_timeout</option></primary>
29116 </indexterm>
29117 </para>
29118 <informaltable frame="all">
29119 <tgroup cols="4" colsep="0" rowsep="0">
29120 <colspec colwidth="8*" align="left"/>
29121 <colspec colwidth="6*" align="center"/>
29122 <colspec colwidth="6*" align="center"/>
29123 <colspec colwidth="6*" align="right"/>
29124 <tbody>
29125 <row>
29126 <entry><option>sqlite_lock_timeout</option></entry>
29127 <entry>Use: <emphasis>main</emphasis></entry>
29128 <entry>Type: <emphasis>time</emphasis></entry>
29129 <entry>Default: <emphasis>5s</emphasis></entry>
29130 </row>
29131 </tbody>
29132 </tgroup>
29133 </informaltable>
29134 <para>
29135 <indexterm role="concept">
29136 <primary>sqlite lookup type</primary>
29137 <secondary>lock timeout</secondary>
29138 </indexterm>
29139 This option controls the timeout that the <command>sqlite</command> lookup uses when trying to
29140 access an SQLite database. See section <xref linkend="SECTsqlite"/> for more details.
29141 </para>
29142 <para>
29143 <indexterm role="option">
29144 <primary><option>strict_acl_vars</option></primary>
29145 </indexterm>
29146 </para>
29147 <informaltable frame="all">
29148 <tgroup cols="4" colsep="0" rowsep="0">
29149 <colspec colwidth="8*" align="left"/>
29150 <colspec colwidth="6*" align="center"/>
29151 <colspec colwidth="6*" align="center"/>
29152 <colspec colwidth="6*" align="right"/>
29153 <tbody>
29154 <row>
29155 <entry><option>strict_acl_vars</option></entry>
29156 <entry>Use: <emphasis>main</emphasis></entry>
29157 <entry>Type: <emphasis>boolean</emphasis></entry>
29158 <entry>Default: <emphasis>false</emphasis></entry>
29159 </row>
29160 </tbody>
29161 </tgroup>
29162 </informaltable>
29163 <para>
29164 <indexterm role="concept">
29165 <primary>access control lists (ACLs)</primary>
29166 <secondary>variables, handling unset</secondary>
29167 </indexterm>
29168 This option controls what happens if a syntactically valid but undefined ACL
29169 variable is referenced. If it is false (the default), an empty string
29170 is substituted; if it is true, an error is generated. See section
29171 <xref linkend="SECTaclvariables"/> for details of ACL variables.
29172 </para>
29173 <para>
29174 <indexterm role="option">
29175 <primary><option>strip_excess_angle_brackets</option></primary>
29176 </indexterm>
29177 </para>
29178 <informaltable frame="all">
29179 <tgroup cols="4" colsep="0" rowsep="0">
29180 <colspec colwidth="8*" align="left"/>
29181 <colspec colwidth="6*" align="center"/>
29182 <colspec colwidth="6*" align="center"/>
29183 <colspec colwidth="6*" align="right"/>
29184 <tbody>
29185 <row>
29186 <entry><option>strip_excess_angle_brackets</option></entry>
29187 <entry>Use: <emphasis>main</emphasis></entry>
29188 <entry>Type: <emphasis>boolean</emphasis></entry>
29189 <entry>Default: <emphasis>false</emphasis></entry>
29190 </row>
29191 </tbody>
29192 </tgroup>
29193 </informaltable>
29194 <para>
29195 <indexterm role="concept">
29196 <primary>angle brackets, excess</primary>
29197 </indexterm>
29198 If this option is set, redundant pairs of angle brackets round <quote>route-addr</quote>
29199 items in addresses are stripped. For example, <emphasis>&lt;&lt;xxx@a.b.c.d&gt;&gt;</emphasis> is
29200 treated as <emphasis>&lt;xxx@a.b.c.d&gt;</emphasis>. If this is in the envelope and the message is
29201 passed on to another MTA, the excess angle brackets are not passed on. If this
29202 option is not set, multiple pairs of angle brackets cause a syntax error.
29203 </para>
29204 <para>
29205 <indexterm role="option">
29206 <primary><option>strip_trailing_dot</option></primary>
29207 </indexterm>
29208 </para>
29209 <informaltable frame="all">
29210 <tgroup cols="4" colsep="0" rowsep="0">
29211 <colspec colwidth="8*" align="left"/>
29212 <colspec colwidth="6*" align="center"/>
29213 <colspec colwidth="6*" align="center"/>
29214 <colspec colwidth="6*" align="right"/>
29215 <tbody>
29216 <row>
29217 <entry><option>strip_trailing_dot</option></entry>
29218 <entry>Use: <emphasis>main</emphasis></entry>
29219 <entry>Type: <emphasis>boolean</emphasis></entry>
29220 <entry>Default: <emphasis>false</emphasis></entry>
29221 </row>
29222 </tbody>
29223 </tgroup>
29224 </informaltable>
29225 <para>
29226 <indexterm role="concept">
29227 <primary>trailing dot on domain</primary>
29228 </indexterm>
29229 <indexterm role="concept">
29230 <primary>dot</primary>
29231 <secondary>trailing on domain</secondary>
29232 </indexterm>
29233 If this option is set, a trailing dot at the end of a domain in an address is
29234 ignored. If this is in the envelope and the message is passed on to another
29235 MTA, the dot is not passed on. If this option is not set, a dot at the end of a
29236 domain causes a syntax error.
29237 However, addresses in header lines are checked only when an ACL requests header
29238 syntax checking.
29239 </para>
29240 <para>
29241 <indexterm role="option">
29242 <primary><option>syslog_duplication</option></primary>
29243 </indexterm>
29244 </para>
29245 <informaltable frame="all">
29246 <tgroup cols="4" colsep="0" rowsep="0">
29247 <colspec colwidth="8*" align="left"/>
29248 <colspec colwidth="6*" align="center"/>
29249 <colspec colwidth="6*" align="center"/>
29250 <colspec colwidth="6*" align="right"/>
29251 <tbody>
29252 <row>
29253 <entry><option>syslog_duplication</option></entry>
29254 <entry>Use: <emphasis>main</emphasis></entry>
29255 <entry>Type: <emphasis>boolean</emphasis></entry>
29256 <entry>Default: <emphasis>true</emphasis></entry>
29257 </row>
29258 </tbody>
29259 </tgroup>
29260 </informaltable>
29261 <para>
29262 <indexterm role="concept">
29263 <primary>syslog</primary>
29264 <secondary>duplicate log lines; suppressing</secondary>
29265 </indexterm>
29266 When Exim is logging to syslog, it writes the log lines for its three
29267 separate logs at different syslog priorities so that they can in principle
29268 be separated on the logging hosts. Some installations do not require this
29269 separation, and in those cases, the duplication of certain log lines is a
29270 nuisance. If <option>syslog_duplication</option> is set false, only one copy of any
29271 particular log line is written to syslog. For lines that normally go to
29272 both the main log and the reject log, the reject log version (possibly
29273 containing message header lines) is written, at LOG_NOTICE priority.
29274 Lines that normally go to both the main and the panic log are written at
29275 the LOG_ALERT priority.
29276 </para>
29277 <para>
29278 <indexterm role="option">
29279 <primary><option>syslog_facility</option></primary>
29280 </indexterm>
29281 </para>
29282 <informaltable frame="all">
29283 <tgroup cols="4" colsep="0" rowsep="0">
29284 <colspec colwidth="8*" align="left"/>
29285 <colspec colwidth="6*" align="center"/>
29286 <colspec colwidth="6*" align="center"/>
29287 <colspec colwidth="6*" align="right"/>
29288 <tbody>
29289 <row>
29290 <entry><option>syslog_facility</option></entry>
29291 <entry>Use: <emphasis>main</emphasis></entry>
29292 <entry>Type: <emphasis>string</emphasis></entry>
29293 <entry>Default: <emphasis>unset</emphasis></entry>
29294 </row>
29295 </tbody>
29296 </tgroup>
29297 </informaltable>
29298 <para>
29299 <indexterm role="concept">
29300 <primary>syslog</primary>
29301 <secondary>facility; setting</secondary>
29302 </indexterm>
29303 This option sets the syslog <quote>facility</quote> name, used when Exim is logging to
29304 syslog. The value must be one of the strings <quote>mail</quote>, <quote>user</quote>, <quote>news</quote>,
29305 <quote>uucp</quote>, <quote>daemon</quote>, or <quote>local<emphasis>x</emphasis></quote> where <emphasis>x</emphasis> is a digit between 0 and 7.
29306 If this option is unset, <quote>mail</quote> is used. See chapter <xref linkend="CHAPlog"/> for
29307 details of Exim&#x2019;s logging.
29308 </para>
29309 <para>
29310 <indexterm role="option">
29311 <primary><option>syslog_processname</option></primary>
29312 </indexterm>
29313 </para>
29314 <informaltable frame="all">
29315 <tgroup cols="4" colsep="0" rowsep="0">
29316 <colspec colwidth="8*" align="left"/>
29317 <colspec colwidth="6*" align="center"/>
29318 <colspec colwidth="6*" align="center"/>
29319 <colspec colwidth="6*" align="right"/>
29320 <tbody>
29321 <row>
29322 <entry><option>syslog_processname</option></entry>
29323 <entry>Use: <emphasis>main</emphasis></entry>
29324 <entry>Type: <emphasis>string</emphasis></entry>
29325 <entry>Default: <emphasis><literal>exim</literal></emphasis></entry>
29326 </row>
29327 </tbody>
29328 </tgroup>
29329 </informaltable>
29330 <para>
29331 <indexterm role="concept">
29332 <primary>syslog</primary>
29333 <secondary>process name; setting</secondary>
29334 </indexterm>
29335 This option sets the syslog <quote>ident</quote> name, used when Exim is logging to
29336 syslog. The value must be no longer than 32 characters. See chapter
29337 <xref linkend="CHAPlog"/> for details of Exim&#x2019;s logging.
29338 </para>
29339 <para>
29340 <indexterm role="option">
29341 <primary><option>syslog_timestamp</option></primary>
29342 </indexterm>
29343 </para>
29344 <informaltable frame="all">
29345 <tgroup cols="4" colsep="0" rowsep="0">
29346 <colspec colwidth="8*" align="left"/>
29347 <colspec colwidth="6*" align="center"/>
29348 <colspec colwidth="6*" align="center"/>
29349 <colspec colwidth="6*" align="right"/>
29350 <tbody>
29351 <row>
29352 <entry><option>syslog_timestamp</option></entry>
29353 <entry>Use: <emphasis>main</emphasis></entry>
29354 <entry>Type: <emphasis>boolean</emphasis></entry>
29355 <entry>Default: <emphasis>true</emphasis></entry>
29356 </row>
29357 </tbody>
29358 </tgroup>
29359 </informaltable>
29360 <para>
29361 <indexterm role="concept">
29362 <primary>syslog</primary>
29363 <secondary>timestamps</secondary>
29364 </indexterm>
29365 If <option>syslog_timestamp</option> is set false, the timestamps on Exim&#x2019;s log lines are
29366 omitted when these lines are sent to syslog. See chapter <xref linkend="CHAPlog"/> for
29367 details of Exim&#x2019;s logging.
29368 </para>
29369 <para>
29370 <indexterm role="option">
29371 <primary><option>system_filter</option></primary>
29372 </indexterm>
29373 </para>
29374 <informaltable frame="all">
29375 <tgroup cols="4" colsep="0" rowsep="0">
29376 <colspec colwidth="8*" align="left"/>
29377 <colspec colwidth="6*" align="center"/>
29378 <colspec colwidth="6*" align="center"/>
29379 <colspec colwidth="6*" align="right"/>
29380 <tbody>
29381 <row>
29382 <entry><option>system_filter</option></entry>
29383 <entry>Use: <emphasis>main</emphasis></entry>
29384 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
29385 <entry>Default: <emphasis>unset</emphasis></entry>
29386 </row>
29387 </tbody>
29388 </tgroup>
29389 </informaltable>
29390 <para>
29391 <indexterm role="concept">
29392 <primary>filter</primary>
29393 <secondary>system filter</secondary>
29394 </indexterm>
29395 <indexterm role="concept">
29396 <primary>system filter</primary>
29397 <secondary>specifying</secondary>
29398 </indexterm>
29399 <indexterm role="concept">
29400 <primary>Sieve filter</primary>
29401 <secondary>not available for system filter</secondary>
29402 </indexterm>
29403 This option specifies an Exim filter file that is applied to all messages at
29404 the start of each delivery attempt, before any routing is done. System filters
29405 must be Exim filters; they cannot be Sieve filters. If the system filter
29406 generates any deliveries to files or pipes, or any new mail messages, the
29407 appropriate <option>system_filter_..._transport</option> option(s) must be set, to define
29408 which transports are to be used. Details of this facility are given in chapter
29409 <xref linkend="CHAPsystemfilter"/>.
29410 </para>
29411 <para>
29412 <indexterm role="option">
29413 <primary><option>system_filter_directory_transport</option></primary>
29414 </indexterm>
29415 </para>
29416 <informaltable frame="all">
29417 <tgroup cols="4" colsep="0" rowsep="0">
29418 <colspec colwidth="8*" align="left"/>
29419 <colspec colwidth="6*" align="center"/>
29420 <colspec colwidth="6*" align="center"/>
29421 <colspec colwidth="6*" align="right"/>
29422 <tbody>
29423 <row>
29424 <entry><option>system_filter_directory_transport</option></entry>
29425 <entry>Use: <emphasis>main</emphasis></entry>
29426 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
29427 <entry>Default: <emphasis>unset</emphasis></entry>
29428 </row>
29429 </tbody>
29430 </tgroup>
29431 </informaltable>
29432 <para>
29433 <indexterm role="variable">
29434 <primary><varname>$address_file</varname></primary>
29435 </indexterm>
29436 This sets the name of the transport driver that is to be used when the
29437 <option>save</option> command in a system message filter specifies a path ending in <quote>/</quote>,
29438 implying delivery of each message into a separate file in some directory.
29439 During the delivery, the variable <varname>$address_file</varname> contains the path name.
29440 </para>
29441 <para>
29442 <indexterm role="option">
29443 <primary><option>system_filter_file_transport</option></primary>
29444 </indexterm>
29445 </para>
29446 <informaltable frame="all">
29447 <tgroup cols="4" colsep="0" rowsep="0">
29448 <colspec colwidth="8*" align="left"/>
29449 <colspec colwidth="6*" align="center"/>
29450 <colspec colwidth="6*" align="center"/>
29451 <colspec colwidth="6*" align="right"/>
29452 <tbody>
29453 <row>
29454 <entry><option>system_filter_file_transport</option></entry>
29455 <entry>Use: <emphasis>main</emphasis></entry>
29456 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
29457 <entry>Default: <emphasis>unset</emphasis></entry>
29458 </row>
29459 </tbody>
29460 </tgroup>
29461 </informaltable>
29462 <para>
29463 <indexterm role="concept">
29464 <primary>file</primary>
29465 <secondary>transport for system filter</secondary>
29466 </indexterm>
29467 This sets the name of the transport driver that is to be used when the <option>save</option>
29468 command in a system message filter specifies a path not ending in <quote>/</quote>. During
29469 the delivery, the variable <varname>$address_file</varname> contains the path name.
29470 </para>
29471 <para>
29472 <indexterm role="option">
29473 <primary><option>system_filter_group</option></primary>
29474 </indexterm>
29475 </para>
29476 <informaltable frame="all">
29477 <tgroup cols="4" colsep="0" rowsep="0">
29478 <colspec colwidth="8*" align="left"/>
29479 <colspec colwidth="6*" align="center"/>
29480 <colspec colwidth="6*" align="center"/>
29481 <colspec colwidth="6*" align="right"/>
29482 <tbody>
29483 <row>
29484 <entry><option>system_filter_group</option></entry>
29485 <entry>Use: <emphasis>main</emphasis></entry>
29486 <entry>Type: <emphasis>string</emphasis></entry>
29487 <entry>Default: <emphasis>unset</emphasis></entry>
29488 </row>
29489 </tbody>
29490 </tgroup>
29491 </informaltable>
29492 <para>
29493 <indexterm role="concept">
29494 <primary>gid (group id)</primary>
29495 <secondary>system filter</secondary>
29496 </indexterm>
29497 This option is used only when <option>system_filter_user</option> is also set. It sets the
29498 gid under which the system filter is run, overriding any gid that is associated
29499 with the user. The value may be numerical or symbolic.
29500 </para>
29501 <para>
29502 <indexterm role="option">
29503 <primary><option>system_filter_pipe_transport</option></primary>
29504 </indexterm>
29505 </para>
29506 <informaltable frame="all">
29507 <tgroup cols="4" colsep="0" rowsep="0">
29508 <colspec colwidth="8*" align="left"/>
29509 <colspec colwidth="6*" align="center"/>
29510 <colspec colwidth="6*" align="center"/>
29511 <colspec colwidth="6*" align="right"/>
29512 <tbody>
29513 <row>
29514 <entry><option>system_filter_pipe_transport</option></entry>
29515 <entry>Use: <emphasis>main</emphasis></entry>
29516 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
29517 <entry>Default: <emphasis>unset</emphasis></entry>
29518 </row>
29519 </tbody>
29520 </tgroup>
29521 </informaltable>
29522 <para>
29523 <indexterm role="concept">
29524 <primary><command>pipe</command> transport</primary>
29525 <secondary>for system filter</secondary>
29526 </indexterm>
29527 <indexterm role="variable">
29528 <primary><varname>$address_pipe</varname></primary>
29529 </indexterm>
29530 This specifies the transport driver that is to be used when a <option>pipe</option> command
29531 is used in a system filter. During the delivery, the variable <varname>$address_pipe</varname>
29532 contains the pipe command.
29533 </para>
29534 <para>
29535 <indexterm role="option">
29536 <primary><option>system_filter_reply_transport</option></primary>
29537 </indexterm>
29538 </para>
29539 <informaltable frame="all">
29540 <tgroup cols="4" colsep="0" rowsep="0">
29541 <colspec colwidth="8*" align="left"/>
29542 <colspec colwidth="6*" align="center"/>
29543 <colspec colwidth="6*" align="center"/>
29544 <colspec colwidth="6*" align="right"/>
29545 <tbody>
29546 <row>
29547 <entry><option>system_filter_reply_transport</option></entry>
29548 <entry>Use: <emphasis>main</emphasis></entry>
29549 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
29550 <entry>Default: <emphasis>unset</emphasis></entry>
29551 </row>
29552 </tbody>
29553 </tgroup>
29554 </informaltable>
29555 <para>
29556 <indexterm role="concept">
29557 <primary><command>autoreply</command> transport</primary>
29558 <secondary>for system filter</secondary>
29559 </indexterm>
29560 This specifies the transport driver that is to be used when a <option>mail</option> command
29561 is used in a system filter.
29562 </para>
29563 <para>
29564 <indexterm role="option">
29565 <primary><option>system_filter_user</option></primary>
29566 </indexterm>
29567 </para>
29568 <informaltable frame="all">
29569 <tgroup cols="4" colsep="0" rowsep="0">
29570 <colspec colwidth="8*" align="left"/>
29571 <colspec colwidth="6*" align="center"/>
29572 <colspec colwidth="6*" align="center"/>
29573 <colspec colwidth="6*" align="right"/>
29574 <tbody>
29575 <row>
29576 <entry><option>system_filter_user</option></entry>
29577 <entry>Use: <emphasis>main</emphasis></entry>
29578 <entry>Type: <emphasis>string</emphasis></entry>
29579 <entry>Default: <emphasis>unset</emphasis></entry>
29580 </row>
29581 </tbody>
29582 </tgroup>
29583 </informaltable>
29584 <para>
29585 <indexterm role="concept">
29586 <primary>uid (user id)</primary>
29587 <secondary>system filter</secondary>
29588 </indexterm>
29589 If this option is set to root, the system filter is run in the main Exim
29590 delivery process, as root.  Otherwise, the system filter runs in a separate
29591 process, as the given user, defaulting to the Exim run-time user.
29592 Unless the string consists entirely of digits, it
29593 is looked up in the password data. Failure to find the named user causes a
29594 configuration error. The gid is either taken from the password data, or
29595 specified by <option>system_filter_group</option>. When the uid is specified numerically,
29596 <option>system_filter_group</option> is required to be set.
29597 </para>
29598 <para>
29599 If the system filter generates any pipe, file, or reply deliveries, the uid
29600 under which the filter is run is used when transporting them, unless a
29601 transport option overrides.
29602 </para>
29603 <para>
29604 <indexterm role="option">
29605 <primary><option>tcp_nodelay</option></primary>
29606 </indexterm>
29607 </para>
29608 <informaltable frame="all">
29609 <tgroup cols="4" colsep="0" rowsep="0">
29610 <colspec colwidth="8*" align="left"/>
29611 <colspec colwidth="6*" align="center"/>
29612 <colspec colwidth="6*" align="center"/>
29613 <colspec colwidth="6*" align="right"/>
29614 <tbody>
29615 <row>
29616 <entry><option>tcp_nodelay</option></entry>
29617 <entry>Use: <emphasis>main</emphasis></entry>
29618 <entry>Type: <emphasis>boolean</emphasis></entry>
29619 <entry>Default: <emphasis>true</emphasis></entry>
29620 </row>
29621 </tbody>
29622 </tgroup>
29623 </informaltable>
29624 <para>
29625 <indexterm role="concept">
29626 <primary>daemon</primary>
29627 <secondary>TCP_NODELAY on sockets</secondary>
29628 </indexterm>
29629 <indexterm role="concept">
29630 <primary>Nagle algorithm</primary>
29631 </indexterm>
29632 <indexterm role="concept">
29633 <primary>TCP_NODELAY on listening sockets</primary>
29634 </indexterm>
29635 If this option is set false, it stops the Exim daemon setting the
29636 TCP_NODELAY option on its listening sockets. Setting TCP_NODELAY
29637 turns off the <quote>Nagle algorithm</quote>, which is a way of improving network
29638 performance in interactive (character-by-character) situations. Turning it off
29639 should improve Exim&#x2019;s performance a bit, so that is what happens by default.
29640 However, it appears that some broken clients cannot cope, and time out. Hence
29641 this option. It affects only those sockets that are set up for listening by the
29642 daemon. Sockets created by the smtp transport for delivering mail always set
29643 TCP_NODELAY.
29644 </para>
29645 <para>
29646 <indexterm role="option">
29647 <primary><option>timeout_frozen_after</option></primary>
29648 </indexterm>
29649 </para>
29650 <informaltable frame="all">
29651 <tgroup cols="4" colsep="0" rowsep="0">
29652 <colspec colwidth="8*" align="left"/>
29653 <colspec colwidth="6*" align="center"/>
29654 <colspec colwidth="6*" align="center"/>
29655 <colspec colwidth="6*" align="right"/>
29656 <tbody>
29657 <row>
29658 <entry><option>timeout_frozen_after</option></entry>
29659 <entry>Use: <emphasis>main</emphasis></entry>
29660 <entry>Type: <emphasis>time</emphasis></entry>
29661 <entry>Default: <emphasis>0s</emphasis></entry>
29662 </row>
29663 </tbody>
29664 </tgroup>
29665 </informaltable>
29666 <para>
29667 <indexterm role="concept">
29668 <primary>frozen messages</primary>
29669 <secondary>timing out</secondary>
29670 </indexterm>
29671 <indexterm role="concept">
29672 <primary>timeout</primary>
29673 <secondary>frozen messages</secondary>
29674 </indexterm>
29675 If <option>timeout_frozen_after</option> is set to a time greater than zero, a frozen
29676 message of any kind that has been on the queue for longer than the given time
29677 is automatically cancelled at the next queue run. If the frozen message is a
29678 bounce message, it is just discarded; otherwise, a bounce is sent to the
29679 sender, in a similar manner to cancellation by the <option>-Mg</option> command line option.
29680 If you want to timeout frozen bounce messages earlier than other kinds of
29681 frozen message, see <option>ignore_bounce_errors_after</option>.
29682 </para>
29683 <para>
29684 <emphasis role="bold">Note:</emphasis> the default value of zero means no timeouts; with this setting,
29685 frozen messages remain on the queue forever (except for any frozen bounce
29686 messages that are released by <option>ignore_bounce_errors_after</option>).
29687 </para>
29688 <para>
29689 <indexterm role="option">
29690 <primary><option>timezone</option></primary>
29691 </indexterm>
29692 </para>
29693 <informaltable frame="all">
29694 <tgroup cols="4" colsep="0" rowsep="0">
29695 <colspec colwidth="8*" align="left"/>
29696 <colspec colwidth="6*" align="center"/>
29697 <colspec colwidth="6*" align="center"/>
29698 <colspec colwidth="6*" align="right"/>
29699 <tbody>
29700 <row>
29701 <entry><option>timezone</option></entry>
29702 <entry>Use: <emphasis>main</emphasis></entry>
29703 <entry>Type: <emphasis>string</emphasis></entry>
29704 <entry>Default: <emphasis>unset</emphasis></entry>
29705 </row>
29706 </tbody>
29707 </tgroup>
29708 </informaltable>
29709 <para>
29710 <indexterm role="concept">
29711 <primary>timezone, setting</primary>
29712 </indexterm>
29713 The value of <option>timezone</option> is used to set the environment variable TZ while
29714 running Exim (if it is different on entry). This ensures that all timestamps
29715 created by Exim are in the required timezone. If you want all your timestamps
29716 to be in UTC (aka GMT) you should set
29717 </para>
29718 <literallayout class="monospaced">
29719 timezone = UTC
29720 </literallayout>
29721 <para>
29722 The default value is taken from TIMEZONE_DEFAULT in <filename>Local/Makefile</filename>,
29723 or, if that is not set, from the value of the TZ environment variable when Exim
29724 is built. If <option>timezone</option> is set to the empty string, either at build or run
29725 time, any existing TZ variable is removed from the environment when Exim
29726 runs. This is appropriate behaviour for obtaining wall-clock time on some, but
29727 unfortunately not all, operating systems.
29728 </para>
29729 <para>
29730 <indexterm role="option">
29731 <primary><option>tls_advertise_hosts</option></primary>
29732 </indexterm>
29733 </para>
29734 <informaltable frame="all">
29735 <tgroup cols="4" colsep="0" rowsep="0">
29736 <colspec colwidth="8*" align="left"/>
29737 <colspec colwidth="6*" align="center"/>
29738 <colspec colwidth="6*" align="center"/>
29739 <colspec colwidth="6*" align="right"/>
29740 <tbody>
29741 <row>
29742 <entry><option>tls_advertise_hosts</option></entry>
29743 <entry>Use: <emphasis>main</emphasis></entry>
29744 <entry>Type: <emphasis>host list</emphasis>&dagger;<emphasis></emphasis></entry>
29745 <entry>Default: <emphasis>unset</emphasis></entry>
29746 </row>
29747 </tbody>
29748 </tgroup>
29749 </informaltable>
29750 <para>
29751 <indexterm role="concept">
29752 <primary>TLS</primary>
29753 <secondary>advertising</secondary>
29754 </indexterm>
29755 <indexterm role="concept">
29756 <primary>encryption</primary>
29757 <secondary>on SMTP connection</secondary>
29758 </indexterm>
29759 <indexterm role="concept">
29760 <primary>SMTP</primary>
29761 <secondary>encrypted connection</secondary>
29762 </indexterm>
29763 When Exim is built with support for TLS encrypted connections, the availability
29764 of the STARTTLS command to set up an encrypted session is advertised in
29765 response to EHLO only to those client hosts that match this option. See
29766 chapter <xref linkend="CHAPTLS"/> for details of Exim&#x2019;s support for TLS.
29767 </para>
29768 <para>
29769 <indexterm role="option">
29770 <primary><option>tls_certificate</option></primary>
29771 </indexterm>
29772 </para>
29773 <informaltable frame="all">
29774 <tgroup cols="4" colsep="0" rowsep="0">
29775 <colspec colwidth="8*" align="left"/>
29776 <colspec colwidth="6*" align="center"/>
29777 <colspec colwidth="6*" align="center"/>
29778 <colspec colwidth="6*" align="right"/>
29779 <tbody>
29780 <row>
29781 <entry><option>tls_certificate</option></entry>
29782 <entry>Use: <emphasis>main</emphasis></entry>
29783 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
29784 <entry>Default: <emphasis>unset</emphasis></entry>
29785 </row>
29786 </tbody>
29787 </tgroup>
29788 </informaltable>
29789 <para>
29790 <indexterm role="concept">
29791 <primary>TLS</primary>
29792 <secondary>server certificate; location of</secondary>
29793 </indexterm>
29794 <indexterm role="concept">
29795 <primary>certificate</primary>
29796 <secondary>server, location of</secondary>
29797 </indexterm>
29798 The value of this option is expanded, and must then be the absolute path to a
29799 file which contains the server&#x2019;s certificates. The server&#x2019;s private key is also
29800 assumed to be in this file if <option>tls_privatekey</option> is unset. See chapter
29801 <xref linkend="CHAPTLS"/> for further details.
29802 </para>
29803 <para>
29804 <emphasis role="bold">Note</emphasis>: The certificates defined by this option are used only when Exim is
29805 receiving incoming messages as a server. If you want to supply certificates for
29806 use when sending messages as a client, you must set the <option>tls_certificate</option>
29807 option in the relevant <command>smtp</command> transport.
29808 </para>
29809 <para>
29810 If the option contains <varname>$tls_out_sni</varname> and Exim is built against OpenSSL, then
29811 if the OpenSSL build supports TLS extensions and the TLS client sends the
29812 Server Name Indication extension, then this option and others documented in
29813 <xref linkend="SECTtlssni"/> will be re-expanded.
29814 </para>
29815 <para>
29816 <indexterm role="option">
29817 <primary><option>tls_crl</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>tls_crl</option></entry>
29829 <entry>Use: <emphasis>main</emphasis></entry>
29830 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
29831 <entry>Default: <emphasis>unset</emphasis></entry>
29832 </row>
29833 </tbody>
29834 </tgroup>
29835 </informaltable>
29836 <para>
29837 <indexterm role="concept">
29838 <primary>TLS</primary>
29839 <secondary>server certificate revocation list</secondary>
29840 </indexterm>
29841 <indexterm role="concept">
29842 <primary>certificate</primary>
29843 <secondary>revocation list for server</secondary>
29844 </indexterm>
29845 This option specifies a certificate revocation list. The expanded value must
29846 be the name of a file that contains a CRL in PEM format.
29847 </para>
29848 <para>
29849 See <xref linkend="SECTtlssni"/> for discussion of when this option might be re-expanded.
29850 </para>
29851 <para>
29852 <indexterm role="option">
29853 <primary><option>tls_dh_max_bits</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>tls_dh_max_bits</option></entry>
29865 <entry>Use: <emphasis>main</emphasis></entry>
29866 <entry>Type: <emphasis>integer</emphasis></entry>
29867 <entry>Default: <emphasis>2236</emphasis></entry>
29868 </row>
29869 </tbody>
29870 </tgroup>
29871 </informaltable>
29872 <para>
29873 <indexterm role="concept">
29874 <primary>TLS</primary>
29875 <secondary>D-H bit count</secondary>
29876 </indexterm>
29877 The number of bits used for Diffie-Hellman key-exchange may be suggested by
29878 the chosen TLS library.  That value might prove to be too high for
29879 interoperability.  This option provides a maximum clamp on the value
29880 suggested, trading off security for interoperability.
29881 </para>
29882 <para>
29883 The value must be at least 1024.
29884 </para>
29885 <para>
29886 The value 2236 was chosen because, at time of adding the option, it was the
29887 hard-coded maximum value supported by the NSS cryptographic library, as used
29888 by Thunderbird, while GnuTLS was suggesting 2432 bits as normal.
29889 </para>
29890 <para>
29891 If you prefer more security and are willing to break some clients, raise this
29892 number.
29893 </para>
29894 <para>
29895 Note that the value passed to GnuTLS for *generating* a new prime may be a
29896 little less than this figure, because GnuTLS is inexact and may produce a
29897 larger prime than requested.
29898 </para>
29899 <para>
29900 <indexterm role="option">
29901 <primary><option>tls_dhparam</option></primary>
29902 </indexterm>
29903 </para>
29904 <informaltable frame="all">
29905 <tgroup cols="4" colsep="0" rowsep="0">
29906 <colspec colwidth="8*" align="left"/>
29907 <colspec colwidth="6*" align="center"/>
29908 <colspec colwidth="6*" align="center"/>
29909 <colspec colwidth="6*" align="right"/>
29910 <tbody>
29911 <row>
29912 <entry><option>tls_dhparam</option></entry>
29913 <entry>Use: <emphasis>main</emphasis></entry>
29914 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
29915 <entry>Default: <emphasis>unset</emphasis></entry>
29916 </row>
29917 </tbody>
29918 </tgroup>
29919 </informaltable>
29920 <para>
29921 <indexterm role="concept">
29922 <primary>TLS</primary>
29923 <secondary>D-H parameters for server</secondary>
29924 </indexterm>
29925 The value of this option is expanded and indicates the source of DH parameters
29926 to be used by Exim.
29927 </para>
29928 <para>
29929 If it is a filename starting with a <literal>/</literal>, then it names a file from which DH
29930 parameters should be loaded.  If the file exists, it should hold a PEM-encoded
29931 PKCS#3 representation of the DH prime.  If the file does not exist, for
29932 OpenSSL it is an error.  For GnuTLS, Exim will attempt to create the file and
29933 fill it with a generated DH prime.  For OpenSSL, if the DH bit-count from
29934 loading the file is greater than <option>tls_dh_max_bits</option> then it will be ignored,
29935 and treated as though the <option>tls_dhparam</option> were set to "none".
29936 </para>
29937 <para>
29938 If this option expands to the string "none", then no DH parameters will be
29939 loaded by Exim.
29940 </para>
29941 <para>
29942 If this option expands to the string "historic" and Exim is using GnuTLS, then
29943 Exim will attempt to load a file from inside the spool directory.  If the file
29944 does not exist, Exim will attempt to create it.
29945 See section <xref linkend="SECTgnutlsparam"/> for further details.
29946 </para>
29947 <para>
29948 If Exim is using OpenSSL and this option is empty or unset, then Exim will load
29949 a default DH prime; the default is the 2048 bit prime described in section
29950 2.2 of RFC 5114, "2048-bit MODP Group with 224-bit Prime Order Subgroup", which
29951 in IKE is assigned number 23.
29952 </para>
29953 <para>
29954 Otherwise, the option must expand to the name used by Exim for any of a number
29955 of DH primes specified in RFC 2409, RFC 3526 and RFC 5114.  As names, Exim uses
29956 "ike" followed by the number used by IKE, of "default" which corresponds to
29957 "ike23".
29958 </para>
29959 <para>
29960 The available primes are:
29961 <literal>ike1</literal>, <literal>ike2</literal>, <literal>ike5</literal>,
29962 <literal>ike14</literal>, <literal>ike15</literal>, <literal>ike16</literal>, <literal>ike17</literal>, <literal>ike18</literal>,
29963 <literal>ike22</literal>, <literal>ike23</literal> (aka <literal>default</literal>) and <literal>ike24</literal>.
29964 </para>
29965 <para>
29966 Some of these will be too small to be accepted by clients.
29967 Some may be too large to be accepted by clients.
29968 </para>
29969 <para>
29970 The TLS protocol does not negotiate an acceptable size for this; clients tend
29971 to hard-drop connections if what is offered by the server is unacceptable,
29972 whether too large or too small, and there&#x2019;s no provision for the client to
29973 tell the server what these constraints are.  Thus, as a server operator, you
29974 need to make an educated guess as to what is most likely to work for your
29975 userbase.
29976 </para>
29977 <para>
29978 Some known size constraints suggest that a bit-size in the range 2048 to 2236
29979 is most likely to maximise interoperability.  The upper bound comes from
29980 applications using the Mozilla Network Security Services (NSS) library, which
29981 used to set its <literal>DH_MAX_P_BITS</literal> upper-bound to 2236.  This affects many
29982 mail user agents (MUAs). The lower bound comes from Debian installs of Exim4
29983 prior to the 4.80 release, as Debian used to patch Exim to raise the minimum
29984 acceptable bound from 1024 to 2048.
29985 </para>
29986 <para>
29987 <indexterm role="option">
29988 <primary><option>tls_ocsp_file</option></primary>
29989 </indexterm>
29990 </para>
29991 <informaltable frame="all">
29992 <tgroup cols="4" colsep="0" rowsep="0">
29993 <colspec colwidth="8*" align="left"/>
29994 <colspec colwidth="6*" align="center"/>
29995 <colspec colwidth="6*" align="center"/>
29996 <colspec colwidth="6*" align="right"/>
29997 <tbody>
29998 <row>
29999 <entry><option>tls_ocsp_file</option></entry>
30000 <entry>Use: <emphasis>main</emphasis></entry>
30001 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
30002 <entry>Default: <emphasis>unset</emphasis></entry>
30003 </row>
30004 </tbody>
30005 </tgroup>
30006 </informaltable>
30007 <para>
30008 This option
30009 must if set expand to the absolute path to a file which contains a current
30010 status proof for the server&#x2019;s certificate, as obtained from the
30011 Certificate Authority.
30012 </para>
30013 <para>
30014 <indexterm role="option">
30015 <primary><option>tls_on_connect_ports</option></primary>
30016 </indexterm>
30017 </para>
30018 <informaltable frame="all">
30019 <tgroup cols="4" colsep="0" rowsep="0">
30020 <colspec colwidth="8*" align="left"/>
30021 <colspec colwidth="6*" align="center"/>
30022 <colspec colwidth="6*" align="center"/>
30023 <colspec colwidth="6*" align="right"/>
30024 <tbody>
30025 <row>
30026 <entry><option>tls_on_connect_ports</option></entry>
30027 <entry>Use: <emphasis>main</emphasis></entry>
30028 <entry>Type: <emphasis>string list</emphasis></entry>
30029 <entry>Default: <emphasis>unset</emphasis></entry>
30030 </row>
30031 </tbody>
30032 </tgroup>
30033 </informaltable>
30034 <para>
30035 This option specifies a list of incoming SSMTP (aka SMTPS) ports that should
30036 operate the obsolete SSMTP (SMTPS) protocol, where a TLS session is immediately
30037 set up without waiting for the client to issue a STARTTLS command. For
30038 further details, see section <xref linkend="SECTsupobssmt"/>.
30039 </para>
30040 <para>
30041 <indexterm role="option">
30042 <primary><option>tls_privatekey</option></primary>
30043 </indexterm>
30044 </para>
30045 <informaltable frame="all">
30046 <tgroup cols="4" colsep="0" rowsep="0">
30047 <colspec colwidth="8*" align="left"/>
30048 <colspec colwidth="6*" align="center"/>
30049 <colspec colwidth="6*" align="center"/>
30050 <colspec colwidth="6*" align="right"/>
30051 <tbody>
30052 <row>
30053 <entry><option>tls_privatekey</option></entry>
30054 <entry>Use: <emphasis>main</emphasis></entry>
30055 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
30056 <entry>Default: <emphasis>unset</emphasis></entry>
30057 </row>
30058 </tbody>
30059 </tgroup>
30060 </informaltable>
30061 <para>
30062 <indexterm role="concept">
30063 <primary>TLS</primary>
30064 <secondary>server private key; location of</secondary>
30065 </indexterm>
30066 The value of this option is expanded, and must then be the absolute path to a
30067 file which contains the server&#x2019;s private key. If this option is unset, or if
30068 the expansion is forced to fail, or the result is an empty string, the private
30069 key is assumed to be in the same file as the server&#x2019;s certificates. See chapter
30070 <xref linkend="CHAPTLS"/> for further details.
30071 </para>
30072 <para>
30073 See <xref linkend="SECTtlssni"/> for discussion of when this option might be re-expanded.
30074 </para>
30075 <para>
30076 <indexterm role="option">
30077 <primary><option>tls_remember_esmtp</option></primary>
30078 </indexterm>
30079 </para>
30080 <informaltable frame="all">
30081 <tgroup cols="4" colsep="0" rowsep="0">
30082 <colspec colwidth="8*" align="left"/>
30083 <colspec colwidth="6*" align="center"/>
30084 <colspec colwidth="6*" align="center"/>
30085 <colspec colwidth="6*" align="right"/>
30086 <tbody>
30087 <row>
30088 <entry><option>tls_remember_esmtp</option></entry>
30089 <entry>Use: <emphasis>main</emphasis></entry>
30090 <entry>Type: <emphasis>boolean</emphasis></entry>
30091 <entry>Default: <emphasis>false</emphasis></entry>
30092 </row>
30093 </tbody>
30094 </tgroup>
30095 </informaltable>
30096 <para>
30097 <indexterm role="concept">
30098 <primary>TLS</primary>
30099 <secondary>esmtp state; remembering</secondary>
30100 </indexterm>
30101 <indexterm role="concept">
30102 <primary>TLS</primary>
30103 <secondary>broken clients</secondary>
30104 </indexterm>
30105 If this option is set true, Exim violates the RFCs by remembering that it is in
30106 <quote>esmtp</quote> state after successfully negotiating a TLS session. This provides
30107 support for broken clients that fail to send a new EHLO after starting a
30108 TLS session.
30109 </para>
30110 <para>
30111 <indexterm role="option">
30112 <primary><option>tls_require_ciphers</option></primary>
30113 </indexterm>
30114 </para>
30115 <informaltable frame="all">
30116 <tgroup cols="4" colsep="0" rowsep="0">
30117 <colspec colwidth="8*" align="left"/>
30118 <colspec colwidth="6*" align="center"/>
30119 <colspec colwidth="6*" align="center"/>
30120 <colspec colwidth="6*" align="right"/>
30121 <tbody>
30122 <row>
30123 <entry><option>tls_require_ciphers</option></entry>
30124 <entry>Use: <emphasis>main</emphasis></entry>
30125 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
30126 <entry>Default: <emphasis>unset</emphasis></entry>
30127 </row>
30128 </tbody>
30129 </tgroup>
30130 </informaltable>
30131 <para>
30132 <indexterm role="concept">
30133 <primary>TLS</primary>
30134 <secondary>requiring specific ciphers</secondary>
30135 </indexterm>
30136 <indexterm role="concept">
30137 <primary>cipher</primary>
30138 <secondary>requiring specific</secondary>
30139 </indexterm>
30140 This option controls which ciphers can be used for incoming TLS connections.
30141 The <command>smtp</command> transport has an option of the same name for controlling outgoing
30142 connections. This option is expanded for each connection, so can be varied for
30143 different clients if required. The value of this option must be a list of
30144 permitted cipher suites. The OpenSSL and GnuTLS libraries handle cipher control
30145 in somewhat different ways. If GnuTLS is being used, the client controls the
30146 preference order of the available ciphers. Details are given in sections
30147 <xref linkend="SECTreqciphssl"/> and <xref linkend="SECTreqciphgnu"/>.
30148 </para>
30149 <para>
30150 <indexterm role="option">
30151 <primary><option>tls_try_verify_hosts</option></primary>
30152 </indexterm>
30153 </para>
30154 <informaltable frame="all">
30155 <tgroup cols="4" colsep="0" rowsep="0">
30156 <colspec colwidth="8*" align="left"/>
30157 <colspec colwidth="6*" align="center"/>
30158 <colspec colwidth="6*" align="center"/>
30159 <colspec colwidth="6*" align="right"/>
30160 <tbody>
30161 <row>
30162 <entry><option>tls_try_verify_hosts</option></entry>
30163 <entry>Use: <emphasis>main</emphasis></entry>
30164 <entry>Type: <emphasis>host list</emphasis>&dagger;<emphasis></emphasis></entry>
30165 <entry>Default: <emphasis>unset</emphasis></entry>
30166 </row>
30167 </tbody>
30168 </tgroup>
30169 </informaltable>
30170 <para>
30171 <indexterm role="concept">
30172 <primary>TLS</primary>
30173 <secondary>client certificate verification</secondary>
30174 </indexterm>
30175 <indexterm role="concept">
30176 <primary>certificate</primary>
30177 <secondary>verification of client</secondary>
30178 </indexterm>
30179 See <option>tls_verify_hosts</option> below.
30180 </para>
30181 <para>
30182 <indexterm role="option">
30183 <primary><option>tls_verify_certificates</option></primary>
30184 </indexterm>
30185 </para>
30186 <informaltable frame="all">
30187 <tgroup cols="4" colsep="0" rowsep="0">
30188 <colspec colwidth="8*" align="left"/>
30189 <colspec colwidth="6*" align="center"/>
30190 <colspec colwidth="6*" align="center"/>
30191 <colspec colwidth="6*" align="right"/>
30192 <tbody>
30193 <row>
30194 <entry><option>tls_verify_certificates</option></entry>
30195 <entry>Use: <emphasis>main</emphasis></entry>
30196 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
30197 <entry>Default: <emphasis>unset</emphasis></entry>
30198 </row>
30199 </tbody>
30200 </tgroup>
30201 </informaltable>
30202 <para>
30203 <indexterm role="concept">
30204 <primary>TLS</primary>
30205 <secondary>client certificate verification</secondary>
30206 </indexterm>
30207 <indexterm role="concept">
30208 <primary>certificate</primary>
30209 <secondary>verification of client</secondary>
30210 </indexterm>
30211 The value of this option is expanded, and must then be the absolute path to
30212 a file containing permitted certificates for clients that
30213 match <option>tls_verify_hosts</option> or <option>tls_try_verify_hosts</option>. Alternatively, if you
30214 are using OpenSSL, you can set <option>tls_verify_certificates</option> to the name of a
30215 directory containing certificate files. This does not work with GnuTLS; the
30216 option must be set to the name of a single file if you are using GnuTLS.
30217 </para>
30218 <para>
30219 These certificates should be for the certificate authorities trusted, rather
30220 than the public cert of individual clients.  With both OpenSSL and GnuTLS, if
30221 the value is a file then the certificates are sent by Exim as a server to
30222 connecting clients, defining the list of accepted certificate authorities.
30223 Thus the values defined should be considered public data.  To avoid this,
30224 use OpenSSL with a directory.
30225 </para>
30226 <para>
30227 See <xref linkend="SECTtlssni"/> for discussion of when this option might be re-expanded.
30228 </para>
30229 <para>
30230 A forced expansion failure or setting to an empty string is equivalent to
30231 being unset.
30232 </para>
30233 <para>
30234 <indexterm role="option">
30235 <primary><option>tls_verify_hosts</option></primary>
30236 </indexterm>
30237 </para>
30238 <informaltable frame="all">
30239 <tgroup cols="4" colsep="0" rowsep="0">
30240 <colspec colwidth="8*" align="left"/>
30241 <colspec colwidth="6*" align="center"/>
30242 <colspec colwidth="6*" align="center"/>
30243 <colspec colwidth="6*" align="right"/>
30244 <tbody>
30245 <row>
30246 <entry><option>tls_verify_hosts</option></entry>
30247 <entry>Use: <emphasis>main</emphasis></entry>
30248 <entry>Type: <emphasis>host list</emphasis>&dagger;<emphasis></emphasis></entry>
30249 <entry>Default: <emphasis>unset</emphasis></entry>
30250 </row>
30251 </tbody>
30252 </tgroup>
30253 </informaltable>
30254 <para>
30255 <indexterm role="concept">
30256 <primary>TLS</primary>
30257 <secondary>client certificate verification</secondary>
30258 </indexterm>
30259 <indexterm role="concept">
30260 <primary>certificate</primary>
30261 <secondary>verification of client</secondary>
30262 </indexterm>
30263 This option, along with <option>tls_try_verify_hosts</option>, controls the checking of
30264 certificates from clients. The expected certificates are defined by
30265 <option>tls_verify_certificates</option>, which must be set. A configuration error occurs if
30266 either <option>tls_verify_hosts</option> or <option>tls_try_verify_hosts</option> is set and
30267 <option>tls_verify_certificates</option> is not set.
30268 </para>
30269 <para>
30270 Any client that matches <option>tls_verify_hosts</option> is constrained by
30271 <option>tls_verify_certificates</option>. When the client initiates a TLS session, it must
30272 present one of the listed certificates. If it does not, the connection is
30273 aborted. <emphasis role="bold">Warning</emphasis>: Including a host in <option>tls_verify_hosts</option> does not require
30274 the host to use TLS. It can still send SMTP commands through unencrypted
30275 connections. Forcing a client to use TLS has to be done separately using an
30276 ACL to reject inappropriate commands when the connection is not encrypted.
30277 </para>
30278 <para>
30279 A weaker form of checking is provided by <option>tls_try_verify_hosts</option>. If a client
30280 matches this option (but not <option>tls_verify_hosts</option>), Exim requests a
30281 certificate and checks it against <option>tls_verify_certificates</option>, but does not
30282 abort the connection if there is no certificate or if it does not match. This
30283 state can be detected in an ACL, which makes it possible to implement policies
30284 such as <quote>accept for relay only if a verified certificate has been received,
30285 but accept for local delivery if encrypted, even without a verified
30286 certificate</quote>.
30287 </para>
30288 <para>
30289 Client hosts that match neither of these lists are not asked to present
30290 certificates.
30291 </para>
30292 <para>
30293 <indexterm role="option">
30294 <primary><option>trusted_groups</option></primary>
30295 </indexterm>
30296 </para>
30297 <informaltable frame="all">
30298 <tgroup cols="4" colsep="0" rowsep="0">
30299 <colspec colwidth="8*" align="left"/>
30300 <colspec colwidth="6*" align="center"/>
30301 <colspec colwidth="6*" align="center"/>
30302 <colspec colwidth="6*" align="right"/>
30303 <tbody>
30304 <row>
30305 <entry><option>trusted_groups</option></entry>
30306 <entry>Use: <emphasis>main</emphasis></entry>
30307 <entry>Type: <emphasis>string list</emphasis>&dagger;<emphasis></emphasis></entry>
30308 <entry>Default: <emphasis>unset</emphasis></entry>
30309 </row>
30310 </tbody>
30311 </tgroup>
30312 </informaltable>
30313 <para>
30314 <indexterm role="concept">
30315 <primary>trusted groups</primary>
30316 </indexterm>
30317 <indexterm role="concept">
30318 <primary>groups</primary>
30319 <secondary>trusted</secondary>
30320 </indexterm>
30321 This option is expanded just once, at the start of Exim&#x2019;s processing. If this
30322 option is set, any process that is running in one of the listed groups, or
30323 which has one of them as a supplementary group, is trusted. The groups can be
30324 specified numerically or by name. See section <xref linkend="SECTtrustedadmin"/> for
30325 details of what trusted callers are permitted to do. If neither
30326 <option>trusted_groups</option> nor <option>trusted_users</option> is set, only root and the Exim user
30327 are trusted.
30328 </para>
30329 <para>
30330 <indexterm role="option">
30331 <primary><option>trusted_users</option></primary>
30332 </indexterm>
30333 </para>
30334 <informaltable frame="all">
30335 <tgroup cols="4" colsep="0" rowsep="0">
30336 <colspec colwidth="8*" align="left"/>
30337 <colspec colwidth="6*" align="center"/>
30338 <colspec colwidth="6*" align="center"/>
30339 <colspec colwidth="6*" align="right"/>
30340 <tbody>
30341 <row>
30342 <entry><option>trusted_users</option></entry>
30343 <entry>Use: <emphasis>main</emphasis></entry>
30344 <entry>Type: <emphasis>string list</emphasis>&dagger;<emphasis></emphasis></entry>
30345 <entry>Default: <emphasis>unset</emphasis></entry>
30346 </row>
30347 </tbody>
30348 </tgroup>
30349 </informaltable>
30350 <para>
30351 <indexterm role="concept">
30352 <primary>trusted users</primary>
30353 </indexterm>
30354 <indexterm role="concept">
30355 <primary>user</primary>
30356 <secondary>trusted</secondary>
30357 </indexterm>
30358 This option is expanded just once, at the start of Exim&#x2019;s processing. If this
30359 option is set, any process that is running as one of the listed users is
30360 trusted. The users can be specified numerically or by name. See section
30361 <xref linkend="SECTtrustedadmin"/> for details of what trusted callers are permitted to do.
30362 If neither <option>trusted_groups</option> nor <option>trusted_users</option> is set, only root and the
30363 Exim user are trusted.
30364 </para>
30365 <para>
30366 <indexterm role="option">
30367 <primary><option>unknown_login</option></primary>
30368 </indexterm>
30369 </para>
30370 <informaltable frame="all">
30371 <tgroup cols="4" colsep="0" rowsep="0">
30372 <colspec colwidth="8*" align="left"/>
30373 <colspec colwidth="6*" align="center"/>
30374 <colspec colwidth="6*" align="center"/>
30375 <colspec colwidth="6*" align="right"/>
30376 <tbody>
30377 <row>
30378 <entry><option>unknown_login</option></entry>
30379 <entry>Use: <emphasis>main</emphasis></entry>
30380 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
30381 <entry>Default: <emphasis>unset</emphasis></entry>
30382 </row>
30383 </tbody>
30384 </tgroup>
30385 </informaltable>
30386 <para>
30387 <indexterm role="concept">
30388 <primary>uid (user id)</primary>
30389 <secondary>unknown caller</secondary>
30390 </indexterm>
30391 <indexterm role="variable">
30392 <primary><varname>$caller_uid</varname></primary>
30393 </indexterm>
30394 This is a specialized feature for use in unusual configurations. By default, if
30395 the uid of the caller of Exim cannot be looked up using <function>getpwuid()</function>, Exim
30396 gives up. The <option>unknown_login</option> option can be used to set a login name to be
30397 used in this circumstance. It is expanded, so values like <option>user$caller_uid</option>
30398 can be set. When <option>unknown_login</option> is used, the value of <option>unknown_username</option>
30399 is used for the user&#x2019;s real name (gecos field), unless this has been set by the
30400 <option>-F</option> option.
30401 </para>
30402 <para>
30403 <indexterm role="option">
30404 <primary><option>unknown_username</option></primary>
30405 </indexterm>
30406 </para>
30407 <informaltable frame="all">
30408 <tgroup cols="4" colsep="0" rowsep="0">
30409 <colspec colwidth="8*" align="left"/>
30410 <colspec colwidth="6*" align="center"/>
30411 <colspec colwidth="6*" align="center"/>
30412 <colspec colwidth="6*" align="right"/>
30413 <tbody>
30414 <row>
30415 <entry><option>unknown_username</option></entry>
30416 <entry>Use: <emphasis>main</emphasis></entry>
30417 <entry>Type: <emphasis>string</emphasis></entry>
30418 <entry>Default: <emphasis>unset</emphasis></entry>
30419 </row>
30420 </tbody>
30421 </tgroup>
30422 </informaltable>
30423 <para>
30424 See <option>unknown_login</option>.
30425 </para>
30426 <para>
30427 <indexterm role="option">
30428 <primary><option>untrusted_set_sender</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>untrusted_set_sender</option></entry>
30440 <entry>Use: <emphasis>main</emphasis></entry>
30441 <entry>Type: <emphasis>address list</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>trusted users</primary>
30450 </indexterm>
30451 <indexterm role="concept">
30452 <primary>sender</primary>
30453 <secondary>setting by untrusted user</secondary>
30454 </indexterm>
30455 <indexterm role="concept">
30456 <primary>untrusted user setting sender</primary>
30457 </indexterm>
30458 <indexterm role="concept">
30459 <primary>user</primary>
30460 <secondary>untrusted setting sender</secondary>
30461 </indexterm>
30462 <indexterm role="concept">
30463 <primary>envelope sender</primary>
30464 </indexterm>
30465 When an untrusted user submits a message to Exim using the standard input, Exim
30466 normally creates an envelope sender address from the user&#x2019;s login and the
30467 default qualification domain. Data from the <option>-f</option> option (for setting envelope
30468 senders on non-SMTP messages) or the SMTP MAIL command (if <option>-bs</option> or <option>-bS</option>
30469 is used) is ignored.
30470 </para>
30471 <para>
30472 However, untrusted users are permitted to set an empty envelope sender address,
30473 to declare that a message should never generate any bounces. For example:
30474 </para>
30475 <literallayout class="monospaced">
30476 exim -f '&lt;&gt;' user@domain.example
30477 </literallayout>
30478 <para>
30479 <indexterm role="variable">
30480 <primary><varname>$sender_ident</varname></primary>
30481 </indexterm>
30482 The <option>untrusted_set_sender</option> option allows you to permit untrusted users to set
30483 other envelope sender addresses in a controlled way. When it is set, untrusted
30484 users are allowed to set envelope sender addresses that match any of the
30485 patterns in the list. Like all address lists, the string is expanded. The
30486 identity of the user is in <varname>$sender_ident</varname>, so you can, for example, restrict
30487 users to setting senders that start with their login ids
30488 followed by a hyphen
30489 by a setting like this:
30490 </para>
30491 <literallayout class="monospaced">
30492 untrusted_set_sender = ^$sender_ident-
30493 </literallayout>
30494 <para>
30495 If you want to allow untrusted users to set envelope sender addresses without
30496 restriction, you can use
30497 </para>
30498 <literallayout class="monospaced">
30499 untrusted_set_sender = *
30500 </literallayout>
30501 <para>
30502 The <option>untrusted_set_sender</option> option applies to all forms of local input, but
30503 only to the setting of the envelope sender. It does not permit untrusted users
30504 to use the other options which trusted user can use to override message
30505 parameters. Furthermore, it does not stop Exim from removing an existing
30506 <emphasis>Sender:</emphasis> header in the message, or from adding a <emphasis>Sender:</emphasis> header if
30507 necessary. See <option>local_sender_retain</option> and <option>local_from_check</option> for ways of
30508 overriding these actions. The handling of the <emphasis>Sender:</emphasis> header is also
30509 described in section <xref linkend="SECTthesenhea"/>.
30510 </para>
30511 <para>
30512 The log line for a message&#x2019;s arrival shows the envelope sender following
30513 <quote>&lt;=</quote>. For local messages, the user&#x2019;s login always follows, after <quote>U=</quote>. In
30514 <option>-bp</option> displays, and in the Exim monitor, if an untrusted user sets an
30515 envelope sender address, the user&#x2019;s login is shown in parentheses after the
30516 sender address.
30517 </para>
30518 <para>
30519 <indexterm role="option">
30520 <primary><option>uucp_from_pattern</option></primary>
30521 </indexterm>
30522 </para>
30523 <informaltable frame="all">
30524 <tgroup cols="4" colsep="0" rowsep="0">
30525 <colspec colwidth="8*" align="left"/>
30526 <colspec colwidth="6*" align="center"/>
30527 <colspec colwidth="6*" align="center"/>
30528 <colspec colwidth="6*" align="right"/>
30529 <tbody>
30530 <row>
30531 <entry><option>uucp_from_pattern</option></entry>
30532 <entry>Use: <emphasis>main</emphasis></entry>
30533 <entry>Type: <emphasis>string</emphasis></entry>
30534 <entry>Default: <emphasis>see below</emphasis></entry>
30535 </row>
30536 </tbody>
30537 </tgroup>
30538 </informaltable>
30539 <para>
30540 <indexterm role="concept">
30541 <primary><quote>From</quote> line</primary>
30542 </indexterm>
30543 <indexterm role="concept">
30544 <primary>UUCP</primary>
30545 <secondary><quote>From</quote> line</secondary>
30546 </indexterm>
30547 Some applications that pass messages to an MTA via a command line interface use
30548 an initial line starting with <quote>From&nbsp;</quote> to pass the envelope sender. In
30549 particular, this is used by UUCP software. Exim recognizes such a line by means
30550 of a regular expression that is set in <option>uucp_from_pattern</option>. When the pattern
30551 matches, the sender address is constructed by expanding the contents of
30552 <option>uucp_from_sender</option>, provided that the caller of Exim is a trusted user. The
30553 default pattern recognizes lines in the following two forms:
30554 </para>
30555 <literallayout class="monospaced">
30556 From ph10 Fri Jan  5 12:35 GMT 1996
30557 From ph10 Fri, 7 Jan 97 14:00:00 GMT
30558 </literallayout>
30559 <para>
30560 The pattern can be seen by running
30561 </para>
30562 <literallayout class="monospaced">
30563 exim -bP uucp_from_pattern
30564 </literallayout>
30565 <para>
30566 It checks only up to the hours and minutes, and allows for a 2-digit or 4-digit
30567 year in the second case. The first word after <quote>From&nbsp;</quote> is matched in the
30568 regular expression by a parenthesized subpattern. The default value for
30569 <option>uucp_from_sender</option> is <quote>$1</quote>, which therefore just uses this first word
30570 (<quote>ph10</quote> in the example above) as the message&#x2019;s sender. See also
30571 <option>ignore_fromline_hosts</option>.
30572 </para>
30573 <para>
30574 <indexterm role="option">
30575 <primary><option>uucp_from_sender</option></primary>
30576 </indexterm>
30577 </para>
30578 <informaltable frame="all">
30579 <tgroup cols="4" colsep="0" rowsep="0">
30580 <colspec colwidth="8*" align="left"/>
30581 <colspec colwidth="6*" align="center"/>
30582 <colspec colwidth="6*" align="center"/>
30583 <colspec colwidth="6*" align="right"/>
30584 <tbody>
30585 <row>
30586 <entry><option>uucp_from_sender</option></entry>
30587 <entry>Use: <emphasis>main</emphasis></entry>
30588 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
30589 <entry>Default: <emphasis><literal>$1</literal></emphasis></entry>
30590 </row>
30591 </tbody>
30592 </tgroup>
30593 </informaltable>
30594 <para>
30595 See <option>uucp_from_pattern</option> above.
30596 </para>
30597 <para>
30598 <indexterm role="option">
30599 <primary><option>warn_message_file</option></primary>
30600 </indexterm>
30601 </para>
30602 <informaltable frame="all">
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>warn_message_file</option></entry>
30611 <entry>Use: <emphasis>main</emphasis></entry>
30612 <entry>Type: <emphasis>string</emphasis></entry>
30613 <entry>Default: <emphasis>unset</emphasis></entry>
30614 </row>
30615 </tbody>
30616 </tgroup>
30617 </informaltable>
30618 <para>
30619 <indexterm role="concept">
30620 <primary>warning of delay</primary>
30621 <secondary>customizing the message</secondary>
30622 </indexterm>
30623 <indexterm role="concept">
30624 <primary>customizing</primary>
30625 <secondary>warning message</secondary>
30626 </indexterm>
30627 This option defines a template file containing paragraphs of text to be used
30628 for constructing the warning message which is sent by Exim when a message has
30629 been on the queue for a specified amount of time, as specified by
30630 <option>delay_warning</option>. Details of the file&#x2019;s contents are given in chapter
30631 <xref linkend="CHAPemsgcust"/>. See also <option>bounce_message_file</option>.
30632 </para>
30633 <para>
30634 <indexterm role="option">
30635 <primary><option>write_rejectlog</option></primary>
30636 </indexterm>
30637 </para>
30638 <informaltable frame="all">
30639 <tgroup cols="4" colsep="0" rowsep="0">
30640 <colspec colwidth="8*" align="left"/>
30641 <colspec colwidth="6*" align="center"/>
30642 <colspec colwidth="6*" align="center"/>
30643 <colspec colwidth="6*" align="right"/>
30644 <tbody>
30645 <row>
30646 <entry><option>write_rejectlog</option></entry>
30647 <entry>Use: <emphasis>main</emphasis></entry>
30648 <entry>Type: <emphasis>boolean</emphasis></entry>
30649 <entry>Default: <emphasis>true</emphasis></entry>
30650 </row>
30651 </tbody>
30652 </tgroup>
30653 </informaltable>
30654 <para>
30655 <indexterm role="concept">
30656 <primary>reject log</primary>
30657 <secondary>disabling</secondary>
30658 </indexterm>
30659 If this option is set false, Exim no longer writes anything to the reject log.
30660 See chapter <xref linkend="CHAPlog"/> for details of what Exim writes to its logs.
30661 <indexterm role="concept" startref="IIDconfima" class="endofrange"/>
30662 <indexterm role="concept" startref="IIDmaiconf" class="endofrange"/>
30663 </para>
30664 </section>
30665 </chapter>
30666
30667 <chapter id="CHAProutergeneric">
30668 <title>Generic options for routers</title>
30669 <para>
30670 <indexterm role="concept" id="IIDgenoprou1" class="startofrange">
30671 <primary>options</primary>
30672 <secondary>generic; for routers</secondary>
30673 </indexterm>
30674 <indexterm role="concept" id="IIDgenoprou2" class="startofrange">
30675 <primary>generic options</primary>
30676 <secondary>router</secondary>
30677 </indexterm>
30678 This chapter describes the generic options that apply to all routers.
30679 Those that are preconditions are marked with &Dagger; in the <quote>use</quote> field.
30680 </para>
30681 <para>
30682 For a general description of how a router operates, see sections
30683 <xref linkend="SECTrunindrou"/> and <xref linkend="SECTrouprecon"/>. The latter specifies the order in
30684 which the preconditions are tested. The order of expansion of the options that
30685 provide data for a transport is: <option>errors_to</option>, <option>headers_add</option>,
30686 <option>headers_remove</option>, <option>transport</option>.
30687 </para>
30688 <para>
30689 <indexterm role="option">
30690 <primary><option>address_data</option></primary>
30691 </indexterm>
30692 </para>
30693 <informaltable frame="all">
30694 <tgroup cols="4" colsep="0" rowsep="0">
30695 <colspec colwidth="8*" align="left"/>
30696 <colspec colwidth="6*" align="center"/>
30697 <colspec colwidth="6*" align="center"/>
30698 <colspec colwidth="6*" align="right"/>
30699 <tbody>
30700 <row>
30701 <entry><option>address_data</option></entry>
30702 <entry>Use: <emphasis>routers</emphasis></entry>
30703 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
30704 <entry>Default: <emphasis>unset</emphasis></entry>
30705 </row>
30706 </tbody>
30707 </tgroup>
30708 </informaltable>
30709 <para>
30710 <indexterm role="concept">
30711 <primary>router</primary>
30712 <secondary>data attached to address</secondary>
30713 </indexterm>
30714 The string is expanded just before the router is run, that is, after all the
30715 precondition tests have succeeded. If the expansion is forced to fail, the
30716 router declines, the value of <option>address_data</option> remains unchanged, and the
30717 <option>more</option> option controls what happens next. Other expansion failures cause
30718 delivery of the address to be deferred.
30719 </para>
30720 <para>
30721 <indexterm role="variable">
30722 <primary><varname>$address_data</varname></primary>
30723 </indexterm>
30724 When the expansion succeeds, the value is retained with the address, and can be
30725 accessed using the variable <varname>$address_data</varname> in the current router, subsequent
30726 routers, and the eventual transport.
30727 </para>
30728 <para>
30729 <emphasis role="bold">Warning</emphasis>: If the current or any subsequent router is a <command>redirect</command> router
30730 that runs a user&#x2019;s filter file, the contents of <varname>$address_data</varname> are accessible
30731 in the filter. This is not normally a problem, because such data is usually
30732 either not confidential or it <quote>belongs</quote> to the current user, but if you do
30733 put confidential data into <varname>$address_data</varname> you need to remember this point.
30734 </para>
30735 <para>
30736 Even if the router declines or passes, the value of <varname>$address_data</varname> remains
30737 with the address, though it can be changed by another <option>address_data</option> setting
30738 on a subsequent router. If a router generates child addresses, the value of
30739 <varname>$address_data</varname> propagates to them. This also applies to the special kind of
30740 <quote>child</quote> that is generated by a router with the <option>unseen</option> option.
30741 </para>
30742 <para>
30743 The idea of <option>address_data</option> is that you can use it to look up a lot of data
30744 for the address once, and then pick out parts of the data later. For example,
30745 you could use a single LDAP lookup to return a string of the form
30746 </para>
30747 <literallayout class="monospaced">
30748 uid=1234 gid=5678 mailbox=/mail/xyz forward=/home/xyz/.forward
30749 </literallayout>
30750 <para>
30751 In the transport you could pick out the mailbox by a setting such as
30752 </para>
30753 <literallayout class="monospaced">
30754 file = ${extract{mailbox}{$address_data}}
30755 </literallayout>
30756 <para>
30757 This makes the configuration file less messy, and also reduces the number of
30758 lookups (though Exim does cache lookups).
30759 </para>
30760 <para>
30761 <indexterm role="variable">
30762 <primary><varname>$sender_address_data</varname></primary>
30763 </indexterm>
30764 <indexterm role="variable">
30765 <primary><varname>$address_data</varname></primary>
30766 </indexterm>
30767 The <option>address_data</option> facility is also useful as a means of passing information
30768 from one router to another, and from a router to a transport. In addition, if
30769 <varname>$address_data</varname> is set by a router when verifying a recipient address from an
30770 ACL, it remains available for use in the rest of the ACL statement. After
30771 verifying a sender, the value is transferred to <varname>$sender_address_data</varname>.
30772 </para>
30773 <para>
30774 <indexterm role="option">
30775 <primary><option>address_test</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>address_test</option></entry>
30787 <entry>Use: <emphasis>routers</emphasis>&Dagger;<emphasis></emphasis></entry>
30788 <entry>Type: <emphasis>boolean</emphasis></entry>
30789 <entry>Default: <emphasis>true</emphasis></entry>
30790 </row>
30791 </tbody>
30792 </tgroup>
30793 </informaltable>
30794 <para>
30795 <indexterm role="option">
30796 <primary><option>-bt</option></primary>
30797 </indexterm>
30798 <indexterm role="concept">
30799 <primary>router</primary>
30800 <secondary>skipping when address testing</secondary>
30801 </indexterm>
30802 If this option is set false, the router is skipped when routing is being tested
30803 by means of the <option>-bt</option> command line option. This can be a convenience when
30804 your first router sends messages to an external scanner, because it saves you
30805 having to set the <quote>already scanned</quote> indicator when testing real address
30806 routing.
30807 </para>
30808 <para>
30809 <indexterm role="option">
30810 <primary><option>cannot_route_message</option></primary>
30811 </indexterm>
30812 </para>
30813 <informaltable frame="all">
30814 <tgroup cols="4" colsep="0" rowsep="0">
30815 <colspec colwidth="8*" align="left"/>
30816 <colspec colwidth="6*" align="center"/>
30817 <colspec colwidth="6*" align="center"/>
30818 <colspec colwidth="6*" align="right"/>
30819 <tbody>
30820 <row>
30821 <entry><option>cannot_route_message</option></entry>
30822 <entry>Use: <emphasis>routers</emphasis></entry>
30823 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
30824 <entry>Default: <emphasis>unset</emphasis></entry>
30825 </row>
30826 </tbody>
30827 </tgroup>
30828 </informaltable>
30829 <para>
30830 <indexterm role="concept">
30831 <primary>router</primary>
30832 <secondary>customizing <quote>cannot route</quote> message</secondary>
30833 </indexterm>
30834 <indexterm role="concept">
30835 <primary>customizing</primary>
30836 <secondary><quote>cannot route</quote> message</secondary>
30837 </indexterm>
30838 This option specifies a text message that is used when an address cannot be
30839 routed because Exim has run out of routers. The default message is
30840 <quote>Unrouteable address</quote>. This option is useful only on routers that have
30841 <option>more</option> set false, or on the very last router in a configuration, because the
30842 value that is used is taken from the last router that is considered. This
30843 includes a router that is skipped because its preconditions are not met, as
30844 well as a router that declines. For example, using the default configuration,
30845 you could put:
30846 </para>
30847 <literallayout class="monospaced">
30848 cannot_route_message = Remote domain not found in DNS
30849 </literallayout>
30850 <para>
30851 on the first router, which is a <command>dnslookup</command> router with <option>more</option> set false,
30852 and
30853 </para>
30854 <literallayout class="monospaced">
30855 cannot_route_message = Unknown local user
30856 </literallayout>
30857 <para>
30858 on the final router that checks for local users. If string expansion fails for
30859 this option, the default message is used. Unless the expansion failure was
30860 explicitly forced, a message about the failure is written to the main and panic
30861 logs, in addition to the normal message about the routing failure.
30862 </para>
30863 <para>
30864 <indexterm role="option">
30865 <primary><option>caseful_local_part</option></primary>
30866 </indexterm>
30867 </para>
30868 <informaltable frame="all">
30869 <tgroup cols="4" colsep="0" rowsep="0">
30870 <colspec colwidth="8*" align="left"/>
30871 <colspec colwidth="6*" align="center"/>
30872 <colspec colwidth="6*" align="center"/>
30873 <colspec colwidth="6*" align="right"/>
30874 <tbody>
30875 <row>
30876 <entry><option>caseful_local_part</option></entry>
30877 <entry>Use: <emphasis>routers</emphasis></entry>
30878 <entry>Type: <emphasis>boolean</emphasis></entry>
30879 <entry>Default: <emphasis>false</emphasis></entry>
30880 </row>
30881 </tbody>
30882 </tgroup>
30883 </informaltable>
30884 <para>
30885 <indexterm role="concept">
30886 <primary>case of local parts</primary>
30887 </indexterm>
30888 <indexterm role="concept">
30889 <primary>router</primary>
30890 <secondary>case of local parts</secondary>
30891 </indexterm>
30892 By default, routers handle the local parts of addresses in a case-insensitive
30893 manner, though the actual case is preserved for transmission with the message.
30894 If you want the case of letters to be significant in a router, you must set
30895 this option true. For individual router options that contain address or local
30896 part lists (for example, <option>local_parts</option>), case-sensitive matching can be
30897 turned on by <quote>+caseful</quote> as a list item. See section <xref linkend="SECTcasletadd"/> for
30898 more details.
30899 </para>
30900 <para>
30901 <indexterm role="variable">
30902 <primary><varname>$local_part</varname></primary>
30903 </indexterm>
30904 <indexterm role="variable">
30905 <primary><varname>$original_local_part</varname></primary>
30906 </indexterm>
30907 <indexterm role="variable">
30908 <primary><varname>$parent_local_part</varname></primary>
30909 </indexterm>
30910 The value of the <varname>$local_part</varname> variable is forced to lower case while a
30911 router is running unless <option>caseful_local_part</option> is set. When a router assigns
30912 an address to a transport, the value of <varname>$local_part</varname> when the transport runs
30913 is the same as it was in the router. Similarly, when a router generates child
30914 addresses by aliasing or forwarding, the values of <varname>$original_local_part</varname>
30915 and <varname>$parent_local_part</varname> are those that were used by the redirecting router.
30916 </para>
30917 <para>
30918 This option applies to the processing of an address by a router. When a
30919 recipient address is being processed in an ACL, there is a separate <option>control</option>
30920 modifier that can be used to specify case-sensitive processing within the ACL
30921 (see section <xref linkend="SECTcontrols"/>).
30922 </para>
30923 <para>
30924 <indexterm role="option">
30925 <primary><option>check_local_user</option></primary>
30926 </indexterm>
30927 </para>
30928 <informaltable frame="all">
30929 <tgroup cols="4" colsep="0" rowsep="0">
30930 <colspec colwidth="8*" align="left"/>
30931 <colspec colwidth="6*" align="center"/>
30932 <colspec colwidth="6*" align="center"/>
30933 <colspec colwidth="6*" align="right"/>
30934 <tbody>
30935 <row>
30936 <entry><option>check_local_user</option></entry>
30937 <entry>Use: <emphasis>routers</emphasis>&Dagger;<emphasis></emphasis></entry>
30938 <entry>Type: <emphasis>boolean</emphasis></entry>
30939 <entry>Default: <emphasis>false</emphasis></entry>
30940 </row>
30941 </tbody>
30942 </tgroup>
30943 </informaltable>
30944 <para>
30945 <indexterm role="concept">
30946 <primary>local user, checking in router</primary>
30947 </indexterm>
30948 <indexterm role="concept">
30949 <primary>router</primary>
30950 <secondary>checking for local user</secondary>
30951 </indexterm>
30952 <indexterm role="concept">
30953 <primary><filename>/etc/passwd</filename></primary>
30954 </indexterm>
30955 <indexterm role="variable">
30956 <primary><varname>$home</varname></primary>
30957 </indexterm>
30958 When this option is true, Exim checks that the local part of the recipient
30959 address (with affixes removed if relevant) is the name of an account on the
30960 local system. The check is done by calling the <function>getpwnam()</function> function rather
30961 than trying to read <filename>/etc/passwd</filename> directly. This means that other methods of
30962 holding password data (such as NIS) are supported. If the local part is a local
30963 user, <varname>$home</varname> is set from the password data, and can be tested in other
30964 preconditions that are evaluated after this one (the order of evaluation is
30965 given in section <xref linkend="SECTrouprecon"/>). However, the value of <varname>$home</varname> can be
30966 overridden by <option>router_home_directory</option>. If the local part is not a local user,
30967 the router is skipped.
30968 </para>
30969 <para>
30970 If you want to check that the local part is either the name of a local user
30971 or matches something else, you cannot combine <option>check_local_user</option> with a
30972 setting of <option>local_parts</option>, because that specifies the logical <emphasis>and</emphasis> of the
30973 two conditions. However, you can use a <command>passwd</command> lookup in a <option>local_parts</option>
30974 setting to achieve this. For example:
30975 </para>
30976 <literallayout class="monospaced">
30977 local_parts = passwd;$local_part : lsearch;/etc/other/users
30978 </literallayout>
30979 <para>
30980 Note, however, that the side effects of <option>check_local_user</option> (such as setting
30981 up a home directory) do not occur when a <command>passwd</command> lookup is used in a
30982 <option>local_parts</option> (or any other) precondition.
30983 </para>
30984 <para>
30985 <indexterm role="option">
30986 <primary><option>condition</option></primary>
30987 </indexterm>
30988 </para>
30989 <informaltable frame="all">
30990 <tgroup cols="4" colsep="0" rowsep="0">
30991 <colspec colwidth="8*" align="left"/>
30992 <colspec colwidth="6*" align="center"/>
30993 <colspec colwidth="6*" align="center"/>
30994 <colspec colwidth="6*" align="right"/>
30995 <tbody>
30996 <row>
30997 <entry><option>condition</option></entry>
30998 <entry>Use: <emphasis>routers</emphasis>&Dagger;<emphasis></emphasis></entry>
30999 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
31000 <entry>Default: <emphasis>unset</emphasis></entry>
31001 </row>
31002 </tbody>
31003 </tgroup>
31004 </informaltable>
31005 <para>
31006 <indexterm role="concept">
31007 <primary>router</primary>
31008 <secondary>customized precondition</secondary>
31009 </indexterm>
31010 This option specifies a general precondition test that has to succeed for the
31011 router to be called. The <option>condition</option> option is the last precondition to be
31012 evaluated (see section <xref linkend="SECTrouprecon"/>). The string is expanded, and if the
31013 result is a forced failure, or an empty string, or one of the strings <quote>0</quote> or
31014 <quote>no</quote> or <quote>false</quote> (checked without regard to the case of the letters), the
31015 router is skipped, and the address is offered to the next one.
31016 </para>
31017 <para>
31018 If the result is any other value, the router is run (as this is the last
31019 precondition to be evaluated, all the other preconditions must be true).
31020 </para>
31021 <para>
31022 This option is unusual in that multiple <option>condition</option> options may be present.
31023 All <option>condition</option> options must succeed.
31024 </para>
31025 <para>
31026 The <option>condition</option> option provides a means of applying custom conditions to the
31027 running of routers. Note that in the case of a simple conditional expansion,
31028 the default expansion values are exactly what is wanted. For example:
31029 </para>
31030 <literallayout class="monospaced">
31031 condition = ${if &gt;{$message_age}{600}}
31032 </literallayout>
31033 <para>
31034 Because of the default behaviour of the string expansion, this is equivalent to
31035 </para>
31036 <literallayout class="monospaced">
31037 condition = ${if &gt;{$message_age}{600}{true}{}}
31038 </literallayout>
31039 <para>
31040 A multiple condition example, which succeeds:
31041 </para>
31042 <literallayout class="monospaced">
31043 condition = ${if &gt;{$message_age}{600}}
31044 condition = ${if !eq{${lc:$local_part}}{postmaster}}
31045 condition = foobar
31046 </literallayout>
31047 <para>
31048 If the expansion fails (other than forced failure) delivery is deferred. Some
31049 of the other precondition options are common special cases that could in fact
31050 be specified using <option>condition</option>.
31051 </para>
31052 <para>
31053 <indexterm role="option">
31054 <primary><option>debug_print</option></primary>
31055 </indexterm>
31056 </para>
31057 <informaltable frame="all">
31058 <tgroup cols="4" colsep="0" rowsep="0">
31059 <colspec colwidth="8*" align="left"/>
31060 <colspec colwidth="6*" align="center"/>
31061 <colspec colwidth="6*" align="center"/>
31062 <colspec colwidth="6*" align="right"/>
31063 <tbody>
31064 <row>
31065 <entry><option>debug_print</option></entry>
31066 <entry>Use: <emphasis>routers</emphasis></entry>
31067 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
31068 <entry>Default: <emphasis>unset</emphasis></entry>
31069 </row>
31070 </tbody>
31071 </tgroup>
31072 </informaltable>
31073 <para>
31074 <indexterm role="concept">
31075 <primary>testing</primary>
31076 <secondary>variables in drivers</secondary>
31077 </indexterm>
31078 If this option is set and debugging is enabled (see the <option>-d</option> command line
31079 option) or in address-testing mode (see the <option>-bt</option> command line option),
31080 the string is expanded and included in the debugging output.
31081 If expansion of the string fails, the error message is written to the debugging
31082 output, and Exim carries on processing.
31083 This option is provided to help with checking out the values of variables and
31084 so on when debugging router configurations. For example, if a <option>condition</option>
31085 option appears not to be working, <option>debug_print</option> can be used to output the
31086 variables it references. The output happens after checks for <option>domains</option>,
31087 <option>local_parts</option>, and <option>check_local_user</option> but before any other preconditions
31088 are tested. A newline is added to the text if it does not end with one.
31089 The variable <varname>$router_name</varname> contains the name of the router.
31090 </para>
31091 <para>
31092 <indexterm role="option">
31093 <primary><option>disable_logging</option></primary>
31094 </indexterm>
31095 </para>
31096 <informaltable frame="all">
31097 <tgroup cols="4" colsep="0" rowsep="0">
31098 <colspec colwidth="8*" align="left"/>
31099 <colspec colwidth="6*" align="center"/>
31100 <colspec colwidth="6*" align="center"/>
31101 <colspec colwidth="6*" align="right"/>
31102 <tbody>
31103 <row>
31104 <entry><option>disable_logging</option></entry>
31105 <entry>Use: <emphasis>routers</emphasis></entry>
31106 <entry>Type: <emphasis>boolean</emphasis></entry>
31107 <entry>Default: <emphasis>false</emphasis></entry>
31108 </row>
31109 </tbody>
31110 </tgroup>
31111 </informaltable>
31112 <para>
31113 If this option is set true, nothing is logged for any routing errors
31114 or for any deliveries caused by this router. You should not set this option
31115 unless you really, really know what you are doing. See also the generic
31116 transport option of the same name.
31117 </para>
31118 <para>
31119 <indexterm role="option">
31120 <primary><option>domains</option></primary>
31121 </indexterm>
31122 </para>
31123 <informaltable frame="all">
31124 <tgroup cols="4" colsep="0" rowsep="0">
31125 <colspec colwidth="8*" align="left"/>
31126 <colspec colwidth="6*" align="center"/>
31127 <colspec colwidth="6*" align="center"/>
31128 <colspec colwidth="6*" align="right"/>
31129 <tbody>
31130 <row>
31131 <entry><option>domains</option></entry>
31132 <entry>Use: <emphasis>routers</emphasis>&Dagger;<emphasis></emphasis></entry>
31133 <entry>Type: <emphasis>domain list</emphasis>&dagger;<emphasis></emphasis></entry>
31134 <entry>Default: <emphasis>unset</emphasis></entry>
31135 </row>
31136 </tbody>
31137 </tgroup>
31138 </informaltable>
31139 <para>
31140 <indexterm role="concept">
31141 <primary>router</primary>
31142 <secondary>restricting to specific domains</secondary>
31143 </indexterm>
31144 <indexterm role="variable">
31145 <primary><varname>$domain_data</varname></primary>
31146 </indexterm>
31147 If this option is set, the router is skipped unless the current domain matches
31148 the list. If the match is achieved by means of a file lookup, the data that the
31149 lookup returned for the domain is placed in <varname>$domain_data</varname> for use in string
31150 expansions of the driver&#x2019;s private options. See section <xref linkend="SECTrouprecon"/> for
31151 a list of the order in which preconditions are evaluated.
31152 </para>
31153 <para>
31154 <indexterm role="option">
31155 <primary><option>driver</option></primary>
31156 </indexterm>
31157 </para>
31158 <informaltable frame="all">
31159 <tgroup cols="4" colsep="0" rowsep="0">
31160 <colspec colwidth="8*" align="left"/>
31161 <colspec colwidth="6*" align="center"/>
31162 <colspec colwidth="6*" align="center"/>
31163 <colspec colwidth="6*" align="right"/>
31164 <tbody>
31165 <row>
31166 <entry><option>driver</option></entry>
31167 <entry>Use: <emphasis>routers</emphasis></entry>
31168 <entry>Type: <emphasis>string</emphasis></entry>
31169 <entry>Default: <emphasis>unset</emphasis></entry>
31170 </row>
31171 </tbody>
31172 </tgroup>
31173 </informaltable>
31174 <para>
31175 This option must always be set. It specifies which of the available routers is
31176 to be used.
31177 </para>
31178 <para>
31179 <indexterm role="option">
31180 <primary><option>errors_to</option></primary>
31181 </indexterm>
31182 </para>
31183 <informaltable frame="all">
31184 <tgroup cols="4" colsep="0" rowsep="0">
31185 <colspec colwidth="8*" align="left"/>
31186 <colspec colwidth="6*" align="center"/>
31187 <colspec colwidth="6*" align="center"/>
31188 <colspec colwidth="6*" align="right"/>
31189 <tbody>
31190 <row>
31191 <entry><option>errors_to</option></entry>
31192 <entry>Use: <emphasis>routers</emphasis></entry>
31193 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
31194 <entry>Default: <emphasis>unset</emphasis></entry>
31195 </row>
31196 </tbody>
31197 </tgroup>
31198 </informaltable>
31199 <para>
31200 <indexterm role="concept">
31201 <primary>envelope sender</primary>
31202 </indexterm>
31203 <indexterm role="concept">
31204 <primary>router</primary>
31205 <secondary>changing address for errors</secondary>
31206 </indexterm>
31207 If a router successfully handles an address, it may assign the address to a
31208 transport for delivery or it may generate child addresses. In both cases, if
31209 there is a delivery problem during later processing, the resulting bounce
31210 message is sent to the address that results from expanding this string,
31211 provided that the address verifies successfully. The <option>errors_to</option> option is
31212 expanded before <option>headers_add</option>, <option>headers_remove</option>, and <option>transport</option>.
31213 </para>
31214 <para>
31215 The <option>errors_to</option> setting associated with an address can be overridden if it
31216 subsequently passes through other routers that have their own <option>errors_to</option>
31217 settings, or if the message is delivered by a transport with a <option>return_path</option>
31218 setting.
31219 </para>
31220 <para>
31221 If <option>errors_to</option> is unset, or the expansion is forced to fail, or the result of
31222 the expansion fails to verify, the errors address associated with the incoming
31223 address is used. At top level, this is the envelope sender. A non-forced
31224 expansion failure causes delivery to be deferred.
31225 </para>
31226 <para>
31227 If an address for which <option>errors_to</option> has been set ends up being delivered over
31228 SMTP, the envelope sender for that delivery is the <option>errors_to</option> value, so that
31229 any bounces that are generated by other MTAs on the delivery route are also
31230 sent there. You can set <option>errors_to</option> to the empty string by either of these
31231 settings:
31232 </para>
31233 <literallayout class="monospaced">
31234 errors_to =
31235 errors_to = ""
31236 </literallayout>
31237 <para>
31238 An expansion item that yields an empty string has the same effect. If you do
31239 this, a locally detected delivery error for addresses processed by this router
31240 no longer gives rise to a bounce message; the error is discarded. If the
31241 address is delivered to a remote host, the return path is set to <literal>&lt;&gt;</literal>, unless
31242 overridden by the <option>return_path</option> option on the transport.
31243 </para>
31244 <para>
31245 <indexterm role="variable">
31246 <primary><varname>$address_data</varname></primary>
31247 </indexterm>
31248 If for some reason you want to discard local errors, but use a non-empty
31249 MAIL command for remote delivery, you can preserve the original return
31250 path in <varname>$address_data</varname> in the router, and reinstate it in the transport by
31251 setting <option>return_path</option>.
31252 </para>
31253 <para>
31254 The most common use of <option>errors_to</option> is to direct mailing list bounces to the
31255 manager of the list, as described in section <xref linkend="SECTmailinglists"/>, or to
31256 implement VERP (Variable Envelope Return Paths) (see section <xref linkend="SECTverp"/>).
31257 </para>
31258 <para>
31259 <indexterm role="option">
31260 <primary><option>expn</option></primary>
31261 </indexterm>
31262 </para>
31263 <informaltable frame="all">
31264 <tgroup cols="4" colsep="0" rowsep="0">
31265 <colspec colwidth="8*" align="left"/>
31266 <colspec colwidth="6*" align="center"/>
31267 <colspec colwidth="6*" align="center"/>
31268 <colspec colwidth="6*" align="right"/>
31269 <tbody>
31270 <row>
31271 <entry><option>expn</option></entry>
31272 <entry>Use: <emphasis>routers</emphasis>&Dagger;<emphasis></emphasis></entry>
31273 <entry>Type: <emphasis>boolean</emphasis></entry>
31274 <entry>Default: <emphasis>true</emphasis></entry>
31275 </row>
31276 </tbody>
31277 </tgroup>
31278 </informaltable>
31279 <para>
31280 <indexterm role="concept">
31281 <primary>address</primary>
31282 <secondary>testing</secondary>
31283 </indexterm>
31284 <indexterm role="concept">
31285 <primary>testing</primary>
31286 <secondary>addresses</secondary>
31287 </indexterm>
31288 <indexterm role="concept">
31289 <primary>EXPN</primary>
31290 <secondary>router skipping</secondary>
31291 </indexterm>
31292 <indexterm role="concept">
31293 <primary>router</primary>
31294 <secondary>skipping for EXPN</secondary>
31295 </indexterm>
31296 If this option is turned off, the router is skipped when testing an address
31297 as a result of processing an SMTP EXPN command. You might, for example,
31298 want to turn it off on a router for users&#x2019; <filename>.forward</filename> files, while leaving it
31299 on for the system alias file.
31300 See section <xref linkend="SECTrouprecon"/> for a list of the order in which preconditions
31301 are evaluated.
31302 </para>
31303 <para>
31304 The use of the SMTP EXPN command is controlled by an ACL (see chapter
31305 <xref linkend="CHAPACL"/>). When Exim is running an EXPN command, it is similar to testing
31306 an address with <option>-bt</option>. Compare VRFY, whose counterpart is <option>-bv</option>.
31307 </para>
31308 <para>
31309 <indexterm role="option">
31310 <primary><option>fail_verify</option></primary>
31311 </indexterm>
31312 </para>
31313 <informaltable frame="all">
31314 <tgroup cols="4" colsep="0" rowsep="0">
31315 <colspec colwidth="8*" align="left"/>
31316 <colspec colwidth="6*" align="center"/>
31317 <colspec colwidth="6*" align="center"/>
31318 <colspec colwidth="6*" align="right"/>
31319 <tbody>
31320 <row>
31321 <entry><option>fail_verify</option></entry>
31322 <entry>Use: <emphasis>routers</emphasis></entry>
31323 <entry>Type: <emphasis>boolean</emphasis></entry>
31324 <entry>Default: <emphasis>false</emphasis></entry>
31325 </row>
31326 </tbody>
31327 </tgroup>
31328 </informaltable>
31329 <para>
31330 <indexterm role="concept">
31331 <primary>router</primary>
31332 <secondary>forcing verification failure</secondary>
31333 </indexterm>
31334 Setting this option has the effect of setting both <option>fail_verify_sender</option> and
31335 <option>fail_verify_recipient</option> to the same value.
31336 </para>
31337 <para>
31338 <indexterm role="option">
31339 <primary><option>fail_verify_recipient</option></primary>
31340 </indexterm>
31341 </para>
31342 <informaltable frame="all">
31343 <tgroup cols="4" colsep="0" rowsep="0">
31344 <colspec colwidth="8*" align="left"/>
31345 <colspec colwidth="6*" align="center"/>
31346 <colspec colwidth="6*" align="center"/>
31347 <colspec colwidth="6*" align="right"/>
31348 <tbody>
31349 <row>
31350 <entry><option>fail_verify_recipient</option></entry>
31351 <entry>Use: <emphasis>routers</emphasis></entry>
31352 <entry>Type: <emphasis>boolean</emphasis></entry>
31353 <entry>Default: <emphasis>false</emphasis></entry>
31354 </row>
31355 </tbody>
31356 </tgroup>
31357 </informaltable>
31358 <para>
31359 If this option is true and an address is accepted by this router when
31360 verifying a recipient, verification fails.
31361 </para>
31362 <para>
31363 <indexterm role="option">
31364 <primary><option>fail_verify_sender</option></primary>
31365 </indexterm>
31366 </para>
31367 <informaltable frame="all">
31368 <tgroup cols="4" colsep="0" rowsep="0">
31369 <colspec colwidth="8*" align="left"/>
31370 <colspec colwidth="6*" align="center"/>
31371 <colspec colwidth="6*" align="center"/>
31372 <colspec colwidth="6*" align="right"/>
31373 <tbody>
31374 <row>
31375 <entry><option>fail_verify_sender</option></entry>
31376 <entry>Use: <emphasis>routers</emphasis></entry>
31377 <entry>Type: <emphasis>boolean</emphasis></entry>
31378 <entry>Default: <emphasis>false</emphasis></entry>
31379 </row>
31380 </tbody>
31381 </tgroup>
31382 </informaltable>
31383 <para>
31384 If this option is true and an address is accepted by this router when
31385 verifying a sender, verification fails.
31386 </para>
31387 <para>
31388 <indexterm role="option">
31389 <primary><option>fallback_hosts</option></primary>
31390 </indexterm>
31391 </para>
31392 <informaltable frame="all">
31393 <tgroup cols="4" colsep="0" rowsep="0">
31394 <colspec colwidth="8*" align="left"/>
31395 <colspec colwidth="6*" align="center"/>
31396 <colspec colwidth="6*" align="center"/>
31397 <colspec colwidth="6*" align="right"/>
31398 <tbody>
31399 <row>
31400 <entry><option>fallback_hosts</option></entry>
31401 <entry>Use: <emphasis>routers</emphasis></entry>
31402 <entry>Type: <emphasis>string list</emphasis></entry>
31403 <entry>Default: <emphasis>unset</emphasis></entry>
31404 </row>
31405 </tbody>
31406 </tgroup>
31407 </informaltable>
31408 <para>
31409 <indexterm role="concept">
31410 <primary>router</primary>
31411 <secondary>fallback hosts</secondary>
31412 </indexterm>
31413 <indexterm role="concept">
31414 <primary>fallback</primary>
31415 <secondary>hosts specified on router</secondary>
31416 </indexterm>
31417 String expansion is not applied to this option. The argument must be a
31418 colon-separated list of host names or IP addresses. The list separator can be
31419 changed (see section <xref linkend="SECTlistconstruct"/>), and a port can be specified with
31420 each name or address. In fact, the format of each item is exactly the same as
31421 defined for the list of hosts in a <command>manualroute</command> router (see section
31422 <xref linkend="SECTformatonehostitem"/>).
31423 </para>
31424 <para>
31425 If a router queues an address for a remote transport, this host list is
31426 associated with the address, and used instead of the transport&#x2019;s fallback host
31427 list. If <option>hosts_randomize</option> is set on the transport, the order of the list is
31428 randomized for each use. See the <option>fallback_hosts</option> option of the <command>smtp</command>
31429 transport for further details.
31430 </para>
31431 <para>
31432 <indexterm role="option">
31433 <primary><option>group</option></primary>
31434 </indexterm>
31435 </para>
31436 <informaltable frame="all">
31437 <tgroup cols="4" colsep="0" rowsep="0">
31438 <colspec colwidth="8*" align="left"/>
31439 <colspec colwidth="6*" align="center"/>
31440 <colspec colwidth="6*" align="center"/>
31441 <colspec colwidth="6*" align="right"/>
31442 <tbody>
31443 <row>
31444 <entry><option>group</option></entry>
31445 <entry>Use: <emphasis>routers</emphasis></entry>
31446 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
31447 <entry>Default: <emphasis>see below</emphasis></entry>
31448 </row>
31449 </tbody>
31450 </tgroup>
31451 </informaltable>
31452 <para>
31453 <indexterm role="concept">
31454 <primary>gid (group id)</primary>
31455 <secondary>local delivery</secondary>
31456 </indexterm>
31457 <indexterm role="concept">
31458 <primary>local transports</primary>
31459 <secondary>uid and gid</secondary>
31460 </indexterm>
31461 <indexterm role="concept">
31462 <primary>transport</primary>
31463 <secondary>local</secondary>
31464 </indexterm>
31465 <indexterm role="concept">
31466 <primary>router</primary>
31467 <secondary>setting group</secondary>
31468 </indexterm>
31469 When a router queues an address for a transport, and the transport does not
31470 specify a group, the group given here is used when running the delivery
31471 process.
31472 The group may be specified numerically or by name. If expansion fails, the
31473 error is logged and delivery is deferred.
31474 The default is unset, unless <option>check_local_user</option> is set, when the default
31475 is taken from the password information. See also <option>initgroups</option> and <option>user</option>
31476 and the discussion in chapter <xref linkend="CHAPenvironment"/>.
31477 </para>
31478 <para>
31479 <indexterm role="option">
31480 <primary><option>headers_add</option></primary>
31481 </indexterm>
31482 </para>
31483 <informaltable frame="all">
31484 <tgroup cols="4" colsep="0" rowsep="0">
31485 <colspec colwidth="8*" align="left"/>
31486 <colspec colwidth="6*" align="center"/>
31487 <colspec colwidth="6*" align="center"/>
31488 <colspec colwidth="6*" align="right"/>
31489 <tbody>
31490 <row>
31491 <entry><option>headers_add</option></entry>
31492 <entry>Use: <emphasis>routers</emphasis></entry>
31493 <entry>Type: <emphasis>list</emphasis>&dagger;<emphasis></emphasis></entry>
31494 <entry>Default: <emphasis>unset</emphasis></entry>
31495 </row>
31496 </tbody>
31497 </tgroup>
31498 </informaltable>
31499 <para>
31500 <indexterm role="concept">
31501 <primary>header lines</primary>
31502 <secondary>adding</secondary>
31503 </indexterm>
31504 <indexterm role="concept">
31505 <primary>router</primary>
31506 <secondary>adding header lines</secondary>
31507 </indexterm>
31508 This option specifies a list of text headers, newline-separated,
31509 that is associated with any addresses that are accepted by the router.
31510 Each item is separately expanded, at routing time.  However, this
31511 option has no effect when an address is just being verified. The way in which
31512 the text is used to add header lines at transport time is described in section
31513 <xref linkend="SECTheadersaddrem"/>. New header lines are not actually added until the
31514 message is in the process of being transported. This means that references to
31515 header lines in string expansions in the transport&#x2019;s configuration do not
31516 <quote>see</quote> the added header lines.
31517 </para>
31518 <para>
31519 The <option>headers_add</option> option is expanded after <option>errors_to</option>, but before
31520 <option>headers_remove</option> and <option>transport</option>. If an item is empty, or if
31521 an item expansion is forced to fail, the item has no effect. Other expansion
31522 failures are treated as configuration errors.
31523 </para>
31524 <para>
31525 Unlike most options, <option>headers_add</option> can be specified multiple times
31526 for a router; all listed headers are added.
31527 </para>
31528 <para>
31529 <emphasis role="bold">Warning 1</emphasis>: The <option>headers_add</option> option cannot be used for a <command>redirect</command>
31530 router that has the <option>one_time</option> option set.
31531 </para>
31532 <para>
31533 <indexterm role="concept">
31534 <primary>duplicate addresses</primary>
31535 </indexterm>
31536 <indexterm role="option">
31537 <primary><option>unseen</option></primary>
31538 </indexterm>
31539 <emphasis role="bold">Warning 2</emphasis>: If the <option>unseen</option> option is set on the router, all header
31540 additions are deleted when the address is passed on to subsequent routers.
31541 For a <option>redirect</option> router, if a generated address is the same as the incoming
31542 address, this can lead to duplicate addresses with different header
31543 modifications. Exim does not do duplicate deliveries (except, in certain
31544 circumstances, to pipes -- see section <xref linkend="SECTdupaddr"/>), but it is undefined
31545 which of the duplicates is discarded, so this ambiguous situation should be
31546 avoided. The <option>repeat_use</option> option of the <option>redirect</option> router may be of help.
31547 </para>
31548 <para>
31549 <indexterm role="option">
31550 <primary><option>headers_remove</option></primary>
31551 </indexterm>
31552 </para>
31553 <informaltable frame="all">
31554 <tgroup cols="4" colsep="0" rowsep="0">
31555 <colspec colwidth="8*" align="left"/>
31556 <colspec colwidth="6*" align="center"/>
31557 <colspec colwidth="6*" align="center"/>
31558 <colspec colwidth="6*" align="right"/>
31559 <tbody>
31560 <row>
31561 <entry><option>headers_remove</option></entry>
31562 <entry>Use: <emphasis>routers</emphasis></entry>
31563 <entry>Type: <emphasis>list</emphasis>&dagger;<emphasis></emphasis></entry>
31564 <entry>Default: <emphasis>unset</emphasis></entry>
31565 </row>
31566 </tbody>
31567 </tgroup>
31568 </informaltable>
31569 <para>
31570 <indexterm role="concept">
31571 <primary>header lines</primary>
31572 <secondary>removing</secondary>
31573 </indexterm>
31574 <indexterm role="concept">
31575 <primary>router</primary>
31576 <secondary>removing header lines</secondary>
31577 </indexterm>
31578 This option specifies a list of text headers, colon-separated,
31579 that is associated with any addresses that are accepted by the router.
31580 Each item is separately expanded, at routing time.  However, this
31581 option has no effect when an address is just being verified. The way in which
31582 the text is used to remove header lines at transport time is described in
31583 section <xref linkend="SECTheadersaddrem"/>. Header lines are not actually removed until
31584 the message is in the process of being transported. This means that references
31585 to header lines in string expansions in the transport&#x2019;s configuration still
31586 <quote>see</quote> the original header lines.
31587 </para>
31588 <para>
31589 The <option>headers_remove</option> option is expanded after <option>errors_to</option> and
31590 <option>headers_add</option>, but before <option>transport</option>. If an item expansion is forced to fail,
31591 the item has no effect. Other expansion failures are treated as configuration
31592 errors.
31593 </para>
31594 <para>
31595 Unlike most options, <option>headers_remove</option> can be specified multiple times
31596 for a router; all listed headers are removed.
31597 </para>
31598 <para>
31599 <emphasis role="bold">Warning 1</emphasis>: The <option>headers_remove</option> option cannot be used for a <command>redirect</command>
31600 router that has the <option>one_time</option> option set.
31601 </para>
31602 <para>
31603 <emphasis role="bold">Warning 2</emphasis>: If the <option>unseen</option> option is set on the router, all header
31604 removal requests are deleted when the address is passed on to subsequent
31605 routers, and this can lead to problems with duplicates -- see the similar
31606 warning for <option>headers_add</option> above.
31607 </para>
31608 <para>
31609 <indexterm role="option">
31610 <primary><option>ignore_target_hosts</option></primary>
31611 </indexterm>
31612 </para>
31613 <informaltable frame="all">
31614 <tgroup cols="4" colsep="0" rowsep="0">
31615 <colspec colwidth="8*" align="left"/>
31616 <colspec colwidth="6*" align="center"/>
31617 <colspec colwidth="6*" align="center"/>
31618 <colspec colwidth="6*" align="right"/>
31619 <tbody>
31620 <row>
31621 <entry><option>ignore_target_hosts</option></entry>
31622 <entry>Use: <emphasis>routers</emphasis></entry>
31623 <entry>Type: <emphasis>host list</emphasis>&dagger;<emphasis></emphasis></entry>
31624 <entry>Default: <emphasis>unset</emphasis></entry>
31625 </row>
31626 </tbody>
31627 </tgroup>
31628 </informaltable>
31629 <para>
31630 <indexterm role="concept">
31631 <primary>IP address</primary>
31632 <secondary>discarding</secondary>
31633 </indexterm>
31634 <indexterm role="concept">
31635 <primary>router</primary>
31636 <secondary>discarding IP addresses</secondary>
31637 </indexterm>
31638 Although this option is a host list, it should normally contain IP address
31639 entries rather than names. If any host that is looked up by the router has an
31640 IP address that matches an item in this list, Exim behaves as if that IP
31641 address did not exist. This option allows you to cope with rogue DNS entries
31642 like
31643 </para>
31644 <literallayout class="monospaced">
31645 remote.domain.example.  A  127.0.0.1
31646 </literallayout>
31647 <para>
31648 by setting
31649 </para>
31650 <literallayout class="monospaced">
31651 ignore_target_hosts = 127.0.0.1
31652 </literallayout>
31653 <para>
31654 on the relevant router. If all the hosts found by a <command>dnslookup</command> router are
31655 discarded in this way, the router declines. In a conventional configuration, an
31656 attempt to mail to such a domain would normally provoke the <quote>unrouteable
31657 domain</quote> error, and an attempt to verify an address in the domain would fail.
31658 Similarly, if <option>ignore_target_hosts</option> is set on an <command>ipliteral</command> router, the
31659 router declines if presented with one of the listed addresses.
31660 </para>
31661 <para>
31662 You can use this option to disable the use of IPv4 or IPv6 for mail delivery by
31663 means of the first or the second of the following settings, respectively:
31664 </para>
31665 <literallayout class="monospaced">
31666 ignore_target_hosts = 0.0.0.0/0
31667 ignore_target_hosts = &lt;; 0::0/0
31668 </literallayout>
31669 <para>
31670 The pattern in the first line matches all IPv4 addresses, whereas the pattern
31671 in the second line matches all IPv6 addresses.
31672 </para>
31673 <para>
31674 This option may also be useful for ignoring link-local and site-local IPv6
31675 addresses. Because, like all host lists, the value of <option>ignore_target_hosts</option>
31676 is expanded before use as a list, it is possible to make it dependent on the
31677 domain that is being routed.
31678 </para>
31679 <para>
31680 <indexterm role="variable">
31681 <primary><varname>$host_address</varname></primary>
31682 </indexterm>
31683 During its expansion, <varname>$host_address</varname> is set to the IP address that is being
31684 checked.
31685 </para>
31686 <para>
31687 <indexterm role="option">
31688 <primary><option>initgroups</option></primary>
31689 </indexterm>
31690 </para>
31691 <informaltable frame="all">
31692 <tgroup cols="4" colsep="0" rowsep="0">
31693 <colspec colwidth="8*" align="left"/>
31694 <colspec colwidth="6*" align="center"/>
31695 <colspec colwidth="6*" align="center"/>
31696 <colspec colwidth="6*" align="right"/>
31697 <tbody>
31698 <row>
31699 <entry><option>initgroups</option></entry>
31700 <entry>Use: <emphasis>routers</emphasis></entry>
31701 <entry>Type: <emphasis>boolean</emphasis></entry>
31702 <entry>Default: <emphasis>false</emphasis></entry>
31703 </row>
31704 </tbody>
31705 </tgroup>
31706 </informaltable>
31707 <para>
31708 <indexterm role="concept">
31709 <primary>additional groups</primary>
31710 </indexterm>
31711 <indexterm role="concept">
31712 <primary>groups</primary>
31713 <secondary>additional</secondary>
31714 </indexterm>
31715 <indexterm role="concept">
31716 <primary>local transports</primary>
31717 <secondary>uid and gid</secondary>
31718 </indexterm>
31719 <indexterm role="concept">
31720 <primary>transport</primary>
31721 <secondary>local</secondary>
31722 </indexterm>
31723 If the router queues an address for a transport, and this option is true, and
31724 the uid supplied by the router is not overridden by the transport, the
31725 <function>initgroups()</function> function is called when running the transport to ensure that
31726 any additional groups associated with the uid are set up. See also <option>group</option>
31727 and <option>user</option> and the discussion in chapter <xref linkend="CHAPenvironment"/>.
31728 </para>
31729 <para>
31730 <indexterm role="option">
31731 <primary><option>local_part_prefix</option></primary>
31732 </indexterm>
31733 </para>
31734 <informaltable frame="all">
31735 <tgroup cols="4" colsep="0" rowsep="0">
31736 <colspec colwidth="8*" align="left"/>
31737 <colspec colwidth="6*" align="center"/>
31738 <colspec colwidth="6*" align="center"/>
31739 <colspec colwidth="6*" align="right"/>
31740 <tbody>
31741 <row>
31742 <entry><option>local_part_prefix</option></entry>
31743 <entry>Use: <emphasis>routers</emphasis>&Dagger;<emphasis></emphasis></entry>
31744 <entry>Type: <emphasis>string list</emphasis></entry>
31745 <entry>Default: <emphasis>unset</emphasis></entry>
31746 </row>
31747 </tbody>
31748 </tgroup>
31749 </informaltable>
31750 <para>
31751 <indexterm role="concept">
31752 <primary>router</primary>
31753 <secondary>prefix for local part</secondary>
31754 </indexterm>
31755 <indexterm role="concept">
31756 <primary>prefix</primary>
31757 <secondary>for local part, used in router</secondary>
31758 </indexterm>
31759 If this option is set, the router is skipped unless the local part starts with
31760 one of the given strings, or <option>local_part_prefix_optional</option> is true. See
31761 section <xref linkend="SECTrouprecon"/> for a list of the order in which preconditions are
31762 evaluated.
31763 </para>
31764 <para>
31765 The list is scanned from left to right, and the first prefix that matches is
31766 used. A limited form of wildcard is available; if the prefix begins with an
31767 asterisk, it matches the longest possible sequence of arbitrary characters at
31768 the start of the local part. An asterisk should therefore always be followed by
31769 some character that does not occur in normal local parts.
31770 <indexterm role="concept">
31771 <primary>multiple mailboxes</primary>
31772 </indexterm>
31773 <indexterm role="concept">
31774 <primary>mailbox</primary>
31775 <secondary>multiple</secondary>
31776 </indexterm>
31777 Wildcarding can be used to set up multiple user mailboxes, as described in
31778 section <xref linkend="SECTmulbox"/>.
31779 </para>
31780 <para>
31781 <indexterm role="variable">
31782 <primary><varname>$local_part</varname></primary>
31783 </indexterm>
31784 <indexterm role="variable">
31785 <primary><varname>$local_part_prefix</varname></primary>
31786 </indexterm>
31787 During the testing of the <option>local_parts</option> option, and while the router is
31788 running, the prefix is removed from the local part, and is available in the
31789 expansion variable <varname>$local_part_prefix</varname>. When a message is being delivered, if
31790 the router accepts the address, this remains true during subsequent delivery by
31791 a transport. In particular, the local part that is transmitted in the RCPT
31792 command for LMTP, SMTP, and BSMTP deliveries has the prefix removed by default.
31793 This behaviour can be overridden by setting <option>rcpt_include_affixes</option> true on
31794 the relevant transport.
31795 </para>
31796 <para>
31797 When an address is being verified, <option>local_part_prefix</option> affects only the
31798 behaviour of the router. If the callout feature of verification is in use, this
31799 means that the full address, including the prefix, will be used during the
31800 callout.
31801 </para>
31802 <para>
31803 The prefix facility is commonly used to handle local parts of the form
31804 <option>owner-something</option>. Another common use is to support local parts of the form
31805 <option>real-username</option> to bypass a user&#x2019;s <filename>.forward</filename> file &ndash; helpful when trying
31806 to tell a user their forwarding is broken &ndash; by placing a router like this one
31807 immediately before the router that handles <filename>.forward</filename> files:
31808 </para>
31809 <literallayout class="monospaced">
31810 real_localuser:
31811   driver = accept
31812   local_part_prefix = real-
31813   check_local_user
31814   transport = local_delivery
31815 </literallayout>
31816 <para>
31817 For security, it would probably be a good idea to restrict the use of this
31818 router to locally-generated messages, using a condition such as this:
31819 </para>
31820 <literallayout class="monospaced">
31821   condition = ${if match {$sender_host_address}\
31822                          {\N^(|127\.0\.0\.1)$\N}}
31823 </literallayout>
31824 <para>
31825 If both <option>local_part_prefix</option> and <option>local_part_suffix</option> are set for a router,
31826 both conditions must be met if not optional. Care must be taken if wildcards
31827 are used in both a prefix and a suffix on the same router. Different
31828 separator characters must be used to avoid ambiguity.
31829 </para>
31830 <para>
31831 <indexterm role="option">
31832 <primary><option>local_part_prefix_optional</option></primary>
31833 </indexterm>
31834 </para>
31835 <informaltable frame="all">
31836 <tgroup cols="4" colsep="0" rowsep="0">
31837 <colspec colwidth="8*" align="left"/>
31838 <colspec colwidth="6*" align="center"/>
31839 <colspec colwidth="6*" align="center"/>
31840 <colspec colwidth="6*" align="right"/>
31841 <tbody>
31842 <row>
31843 <entry><option>local_part_prefix_optional</option></entry>
31844 <entry>Use: <emphasis>routers</emphasis></entry>
31845 <entry>Type: <emphasis>boolean</emphasis></entry>
31846 <entry>Default: <emphasis>false</emphasis></entry>
31847 </row>
31848 </tbody>
31849 </tgroup>
31850 </informaltable>
31851 <para>
31852 See <option>local_part_prefix</option> above.
31853 </para>
31854 <para>
31855 <indexterm role="option">
31856 <primary><option>local_part_suffix</option></primary>
31857 </indexterm>
31858 </para>
31859 <informaltable frame="all">
31860 <tgroup cols="4" colsep="0" rowsep="0">
31861 <colspec colwidth="8*" align="left"/>
31862 <colspec colwidth="6*" align="center"/>
31863 <colspec colwidth="6*" align="center"/>
31864 <colspec colwidth="6*" align="right"/>
31865 <tbody>
31866 <row>
31867 <entry><option>local_part_suffix</option></entry>
31868 <entry>Use: <emphasis>routers</emphasis>&Dagger;<emphasis></emphasis></entry>
31869 <entry>Type: <emphasis>string list</emphasis></entry>
31870 <entry>Default: <emphasis>unset</emphasis></entry>
31871 </row>
31872 </tbody>
31873 </tgroup>
31874 </informaltable>
31875 <para>
31876 <indexterm role="concept">
31877 <primary>router</primary>
31878 <secondary>suffix for local part</secondary>
31879 </indexterm>
31880 <indexterm role="concept">
31881 <primary>suffix for local part</primary>
31882 <secondary>used in router</secondary>
31883 </indexterm>
31884 This option operates in the same way as <option>local_part_prefix</option>, except that the
31885 local part must end (rather than start) with the given string, the
31886 <option>local_part_suffix_optional</option> option determines whether the suffix is
31887 mandatory, and the wildcard * character, if present, must be the last
31888 character of the suffix. This option facility is commonly used to handle local
31889 parts of the form <option>something-request</option> and multiple user mailboxes of the form
31890 <option>username-foo</option>.
31891 </para>
31892 <para>
31893 <indexterm role="option">
31894 <primary><option>local_part_suffix_optional</option></primary>
31895 </indexterm>
31896 </para>
31897 <informaltable frame="all">
31898 <tgroup cols="4" colsep="0" rowsep="0">
31899 <colspec colwidth="8*" align="left"/>
31900 <colspec colwidth="6*" align="center"/>
31901 <colspec colwidth="6*" align="center"/>
31902 <colspec colwidth="6*" align="right"/>
31903 <tbody>
31904 <row>
31905 <entry><option>local_part_suffix_optional</option></entry>
31906 <entry>Use: <emphasis>routers</emphasis></entry>
31907 <entry>Type: <emphasis>boolean</emphasis></entry>
31908 <entry>Default: <emphasis>false</emphasis></entry>
31909 </row>
31910 </tbody>
31911 </tgroup>
31912 </informaltable>
31913 <para>
31914 See <option>local_part_suffix</option> above.
31915 </para>
31916 <para>
31917 <indexterm role="option">
31918 <primary><option>local_parts</option></primary>
31919 </indexterm>
31920 </para>
31921 <informaltable frame="all">
31922 <tgroup cols="4" colsep="0" rowsep="0">
31923 <colspec colwidth="8*" align="left"/>
31924 <colspec colwidth="6*" align="center"/>
31925 <colspec colwidth="6*" align="center"/>
31926 <colspec colwidth="6*" align="right"/>
31927 <tbody>
31928 <row>
31929 <entry><option>local_parts</option></entry>
31930 <entry>Use: <emphasis>routers</emphasis>&Dagger;<emphasis></emphasis></entry>
31931 <entry>Type: <emphasis>local part list</emphasis>&dagger;<emphasis></emphasis></entry>
31932 <entry>Default: <emphasis>unset</emphasis></entry>
31933 </row>
31934 </tbody>
31935 </tgroup>
31936 </informaltable>
31937 <para>
31938 <indexterm role="concept">
31939 <primary>router</primary>
31940 <secondary>restricting to specific local parts</secondary>
31941 </indexterm>
31942 <indexterm role="concept">
31943 <primary>local part</primary>
31944 <secondary>checking in router</secondary>
31945 </indexterm>
31946 The router is run only if the local part of the address matches the list.
31947 See section <xref linkend="SECTrouprecon"/> for a list of the order in which preconditions
31948 are evaluated, and
31949 section <xref linkend="SECTlocparlis"/> for a discussion of local part lists. Because the
31950 string is expanded, it is possible to make it depend on the domain, for
31951 example:
31952 </para>
31953 <literallayout class="monospaced">
31954 local_parts = dbm;/usr/local/specials/$domain
31955 </literallayout>
31956 <para>
31957 <indexterm role="variable">
31958 <primary><varname>$local_part_data</varname></primary>
31959 </indexterm>
31960 If the match is achieved by a lookup, the data that the lookup returned
31961 for the local part is placed in the variable <varname>$local_part_data</varname> for use in
31962 expansions of the router&#x2019;s private options. You might use this option, for
31963 example, if you have a large number of local virtual domains, and you want to
31964 send all postmaster mail to the same place without having to set up an alias in
31965 each virtual domain:
31966 </para>
31967 <literallayout class="monospaced">
31968 postmaster:
31969   driver = redirect
31970   local_parts = postmaster
31971   data = postmaster@real.domain.example
31972 </literallayout>
31973 <para>
31974 <indexterm role="option">
31975 <primary><option>log_as_local</option></primary>
31976 </indexterm>
31977 </para>
31978 <informaltable frame="all">
31979 <tgroup cols="4" colsep="0" rowsep="0">
31980 <colspec colwidth="8*" align="left"/>
31981 <colspec colwidth="6*" align="center"/>
31982 <colspec colwidth="6*" align="center"/>
31983 <colspec colwidth="6*" align="right"/>
31984 <tbody>
31985 <row>
31986 <entry><option>log_as_local</option></entry>
31987 <entry>Use: <emphasis>routers</emphasis></entry>
31988 <entry>Type: <emphasis>boolean</emphasis></entry>
31989 <entry>Default: <emphasis>see below</emphasis></entry>
31990 </row>
31991 </tbody>
31992 </tgroup>
31993 </informaltable>
31994 <para>
31995 <indexterm role="concept">
31996 <primary>log</primary>
31997 <secondary>delivery line</secondary>
31998 </indexterm>
31999 <indexterm role="concept">
32000 <primary>delivery</primary>
32001 <secondary>log line format</secondary>
32002 </indexterm>
32003 Exim has two logging styles for delivery, the idea being to make local
32004 deliveries stand out more visibly from remote ones. In the <quote>local</quote> style, the
32005 recipient address is given just as the local part, without a domain. The use of
32006 this style is controlled by this option. It defaults to true for the <command>accept</command>
32007 router, and false for all the others. This option applies only when a
32008 router assigns an address to a transport. It has no effect on routers that
32009 redirect addresses.
32010 </para>
32011 <para>
32012 <indexterm role="option">
32013 <primary><option>more</option></primary>
32014 </indexterm>
32015 </para>
32016 <informaltable frame="all">
32017 <tgroup cols="4" colsep="0" rowsep="0">
32018 <colspec colwidth="8*" align="left"/>
32019 <colspec colwidth="6*" align="center"/>
32020 <colspec colwidth="6*" align="center"/>
32021 <colspec colwidth="6*" align="right"/>
32022 <tbody>
32023 <row>
32024 <entry><option>more</option></entry>
32025 <entry>Use: <emphasis>routers</emphasis></entry>
32026 <entry>Type: <emphasis>boolean</emphasis>&dagger;<emphasis></emphasis></entry>
32027 <entry>Default: <emphasis>true</emphasis></entry>
32028 </row>
32029 </tbody>
32030 </tgroup>
32031 </informaltable>
32032 <para>
32033 The result of string expansion for this option must be a valid boolean value,
32034 that is, one of the strings <quote>yes</quote>, <quote>no</quote>, <quote>true</quote>, or <quote>false</quote>. Any other
32035 result causes an error, and delivery is deferred. If the expansion is forced to
32036 fail, the default value for the option (true) is used. Other failures cause
32037 delivery to be deferred.
32038 </para>
32039 <para>
32040 If this option is set false, and the router declines to handle the address, no
32041 further routers are tried, routing fails, and the address is bounced.
32042 <indexterm role="option">
32043 <primary><option>self</option></primary>
32044 </indexterm>
32045 However, if the router explicitly passes an address to the following router by
32046 means of the setting
32047 </para>
32048 <literallayout class="monospaced">
32049 self = pass
32050 </literallayout>
32051 <para>
32052 or otherwise, the setting of <option>more</option> is ignored. Also, the setting of <option>more</option>
32053 does not affect the behaviour if one of the precondition tests fails. In that
32054 case, the address is always passed to the next router.
32055 </para>
32056 <para>
32057 Note that <option>address_data</option> is not considered to be a precondition. If its
32058 expansion is forced to fail, the router declines, and the value of <option>more</option>
32059 controls what happens next.
32060 </para>
32061 <para>
32062 <indexterm role="option">
32063 <primary><option>pass_on_timeout</option></primary>
32064 </indexterm>
32065 </para>
32066 <informaltable frame="all">
32067 <tgroup cols="4" colsep="0" rowsep="0">
32068 <colspec colwidth="8*" align="left"/>
32069 <colspec colwidth="6*" align="center"/>
32070 <colspec colwidth="6*" align="center"/>
32071 <colspec colwidth="6*" align="right"/>
32072 <tbody>
32073 <row>
32074 <entry><option>pass_on_timeout</option></entry>
32075 <entry>Use: <emphasis>routers</emphasis></entry>
32076 <entry>Type: <emphasis>boolean</emphasis></entry>
32077 <entry>Default: <emphasis>false</emphasis></entry>
32078 </row>
32079 </tbody>
32080 </tgroup>
32081 </informaltable>
32082 <para>
32083 <indexterm role="concept">
32084 <primary>timeout</primary>
32085 <secondary>of router</secondary>
32086 </indexterm>
32087 <indexterm role="concept">
32088 <primary>router</primary>
32089 <secondary>timeout</secondary>
32090 </indexterm>
32091 If a router times out during a host lookup, it normally causes deferral of the
32092 address. If <option>pass_on_timeout</option> is set, the address is passed on to the next
32093 router, overriding <option>no_more</option>. This may be helpful for systems that are
32094 intermittently connected to the Internet, or those that want to pass to a smart
32095 host any messages that cannot immediately be delivered.
32096 </para>
32097 <para>
32098 There are occasional other temporary errors that can occur while doing DNS
32099 lookups. They are treated in the same way as a timeout, and this option
32100 applies to all of them.
32101 </para>
32102 <para>
32103 <indexterm role="option">
32104 <primary><option>pass_router</option></primary>
32105 </indexterm>
32106 </para>
32107 <informaltable frame="all">
32108 <tgroup cols="4" colsep="0" rowsep="0">
32109 <colspec colwidth="8*" align="left"/>
32110 <colspec colwidth="6*" align="center"/>
32111 <colspec colwidth="6*" align="center"/>
32112 <colspec colwidth="6*" align="right"/>
32113 <tbody>
32114 <row>
32115 <entry><option>pass_router</option></entry>
32116 <entry>Use: <emphasis>routers</emphasis></entry>
32117 <entry>Type: <emphasis>string</emphasis></entry>
32118 <entry>Default: <emphasis>unset</emphasis></entry>
32119 </row>
32120 </tbody>
32121 </tgroup>
32122 </informaltable>
32123 <para>
32124 <indexterm role="concept">
32125 <primary>router</primary>
32126 <secondary>go to after <quote>pass</quote></secondary>
32127 </indexterm>
32128 Routers that recognize the generic <option>self</option> option (<command>dnslookup</command>,
32129 <command>ipliteral</command>, and <command>manualroute</command>) are able to return <quote>pass</quote>, forcing
32130 routing to continue, and overriding a false setting of <option>more</option>. When one of
32131 these routers returns <quote>pass</quote>, the address is normally handed on to the next
32132 router in sequence. This can be changed by setting <option>pass_router</option> to the name
32133 of another router. However (unlike <option>redirect_router</option>) the named router must
32134 be below the current router, to avoid loops. Note that this option applies only
32135 to the special case of <quote>pass</quote>. It does not apply when a router returns
32136 <quote>decline</quote> because it cannot handle an address.
32137 </para>
32138 <para>
32139 <indexterm role="option">
32140 <primary><option>redirect_router</option></primary>
32141 </indexterm>
32142 </para>
32143 <informaltable frame="all">
32144 <tgroup cols="4" colsep="0" rowsep="0">
32145 <colspec colwidth="8*" align="left"/>
32146 <colspec colwidth="6*" align="center"/>
32147 <colspec colwidth="6*" align="center"/>
32148 <colspec colwidth="6*" align="right"/>
32149 <tbody>
32150 <row>
32151 <entry><option>redirect_router</option></entry>
32152 <entry>Use: <emphasis>routers</emphasis></entry>
32153 <entry>Type: <emphasis>string</emphasis></entry>
32154 <entry>Default: <emphasis>unset</emphasis></entry>
32155 </row>
32156 </tbody>
32157 </tgroup>
32158 </informaltable>
32159 <para>
32160 <indexterm role="concept">
32161 <primary>router</primary>
32162 <secondary>start at after redirection</secondary>
32163 </indexterm>
32164 Sometimes an administrator knows that it is pointless to reprocess addresses
32165 generated from alias or forward files with the same router again. For
32166 example, if an alias file translates real names into login ids there is no
32167 point searching the alias file a second time, especially if it is a large file.
32168 </para>
32169 <para>
32170 The <option>redirect_router</option> option can be set to the name of any router instance.
32171 It causes the routing of any generated addresses to start at the named router
32172 instead of at the first router. This option has no effect if the router in
32173 which it is set does not generate new addresses.
32174 </para>
32175 <para>
32176 <indexterm role="option">
32177 <primary><option>require_files</option></primary>
32178 </indexterm>
32179 </para>
32180 <informaltable frame="all">
32181 <tgroup cols="4" colsep="0" rowsep="0">
32182 <colspec colwidth="8*" align="left"/>
32183 <colspec colwidth="6*" align="center"/>
32184 <colspec colwidth="6*" align="center"/>
32185 <colspec colwidth="6*" align="right"/>
32186 <tbody>
32187 <row>
32188 <entry><option>require_files</option></entry>
32189 <entry>Use: <emphasis>routers</emphasis>&Dagger;<emphasis></emphasis></entry>
32190 <entry>Type: <emphasis>string list</emphasis>&dagger;<emphasis></emphasis></entry>
32191 <entry>Default: <emphasis>unset</emphasis></entry>
32192 </row>
32193 </tbody>
32194 </tgroup>
32195 </informaltable>
32196 <para>
32197 <indexterm role="concept">
32198 <primary>file</primary>
32199 <secondary>requiring for router</secondary>
32200 </indexterm>
32201 <indexterm role="concept">
32202 <primary>router</primary>
32203 <secondary>requiring file existence</secondary>
32204 </indexterm>
32205 This option provides a general mechanism for predicating the running of a
32206 router on the existence or non-existence of certain files or directories.
32207 Before running a router, as one of its precondition tests, Exim works its way
32208 through the <option>require_files</option> list, expanding each item separately.
32209 </para>
32210 <para>
32211 Because the list is split before expansion, any colons in expansion items must
32212 be doubled, or the facility for using a different list separator must be used.
32213 If any expansion is forced to fail, the item is ignored. Other expansion
32214 failures cause routing of the address to be deferred.
32215 </para>
32216 <para>
32217 If any expanded string is empty, it is ignored. Otherwise, except as described
32218 below, each string must be a fully qualified file path, optionally preceded by
32219 <quote>!</quote>. The paths are passed to the <function>stat()</function> function to test for the
32220 existence of the files or directories. The router is skipped if any paths not
32221 preceded by <quote>!</quote> do not exist, or if any paths preceded by <quote>!</quote> do exist.
32222 </para>
32223 <para>
32224 <indexterm role="concept">
32225 <primary>NFS</primary>
32226 </indexterm>
32227 If <function>stat()</function> cannot determine whether a file exists or not, delivery of
32228 the message is deferred. This can happen when NFS-mounted filesystems are
32229 unavailable.
32230 </para>
32231 <para>
32232 This option is checked after the <option>domains</option>, <option>local_parts</option>, and <option>senders</option>
32233 options, so you cannot use it to check for the existence of a file in which to
32234 look up a domain, local part, or sender. (See section <xref linkend="SECTrouprecon"/> for a
32235 full list of the order in which preconditions are evaluated.) However, as
32236 these options are all expanded, you can use the <option>exists</option> expansion condition
32237 to make such tests. The <option>require_files</option> option is intended for checking files
32238 that the router may be going to use internally, or which are needed by a
32239 transport (for example <filename>.procmailrc</filename>).
32240 </para>
32241 <para>
32242 During delivery, the <function>stat()</function> function is run as root, but there is a
32243 facility for some checking of the accessibility of a file by another user.
32244 This is not a proper permissions check, but just a <quote>rough</quote> check that
32245 operates as follows:
32246 </para>
32247 <para>
32248 If an item in a <option>require_files</option> list does not contain any forward slash
32249 characters, it is taken to be the user (and optional group, separated by a
32250 comma) to be checked for subsequent files in the list. If no group is specified
32251 but the user is specified symbolically, the gid associated with the uid is
32252 used. For example:
32253 </para>
32254 <literallayout class="monospaced">
32255 require_files = mail:/some/file
32256 require_files = $local_part:$home/.procmailrc
32257 </literallayout>
32258 <para>
32259 If a user or group name in a <option>require_files</option> list does not exist, the
32260 <option>require_files</option> condition fails.
32261 </para>
32262 <para>
32263 Exim performs the check by scanning along the components of the file path, and
32264 checking the access for the given uid and gid. It checks for <quote>x</quote> access on
32265 directories, and <quote>r</quote> access on the final file. Note that this means that file
32266 access control lists, if the operating system has them, are ignored.
32267 </para>
32268 <para>
32269 <emphasis role="bold">Warning 1</emphasis>: When the router is being run to verify addresses for an
32270 incoming SMTP message, Exim is not running as root, but under its own uid. This
32271 may affect the result of a <option>require_files</option> check. In particular, <function>stat()</function>
32272 may yield the error EACCES (<quote>Permission denied</quote>). This means that the Exim
32273 user is not permitted to read one of the directories on the file&#x2019;s path.
32274 </para>
32275 <para>
32276 <emphasis role="bold">Warning 2</emphasis>: Even when Exim is running as root while delivering a message,
32277 <function>stat()</function> can yield EACCES for a file in an NFS directory that is mounted
32278 without root access. In this case, if a check for access by a particular user
32279 is requested, Exim creates a subprocess that runs as that user, and tries the
32280 check again in that process.
32281 </para>
32282 <para>
32283 The default action for handling an unresolved EACCES is to consider it to
32284 be caused by a configuration error, and routing is deferred because the
32285 existence or non-existence of the file cannot be determined. However, in some
32286 circumstances it may be desirable to treat this condition as if the file did
32287 not exist. If the file name (or the exclamation mark that precedes the file
32288 name for non-existence) is preceded by a plus sign, the EACCES error is treated
32289 as if the file did not exist. For example:
32290 </para>
32291 <literallayout class="monospaced">
32292 require_files = +/some/file
32293 </literallayout>
32294 <para>
32295 If the router is not an essential part of verification (for example, it
32296 handles users&#x2019; <filename>.forward</filename> files), another solution is to set the <option>verify</option>
32297 option false so that the router is skipped when verifying.
32298 </para>
32299 <para>
32300 <indexterm role="option">
32301 <primary><option>retry_use_local_part</option></primary>
32302 </indexterm>
32303 </para>
32304 <informaltable frame="all">
32305 <tgroup cols="4" colsep="0" rowsep="0">
32306 <colspec colwidth="8*" align="left"/>
32307 <colspec colwidth="6*" align="center"/>
32308 <colspec colwidth="6*" align="center"/>
32309 <colspec colwidth="6*" align="right"/>
32310 <tbody>
32311 <row>
32312 <entry><option>retry_use_local_part</option></entry>
32313 <entry>Use: <emphasis>routers</emphasis></entry>
32314 <entry>Type: <emphasis>boolean</emphasis></entry>
32315 <entry>Default: <emphasis>see below</emphasis></entry>
32316 </row>
32317 </tbody>
32318 </tgroup>
32319 </informaltable>
32320 <para>
32321 <indexterm role="concept">
32322 <primary>hints database</primary>
32323 <secondary>retry keys</secondary>
32324 </indexterm>
32325 <indexterm role="concept">
32326 <primary>local part</primary>
32327 <secondary>in retry keys</secondary>
32328 </indexterm>
32329 When a delivery suffers a temporary routing failure, a retry record is created
32330 in Exim&#x2019;s hints database. For addresses whose routing depends only on the
32331 domain, the key for the retry record should not involve the local part, but for
32332 other addresses, both the domain and the local part should be included.
32333 Usually, remote routing is of the former kind, and local routing is of the
32334 latter kind.
32335 </para>
32336 <para>
32337 This option controls whether the local part is used to form the key for retry
32338 hints for addresses that suffer temporary errors while being handled by this
32339 router. The default value is true for any router that has <option>check_local_user</option>
32340 set, and false otherwise. Note that this option does not apply to hints keys
32341 for transport delays; they are controlled by a generic transport option of the
32342 same name.
32343 </para>
32344 <para>
32345 The setting of <option>retry_use_local_part</option> applies only to the router on which it
32346 appears. If the router generates child addresses, they are routed
32347 independently; this setting does not become attached to them.
32348 </para>
32349 <para>
32350 <indexterm role="option">
32351 <primary><option>router_home_directory</option></primary>
32352 </indexterm>
32353 </para>
32354 <informaltable frame="all">
32355 <tgroup cols="4" colsep="0" rowsep="0">
32356 <colspec colwidth="8*" align="left"/>
32357 <colspec colwidth="6*" align="center"/>
32358 <colspec colwidth="6*" align="center"/>
32359 <colspec colwidth="6*" align="right"/>
32360 <tbody>
32361 <row>
32362 <entry><option>router_home_directory</option></entry>
32363 <entry>Use: <emphasis>routers</emphasis></entry>
32364 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
32365 <entry>Default: <emphasis>unset</emphasis></entry>
32366 </row>
32367 </tbody>
32368 </tgroup>
32369 </informaltable>
32370 <para>
32371 <indexterm role="concept">
32372 <primary>router</primary>
32373 <secondary>home directory for</secondary>
32374 </indexterm>
32375 <indexterm role="concept">
32376 <primary>home directory</primary>
32377 <secondary>for router</secondary>
32378 </indexterm>
32379 <indexterm role="variable">
32380 <primary><varname>$home</varname></primary>
32381 </indexterm>
32382 This option sets a home directory for use while the router is running. (Compare
32383 <option>transport_home_directory</option>, which sets a home directory for later
32384 transporting.) In particular, if used on a <command>redirect</command> router, this option
32385 sets a value for <varname>$home</varname> while a filter is running. The value is expanded;
32386 forced expansion failure causes the option to be ignored &ndash; other failures
32387 cause the router to defer.
32388 </para>
32389 <para>
32390 Expansion of <option>router_home_directory</option> happens immediately after the
32391 <option>check_local_user</option> test (if configured), before any further expansions take
32392 place.
32393 (See section <xref linkend="SECTrouprecon"/> for a list of the order in which preconditions
32394 are evaluated.)
32395 While the router is running, <option>router_home_directory</option> overrides the value of
32396 <varname>$home</varname> that came from <option>check_local_user</option>.
32397 </para>
32398 <para>
32399 When a router accepts an address and assigns it to a local transport (including
32400 the cases when a <command>redirect</command> router generates a pipe, file, or autoreply
32401 delivery), the home directory setting for the transport is taken from the first
32402 of these values that is set:
32403 </para>
32404 <itemizedlist>
32405 <listitem>
32406 <para>
32407 The <option>home_directory</option> option on the transport;
32408 </para>
32409 </listitem>
32410 <listitem>
32411 <para>
32412 The <option>transport_home_directory</option> option on the router;
32413 </para>
32414 </listitem>
32415 <listitem>
32416 <para>
32417 The password data if <option>check_local_user</option> is set on the router;
32418 </para>
32419 </listitem>
32420 <listitem>
32421 <para>
32422 The <option>router_home_directory</option> option on the router.
32423 </para>
32424 </listitem>
32425 </itemizedlist>
32426 <para>
32427 In other words, <option>router_home_directory</option> overrides the password data for the
32428 router, but not for the transport.
32429 </para>
32430 <para>
32431 <indexterm role="option">
32432 <primary><option>self</option></primary>
32433 </indexterm>
32434 </para>
32435 <informaltable frame="all">
32436 <tgroup cols="4" colsep="0" rowsep="0">
32437 <colspec colwidth="8*" align="left"/>
32438 <colspec colwidth="6*" align="center"/>
32439 <colspec colwidth="6*" align="center"/>
32440 <colspec colwidth="6*" align="right"/>
32441 <tbody>
32442 <row>
32443 <entry><option>self</option></entry>
32444 <entry>Use: <emphasis>routers</emphasis></entry>
32445 <entry>Type: <emphasis>string</emphasis></entry>
32446 <entry>Default: <emphasis>freeze</emphasis></entry>
32447 </row>
32448 </tbody>
32449 </tgroup>
32450 </informaltable>
32451 <para>
32452 <indexterm role="concept">
32453 <primary>MX record</primary>
32454 <secondary>pointing to local host</secondary>
32455 </indexterm>
32456 <indexterm role="concept">
32457 <primary>local host</primary>
32458 <secondary>MX pointing to</secondary>
32459 </indexterm>
32460 This option applies to those routers that use a recipient address to find a
32461 list of remote hosts. Currently, these are the <command>dnslookup</command>, <command>ipliteral</command>,
32462 and <command>manualroute</command> routers.
32463 Certain configurations of the <command>queryprogram</command> router can also specify a list
32464 of remote hosts.
32465 Usually such routers are configured to send the message to a remote host via an
32466 <command>smtp</command> transport. The <option>self</option> option specifies what happens when the first
32467 host on the list turns out to be the local host.
32468 The way in which Exim checks for the local host is described in section
32469 <xref linkend="SECTreclocipadd"/>.
32470 </para>
32471 <para>
32472 Normally this situation indicates either an error in Exim&#x2019;s configuration (for
32473 example, the router should be configured not to process this domain), or an
32474 error in the DNS (for example, the MX should not point to this host). For this
32475 reason, the default action is to log the incident, defer the address, and
32476 freeze the message. The following alternatives are provided for use in special
32477 cases:
32478 </para>
32479 <variablelist>
32480 <varlistentry>
32481 <term><option>defer</option></term>
32482 <listitem>
32483 <para>
32484 Delivery of the message is tried again later, but the message is not frozen.
32485 </para>
32486 </listitem></varlistentry>
32487 <varlistentry>
32488 <term><option>reroute</option>: &lt;<emphasis>domain</emphasis>&gt;</term>
32489 <listitem>
32490 <para>
32491 The domain is changed to the given domain, and the address is passed back to
32492 be reprocessed by the routers. No rewriting of headers takes place. This
32493 behaviour is essentially a redirection.
32494 </para>
32495 </listitem></varlistentry>
32496 <varlistentry>
32497 <term><option>reroute: rewrite:</option> &lt;<emphasis>domain</emphasis>&gt;</term>
32498 <listitem>
32499 <para>
32500 The domain is changed to the given domain, and the address is passed back to be
32501 reprocessed by the routers. Any headers that contain the original domain are
32502 rewritten.
32503 </para>
32504 </listitem></varlistentry>
32505 <varlistentry>
32506 <term><option>pass</option></term>
32507 <listitem>
32508 <para>
32509 <indexterm role="option">
32510 <primary><option>more</option></primary>
32511 </indexterm>
32512 <indexterm role="variable">
32513 <primary><varname>$self_hostname</varname></primary>
32514 </indexterm>
32515 The router passes the address to the next router, or to the router named in the
32516 <option>pass_router</option> option if it is set. This overrides <option>no_more</option>. During
32517 subsequent routing and delivery, the variable <varname>$self_hostname</varname> contains the
32518 name of the local host that the router encountered. This can be used to
32519 distinguish between different cases for hosts with multiple names. The
32520 combination
32521 </para>
32522 <literallayout class="monospaced">
32523 self = pass
32524 no_more
32525 </literallayout>
32526 <para>
32527 ensures that only those addresses that routed to the local host are passed on.
32528 Without <option>no_more</option>, addresses that were declined for other reasons would also
32529 be passed to the next router.
32530 </para>
32531 </listitem></varlistentry>
32532 <varlistentry>
32533 <term><option>fail</option></term>
32534 <listitem>
32535 <para>
32536 Delivery fails and an error report is generated.
32537 </para>
32538 </listitem></varlistentry>
32539 <varlistentry>
32540 <term><option>send</option></term>
32541 <listitem>
32542 <para>
32543 <indexterm role="concept">
32544 <primary>local host</primary>
32545 <secondary>sending to</secondary>
32546 </indexterm>
32547 The anomaly is ignored and the address is queued for the transport. This
32548 setting should be used with extreme caution. For an <command>smtp</command> transport, it
32549 makes sense only in cases where the program that is listening on the SMTP port
32550 is not this version of Exim. That is, it must be some other MTA, or Exim with a
32551 different configuration file that handles the domain in another way.
32552 </para>
32553 </listitem></varlistentry>
32554 </variablelist>
32555 <para>
32556 <indexterm role="option">
32557 <primary><option>senders</option></primary>
32558 </indexterm>
32559 </para>
32560 <informaltable frame="all">
32561 <tgroup cols="4" colsep="0" rowsep="0">
32562 <colspec colwidth="8*" align="left"/>
32563 <colspec colwidth="6*" align="center"/>
32564 <colspec colwidth="6*" align="center"/>
32565 <colspec colwidth="6*" align="right"/>
32566 <tbody>
32567 <row>
32568 <entry><option>senders</option></entry>
32569 <entry>Use: <emphasis>routers</emphasis>&Dagger;<emphasis></emphasis></entry>
32570 <entry>Type: <emphasis>address list</emphasis>&dagger;<emphasis></emphasis></entry>
32571 <entry>Default: <emphasis>unset</emphasis></entry>
32572 </row>
32573 </tbody>
32574 </tgroup>
32575 </informaltable>
32576 <para>
32577 <indexterm role="concept">
32578 <primary>router</primary>
32579 <secondary>checking senders</secondary>
32580 </indexterm>
32581 If this option is set, the router is skipped unless the message&#x2019;s sender
32582 address matches something on the list.
32583 See section <xref linkend="SECTrouprecon"/> for a list of the order in which preconditions
32584 are evaluated.
32585 </para>
32586 <para>
32587 There are issues concerning verification when the running of routers is
32588 dependent on the sender. When Exim is verifying the address in an <option>errors_to</option>
32589 setting, it sets the sender to the null string. When using the <option>-bt</option> option
32590 to check a configuration file, it is necessary also to use the <option>-f</option> option to
32591 set an appropriate sender. For incoming mail, the sender is unset when
32592 verifying the sender, but is available when verifying any recipients. If the
32593 SMTP VRFY command is enabled, it must be used after MAIL if the sender address
32594 matters.
32595 </para>
32596 <para>
32597 <indexterm role="option">
32598 <primary><option>translate_ip_address</option></primary>
32599 </indexterm>
32600 </para>
32601 <informaltable frame="all">
32602 <tgroup cols="4" colsep="0" rowsep="0">
32603 <colspec colwidth="8*" align="left"/>
32604 <colspec colwidth="6*" align="center"/>
32605 <colspec colwidth="6*" align="center"/>
32606 <colspec colwidth="6*" align="right"/>
32607 <tbody>
32608 <row>
32609 <entry><option>translate_ip_address</option></entry>
32610 <entry>Use: <emphasis>routers</emphasis></entry>
32611 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
32612 <entry>Default: <emphasis>unset</emphasis></entry>
32613 </row>
32614 </tbody>
32615 </tgroup>
32616 </informaltable>
32617 <para>
32618 <indexterm role="concept">
32619 <primary>IP address</primary>
32620 <secondary>translating</secondary>
32621 </indexterm>
32622 <indexterm role="concept">
32623 <primary>packet radio</primary>
32624 </indexterm>
32625 <indexterm role="concept">
32626 <primary>router</primary>
32627 <secondary>IP address translation</secondary>
32628 </indexterm>
32629 There exist some rare networking situations (for example, packet radio) where
32630 it is helpful to be able to translate IP addresses generated by normal routing
32631 mechanisms into other IP addresses, thus performing a kind of manual IP
32632 routing. This should be done only if the normal IP routing of the TCP/IP stack
32633 is inadequate or broken. Because this is an extremely uncommon requirement, the
32634 code to support this option is not included in the Exim binary unless
32635 SUPPORT_TRANSLATE_IP_ADDRESS=yes is set in <filename>Local/Makefile</filename>.
32636 </para>
32637 <para>
32638 <indexterm role="variable">
32639 <primary><varname>$host_address</varname></primary>
32640 </indexterm>
32641 The <option>translate_ip_address</option> string is expanded for every IP address generated
32642 by the router, with the generated address set in <varname>$host_address</varname>. If the
32643 expansion is forced to fail, no action is taken.
32644 For any other expansion error, delivery of the message is deferred.
32645 If the result of the expansion is an IP address, that replaces the original
32646 address; otherwise the result is assumed to be a host name &ndash; this is looked
32647 up using <function>gethostbyname()</function> (or <function>getipnodebyname()</function> when available) to
32648 produce one or more replacement IP addresses. For example, to subvert all IP
32649 addresses in some specific networks, this could be added to a router:
32650 </para>
32651 <literallayout class="monospaced">
32652 translate_ip_address = \
32653   ${lookup{${mask:$host_address/26}}lsearch{/some/file}\
32654     {$value}fail}}
32655 </literallayout>
32656 <para>
32657 The file would contain lines like
32658 </para>
32659 <literallayout class="monospaced">
32660 10.2.3.128/26    some.host
32661 10.8.4.34/26     10.44.8.15
32662 </literallayout>
32663 <para>
32664 You should not make use of this facility unless you really understand what you
32665 are doing.
32666 </para>
32667 <para>
32668 <indexterm role="option">
32669 <primary><option>transport</option></primary>
32670 </indexterm>
32671 </para>
32672 <informaltable frame="all">
32673 <tgroup cols="4" colsep="0" rowsep="0">
32674 <colspec colwidth="8*" align="left"/>
32675 <colspec colwidth="6*" align="center"/>
32676 <colspec colwidth="6*" align="center"/>
32677 <colspec colwidth="6*" align="right"/>
32678 <tbody>
32679 <row>
32680 <entry><option>transport</option></entry>
32681 <entry>Use: <emphasis>routers</emphasis></entry>
32682 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
32683 <entry>Default: <emphasis>unset</emphasis></entry>
32684 </row>
32685 </tbody>
32686 </tgroup>
32687 </informaltable>
32688 <para>
32689 This option specifies the transport to be used when a router accepts an address
32690 and sets it up for delivery. A transport is never needed if a router is used
32691 only for verification. The value of the option is expanded at routing time,
32692 after the expansion of <option>errors_to</option>, <option>headers_add</option>, and <option>headers_remove</option>,
32693 and result must be the name of one of the configured transports. If it is not,
32694 delivery is deferred.
32695 </para>
32696 <para>
32697 The <option>transport</option> option is not used by the <command>redirect</command> router, but it does
32698 have some private options that set up transports for pipe and file deliveries
32699 (see chapter <xref linkend="CHAPredirect"/>).
32700 </para>
32701 <para>
32702 <indexterm role="option">
32703 <primary><option>transport_current_directory</option></primary>
32704 </indexterm>
32705 </para>
32706 <informaltable frame="all">
32707 <tgroup cols="4" colsep="0" rowsep="0">
32708 <colspec colwidth="8*" align="left"/>
32709 <colspec colwidth="6*" align="center"/>
32710 <colspec colwidth="6*" align="center"/>
32711 <colspec colwidth="6*" align="right"/>
32712 <tbody>
32713 <row>
32714 <entry><option>transport_current_directory</option></entry>
32715 <entry>Use: <emphasis>routers</emphasis></entry>
32716 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
32717 <entry>Default: <emphasis>unset</emphasis></entry>
32718 </row>
32719 </tbody>
32720 </tgroup>
32721 </informaltable>
32722 <para>
32723 <indexterm role="concept">
32724 <primary>current directory for local transport</primary>
32725 </indexterm>
32726 This option associates a current directory with any address that is routed
32727 to a local transport. This can happen either because a transport is
32728 explicitly configured for the router, or because it generates a delivery to a
32729 file or a pipe. During the delivery process (that is, at transport time), this
32730 option string is expanded and is set as the current directory, unless
32731 overridden by a setting on the transport.
32732 If the expansion fails for any reason, including forced failure, an error is
32733 logged, and delivery is deferred.
32734 See chapter <xref linkend="CHAPenvironment"/> for details of the local delivery
32735 environment.
32736 </para>
32737 <para>
32738 <indexterm role="option">
32739 <primary><option>transport_home_directory</option></primary>
32740 </indexterm>
32741 </para>
32742 <informaltable frame="all">
32743 <tgroup cols="4" colsep="0" rowsep="0">
32744 <colspec colwidth="8*" align="left"/>
32745 <colspec colwidth="6*" align="center"/>
32746 <colspec colwidth="6*" align="center"/>
32747 <colspec colwidth="6*" align="right"/>
32748 <tbody>
32749 <row>
32750 <entry><option>transport_home_directory</option></entry>
32751 <entry>Use: <emphasis>routers</emphasis></entry>
32752 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
32753 <entry>Default: <emphasis>see below</emphasis></entry>
32754 </row>
32755 </tbody>
32756 </tgroup>
32757 </informaltable>
32758 <para>
32759 <indexterm role="concept">
32760 <primary>home directory</primary>
32761 <secondary>for local transport</secondary>
32762 </indexterm>
32763 This option associates a home directory with any address that is routed to a
32764 local transport. This can happen either because a transport is explicitly
32765 configured for the router, or because it generates a delivery to a file or a
32766 pipe. During the delivery process (that is, at transport time), the option
32767 string is expanded and is set as the home directory, unless overridden by a
32768 setting of <option>home_directory</option> on the transport.
32769 If the expansion fails for any reason, including forced failure, an error is
32770 logged, and delivery is deferred.
32771 </para>
32772 <para>
32773 If the transport does not specify a home directory, and
32774 <option>transport_home_directory</option> is not set for the router, the home directory for
32775 the transport is taken from the password data if <option>check_local_user</option> is set for
32776 the router. Otherwise it is taken from <option>router_home_directory</option> if that option
32777 is set; if not, no home directory is set for the transport.
32778 </para>
32779 <para>
32780 See chapter <xref linkend="CHAPenvironment"/> for further details of the local delivery
32781 environment.
32782 </para>
32783 <para>
32784 <indexterm role="option">
32785 <primary><option>unseen</option></primary>
32786 </indexterm>
32787 </para>
32788 <informaltable frame="all">
32789 <tgroup cols="4" colsep="0" rowsep="0">
32790 <colspec colwidth="8*" align="left"/>
32791 <colspec colwidth="6*" align="center"/>
32792 <colspec colwidth="6*" align="center"/>
32793 <colspec colwidth="6*" align="right"/>
32794 <tbody>
32795 <row>
32796 <entry><option>unseen</option></entry>
32797 <entry>Use: <emphasis>routers</emphasis></entry>
32798 <entry>Type: <emphasis>boolean</emphasis>&dagger;<emphasis></emphasis></entry>
32799 <entry>Default: <emphasis>false</emphasis></entry>
32800 </row>
32801 </tbody>
32802 </tgroup>
32803 </informaltable>
32804 <para>
32805 <indexterm role="concept">
32806 <primary>router</primary>
32807 <secondary>carrying on after success</secondary>
32808 </indexterm>
32809 The result of string expansion for this option must be a valid boolean value,
32810 that is, one of the strings <quote>yes</quote>, <quote>no</quote>, <quote>true</quote>, or <quote>false</quote>. Any other
32811 result causes an error, and delivery is deferred. If the expansion is forced to
32812 fail, the default value for the option (false) is used. Other failures cause
32813 delivery to be deferred.
32814 </para>
32815 <para>
32816 When this option is set true, routing does not cease if the router accepts the
32817 address. Instead, a copy of the incoming address is passed to the next router,
32818 overriding a false setting of <option>more</option>. There is little point in setting
32819 <option>more</option> false if <option>unseen</option> is always true, but it may be useful in cases when
32820 the value of <option>unseen</option> contains expansion items (and therefore, presumably, is
32821 sometimes true and sometimes false).
32822 </para>
32823 <para>
32824 <indexterm role="concept">
32825 <primary>copy of message (<option>unseen</option> option)</primary>
32826 </indexterm>
32827 Setting the <option>unseen</option> option has a similar effect to the <option>unseen</option> command
32828 qualifier in filter files. It can be used to cause copies of messages to be
32829 delivered to some other destination, while also carrying out a normal delivery.
32830 In effect, the current address is made into a <quote>parent</quote> that has two children
32831 &ndash; one that is delivered as specified by this router, and a clone that goes on
32832 to be routed further. For this reason, <option>unseen</option> may not be combined with the
32833 <option>one_time</option> option in a <command>redirect</command> router.
32834 </para>
32835 <para>
32836 <emphasis role="bold">Warning</emphasis>: Header lines added to the address (or specified for removal) by
32837 this router or by previous routers affect the <quote>unseen</quote> copy of the message
32838 only. The clone that continues to be processed by further routers starts with
32839 no added headers and none specified for removal. For a <option>redirect</option> router, if
32840 a generated address is the same as the incoming address, this can lead to
32841 duplicate addresses with different header modifications. Exim does not do
32842 duplicate deliveries (except, in certain circumstances, to pipes -- see section
32843 <xref linkend="SECTdupaddr"/>), but it is undefined which of the duplicates is discarded,
32844 so this ambiguous situation should be avoided. The <option>repeat_use</option> option of the
32845 <option>redirect</option> router may be of help.
32846 </para>
32847 <para>
32848 Unlike the handling of header modifications, any data that was set by the
32849 <option>address_data</option> option in the current or previous routers <emphasis>is</emphasis> passed on to
32850 subsequent routers.
32851 </para>
32852 <para>
32853 <indexterm role="option">
32854 <primary><option>user</option></primary>
32855 </indexterm>
32856 </para>
32857 <informaltable frame="all">
32858 <tgroup cols="4" colsep="0" rowsep="0">
32859 <colspec colwidth="8*" align="left"/>
32860 <colspec colwidth="6*" align="center"/>
32861 <colspec colwidth="6*" align="center"/>
32862 <colspec colwidth="6*" align="right"/>
32863 <tbody>
32864 <row>
32865 <entry><option>user</option></entry>
32866 <entry>Use: <emphasis>routers</emphasis></entry>
32867 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
32868 <entry>Default: <emphasis>see below</emphasis></entry>
32869 </row>
32870 </tbody>
32871 </tgroup>
32872 </informaltable>
32873 <para>
32874 <indexterm role="concept">
32875 <primary>uid (user id)</primary>
32876 <secondary>local delivery</secondary>
32877 </indexterm>
32878 <indexterm role="concept">
32879 <primary>local transports</primary>
32880 <secondary>uid and gid</secondary>
32881 </indexterm>
32882 <indexterm role="concept">
32883 <primary>transport</primary>
32884 <secondary>local</secondary>
32885 </indexterm>
32886 <indexterm role="concept">
32887 <primary>router</primary>
32888 <secondary>user for filter processing</secondary>
32889 </indexterm>
32890 <indexterm role="concept">
32891 <primary>filter</primary>
32892 <secondary>user for processing</secondary>
32893 </indexterm>
32894 When a router queues an address for a transport, and the transport does not
32895 specify a user, the user given here is used when running the delivery process.
32896 The user may be specified numerically or by name. If expansion fails, the
32897 error is logged and delivery is deferred.
32898 This user is also used by the <command>redirect</command> router when running a filter file.
32899 The default is unset, except when <option>check_local_user</option> is set. In this case,
32900 the default is taken from the password information. If the user is specified as
32901 a name, and <option>group</option> is not set, the group associated with the user is used.
32902 See also <option>initgroups</option> and <option>group</option> and the discussion in chapter
32903 <xref linkend="CHAPenvironment"/>.
32904 </para>
32905 <para>
32906 <indexterm role="option">
32907 <primary><option>verify</option></primary>
32908 </indexterm>
32909 </para>
32910 <informaltable frame="all">
32911 <tgroup cols="4" colsep="0" rowsep="0">
32912 <colspec colwidth="8*" align="left"/>
32913 <colspec colwidth="6*" align="center"/>
32914 <colspec colwidth="6*" align="center"/>
32915 <colspec colwidth="6*" align="right"/>
32916 <tbody>
32917 <row>
32918 <entry><option>verify</option></entry>
32919 <entry>Use: <emphasis>routers</emphasis>&Dagger;<emphasis></emphasis></entry>
32920 <entry>Type: <emphasis>boolean</emphasis></entry>
32921 <entry>Default: <emphasis>true</emphasis></entry>
32922 </row>
32923 </tbody>
32924 </tgroup>
32925 </informaltable>
32926 <para>
32927 Setting this option has the effect of setting <option>verify_sender</option> and
32928 <option>verify_recipient</option> to the same value.
32929 </para>
32930 <para>
32931 <indexterm role="option">
32932 <primary><option>verify_only</option></primary>
32933 </indexterm>
32934 </para>
32935 <informaltable frame="all">
32936 <tgroup cols="4" colsep="0" rowsep="0">
32937 <colspec colwidth="8*" align="left"/>
32938 <colspec colwidth="6*" align="center"/>
32939 <colspec colwidth="6*" align="center"/>
32940 <colspec colwidth="6*" align="right"/>
32941 <tbody>
32942 <row>
32943 <entry><option>verify_only</option></entry>
32944 <entry>Use: <emphasis>routers</emphasis>&Dagger;<emphasis></emphasis></entry>
32945 <entry>Type: <emphasis>boolean</emphasis></entry>
32946 <entry>Default: <emphasis>false</emphasis></entry>
32947 </row>
32948 </tbody>
32949 </tgroup>
32950 </informaltable>
32951 <para>
32952 <indexterm role="concept">
32953 <primary>EXPN</primary>
32954 <secondary>with <option>verify_only</option></secondary>
32955 </indexterm>
32956 <indexterm role="option">
32957 <primary><option>-bv</option></primary>
32958 </indexterm>
32959 <indexterm role="concept">
32960 <primary>router</primary>
32961 <secondary>used only when verifying</secondary>
32962 </indexterm>
32963 If this option is set, the router is used only when verifying an address,
32964 delivering in cutthrough mode or
32965 testing with the <option>-bv</option> option, not when actually doing a delivery, testing
32966 with the <option>-bt</option> option, or running the SMTP EXPN command. It can be further
32967 restricted to verifying only senders or recipients by means of
32968 <option>verify_sender</option> and <option>verify_recipient</option>.
32969 </para>
32970 <para>
32971 <emphasis role="bold">Warning</emphasis>: When the router is being run to verify addresses for an incoming
32972 SMTP message, Exim is not running as root, but under its own uid. If the router
32973 accesses any files, you need to make sure that they are accessible to the Exim
32974 user or group.
32975 </para>
32976 <para>
32977 <indexterm role="option">
32978 <primary><option>verify_recipient</option></primary>
32979 </indexterm>
32980 </para>
32981 <informaltable frame="all">
32982 <tgroup cols="4" colsep="0" rowsep="0">
32983 <colspec colwidth="8*" align="left"/>
32984 <colspec colwidth="6*" align="center"/>
32985 <colspec colwidth="6*" align="center"/>
32986 <colspec colwidth="6*" align="right"/>
32987 <tbody>
32988 <row>
32989 <entry><option>verify_recipient</option></entry>
32990 <entry>Use: <emphasis>routers</emphasis>&Dagger;<emphasis></emphasis></entry>
32991 <entry>Type: <emphasis>boolean</emphasis></entry>
32992 <entry>Default: <emphasis>true</emphasis></entry>
32993 </row>
32994 </tbody>
32995 </tgroup>
32996 </informaltable>
32997 <para>
32998 If this option is false, the router is skipped when verifying recipient
32999 addresses,
33000 delivering in cutthrough mode
33001 or testing recipient verification using <option>-bv</option>.
33002 See section <xref linkend="SECTrouprecon"/> for a list of the order in which preconditions
33003 are evaluated.
33004 </para>
33005 <para>
33006 <indexterm role="option">
33007 <primary><option>verify_sender</option></primary>
33008 </indexterm>
33009 </para>
33010 <informaltable frame="all">
33011 <tgroup cols="4" colsep="0" rowsep="0">
33012 <colspec colwidth="8*" align="left"/>
33013 <colspec colwidth="6*" align="center"/>
33014 <colspec colwidth="6*" align="center"/>
33015 <colspec colwidth="6*" align="right"/>
33016 <tbody>
33017 <row>
33018 <entry><option>verify_sender</option></entry>
33019 <entry>Use: <emphasis>routers</emphasis>&Dagger;<emphasis></emphasis></entry>
33020 <entry>Type: <emphasis>boolean</emphasis></entry>
33021 <entry>Default: <emphasis>true</emphasis></entry>
33022 </row>
33023 </tbody>
33024 </tgroup>
33025 </informaltable>
33026 <para>
33027 If this option is false, the router is skipped when verifying sender addresses
33028 or testing sender verification using <option>-bvs</option>.
33029 See section <xref linkend="SECTrouprecon"/> for a list of the order in which preconditions
33030 are evaluated.
33031 <indexterm role="concept" startref="IIDgenoprou1" class="endofrange"/>
33032 <indexterm role="concept" startref="IIDgenoprou2" class="endofrange"/>
33033 </para>
33034 </chapter>
33035
33036 <chapter id="CHID4">
33037 <title>The accept router</title>
33038 <para>
33039 <indexterm role="concept">
33040 <primary><command>accept</command> router</primary>
33041 </indexterm>
33042 <indexterm role="concept">
33043 <primary>routers</primary>
33044 <secondary><command>accept</command></secondary>
33045 </indexterm>
33046 The <command>accept</command> router has no private options of its own. Unless it is being
33047 used purely for verification (see <option>verify_only</option>) a transport is required to
33048 be defined by the generic <option>transport</option> option. If the preconditions that are
33049 specified by generic options are met, the router accepts the address and queues
33050 it for the given transport. The most common use of this router is for setting
33051 up deliveries to local mailboxes. For example:
33052 </para>
33053 <literallayout class="monospaced">
33054 localusers:
33055   driver = accept
33056   domains = mydomain.example
33057   check_local_user
33058   transport = local_delivery
33059 </literallayout>
33060 <para>
33061 The <option>domains</option> condition in this example checks the domain of the address, and
33062 <option>check_local_user</option> checks that the local part is the login of a local user.
33063 When both preconditions are met, the <command>accept</command> router runs, and queues the
33064 address for the <command>local_delivery</command> transport.
33065 </para>
33066 </chapter>
33067
33068 <chapter id="CHAPdnslookup">
33069 <title>The dnslookup router</title>
33070 <para>
33071 <indexterm role="concept" id="IIDdnsrou1" class="startofrange">
33072 <primary><command>dnslookup</command> router</primary>
33073 </indexterm>
33074 <indexterm role="concept" id="IIDdnsrou2" class="startofrange">
33075 <primary>routers</primary>
33076 <secondary><command>dnslookup</command></secondary>
33077 </indexterm>
33078 The <command>dnslookup</command> router looks up the hosts that handle mail for the
33079 recipient&#x2019;s domain in the DNS. A transport must always be set for this router,
33080 unless <option>verify_only</option> is set.
33081 </para>
33082 <para>
33083 If SRV support is configured (see <option>check_srv</option> below), Exim first searches for
33084 SRV records. If none are found, or if SRV support is not configured,
33085 MX records are looked up. If no MX records exist, address records are sought.
33086 However, <option>mx_domains</option> can be set to disable the direct use of address
33087 records.
33088 </para>
33089 <para>
33090 MX records of equal priority are sorted by Exim into a random order. Exim then
33091 looks for address records for the host names obtained from MX or SRV records.
33092 When a host has more than one IP address, they are sorted into a random order,
33093 except that IPv6 addresses are always sorted before IPv4 addresses. If all the
33094 IP addresses found are discarded by a setting of the <option>ignore_target_hosts</option>
33095 generic option, the router declines.
33096 </para>
33097 <para>
33098 Unless they have the highest priority (lowest MX value), MX records that point
33099 to the local host, or to any host name that matches <option>hosts_treat_as_local</option>,
33100 are discarded, together with any other MX records of equal or lower priority.
33101 </para>
33102 <para>
33103 <indexterm role="concept">
33104 <primary>MX record</primary>
33105 <secondary>pointing to local host</secondary>
33106 </indexterm>
33107 <indexterm role="concept">
33108 <primary>local host</primary>
33109 <secondary>MX pointing to</secondary>
33110 </indexterm>
33111 <indexterm role="option">
33112 <primary><option>self</option></primary>
33113 <secondary>in <command>dnslookup</command> router</secondary>
33114 </indexterm>
33115 If the host pointed to by the highest priority MX record, or looked up as an
33116 address record, is the local host, or matches <option>hosts_treat_as_local</option>, what
33117 happens is controlled by the generic <option>self</option> option.
33118 </para>
33119 <section id="SECTprowitdnsloo">
33120 <title>Problems with DNS lookups</title>
33121 <para>
33122 There have been problems with DNS servers when SRV records are looked up.
33123 Some mis-behaving servers return a DNS error or timeout when a non-existent
33124 SRV record is sought. Similar problems have in the past been reported for
33125 MX records. The global <option>dns_again_means_nonexist</option> option can help with this
33126 problem, but it is heavy-handed because it is a global option.
33127 </para>
33128 <para>
33129 For this reason, there are two options, <option>srv_fail_domains</option> and
33130 <option>mx_fail_domains</option>, that control what happens when a DNS lookup in a
33131 <command>dnslookup</command> router results in a DNS failure or a <quote>try again</quote> response. If
33132 an attempt to look up an SRV or MX record causes one of these results, and the
33133 domain matches the relevant list, Exim behaves as if the DNS had responded <quote>no
33134 such record</quote>. In the case of an SRV lookup, this means that the router
33135 proceeds to look for MX records; in the case of an MX lookup, it proceeds to
33136 look for A or AAAA records, unless the domain matches <option>mx_domains</option>, in which
33137 case routing fails.
33138 </para>
33139 </section>
33140 <section id="SECTdnslookupdecline">
33141 <title>Declining addresses by dnslookup</title>
33142 <para>
33143 <indexterm role="concept">
33144 <primary><command>dnslookup</command> router</primary>
33145 <secondary>declines</secondary>
33146 </indexterm>
33147 There are a few cases where a <command>dnslookup</command> router will decline to accept
33148 an address; if such a router is expected to handle "all remaining non-local
33149 domains", then it is important to set <option>no_more</option>.
33150 </para>
33151 <para>
33152 Reasons for a <command>dnslookup</command> router to decline currently include:
33153 </para>
33154 <itemizedlist>
33155 <listitem>
33156 <para>
33157 The domain does not exist in DNS
33158 </para>
33159 </listitem>
33160 <listitem>
33161 <para>
33162 The domain exists but the MX record&#x2019;s host part is just "."; this is a common
33163 convention (borrowed from SRV) used to indicate that there is no such service
33164 for this domain and to not fall back to trying A/AAAA records.
33165 </para>
33166 </listitem>
33167 <listitem>
33168 <para>
33169 Ditto, but for SRV records, when <option>check_srv</option> is set on this router.
33170 </para>
33171 </listitem>
33172 <listitem>
33173 <para>
33174 MX record points to a non-existent host.
33175 </para>
33176 </listitem>
33177 <listitem>
33178 <para>
33179 MX record points to an IP address and the main section option
33180 <option>allow_mx_to_ip</option> is not set.
33181 </para>
33182 </listitem>
33183 <listitem>
33184 <para>
33185 MX records exist and point to valid hosts, but all hosts resolve only to
33186 addresses blocked by the <option>ignore_target_hosts</option> generic option on this router.
33187 </para>
33188 </listitem>
33189 <listitem>
33190 <para>
33191 The domain is not syntactically valid (see also <option>allow_utf8_domains</option> and
33192 <option>dns_check_names_pattern</option> for handling one variant of this)
33193 </para>
33194 </listitem>
33195 <listitem>
33196 <para>
33197 <option>check_secondary_mx</option> is set on this router but the local host can
33198 not be found in the MX records (see below)
33199 </para>
33200 </listitem>
33201 </itemizedlist>
33202 </section>
33203 <section id="SECID118">
33204 <title>Private options for dnslookup</title>
33205 <para>
33206 <indexterm role="concept">
33207 <primary>options</primary>
33208 <secondary><command>dnslookup</command> router</secondary>
33209 </indexterm>
33210 The private options for the <command>dnslookup</command> router are as follows:
33211 </para>
33212 <para>
33213 <indexterm role="option">
33214 <primary><option>check_secondary_mx</option></primary>
33215 </indexterm>
33216 </para>
33217 <informaltable frame="all">
33218 <tgroup cols="4" colsep="0" rowsep="0">
33219 <colspec colwidth="8*" align="left"/>
33220 <colspec colwidth="6*" align="center"/>
33221 <colspec colwidth="6*" align="center"/>
33222 <colspec colwidth="6*" align="right"/>
33223 <tbody>
33224 <row>
33225 <entry><option>check_secondary_mx</option></entry>
33226 <entry>Use: <emphasis>dnslookup</emphasis></entry>
33227 <entry>Type: <emphasis>boolean</emphasis></entry>
33228 <entry>Default: <emphasis>false</emphasis></entry>
33229 </row>
33230 </tbody>
33231 </tgroup>
33232 </informaltable>
33233 <para>
33234 <indexterm role="concept">
33235 <primary>MX record</primary>
33236 <secondary>checking for secondary</secondary>
33237 </indexterm>
33238 If this option is set, the router declines unless the local host is found in
33239 (and removed from) the list of hosts obtained by MX lookup. This can be used to
33240 process domains for which the local host is a secondary mail exchanger
33241 differently to other domains. The way in which Exim decides whether a host is
33242 the local host is described in section <xref linkend="SECTreclocipadd"/>.
33243 </para>
33244 <para>
33245 <indexterm role="option">
33246 <primary><option>check_srv</option></primary>
33247 </indexterm>
33248 </para>
33249 <informaltable frame="all">
33250 <tgroup cols="4" colsep="0" rowsep="0">
33251 <colspec colwidth="8*" align="left"/>
33252 <colspec colwidth="6*" align="center"/>
33253 <colspec colwidth="6*" align="center"/>
33254 <colspec colwidth="6*" align="right"/>
33255 <tbody>
33256 <row>
33257 <entry><option>check_srv</option></entry>
33258 <entry>Use: <emphasis>dnslookup</emphasis></entry>
33259 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
33260 <entry>Default: <emphasis>unset</emphasis></entry>
33261 </row>
33262 </tbody>
33263 </tgroup>
33264 </informaltable>
33265 <para>
33266 <indexterm role="concept">
33267 <primary>SRV record</primary>
33268 <secondary>enabling use of</secondary>
33269 </indexterm>
33270 The <command>dnslookup</command> router supports the use of SRV records (see RFC 2782) in
33271 addition to MX and address records. The support is disabled by default. To
33272 enable SRV support, set the <option>check_srv</option> option to the name of the service
33273 required. For example,
33274 </para>
33275 <literallayout class="monospaced">
33276 check_srv = smtp
33277 </literallayout>
33278 <para>
33279 looks for SRV records that refer to the normal smtp service. The option is
33280 expanded, so the service name can vary from message to message or address
33281 to address. This might be helpful if SRV records are being used for a
33282 submission service. If the expansion is forced to fail, the <option>check_srv</option>
33283 option is ignored, and the router proceeds to look for MX records in the
33284 normal way.
33285 </para>
33286 <para>
33287 When the expansion succeeds, the router searches first for SRV records for
33288 the given service (it assumes TCP protocol). A single SRV record with a
33289 host name that consists of just a single dot indicates <quote>no such service for
33290 this domain</quote>; if this is encountered, the router declines. If other kinds of
33291 SRV record are found, they are used to construct a host list for delivery
33292 according to the rules of RFC 2782. MX records are not sought in this case.
33293 </para>
33294 <para>
33295 When no SRV records are found, MX records (and address records) are sought in
33296 the traditional way. In other words, SRV records take precedence over MX
33297 records, just as MX records take precedence over address records. Note that
33298 this behaviour is not sanctioned by RFC 2782, though a previous draft RFC
33299 defined it. It is apparently believed that MX records are sufficient for email
33300 and that SRV records should not be used for this purpose. However, SRV records
33301 have an additional <quote>weight</quote> feature which some people might find useful when
33302 trying to split an SMTP load between hosts of different power.
33303 </para>
33304 <para>
33305 See section <xref linkend="SECTprowitdnsloo"/> above for a discussion of Exim&#x2019;s behaviour
33306 when there is a DNS lookup error.
33307 </para>
33308 <para>
33309 <indexterm role="option">
33310 <primary><option>dnssec_request_domains</option></primary>
33311 </indexterm>
33312 </para>
33313 <informaltable frame="all">
33314 <tgroup cols="4" colsep="0" rowsep="0">
33315 <colspec colwidth="8*" align="left"/>
33316 <colspec colwidth="6*" align="center"/>
33317 <colspec colwidth="6*" align="center"/>
33318 <colspec colwidth="6*" align="right"/>
33319 <tbody>
33320 <row>
33321 <entry><option>dnssec_request_domains</option></entry>
33322 <entry>Use: <emphasis>dnslookup</emphasis></entry>
33323 <entry>Type: <emphasis>domain list</emphasis>&dagger;<emphasis></emphasis></entry>
33324 <entry>Default: <emphasis>unset</emphasis></entry>
33325 </row>
33326 </tbody>
33327 </tgroup>
33328 </informaltable>
33329 <para>
33330 <indexterm role="concept">
33331 <primary>MX record</primary>
33332 <secondary>security</secondary>
33333 </indexterm>
33334 <indexterm role="concept">
33335 <primary>DNSSEC</primary>
33336 <secondary>MX lookup</secondary>
33337 </indexterm>
33338 <indexterm role="concept">
33339 <primary>security</primary>
33340 <secondary>MX lookup</secondary>
33341 </indexterm>
33342 <indexterm role="concept">
33343 <primary>DNS</primary>
33344 <secondary>DNSSEC</secondary>
33345 </indexterm>
33346 DNS lookups for domains matching <option>dnssec_request_domains</option> will be done with
33347 the dnssec request bit set.
33348 This applies to all of the SRV, MX A6, AAAA, A lookup sequence.
33349 </para>
33350 <para>
33351 <indexterm role="option">
33352 <primary><option>dnssec_require_domains</option></primary>
33353 </indexterm>
33354 </para>
33355 <informaltable frame="all">
33356 <tgroup cols="4" colsep="0" rowsep="0">
33357 <colspec colwidth="8*" align="left"/>
33358 <colspec colwidth="6*" align="center"/>
33359 <colspec colwidth="6*" align="center"/>
33360 <colspec colwidth="6*" align="right"/>
33361 <tbody>
33362 <row>
33363 <entry><option>dnssec_require_domains</option></entry>
33364 <entry>Use: <emphasis>dnslookup</emphasis></entry>
33365 <entry>Type: <emphasis>domain list</emphasis>&dagger;<emphasis></emphasis></entry>
33366 <entry>Default: <emphasis>unset</emphasis></entry>
33367 </row>
33368 </tbody>
33369 </tgroup>
33370 </informaltable>
33371 <para>
33372 <indexterm role="concept">
33373 <primary>MX record</primary>
33374 <secondary>security</secondary>
33375 </indexterm>
33376 <indexterm role="concept">
33377 <primary>DNSSEC</primary>
33378 <secondary>MX lookup</secondary>
33379 </indexterm>
33380 <indexterm role="concept">
33381 <primary>security</primary>
33382 <secondary>MX lookup</secondary>
33383 </indexterm>
33384 <indexterm role="concept">
33385 <primary>DNS</primary>
33386 <secondary>DNSSEC</secondary>
33387 </indexterm>
33388 DNS lookups for domains matching <option>dnssec_request_domains</option> will be done with
33389 the dnssec request bit set.  Any returns not having the Authenticated Data bit
33390 (AD bit) set wil be ignored and logged as a host-lookup failure.
33391 This applies to all of the SRV, MX A6, AAAA, A lookup sequence.
33392 </para>
33393 <para>
33394 <indexterm role="option">
33395 <primary><option>mx_domains</option></primary>
33396 </indexterm>
33397 </para>
33398 <informaltable frame="all">
33399 <tgroup cols="4" colsep="0" rowsep="0">
33400 <colspec colwidth="8*" align="left"/>
33401 <colspec colwidth="6*" align="center"/>
33402 <colspec colwidth="6*" align="center"/>
33403 <colspec colwidth="6*" align="right"/>
33404 <tbody>
33405 <row>
33406 <entry><option>mx_domains</option></entry>
33407 <entry>Use: <emphasis>dnslookup</emphasis></entry>
33408 <entry>Type: <emphasis>domain list</emphasis>&dagger;<emphasis></emphasis></entry>
33409 <entry>Default: <emphasis>unset</emphasis></entry>
33410 </row>
33411 </tbody>
33412 </tgroup>
33413 </informaltable>
33414 <para>
33415 <indexterm role="concept">
33416 <primary>MX record</primary>
33417 <secondary>required to exist</secondary>
33418 </indexterm>
33419 <indexterm role="concept">
33420 <primary>SRV record</primary>
33421 <secondary>required to exist</secondary>
33422 </indexterm>
33423 A domain that matches <option>mx_domains</option> is required to have either an MX or an SRV
33424 record in order to be recognized. (The name of this option could be improved.)
33425 For example, if all the mail hosts in <emphasis>fict.example</emphasis> are known to have MX
33426 records, except for those in <emphasis>discworld.fict.example</emphasis>, you could use this
33427 setting:
33428 </para>
33429 <literallayout class="monospaced">
33430 mx_domains = ! *.discworld.fict.example : *.fict.example
33431 </literallayout>
33432 <para>
33433 This specifies that messages addressed to a domain that matches the list but
33434 has no MX record should be bounced immediately instead of being routed using
33435 the address record.
33436 </para>
33437 <para>
33438 <indexterm role="option">
33439 <primary><option>mx_fail_domains</option></primary>
33440 </indexterm>
33441 </para>
33442 <informaltable frame="all">
33443 <tgroup cols="4" colsep="0" rowsep="0">
33444 <colspec colwidth="8*" align="left"/>
33445 <colspec colwidth="6*" align="center"/>
33446 <colspec colwidth="6*" align="center"/>
33447 <colspec colwidth="6*" align="right"/>
33448 <tbody>
33449 <row>
33450 <entry><option>mx_fail_domains</option></entry>
33451 <entry>Use: <emphasis>dnslookup</emphasis></entry>
33452 <entry>Type: <emphasis>domain list</emphasis>&dagger;<emphasis></emphasis></entry>
33453 <entry>Default: <emphasis>unset</emphasis></entry>
33454 </row>
33455 </tbody>
33456 </tgroup>
33457 </informaltable>
33458 <para>
33459 If the DNS lookup for MX records for one of the domains in this list causes a
33460 DNS lookup error, Exim behaves as if no MX records were found. See section
33461 <xref linkend="SECTprowitdnsloo"/> for more discussion.
33462 </para>
33463 <para>
33464 <indexterm role="option">
33465 <primary><option>qualify_single</option></primary>
33466 </indexterm>
33467 </para>
33468 <informaltable frame="all">
33469 <tgroup cols="4" colsep="0" rowsep="0">
33470 <colspec colwidth="8*" align="left"/>
33471 <colspec colwidth="6*" align="center"/>
33472 <colspec colwidth="6*" align="center"/>
33473 <colspec colwidth="6*" align="right"/>
33474 <tbody>
33475 <row>
33476 <entry><option>qualify_single</option></entry>
33477 <entry>Use: <emphasis>dnslookup</emphasis></entry>
33478 <entry>Type: <emphasis>boolean</emphasis></entry>
33479 <entry>Default: <emphasis>true</emphasis></entry>
33480 </row>
33481 </tbody>
33482 </tgroup>
33483 </informaltable>
33484 <para>
33485 <indexterm role="concept">
33486 <primary>DNS</primary>
33487 <secondary>resolver options</secondary>
33488 </indexterm>
33489 <indexterm role="concept">
33490 <primary>DNS</primary>
33491 <secondary>qualifying single-component names</secondary>
33492 </indexterm>
33493 When this option is true, the resolver option RES_DEFNAMES is set for DNS
33494 lookups. Typically, but not standardly, this causes the resolver to qualify
33495 single-component names with the default domain. For example, on a machine
33496 called <emphasis>dictionary.ref.example</emphasis>, the domain <emphasis>thesaurus</emphasis> would be changed to
33497 <emphasis>thesaurus.ref.example</emphasis> inside the resolver. For details of what your
33498 resolver actually does, consult your man pages for <emphasis>resolver</emphasis> and
33499 <emphasis>resolv.conf</emphasis>.
33500 </para>
33501 <para>
33502 <indexterm role="option">
33503 <primary><option>rewrite_headers</option></primary>
33504 </indexterm>
33505 </para>
33506 <informaltable frame="all">
33507 <tgroup cols="4" colsep="0" rowsep="0">
33508 <colspec colwidth="8*" align="left"/>
33509 <colspec colwidth="6*" align="center"/>
33510 <colspec colwidth="6*" align="center"/>
33511 <colspec colwidth="6*" align="right"/>
33512 <tbody>
33513 <row>
33514 <entry><option>rewrite_headers</option></entry>
33515 <entry>Use: <emphasis>dnslookup</emphasis></entry>
33516 <entry>Type: <emphasis>boolean</emphasis></entry>
33517 <entry>Default: <emphasis>true</emphasis></entry>
33518 </row>
33519 </tbody>
33520 </tgroup>
33521 </informaltable>
33522 <para>
33523 <indexterm role="concept">
33524 <primary>rewriting</primary>
33525 <secondary>header lines</secondary>
33526 </indexterm>
33527 <indexterm role="concept">
33528 <primary>header lines</primary>
33529 <secondary>rewriting</secondary>
33530 </indexterm>
33531 If the domain name in the address that is being processed is not fully
33532 qualified, it may be expanded to its full form by a DNS lookup. For example, if
33533 an address is specified as <emphasis>dormouse@teaparty</emphasis>, the domain might be
33534 expanded to <emphasis>teaparty.wonderland.fict.example</emphasis>. Domain expansion can also
33535 occur as a result of setting the <option>widen_domains</option> option. If
33536 <option>rewrite_headers</option> is true, all occurrences of the abbreviated domain name in
33537 any <emphasis>Bcc:</emphasis>, <emphasis>Cc:</emphasis>, <emphasis>From:</emphasis>, <emphasis>Reply-to:</emphasis>, <emphasis>Sender:</emphasis>, and <emphasis>To:</emphasis>
33538 header lines of the message are rewritten with the full domain name.
33539 </para>
33540 <para>
33541 This option should be turned off only when it is known that no message is
33542 ever going to be sent outside an environment where the abbreviation makes
33543 sense.
33544 </para>
33545 <para>
33546 When an MX record is looked up in the DNS and matches a wildcard record, name
33547 servers normally return a record containing the name that has been looked up,
33548 making it impossible to detect whether a wildcard was present or not. However,
33549 some name servers have recently been seen to return the wildcard entry. If the
33550 name returned by a DNS lookup begins with an asterisk, it is not used for
33551 header rewriting.
33552 </para>
33553 <para>
33554 <indexterm role="option">
33555 <primary><option>same_domain_copy_routing</option></primary>
33556 </indexterm>
33557 </para>
33558 <informaltable frame="all">
33559 <tgroup cols="4" colsep="0" rowsep="0">
33560 <colspec colwidth="8*" align="left"/>
33561 <colspec colwidth="6*" align="center"/>
33562 <colspec colwidth="6*" align="center"/>
33563 <colspec colwidth="6*" align="right"/>
33564 <tbody>
33565 <row>
33566 <entry><option>same_domain_copy_routing</option></entry>
33567 <entry>Use: <emphasis>dnslookup</emphasis></entry>
33568 <entry>Type: <emphasis>boolean</emphasis></entry>
33569 <entry>Default: <emphasis>false</emphasis></entry>
33570 </row>
33571 </tbody>
33572 </tgroup>
33573 </informaltable>
33574 <para>
33575 <indexterm role="concept">
33576 <primary>address</primary>
33577 <secondary>copying routing</secondary>
33578 </indexterm>
33579 Addresses with the same domain are normally routed by the <command>dnslookup</command> router
33580 to the same list of hosts. However, this cannot be presumed, because the router
33581 options and preconditions may refer to the local part of the address. By
33582 default, therefore, Exim routes each address in a message independently. DNS
33583 servers run caches, so repeated DNS lookups are not normally expensive, and in
33584 any case, personal messages rarely have more than a few recipients.
33585 </para>
33586 <para>
33587 If you are running mailing lists with large numbers of subscribers at the same
33588 domain, and you are using a <command>dnslookup</command> router which is independent of the
33589 local part, you can set <option>same_domain_copy_routing</option> to bypass repeated DNS
33590 lookups for identical domains in one message. In this case, when <command>dnslookup</command>
33591 routes an address to a remote transport, any other unrouted addresses in the
33592 message that have the same domain are automatically given the same routing
33593 without processing them independently,
33594 provided the following conditions are met:
33595 </para>
33596 <itemizedlist>
33597 <listitem>
33598 <para>
33599 No router that processed the address specified <option>headers_add</option> or
33600 <option>headers_remove</option>.
33601 </para>
33602 </listitem>
33603 <listitem>
33604 <para>
33605 The router did not change the address in any way, for example, by <quote>widening</quote>
33606 the domain.
33607 </para>
33608 </listitem>
33609 </itemizedlist>
33610 <para>
33611 <indexterm role="option">
33612 <primary><option>search_parents</option></primary>
33613 </indexterm>
33614 </para>
33615 <informaltable frame="all">
33616 <tgroup cols="4" colsep="0" rowsep="0">
33617 <colspec colwidth="8*" align="left"/>
33618 <colspec colwidth="6*" align="center"/>
33619 <colspec colwidth="6*" align="center"/>
33620 <colspec colwidth="6*" align="right"/>
33621 <tbody>
33622 <row>
33623 <entry><option>search_parents</option></entry>
33624 <entry>Use: <emphasis>dnslookup</emphasis></entry>
33625 <entry>Type: <emphasis>boolean</emphasis></entry>
33626 <entry>Default: <emphasis>false</emphasis></entry>
33627 </row>
33628 </tbody>
33629 </tgroup>
33630 </informaltable>
33631 <para>
33632 <indexterm role="concept">
33633 <primary>DNS</primary>
33634 <secondary>resolver options</secondary>
33635 </indexterm>
33636 When this option is true, the resolver option RES_DNSRCH is set for DNS
33637 lookups. This is different from the <option>qualify_single</option> option in that it
33638 applies to domains containing dots. Typically, but not standardly, it causes
33639 the resolver to search for the name in the current domain and in parent
33640 domains. For example, on a machine in the <emphasis>fict.example</emphasis> domain, if looking
33641 up <emphasis>teaparty.wonderland</emphasis> failed, the resolver would try
33642 <emphasis>teaparty.wonderland.fict.example</emphasis>. For details of what your resolver
33643 actually does, consult your man pages for <emphasis>resolver</emphasis> and <emphasis>resolv.conf</emphasis>.
33644 </para>
33645 <para>
33646 Setting this option true can cause problems in domains that have a wildcard MX
33647 record, because any domain that does not have its own MX record matches the
33648 local wildcard.
33649 </para>
33650 <para>
33651 <indexterm role="option">
33652 <primary><option>srv_fail_domains</option></primary>
33653 </indexterm>
33654 </para>
33655 <informaltable frame="all">
33656 <tgroup cols="4" colsep="0" rowsep="0">
33657 <colspec colwidth="8*" align="left"/>
33658 <colspec colwidth="6*" align="center"/>
33659 <colspec colwidth="6*" align="center"/>
33660 <colspec colwidth="6*" align="right"/>
33661 <tbody>
33662 <row>
33663 <entry><option>srv_fail_domains</option></entry>
33664 <entry>Use: <emphasis>dnslookup</emphasis></entry>
33665 <entry>Type: <emphasis>domain list</emphasis>&dagger;<emphasis></emphasis></entry>
33666 <entry>Default: <emphasis>unset</emphasis></entry>
33667 </row>
33668 </tbody>
33669 </tgroup>
33670 </informaltable>
33671 <para>
33672 If the DNS lookup for SRV records for one of the domains in this list causes a
33673 DNS lookup error, Exim behaves as if no SRV records were found. See section
33674 <xref linkend="SECTprowitdnsloo"/> for more discussion.
33675 </para>
33676 <para>
33677 <indexterm role="option">
33678 <primary><option>widen_domains</option></primary>
33679 </indexterm>
33680 </para>
33681 <informaltable frame="all">
33682 <tgroup cols="4" colsep="0" rowsep="0">
33683 <colspec colwidth="8*" align="left"/>
33684 <colspec colwidth="6*" align="center"/>
33685 <colspec colwidth="6*" align="center"/>
33686 <colspec colwidth="6*" align="right"/>
33687 <tbody>
33688 <row>
33689 <entry><option>widen_domains</option></entry>
33690 <entry>Use: <emphasis>dnslookup</emphasis></entry>
33691 <entry>Type: <emphasis>string list</emphasis></entry>
33692 <entry>Default: <emphasis>unset</emphasis></entry>
33693 </row>
33694 </tbody>
33695 </tgroup>
33696 </informaltable>
33697 <para>
33698 <indexterm role="concept">
33699 <primary>domain</primary>
33700 <secondary>partial; widening</secondary>
33701 </indexterm>
33702 If a DNS lookup fails and this option is set, each of its strings in turn is
33703 added onto the end of the domain, and the lookup is tried again. For example,
33704 if
33705 </para>
33706 <literallayout class="monospaced">
33707 widen_domains = fict.example:ref.example
33708 </literallayout>
33709 <para>
33710 is set and a lookup of <emphasis>klingon.dictionary</emphasis> fails,
33711 <emphasis>klingon.dictionary.fict.example</emphasis> is looked up, and if this fails,
33712 <emphasis>klingon.dictionary.ref.example</emphasis> is tried. Note that the <option>qualify_single</option>
33713 and <option>search_parents</option> options can cause some widening to be undertaken inside
33714 the DNS resolver. <option>widen_domains</option> is not applied to sender addresses
33715 when verifying, unless <option>rewrite_headers</option> is false (not the default).
33716 </para>
33717 </section>
33718 <section id="SECID119">
33719 <title>Effect of qualify_single and search_parents</title>
33720 <para>
33721 When a domain from an envelope recipient is changed by the resolver as a result
33722 of the <option>qualify_single</option> or <option>search_parents</option> options, Exim rewrites the
33723 corresponding address in the message&#x2019;s header lines unless <option>rewrite_headers</option>
33724 is set false. Exim then re-routes the address, using the full domain.
33725 </para>
33726 <para>
33727 These two options affect only the DNS lookup that takes place inside the router
33728 for the domain of the address that is being routed. They do not affect lookups
33729 such as that implied by
33730 </para>
33731 <literallayout class="monospaced">
33732 domains = @mx_any
33733 </literallayout>
33734 <para>
33735 that may happen while processing a router precondition before the router is
33736 entered. No widening ever takes place for these lookups.
33737 <indexterm role="concept" startref="IIDdnsrou1" class="endofrange"/>
33738 <indexterm role="concept" startref="IIDdnsrou2" class="endofrange"/>
33739 </para>
33740 </section>
33741 </chapter>
33742
33743 <chapter id="CHID5">
33744 <title>The ipliteral router</title>
33745 <para>
33746 <indexterm role="concept">
33747 <primary><command>ipliteral</command> router</primary>
33748 </indexterm>
33749 <indexterm role="concept">
33750 <primary>domain literal</primary>
33751 <secondary>routing</secondary>
33752 </indexterm>
33753 <indexterm role="concept">
33754 <primary>routers</primary>
33755 <secondary><command>ipliteral</command></secondary>
33756 </indexterm>
33757 This router has no private options. Unless it is being used purely for
33758 verification (see <option>verify_only</option>) a transport is required to be defined by the
33759 generic <option>transport</option> option. The router accepts the address if its domain part
33760 takes the form of an RFC 2822 domain literal. For example, the <command>ipliteral</command>
33761 router handles the address
33762 </para>
33763 <literallayout class="monospaced">
33764 root@[192.168.1.1]
33765 </literallayout>
33766 <para>
33767 by setting up delivery to the host with that IP address. IPv4 domain literals
33768 consist of an IPv4 address enclosed in square brackets. IPv6 domain literals
33769 are similar, but the address is preceded by <literal>ipv6:</literal>. For example:
33770 </para>
33771 <literallayout class="monospaced">
33772 postmaster@[ipv6:fe80::a00:20ff:fe86:a061.5678]
33773 </literallayout>
33774 <para>
33775 Exim allows <literal>ipv4:</literal> before IPv4 addresses, for consistency, and on the
33776 grounds that sooner or later somebody will try it.
33777 </para>
33778 <para>
33779 <indexterm role="option">
33780 <primary><option>self</option></primary>
33781 <secondary>in <command>ipliteral</command> router</secondary>
33782 </indexterm>
33783 If the IP address matches something in <option>ignore_target_hosts</option>, the router
33784 declines. If an IP literal turns out to refer to the local host, the generic
33785 <option>self</option> option determines what happens.
33786 </para>
33787 <para>
33788 The RFCs require support for domain literals; however, their use is
33789 controversial in today&#x2019;s Internet. If you want to use this router, you must
33790 also set the main configuration option <option>allow_domain_literals</option>. Otherwise,
33791 Exim will not recognize the domain literal syntax in addresses.
33792 </para>
33793 </chapter>
33794
33795 <chapter id="CHID6">
33796 <title>The iplookup router</title>
33797 <para>
33798 <indexterm role="concept">
33799 <primary><command>iplookup</command> router</primary>
33800 </indexterm>
33801 <indexterm role="concept">
33802 <primary>routers</primary>
33803 <secondary><command>iplookup</command></secondary>
33804 </indexterm>
33805 The <command>iplookup</command> router was written to fulfil a specific requirement in
33806 Cambridge University (which in fact no longer exists). For this reason, it is
33807 not included in the binary of Exim by default. If you want to include it, you
33808 must set
33809 </para>
33810 <literallayout class="monospaced">
33811 ROUTER_IPLOOKUP=yes
33812 </literallayout>
33813 <para>
33814 in your <filename>Local/Makefile</filename> configuration file.
33815 </para>
33816 <para>
33817 The <command>iplookup</command> router routes an address by sending it over a TCP or UDP
33818 connection to one or more specific hosts. The host can then return the same or
33819 a different address &ndash; in effect rewriting the recipient address in the
33820 message&#x2019;s envelope. The new address is then passed on to subsequent routers. If
33821 this process fails, the address can be passed on to other routers, or delivery
33822 can be deferred. Since <command>iplookup</command> is just a rewriting router, a transport
33823 must not be specified for it.
33824 </para>
33825 <para>
33826 <indexterm role="concept">
33827 <primary>options</primary>
33828 <secondary><command>iplookup</command> router</secondary>
33829 </indexterm>
33830 <indexterm role="option">
33831 <primary><option>hosts</option></primary>
33832 </indexterm>
33833 </para>
33834 <informaltable frame="all">
33835 <tgroup cols="4" colsep="0" rowsep="0">
33836 <colspec colwidth="8*" align="left"/>
33837 <colspec colwidth="6*" align="center"/>
33838 <colspec colwidth="6*" align="center"/>
33839 <colspec colwidth="6*" align="right"/>
33840 <tbody>
33841 <row>
33842 <entry><option>hosts</option></entry>
33843 <entry>Use: <emphasis>iplookup</emphasis></entry>
33844 <entry>Type: <emphasis>string</emphasis></entry>
33845 <entry>Default: <emphasis>unset</emphasis></entry>
33846 </row>
33847 </tbody>
33848 </tgroup>
33849 </informaltable>
33850 <para>
33851 This option must be supplied. Its value is a colon-separated list of host
33852 names. The hosts are looked up using <function>gethostbyname()</function>
33853 (or <function>getipnodebyname()</function> when available)
33854 and are tried in order until one responds to the query. If none respond, what
33855 happens is controlled by <option>optional</option>.
33856 </para>
33857 <para>
33858 <indexterm role="option">
33859 <primary><option>optional</option></primary>
33860 </indexterm>
33861 </para>
33862 <informaltable frame="all">
33863 <tgroup cols="4" colsep="0" rowsep="0">
33864 <colspec colwidth="8*" align="left"/>
33865 <colspec colwidth="6*" align="center"/>
33866 <colspec colwidth="6*" align="center"/>
33867 <colspec colwidth="6*" align="right"/>
33868 <tbody>
33869 <row>
33870 <entry><option>optional</option></entry>
33871 <entry>Use: <emphasis>iplookup</emphasis></entry>
33872 <entry>Type: <emphasis>boolean</emphasis></entry>
33873 <entry>Default: <emphasis>false</emphasis></entry>
33874 </row>
33875 </tbody>
33876 </tgroup>
33877 </informaltable>
33878 <para>
33879 If <option>optional</option> is true, if no response is obtained from any host, the address
33880 is passed to the next router, overriding <option>no_more</option>. If <option>optional</option> is false,
33881 delivery to the address is deferred.
33882 </para>
33883 <para>
33884 <indexterm role="option">
33885 <primary><option>port</option></primary>
33886 </indexterm>
33887 </para>
33888 <informaltable frame="all">
33889 <tgroup cols="4" colsep="0" rowsep="0">
33890 <colspec colwidth="8*" align="left"/>
33891 <colspec colwidth="6*" align="center"/>
33892 <colspec colwidth="6*" align="center"/>
33893 <colspec colwidth="6*" align="right"/>
33894 <tbody>
33895 <row>
33896 <entry><option>port</option></entry>
33897 <entry>Use: <emphasis>iplookup</emphasis></entry>
33898 <entry>Type: <emphasis>integer</emphasis></entry>
33899 <entry>Default: <emphasis>0</emphasis></entry>
33900 </row>
33901 </tbody>
33902 </tgroup>
33903 </informaltable>
33904 <para>
33905 <indexterm role="concept">
33906 <primary>port</primary>
33907 <secondary><command>iplookup</command> router</secondary>
33908 </indexterm>
33909 This option must be supplied. It specifies the port number for the TCP or UDP
33910 call.
33911 </para>
33912 <para>
33913 <indexterm role="option">
33914 <primary><option>protocol</option></primary>
33915 </indexterm>
33916 </para>
33917 <informaltable frame="all">
33918 <tgroup cols="4" colsep="0" rowsep="0">
33919 <colspec colwidth="8*" align="left"/>
33920 <colspec colwidth="6*" align="center"/>
33921 <colspec colwidth="6*" align="center"/>
33922 <colspec colwidth="6*" align="right"/>
33923 <tbody>
33924 <row>
33925 <entry><option>protocol</option></entry>
33926 <entry>Use: <emphasis>iplookup</emphasis></entry>
33927 <entry>Type: <emphasis>string</emphasis></entry>
33928 <entry>Default: <emphasis>udp</emphasis></entry>
33929 </row>
33930 </tbody>
33931 </tgroup>
33932 </informaltable>
33933 <para>
33934 This option can be set to <quote>udp</quote> or <quote>tcp</quote> to specify which of the two
33935 protocols is to be used.
33936 </para>
33937 <para>
33938 <indexterm role="option">
33939 <primary><option>query</option></primary>
33940 </indexterm>
33941 </para>
33942 <informaltable frame="all">
33943 <tgroup cols="4" colsep="0" rowsep="0">
33944 <colspec colwidth="8*" align="left"/>
33945 <colspec colwidth="6*" align="center"/>
33946 <colspec colwidth="6*" align="center"/>
33947 <colspec colwidth="6*" align="right"/>
33948 <tbody>
33949 <row>
33950 <entry><option>query</option></entry>
33951 <entry>Use: <emphasis>iplookup</emphasis></entry>
33952 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
33953 <entry>Default: <emphasis>see below</emphasis></entry>
33954 </row>
33955 </tbody>
33956 </tgroup>
33957 </informaltable>
33958 <para>
33959 This defines the content of the query that is sent to the remote hosts. The
33960 default value is:
33961 </para>
33962 <literallayout class="monospaced">
33963 $local_part@$domain $local_part@$domain
33964 </literallayout>
33965 <para>
33966 The repetition serves as a way of checking that a response is to the correct
33967 query in the default case (see <option>response_pattern</option> below).
33968 </para>
33969 <para>
33970 <indexterm role="option">
33971 <primary><option>reroute</option></primary>
33972 </indexterm>
33973 </para>
33974 <informaltable frame="all">
33975 <tgroup cols="4" colsep="0" rowsep="0">
33976 <colspec colwidth="8*" align="left"/>
33977 <colspec colwidth="6*" align="center"/>
33978 <colspec colwidth="6*" align="center"/>
33979 <colspec colwidth="6*" align="right"/>
33980 <tbody>
33981 <row>
33982 <entry><option>reroute</option></entry>
33983 <entry>Use: <emphasis>iplookup</emphasis></entry>
33984 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
33985 <entry>Default: <emphasis>unset</emphasis></entry>
33986 </row>
33987 </tbody>
33988 </tgroup>
33989 </informaltable>
33990 <para>
33991 If this option is not set, the rerouted address is precisely the byte string
33992 returned by the remote host, up to the first white space, if any. If set, the
33993 string is expanded to form the rerouted address. It can include parts matched
33994 in the response by <option>response_pattern</option> by means of numeric variables such as
33995 <varname>$1</varname>, <varname>$2</varname>, etc. The variable <varname>$0</varname> refers to the entire input string,
33996 whether or not a pattern is in use. In all cases, the rerouted address must end
33997 up in the form <emphasis>local_part@domain</emphasis>.
33998 </para>
33999 <para>
34000 <indexterm role="option">
34001 <primary><option>response_pattern</option></primary>
34002 </indexterm>
34003 </para>
34004 <informaltable frame="all">
34005 <tgroup cols="4" colsep="0" rowsep="0">
34006 <colspec colwidth="8*" align="left"/>
34007 <colspec colwidth="6*" align="center"/>
34008 <colspec colwidth="6*" align="center"/>
34009 <colspec colwidth="6*" align="right"/>
34010 <tbody>
34011 <row>
34012 <entry><option>response_pattern</option></entry>
34013 <entry>Use: <emphasis>iplookup</emphasis></entry>
34014 <entry>Type: <emphasis>string</emphasis></entry>
34015 <entry>Default: <emphasis>unset</emphasis></entry>
34016 </row>
34017 </tbody>
34018 </tgroup>
34019 </informaltable>
34020 <para>
34021 This option can be set to a regular expression that is applied to the string
34022 returned from the remote host. If the pattern does not match the response, the
34023 router declines. If <option>response_pattern</option> is not set, no checking of the
34024 response is done, unless the query was defaulted, in which case there is a
34025 check that the text returned after the first white space is the original
34026 address. This checks that the answer that has been received is in response to
34027 the correct question. For example, if the response is just a new domain, the
34028 following could be used:
34029 </para>
34030 <literallayout class="monospaced">
34031 response_pattern = ^([^@]+)$
34032 reroute = $local_part@$1
34033 </literallayout>
34034 <para>
34035 <indexterm role="option">
34036 <primary><option>timeout</option></primary>
34037 </indexterm>
34038 </para>
34039 <informaltable frame="all">
34040 <tgroup cols="4" colsep="0" rowsep="0">
34041 <colspec colwidth="8*" align="left"/>
34042 <colspec colwidth="6*" align="center"/>
34043 <colspec colwidth="6*" align="center"/>
34044 <colspec colwidth="6*" align="right"/>
34045 <tbody>
34046 <row>
34047 <entry><option>timeout</option></entry>
34048 <entry>Use: <emphasis>iplookup</emphasis></entry>
34049 <entry>Type: <emphasis>time</emphasis></entry>
34050 <entry>Default: <emphasis>5s</emphasis></entry>
34051 </row>
34052 </tbody>
34053 </tgroup>
34054 </informaltable>
34055 <para>
34056 This specifies the amount of time to wait for a response from the remote
34057 machine. The same timeout is used for the <function>connect()</function> function for a TCP
34058 call. It does not apply to UDP.
34059 </para>
34060 </chapter>
34061
34062 <chapter id="CHID7">
34063 <title>The manualroute router</title>
34064 <para>
34065 <indexterm role="concept" id="IIDmanrou1" class="startofrange">
34066 <primary><command>manualroute</command> router</primary>
34067 </indexterm>
34068 <indexterm role="concept" id="IIDmanrou2" class="startofrange">
34069 <primary>routers</primary>
34070 <secondary><command>manualroute</command></secondary>
34071 </indexterm>
34072 <indexterm role="concept">
34073 <primary>domain</primary>
34074 <secondary>manually routing</secondary>
34075 </indexterm>
34076 The <command>manualroute</command> router is so-called because it provides a way of manually
34077 routing an address according to its domain. It is mainly used when you want to
34078 route addresses to remote hosts according to your own rules, bypassing the
34079 normal DNS routing that looks up MX records. However, <command>manualroute</command> can also
34080 route to local transports, a facility that may be useful if you want to save
34081 messages for dial-in hosts in local files.
34082 </para>
34083 <para>
34084 The <command>manualroute</command> router compares a list of domain patterns with the domain
34085 it is trying to route. If there is no match, the router declines. Each pattern
34086 has associated with it a list of hosts and some other optional data, which may
34087 include a transport. The combination of a pattern and its data is called a
34088 <quote>routing rule</quote>. For patterns that do not have an associated transport, the
34089 generic <option>transport</option> option must specify a transport, unless the router is
34090 being used purely for verification (see <option>verify_only</option>).
34091 </para>
34092 <para>
34093 <indexterm role="variable">
34094 <primary><varname>$host</varname></primary>
34095 </indexterm>
34096 In the case of verification, matching the domain pattern is sufficient for the
34097 router to accept the address. When actually routing an address for delivery,
34098 an address that matches a domain pattern is queued for the associated
34099 transport. If the transport is not a local one, a host list must be associated
34100 with the pattern; IP addresses are looked up for the hosts, and these are
34101 passed to the transport along with the mail address. For local transports, a
34102 host list is optional. If it is present, it is passed in <varname>$host</varname> as a single
34103 text string.
34104 </para>
34105 <para>
34106 The list of routing rules can be provided as an inline string in
34107 <option>route_list</option>, or the data can be obtained by looking up the domain in a file
34108 or database by setting <option>route_data</option>. Only one of these settings may appear in
34109 any one instance of <command>manualroute</command>. The format of routing rules is described
34110 below, following the list of private options.
34111 </para>
34112 <section id="SECTprioptman">
34113 <title>Private options for manualroute</title>
34114 <para>
34115 <indexterm role="concept">
34116 <primary>options</primary>
34117 <secondary><command>manualroute</command> router</secondary>
34118 </indexterm>
34119 The private options for the <command>manualroute</command> router are as follows:
34120 </para>
34121 <para>
34122 <indexterm role="option">
34123 <primary><option>host_all_ignored</option></primary>
34124 </indexterm>
34125 </para>
34126 <informaltable frame="all">
34127 <tgroup cols="4" colsep="0" rowsep="0">
34128 <colspec colwidth="8*" align="left"/>
34129 <colspec colwidth="6*" align="center"/>
34130 <colspec colwidth="6*" align="center"/>
34131 <colspec colwidth="6*" align="right"/>
34132 <tbody>
34133 <row>
34134 <entry><option>host_all_ignored</option></entry>
34135 <entry>Use: <emphasis>manualroute</emphasis></entry>
34136 <entry>Type: <emphasis>string</emphasis></entry>
34137 <entry>Default: <emphasis>defer</emphasis></entry>
34138 </row>
34139 </tbody>
34140 </tgroup>
34141 </informaltable>
34142 <para>
34143 See <option>host_find_failed</option>.
34144 </para>
34145 <para>
34146 <indexterm role="option">
34147 <primary><option>host_find_failed</option></primary>
34148 </indexterm>
34149 </para>
34150 <informaltable frame="all">
34151 <tgroup cols="4" colsep="0" rowsep="0">
34152 <colspec colwidth="8*" align="left"/>
34153 <colspec colwidth="6*" align="center"/>
34154 <colspec colwidth="6*" align="center"/>
34155 <colspec colwidth="6*" align="right"/>
34156 <tbody>
34157 <row>
34158 <entry><option>host_find_failed</option></entry>
34159 <entry>Use: <emphasis>manualroute</emphasis></entry>
34160 <entry>Type: <emphasis>string</emphasis></entry>
34161 <entry>Default: <emphasis>freeze</emphasis></entry>
34162 </row>
34163 </tbody>
34164 </tgroup>
34165 </informaltable>
34166 <para>
34167 This option controls what happens when <command>manualroute</command> tries to find an IP
34168 address for a host, and the host does not exist. The option can be set to one
34169 of the following values:
34170 </para>
34171 <literallayout class="monospaced">
34172 decline
34173 defer
34174 fail
34175 freeze
34176 ignore
34177 pass
34178 </literallayout>
34179 <para>
34180 The default (<quote>freeze</quote>) assumes that this state is a serious configuration
34181 error. The difference between <quote>pass</quote> and <quote>decline</quote> is that the former
34182 forces the address to be passed to the next router (or the router defined by
34183 <option>pass_router</option>),
34184 <indexterm role="option">
34185 <primary><option>more</option></primary>
34186 </indexterm>
34187 overriding <option>no_more</option>, whereas the latter passes the address to the next
34188 router only if <option>more</option> is true.
34189 </para>
34190 <para>
34191 The value <quote>ignore</quote> causes Exim to completely ignore a host whose IP address
34192 cannot be found. If all the hosts in the list are ignored, the behaviour is
34193 controlled by the <option>host_all_ignored</option> option. This takes the same values
34194 as <option>host_find_failed</option>, except that it cannot be set to <quote>ignore</quote>.
34195 </para>
34196 <para>
34197 The <option>host_find_failed</option> option applies only to a definite <quote>does not exist</quote>
34198 state; if a host lookup gets a temporary error, delivery is deferred unless the
34199 generic <option>pass_on_timeout</option> option is set.
34200 </para>
34201 <para>
34202 <indexterm role="option">
34203 <primary><option>hosts_randomize</option></primary>
34204 </indexterm>
34205 </para>
34206 <informaltable frame="all">
34207 <tgroup cols="4" colsep="0" rowsep="0">
34208 <colspec colwidth="8*" align="left"/>
34209 <colspec colwidth="6*" align="center"/>
34210 <colspec colwidth="6*" align="center"/>
34211 <colspec colwidth="6*" align="right"/>
34212 <tbody>
34213 <row>
34214 <entry><option>hosts_randomize</option></entry>
34215 <entry>Use: <emphasis>manualroute</emphasis></entry>
34216 <entry>Type: <emphasis>boolean</emphasis></entry>
34217 <entry>Default: <emphasis>false</emphasis></entry>
34218 </row>
34219 </tbody>
34220 </tgroup>
34221 </informaltable>
34222 <para>
34223 <indexterm role="concept">
34224 <primary>randomized host list</primary>
34225 </indexterm>
34226 <indexterm role="concept">
34227 <primary>host</primary>
34228 <secondary>list of; randomized</secondary>
34229 </indexterm>
34230 If this option is set, the order of the items in a host list in a routing rule
34231 is randomized each time the list is used, unless an option in the routing rule
34232 overrides (see below). Randomizing the order of a host list can be used to do
34233 crude load sharing. However, if more than one mail address is routed by the
34234 same router to the same host list, the host lists are considered to be the same
34235 (even though they may be randomized into different orders) for the purpose of
34236 deciding whether to batch the deliveries into a single SMTP transaction.
34237 </para>
34238 <para>
34239 When <option>hosts_randomize</option> is true, a host list may be split
34240 into groups whose order is separately randomized. This makes it possible to
34241 set up MX-like behaviour. The boundaries between groups are indicated by an
34242 item that is just <literal>+</literal> in the host list. For example:
34243 </para>
34244 <literallayout class="monospaced">
34245 route_list = * host1:host2:host3:+:host4:host5
34246 </literallayout>
34247 <para>
34248 The order of the first three hosts and the order of the last two hosts is
34249 randomized for each use, but the first three always end up before the last two.
34250 If <option>hosts_randomize</option> is not set, a <literal>+</literal> item in the list is ignored. If a
34251 randomized host list is passed to an <command>smtp</command> transport that also has
34252 <option>hosts_randomize set</option>, the list is not re-randomized.
34253 </para>
34254 <para>
34255 <indexterm role="option">
34256 <primary><option>route_data</option></primary>
34257 </indexterm>
34258 </para>
34259 <informaltable frame="all">
34260 <tgroup cols="4" colsep="0" rowsep="0">
34261 <colspec colwidth="8*" align="left"/>
34262 <colspec colwidth="6*" align="center"/>
34263 <colspec colwidth="6*" align="center"/>
34264 <colspec colwidth="6*" align="right"/>
34265 <tbody>
34266 <row>
34267 <entry><option>route_data</option></entry>
34268 <entry>Use: <emphasis>manualroute</emphasis></entry>
34269 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
34270 <entry>Default: <emphasis>unset</emphasis></entry>
34271 </row>
34272 </tbody>
34273 </tgroup>
34274 </informaltable>
34275 <para>
34276 If this option is set, it must expand to yield the data part of a routing rule.
34277 Typically, the expansion string includes a lookup based on the domain. For
34278 example:
34279 </para>
34280 <literallayout class="monospaced">
34281 route_data = ${lookup{$domain}dbm{/etc/routes}}
34282 </literallayout>
34283 <para>
34284 If the expansion is forced to fail, or the result is an empty string, the
34285 router declines. Other kinds of expansion failure cause delivery to be
34286 deferred.
34287 </para>
34288 <para>
34289 <indexterm role="option">
34290 <primary><option>route_list</option></primary>
34291 </indexterm>
34292 </para>
34293 <informaltable frame="all">
34294 <tgroup cols="4" colsep="0" rowsep="0">
34295 <colspec colwidth="8*" align="left"/>
34296 <colspec colwidth="6*" align="center"/>
34297 <colspec colwidth="6*" align="center"/>
34298 <colspec colwidth="6*" align="right"/>
34299 <tbody>
34300 <row>
34301 <entry><option>route_list</option></entry>
34302 <entry>Use: <emphasis>manualroute</emphasis></entry>
34303 <entry>Type: <emphasis>string list</emphasis></entry>
34304 <entry>Default: <emphasis>unset</emphasis></entry>
34305 </row>
34306 </tbody>
34307 </tgroup>
34308 </informaltable>
34309 <para>
34310 This string is a list of routing rules, in the form defined below. Note that,
34311 unlike most string lists, the items are separated by semicolons. This is so
34312 that they may contain colon-separated host lists.
34313 </para>
34314 <para>
34315 <indexterm role="option">
34316 <primary><option>same_domain_copy_routing</option></primary>
34317 </indexterm>
34318 </para>
34319 <informaltable frame="all">
34320 <tgroup cols="4" colsep="0" rowsep="0">
34321 <colspec colwidth="8*" align="left"/>
34322 <colspec colwidth="6*" align="center"/>
34323 <colspec colwidth="6*" align="center"/>
34324 <colspec colwidth="6*" align="right"/>
34325 <tbody>
34326 <row>
34327 <entry><option>same_domain_copy_routing</option></entry>
34328 <entry>Use: <emphasis>manualroute</emphasis></entry>
34329 <entry>Type: <emphasis>boolean</emphasis></entry>
34330 <entry>Default: <emphasis>false</emphasis></entry>
34331 </row>
34332 </tbody>
34333 </tgroup>
34334 </informaltable>
34335 <para>
34336 <indexterm role="concept">
34337 <primary>address</primary>
34338 <secondary>copying routing</secondary>
34339 </indexterm>
34340 Addresses with the same domain are normally routed by the <command>manualroute</command>
34341 router to the same list of hosts. However, this cannot be presumed, because the
34342 router options and preconditions may refer to the local part of the address. By
34343 default, therefore, Exim routes each address in a message independently. DNS
34344 servers run caches, so repeated DNS lookups are not normally expensive, and in
34345 any case, personal messages rarely have more than a few recipients.
34346 </para>
34347 <para>
34348 If you are running mailing lists with large numbers of subscribers at the same
34349 domain, and you are using a <command>manualroute</command> router which is independent of the
34350 local part, you can set <option>same_domain_copy_routing</option> to bypass repeated DNS
34351 lookups for identical domains in one message. In this case, when
34352 <command>manualroute</command> routes an address to a remote transport, any other unrouted
34353 addresses in the message that have the same domain are automatically given the
34354 same routing without processing them independently. However, this is only done
34355 if <option>headers_add</option> and <option>headers_remove</option> are unset.
34356 </para>
34357 </section>
34358 <section id="SECID120">
34359 <title>Routing rules in route_list</title>
34360 <para>
34361 The value of <option>route_list</option> is a string consisting of a sequence of routing
34362 rules, separated by semicolons. If a semicolon is needed in a rule, it can be
34363 entered as two semicolons. Alternatively, the list separator can be changed as
34364 described (for colon-separated lists) in section <xref linkend="SECTlistconstruct"/>.
34365 Empty rules are ignored. The format of each rule is
34366 </para>
34367 <literallayout>
34368 &lt;<emphasis>domain pattern</emphasis>&gt;  &lt;<emphasis>list of hosts</emphasis>&gt;  &lt;<emphasis>options</emphasis>&gt;
34369 </literallayout>
34370 <para>
34371 The following example contains two rules, each with a simple domain pattern and
34372 no options:
34373 </para>
34374 <literallayout class="monospaced">
34375 route_list = \
34376   dict.ref.example  mail-1.ref.example:mail-2.ref.example ; \
34377   thes.ref.example  mail-3.ref.example:mail-4.ref.example
34378 </literallayout>
34379 <para>
34380 The three parts of a rule are separated by white space. The pattern and the
34381 list of hosts can be enclosed in quotes if necessary, and if they are, the
34382 usual quoting rules apply. Each rule in a <option>route_list</option> must start with a
34383 single domain pattern, which is the only mandatory item in the rule. The
34384 pattern is in the same format as one item in a domain list (see section
34385 <xref linkend="SECTdomainlist"/>),
34386 except that it may not be the name of an interpolated file.
34387 That is, it may be wildcarded, or a regular expression, or a file or database
34388 lookup (with semicolons doubled, because of the use of semicolon as a separator
34389 in a <option>route_list</option>).
34390 </para>
34391 <para>
34392 The rules in <option>route_list</option> are searched in order until one of the patterns
34393 matches the domain that is being routed. The list of hosts and then options are
34394 then used as described below. If there is no match, the router declines. When
34395 <option>route_list</option> is set, <option>route_data</option> must not be set.
34396 </para>
34397 </section>
34398 <section id="SECID121">
34399 <title>Routing rules in route_data</title>
34400 <para>
34401 The use of <option>route_list</option> is convenient when there are only a small number of
34402 routing rules. For larger numbers, it is easier to use a file or database to
34403 hold the routing information, and use the <option>route_data</option> option instead.
34404 The value of <option>route_data</option> is a list of hosts, followed by (optional) options.
34405 Most commonly, <option>route_data</option> is set as a string that contains an
34406 expansion lookup. For example, suppose we place two routing rules in a file
34407 like this:
34408 </para>
34409 <literallayout class="monospaced">
34410 dict.ref.example:  mail-1.ref.example:mail-2.ref.example
34411 thes.ref.example:  mail-3.ref.example:mail-4.ref.example
34412 </literallayout>
34413 <para>
34414 This data can be accessed by setting
34415 </para>
34416 <literallayout class="monospaced">
34417 route_data = ${lookup{$domain}lsearch{/the/file/name}}
34418 </literallayout>
34419 <para>
34420 Failure of the lookup results in an empty string, causing the router to
34421 decline. However, you do not have to use a lookup in <option>route_data</option>. The only
34422 requirement is that the result of expanding the string is a list of hosts,
34423 possibly followed by options, separated by white space. The list of hosts must
34424 be enclosed in quotes if it contains white space.
34425 </para>
34426 </section>
34427 <section id="SECID122">
34428 <title>Format of the list of hosts</title>
34429 <para>
34430 A list of hosts, whether obtained via <option>route_data</option> or <option>route_list</option>, is
34431 always separately expanded before use. If the expansion fails, the router
34432 declines. The result of the expansion must be a colon-separated list of names
34433 and/or IP addresses, optionally also including ports. The format of each item
34434 in the list is described in the next section. The list separator can be changed
34435 as described in section <xref linkend="SECTlistconstruct"/>.
34436 </para>
34437 <para>
34438 If the list of hosts was obtained from a <option>route_list</option> item, the following
34439 variables are set during its expansion:
34440 </para>
34441 <itemizedlist>
34442 <listitem>
34443 <para>
34444 <indexterm role="concept">
34445 <primary>numerical variables (<varname>$1</varname> <varname>$2</varname>  etc)</primary>
34446 <secondary>in <command>manualroute</command> router</secondary>
34447 </indexterm>
34448 If the domain was matched against a regular expression, the numeric variables
34449 <varname>$1</varname>, <varname>$2</varname>, etc. may be set. For example:
34450 </para>
34451 <literallayout class="monospaced">
34452 route_list = ^domain(\d+)   host-$1.text.example
34453 </literallayout>
34454 </listitem>
34455 <listitem>
34456 <para>
34457 <varname>$0</varname> is always set to the entire domain.
34458 </para>
34459 </listitem>
34460 <listitem>
34461 <para>
34462 <varname>$1</varname> is also set when partial matching is done in a file lookup.
34463 </para>
34464 </listitem>
34465 <listitem>
34466 <para>
34467 <indexterm role="variable">
34468 <primary><varname>$value</varname></primary>
34469 </indexterm>
34470 If the pattern that matched the domain was a lookup item, the data that was
34471 looked up is available in the expansion variable <varname>$value</varname>. For example:
34472 </para>
34473 <literallayout class="monospaced">
34474 route_list = lsearch;;/some/file.routes  $value
34475 </literallayout>
34476 </listitem>
34477 </itemizedlist>
34478 <para>
34479 Note the doubling of the semicolon in the pattern that is necessary because
34480 semicolon is the default route list separator.
34481 </para>
34482 </section>
34483 <section id="SECTformatonehostitem">
34484 <title>Format of one host item</title>
34485 <para>
34486 Each item in the list of hosts is either a host name or an IP address,
34487 optionally with an attached port number. When no port is given, an IP address
34488 is not enclosed in brackets. When a port is specified, it overrides the port
34489 specification on the transport. The port is separated from the name or address
34490 by a colon. This leads to some complications:
34491 </para>
34492 <itemizedlist>
34493 <listitem>
34494 <para>
34495 Because colon is the default separator for the list of hosts, either
34496 the colon that specifies a port must be doubled, or the list separator must
34497 be changed. The following two examples have the same effect:
34498 </para>
34499 <literallayout class="monospaced">
34500 route_list = * "host1.tld::1225 : host2.tld::1226"
34501 route_list = * "&lt;+ host1.tld:1225 + host2.tld:1226"
34502 </literallayout>
34503 </listitem>
34504 <listitem>
34505 <para>
34506 When IPv6 addresses are involved, it gets worse, because they contain
34507 colons of their own. To make this case easier, it is permitted to
34508 enclose an IP address (either v4 or v6) in square brackets if a port
34509 number follows. For example:
34510 </para>
34511 <literallayout class="monospaced">
34512 route_list = * "&lt;/ [10.1.1.1]:1225 / [::1]:1226"
34513 </literallayout>
34514 </listitem>
34515 </itemizedlist>
34516 </section>
34517 <section id="SECThostshowused">
34518 <title>How the list of hosts is used</title>
34519 <para>
34520 When an address is routed to an <command>smtp</command> transport by <command>manualroute</command>, each of
34521 the hosts is tried, in the order specified, when carrying out the SMTP
34522 delivery. However, the order can be changed by setting the <option>hosts_randomize</option>
34523 option, either on the router (see section <xref linkend="SECTprioptman"/> above), or on the
34524 transport.
34525 </para>
34526 <para>
34527 Hosts may be listed by name or by IP address. An unadorned name in the list of
34528 hosts is interpreted as a host name. A name that is followed by <literal>/MX</literal> is
34529 interpreted as an indirection to a sublist of hosts obtained by looking up MX
34530 records in the DNS. For example:
34531 </para>
34532 <literallayout class="monospaced">
34533 route_list = *  x.y.z:p.q.r/MX:e.f.g
34534 </literallayout>
34535 <para>
34536 If this feature is used with a port specifier, the port must come last. For
34537 example:
34538 </para>
34539 <literallayout class="monospaced">
34540 route_list = *  dom1.tld/mx::1225
34541 </literallayout>
34542 <para>
34543 If the <option>hosts_randomize</option> option is set, the order of the items in the list is
34544 randomized before any lookups are done. Exim then scans the list; for any name
34545 that is not followed by <literal>/MX</literal> it looks up an IP address. If this turns out to
34546 be an interface on the local host and the item is not the first in the list,
34547 Exim discards it and any subsequent items. If it is the first item, what
34548 happens is controlled by the
34549 <indexterm role="option">
34550 <primary><option>self</option></primary>
34551 <secondary>in <command>manualroute</command> router</secondary>
34552 </indexterm>
34553 <option>self</option> option of the router.
34554 </para>
34555 <para>
34556 A name on the list that is followed by <literal>/MX</literal> is replaced with the list of
34557 hosts obtained by looking up MX records for the name. This is always a DNS
34558 lookup; the <option>bydns</option> and <option>byname</option> options (see section <xref linkend="SECThowoptused"/>
34559 below) are not relevant here. The order of these hosts is determined by the
34560 preference values in the MX records, according to the usual rules. Because
34561 randomizing happens before the MX lookup, it does not affect the order that is
34562 defined by MX preferences.
34563 </para>
34564 <para>
34565 If the local host is present in the sublist obtained from MX records, but is
34566 not the most preferred host in that list, it and any equally or less
34567 preferred hosts are removed before the sublist is inserted into the main list.
34568 </para>
34569 <para>
34570 If the local host is the most preferred host in the MX list, what happens
34571 depends on where in the original list of hosts the <literal>/MX</literal> item appears. If it
34572 is not the first item (that is, there are previous hosts in the main list),
34573 Exim discards this name and any subsequent items in the main list.
34574 </para>
34575 <para>
34576 If the MX item is first in the list of hosts, and the local host is the
34577 most preferred host, what happens is controlled by the <option>self</option> option of the
34578 router.
34579 </para>
34580 <para>
34581 DNS failures when lookup up the MX records are treated in the same way as DNS
34582 failures when looking up IP addresses: <option>pass_on_timeout</option> and
34583 <option>host_find_failed</option> are used when relevant.
34584 </para>
34585 <para>
34586 The generic <option>ignore_target_hosts</option> option applies to all hosts in the list,
34587 whether obtained from an MX lookup or not.
34588 </para>
34589 </section>
34590 <section id="SECThowoptused">
34591 <title>How the options are used</title>
34592 <para>
34593 The options are a sequence of words; in practice no more than three are ever
34594 present. One of the words can be the name of a transport; this overrides the
34595 <option>transport</option> option on the router for this particular routing rule only. The
34596 other words (if present) control randomization of the list of hosts on a
34597 per-rule basis, and how the IP addresses of the hosts are to be found when
34598 routing to a remote transport. These options are as follows:
34599 </para>
34600 <itemizedlist>
34601 <listitem>
34602 <para>
34603 <option>randomize</option>: randomize the order of the hosts in this list, overriding the
34604 setting of <option>hosts_randomize</option> for this routing rule only.
34605 </para>
34606 </listitem>
34607 <listitem>
34608 <para>
34609 <option>no_randomize</option>: do not randomize the order of the hosts in this list,
34610 overriding the setting of <option>hosts_randomize</option> for this routing rule only.
34611 </para>
34612 </listitem>
34613 <listitem>
34614 <para>
34615 <option>byname</option>: use <function>getipnodebyname()</function> (<function>gethostbyname()</function> on older systems) to
34616 find IP addresses. This function may ultimately cause a DNS lookup, but it may
34617 also look in <filename>/etc/hosts</filename> or other sources of information.
34618 </para>
34619 </listitem>
34620 <listitem>
34621 <para>
34622 <option>bydns</option>: look up address records for the hosts directly in the DNS; fail if
34623 no address records are found. If there is a temporary DNS error (such as a
34624 timeout), delivery is deferred.
34625 </para>
34626 </listitem>
34627 </itemizedlist>
34628 <para>
34629 For example:
34630 </para>
34631 <literallayout class="monospaced">
34632 route_list = domain1  host1:host2:host3  randomize bydns;\
34633              domain2  host4:host5
34634 </literallayout>
34635 <para>
34636 If neither <option>byname</option> nor <option>bydns</option> is given, Exim behaves as follows: First, a
34637 DNS lookup is done. If this yields anything other than HOST_NOT_FOUND, that
34638 result is used. Otherwise, Exim goes on to try a call to <function>getipnodebyname()</function>
34639 or <function>gethostbyname()</function>, and the result of the lookup is the result of that
34640 call.
34641 </para>
34642 <para>
34643 <emphasis role="bold">Warning</emphasis>: It has been discovered that on some systems, if a DNS lookup
34644 called via <function>getipnodebyname()</function> times out, HOST_NOT_FOUND is returned
34645 instead of TRY_AGAIN. That is why the default action is to try a DNS
34646 lookup first. Only if that gives a definite <quote>no such host</quote> is the local
34647 function called.
34648 </para>
34649 <para>
34650 If no IP address for a host can be found, what happens is controlled by the
34651 <option>host_find_failed</option> option.
34652 </para>
34653 <para>
34654 <indexterm role="variable">
34655 <primary><varname>$host</varname></primary>
34656 </indexterm>
34657 When an address is routed to a local transport, IP addresses are not looked up.
34658 The host list is passed to the transport in the <varname>$host</varname> variable.
34659 </para>
34660 </section>
34661 <section id="SECID123">
34662 <title>Manualroute examples</title>
34663 <para>
34664 In some of the examples that follow, the presence of the <option>remote_smtp</option>
34665 transport, as defined in the default configuration file, is assumed:
34666 </para>
34667 <itemizedlist>
34668 <listitem>
34669 <para>
34670 <indexterm role="concept">
34671 <primary>smart host</primary>
34672 <secondary>example router</secondary>
34673 </indexterm>
34674 The <command>manualroute</command> router can be used to forward all external mail to a
34675 <emphasis>smart host</emphasis>. If you have set up, in the main part of the configuration, a
34676 named domain list that contains your local domains, for example:
34677 </para>
34678 <literallayout class="monospaced">
34679 domainlist local_domains = my.domain.example
34680 </literallayout>
34681 <para>
34682 You can arrange for all other domains to be routed to a smart host by making
34683 your first router something like this:
34684 </para>
34685 <literallayout class="monospaced">
34686 smart_route:
34687   driver = manualroute
34688   domains = !+local_domains
34689   transport = remote_smtp
34690   route_list = * smarthost.ref.example
34691 </literallayout>
34692 <para>
34693 This causes all non-local addresses to be sent to the single host
34694 <emphasis>smarthost.ref.example</emphasis>. If a colon-separated list of smart hosts is given,
34695 they are tried in order
34696 (but you can use <option>hosts_randomize</option> to vary the order each time).
34697 Another way of configuring the same thing is this:
34698 </para>
34699 <literallayout class="monospaced">
34700 smart_route:
34701   driver = manualroute
34702   transport = remote_smtp
34703   route_list = !+local_domains  smarthost.ref.example
34704 </literallayout>
34705 <para>
34706 There is no difference in behaviour between these two routers as they stand.
34707 However, they behave differently if <option>no_more</option> is added to them. In the first
34708 example, the router is skipped if the domain does not match the <option>domains</option>
34709 precondition; the following router is always tried. If the router runs, it
34710 always matches the domain and so can never decline. Therefore, <option>no_more</option>
34711 would have no effect. In the second case, the router is never skipped; it
34712 always runs. However, if it doesn&#x2019;t match the domain, it declines. In this case
34713 <option>no_more</option> would prevent subsequent routers from running.
34714 </para>
34715 </listitem>
34716 <listitem>
34717 <para>
34718 <indexterm role="concept">
34719 <primary>mail hub example</primary>
34720 </indexterm>
34721 A <emphasis>mail hub</emphasis> is a host which receives mail for a number of domains via MX
34722 records in the DNS and delivers it via its own private routing mechanism. Often
34723 the final destinations are behind a firewall, with the mail hub being the one
34724 machine that can connect to machines both inside and outside the firewall. The
34725 <command>manualroute</command> router is usually used on a mail hub to route incoming messages
34726 to the correct hosts. For a small number of domains, the routing can be inline,
34727 using the <option>route_list</option> option, but for a larger number a file or database
34728 lookup is easier to manage.
34729 </para>
34730 <para>
34731 If the domain names are in fact the names of the machines to which the mail is
34732 to be sent by the mail hub, the configuration can be quite simple. For
34733 example:
34734 </para>
34735 <literallayout class="monospaced">
34736 hub_route:
34737   driver = manualroute
34738   transport = remote_smtp
34739   route_list = *.rhodes.tvs.example  $domain
34740 </literallayout>
34741 <para>
34742 This configuration routes domains that match <literal>*.rhodes.tvs.example</literal> to hosts
34743 whose names are the same as the mail domains. A similar approach can be taken
34744 if the host name can be obtained from the domain name by a string manipulation
34745 that the expansion facilities can handle. Otherwise, a lookup based on the
34746 domain can be used to find the host:
34747 </para>
34748 <literallayout class="monospaced">
34749 through_firewall:
34750   driver = manualroute
34751   transport = remote_smtp
34752   route_data = ${lookup {$domain} cdb {/internal/host/routes}}
34753 </literallayout>
34754 <para>
34755 The result of the lookup must be the name or IP address of the host (or
34756 hosts) to which the address is to be routed. If the lookup fails, the route
34757 data is empty, causing the router to decline. The address then passes to the
34758 next router.
34759 </para>
34760 </listitem>
34761 <listitem>
34762 <para>
34763 <indexterm role="concept">
34764 <primary>batched SMTP output example</primary>
34765 </indexterm>
34766 <indexterm role="concept">
34767 <primary>SMTP</primary>
34768 <secondary>batched outgoing; example</secondary>
34769 </indexterm>
34770 You can use <command>manualroute</command> to deliver messages to pipes or files in batched
34771 SMTP format for onward transportation by some other means. This is one way of
34772 storing mail for a dial-up host when it is not connected. The route list entry
34773 can be as simple as a single domain name in a configuration like this:
34774 </para>
34775 <literallayout class="monospaced">
34776 save_in_file:
34777   driver = manualroute
34778   transport = batchsmtp_appendfile
34779   route_list = saved.domain.example
34780 </literallayout>
34781 <para>
34782 though often a pattern is used to pick up more than one domain. If there are
34783 several domains or groups of domains with different transport requirements,
34784 different transports can be listed in the routing information:
34785 </para>
34786 <literallayout class="monospaced">
34787 save_in_file:
34788   driver = manualroute
34789   route_list = \
34790     *.saved.domain1.example  $domain  batch_appendfile; \
34791     *.saved.domain2.example  \
34792       ${lookup{$domain}dbm{/domain2/hosts}{$value}fail} \
34793       batch_pipe
34794 </literallayout>
34795 <para>
34796 <indexterm role="variable">
34797 <primary><varname>$domain</varname></primary>
34798 </indexterm>
34799 <indexterm role="variable">
34800 <primary><varname>$host</varname></primary>
34801 </indexterm>
34802 The first of these just passes the domain in the <varname>$host</varname> variable, which
34803 doesn&#x2019;t achieve much (since it is also in <varname>$domain</varname>), but the second does a
34804 file lookup to find a value to pass, causing the router to decline to handle
34805 the address if the lookup fails.
34806 </para>
34807 </listitem>
34808 <listitem>
34809 <para>
34810 <indexterm role="concept">
34811 <primary>UUCP</primary>
34812 <secondary>example of router for</secondary>
34813 </indexterm>
34814 Routing mail directly to UUCP software is a specific case of the use of
34815 <command>manualroute</command> in a gateway to another mail environment. This is an example of
34816 one way it can be done:
34817 </para>
34818 <literallayout class="monospaced">
34819 # Transport
34820 uucp:
34821   driver = pipe
34822   user = nobody
34823   command = /usr/local/bin/uux -r - \
34824     ${substr_-5:$host}!rmail ${local_part}
34825   return_fail_output = true
34826
34827 # Router
34828 uucphost:
34829   transport = uucp
34830   driver = manualroute
34831   route_data = \
34832     ${lookup{$domain}lsearch{/usr/local/exim/uucphosts}}
34833 </literallayout>
34834 <para>
34835 The file <filename>/usr/local/exim/uucphosts</filename> contains entries like
34836 </para>
34837 <literallayout class="monospaced">
34838 darksite.ethereal.example:           darksite.UUCP
34839 </literallayout>
34840 <para>
34841 It can be set up more simply without adding and removing <quote>.UUCP</quote> but this way
34842 makes clear the distinction between the domain name
34843 <emphasis>darksite.ethereal.example</emphasis> and the UUCP host name <emphasis>darksite</emphasis>.
34844 </para>
34845 </listitem>
34846 </itemizedlist>
34847 <para>
34848 <indexterm role="concept" startref="IIDmanrou1" class="endofrange"/>
34849 <indexterm role="concept" startref="IIDmanrou2" class="endofrange"/>
34850 </para>
34851 </section>
34852 </chapter>
34853
34854 <chapter id="CHAPdriverlast">
34855 <title>The queryprogram router</title>
34856 <para>
34857 <indexterm role="concept" id="IIDquerou1" class="startofrange">
34858 <primary><command>queryprogram</command> router</primary>
34859 </indexterm>
34860 <indexterm role="concept" id="IIDquerou2" class="startofrange">
34861 <primary>routers</primary>
34862 <secondary><command>queryprogram</command></secondary>
34863 </indexterm>
34864 <indexterm role="concept">
34865 <primary>routing</primary>
34866 <secondary>by external program</secondary>
34867 </indexterm>
34868 The <command>queryprogram</command> router routes an address by running an external command
34869 and acting on its output. This is an expensive way to route, and is intended
34870 mainly for use in lightly-loaded systems, or for performing experiments.
34871 However, if it is possible to use the precondition options (<option>domains</option>,
34872 <option>local_parts</option>, etc) to skip this router for most addresses, it could sensibly
34873 be used in special cases, even on a busy host. There are the following private
34874 options:
34875 <indexterm role="concept">
34876 <primary>options</primary>
34877 <secondary><command>queryprogram</command> router</secondary>
34878 </indexterm>
34879 </para>
34880 <para>
34881 <indexterm role="option">
34882 <primary><option>command</option></primary>
34883 </indexterm>
34884 </para>
34885 <informaltable frame="all">
34886 <tgroup cols="4" colsep="0" rowsep="0">
34887 <colspec colwidth="8*" align="left"/>
34888 <colspec colwidth="6*" align="center"/>
34889 <colspec colwidth="6*" align="center"/>
34890 <colspec colwidth="6*" align="right"/>
34891 <tbody>
34892 <row>
34893 <entry><option>command</option></entry>
34894 <entry>Use: <emphasis>queryprogram</emphasis></entry>
34895 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
34896 <entry>Default: <emphasis>unset</emphasis></entry>
34897 </row>
34898 </tbody>
34899 </tgroup>
34900 </informaltable>
34901 <para>
34902 This option must be set. It specifies the command that is to be run. The
34903 command is split up into a command name and arguments, and then each is
34904 expanded separately (exactly as for a <command>pipe</command> transport, described in chapter
34905 <xref linkend="CHAPpipetransport"/>).
34906 </para>
34907 <para>
34908 <indexterm role="option">
34909 <primary><option>command_group</option></primary>
34910 </indexterm>
34911 </para>
34912 <informaltable frame="all">
34913 <tgroup cols="4" colsep="0" rowsep="0">
34914 <colspec colwidth="8*" align="left"/>
34915 <colspec colwidth="6*" align="center"/>
34916 <colspec colwidth="6*" align="center"/>
34917 <colspec colwidth="6*" align="right"/>
34918 <tbody>
34919 <row>
34920 <entry><option>command_group</option></entry>
34921 <entry>Use: <emphasis>queryprogram</emphasis></entry>
34922 <entry>Type: <emphasis>string</emphasis></entry>
34923 <entry>Default: <emphasis>unset</emphasis></entry>
34924 </row>
34925 </tbody>
34926 </tgroup>
34927 </informaltable>
34928 <para>
34929 <indexterm role="concept">
34930 <primary>gid (group id)</primary>
34931 <secondary>in <command>queryprogram</command> router</secondary>
34932 </indexterm>
34933 This option specifies a gid to be set when running the command while routing an
34934 address for deliver. It must be set if <option>command_user</option> specifies a numerical
34935 uid. If it begins with a digit, it is interpreted as the numerical value of the
34936 gid. Otherwise it is looked up using <function>getgrnam()</function>.
34937 </para>
34938 <para>
34939 <indexterm role="option">
34940 <primary><option>command_user</option></primary>
34941 </indexterm>
34942 </para>
34943 <informaltable frame="all">
34944 <tgroup cols="4" colsep="0" rowsep="0">
34945 <colspec colwidth="8*" align="left"/>
34946 <colspec colwidth="6*" align="center"/>
34947 <colspec colwidth="6*" align="center"/>
34948 <colspec colwidth="6*" align="right"/>
34949 <tbody>
34950 <row>
34951 <entry><option>command_user</option></entry>
34952 <entry>Use: <emphasis>queryprogram</emphasis></entry>
34953 <entry>Type: <emphasis>string</emphasis></entry>
34954 <entry>Default: <emphasis>unset</emphasis></entry>
34955 </row>
34956 </tbody>
34957 </tgroup>
34958 </informaltable>
34959 <para>
34960 <indexterm role="concept">
34961 <primary>uid (user id)</primary>
34962 <secondary>for <command>queryprogram</command></secondary>
34963 </indexterm>
34964 This option must be set. It specifies the uid which is set when running the
34965 command while routing an address for delivery. If the value begins with a digit,
34966 it is interpreted as the numerical value of the uid. Otherwise, it is looked up
34967 using <function>getpwnam()</function> to obtain a value for the uid and, if <option>command_group</option> is
34968 not set, a value for the gid also.
34969 </para>
34970 <para>
34971 <emphasis role="bold">Warning:</emphasis> Changing uid and gid is possible only when Exim is running as
34972 root, which it does during a normal delivery in a conventional configuration.
34973 However, when an address is being verified during message reception, Exim is
34974 usually running as the Exim user, not as root. If the <command>queryprogram</command> router
34975 is called from a non-root process, Exim cannot change uid or gid before running
34976 the command. In this circumstance the command runs under the current uid and
34977 gid.
34978 </para>
34979 <para>
34980 <indexterm role="option">
34981 <primary><option>current_directory</option></primary>
34982 </indexterm>
34983 </para>
34984 <informaltable frame="all">
34985 <tgroup cols="4" colsep="0" rowsep="0">
34986 <colspec colwidth="8*" align="left"/>
34987 <colspec colwidth="6*" align="center"/>
34988 <colspec colwidth="6*" align="center"/>
34989 <colspec colwidth="6*" align="right"/>
34990 <tbody>
34991 <row>
34992 <entry><option>current_directory</option></entry>
34993 <entry>Use: <emphasis>queryprogram</emphasis></entry>
34994 <entry>Type: <emphasis>string</emphasis></entry>
34995 <entry>Default: <emphasis>/</emphasis></entry>
34996 </row>
34997 </tbody>
34998 </tgroup>
34999 </informaltable>
35000 <para>
35001 This option specifies an absolute path which is made the current directory
35002 before running the command.
35003 </para>
35004 <para>
35005 <indexterm role="option">
35006 <primary><option>timeout</option></primary>
35007 </indexterm>
35008 </para>
35009 <informaltable frame="all">
35010 <tgroup cols="4" colsep="0" rowsep="0">
35011 <colspec colwidth="8*" align="left"/>
35012 <colspec colwidth="6*" align="center"/>
35013 <colspec colwidth="6*" align="center"/>
35014 <colspec colwidth="6*" align="right"/>
35015 <tbody>
35016 <row>
35017 <entry><option>timeout</option></entry>
35018 <entry>Use: <emphasis>queryprogram</emphasis></entry>
35019 <entry>Type: <emphasis>time</emphasis></entry>
35020 <entry>Default: <emphasis>1h</emphasis></entry>
35021 </row>
35022 </tbody>
35023 </tgroup>
35024 </informaltable>
35025 <para>
35026 If the command does not complete within the timeout period, its process group
35027 is killed and the message is frozen. A value of zero time specifies no
35028 timeout.
35029 </para>
35030 <para>
35031 The standard output of the command is connected to a pipe, which is read when
35032 the command terminates. It should consist of a single line of output,
35033 containing up to five fields, separated by white space. The maximum length of
35034 the line is 1023 characters. Longer lines are silently truncated. The first
35035 field is one of the following words (case-insensitive):
35036 </para>
35037 <itemizedlist>
35038 <listitem>
35039 <para>
35040 <emphasis>Accept</emphasis>: routing succeeded; the remaining fields specify what to do (see
35041 below).
35042 </para>
35043 </listitem>
35044 <listitem>
35045 <para>
35046 <emphasis>Decline</emphasis>: the router declines; pass the address to the next router, unless
35047 <option>no_more</option> is set.
35048 </para>
35049 </listitem>
35050 <listitem>
35051 <para>
35052 <emphasis>Fail</emphasis>: routing failed; do not pass the address to any more routers. Any
35053 subsequent text on the line is an error message. If the router is run as part
35054 of address verification during an incoming SMTP message, the message is
35055 included in the SMTP response.
35056 </para>
35057 </listitem>
35058 <listitem>
35059 <para>
35060 <emphasis>Defer</emphasis>: routing could not be completed at this time; try again later. Any
35061 subsequent text on the line is an error message which is logged. It is not
35062 included in any SMTP response.
35063 </para>
35064 </listitem>
35065 <listitem>
35066 <para>
35067 <emphasis>Freeze</emphasis>: the same as <emphasis>defer</emphasis>, except that the message is frozen.
35068 </para>
35069 </listitem>
35070 <listitem>
35071 <para>
35072 <emphasis>Pass</emphasis>: pass the address to the next router (or the router specified by
35073 <option>pass_router</option>), overriding <option>no_more</option>.
35074 </para>
35075 </listitem>
35076 <listitem>
35077 <para>
35078 <emphasis>Redirect</emphasis>: the message is redirected. The remainder of the line is a list of
35079 new addresses, which are routed independently, starting with the first router,
35080 or the router specified by <option>redirect_router</option>, if set.
35081 </para>
35082 </listitem>
35083 </itemizedlist>
35084 <para>
35085 When the first word is <emphasis>accept</emphasis>, the remainder of the line consists of a
35086 number of keyed data values, as follows (split into two lines here, to fit on
35087 the page):
35088 </para>
35089 <literallayout class="monospaced">
35090 ACCEPT TRANSPORT=&lt;transport&gt; HOSTS=&lt;list of hosts&gt;
35091 LOOKUP=byname|bydns DATA=&lt;text&gt;
35092 </literallayout>
35093 <para>
35094 The data items can be given in any order, and all are optional. If no transport
35095 is included, the transport specified by the generic <option>transport</option> option is
35096 used. The list of hosts and the lookup type are needed only if the transport is
35097 an <command>smtp</command> transport that does not itself supply a list of hosts.
35098 </para>
35099 <para>
35100 The format of the list of hosts is the same as for the <command>manualroute</command> router.
35101 As well as host names and IP addresses with optional port numbers, as described
35102 in section <xref linkend="SECTformatonehostitem"/>, it may contain names followed by
35103 <literal>/MX</literal> to specify sublists of hosts that are obtained by looking up MX records
35104 (see section <xref linkend="SECThostshowused"/>).
35105 </para>
35106 <para>
35107 If the lookup type is not specified, Exim behaves as follows when trying to
35108 find an IP address for each host: First, a DNS lookup is done. If this yields
35109 anything other than HOST_NOT_FOUND, that result is used. Otherwise, Exim
35110 goes on to try a call to <function>getipnodebyname()</function> or <function>gethostbyname()</function>, and the
35111 result of the lookup is the result of that call.
35112 </para>
35113 <para>
35114 <indexterm role="variable">
35115 <primary><varname>$address_data</varname></primary>
35116 </indexterm>
35117 If the DATA field is set, its value is placed in the <varname>$address_data</varname>
35118 variable. For example, this return line
35119 </para>
35120 <literallayout class="monospaced">
35121 accept hosts=x1.y.example:x2.y.example data="rule1"
35122 </literallayout>
35123 <para>
35124 routes the address to the default transport, passing a list of two hosts. When
35125 the transport runs, the string <quote>rule1</quote> is in <varname>$address_data</varname>.
35126 <indexterm role="concept" startref="IIDquerou1" class="endofrange"/>
35127 <indexterm role="concept" startref="IIDquerou2" class="endofrange"/>
35128 </para>
35129 </chapter>
35130
35131 <chapter id="CHAPredirect">
35132 <title>The redirect router</title>
35133 <para>
35134 <indexterm role="concept" id="IIDredrou1" class="startofrange">
35135 <primary><command>redirect</command> router</primary>
35136 </indexterm>
35137 <indexterm role="concept" id="IIDredrou2" class="startofrange">
35138 <primary>routers</primary>
35139 <secondary><command>redirect</command></secondary>
35140 </indexterm>
35141 <indexterm role="concept">
35142 <primary>alias file</primary>
35143 <secondary>in a <command>redirect</command> router</secondary>
35144 </indexterm>
35145 <indexterm role="concept">
35146 <primary>address redirection</primary>
35147 <secondary><command>redirect</command> router</secondary>
35148 </indexterm>
35149 The <command>redirect</command> router handles several kinds of address redirection. Its most
35150 common uses are for resolving local part aliases from a central alias file
35151 (usually called <filename>/etc/aliases</filename>) and for handling users&#x2019; personal <filename>.forward</filename>
35152 files, but it has many other potential uses. The incoming address can be
35153 redirected in several different ways:
35154 </para>
35155 <itemizedlist>
35156 <listitem>
35157 <para>
35158 It can be replaced by one or more new addresses which are themselves routed
35159 independently.
35160 </para>
35161 </listitem>
35162 <listitem>
35163 <para>
35164 It can be routed to be delivered to a given file or directory.
35165 </para>
35166 </listitem>
35167 <listitem>
35168 <para>
35169 It can be routed to be delivered to a specified pipe command.
35170 </para>
35171 </listitem>
35172 <listitem>
35173 <para>
35174 It can cause an automatic reply to be generated.
35175 </para>
35176 </listitem>
35177 <listitem>
35178 <para>
35179 It can be forced to fail, optionally with a custom error message.
35180 </para>
35181 </listitem>
35182 <listitem>
35183 <para>
35184 It can be temporarily deferred, optionally with a custom message.
35185 </para>
35186 </listitem>
35187 <listitem>
35188 <para>
35189 It can be discarded.
35190 </para>
35191 </listitem>
35192 </itemizedlist>
35193 <para>
35194 The generic <option>transport</option> option must not be set for <command>redirect</command> routers.
35195 However, there are some private options which define transports for delivery to
35196 files and pipes, and for generating autoreplies. See the <option>file_transport</option>,
35197 <option>pipe_transport</option> and <option>reply_transport</option> descriptions below.
35198 </para>
35199 <section id="SECID124">
35200 <title>Redirection data</title>
35201 <para>
35202 The router operates by interpreting a text string which it obtains either by
35203 expanding the contents of the <option>data</option> option, or by reading the entire
35204 contents of a file whose name is given in the <option>file</option> option. These two
35205 options are mutually exclusive. The first is commonly used for handling system
35206 aliases, in a configuration like this:
35207 </para>
35208 <literallayout class="monospaced">
35209 system_aliases:
35210   driver = redirect
35211   data = ${lookup{$local_part}lsearch{/etc/aliases}}
35212 </literallayout>
35213 <para>
35214 If the lookup fails, the expanded string in this example is empty. When the
35215 expansion of <option>data</option> results in an empty string, the router declines. A forced
35216 expansion failure also causes the router to decline; other expansion failures
35217 cause delivery to be deferred.
35218 </para>
35219 <para>
35220 A configuration using <option>file</option> is commonly used for handling users&#x2019;
35221 <filename>.forward</filename> files, like this:
35222 </para>
35223 <literallayout class="monospaced">
35224 userforward:
35225   driver = redirect
35226   check_local_user
35227   file = $home/.forward
35228   no_verify
35229 </literallayout>
35230 <para>
35231 If the file does not exist, or causes no action to be taken (for example, it is
35232 empty or consists only of comments), the router declines. <emphasis role="bold">Warning</emphasis>: This
35233 is not the case when the file contains syntactically valid items that happen to
35234 yield empty addresses, for example, items containing only RFC 2822 address
35235 comments.
35236 </para>
35237 </section>
35238 <section id="SECID125">
35239 <title>Forward files and address verification</title>
35240 <para>
35241 <indexterm role="concept">
35242 <primary>address redirection</primary>
35243 <secondary>while verifying</secondary>
35244 </indexterm>
35245 It is usual to set <option>no_verify</option> on <command>redirect</command> routers which handle users&#x2019;
35246 <filename>.forward</filename> files, as in the example above. There are two reasons for this:
35247 </para>
35248 <itemizedlist>
35249 <listitem>
35250 <para>
35251 When Exim is receiving an incoming SMTP message from a remote host, it is
35252 running under the Exim uid, not as root. Exim is unable to change uid to read
35253 the file as the user, and it may not be able to read it as the Exim user. So in
35254 practice the router may not be able to operate.
35255 </para>
35256 </listitem>
35257 <listitem>
35258 <para>
35259 However, even when the router can operate, the existence of a <filename>.forward</filename> file
35260 is unimportant when verifying an address. What should be checked is whether the
35261 local part is a valid user name or not. Cutting out the redirection processing
35262 saves some resources.
35263 </para>
35264 </listitem>
35265 </itemizedlist>
35266 </section>
35267 <section id="SECID126">
35268 <title>Interpreting redirection data</title>
35269 <para>
35270 <indexterm role="concept">
35271 <primary>Sieve filter</primary>
35272 <secondary>specifying in redirection data</secondary>
35273 </indexterm>
35274 <indexterm role="concept">
35275 <primary>filter</primary>
35276 <secondary>specifying in redirection data</secondary>
35277 </indexterm>
35278 The contents of the data string, whether obtained from <option>data</option> or <option>file</option>,
35279 can be interpreted in two different ways:
35280 </para>
35281 <itemizedlist>
35282 <listitem>
35283 <para>
35284 If the <option>allow_filter</option> option is set true, and the data begins with the text
35285 <quote>#Exim filter</quote> or <quote>#Sieve filter</quote>, it is interpreted as a list of
35286 <emphasis>filtering</emphasis> instructions in the form of an Exim or Sieve filter file,
35287 respectively. Details of the syntax and semantics of filter files are described
35288 in a separate document entitled <emphasis>Exim&#x2019;s interfaces to mail filtering</emphasis>; this
35289 document is intended for use by end users.
35290 </para>
35291 </listitem>
35292 <listitem>
35293 <para>
35294 Otherwise, the data must be a comma-separated list of redirection items, as
35295 described in the next section.
35296 </para>
35297 </listitem>
35298 </itemizedlist>
35299 <para>
35300 When a message is redirected to a file (a <quote>mail folder</quote>), the file name given
35301 in a non-filter redirection list must always be an absolute path. A filter may
35302 generate a relative path &ndash; how this is handled depends on the transport&#x2019;s
35303 configuration. See section <xref linkend="SECTfildiropt"/> for a discussion of this issue
35304 for the <command>appendfile</command> transport.
35305 </para>
35306 </section>
35307 <section id="SECTitenonfilred">
35308 <title>Items in a non-filter redirection list</title>
35309 <para>
35310 <indexterm role="concept">
35311 <primary>address redirection</primary>
35312 <secondary>non-filter list items</secondary>
35313 </indexterm>
35314 When the redirection data is not an Exim or Sieve filter, for example, if it
35315 comes from a conventional alias or forward file, it consists of a list of
35316 addresses, file names, pipe commands, or certain special items (see section
35317 <xref linkend="SECTspecitredli"/> below). The special items can be individually enabled or
35318 disabled by means of options whose names begin with <option>allow_</option> or <option>forbid_</option>,
35319 depending on their default values. The items in the list are separated by
35320 commas or newlines.
35321 If a comma is required in an item, the entire item must be enclosed in double
35322 quotes.
35323 </para>
35324 <para>
35325 Lines starting with a # character are comments, and are ignored, and # may
35326 also appear following a comma, in which case everything between the # and the
35327 next newline character is ignored.
35328 </para>
35329 <para>
35330 If an item is entirely enclosed in double quotes, these are removed. Otherwise
35331 double quotes are retained because some forms of mail address require their use
35332 (but never to enclose the entire address). In the following description,
35333 <quote>item</quote> refers to what remains after any surrounding double quotes have been
35334 removed.
35335 </para>
35336 <para>
35337 <indexterm role="variable">
35338 <primary><varname>$local_part</varname></primary>
35339 </indexterm>
35340 <emphasis role="bold">Warning</emphasis>: If you use an Exim expansion to construct a redirection address,
35341 and the expansion contains a reference to <varname>$local_part</varname>, you should make use
35342 of the <option>quote_local_part</option> expansion operator, in case the local part contains
35343 special characters. For example, to redirect all mail for the domain
35344 <emphasis>obsolete.example</emphasis>, retaining the existing local part, you could use this
35345 setting:
35346 </para>
35347 <literallayout class="monospaced">
35348 data = ${quote_local_part:$local_part}@newdomain.example
35349 </literallayout>
35350 </section>
35351 <section id="SECTredlocmai">
35352 <title>Redirecting to a local mailbox</title>
35353 <para>
35354 <indexterm role="concept">
35355 <primary>routing</primary>
35356 <secondary>loops in</secondary>
35357 </indexterm>
35358 <indexterm role="concept">
35359 <primary>loop</primary>
35360 <secondary>while routing, avoidance of</secondary>
35361 </indexterm>
35362 <indexterm role="concept">
35363 <primary>address redirection</primary>
35364 <secondary>to local mailbox</secondary>
35365 </indexterm>
35366 A redirection item may safely be the same as the address currently under
35367 consideration. This does not cause a routing loop, because a router is
35368 automatically skipped if any ancestor of the address that is being processed
35369 is the same as the current address and was processed by the current router.
35370 Such an address is therefore passed to the following routers, so it is handled
35371 as if there were no redirection. When making this loop-avoidance test, the
35372 complete local part, including any prefix or suffix, is used.
35373 </para>
35374 <para>
35375 <indexterm role="concept">
35376 <primary>address redirection</primary>
35377 <secondary>local part without domain</secondary>
35378 </indexterm>
35379 Specifying the same local part without a domain is a common usage in personal
35380 filter files when the user wants to have messages delivered to the local
35381 mailbox and also forwarded elsewhere. For example, the user whose login is
35382 <emphasis>cleo</emphasis> might have a <filename>.forward</filename> file containing this:
35383 </para>
35384 <literallayout class="monospaced">
35385 cleo, cleopatra@egypt.example
35386 </literallayout>
35387 <para>
35388 <indexterm role="concept">
35389 <primary>backslash in alias file</primary>
35390 </indexterm>
35391 <indexterm role="concept">
35392 <primary>alias file</primary>
35393 <secondary>backslash in</secondary>
35394 </indexterm>
35395 For compatibility with other MTAs, such unqualified local parts may be
35396 preceded by <quote>\</quote>, but this is not a requirement for loop prevention. However,
35397 it does make a difference if more than one domain is being handled
35398 synonymously.
35399 </para>
35400 <para>
35401 If an item begins with <quote>\</quote> and the rest of the item parses as a valid RFC
35402 2822 address that does not include a domain, the item is qualified using the
35403 domain of the incoming address. In the absence of a leading <quote>\</quote>, unqualified
35404 addresses are qualified using the value in <option>qualify_recipient</option>, but you can
35405 force the incoming domain to be used by setting <option>qualify_preserve_domain</option>.
35406 </para>
35407 <para>
35408 Care must be taken if there are alias names for local users.
35409 Consider an MTA handling a single local domain where the system alias file
35410 contains:
35411 </para>
35412 <literallayout class="monospaced">
35413 Sam.Reman: spqr
35414 </literallayout>
35415 <para>
35416 Now suppose that Sam (whose login id is <emphasis>spqr</emphasis>) wants to save copies of
35417 messages in the local mailbox, and also forward copies elsewhere. He creates
35418 this forward file:
35419 </para>
35420 <literallayout class="monospaced">
35421 Sam.Reman, spqr@reme.elsewhere.example
35422 </literallayout>
35423 <para>
35424 With these settings, an incoming message addressed to <emphasis>Sam.Reman</emphasis> fails. The
35425 <command>redirect</command> router for system aliases does not process <emphasis>Sam.Reman</emphasis> the
35426 second time round, because it has previously routed it,
35427 and the following routers presumably cannot handle the alias. The forward file
35428 should really contain
35429 </para>
35430 <literallayout class="monospaced">
35431 spqr, spqr@reme.elsewhere.example
35432 </literallayout>
35433 <para>
35434 but because this is such a common error, the <option>check_ancestor</option> option (see
35435 below) exists to provide a way to get round it. This is normally set on a
35436 <command>redirect</command> router that is handling users&#x2019; <filename>.forward</filename> files.
35437 </para>
35438 </section>
35439 <section id="SECTspecitredli">
35440 <title>Special items in redirection lists</title>
35441 <para>
35442 In addition to addresses, the following types of item may appear in redirection
35443 lists (that is, in non-filter redirection data):
35444 </para>
35445 <itemizedlist>
35446 <listitem>
35447 <para>
35448 <indexterm role="concept">
35449 <primary>pipe</primary>
35450 <secondary>in redirection list</secondary>
35451 </indexterm>
35452 <indexterm role="concept">
35453 <primary>address redirection</primary>
35454 <secondary>to pipe</secondary>
35455 </indexterm>
35456 An item is treated as a pipe command if it begins with <quote>|</quote> and does not parse
35457 as a valid RFC 2822 address that includes a domain. A transport for running the
35458 command must be specified by the <option>pipe_transport</option> option.
35459 Normally, either the router or the transport specifies a user and a group under
35460 which to run the delivery. The default is to use the Exim user and group.
35461 </para>
35462 <para>
35463 Single or double quotes can be used for enclosing the individual arguments of
35464 the pipe command; no interpretation of escapes is done for single quotes. If
35465 the command contains a comma character, it is necessary to put the whole item
35466 in double quotes, for example:
35467 </para>
35468 <literallayout class="monospaced">
35469 "|/some/command ready,steady,go"
35470 </literallayout>
35471 <para>
35472 since items in redirection lists are terminated by commas. Do not, however,
35473 quote just the command. An item such as
35474 </para>
35475 <literallayout class="monospaced">
35476 |"/some/command ready,steady,go"
35477 </literallayout>
35478 <para>
35479 is interpreted as a pipe with a rather strange command name, and no arguments.
35480 </para>
35481 <para>
35482 Note that the above example assumes that the text comes from a lookup source
35483 of some sort, so that the quotes are part of the data.  If composing a
35484 redirect router with a <option>data</option> option directly specifying this command, the
35485 quotes will be used by the configuration parser to define the extent of one
35486 string, but will not be passed down into the redirect router itself.  There
35487 are two main approaches to get around this: escape quotes to be part of the
35488 data itself, or avoid using this mechanism and instead create a custom
35489 transport with the <option>command</option> option set and reference that transport from
35490 an <option>accept</option> router.
35491 </para>
35492 </listitem>
35493 <listitem>
35494 <para>
35495 <indexterm role="concept">
35496 <primary>file</primary>
35497 <secondary>in redirection list</secondary>
35498 </indexterm>
35499 <indexterm role="concept">
35500 <primary>address redirection</primary>
35501 <secondary>to file</secondary>
35502 </indexterm>
35503 An item is interpreted as a path name if it begins with <quote>/</quote> and does not
35504 parse as a valid RFC 2822 address that includes a domain. For example,
35505 </para>
35506 <literallayout class="monospaced">
35507 /home/world/minbari
35508 </literallayout>
35509 <para>
35510 is treated as a file name, but
35511 </para>
35512 <literallayout class="monospaced">
35513 /s=molari/o=babylon/@x400gate.way
35514 </literallayout>
35515 <para>
35516 is treated as an address. For a file name, a transport must be specified using
35517 the <option>file_transport</option> option. However, if the generated path name ends with a
35518 forward slash character, it is interpreted as a directory name rather than a
35519 file name, and <option>directory_transport</option> is used instead.
35520 </para>
35521 <para>
35522 Normally, either the router or the transport specifies a user and a group under
35523 which to run the delivery. The default is to use the Exim user and group.
35524 </para>
35525 <para>
35526 <indexterm role="concept">
35527 <primary><filename>/dev/null</filename></primary>
35528 </indexterm>
35529 However, if a redirection item is the path <filename>/dev/null</filename>, delivery to it is
35530 bypassed at a high level, and the log entry shows <quote>**bypassed**</quote>
35531 instead of a transport name. In this case the user and group are not used.
35532 </para>
35533 </listitem>
35534 <listitem>
35535 <para>
35536 <indexterm role="concept">
35537 <primary>included address list</primary>
35538 </indexterm>
35539 <indexterm role="concept">
35540 <primary>address redirection</primary>
35541 <secondary>included external list</secondary>
35542 </indexterm>
35543 If an item is of the form
35544 </para>
35545 <literallayout class="monospaced">
35546 :include:&lt;path name&gt;
35547 </literallayout>
35548 <para>
35549 a list of further items is taken from the given file and included at that
35550 point. <emphasis role="bold">Note</emphasis>: Such a file can not be a filter file; it is just an
35551 out-of-line addition to the list. The items in the included list are separated
35552 by commas or newlines and are not subject to expansion. If this is the first
35553 item in an alias list in an <command>lsearch</command> file, a colon must be used to terminate
35554 the alias name. This example is incorrect:
35555 </para>
35556 <literallayout class="monospaced">
35557 list1    :include:/opt/lists/list1
35558 </literallayout>
35559 <para>
35560 It must be given as
35561 </para>
35562 <literallayout class="monospaced">
35563 list1:   :include:/opt/lists/list1
35564 </literallayout>
35565 </listitem>
35566 <listitem>
35567 <para>
35568 <indexterm role="concept">
35569 <primary>address redirection</primary>
35570 <secondary>to black hole</secondary>
35571 </indexterm>
35572 Sometimes you want to throw away mail to a particular local part. Making the
35573 <option>data</option> option expand to an empty string does not work, because that causes
35574 the router to decline. Instead, the alias item
35575 <indexterm role="concept">
35576 <primary>black hole</primary>
35577 </indexterm>
35578 <indexterm role="concept">
35579 <primary>abandoning mail</primary>
35580 </indexterm>
35581 <emphasis>:blackhole:</emphasis> can be used. It does what its name implies. No delivery is
35582 done, and no error message is generated. This has the same effect as specifing
35583 <filename>/dev/null</filename> as a destination, but it can be independently disabled.
35584 </para>
35585 <para>
35586 <emphasis role="bold">Warning</emphasis>: If <emphasis>:blackhole:</emphasis> appears anywhere in a redirection list, no
35587 delivery is done for the original local part, even if other redirection items
35588 are present. If you are generating a multi-item list (for example, by reading a
35589 database) and need the ability to provide a no-op item, you must use
35590 <filename>/dev/null</filename>.
35591 </para>
35592 </listitem>
35593 <listitem>
35594 <para>
35595 <indexterm role="concept">
35596 <primary>delivery</primary>
35597 <secondary>forcing failure</secondary>
35598 </indexterm>
35599 <indexterm role="concept">
35600 <primary>delivery</primary>
35601 <secondary>forcing deferral</secondary>
35602 </indexterm>
35603 <indexterm role="concept">
35604 <primary>failing delivery</primary>
35605 <secondary>forcing</secondary>
35606 </indexterm>
35607 <indexterm role="concept">
35608 <primary>deferred delivery, forcing</primary>
35609 </indexterm>
35610 <indexterm role="concept">
35611 <primary>customizing</primary>
35612 <secondary>failure message</secondary>
35613 </indexterm>
35614 An attempt to deliver a particular address can be deferred or forced to fail by
35615 redirection items of the form
35616 </para>
35617 <literallayout class="monospaced">
35618 :defer:
35619 :fail:
35620 </literallayout>
35621 <para>
35622 respectively. When a redirection list contains such an item, it applies
35623 to the entire redirection; any other items in the list are ignored. Any
35624 text following <emphasis>:fail:</emphasis> or <emphasis>:defer:</emphasis> is placed in the error text
35625 associated with the failure. For example, an alias file might contain:
35626 </para>
35627 <literallayout class="monospaced">
35628 X.Employee:  :fail: Gone away, no forwarding address
35629 </literallayout>
35630 <para>
35631 In the case of an address that is being verified from an ACL or as the subject
35632 of a
35633 <indexterm role="concept">
35634 <primary>VRFY</primary>
35635 <secondary>error text, display of</secondary>
35636 </indexterm>
35637 VRFY command, the text is included in the SMTP error response by
35638 default.
35639 <indexterm role="concept">
35640 <primary>EXPN</primary>
35641 <secondary>error text, display of</secondary>
35642 </indexterm>
35643 The text is not included in the response to an EXPN command. In non-SMTP cases
35644 the text is included in the error message that Exim generates.
35645 </para>
35646 <para>
35647 <indexterm role="concept">
35648 <primary>SMTP</primary>
35649 <secondary>error codes</secondary>
35650 </indexterm>
35651 By default, Exim sends a 451 SMTP code for a <emphasis>:defer:</emphasis>, and 550 for
35652 <emphasis>:fail:</emphasis>. However, if the message starts with three digits followed by a
35653 space, optionally followed by an extended code of the form <emphasis>n.n.n</emphasis>, also
35654 followed by a space, and the very first digit is the same as the default error
35655 code, the code from the message is used instead. If the very first digit is
35656 incorrect, a panic error is logged, and the default code is used. You can
35657 suppress the use of the supplied code in a redirect router by setting the
35658 <option>forbid_smtp_code</option> option true. In this case, any SMTP code is quietly
35659 ignored.
35660 </para>
35661 <para>
35662 <indexterm role="variable">
35663 <primary><varname>$acl_verify_message</varname></primary>
35664 </indexterm>
35665 In an ACL, an explicitly provided message overrides the default, but the
35666 default message is available in the variable <varname>$acl_verify_message</varname> and can
35667 therefore be included in a custom message if this is desired.
35668 </para>
35669 <para>
35670 Normally the error text is the rest of the redirection list &ndash; a comma does
35671 not terminate it &ndash; but a newline does act as a terminator. Newlines are not
35672 normally present in alias expansions. In <command>lsearch</command> lookups they are removed
35673 as part of the continuation process, but they may exist in other kinds of
35674 lookup and in <emphasis>:include:</emphasis> files.
35675 </para>
35676 <para>
35677 During routing for message delivery (as opposed to verification), a redirection
35678 containing <emphasis>:fail:</emphasis> causes an immediate failure of the incoming address,
35679 whereas <emphasis>:defer:</emphasis> causes the message to remain on the queue so that a
35680 subsequent delivery attempt can happen at a later time. If an address is
35681 deferred for too long, it will ultimately fail, because the normal retry
35682 rules still apply.
35683 </para>
35684 </listitem>
35685 <listitem>
35686 <para>
35687 <indexterm role="concept">
35688 <primary>alias file</primary>
35689 <secondary>exception to default</secondary>
35690 </indexterm>
35691 Sometimes it is useful to use a single-key search type with a default (see
35692 chapter <xref linkend="CHAPfdlookup"/>) to look up aliases. However, there may be a need
35693 for exceptions to the default. These can be handled by aliasing them to
35694 <emphasis>:unknown:</emphasis>. This differs from <emphasis>:fail:</emphasis> in that it causes the <command>redirect</command>
35695 router to decline, whereas <emphasis>:fail:</emphasis> forces routing to fail. A lookup which
35696 results in an empty redirection list has the same effect.
35697 </para>
35698 </listitem>
35699 </itemizedlist>
35700 </section>
35701 <section id="SECTdupaddr">
35702 <title>Duplicate addresses</title>
35703 <para>
35704 <indexterm role="concept">
35705 <primary>duplicate addresses</primary>
35706 </indexterm>
35707 <indexterm role="concept">
35708 <primary>address duplicate, discarding</primary>
35709 </indexterm>
35710 <indexterm role="concept">
35711 <primary>pipe</primary>
35712 <secondary>duplicated</secondary>
35713 </indexterm>
35714 Exim removes duplicate addresses from the list to which it is delivering, so as
35715 to deliver just one copy to each address. This does not apply to deliveries
35716 routed to pipes by different immediate parent addresses, but an indirect
35717 aliasing scheme of the type
35718 </para>
35719 <literallayout class="monospaced">
35720 pipe:       |/some/command $local_part
35721 localpart1: pipe
35722 localpart2: pipe
35723 </literallayout>
35724 <para>
35725 does not work with a message that is addressed to both local parts, because
35726 when the second is aliased to the intermediate local part <quote>pipe</quote> it gets
35727 discarded as being the same as a previously handled address. However, a scheme
35728 such as
35729 </para>
35730 <literallayout class="monospaced">
35731 localpart1: |/some/command $local_part
35732 localpart2: |/some/command $local_part
35733 </literallayout>
35734 <para>
35735 does result in two different pipe deliveries, because the immediate parents of
35736 the pipes are distinct.
35737 </para>
35738 </section>
35739 <section id="SECID128">
35740 <title>Repeated redirection expansion</title>
35741 <para>
35742 <indexterm role="concept">
35743 <primary>repeated redirection expansion</primary>
35744 </indexterm>
35745 <indexterm role="concept">
35746 <primary>address redirection</primary>
35747 <secondary>repeated for each delivery attempt</secondary>
35748 </indexterm>
35749 When a message cannot be delivered to all of its recipients immediately,
35750 leading to two or more delivery attempts, redirection expansion is carried out
35751 afresh each time for those addresses whose children were not all previously
35752 delivered. If redirection is being used as a mailing list, this can lead to new
35753 members of the list receiving copies of old messages. The <option>one_time</option> option
35754 can be used to avoid this.
35755 </para>
35756 </section>
35757 <section id="SECID129">
35758 <title>Errors in redirection lists</title>
35759 <para>
35760 <indexterm role="concept">
35761 <primary>address redirection</primary>
35762 <secondary>errors</secondary>
35763 </indexterm>
35764 If <option>skip_syntax_errors</option> is set, a malformed address that causes a parsing
35765 error is skipped, and an entry is written to the main log. This may be useful
35766 for mailing lists that are automatically managed. Otherwise, if an error is
35767 detected while generating the list of new addresses, the original address is
35768 deferred. See also <option>syntax_errors_to</option>.
35769 </para>
35770 </section>
35771 <section id="SECID130">
35772 <title>Private options for the redirect router</title>
35773 <para>
35774 <indexterm role="concept">
35775 <primary>options</primary>
35776 <secondary><command>redirect</command> router</secondary>
35777 </indexterm>
35778 The private options for the <command>redirect</command> router are as follows:
35779 </para>
35780 <para>
35781 <indexterm role="option">
35782 <primary><option>allow_defer</option></primary>
35783 </indexterm>
35784 </para>
35785 <informaltable frame="all">
35786 <tgroup cols="4" colsep="0" rowsep="0">
35787 <colspec colwidth="8*" align="left"/>
35788 <colspec colwidth="6*" align="center"/>
35789 <colspec colwidth="6*" align="center"/>
35790 <colspec colwidth="6*" align="right"/>
35791 <tbody>
35792 <row>
35793 <entry><option>allow_defer</option></entry>
35794 <entry>Use: <emphasis>redirect</emphasis></entry>
35795 <entry>Type: <emphasis>boolean</emphasis></entry>
35796 <entry>Default: <emphasis>false</emphasis></entry>
35797 </row>
35798 </tbody>
35799 </tgroup>
35800 </informaltable>
35801 <para>
35802 Setting this option allows the use of <emphasis>:defer:</emphasis> in non-filter redirection
35803 data, or the <option>defer</option> command in an Exim filter file.
35804 </para>
35805 <para>
35806 <indexterm role="option">
35807 <primary><option>allow_fail</option></primary>
35808 </indexterm>
35809 </para>
35810 <informaltable frame="all">
35811 <tgroup cols="4" colsep="0" rowsep="0">
35812 <colspec colwidth="8*" align="left"/>
35813 <colspec colwidth="6*" align="center"/>
35814 <colspec colwidth="6*" align="center"/>
35815 <colspec colwidth="6*" align="right"/>
35816 <tbody>
35817 <row>
35818 <entry><option>allow_fail</option></entry>
35819 <entry>Use: <emphasis>redirect</emphasis></entry>
35820 <entry>Type: <emphasis>boolean</emphasis></entry>
35821 <entry>Default: <emphasis>false</emphasis></entry>
35822 </row>
35823 </tbody>
35824 </tgroup>
35825 </informaltable>
35826 <para>
35827 <indexterm role="concept">
35828 <primary>failing delivery</primary>
35829 <secondary>from filter</secondary>
35830 </indexterm>
35831 If this option is true, the <emphasis>:fail:</emphasis> item can be used in a redirection list,
35832 and the <option>fail</option> command may be used in an Exim filter file.
35833 </para>
35834 <para>
35835 <indexterm role="option">
35836 <primary><option>allow_filter</option></primary>
35837 </indexterm>
35838 </para>
35839 <informaltable frame="all">
35840 <tgroup cols="4" colsep="0" rowsep="0">
35841 <colspec colwidth="8*" align="left"/>
35842 <colspec colwidth="6*" align="center"/>
35843 <colspec colwidth="6*" align="center"/>
35844 <colspec colwidth="6*" align="right"/>
35845 <tbody>
35846 <row>
35847 <entry><option>allow_filter</option></entry>
35848 <entry>Use: <emphasis>redirect</emphasis></entry>
35849 <entry>Type: <emphasis>boolean</emphasis></entry>
35850 <entry>Default: <emphasis>false</emphasis></entry>
35851 </row>
35852 </tbody>
35853 </tgroup>
35854 </informaltable>
35855 <para>
35856 <indexterm role="concept">
35857 <primary>filter</primary>
35858 <secondary>enabling use of</secondary>
35859 </indexterm>
35860 <indexterm role="concept">
35861 <primary>Sieve filter</primary>
35862 <secondary>enabling use of</secondary>
35863 </indexterm>
35864 Setting this option allows Exim to interpret redirection data that starts with
35865 <quote>#Exim filter</quote> or <quote>#Sieve filter</quote> as a set of filtering instructions. There
35866 are some features of Exim filter files that some administrators may wish to
35867 lock out; see the <option>forbid_filter_</option><emphasis>xxx</emphasis> options below.
35868 </para>
35869 <para>
35870 It is also possible to lock out Exim filters or Sieve filters while allowing
35871 the other type; see <option>forbid_exim_filter</option> and <option>forbid_sieve_filter</option>.
35872 </para>
35873 <para>
35874 The filter is run using the uid and gid set by the generic <option>user</option> and
35875 <option>group</option> options. These take their defaults from the password data if
35876 <option>check_local_user</option> is set, so in the normal case of users&#x2019; personal filter
35877 files, the filter is run as the relevant user. When <option>allow_filter</option> is set
35878 true, Exim insists that either <option>check_local_user</option> or <option>user</option> is set.
35879 </para>
35880 <para>
35881 <indexterm role="option">
35882 <primary><option>allow_freeze</option></primary>
35883 </indexterm>
35884 </para>
35885 <informaltable frame="all">
35886 <tgroup cols="4" colsep="0" rowsep="0">
35887 <colspec colwidth="8*" align="left"/>
35888 <colspec colwidth="6*" align="center"/>
35889 <colspec colwidth="6*" align="center"/>
35890 <colspec colwidth="6*" align="right"/>
35891 <tbody>
35892 <row>
35893 <entry><option>allow_freeze</option></entry>
35894 <entry>Use: <emphasis>redirect</emphasis></entry>
35895 <entry>Type: <emphasis>boolean</emphasis></entry>
35896 <entry>Default: <emphasis>false</emphasis></entry>
35897 </row>
35898 </tbody>
35899 </tgroup>
35900 </informaltable>
35901 <para>
35902 <indexterm role="concept">
35903 <primary>freezing messages</primary>
35904 <secondary>allowing in filter</secondary>
35905 </indexterm>
35906 Setting this option allows the use of the <option>freeze</option> command in an Exim filter.
35907 This command is more normally encountered in system filters, and is disabled by
35908 default for redirection filters because it isn&#x2019;t something you usually want to
35909 let ordinary users do.
35910 </para>
35911 <para>
35912 <indexterm role="option">
35913 <primary><option>check_ancestor</option></primary>
35914 </indexterm>
35915 </para>
35916 <informaltable frame="all">
35917 <tgroup cols="4" colsep="0" rowsep="0">
35918 <colspec colwidth="8*" align="left"/>
35919 <colspec colwidth="6*" align="center"/>
35920 <colspec colwidth="6*" align="center"/>
35921 <colspec colwidth="6*" align="right"/>
35922 <tbody>
35923 <row>
35924 <entry><option>check_ancestor</option></entry>
35925 <entry>Use: <emphasis>redirect</emphasis></entry>
35926 <entry>Type: <emphasis>boolean</emphasis></entry>
35927 <entry>Default: <emphasis>false</emphasis></entry>
35928 </row>
35929 </tbody>
35930 </tgroup>
35931 </informaltable>
35932 <para>
35933 This option is concerned with handling generated addresses that are the same
35934 as some address in the list of redirection ancestors of the current address.
35935 Although it is turned off by default in the code, it is set in the default
35936 configuration file for handling users&#x2019; <filename>.forward</filename> files. It is recommended
35937 for this use of the <command>redirect</command> router.
35938 </para>
35939 <para>
35940 When <option>check_ancestor</option> is set, if a generated address (including the domain)
35941 is the same as any ancestor of the current address, it is replaced by a copy of
35942 the current address. This helps in the case where local part A is aliased to B,
35943 and B has a <filename>.forward</filename> file pointing back to A. For example, within a single
35944 domain, the local part <quote>Joe.Bloggs</quote> is aliased to <quote>jb</quote> and
35945 <filename>&nbsp;jb/.forward</filename> contains:
35946 </para>
35947 <literallayout class="monospaced">
35948 \Joe.Bloggs, &lt;other item(s)&gt;
35949 </literallayout>
35950 <para>
35951 Without the <option>check_ancestor</option> setting, either local part (<quote>jb</quote> or
35952 <quote>joe.bloggs</quote>) gets processed once by each router and so ends up as it was
35953 originally. If <quote>jb</quote> is the real mailbox name, mail to <quote>jb</quote> gets delivered
35954 (having been turned into <quote>joe.bloggs</quote> by the <filename>.forward</filename> file and back to
35955 <quote>jb</quote> by the alias), but mail to <quote>joe.bloggs</quote> fails. Setting
35956 <option>check_ancestor</option> on the <command>redirect</command> router that handles the <filename>.forward</filename>
35957 file prevents it from turning <quote>jb</quote> back into <quote>joe.bloggs</quote> when that was the
35958 original address. See also the <option>repeat_use</option> option below.
35959 </para>
35960 <para>
35961 <indexterm role="option">
35962 <primary><option>check_group</option></primary>
35963 </indexterm>
35964 </para>
35965 <informaltable frame="all">
35966 <tgroup cols="4" colsep="0" rowsep="0">
35967 <colspec colwidth="8*" align="left"/>
35968 <colspec colwidth="6*" align="center"/>
35969 <colspec colwidth="6*" align="center"/>
35970 <colspec colwidth="6*" align="right"/>
35971 <tbody>
35972 <row>
35973 <entry><option>check_group</option></entry>
35974 <entry>Use: <emphasis>redirect</emphasis></entry>
35975 <entry>Type: <emphasis>boolean</emphasis></entry>
35976 <entry>Default: <emphasis>see below</emphasis></entry>
35977 </row>
35978 </tbody>
35979 </tgroup>
35980 </informaltable>
35981 <para>
35982 When the <option>file</option> option is used, the group owner of the file is checked only
35983 when this option is set. The permitted groups are those listed in the
35984 <option>owngroups</option> option, together with the user&#x2019;s default group if
35985 <option>check_local_user</option> is set. If the file has the wrong group, routing is
35986 deferred. The default setting for this option is true if <option>check_local_user</option>
35987 is set and the <option>modemask</option> option permits the group write bit, or if the
35988 <option>owngroups</option> option is set. Otherwise it is false, and no group check occurs.
35989 </para>
35990 <para>
35991 <indexterm role="option">
35992 <primary><option>check_owner</option></primary>
35993 </indexterm>
35994 </para>
35995 <informaltable frame="all">
35996 <tgroup cols="4" colsep="0" rowsep="0">
35997 <colspec colwidth="8*" align="left"/>
35998 <colspec colwidth="6*" align="center"/>
35999 <colspec colwidth="6*" align="center"/>
36000 <colspec colwidth="6*" align="right"/>
36001 <tbody>
36002 <row>
36003 <entry><option>check_owner</option></entry>
36004 <entry>Use: <emphasis>redirect</emphasis></entry>
36005 <entry>Type: <emphasis>boolean</emphasis></entry>
36006 <entry>Default: <emphasis>see below</emphasis></entry>
36007 </row>
36008 </tbody>
36009 </tgroup>
36010 </informaltable>
36011 <para>
36012 When the <option>file</option> option is used, the owner of the file is checked only when
36013 this option is set. If <option>check_local_user</option> is set, the local user is
36014 permitted; otherwise the owner must be one of those listed in the <option>owners</option>
36015 option. The default value for this option is true if <option>check_local_user</option> or
36016 <option>owners</option> is set. Otherwise the default is false, and no owner check occurs.
36017 </para>
36018 <para>
36019 <indexterm role="option">
36020 <primary><option>data</option></primary>
36021 </indexterm>
36022 </para>
36023 <informaltable frame="all">
36024 <tgroup cols="4" colsep="0" rowsep="0">
36025 <colspec colwidth="8*" align="left"/>
36026 <colspec colwidth="6*" align="center"/>
36027 <colspec colwidth="6*" align="center"/>
36028 <colspec colwidth="6*" align="right"/>
36029 <tbody>
36030 <row>
36031 <entry><option>data</option></entry>
36032 <entry>Use: <emphasis>redirect</emphasis></entry>
36033 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
36034 <entry>Default: <emphasis>unset</emphasis></entry>
36035 </row>
36036 </tbody>
36037 </tgroup>
36038 </informaltable>
36039 <para>
36040 This option is mutually exclusive with <option>file</option>. One or other of them must be
36041 set, but not both. The contents of <option>data</option> are expanded, and then used as the
36042 list of forwarding items, or as a set of filtering instructions. If the
36043 expansion is forced to fail, or the result is an empty string or a string that
36044 has no effect (consists entirely of comments), the router declines.
36045 </para>
36046 <para>
36047 When filtering instructions are used, the string must begin with <quote>#Exim
36048 filter</quote>, and all comments in the string, including this initial one, must be
36049 terminated with newline characters. For example:
36050 </para>
36051 <literallayout class="monospaced">
36052 data = #Exim filter\n\
36053        if $h_to: contains Exim then save $home/mail/exim endif
36054 </literallayout>
36055 <para>
36056 If you are reading the data from a database where newlines cannot be included,
36057 you can use the <varname>${sg}</varname> expansion item to turn the escape string of your
36058 choice into a newline.
36059 </para>
36060 <para>
36061 <indexterm role="option">
36062 <primary><option>directory_transport</option></primary>
36063 </indexterm>
36064 </para>
36065 <informaltable frame="all">
36066 <tgroup cols="4" colsep="0" rowsep="0">
36067 <colspec colwidth="8*" align="left"/>
36068 <colspec colwidth="6*" align="center"/>
36069 <colspec colwidth="6*" align="center"/>
36070 <colspec colwidth="6*" align="right"/>
36071 <tbody>
36072 <row>
36073 <entry><option>directory_transport</option></entry>
36074 <entry>Use: <emphasis>redirect</emphasis></entry>
36075 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
36076 <entry>Default: <emphasis>unset</emphasis></entry>
36077 </row>
36078 </tbody>
36079 </tgroup>
36080 </informaltable>
36081 <para>
36082 A <command>redirect</command> router sets up a direct delivery to a directory when a path name
36083 ending with a slash is specified as a new <quote>address</quote>. The transport used is
36084 specified by this option, which, after expansion, must be the name of a
36085 configured transport. This should normally be an <command>appendfile</command> transport.
36086 </para>
36087 <para>
36088 <indexterm role="option">
36089 <primary><option>file</option></primary>
36090 </indexterm>
36091 </para>
36092 <informaltable frame="all">
36093 <tgroup cols="4" colsep="0" rowsep="0">
36094 <colspec colwidth="8*" align="left"/>
36095 <colspec colwidth="6*" align="center"/>
36096 <colspec colwidth="6*" align="center"/>
36097 <colspec colwidth="6*" align="right"/>
36098 <tbody>
36099 <row>
36100 <entry><option>file</option></entry>
36101 <entry>Use: <emphasis>redirect</emphasis></entry>
36102 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
36103 <entry>Default: <emphasis>unset</emphasis></entry>
36104 </row>
36105 </tbody>
36106 </tgroup>
36107 </informaltable>
36108 <para>
36109 This option specifies the name of a file that contains the redirection data. It
36110 is mutually exclusive with the <option>data</option> option. The string is expanded before
36111 use; if the expansion is forced to fail, the router declines. Other expansion
36112 failures cause delivery to be deferred. The result of a successful expansion
36113 must be an absolute path. The entire file is read and used as the redirection
36114 data. If the data is an empty string or a string that has no effect (consists
36115 entirely of comments), the router declines.
36116 </para>
36117 <para>
36118 <indexterm role="concept">
36119 <primary>NFS</primary>
36120 <secondary>checking for file existence</secondary>
36121 </indexterm>
36122 If the attempt to open the file fails with a <quote>does not exist</quote> error, Exim
36123 runs a check on the containing directory,
36124 unless <option>ignore_enotdir</option> is true (see below).
36125 If the directory does not appear to exist, delivery is deferred. This can
36126 happen when users&#x2019; <filename>.forward</filename> files are in NFS-mounted directories, and there
36127 is a mount problem. If the containing directory does exist, but the file does
36128 not, the router declines.
36129 </para>
36130 <para>
36131 <indexterm role="option">
36132 <primary><option>file_transport</option></primary>
36133 </indexterm>
36134 </para>
36135 <informaltable frame="all">
36136 <tgroup cols="4" colsep="0" rowsep="0">
36137 <colspec colwidth="8*" align="left"/>
36138 <colspec colwidth="6*" align="center"/>
36139 <colspec colwidth="6*" align="center"/>
36140 <colspec colwidth="6*" align="right"/>
36141 <tbody>
36142 <row>
36143 <entry><option>file_transport</option></entry>
36144 <entry>Use: <emphasis>redirect</emphasis></entry>
36145 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
36146 <entry>Default: <emphasis>unset</emphasis></entry>
36147 </row>
36148 </tbody>
36149 </tgroup>
36150 </informaltable>
36151 <para>
36152 <indexterm role="variable">
36153 <primary><varname>$address_file</varname></primary>
36154 </indexterm>
36155 A <command>redirect</command> router sets up a direct delivery to a file when a path name not
36156 ending in a slash is specified as a new <quote>address</quote>. The transport used is
36157 specified by this option, which, after expansion, must be the name of a
36158 configured transport. This should normally be an <command>appendfile</command> transport. When
36159 it is running, the file name is in <varname>$address_file</varname>.
36160 </para>
36161 <para>
36162 <indexterm role="option">
36163 <primary><option>filter_prepend_home</option></primary>
36164 </indexterm>
36165 </para>
36166 <informaltable frame="all">
36167 <tgroup cols="4" colsep="0" rowsep="0">
36168 <colspec colwidth="8*" align="left"/>
36169 <colspec colwidth="6*" align="center"/>
36170 <colspec colwidth="6*" align="center"/>
36171 <colspec colwidth="6*" align="right"/>
36172 <tbody>
36173 <row>
36174 <entry><option>filter_prepend_home</option></entry>
36175 <entry>Use: <emphasis>redirect</emphasis></entry>
36176 <entry>Type: <emphasis>boolean</emphasis></entry>
36177 <entry>Default: <emphasis>true</emphasis></entry>
36178 </row>
36179 </tbody>
36180 </tgroup>
36181 </informaltable>
36182 <para>
36183 When this option is true, if a <command>save</command> command in an Exim filter specifies a
36184 relative path, and <varname>$home</varname> is defined, it is automatically prepended to the
36185 relative path. If this option is set false, this action does not happen. The
36186 relative path is then passed to the transport unmodified.
36187 </para>
36188 <para>
36189 <indexterm role="option">
36190 <primary><option>forbid_blackhole</option></primary>
36191 </indexterm>
36192 </para>
36193 <informaltable frame="all">
36194 <tgroup cols="4" colsep="0" rowsep="0">
36195 <colspec colwidth="8*" align="left"/>
36196 <colspec colwidth="6*" align="center"/>
36197 <colspec colwidth="6*" align="center"/>
36198 <colspec colwidth="6*" align="right"/>
36199 <tbody>
36200 <row>
36201 <entry><option>forbid_blackhole</option></entry>
36202 <entry>Use: <emphasis>redirect</emphasis></entry>
36203 <entry>Type: <emphasis>boolean</emphasis></entry>
36204 <entry>Default: <emphasis>false</emphasis></entry>
36205 </row>
36206 </tbody>
36207 </tgroup>
36208 </informaltable>
36209 <para>
36210 If this option is true, the <emphasis>:blackhole:</emphasis> item may not appear in a
36211 redirection list.
36212 </para>
36213 <para>
36214 <indexterm role="option">
36215 <primary><option>forbid_exim_filter</option></primary>
36216 </indexterm>
36217 </para>
36218 <informaltable frame="all">
36219 <tgroup cols="4" colsep="0" rowsep="0">
36220 <colspec colwidth="8*" align="left"/>
36221 <colspec colwidth="6*" align="center"/>
36222 <colspec colwidth="6*" align="center"/>
36223 <colspec colwidth="6*" align="right"/>
36224 <tbody>
36225 <row>
36226 <entry><option>forbid_exim_filter</option></entry>
36227 <entry>Use: <emphasis>redirect</emphasis></entry>
36228 <entry>Type: <emphasis>boolean</emphasis></entry>
36229 <entry>Default: <emphasis>false</emphasis></entry>
36230 </row>
36231 </tbody>
36232 </tgroup>
36233 </informaltable>
36234 <para>
36235 If this option is set true, only Sieve filters are permitted when
36236 <option>allow_filter</option> is true.
36237 </para>
36238 <para>
36239 <indexterm role="option">
36240 <primary><option>forbid_file</option></primary>
36241 </indexterm>
36242 </para>
36243 <informaltable frame="all">
36244 <tgroup cols="4" colsep="0" rowsep="0">
36245 <colspec colwidth="8*" align="left"/>
36246 <colspec colwidth="6*" align="center"/>
36247 <colspec colwidth="6*" align="center"/>
36248 <colspec colwidth="6*" align="right"/>
36249 <tbody>
36250 <row>
36251 <entry><option>forbid_file</option></entry>
36252 <entry>Use: <emphasis>redirect</emphasis></entry>
36253 <entry>Type: <emphasis>boolean</emphasis></entry>
36254 <entry>Default: <emphasis>false</emphasis></entry>
36255 </row>
36256 </tbody>
36257 </tgroup>
36258 </informaltable>
36259 <para>
36260 <indexterm role="concept">
36261 <primary>delivery</primary>
36262 <secondary>to file; forbidding</secondary>
36263 </indexterm>
36264 <indexterm role="concept">
36265 <primary>Sieve filter</primary>
36266 <secondary>forbidding delivery to a file</secondary>
36267 </indexterm>
36268 <indexterm role="concept">
36269 <primary>Sieve filter</primary>
36270 <secondary><quote>keep</quote> facility; disabling</secondary>
36271 </indexterm>
36272 If this option is true, this router may not generate a new address that
36273 specifies delivery to a local file or directory, either from a filter or from a
36274 conventional forward file. This option is forced to be true if <option>one_time</option> is
36275 set. It applies to Sieve filters as well as to Exim filters, but if true, it
36276 locks out the Sieve&#x2019;s <quote>keep</quote> facility.
36277 </para>
36278 <para>
36279 <indexterm role="option">
36280 <primary><option>forbid_filter_dlfunc</option></primary>
36281 </indexterm>
36282 </para>
36283 <informaltable frame="all">
36284 <tgroup cols="4" colsep="0" rowsep="0">
36285 <colspec colwidth="8*" align="left"/>
36286 <colspec colwidth="6*" align="center"/>
36287 <colspec colwidth="6*" align="center"/>
36288 <colspec colwidth="6*" align="right"/>
36289 <tbody>
36290 <row>
36291 <entry><option>forbid_filter_dlfunc</option></entry>
36292 <entry>Use: <emphasis>redirect</emphasis></entry>
36293 <entry>Type: <emphasis>boolean</emphasis></entry>
36294 <entry>Default: <emphasis>false</emphasis></entry>
36295 </row>
36296 </tbody>
36297 </tgroup>
36298 </informaltable>
36299 <para>
36300 <indexterm role="concept">
36301 <primary>filter</primary>
36302 <secondary>locking out certain features</secondary>
36303 </indexterm>
36304 If this option is true, string expansions in Exim filters are not allowed to
36305 make use of the <option>dlfunc</option> expansion facility to run dynamically loaded
36306 functions.
36307 </para>
36308 <para>
36309 <indexterm role="option">
36310 <primary><option>forbid_filter_existstest</option></primary>
36311 </indexterm>
36312 </para>
36313 <informaltable frame="all">
36314 <tgroup cols="4" colsep="0" rowsep="0">
36315 <colspec colwidth="8*" align="left"/>
36316 <colspec colwidth="6*" align="center"/>
36317 <colspec colwidth="6*" align="center"/>
36318 <colspec colwidth="6*" align="right"/>
36319 <tbody>
36320 <row>
36321 <entry><option>forbid_filter_existstest</option></entry>
36322 <entry>Use: <emphasis>redirect</emphasis></entry>
36323 <entry>Type: <emphasis>boolean</emphasis></entry>
36324 <entry>Default: <emphasis>false</emphasis></entry>
36325 </row>
36326 </tbody>
36327 </tgroup>
36328 </informaltable>
36329 <para>
36330 <indexterm role="concept">
36331 <primary>expansion</primary>
36332 <secondary>statting a file</secondary>
36333 </indexterm>
36334 If this option is true, string expansions in Exim filters are not allowed to
36335 make use of the <option>exists</option> condition or the <option>stat</option> expansion item.
36336 </para>
36337 <para>
36338 <indexterm role="option">
36339 <primary><option>forbid_filter_logwrite</option></primary>
36340 </indexterm>
36341 </para>
36342 <informaltable frame="all">
36343 <tgroup cols="4" colsep="0" rowsep="0">
36344 <colspec colwidth="8*" align="left"/>
36345 <colspec colwidth="6*" align="center"/>
36346 <colspec colwidth="6*" align="center"/>
36347 <colspec colwidth="6*" align="right"/>
36348 <tbody>
36349 <row>
36350 <entry><option>forbid_filter_logwrite</option></entry>
36351 <entry>Use: <emphasis>redirect</emphasis></entry>
36352 <entry>Type: <emphasis>boolean</emphasis></entry>
36353 <entry>Default: <emphasis>false</emphasis></entry>
36354 </row>
36355 </tbody>
36356 </tgroup>
36357 </informaltable>
36358 <para>
36359 If this option is true, use of the logging facility in Exim filters is not
36360 permitted. Logging is in any case available only if the filter is being run
36361 under some unprivileged uid (which is normally the case for ordinary users&#x2019;
36362 <filename>.forward</filename> files).
36363 </para>
36364 <para>
36365 <indexterm role="option">
36366 <primary><option>forbid_filter_lookup</option></primary>
36367 </indexterm>
36368 </para>
36369 <informaltable frame="all">
36370 <tgroup cols="4" colsep="0" rowsep="0">
36371 <colspec colwidth="8*" align="left"/>
36372 <colspec colwidth="6*" align="center"/>
36373 <colspec colwidth="6*" align="center"/>
36374 <colspec colwidth="6*" align="right"/>
36375 <tbody>
36376 <row>
36377 <entry><option>forbid_filter_lookup</option></entry>
36378 <entry>Use: <emphasis>redirect</emphasis></entry>
36379 <entry>Type: <emphasis>boolean</emphasis></entry>
36380 <entry>Default: <emphasis>false</emphasis></entry>
36381 </row>
36382 </tbody>
36383 </tgroup>
36384 </informaltable>
36385 <para>
36386 If this option is true, string expansions in Exim filter files are not allowed
36387 to make use of <option>lookup</option> items.
36388 </para>
36389 <para>
36390 <indexterm role="option">
36391 <primary><option>forbid_filter_perl</option></primary>
36392 </indexterm>
36393 </para>
36394 <informaltable frame="all">
36395 <tgroup cols="4" colsep="0" rowsep="0">
36396 <colspec colwidth="8*" align="left"/>
36397 <colspec colwidth="6*" align="center"/>
36398 <colspec colwidth="6*" align="center"/>
36399 <colspec colwidth="6*" align="right"/>
36400 <tbody>
36401 <row>
36402 <entry><option>forbid_filter_perl</option></entry>
36403 <entry>Use: <emphasis>redirect</emphasis></entry>
36404 <entry>Type: <emphasis>boolean</emphasis></entry>
36405 <entry>Default: <emphasis>false</emphasis></entry>
36406 </row>
36407 </tbody>
36408 </tgroup>
36409 </informaltable>
36410 <para>
36411 This option has an effect only if Exim is built with embedded Perl support. If
36412 it is true, string expansions in Exim filter files are not allowed to make use
36413 of the embedded Perl support.
36414 </para>
36415 <para>
36416 <indexterm role="option">
36417 <primary><option>forbid_filter_readfile</option></primary>
36418 </indexterm>
36419 </para>
36420 <informaltable frame="all">
36421 <tgroup cols="4" colsep="0" rowsep="0">
36422 <colspec colwidth="8*" align="left"/>
36423 <colspec colwidth="6*" align="center"/>
36424 <colspec colwidth="6*" align="center"/>
36425 <colspec colwidth="6*" align="right"/>
36426 <tbody>
36427 <row>
36428 <entry><option>forbid_filter_readfile</option></entry>
36429 <entry>Use: <emphasis>redirect</emphasis></entry>
36430 <entry>Type: <emphasis>boolean</emphasis></entry>
36431 <entry>Default: <emphasis>false</emphasis></entry>
36432 </row>
36433 </tbody>
36434 </tgroup>
36435 </informaltable>
36436 <para>
36437 If this option is true, string expansions in Exim filter files are not allowed
36438 to make use of <option>readfile</option> items.
36439 </para>
36440 <para>
36441 <indexterm role="option">
36442 <primary><option>forbid_filter_readsocket</option></primary>
36443 </indexterm>
36444 </para>
36445 <informaltable frame="all">
36446 <tgroup cols="4" colsep="0" rowsep="0">
36447 <colspec colwidth="8*" align="left"/>
36448 <colspec colwidth="6*" align="center"/>
36449 <colspec colwidth="6*" align="center"/>
36450 <colspec colwidth="6*" align="right"/>
36451 <tbody>
36452 <row>
36453 <entry><option>forbid_filter_readsocket</option></entry>
36454 <entry>Use: <emphasis>redirect</emphasis></entry>
36455 <entry>Type: <emphasis>boolean</emphasis></entry>
36456 <entry>Default: <emphasis>false</emphasis></entry>
36457 </row>
36458 </tbody>
36459 </tgroup>
36460 </informaltable>
36461 <para>
36462 If this option is true, string expansions in Exim filter files are not allowed
36463 to make use of <option>readsocket</option> items.
36464 </para>
36465 <para>
36466 <indexterm role="option">
36467 <primary><option>forbid_filter_reply</option></primary>
36468 </indexterm>
36469 </para>
36470 <informaltable frame="all">
36471 <tgroup cols="4" colsep="0" rowsep="0">
36472 <colspec colwidth="8*" align="left"/>
36473 <colspec colwidth="6*" align="center"/>
36474 <colspec colwidth="6*" align="center"/>
36475 <colspec colwidth="6*" align="right"/>
36476 <tbody>
36477 <row>
36478 <entry><option>forbid_filter_reply</option></entry>
36479 <entry>Use: <emphasis>redirect</emphasis></entry>
36480 <entry>Type: <emphasis>boolean</emphasis></entry>
36481 <entry>Default: <emphasis>false</emphasis></entry>
36482 </row>
36483 </tbody>
36484 </tgroup>
36485 </informaltable>
36486 <para>
36487 If this option is true, this router may not generate an automatic reply
36488 message. Automatic replies can be generated only from Exim or Sieve filter
36489 files, not from traditional forward files. This option is forced to be true if
36490 <option>one_time</option> is set.
36491 </para>
36492 <para>
36493 <indexterm role="option">
36494 <primary><option>forbid_filter_run</option></primary>
36495 </indexterm>
36496 </para>
36497 <informaltable frame="all">
36498 <tgroup cols="4" colsep="0" rowsep="0">
36499 <colspec colwidth="8*" align="left"/>
36500 <colspec colwidth="6*" align="center"/>
36501 <colspec colwidth="6*" align="center"/>
36502 <colspec colwidth="6*" align="right"/>
36503 <tbody>
36504 <row>
36505 <entry><option>forbid_filter_run</option></entry>
36506 <entry>Use: <emphasis>redirect</emphasis></entry>
36507 <entry>Type: <emphasis>boolean</emphasis></entry>
36508 <entry>Default: <emphasis>false</emphasis></entry>
36509 </row>
36510 </tbody>
36511 </tgroup>
36512 </informaltable>
36513 <para>
36514 If this option is true, string expansions in Exim filter files are not allowed
36515 to make use of <option>run</option> items.
36516 </para>
36517 <para>
36518 <indexterm role="option">
36519 <primary><option>forbid_include</option></primary>
36520 </indexterm>
36521 </para>
36522 <informaltable frame="all">
36523 <tgroup cols="4" colsep="0" rowsep="0">
36524 <colspec colwidth="8*" align="left"/>
36525 <colspec colwidth="6*" align="center"/>
36526 <colspec colwidth="6*" align="center"/>
36527 <colspec colwidth="6*" align="right"/>
36528 <tbody>
36529 <row>
36530 <entry><option>forbid_include</option></entry>
36531 <entry>Use: <emphasis>redirect</emphasis></entry>
36532 <entry>Type: <emphasis>boolean</emphasis></entry>
36533 <entry>Default: <emphasis>false</emphasis></entry>
36534 </row>
36535 </tbody>
36536 </tgroup>
36537 </informaltable>
36538 <para>
36539 If this option is true, items of the form
36540 </para>
36541 <literallayout class="monospaced">
36542 :include:&lt;path name&gt;
36543 </literallayout>
36544 <para>
36545 are not permitted in non-filter redirection lists.
36546 </para>
36547 <para>
36548 <indexterm role="option">
36549 <primary><option>forbid_pipe</option></primary>
36550 </indexterm>
36551 </para>
36552 <informaltable frame="all">
36553 <tgroup cols="4" colsep="0" rowsep="0">
36554 <colspec colwidth="8*" align="left"/>
36555 <colspec colwidth="6*" align="center"/>
36556 <colspec colwidth="6*" align="center"/>
36557 <colspec colwidth="6*" align="right"/>
36558 <tbody>
36559 <row>
36560 <entry><option>forbid_pipe</option></entry>
36561 <entry>Use: <emphasis>redirect</emphasis></entry>
36562 <entry>Type: <emphasis>boolean</emphasis></entry>
36563 <entry>Default: <emphasis>false</emphasis></entry>
36564 </row>
36565 </tbody>
36566 </tgroup>
36567 </informaltable>
36568 <para>
36569 <indexterm role="concept">
36570 <primary>delivery</primary>
36571 <secondary>to pipe; forbidding</secondary>
36572 </indexterm>
36573 If this option is true, this router may not generate a new address which
36574 specifies delivery to a pipe, either from an Exim filter or from a conventional
36575 forward file. This option is forced to be true if <option>one_time</option> is set.
36576 </para>
36577 <para>
36578 <indexterm role="option">
36579 <primary><option>forbid_sieve_filter</option></primary>
36580 </indexterm>
36581 </para>
36582 <informaltable frame="all">
36583 <tgroup cols="4" colsep="0" rowsep="0">
36584 <colspec colwidth="8*" align="left"/>
36585 <colspec colwidth="6*" align="center"/>
36586 <colspec colwidth="6*" align="center"/>
36587 <colspec colwidth="6*" align="right"/>
36588 <tbody>
36589 <row>
36590 <entry><option>forbid_sieve_filter</option></entry>
36591 <entry>Use: <emphasis>redirect</emphasis></entry>
36592 <entry>Type: <emphasis>boolean</emphasis></entry>
36593 <entry>Default: <emphasis>false</emphasis></entry>
36594 </row>
36595 </tbody>
36596 </tgroup>
36597 </informaltable>
36598 <para>
36599 If this option is set true, only Exim filters are permitted when
36600 <option>allow_filter</option> is true.
36601 </para>
36602 <para>
36603 <indexterm role="concept">
36604 <primary>SMTP</primary>
36605 <secondary>error codes</secondary>
36606 </indexterm>
36607 <indexterm role="option">
36608 <primary><option>forbid_smtp_code</option></primary>
36609 </indexterm>
36610 </para>
36611 <informaltable frame="all">
36612 <tgroup cols="4" colsep="0" rowsep="0">
36613 <colspec colwidth="8*" align="left"/>
36614 <colspec colwidth="6*" align="center"/>
36615 <colspec colwidth="6*" align="center"/>
36616 <colspec colwidth="6*" align="right"/>
36617 <tbody>
36618 <row>
36619 <entry><option>forbid_smtp_code</option></entry>
36620 <entry>Use: <emphasis>redirect</emphasis></entry>
36621 <entry>Type: <emphasis>boolean</emphasis></entry>
36622 <entry>Default: <emphasis>false</emphasis></entry>
36623 </row>
36624 </tbody>
36625 </tgroup>
36626 </informaltable>
36627 <para>
36628 If this option is set true, any SMTP error codes that are present at the start
36629 of messages specified for <literal>:defer:</literal> or <literal>:fail:</literal> are quietly ignored, and
36630 the default codes (451 and 550, respectively) are always used.
36631 </para>
36632 <para>
36633 <indexterm role="option">
36634 <primary><option>hide_child_in_errmsg</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>hide_child_in_errmsg</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>bounce message</primary>
36656 <secondary>redirection details; suppressing</secondary>
36657 </indexterm>
36658 If this option is true, it prevents Exim from quoting a child address if it
36659 generates a bounce or delay message for it. Instead it says <quote>an address
36660 generated from &lt;<emphasis>the top level address</emphasis>&gt;</quote>. Of course, this applies only to
36661 bounces generated locally. If a message is forwarded to another host, <emphasis>its</emphasis>
36662 bounce may well quote the generated address.
36663 </para>
36664 <para>
36665 <indexterm role="option">
36666 <primary><option>ignore_eacces</option></primary>
36667 </indexterm>
36668 </para>
36669 <informaltable frame="all">
36670 <tgroup cols="4" colsep="0" rowsep="0">
36671 <colspec colwidth="8*" align="left"/>
36672 <colspec colwidth="6*" align="center"/>
36673 <colspec colwidth="6*" align="center"/>
36674 <colspec colwidth="6*" align="right"/>
36675 <tbody>
36676 <row>
36677 <entry><option>ignore_eacces</option></entry>
36678 <entry>Use: <emphasis>redirect</emphasis></entry>
36679 <entry>Type: <emphasis>boolean</emphasis></entry>
36680 <entry>Default: <emphasis>false</emphasis></entry>
36681 </row>
36682 </tbody>
36683 </tgroup>
36684 </informaltable>
36685 <para>
36686 <indexterm role="concept">
36687 <primary>EACCES</primary>
36688 </indexterm>
36689 If this option is set and an attempt to open a redirection file yields the
36690 EACCES error (permission denied), the <command>redirect</command> router behaves as if the
36691 file did not exist.
36692 </para>
36693 <para>
36694 <indexterm role="option">
36695 <primary><option>ignore_enotdir</option></primary>
36696 </indexterm>
36697 </para>
36698 <informaltable frame="all">
36699 <tgroup cols="4" colsep="0" rowsep="0">
36700 <colspec colwidth="8*" align="left"/>
36701 <colspec colwidth="6*" align="center"/>
36702 <colspec colwidth="6*" align="center"/>
36703 <colspec colwidth="6*" align="right"/>
36704 <tbody>
36705 <row>
36706 <entry><option>ignore_enotdir</option></entry>
36707 <entry>Use: <emphasis>redirect</emphasis></entry>
36708 <entry>Type: <emphasis>boolean</emphasis></entry>
36709 <entry>Default: <emphasis>false</emphasis></entry>
36710 </row>
36711 </tbody>
36712 </tgroup>
36713 </informaltable>
36714 <para>
36715 <indexterm role="concept">
36716 <primary>ENOTDIR</primary>
36717 </indexterm>
36718 If this option is set and an attempt to open a redirection file yields the
36719 ENOTDIR error (something on the path is not a directory), the <command>redirect</command>
36720 router behaves as if the file did not exist.
36721 </para>
36722 <para>
36723 Setting <option>ignore_enotdir</option> has another effect as well: When a <command>redirect</command>
36724 router that has the <option>file</option> option set discovers that the file does not exist
36725 (the ENOENT error), it tries to <function>stat()</function> the parent directory, as a check
36726 against unmounted NFS directories. If the parent can not be statted, delivery
36727 is deferred. However, it seems wrong to do this check when <option>ignore_enotdir</option>
36728 is set, because that option tells Exim to ignore <quote>something on the path is not
36729 a directory</quote> (the ENOTDIR error). This is a confusing area, because it seems
36730 that some operating systems give ENOENT where others give ENOTDIR.
36731 </para>
36732 <para>
36733 <indexterm role="option">
36734 <primary><option>include_directory</option></primary>
36735 </indexterm>
36736 </para>
36737 <informaltable frame="all">
36738 <tgroup cols="4" colsep="0" rowsep="0">
36739 <colspec colwidth="8*" align="left"/>
36740 <colspec colwidth="6*" align="center"/>
36741 <colspec colwidth="6*" align="center"/>
36742 <colspec colwidth="6*" align="right"/>
36743 <tbody>
36744 <row>
36745 <entry><option>include_directory</option></entry>
36746 <entry>Use: <emphasis>redirect</emphasis></entry>
36747 <entry>Type: <emphasis>string</emphasis></entry>
36748 <entry>Default: <emphasis>unset</emphasis></entry>
36749 </row>
36750 </tbody>
36751 </tgroup>
36752 </informaltable>
36753 <para>
36754 If this option is set, the path names of any <emphasis>:include:</emphasis> items in a
36755 redirection list must start with this directory.
36756 </para>
36757 <para>
36758 <indexterm role="option">
36759 <primary><option>modemask</option></primary>
36760 </indexterm>
36761 </para>
36762 <informaltable frame="all">
36763 <tgroup cols="4" colsep="0" rowsep="0">
36764 <colspec colwidth="8*" align="left"/>
36765 <colspec colwidth="6*" align="center"/>
36766 <colspec colwidth="6*" align="center"/>
36767 <colspec colwidth="6*" align="right"/>
36768 <tbody>
36769 <row>
36770 <entry><option>modemask</option></entry>
36771 <entry>Use: <emphasis>redirect</emphasis></entry>
36772 <entry>Type: <emphasis>octal integer</emphasis></entry>
36773 <entry>Default: <emphasis>022</emphasis></entry>
36774 </row>
36775 </tbody>
36776 </tgroup>
36777 </informaltable>
36778 <para>
36779 This specifies mode bits which must not be set for a file specified by the
36780 <option>file</option> option. If any of the forbidden bits are set, delivery is deferred.
36781 </para>
36782 <para>
36783 <indexterm role="option">
36784 <primary><option>one_time</option></primary>
36785 </indexterm>
36786 </para>
36787 <informaltable frame="all">
36788 <tgroup cols="4" colsep="0" rowsep="0">
36789 <colspec colwidth="8*" align="left"/>
36790 <colspec colwidth="6*" align="center"/>
36791 <colspec colwidth="6*" align="center"/>
36792 <colspec colwidth="6*" align="right"/>
36793 <tbody>
36794 <row>
36795 <entry><option>one_time</option></entry>
36796 <entry>Use: <emphasis>redirect</emphasis></entry>
36797 <entry>Type: <emphasis>boolean</emphasis></entry>
36798 <entry>Default: <emphasis>false</emphasis></entry>
36799 </row>
36800 </tbody>
36801 </tgroup>
36802 </informaltable>
36803 <para>
36804 <indexterm role="concept">
36805 <primary>one-time aliasing/forwarding expansion</primary>
36806 </indexterm>
36807 <indexterm role="concept">
36808 <primary>alias file</primary>
36809 <secondary>one-time expansion</secondary>
36810 </indexterm>
36811 <indexterm role="concept">
36812 <primary>forward file</primary>
36813 <secondary>one-time expansion</secondary>
36814 </indexterm>
36815 <indexterm role="concept">
36816 <primary>mailing lists</primary>
36817 <secondary>one-time expansion</secondary>
36818 </indexterm>
36819 <indexterm role="concept">
36820 <primary>address redirection</primary>
36821 <secondary>one-time expansion</secondary>
36822 </indexterm>
36823 Sometimes the fact that Exim re-evaluates aliases and reprocesses redirection
36824 files each time it tries to deliver a message causes a problem when one or more
36825 of the generated addresses fails be delivered at the first attempt. The problem
36826 is not one of duplicate delivery &ndash; Exim is clever enough to handle that &ndash;
36827 but of what happens when the redirection list changes during the time that the
36828 message is on Exim&#x2019;s queue. This is particularly true in the case of mailing
36829 lists, where new subscribers might receive copies of messages that were posted
36830 before they subscribed.
36831 </para>
36832 <para>
36833 If <option>one_time</option> is set and any addresses generated by the router fail to
36834 deliver at the first attempt, the failing addresses are added to the message as
36835 <quote>top level</quote> addresses, and the parent address that generated them is marked
36836 <quote>delivered</quote>. Thus, redirection does not happen again at the next delivery
36837 attempt.
36838 </para>
36839 <para>
36840 <emphasis role="bold">Warning 1</emphasis>: Any header line addition or removal that is specified by this
36841 router would be lost if delivery did not succeed at the first attempt. For this
36842 reason, the <option>headers_add</option> and <option>headers_remove</option> generic options are not
36843 permitted when <option>one_time</option> is set.
36844 </para>
36845 <para>
36846 <emphasis role="bold">Warning 2</emphasis>: To ensure that the router generates only addresses (as opposed
36847 to pipe or file deliveries or auto-replies) <option>forbid_file</option>, <option>forbid_pipe</option>,
36848 and <option>forbid_filter_reply</option> are forced to be true when <option>one_time</option> is set.
36849 </para>
36850 <para>
36851 <emphasis role="bold">Warning 3</emphasis>: The <option>unseen</option> generic router option may not be set with
36852 <option>one_time</option>.
36853 </para>
36854 <para>
36855 The original top-level address is remembered with each of the generated
36856 addresses, and is output in any log messages. However, any intermediate parent
36857 addresses are not recorded. This makes a difference to the log only if
36858 <option>all_parents</option> log selector is set. It is expected that <option>one_time</option> will
36859 typically be used for mailing lists, where there is normally just one level of
36860 expansion.
36861 </para>
36862 <para>
36863 <indexterm role="option">
36864 <primary><option>owners</option></primary>
36865 </indexterm>
36866 </para>
36867 <informaltable frame="all">
36868 <tgroup cols="4" colsep="0" rowsep="0">
36869 <colspec colwidth="8*" align="left"/>
36870 <colspec colwidth="6*" align="center"/>
36871 <colspec colwidth="6*" align="center"/>
36872 <colspec colwidth="6*" align="right"/>
36873 <tbody>
36874 <row>
36875 <entry><option>owners</option></entry>
36876 <entry>Use: <emphasis>redirect</emphasis></entry>
36877 <entry>Type: <emphasis>string list</emphasis></entry>
36878 <entry>Default: <emphasis>unset</emphasis></entry>
36879 </row>
36880 </tbody>
36881 </tgroup>
36882 </informaltable>
36883 <para>
36884 <indexterm role="concept">
36885 <primary>ownership</primary>
36886 <secondary>alias file</secondary>
36887 </indexterm>
36888 <indexterm role="concept">
36889 <primary>ownership</primary>
36890 <secondary>forward file</secondary>
36891 </indexterm>
36892 <indexterm role="concept">
36893 <primary>alias file</primary>
36894 <secondary>ownership</secondary>
36895 </indexterm>
36896 <indexterm role="concept">
36897 <primary>forward file</primary>
36898 <secondary>ownership</secondary>
36899 </indexterm>
36900 This specifies a list of permitted owners for the file specified by <option>file</option>.
36901 This list is in addition to the local user when <option>check_local_user</option> is set.
36902 See <option>check_owner</option> above.
36903 </para>
36904 <para>
36905 <indexterm role="option">
36906 <primary><option>owngroups</option></primary>
36907 </indexterm>
36908 </para>
36909 <informaltable frame="all">
36910 <tgroup cols="4" colsep="0" rowsep="0">
36911 <colspec colwidth="8*" align="left"/>
36912 <colspec colwidth="6*" align="center"/>
36913 <colspec colwidth="6*" align="center"/>
36914 <colspec colwidth="6*" align="right"/>
36915 <tbody>
36916 <row>
36917 <entry><option>owngroups</option></entry>
36918 <entry>Use: <emphasis>redirect</emphasis></entry>
36919 <entry>Type: <emphasis>string list</emphasis></entry>
36920 <entry>Default: <emphasis>unset</emphasis></entry>
36921 </row>
36922 </tbody>
36923 </tgroup>
36924 </informaltable>
36925 <para>
36926 This specifies a list of permitted groups for the file specified by <option>file</option>.
36927 The list is in addition to the local user&#x2019;s primary group when
36928 <option>check_local_user</option> is set. See <option>check_group</option> above.
36929 </para>
36930 <para>
36931 <indexterm role="option">
36932 <primary><option>pipe_transport</option></primary>
36933 </indexterm>
36934 </para>
36935 <informaltable frame="all">
36936 <tgroup cols="4" colsep="0" rowsep="0">
36937 <colspec colwidth="8*" align="left"/>
36938 <colspec colwidth="6*" align="center"/>
36939 <colspec colwidth="6*" align="center"/>
36940 <colspec colwidth="6*" align="right"/>
36941 <tbody>
36942 <row>
36943 <entry><option>pipe_transport</option></entry>
36944 <entry>Use: <emphasis>redirect</emphasis></entry>
36945 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
36946 <entry>Default: <emphasis>unset</emphasis></entry>
36947 </row>
36948 </tbody>
36949 </tgroup>
36950 </informaltable>
36951 <para>
36952 <indexterm role="variable">
36953 <primary><varname>$address_pipe</varname></primary>
36954 </indexterm>
36955 A <command>redirect</command> router sets up a direct delivery to a pipe when a string
36956 starting with a vertical bar character is specified as a new <quote>address</quote>. The
36957 transport used is specified by this option, which, after expansion, must be the
36958 name of a configured transport. This should normally be a <command>pipe</command> transport.
36959 When the transport is run, the pipe command is in <varname>$address_pipe</varname>.
36960 </para>
36961 <para>
36962 <indexterm role="option">
36963 <primary><option>qualify_domain</option></primary>
36964 </indexterm>
36965 </para>
36966 <informaltable frame="all">
36967 <tgroup cols="4" colsep="0" rowsep="0">
36968 <colspec colwidth="8*" align="left"/>
36969 <colspec colwidth="6*" align="center"/>
36970 <colspec colwidth="6*" align="center"/>
36971 <colspec colwidth="6*" align="right"/>
36972 <tbody>
36973 <row>
36974 <entry><option>qualify_domain</option></entry>
36975 <entry>Use: <emphasis>redirect</emphasis></entry>
36976 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
36977 <entry>Default: <emphasis>unset</emphasis></entry>
36978 </row>
36979 </tbody>
36980 </tgroup>
36981 </informaltable>
36982 <para>
36983 <indexterm role="variable">
36984 <primary><varname>$qualify_recipient</varname></primary>
36985 </indexterm>
36986 If this option is set, and an unqualified address (one without a domain) is
36987 generated, and that address would normally be qualified by the global setting
36988 in <option>qualify_recipient</option>, it is instead qualified with the domain specified by
36989 expanding this string. If the expansion fails, the router declines. If you want
36990 to revert to the default, you can have the expansion generate
36991 <varname>$qualify_recipient</varname>.
36992 </para>
36993 <para>
36994 This option applies to all unqualified addresses generated by Exim filters,
36995 but for traditional <filename>.forward</filename> files, it applies only to addresses that are
36996 not preceded by a backslash. Sieve filters cannot generate unqualified
36997 addresses.
36998 </para>
36999 <para>
37000 <indexterm role="option">
37001 <primary><option>qualify_preserve_domain</option></primary>
37002 </indexterm>
37003 </para>
37004 <informaltable frame="all">
37005 <tgroup cols="4" colsep="0" rowsep="0">
37006 <colspec colwidth="8*" align="left"/>
37007 <colspec colwidth="6*" align="center"/>
37008 <colspec colwidth="6*" align="center"/>
37009 <colspec colwidth="6*" align="right"/>
37010 <tbody>
37011 <row>
37012 <entry><option>qualify_preserve_domain</option></entry>
37013 <entry>Use: <emphasis>redirect</emphasis></entry>
37014 <entry>Type: <emphasis>boolean</emphasis></entry>
37015 <entry>Default: <emphasis>false</emphasis></entry>
37016 </row>
37017 </tbody>
37018 </tgroup>
37019 </informaltable>
37020 <para>
37021 <indexterm role="concept">
37022 <primary>domain</primary>
37023 <secondary>in redirection; preserving</secondary>
37024 </indexterm>
37025 <indexterm role="concept">
37026 <primary>preserving domain in redirection</primary>
37027 </indexterm>
37028 <indexterm role="concept">
37029 <primary>address redirection</primary>
37030 <secondary>domain; preserving</secondary>
37031 </indexterm>
37032 If this option is set, the router&#x2019;s local <option>qualify_domain</option> option must not be
37033 set (a configuration error occurs if it is). If an unqualified address (one
37034 without a domain) is generated, it is qualified with the domain of the parent
37035 address (the immediately preceding ancestor) instead of the global
37036 <option>qualify_recipient</option> value. In the case of a traditional <filename>.forward</filename> file,
37037 this applies whether or not the address is preceded by a backslash.
37038 </para>
37039 <para>
37040 <indexterm role="option">
37041 <primary><option>repeat_use</option></primary>
37042 </indexterm>
37043 </para>
37044 <informaltable frame="all">
37045 <tgroup cols="4" colsep="0" rowsep="0">
37046 <colspec colwidth="8*" align="left"/>
37047 <colspec colwidth="6*" align="center"/>
37048 <colspec colwidth="6*" align="center"/>
37049 <colspec colwidth="6*" align="right"/>
37050 <tbody>
37051 <row>
37052 <entry><option>repeat_use</option></entry>
37053 <entry>Use: <emphasis>redirect</emphasis></entry>
37054 <entry>Type: <emphasis>boolean</emphasis></entry>
37055 <entry>Default: <emphasis>true</emphasis></entry>
37056 </row>
37057 </tbody>
37058 </tgroup>
37059 </informaltable>
37060 <para>
37061 If this option is set false, the router is skipped for a child address that has
37062 any ancestor that was routed by this router. This test happens before any of
37063 the other preconditions are tested. Exim&#x2019;s default anti-looping rules skip
37064 only when the ancestor is the same as the current address. See also
37065 <option>check_ancestor</option> above and the generic <option>redirect_router</option> option.
37066 </para>
37067 <para>
37068 <indexterm role="option">
37069 <primary><option>reply_transport</option></primary>
37070 </indexterm>
37071 </para>
37072 <informaltable frame="all">
37073 <tgroup cols="4" colsep="0" rowsep="0">
37074 <colspec colwidth="8*" align="left"/>
37075 <colspec colwidth="6*" align="center"/>
37076 <colspec colwidth="6*" align="center"/>
37077 <colspec colwidth="6*" align="right"/>
37078 <tbody>
37079 <row>
37080 <entry><option>reply_transport</option></entry>
37081 <entry>Use: <emphasis>redirect</emphasis></entry>
37082 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
37083 <entry>Default: <emphasis>unset</emphasis></entry>
37084 </row>
37085 </tbody>
37086 </tgroup>
37087 </informaltable>
37088 <para>
37089 A <command>redirect</command> router sets up an automatic reply when a <option>mail</option> or
37090 <option>vacation</option> command is used in a filter file. The transport used is specified
37091 by this option, which, after expansion, must be the name of a configured
37092 transport. This should normally be an <command>autoreply</command> transport. Other transports
37093 are unlikely to do anything sensible or useful.
37094 </para>
37095 <para>
37096 <indexterm role="option">
37097 <primary><option>rewrite</option></primary>
37098 </indexterm>
37099 </para>
37100 <informaltable frame="all">
37101 <tgroup cols="4" colsep="0" rowsep="0">
37102 <colspec colwidth="8*" align="left"/>
37103 <colspec colwidth="6*" align="center"/>
37104 <colspec colwidth="6*" align="center"/>
37105 <colspec colwidth="6*" align="right"/>
37106 <tbody>
37107 <row>
37108 <entry><option>rewrite</option></entry>
37109 <entry>Use: <emphasis>redirect</emphasis></entry>
37110 <entry>Type: <emphasis>boolean</emphasis></entry>
37111 <entry>Default: <emphasis>true</emphasis></entry>
37112 </row>
37113 </tbody>
37114 </tgroup>
37115 </informaltable>
37116 <para>
37117 <indexterm role="concept">
37118 <primary>address redirection</primary>
37119 <secondary>disabling rewriting</secondary>
37120 </indexterm>
37121 If this option is set false, addresses generated by the router are not
37122 subject to address rewriting. Otherwise, they are treated like new addresses
37123 and are rewritten according to the global rewriting rules.
37124 </para>
37125 <para>
37126 <indexterm role="option">
37127 <primary><option>sieve_subaddress</option></primary>
37128 </indexterm>
37129 </para>
37130 <informaltable frame="all">
37131 <tgroup cols="4" colsep="0" rowsep="0">
37132 <colspec colwidth="8*" align="left"/>
37133 <colspec colwidth="6*" align="center"/>
37134 <colspec colwidth="6*" align="center"/>
37135 <colspec colwidth="6*" align="right"/>
37136 <tbody>
37137 <row>
37138 <entry><option>sieve_subaddress</option></entry>
37139 <entry>Use: <emphasis>redirect</emphasis></entry>
37140 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
37141 <entry>Default: <emphasis>unset</emphasis></entry>
37142 </row>
37143 </tbody>
37144 </tgroup>
37145 </informaltable>
37146 <para>
37147 The value of this option is passed to a Sieve filter to specify the
37148 :subaddress part of an address.
37149 </para>
37150 <para>
37151 <indexterm role="option">
37152 <primary><option>sieve_useraddress</option></primary>
37153 </indexterm>
37154 </para>
37155 <informaltable frame="all">
37156 <tgroup cols="4" colsep="0" rowsep="0">
37157 <colspec colwidth="8*" align="left"/>
37158 <colspec colwidth="6*" align="center"/>
37159 <colspec colwidth="6*" align="center"/>
37160 <colspec colwidth="6*" align="right"/>
37161 <tbody>
37162 <row>
37163 <entry><option>sieve_useraddress</option></entry>
37164 <entry>Use: <emphasis>redirect</emphasis></entry>
37165 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
37166 <entry>Default: <emphasis>unset</emphasis></entry>
37167 </row>
37168 </tbody>
37169 </tgroup>
37170 </informaltable>
37171 <para>
37172 The value of this option is passed to a Sieve filter to specify the :user part
37173 of an address. However, if it is unset, the entire original local part
37174 (including any prefix or suffix) is used for :user.
37175 </para>
37176 <para>
37177 <indexterm role="option">
37178 <primary><option>sieve_vacation_directory</option></primary>
37179 </indexterm>
37180 </para>
37181 <informaltable frame="all">
37182 <tgroup cols="4" colsep="0" rowsep="0">
37183 <colspec colwidth="8*" align="left"/>
37184 <colspec colwidth="6*" align="center"/>
37185 <colspec colwidth="6*" align="center"/>
37186 <colspec colwidth="6*" align="right"/>
37187 <tbody>
37188 <row>
37189 <entry><option>sieve_vacation_directory</option></entry>
37190 <entry>Use: <emphasis>redirect</emphasis></entry>
37191 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
37192 <entry>Default: <emphasis>unset</emphasis></entry>
37193 </row>
37194 </tbody>
37195 </tgroup>
37196 </informaltable>
37197 <para>
37198 <indexterm role="concept">
37199 <primary>Sieve filter</primary>
37200 <secondary>vacation directory</secondary>
37201 </indexterm>
37202 To enable the <quote>vacation</quote> extension for Sieve filters, you must set
37203 <option>sieve_vacation_directory</option> to the directory where vacation databases are held
37204 (do not put anything else in that directory), and ensure that the
37205 <option>reply_transport</option> option refers to an <command>autoreply</command> transport. Each user
37206 needs their own directory; Exim will create it if necessary.
37207 </para>
37208 <para>
37209 <indexterm role="option">
37210 <primary><option>skip_syntax_errors</option></primary>
37211 </indexterm>
37212 </para>
37213 <informaltable frame="all">
37214 <tgroup cols="4" colsep="0" rowsep="0">
37215 <colspec colwidth="8*" align="left"/>
37216 <colspec colwidth="6*" align="center"/>
37217 <colspec colwidth="6*" align="center"/>
37218 <colspec colwidth="6*" align="right"/>
37219 <tbody>
37220 <row>
37221 <entry><option>skip_syntax_errors</option></entry>
37222 <entry>Use: <emphasis>redirect</emphasis></entry>
37223 <entry>Type: <emphasis>boolean</emphasis></entry>
37224 <entry>Default: <emphasis>false</emphasis></entry>
37225 </row>
37226 </tbody>
37227 </tgroup>
37228 </informaltable>
37229 <para>
37230 <indexterm role="concept">
37231 <primary>forward file</primary>
37232 <secondary>broken</secondary>
37233 </indexterm>
37234 <indexterm role="concept">
37235 <primary>address redirection</primary>
37236 <secondary>broken files</secondary>
37237 </indexterm>
37238 <indexterm role="concept">
37239 <primary>alias file</primary>
37240 <secondary>broken</secondary>
37241 </indexterm>
37242 <indexterm role="concept">
37243 <primary>broken alias or forward files</primary>
37244 </indexterm>
37245 <indexterm role="concept">
37246 <primary>ignoring faulty addresses</primary>
37247 </indexterm>
37248 <indexterm role="concept">
37249 <primary>skipping faulty addresses</primary>
37250 </indexterm>
37251 <indexterm role="concept">
37252 <primary>error</primary>
37253 <secondary>skipping bad syntax</secondary>
37254 </indexterm>
37255 If <option>skip_syntax_errors</option> is set, syntactically malformed addresses in
37256 non-filter redirection data are skipped, and each failing address is logged. If
37257 <option>syntax_errors_to</option> is set, a message is sent to the address it defines,
37258 giving details of the failures. If <option>syntax_errors_text</option> is set, its contents
37259 are expanded and placed at the head of the error message generated by
37260 <option>syntax_errors_to</option>. Usually it is appropriate to set <option>syntax_errors_to</option> to
37261 be the same address as the generic <option>errors_to</option> option. The
37262 <option>skip_syntax_errors</option> option is often used when handling mailing lists.
37263 </para>
37264 <para>
37265 If all the addresses in a redirection list are skipped because of syntax
37266 errors, the router declines to handle the original address, and it is passed to
37267 the following routers.
37268 </para>
37269 <para>
37270 If <option>skip_syntax_errors</option> is set when an Exim filter is interpreted, any syntax
37271 error in the filter causes filtering to be abandoned without any action being
37272 taken. The incident is logged, and the router declines to handle the address,
37273 so it is passed to the following routers.
37274 </para>
37275 <para>
37276 <indexterm role="concept">
37277 <primary>Sieve filter</primary>
37278 <secondary>syntax errors in</secondary>
37279 </indexterm>
37280 Syntax errors in a Sieve filter file cause the <quote>keep</quote> action to occur. This
37281 action is specified by RFC 3028. The values of <option>skip_syntax_errors</option>,
37282 <option>syntax_errors_to</option>, and <option>syntax_errors_text</option> are not used.
37283 </para>
37284 <para>
37285 <option>skip_syntax_errors</option> can be used to specify that errors in users&#x2019; forward
37286 lists or filter files should not prevent delivery. The <option>syntax_errors_to</option>
37287 option, used with an address that does not get redirected, can be used to
37288 notify users of these errors, by means of a router like this:
37289 </para>
37290 <literallayout class="monospaced">
37291 userforward:
37292   driver = redirect
37293   allow_filter
37294   check_local_user
37295   file = $home/.forward
37296   file_transport = address_file
37297   pipe_transport = address_pipe
37298   reply_transport = address_reply
37299   no_verify
37300   skip_syntax_errors
37301   syntax_errors_to = real-$local_part@$domain
37302   syntax_errors_text = \
37303    This is an automatically generated message. An error has\n\
37304    been found in your .forward file. Details of the error are\n\
37305    reported below. While this error persists, you will receive\n\
37306    a copy of this message for every message that is addressed\n\
37307    to you. If your .forward file is a filter file, or if it is\n\
37308    a non-filter file containing no valid forwarding addresses,\n\
37309    a copy of each incoming message will be put in your normal\n\
37310    mailbox. If a non-filter file contains at least one valid\n\
37311    forwarding address, forwarding to the valid addresses will\n\
37312    happen, and those will be the only deliveries that occur.
37313 </literallayout>
37314 <para>
37315 You also need a router to ensure that local addresses that are prefixed by
37316 <literal>real-</literal> are recognized, but not forwarded or filtered. For example, you could
37317 put this immediately before the <command>userforward</command> router:
37318 </para>
37319 <literallayout class="monospaced">
37320 real_localuser:
37321   driver = accept
37322   check_local_user
37323   local_part_prefix = real-
37324   transport = local_delivery
37325 </literallayout>
37326 <para>
37327 For security, it would probably be a good idea to restrict the use of this
37328 router to locally-generated messages, using a condition such as this:
37329 </para>
37330 <literallayout class="monospaced">
37331   condition = ${if match {$sender_host_address}\
37332                          {\N^(|127\.0\.0\.1)$\N}}
37333 </literallayout>
37334 <para>
37335 <indexterm role="option">
37336 <primary><option>syntax_errors_text</option></primary>
37337 </indexterm>
37338 </para>
37339 <informaltable frame="all">
37340 <tgroup cols="4" colsep="0" rowsep="0">
37341 <colspec colwidth="8*" align="left"/>
37342 <colspec colwidth="6*" align="center"/>
37343 <colspec colwidth="6*" align="center"/>
37344 <colspec colwidth="6*" align="right"/>
37345 <tbody>
37346 <row>
37347 <entry><option>syntax_errors_text</option></entry>
37348 <entry>Use: <emphasis>redirect</emphasis></entry>
37349 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
37350 <entry>Default: <emphasis>unset</emphasis></entry>
37351 </row>
37352 </tbody>
37353 </tgroup>
37354 </informaltable>
37355 <para>
37356 See <option>skip_syntax_errors</option> above.
37357 </para>
37358 <para>
37359 <indexterm role="option">
37360 <primary><option>syntax_errors_to</option></primary>
37361 </indexterm>
37362 </para>
37363 <informaltable frame="all">
37364 <tgroup cols="4" colsep="0" rowsep="0">
37365 <colspec colwidth="8*" align="left"/>
37366 <colspec colwidth="6*" align="center"/>
37367 <colspec colwidth="6*" align="center"/>
37368 <colspec colwidth="6*" align="right"/>
37369 <tbody>
37370 <row>
37371 <entry><option>syntax_errors_to</option></entry>
37372 <entry>Use: <emphasis>redirect</emphasis></entry>
37373 <entry>Type: <emphasis>string</emphasis></entry>
37374 <entry>Default: <emphasis>unset</emphasis></entry>
37375 </row>
37376 </tbody>
37377 </tgroup>
37378 </informaltable>
37379 <para>
37380 See <option>skip_syntax_errors</option> above.
37381 <indexterm role="concept" startref="IIDredrou1" class="endofrange"/>
37382 <indexterm role="concept" startref="IIDredrou2" class="endofrange"/>
37383 </para>
37384 </section>
37385 </chapter>
37386
37387 <chapter id="CHAPenvironment">
37388 <title>Environment for running local transports</title>
37389 <titleabbrev>Environment for local transports</titleabbrev>
37390 <para>
37391 <indexterm role="concept" id="IIDenvlotra1" class="startofrange">
37392 <primary>local transports</primary>
37393 <secondary>environment for</secondary>
37394 </indexterm>
37395 <indexterm role="concept" id="IIDenvlotra2" class="startofrange">
37396 <primary>environment for local transports</primary>
37397 </indexterm>
37398 <indexterm role="concept" id="IIDenvlotra3" class="startofrange">
37399 <primary>transport</primary>
37400 <secondary>local; environment for</secondary>
37401 </indexterm>
37402 Local transports handle deliveries to files and pipes. (The <command>autoreply</command>
37403 transport can be thought of as similar to a pipe.) Exim always runs transports
37404 in subprocesses, under specified uids and gids. Typical deliveries to local
37405 mailboxes run under the uid and gid of the local user.
37406 </para>
37407 <para>
37408 Exim also sets a specific current directory while running the transport; for
37409 some transports a home directory setting is also relevant. The <command>pipe</command>
37410 transport is the only one that sets up environment variables; see section
37411 <xref linkend="SECTpipeenv"/> for details.
37412 </para>
37413 <para>
37414 The values used for the uid, gid, and the directories may come from several
37415 different places. In many cases, the router that handles the address associates
37416 settings with that address as a result of its <option>check_local_user</option>, <option>group</option>,
37417 or <option>user</option> options. However, values may also be given in the transport&#x2019;s own
37418 configuration, and these override anything that comes from the router.
37419 </para>
37420 <section id="SECID131">
37421 <title>Concurrent deliveries</title>
37422 <para>
37423 <indexterm role="concept">
37424 <primary>concurrent deliveries</primary>
37425 </indexterm>
37426 <indexterm role="concept">
37427 <primary>simultaneous deliveries</primary>
37428 </indexterm>
37429 If two different messages for the same local recipient arrive more or less
37430 simultaneously, the two delivery processes are likely to run concurrently. When
37431 the <command>appendfile</command> transport is used to write to a file, Exim applies locking
37432 rules to stop concurrent processes from writing to the same file at the same
37433 time.
37434 </para>
37435 <para>
37436 However, when you use a <command>pipe</command> transport, it is up to you to arrange any
37437 locking that is needed. Here is a silly example:
37438 </para>
37439 <literallayout class="monospaced">
37440 my_transport:
37441   driver = pipe
37442   command = /bin/sh -c 'cat &gt;&gt;/some/file'
37443 </literallayout>
37444 <para>
37445 This is supposed to write the message at the end of the file. However, if two
37446 messages arrive at the same time, the file will be scrambled. You can use the
37447 <option>exim_lock</option> utility program (see section <xref linkend="SECTmailboxmaint"/>) to lock a
37448 file using the same algorithm that Exim itself uses.
37449 </para>
37450 </section>
37451 <section id="SECTenvuidgid">
37452 <title>Uids and gids</title>
37453 <para>
37454 <indexterm role="concept">
37455 <primary>local transports</primary>
37456 <secondary>uid and gid</secondary>
37457 </indexterm>
37458 <indexterm role="concept">
37459 <primary>transport</primary>
37460 <secondary>local; uid and gid</secondary>
37461 </indexterm>
37462 All transports have the options <option>group</option> and <option>user</option>. If <option>group</option> is set, it
37463 overrides any group that the router set in the address, even if <option>user</option> is not
37464 set for the transport. This makes it possible, for example, to run local mail
37465 delivery under the uid of the recipient (set by the router), but in a special
37466 group (set by the transport). For example:
37467 </para>
37468 <literallayout class="monospaced">
37469 # Routers ...
37470 # User/group are set by check_local_user in this router
37471 local_users:
37472   driver = accept
37473   check_local_user
37474   transport = group_delivery
37475
37476 # Transports ...
37477 # This transport overrides the group
37478 group_delivery:
37479   driver = appendfile
37480   file = /var/spool/mail/$local_part
37481   group = mail
37482 </literallayout>
37483 <para>
37484 If <option>user</option> is set for a transport, its value overrides what is set in the
37485 address by the router. If <option>user</option> is non-numeric and <option>group</option> is not set, the
37486 gid associated with the user is used. If <option>user</option> is numeric, <option>group</option> must be
37487 set.
37488 </para>
37489 <para>
37490 <indexterm role="option">
37491 <primary><option>initgroups</option></primary>
37492 </indexterm>
37493 When the uid is taken from the transport&#x2019;s configuration, the <function>initgroups()</function>
37494 function is called for the groups associated with that uid if the
37495 <option>initgroups</option> option is set for the transport. When the uid is not specified
37496 by the transport, but is associated with the address by a router, the option
37497 for calling <function>initgroups()</function> is taken from the router configuration.
37498 </para>
37499 <para>
37500 <indexterm role="concept">
37501 <primary><command>pipe</command> transport</primary>
37502 <secondary>uid for</secondary>
37503 </indexterm>
37504 The <command>pipe</command> transport contains the special option <option>pipe_as_creator</option>. If this
37505 is set and <option>user</option> is not set, the uid of the process that called Exim to
37506 receive the message is used, and if <option>group</option> is not set, the corresponding
37507 original gid is also used.
37508 </para>
37509 <para>
37510 This is the detailed preference order for obtaining a gid; the first of the
37511 following that is set is used:
37512 </para>
37513 <itemizedlist>
37514 <listitem>
37515 <para>
37516 A <option>group</option> setting of the transport;
37517 </para>
37518 </listitem>
37519 <listitem>
37520 <para>
37521 A <option>group</option> setting of the router;
37522 </para>
37523 </listitem>
37524 <listitem>
37525 <para>
37526 A gid associated with a user setting of the router, either as a result of
37527 <option>check_local_user</option> or an explicit non-numeric <option>user</option> setting;
37528 </para>
37529 </listitem>
37530 <listitem>
37531 <para>
37532 The group associated with a non-numeric <option>user</option> setting of the transport;
37533 </para>
37534 </listitem>
37535 <listitem>
37536 <para>
37537 In a <command>pipe</command> transport, the creator&#x2019;s gid if <option>deliver_as_creator</option> is set and
37538 the uid is the creator&#x2019;s uid;
37539 </para>
37540 </listitem>
37541 <listitem>
37542 <para>
37543 The Exim gid if the Exim uid is being used as a default.
37544 </para>
37545 </listitem>
37546 </itemizedlist>
37547 <para>
37548 If, for example, the user is specified numerically on the router and there are
37549 no group settings, no gid is available. In this situation, an error occurs.
37550 This is different for the uid, for which there always is an ultimate default.
37551 The first of the following that is set is used:
37552 </para>
37553 <itemizedlist>
37554 <listitem>
37555 <para>
37556 A <option>user</option> setting of the transport;
37557 </para>
37558 </listitem>
37559 <listitem>
37560 <para>
37561 In a <command>pipe</command> transport, the creator&#x2019;s uid if <option>deliver_as_creator</option> is set;
37562 </para>
37563 </listitem>
37564 <listitem>
37565 <para>
37566 A <option>user</option> setting of the router;
37567 </para>
37568 </listitem>
37569 <listitem>
37570 <para>
37571 A <option>check_local_user</option> setting of the router;
37572 </para>
37573 </listitem>
37574 <listitem>
37575 <para>
37576 The Exim uid.
37577 </para>
37578 </listitem>
37579 </itemizedlist>
37580 <para>
37581 Of course, an error will still occur if the uid that is chosen is on the
37582 <option>never_users</option> list.
37583 </para>
37584 </section>
37585 <section id="SECID132">
37586 <title>Current and home directories</title>
37587 <para>
37588 <indexterm role="concept">
37589 <primary>current directory for local transport</primary>
37590 </indexterm>
37591 <indexterm role="concept">
37592 <primary>home directory</primary>
37593 <secondary>for local transport</secondary>
37594 </indexterm>
37595 <indexterm role="concept">
37596 <primary>transport</primary>
37597 <secondary>local; home directory for</secondary>
37598 </indexterm>
37599 <indexterm role="concept">
37600 <primary>transport</primary>
37601 <secondary>local; current directory for</secondary>
37602 </indexterm>
37603 Routers may set current and home directories for local transports by means of
37604 the <option>transport_current_directory</option> and <option>transport_home_directory</option> options.
37605 However, if the transport&#x2019;s <option>current_directory</option> or <option>home_directory</option> options
37606 are set, they override the router&#x2019;s values. In detail, the home directory
37607 for a local transport is taken from the first of these values that is set:
37608 </para>
37609 <itemizedlist>
37610 <listitem>
37611 <para>
37612 The <option>home_directory</option> option on the transport;
37613 </para>
37614 </listitem>
37615 <listitem>
37616 <para>
37617 The <option>transport_home_directory</option> option on the router;
37618 </para>
37619 </listitem>
37620 <listitem>
37621 <para>
37622 The password data if <option>check_local_user</option> is set on the router;
37623 </para>
37624 </listitem>
37625 <listitem>
37626 <para>
37627 The <option>router_home_directory</option> option on the router.
37628 </para>
37629 </listitem>
37630 </itemizedlist>
37631 <para>
37632 The current directory is taken from the first of these values that is set:
37633 </para>
37634 <itemizedlist>
37635 <listitem>
37636 <para>
37637 The <option>current_directory</option> option on the transport;
37638 </para>
37639 </listitem>
37640 <listitem>
37641 <para>
37642 The <option>transport_current_directory</option> option on the router.
37643 </para>
37644 </listitem>
37645 </itemizedlist>
37646 <para>
37647 If neither the router nor the transport sets a current directory, Exim uses the
37648 value of the home directory, if it is set. Otherwise it sets the current
37649 directory to <filename>/</filename> before running a local transport.
37650 </para>
37651 </section>
37652 <section id="SECID133">
37653 <title>Expansion variables derived from the address</title>
37654 <para>
37655 <indexterm role="variable">
37656 <primary><varname>$domain</varname></primary>
37657 </indexterm>
37658 <indexterm role="variable">
37659 <primary><varname>$local_part</varname></primary>
37660 </indexterm>
37661 <indexterm role="variable">
37662 <primary><varname>$original_domain</varname></primary>
37663 </indexterm>
37664 Normally a local delivery is handling a single address, and in that case the
37665 variables such as <varname>$domain</varname> and <varname>$local_part</varname> are set during local
37666 deliveries. However, in some circumstances more than one address may be handled
37667 at once (for example, while writing batch SMTP for onward transmission by some
37668 other means). In this case, the variables associated with the local part are
37669 never set, <varname>$domain</varname> is set only if all the addresses have the same domain,
37670 and <varname>$original_domain</varname> is never set.
37671 <indexterm role="concept" startref="IIDenvlotra1" class="endofrange"/>
37672 <indexterm role="concept" startref="IIDenvlotra2" class="endofrange"/>
37673 <indexterm role="concept" startref="IIDenvlotra3" class="endofrange"/>
37674 </para>
37675 </section>
37676 </chapter>
37677
37678 <chapter id="CHAPtransportgeneric">
37679 <title>Generic options for transports</title>
37680 <para>
37681 <indexterm role="concept" id="IIDgenoptra1" class="startofrange">
37682 <primary>generic options</primary>
37683 <secondary>transport</secondary>
37684 </indexterm>
37685 <indexterm role="concept" id="IIDgenoptra2" class="startofrange">
37686 <primary>options</primary>
37687 <secondary>generic; for transports</secondary>
37688 </indexterm>
37689 <indexterm role="concept" id="IIDgenoptra3" class="startofrange">
37690 <primary>transport</primary>
37691 <secondary>generic options for</secondary>
37692 </indexterm>
37693 The following generic options apply to all transports:
37694 </para>
37695 <para>
37696 <indexterm role="option">
37697 <primary><option>body_only</option></primary>
37698 </indexterm>
37699 </para>
37700 <informaltable frame="all">
37701 <tgroup cols="4" colsep="0" rowsep="0">
37702 <colspec colwidth="8*" align="left"/>
37703 <colspec colwidth="6*" align="center"/>
37704 <colspec colwidth="6*" align="center"/>
37705 <colspec colwidth="6*" align="right"/>
37706 <tbody>
37707 <row>
37708 <entry><option>body_only</option></entry>
37709 <entry>Use: <emphasis>transports</emphasis></entry>
37710 <entry>Type: <emphasis>boolean</emphasis></entry>
37711 <entry>Default: <emphasis>false</emphasis></entry>
37712 </row>
37713 </tbody>
37714 </tgroup>
37715 </informaltable>
37716 <para>
37717 <indexterm role="concept">
37718 <primary>transport</primary>
37719 <secondary>body only</secondary>
37720 </indexterm>
37721 <indexterm role="concept">
37722 <primary>message</primary>
37723 <secondary>transporting body only</secondary>
37724 </indexterm>
37725 <indexterm role="concept">
37726 <primary>body of message</primary>
37727 <secondary>transporting</secondary>
37728 </indexterm>
37729 If this option is set, the message&#x2019;s headers are not transported. It is
37730 mutually exclusive with <option>headers_only</option>. If it is used with the <command>appendfile</command>
37731 or <command>pipe</command> transports, the settings of <option>message_prefix</option> and
37732 <option>message_suffix</option> should be checked, because this option does not
37733 automatically suppress them.
37734 </para>
37735 <para>
37736 <indexterm role="option">
37737 <primary><option>current_directory</option></primary>
37738 </indexterm>
37739 </para>
37740 <informaltable frame="all">
37741 <tgroup cols="4" colsep="0" rowsep="0">
37742 <colspec colwidth="8*" align="left"/>
37743 <colspec colwidth="6*" align="center"/>
37744 <colspec colwidth="6*" align="center"/>
37745 <colspec colwidth="6*" align="right"/>
37746 <tbody>
37747 <row>
37748 <entry><option>current_directory</option></entry>
37749 <entry>Use: <emphasis>transports</emphasis></entry>
37750 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
37751 <entry>Default: <emphasis>unset</emphasis></entry>
37752 </row>
37753 </tbody>
37754 </tgroup>
37755 </informaltable>
37756 <para>
37757 <indexterm role="concept">
37758 <primary>transport</primary>
37759 <secondary>current directory for</secondary>
37760 </indexterm>
37761 This specifies the current directory that is to be set while running the
37762 transport, overriding any value that may have been set by the router.
37763 If the expansion fails for any reason, including forced failure, an error is
37764 logged, and delivery is deferred.
37765 </para>
37766 <para>
37767 <indexterm role="option">
37768 <primary><option>disable_logging</option></primary>
37769 </indexterm>
37770 </para>
37771 <informaltable frame="all">
37772 <tgroup cols="4" colsep="0" rowsep="0">
37773 <colspec colwidth="8*" align="left"/>
37774 <colspec colwidth="6*" align="center"/>
37775 <colspec colwidth="6*" align="center"/>
37776 <colspec colwidth="6*" align="right"/>
37777 <tbody>
37778 <row>
37779 <entry><option>disable_logging</option></entry>
37780 <entry>Use: <emphasis>transports</emphasis></entry>
37781 <entry>Type: <emphasis>boolean</emphasis></entry>
37782 <entry>Default: <emphasis>false</emphasis></entry>
37783 </row>
37784 </tbody>
37785 </tgroup>
37786 </informaltable>
37787 <para>
37788 If this option is set true, nothing is logged for any
37789 deliveries by the transport or for any
37790 transport errors. You should not set this option unless you really, really know
37791 what you are doing.
37792 </para>
37793 <para>
37794 <indexterm role="option">
37795 <primary><option>debug_print</option></primary>
37796 </indexterm>
37797 </para>
37798 <informaltable frame="all">
37799 <tgroup cols="4" colsep="0" rowsep="0">
37800 <colspec colwidth="8*" align="left"/>
37801 <colspec colwidth="6*" align="center"/>
37802 <colspec colwidth="6*" align="center"/>
37803 <colspec colwidth="6*" align="right"/>
37804 <tbody>
37805 <row>
37806 <entry><option>debug_print</option></entry>
37807 <entry>Use: <emphasis>transports</emphasis></entry>
37808 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
37809 <entry>Default: <emphasis>unset</emphasis></entry>
37810 </row>
37811 </tbody>
37812 </tgroup>
37813 </informaltable>
37814 <para>
37815 <indexterm role="concept">
37816 <primary>testing</primary>
37817 <secondary>variables in drivers</secondary>
37818 </indexterm>
37819 If this option is set and debugging is enabled (see the <option>-d</option> command line
37820 option), the string is expanded and included in the debugging output when the
37821 transport is run.
37822 If expansion of the string fails, the error message is written to the debugging
37823 output, and Exim carries on processing.
37824 This facility is provided to help with checking out the values of variables and
37825 so on when debugging driver configurations. For example, if a <option>headers_add</option>
37826 option is not working properly, <option>debug_print</option> could be used to output the
37827 variables it references. A newline is added to the text if it does not end with
37828 one.
37829 The variables <varname>$transport_name</varname> and <varname>$router_name</varname> contain the name of the
37830 transport and the router that called it.
37831 </para>
37832 <para>
37833 <indexterm role="option">
37834 <primary><option>delivery_date_add</option></primary>
37835 </indexterm>
37836 </para>
37837 <informaltable frame="all">
37838 <tgroup cols="4" colsep="0" rowsep="0">
37839 <colspec colwidth="8*" align="left"/>
37840 <colspec colwidth="6*" align="center"/>
37841 <colspec colwidth="6*" align="center"/>
37842 <colspec colwidth="6*" align="right"/>
37843 <tbody>
37844 <row>
37845 <entry><option>delivery_date_add</option></entry>
37846 <entry>Use: <emphasis>transports</emphasis></entry>
37847 <entry>Type: <emphasis>boolean</emphasis></entry>
37848 <entry>Default: <emphasis>false</emphasis></entry>
37849 </row>
37850 </tbody>
37851 </tgroup>
37852 </informaltable>
37853 <para>
37854 <indexterm role="concept">
37855 <primary><emphasis>Delivery-date:</emphasis> header line</primary>
37856 </indexterm>
37857 If this option is true, a <emphasis>Delivery-date:</emphasis> header is added to the message.
37858 This gives the actual time the delivery was made. As this is not a standard
37859 header, Exim has a configuration option (<option>delivery_date_remove</option>) which
37860 requests its removal from incoming messages, so that delivered messages can
37861 safely be resent to other recipients.
37862 </para>
37863 <para>
37864 <indexterm role="option">
37865 <primary><option>driver</option></primary>
37866 </indexterm>
37867 </para>
37868 <informaltable frame="all">
37869 <tgroup cols="4" colsep="0" rowsep="0">
37870 <colspec colwidth="8*" align="left"/>
37871 <colspec colwidth="6*" align="center"/>
37872 <colspec colwidth="6*" align="center"/>
37873 <colspec colwidth="6*" align="right"/>
37874 <tbody>
37875 <row>
37876 <entry><option>driver</option></entry>
37877 <entry>Use: <emphasis>transports</emphasis></entry>
37878 <entry>Type: <emphasis>string</emphasis></entry>
37879 <entry>Default: <emphasis>unset</emphasis></entry>
37880 </row>
37881 </tbody>
37882 </tgroup>
37883 </informaltable>
37884 <para>
37885 This specifies which of the available transport drivers is to be used.
37886 There is no default, and this option must be set for every transport.
37887 </para>
37888 <para>
37889 <indexterm role="option">
37890 <primary><option>envelope_to_add</option></primary>
37891 </indexterm>
37892 </para>
37893 <informaltable frame="all">
37894 <tgroup cols="4" colsep="0" rowsep="0">
37895 <colspec colwidth="8*" align="left"/>
37896 <colspec colwidth="6*" align="center"/>
37897 <colspec colwidth="6*" align="center"/>
37898 <colspec colwidth="6*" align="right"/>
37899 <tbody>
37900 <row>
37901 <entry><option>envelope_to_add</option></entry>
37902 <entry>Use: <emphasis>transports</emphasis></entry>
37903 <entry>Type: <emphasis>boolean</emphasis></entry>
37904 <entry>Default: <emphasis>false</emphasis></entry>
37905 </row>
37906 </tbody>
37907 </tgroup>
37908 </informaltable>
37909 <para>
37910 <indexterm role="concept">
37911 <primary><emphasis>Envelope-to:</emphasis> header line</primary>
37912 </indexterm>
37913 If this option is true, an <emphasis>Envelope-to:</emphasis> header is added to the message.
37914 This gives the original address(es) in the incoming envelope that caused this
37915 delivery to happen. More than one address may be present if the transport is
37916 configured to handle several addresses at once, or if more than one original
37917 address was redirected to the same final address. As this is not a standard
37918 header, Exim has a configuration option (<option>envelope_to_remove</option>) which requests
37919 its removal from incoming messages, so that delivered messages can safely be
37920 resent to other recipients.
37921 </para>
37922 <para>
37923 <indexterm role="option">
37924 <primary><option>group</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>group</option></entry>
37936 <entry>Use: <emphasis>transports</emphasis></entry>
37937 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
37938 <entry>Default: <emphasis>Exim group</emphasis></entry>
37939 </row>
37940 </tbody>
37941 </tgroup>
37942 </informaltable>
37943 <para>
37944 <indexterm role="concept">
37945 <primary>transport</primary>
37946 <secondary>group; specifying</secondary>
37947 </indexterm>
37948 This option specifies a gid for running the transport process, overriding any
37949 value that the router supplies, and also overriding any value associated with
37950 <option>user</option> (see below).
37951 </para>
37952 <para>
37953 <indexterm role="option">
37954 <primary><option>headers_add</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>headers_add</option></entry>
37966 <entry>Use: <emphasis>transports</emphasis></entry>
37967 <entry>Type: <emphasis>list</emphasis>&dagger;<emphasis></emphasis></entry>
37968 <entry>Default: <emphasis>unset</emphasis></entry>
37969 </row>
37970 </tbody>
37971 </tgroup>
37972 </informaltable>
37973 <para>
37974 <indexterm role="concept">
37975 <primary>header lines</primary>
37976 <secondary>adding in transport</secondary>
37977 </indexterm>
37978 <indexterm role="concept">
37979 <primary>transport</primary>
37980 <secondary>header lines; adding</secondary>
37981 </indexterm>
37982 This option specifies a list of text headers, newline-separated,
37983 which are (separately) expanded and added to the header
37984 portion of a message as it is transported, as described in section
37985 <xref linkend="SECTheadersaddrem"/>. Additional header lines can also be specified by
37986 routers. If the result of the expansion is an empty string, or if the expansion
37987 is forced to fail, no action is taken. Other expansion failures are treated as
37988 errors and cause the delivery to be deferred.
37989 </para>
37990 <para>
37991 Unlike most options, <option>headers_add</option> can be specified multiple times
37992 for a transport; all listed headers are added.
37993 </para>
37994 <para>
37995 <indexterm role="option">
37996 <primary><option>headers_only</option></primary>
37997 </indexterm>
37998 </para>
37999 <informaltable frame="all">
38000 <tgroup cols="4" colsep="0" rowsep="0">
38001 <colspec colwidth="8*" align="left"/>
38002 <colspec colwidth="6*" align="center"/>
38003 <colspec colwidth="6*" align="center"/>
38004 <colspec colwidth="6*" align="right"/>
38005 <tbody>
38006 <row>
38007 <entry><option>headers_only</option></entry>
38008 <entry>Use: <emphasis>transports</emphasis></entry>
38009 <entry>Type: <emphasis>boolean</emphasis></entry>
38010 <entry>Default: <emphasis>false</emphasis></entry>
38011 </row>
38012 </tbody>
38013 </tgroup>
38014 </informaltable>
38015 <para>
38016 <indexterm role="concept">
38017 <primary>transport</primary>
38018 <secondary>header lines only</secondary>
38019 </indexterm>
38020 <indexterm role="concept">
38021 <primary>message</primary>
38022 <secondary>transporting headers only</secondary>
38023 </indexterm>
38024 <indexterm role="concept">
38025 <primary>header lines</primary>
38026 <secondary>transporting</secondary>
38027 </indexterm>
38028 If this option is set, the message&#x2019;s body is not transported. It is mutually
38029 exclusive with <option>body_only</option>. If it is used with the <command>appendfile</command> or <command>pipe</command>
38030 transports, the settings of <option>message_prefix</option> and <option>message_suffix</option> should be
38031 checked, since this option does not automatically suppress them.
38032 </para>
38033 <para>
38034 <indexterm role="option">
38035 <primary><option>headers_remove</option></primary>
38036 </indexterm>
38037 </para>
38038 <informaltable frame="all">
38039 <tgroup cols="4" colsep="0" rowsep="0">
38040 <colspec colwidth="8*" align="left"/>
38041 <colspec colwidth="6*" align="center"/>
38042 <colspec colwidth="6*" align="center"/>
38043 <colspec colwidth="6*" align="right"/>
38044 <tbody>
38045 <row>
38046 <entry><option>headers_remove</option></entry>
38047 <entry>Use: <emphasis>transports</emphasis></entry>
38048 <entry>Type: <emphasis>list</emphasis>&dagger;<emphasis></emphasis></entry>
38049 <entry>Default: <emphasis>unset</emphasis></entry>
38050 </row>
38051 </tbody>
38052 </tgroup>
38053 </informaltable>
38054 <para>
38055 <indexterm role="concept">
38056 <primary>header lines</primary>
38057 <secondary>removing</secondary>
38058 </indexterm>
38059 <indexterm role="concept">
38060 <primary>transport</primary>
38061 <secondary>header lines; removing</secondary>
38062 </indexterm>
38063 This option specifies a list of header names, colon-separated;
38064 these headers are omitted from the message as it is transported, as described
38065 in section <xref linkend="SECTheadersaddrem"/>. Header removal can also be specified by
38066 routers.
38067 Each list item is separately expanded.
38068 If the result of the expansion is an empty string, or if the expansion
38069 is forced to fail, no action is taken. Other expansion failures are treated as
38070 errors and cause the delivery to be deferred.
38071 </para>
38072 <para>
38073 Unlike most options, <option>headers_remove</option> can be specified multiple times
38074 for a router; all listed headers are removed.
38075 </para>
38076 <para>
38077 <indexterm role="option">
38078 <primary><option>headers_rewrite</option></primary>
38079 </indexterm>
38080 </para>
38081 <informaltable frame="all">
38082 <tgroup cols="4" colsep="0" rowsep="0">
38083 <colspec colwidth="8*" align="left"/>
38084 <colspec colwidth="6*" align="center"/>
38085 <colspec colwidth="6*" align="center"/>
38086 <colspec colwidth="6*" align="right"/>
38087 <tbody>
38088 <row>
38089 <entry><option>headers_rewrite</option></entry>
38090 <entry>Use: <emphasis>transports</emphasis></entry>
38091 <entry>Type: <emphasis>string</emphasis></entry>
38092 <entry>Default: <emphasis>unset</emphasis></entry>
38093 </row>
38094 </tbody>
38095 </tgroup>
38096 </informaltable>
38097 <para>
38098 <indexterm role="concept">
38099 <primary>transport</primary>
38100 <secondary>header lines; rewriting</secondary>
38101 </indexterm>
38102 <indexterm role="concept">
38103 <primary>rewriting</primary>
38104 <secondary>at transport time</secondary>
38105 </indexterm>
38106 This option allows addresses in header lines to be rewritten at transport time,
38107 that is, as the message is being copied to its destination. The contents of the
38108 option are a colon-separated list of rewriting rules. Each rule is in exactly
38109 the same form as one of the general rewriting rules that are applied when a
38110 message is received. These are described in chapter <xref linkend="CHAPrewrite"/>. For
38111 example,
38112 </para>
38113 <literallayout class="monospaced">
38114 headers_rewrite = a@b c@d f : \
38115                   x@y w@z
38116 </literallayout>
38117 <para>
38118 changes <emphasis>a@b</emphasis> into <emphasis>c@d</emphasis> in <emphasis>From:</emphasis> header lines, and <emphasis>x@y</emphasis> into
38119 <emphasis>w@z</emphasis> in all address-bearing header lines. The rules are applied to the
38120 header lines just before they are written out at transport time, so they affect
38121 only those copies of the message that pass through the transport. However, only
38122 the message&#x2019;s original header lines, and any that were added by a system
38123 filter, are rewritten. If a router or transport adds header lines, they are not
38124 affected by this option. These rewriting rules are <emphasis>not</emphasis> applied to the
38125 envelope. You can change the return path using <option>return_path</option>, but you cannot
38126 change envelope recipients at this time.
38127 </para>
38128 <para>
38129 <indexterm role="option">
38130 <primary><option>home_directory</option></primary>
38131 </indexterm>
38132 </para>
38133 <informaltable frame="all">
38134 <tgroup cols="4" colsep="0" rowsep="0">
38135 <colspec colwidth="8*" align="left"/>
38136 <colspec colwidth="6*" align="center"/>
38137 <colspec colwidth="6*" align="center"/>
38138 <colspec colwidth="6*" align="right"/>
38139 <tbody>
38140 <row>
38141 <entry><option>home_directory</option></entry>
38142 <entry>Use: <emphasis>transports</emphasis></entry>
38143 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
38144 <entry>Default: <emphasis>unset</emphasis></entry>
38145 </row>
38146 </tbody>
38147 </tgroup>
38148 </informaltable>
38149 <para>
38150 <indexterm role="concept">
38151 <primary>transport</primary>
38152 <secondary>home directory for</secondary>
38153 </indexterm>
38154 <indexterm role="variable">
38155 <primary><varname>$home</varname></primary>
38156 </indexterm>
38157 This option specifies a home directory setting for a local transport,
38158 overriding any value that may be set by the router. The home directory is
38159 placed in <varname>$home</varname> while expanding the transport&#x2019;s private options. It is also
38160 used as the current directory if no current directory is set by the
38161 <option>current_directory</option> option on the transport or the
38162 <option>transport_current_directory</option> option on the router. If the expansion fails
38163 for any reason, including forced failure, an error is logged, and delivery is
38164 deferred.
38165 </para>
38166 <para>
38167 <indexterm role="option">
38168 <primary><option>initgroups</option></primary>
38169 </indexterm>
38170 </para>
38171 <informaltable frame="all">
38172 <tgroup cols="4" colsep="0" rowsep="0">
38173 <colspec colwidth="8*" align="left"/>
38174 <colspec colwidth="6*" align="center"/>
38175 <colspec colwidth="6*" align="center"/>
38176 <colspec colwidth="6*" align="right"/>
38177 <tbody>
38178 <row>
38179 <entry><option>initgroups</option></entry>
38180 <entry>Use: <emphasis>transports</emphasis></entry>
38181 <entry>Type: <emphasis>boolean</emphasis></entry>
38182 <entry>Default: <emphasis>false</emphasis></entry>
38183 </row>
38184 </tbody>
38185 </tgroup>
38186 </informaltable>
38187 <para>
38188 <indexterm role="concept">
38189 <primary>additional groups</primary>
38190 </indexterm>
38191 <indexterm role="concept">
38192 <primary>groups</primary>
38193 <secondary>additional</secondary>
38194 </indexterm>
38195 <indexterm role="concept">
38196 <primary>transport</primary>
38197 <secondary>group; additional</secondary>
38198 </indexterm>
38199 If this option is true and the uid for the delivery process is provided by the
38200 transport, the <function>initgroups()</function> function is called when running the transport
38201 to ensure that any additional groups associated with the uid are set up.
38202 </para>
38203 <para>
38204 <indexterm role="option">
38205 <primary><option>message_size_limit</option></primary>
38206 </indexterm>
38207 </para>
38208 <informaltable frame="all">
38209 <tgroup cols="4" colsep="0" rowsep="0">
38210 <colspec colwidth="8*" align="left"/>
38211 <colspec colwidth="6*" align="center"/>
38212 <colspec colwidth="6*" align="center"/>
38213 <colspec colwidth="6*" align="right"/>
38214 <tbody>
38215 <row>
38216 <entry><option>message_size_limit</option></entry>
38217 <entry>Use: <emphasis>transports</emphasis></entry>
38218 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
38219 <entry>Default: <emphasis>0</emphasis></entry>
38220 </row>
38221 </tbody>
38222 </tgroup>
38223 </informaltable>
38224 <para>
38225 <indexterm role="concept">
38226 <primary>limit</primary>
38227 <secondary>message size per transport</secondary>
38228 </indexterm>
38229 <indexterm role="concept">
38230 <primary>size</primary>
38231 <secondary>of message, limit</secondary>
38232 </indexterm>
38233 <indexterm role="concept">
38234 <primary>transport</primary>
38235 <secondary>message size; limiting</secondary>
38236 </indexterm>
38237 This option controls the size of messages passed through the transport. It is
38238 expanded before use; the result of the expansion must be a sequence of decimal
38239 digits, optionally followed by K or M. If the expansion fails for any reason,
38240 including forced failure, or if the result is not of the required form,
38241 delivery is deferred. If the value is greater than zero and the size of a
38242 message exceeds this limit, the address is failed. If there is any chance that
38243 the resulting bounce message could be routed to the same transport, you should
38244 ensure that <option>return_size_limit</option> is less than the transport&#x2019;s
38245 <option>message_size_limit</option>, as otherwise the bounce message will fail to get
38246 delivered.
38247 </para>
38248 <para>
38249 <indexterm role="option">
38250 <primary><option>rcpt_include_affixes</option></primary>
38251 </indexterm>
38252 </para>
38253 <informaltable frame="all">
38254 <tgroup cols="4" colsep="0" rowsep="0">
38255 <colspec colwidth="8*" align="left"/>
38256 <colspec colwidth="6*" align="center"/>
38257 <colspec colwidth="6*" align="center"/>
38258 <colspec colwidth="6*" align="right"/>
38259 <tbody>
38260 <row>
38261 <entry><option>rcpt_include_affixes</option></entry>
38262 <entry>Use: <emphasis>transports</emphasis></entry>
38263 <entry>Type: <emphasis>boolean</emphasis></entry>
38264 <entry>Default: <emphasis>false</emphasis></entry>
38265 </row>
38266 </tbody>
38267 </tgroup>
38268 </informaltable>
38269 <para>
38270 <indexterm role="concept">
38271 <primary>prefix</primary>
38272 <secondary>for local part, including in envelope</secondary>
38273 </indexterm>
38274 <indexterm role="concept">
38275 <primary>suffix for local part</primary>
38276 <secondary>including in envelope</secondary>
38277 </indexterm>
38278 <indexterm role="concept">
38279 <primary>local part</primary>
38280 <secondary>prefix</secondary>
38281 </indexterm>
38282 <indexterm role="concept">
38283 <primary>local part</primary>
38284 <secondary>suffix</secondary>
38285 </indexterm>
38286 When this option is false (the default), and an address that has had any
38287 affixes (prefixes or suffixes) removed from the local part is delivered by any
38288 form of SMTP or LMTP, the affixes are not included. For example, if a router
38289 that contains
38290 </para>
38291 <literallayout class="monospaced">
38292 local_part_prefix = *-
38293 </literallayout>
38294 <para>
38295 routes the address <emphasis>abc-xyz@some.domain</emphasis> to an SMTP transport, the envelope
38296 is delivered with
38297 </para>
38298 <literallayout class="monospaced">
38299 RCPT TO:&lt;xyz@some.domain&gt;
38300 </literallayout>
38301 <para>
38302 This is also the case when an ACL-time callout is being used to verify a
38303 recipient address. However, if <option>rcpt_include_affixes</option> is set true, the
38304 whole local part is included in the RCPT command. This option applies to BSMTP
38305 deliveries by the <command>appendfile</command> and <command>pipe</command> transports as well as to the
38306 <command>lmtp</command> and <command>smtp</command> transports.
38307 </para>
38308 <para>
38309 <indexterm role="option">
38310 <primary><option>retry_use_local_part</option></primary>
38311 </indexterm>
38312 </para>
38313 <informaltable frame="all">
38314 <tgroup cols="4" colsep="0" rowsep="0">
38315 <colspec colwidth="8*" align="left"/>
38316 <colspec colwidth="6*" align="center"/>
38317 <colspec colwidth="6*" align="center"/>
38318 <colspec colwidth="6*" align="right"/>
38319 <tbody>
38320 <row>
38321 <entry><option>retry_use_local_part</option></entry>
38322 <entry>Use: <emphasis>transports</emphasis></entry>
38323 <entry>Type: <emphasis>boolean</emphasis></entry>
38324 <entry>Default: <emphasis>see below</emphasis></entry>
38325 </row>
38326 </tbody>
38327 </tgroup>
38328 </informaltable>
38329 <para>
38330 <indexterm role="concept">
38331 <primary>hints database</primary>
38332 <secondary>retry keys</secondary>
38333 </indexterm>
38334 When a delivery suffers a temporary failure, a retry record is created
38335 in Exim&#x2019;s hints database. For remote deliveries, the key for the retry record
38336 is based on the name and/or IP address of the failing remote host. For local
38337 deliveries, the key is normally the entire address, including both the local
38338 part and the domain. This is suitable for most common cases of local delivery
38339 temporary failure &ndash; for example, exceeding a mailbox quota should delay only
38340 deliveries to that mailbox, not to the whole domain.
38341 </para>
38342 <para>
38343 However, in some special cases you may want to treat a temporary local delivery
38344 as a failure associated with the domain, and not with a particular local part.
38345 (For example, if you are storing all mail for some domain in files.) You can do
38346 this by setting <option>retry_use_local_part</option> false.
38347 </para>
38348 <para>
38349 For all the local transports, its default value is true. For remote transports,
38350 the default value is false for tidiness, but changing the value has no effect
38351 on a remote transport in the current implementation.
38352 </para>
38353 <para>
38354 <indexterm role="option">
38355 <primary><option>return_path</option></primary>
38356 </indexterm>
38357 </para>
38358 <informaltable frame="all">
38359 <tgroup cols="4" colsep="0" rowsep="0">
38360 <colspec colwidth="8*" align="left"/>
38361 <colspec colwidth="6*" align="center"/>
38362 <colspec colwidth="6*" align="center"/>
38363 <colspec colwidth="6*" align="right"/>
38364 <tbody>
38365 <row>
38366 <entry><option>return_path</option></entry>
38367 <entry>Use: <emphasis>transports</emphasis></entry>
38368 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
38369 <entry>Default: <emphasis>unset</emphasis></entry>
38370 </row>
38371 </tbody>
38372 </tgroup>
38373 </informaltable>
38374 <para>
38375 <indexterm role="concept">
38376 <primary>envelope sender</primary>
38377 </indexterm>
38378 <indexterm role="concept">
38379 <primary>transport</primary>
38380 <secondary>return path; changing</secondary>
38381 </indexterm>
38382 <indexterm role="concept">
38383 <primary>return path</primary>
38384 <secondary>changing in transport</secondary>
38385 </indexterm>
38386 If this option is set, the string is expanded at transport time and replaces
38387 the existing return path (envelope sender) value in the copy of the message
38388 that is being delivered. An empty return path is permitted. This feature is
38389 designed for remote deliveries, where the value of this option is used in the
38390 SMTP MAIL command. If you set <option>return_path</option> for a local transport, the
38391 only effect is to change the address that is placed in the <emphasis>Return-path:</emphasis>
38392 header line, if one is added to the message (see the next option).
38393 </para>
38394 <para>
38395 <emphasis role="bold">Note:</emphasis> A changed return path is not logged unless you add
38396 <option>return_path_on_delivery</option> to the log selector.
38397 </para>
38398 <para>
38399 <indexterm role="variable">
38400 <primary><varname>$return_path</varname></primary>
38401 </indexterm>
38402 The expansion can refer to the existing value via <varname>$return_path</varname>. This is
38403 either the message&#x2019;s envelope sender, or an address set by the
38404 <option>errors_to</option> option on a router. If the expansion is forced to fail, no
38405 replacement occurs; if it fails for another reason, delivery is deferred. This
38406 option can be used to support VERP (Variable Envelope Return Paths) &ndash; see
38407 section <xref linkend="SECTverp"/>.
38408 </para>
38409 <para>
38410 <emphasis role="bold">Note</emphasis>: If a delivery error is detected locally, including the case when a
38411 remote server rejects a message at SMTP time, the bounce message is not sent to
38412 the value of this option. It is sent to the previously set errors address.
38413 This defaults to the incoming sender address, but can be changed by setting
38414 <option>errors_to</option> in a router.
38415 </para>
38416 <para>
38417 <indexterm role="option">
38418 <primary><option>return_path_add</option></primary>
38419 </indexterm>
38420 </para>
38421 <informaltable frame="all">
38422 <tgroup cols="4" colsep="0" rowsep="0">
38423 <colspec colwidth="8*" align="left"/>
38424 <colspec colwidth="6*" align="center"/>
38425 <colspec colwidth="6*" align="center"/>
38426 <colspec colwidth="6*" align="right"/>
38427 <tbody>
38428 <row>
38429 <entry><option>return_path_add</option></entry>
38430 <entry>Use: <emphasis>transports</emphasis></entry>
38431 <entry>Type: <emphasis>boolean</emphasis></entry>
38432 <entry>Default: <emphasis>false</emphasis></entry>
38433 </row>
38434 </tbody>
38435 </tgroup>
38436 </informaltable>
38437 <para>
38438 <indexterm role="concept">
38439 <primary><emphasis>Return-path:</emphasis> header line</primary>
38440 </indexterm>
38441 If this option is true, a <emphasis>Return-path:</emphasis> header is added to the message.
38442 Although the return path is normally available in the prefix line of BSD
38443 mailboxes, this is commonly not displayed by MUAs, and so the user does not
38444 have easy access to it.
38445 </para>
38446 <para>
38447 RFC 2821 states that the <emphasis>Return-path:</emphasis> header is added to a message <quote>when
38448 the delivery SMTP server makes the final delivery</quote>. This implies that this
38449 header should not be present in incoming messages. Exim has a configuration
38450 option, <option>return_path_remove</option>, which requests removal of this header from
38451 incoming messages, so that delivered messages can safely be resent to other
38452 recipients.
38453 </para>
38454 <para>
38455 <indexterm role="option">
38456 <primary><option>shadow_condition</option></primary>
38457 </indexterm>
38458 </para>
38459 <informaltable frame="all">
38460 <tgroup cols="4" colsep="0" rowsep="0">
38461 <colspec colwidth="8*" align="left"/>
38462 <colspec colwidth="6*" align="center"/>
38463 <colspec colwidth="6*" align="center"/>
38464 <colspec colwidth="6*" align="right"/>
38465 <tbody>
38466 <row>
38467 <entry><option>shadow_condition</option></entry>
38468 <entry>Use: <emphasis>transports</emphasis></entry>
38469 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
38470 <entry>Default: <emphasis>unset</emphasis></entry>
38471 </row>
38472 </tbody>
38473 </tgroup>
38474 </informaltable>
38475 <para>
38476 See <option>shadow_transport</option> below.
38477 </para>
38478 <para>
38479 <indexterm role="option">
38480 <primary><option>shadow_transport</option></primary>
38481 </indexterm>
38482 </para>
38483 <informaltable frame="all">
38484 <tgroup cols="4" colsep="0" rowsep="0">
38485 <colspec colwidth="8*" align="left"/>
38486 <colspec colwidth="6*" align="center"/>
38487 <colspec colwidth="6*" align="center"/>
38488 <colspec colwidth="6*" align="right"/>
38489 <tbody>
38490 <row>
38491 <entry><option>shadow_transport</option></entry>
38492 <entry>Use: <emphasis>transports</emphasis></entry>
38493 <entry>Type: <emphasis>string</emphasis></entry>
38494 <entry>Default: <emphasis>unset</emphasis></entry>
38495 </row>
38496 </tbody>
38497 </tgroup>
38498 </informaltable>
38499 <para>
38500 <indexterm role="concept">
38501 <primary>shadow transport</primary>
38502 </indexterm>
38503 <indexterm role="concept">
38504 <primary>transport</primary>
38505 <secondary>shadow</secondary>
38506 </indexterm>
38507 A local transport may set the <option>shadow_transport</option> option to the name of
38508 another local transport. Shadow remote transports are not supported.
38509 </para>
38510 <para>
38511 Whenever a delivery to the main transport succeeds, and either
38512 <option>shadow_condition</option> is unset, or its expansion does not result in the empty
38513 string or one of the strings <quote>0</quote> or <quote>no</quote> or <quote>false</quote>, the message is also
38514 passed to the shadow transport, with the same delivery address or addresses. If
38515 expansion fails, no action is taken except that non-forced expansion failures
38516 cause a log line to be written.
38517 </para>
38518 <para>
38519 The result of the shadow transport is discarded and does not affect the
38520 subsequent processing of the message. Only a single level of shadowing is
38521 provided; the <option>shadow_transport</option> option is ignored on any transport when it
38522 is running as a shadow. Options concerned with output from pipes are also
38523 ignored. The log line for the successful delivery has an item added on the end,
38524 of the form
38525 </para>
38526 <literallayout class="monospaced">
38527 ST=&lt;shadow transport name&gt;
38528 </literallayout>
38529 <para>
38530 If the shadow transport did not succeed, the error message is put in
38531 parentheses afterwards. Shadow transports can be used for a number of different
38532 purposes, including keeping more detailed log information than Exim normally
38533 provides, and implementing automatic acknowledgment policies based on message
38534 headers that some sites insist on.
38535 </para>
38536 <para>
38537 <indexterm role="option">
38538 <primary><option>transport_filter</option></primary>
38539 </indexterm>
38540 </para>
38541 <informaltable frame="all">
38542 <tgroup cols="4" colsep="0" rowsep="0">
38543 <colspec colwidth="8*" align="left"/>
38544 <colspec colwidth="6*" align="center"/>
38545 <colspec colwidth="6*" align="center"/>
38546 <colspec colwidth="6*" align="right"/>
38547 <tbody>
38548 <row>
38549 <entry><option>transport_filter</option></entry>
38550 <entry>Use: <emphasis>transports</emphasis></entry>
38551 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
38552 <entry>Default: <emphasis>unset</emphasis></entry>
38553 </row>
38554 </tbody>
38555 </tgroup>
38556 </informaltable>
38557 <para>
38558 <indexterm role="concept">
38559 <primary>transport</primary>
38560 <secondary>filter</secondary>
38561 </indexterm>
38562 <indexterm role="concept">
38563 <primary>filter</primary>
38564 <secondary>transport filter</secondary>
38565 </indexterm>
38566 This option sets up a filtering (in the Unix shell sense) process for messages
38567 at transport time. It should not be confused with mail filtering as set up by
38568 individual users or via a system filter.
38569 </para>
38570 <para>
38571 When the message is about to be written out, the command specified by
38572 <option>transport_filter</option> is started up in a separate, parallel process, and
38573 the entire message, including the header lines, is passed to it on its standard
38574 input (this in fact is done from a third process, to avoid deadlock). The
38575 command must be specified as an absolute path.
38576 </para>
38577 <para>
38578 The lines of the message that are written to the transport filter are
38579 terminated by newline (<quote>\n</quote>). The message is passed to the filter before any
38580 SMTP-specific processing, such as turning <quote>\n</quote> into <quote>\r\n</quote> and escaping
38581 lines beginning with a dot, and also before any processing implied by the
38582 settings of <option>check_string</option> and <option>escape_string</option> in the <command>appendfile</command> or
38583 <command>pipe</command> transports.
38584 </para>
38585 <para>
38586 The standard error for the filter process is set to the same destination as its
38587 standard output; this is read and written to the message&#x2019;s ultimate
38588 destination. The process that writes the message to the filter, the
38589 filter itself, and the original process that reads the result and delivers it
38590 are all run in parallel, like a shell pipeline.
38591 </para>
38592 <para>
38593 The filter can perform any transformations it likes, but of course should take
38594 care not to break RFC 2822 syntax. Exim does not check the result, except to
38595 test for a final newline when SMTP is in use. All messages transmitted over
38596 SMTP must end with a newline, so Exim supplies one if it is missing.
38597 </para>
38598 <para>
38599 <indexterm role="concept">
38600 <primary>content scanning</primary>
38601 <secondary>per user</secondary>
38602 </indexterm>
38603 A transport filter can be used to provide content-scanning on a per-user basis
38604 at delivery time if the only required effect of the scan is to modify the
38605 message. For example, a content scan could insert a new header line containing
38606 a spam score. This could be interpreted by a filter in the user&#x2019;s MUA. It is
38607 not possible to discard a message at this stage.
38608 </para>
38609 <para>
38610 <indexterm role="concept">
38611 <primary>SMTP</primary>
38612 <secondary>SIZE</secondary>
38613 </indexterm>
38614 A problem might arise if the filter increases the size of a message that is
38615 being sent down an SMTP connection. If the receiving SMTP server has indicated
38616 support for the SIZE parameter, Exim will have sent the size of the message
38617 at the start of the SMTP session. If what is actually sent is substantially
38618 more, the server might reject the message. This can be worked round by setting
38619 the <option>size_addition</option> option on the <command>smtp</command> transport, either to allow for
38620 additions to the message, or to disable the use of SIZE altogether.
38621 </para>
38622 <para>
38623 <indexterm role="variable">
38624 <primary><varname>$pipe_addresses</varname></primary>
38625 </indexterm>
38626 The value of the <option>transport_filter</option> option is the command string for starting
38627 the filter, which is run directly from Exim, not under a shell. The string is
38628 parsed by Exim in the same way as a command string for the <command>pipe</command> transport:
38629 Exim breaks it up into arguments and then expands each argument separately (see
38630 section <xref linkend="SECThowcommandrun"/>). Any kind of expansion failure causes delivery
38631 to be deferred. The special argument <varname>$pipe_addresses</varname> is replaced by a number
38632 of arguments, one for each address that applies to this delivery. (This isn&#x2019;t
38633 an ideal name for this feature here, but as it was already implemented for the
38634 <command>pipe</command> transport, it seemed sensible not to change it.)
38635 </para>
38636 <para>
38637 <indexterm role="variable">
38638 <primary><varname>$host</varname></primary>
38639 </indexterm>
38640 <indexterm role="variable">
38641 <primary><varname>$host_address</varname></primary>
38642 </indexterm>
38643 The expansion variables <varname>$host</varname> and <varname>$host_address</varname> are available when the
38644 transport is a remote one. They contain the name and IP address of the host to
38645 which the message is being sent. For example:
38646 </para>
38647 <literallayout class="monospaced">
38648 transport_filter = /some/directory/transport-filter.pl \
38649   $host $host_address $sender_address $pipe_addresses
38650 </literallayout>
38651 <para>
38652 Two problems arise if you want to use more complicated expansion items to
38653 generate transport filter commands, both of which due to the fact that the
38654 command is split up <emphasis>before</emphasis> expansion.
38655 </para>
38656 <itemizedlist>
38657 <listitem>
38658 <para>
38659 If an expansion item contains white space, you must quote it, so that it is all
38660 part of the same command item. If the entire option setting is one such
38661 expansion item, you have to take care what kind of quoting you use. For
38662 example:
38663 </para>
38664 <literallayout class="monospaced">
38665 transport_filter = '/bin/cmd${if eq{$host}{a.b.c}{1}{2}}'
38666 </literallayout>
38667 <para>
38668 This runs the command <command>/bin/cmd1</command> if the host name is <emphasis>a.b.c</emphasis>, and
38669 <command>/bin/cmd2</command> otherwise. If double quotes had been used, they would have been
38670 stripped by Exim when it read the option&#x2019;s value. When the value is used, if
38671 the single quotes were missing, the line would be split into two items,
38672 <literal>/bin/cmd${if</literal> and <literal>eq{$host}{a.b.c}{1}{2}</literal>, and an error would occur when
38673 Exim tried to expand the first one.
38674 </para>
38675 </listitem>
38676 <listitem>
38677 <para>
38678 Except for the special case of <varname>$pipe_addresses</varname> that is mentioned above, an
38679 expansion cannot generate multiple arguments, or a command name followed by
38680 arguments. Consider this example:
38681 </para>
38682 <literallayout class="monospaced">
38683 transport_filter = ${lookup{$host}lsearch{/a/file}\
38684                     {$value}{/bin/cat}}
38685 </literallayout>
38686 <para>
38687 The result of the lookup is interpreted as the name of the command, even
38688 if it contains white space. The simplest way round this is to use a shell:
38689 </para>
38690 <literallayout class="monospaced">
38691 transport_filter = /bin/sh -c ${lookup{$host}lsearch{/a/file}\
38692                                {$value}{/bin/cat}}
38693 </literallayout>
38694 </listitem>
38695 </itemizedlist>
38696 <para>
38697 The filter process is run under the same uid and gid as the normal delivery.
38698 For remote deliveries this is the Exim uid/gid by default. The command should
38699 normally yield a zero return code. Transport filters are not supposed to fail.
38700 A non-zero code is taken to mean that the transport filter encountered some
38701 serious problem. Delivery of the message is deferred; the message remains on
38702 the queue and is tried again later. It is not possible to cause a message to be
38703 bounced from a transport filter.
38704 </para>
38705 <para>
38706 If a transport filter is set on an autoreply transport, the original message is
38707 passed through the filter as it is being copied into the newly generated
38708 message, which happens if the <option>return_message</option> option is set.
38709 </para>
38710 <para>
38711 <indexterm role="option">
38712 <primary><option>transport_filter_timeout</option></primary>
38713 </indexterm>
38714 </para>
38715 <informaltable frame="all">
38716 <tgroup cols="4" colsep="0" rowsep="0">
38717 <colspec colwidth="8*" align="left"/>
38718 <colspec colwidth="6*" align="center"/>
38719 <colspec colwidth="6*" align="center"/>
38720 <colspec colwidth="6*" align="right"/>
38721 <tbody>
38722 <row>
38723 <entry><option>transport_filter_timeout</option></entry>
38724 <entry>Use: <emphasis>transports</emphasis></entry>
38725 <entry>Type: <emphasis>time</emphasis></entry>
38726 <entry>Default: <emphasis>5m</emphasis></entry>
38727 </row>
38728 </tbody>
38729 </tgroup>
38730 </informaltable>
38731 <para>
38732 <indexterm role="concept">
38733 <primary>transport</primary>
38734 <secondary>filter, timeout</secondary>
38735 </indexterm>
38736 When Exim is reading the output of a transport filter, it applies a timeout
38737 that can be set by this option. Exceeding the timeout is normally treated as a
38738 temporary delivery failure. However, if a transport filter is used with a
38739 <command>pipe</command> transport, a timeout in the transport filter is treated in the same
38740 way as a timeout in the pipe command itself. By default, a timeout is a hard
38741 error, but if the <command>pipe</command> transport&#x2019;s <option>timeout_defer</option> option is set true, it
38742 becomes a temporary error.
38743 </para>
38744 <para>
38745 <indexterm role="option">
38746 <primary><option>user</option></primary>
38747 </indexterm>
38748 </para>
38749 <informaltable frame="all">
38750 <tgroup cols="4" colsep="0" rowsep="0">
38751 <colspec colwidth="8*" align="left"/>
38752 <colspec colwidth="6*" align="center"/>
38753 <colspec colwidth="6*" align="center"/>
38754 <colspec colwidth="6*" align="right"/>
38755 <tbody>
38756 <row>
38757 <entry><option>user</option></entry>
38758 <entry>Use: <emphasis>transports</emphasis></entry>
38759 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
38760 <entry>Default: <emphasis>Exim user</emphasis></entry>
38761 </row>
38762 </tbody>
38763 </tgroup>
38764 </informaltable>
38765 <para>
38766 <indexterm role="concept">
38767 <primary>uid (user id)</primary>
38768 <secondary>local delivery</secondary>
38769 </indexterm>
38770 <indexterm role="concept">
38771 <primary>transport</primary>
38772 <secondary>user, specifying</secondary>
38773 </indexterm>
38774 This option specifies the user under whose uid the delivery process is to be
38775 run, overriding any uid that may have been set by the router. If the user is
38776 given as a name, the uid is looked up from the password data, and the
38777 associated group is taken as the value of the gid to be used if the <option>group</option>
38778 option is not set.
38779 </para>
38780 <para>
38781 For deliveries that use local transports, a user and group are normally
38782 specified explicitly or implicitly (for example, as a result of
38783 <option>check_local_user</option>) by the router or transport.
38784 </para>
38785 <para>
38786 <indexterm role="concept">
38787 <primary>hints database</primary>
38788 <secondary>access by remote transport</secondary>
38789 </indexterm>
38790 For remote transports, you should leave this option unset unless you really are
38791 sure you know what you are doing. When a remote transport is running, it needs
38792 to be able to access Exim&#x2019;s hints databases, because each host may have its own
38793 retry data.
38794 <indexterm role="concept" startref="IIDgenoptra1" class="endofrange"/>
38795 <indexterm role="concept" startref="IIDgenoptra2" class="endofrange"/>
38796 <indexterm role="concept" startref="IIDgenoptra3" class="endofrange"/>
38797 </para>
38798 </chapter>
38799
38800 <chapter id="CHAPbatching">
38801 <title>Address batching in local transports</title>
38802 <titleabbrev>Address batching</titleabbrev>
38803 <para>
38804 <indexterm role="concept">
38805 <primary>transport</primary>
38806 <secondary>local; address batching in</secondary>
38807 </indexterm>
38808 The only remote transport (<command>smtp</command>) is normally configured to handle more than
38809 one address at a time, so that when several addresses are routed to the same
38810 remote host, just one copy of the message is sent. Local transports, however,
38811 normally handle one address at a time. That is, a separate instance of the
38812 transport is run for each address that is routed to the transport. A separate
38813 copy of the message is delivered each time.
38814 </para>
38815 <para>
38816 <indexterm role="concept">
38817 <primary>batched local delivery</primary>
38818 </indexterm>
38819 <indexterm role="option">
38820 <primary><option>batch_max</option></primary>
38821 </indexterm>
38822 <indexterm role="option">
38823 <primary><option>batch_id</option></primary>
38824 </indexterm>
38825 In special cases, it may be desirable to handle several addresses at once in a
38826 local transport, for example:
38827 </para>
38828 <itemizedlist>
38829 <listitem>
38830 <para>
38831 In an <command>appendfile</command> transport, when storing messages in files for later
38832 delivery by some other means, a single copy of the message with multiple
38833 recipients saves space.
38834 </para>
38835 </listitem>
38836 <listitem>
38837 <para>
38838 In an <command>lmtp</command> transport, when delivering over <quote>local SMTP</quote> to some process,
38839 a single copy saves time, and is the normal way LMTP is expected to work.
38840 </para>
38841 </listitem>
38842 <listitem>
38843 <para>
38844 In a <command>pipe</command> transport, when passing the message
38845 to a scanner program or
38846 to some other delivery mechanism such as UUCP, multiple recipients may be
38847 acceptable.
38848 </para>
38849 </listitem>
38850 </itemizedlist>
38851 <para>
38852 These three local transports all have the same options for controlling multiple
38853 (<quote>batched</quote>) deliveries, namely <option>batch_max</option> and <option>batch_id</option>. To save
38854 repeating the information for each transport, these options are described here.
38855 </para>
38856 <para>
38857 The <option>batch_max</option> option specifies the maximum number of addresses that can be
38858 delivered together in a single run of the transport. Its default value is one
38859 (no batching). When more than one address is routed to a transport that has a
38860 <option>batch_max</option> value greater than one, the addresses are delivered in a batch
38861 (that is, in a single run of the transport with multiple recipients), subject
38862 to certain conditions:
38863 </para>
38864 <itemizedlist>
38865 <listitem>
38866 <para>
38867 <indexterm role="variable">
38868 <primary><varname>$local_part</varname></primary>
38869 </indexterm>
38870 If any of the transport&#x2019;s options contain a reference to <varname>$local_part</varname>, no
38871 batching is possible.
38872 </para>
38873 </listitem>
38874 <listitem>
38875 <para>
38876 <indexterm role="variable">
38877 <primary><varname>$domain</varname></primary>
38878 </indexterm>
38879 If any of the transport&#x2019;s options contain a reference to <varname>$domain</varname>, only
38880 addresses with the same domain are batched.
38881 </para>
38882 </listitem>
38883 <listitem>
38884 <para>
38885 <indexterm role="concept">
38886 <primary>customizing</primary>
38887 <secondary>batching condition</secondary>
38888 </indexterm>
38889 If <option>batch_id</option> is set, it is expanded for each address, and only those
38890 addresses with the same expanded value are batched. This allows you to specify
38891 customized batching conditions. Failure of the expansion for any reason,
38892 including forced failure, disables batching, but it does not stop the delivery
38893 from taking place.
38894 </para>
38895 </listitem>
38896 <listitem>
38897 <para>
38898 Batched addresses must also have the same errors address (where to send
38899 delivery errors), the same header additions and removals, the same user and
38900 group for the transport, and if a host list is present, the first host must
38901 be the same.
38902 </para>
38903 </listitem>
38904 </itemizedlist>
38905 <para>
38906 In the case of the <command>appendfile</command> and <command>pipe</command> transports, batching applies
38907 both when the file or pipe command is specified in the transport, and when it
38908 is specified by a <command>redirect</command> router, but all the batched addresses must of
38909 course be routed to the same file or pipe command. These two transports have an
38910 option called <option>use_bsmtp</option>, which causes them to deliver the message in
38911 <quote>batched SMTP</quote> format, with the envelope represented as SMTP commands. The
38912 <option>check_string</option> and <option>escape_string</option> options are forced to the values
38913 </para>
38914 <literallayout class="monospaced">
38915 check_string = "."
38916 escape_string = ".."
38917 </literallayout>
38918 <para>
38919 when batched SMTP is in use. A full description of the batch SMTP mechanism is
38920 given in section <xref linkend="SECTbatchSMTP"/>. The <command>lmtp</command> transport does not have a
38921 <option>use_bsmtp</option> option, because it always delivers using the SMTP protocol.
38922 </para>
38923 <para>
38924 <indexterm role="concept">
38925 <primary><emphasis>Envelope-to:</emphasis> header line</primary>
38926 </indexterm>
38927 If the generic <option>envelope_to_add</option> option is set for a batching transport, the
38928 <emphasis>Envelope-to:</emphasis> header that is added to the message contains all the addresses
38929 that are being processed together. If you are using a batching <command>appendfile</command>
38930 transport without <option>use_bsmtp</option>, the only way to preserve the recipient
38931 addresses is to set the <option>envelope_to_add</option> option.
38932 </para>
38933 <para>
38934 <indexterm role="concept">
38935 <primary><command>pipe</command> transport</primary>
38936 <secondary>with multiple addresses</secondary>
38937 </indexterm>
38938 <indexterm role="variable">
38939 <primary><varname>$pipe_addresses</varname></primary>
38940 </indexterm>
38941 If you are using a <command>pipe</command> transport without BSMTP, and setting the
38942 transport&#x2019;s <option>command</option> option, you can include <varname>$pipe_addresses</varname> as part of
38943 the command. This is not a true variable; it is a bit of magic that causes each
38944 of the recipient addresses to be inserted into the command as a separate
38945 argument. This provides a way of accessing all the addresses that are being
38946 delivered in the batch. <emphasis role="bold">Note:</emphasis> This is not possible for pipe commands that
38947 are specified by a <command>redirect</command> router.
38948 </para>
38949 </chapter>
38950
38951 <chapter id="CHAPappendfile">
38952 <title>The appendfile transport</title>
38953 <para>
38954 <indexterm role="concept" id="IIDapptra1" class="startofrange">
38955 <primary><command>appendfile</command> transport</primary>
38956 </indexterm>
38957 <indexterm role="concept" id="IIDapptra2" class="startofrange">
38958 <primary>transports</primary>
38959 <secondary><command>appendfile</command></secondary>
38960 </indexterm>
38961 <indexterm role="concept">
38962 <primary>directory creation</primary>
38963 </indexterm>
38964 <indexterm role="concept">
38965 <primary>creating directories</primary>
38966 </indexterm>
38967 The <command>appendfile</command> transport delivers a message by appending it to an existing
38968 file, or by creating an entirely new file in a specified directory. Single
38969 files to which messages are appended can be in the traditional Unix mailbox
38970 format, or optionally in the MBX format supported by the Pine MUA and
38971 University of Washington IMAP daemon, <emphasis>inter alia</emphasis>. When each message is
38972 being delivered as a separate file, <quote>maildir</quote> format can optionally be used
38973 to give added protection against failures that happen part-way through the
38974 delivery. A third form of separate-file delivery known as <quote>mailstore</quote> is also
38975 supported. For all file formats, Exim attempts to create as many levels of
38976 directory as necessary, provided that <option>create_directory</option> is set.
38977 </para>
38978 <para>
38979 The code for the optional formats is not included in the Exim binary by
38980 default. It is necessary to set SUPPORT_MBX, SUPPORT_MAILDIR and/or
38981 SUPPORT_MAILSTORE in <filename>Local/Makefile</filename> to have the appropriate code
38982 included.
38983 </para>
38984 <para>
38985 <indexterm role="concept">
38986 <primary>quota</primary>
38987 <secondary>system</secondary>
38988 </indexterm>
38989 Exim recognizes system quota errors, and generates an appropriate message. Exim
38990 also supports its own quota control within the transport, for use when the
38991 system facility is unavailable or cannot be used for some reason.
38992 </para>
38993 <para>
38994 If there is an error while appending to a file (for example, quota exceeded or
38995 partition filled), Exim attempts to reset the file&#x2019;s length and last
38996 modification time back to what they were before. If there is an error while
38997 creating an entirely new file, the new file is removed.
38998 </para>
38999 <para>
39000 Before appending to a file, a number of security checks are made, and the
39001 file is locked. A detailed description is given below, after the list of
39002 private options.
39003 </para>
39004 <para>
39005 The <command>appendfile</command> transport is most commonly used for local deliveries to
39006 users&#x2019; mailboxes. However, it can also be used as a pseudo-remote transport for
39007 putting messages into files for remote delivery by some means other than Exim.
39008 <quote>Batch SMTP</quote> format is often used in this case (see the <option>use_bsmtp</option>
39009 option).
39010 </para>
39011 <section id="SECTfildiropt">
39012 <title>The file and directory options</title>
39013 <para>
39014 The <option>file</option> option specifies a single file, to which the message is appended;
39015 the <option>directory</option> option specifies a directory, in which a new file containing
39016 the message is created. Only one of these two options can be set, and for
39017 normal deliveries to mailboxes, one of them <emphasis>must</emphasis> be set.
39018 </para>
39019 <para>
39020 <indexterm role="variable">
39021 <primary><varname>$address_file</varname></primary>
39022 </indexterm>
39023 <indexterm role="variable">
39024 <primary><varname>$local_part</varname></primary>
39025 </indexterm>
39026 However, <command>appendfile</command> is also used for delivering messages to files or
39027 directories whose names (or parts of names) are obtained from alias,
39028 forwarding, or filtering operations (for example, a <option>save</option> command in a
39029 user&#x2019;s Exim filter). When such a transport is running, <varname>$local_part</varname> contains
39030 the local part that was aliased or forwarded, and <varname>$address_file</varname> contains the
39031 name (or partial name) of the file or directory generated by the redirection
39032 operation. There are two cases:
39033 </para>
39034 <itemizedlist>
39035 <listitem>
39036 <para>
39037 If neither <option>file</option> nor <option>directory</option> is set, the redirection operation
39038 must specify an absolute path (one that begins with <literal>/</literal>). This is the most
39039 common case when users with local accounts use filtering to sort mail into
39040 different folders. See for example, the <command>address_file</command> transport in the
39041 default configuration. If the path ends with a slash, it is assumed to be the
39042 name of a directory. A delivery to a directory can also be forced by setting
39043 <option>maildir_format</option> or <option>mailstore_format</option>.
39044 </para>
39045 </listitem>
39046 <listitem>
39047 <para>
39048 If <option>file</option> or <option>directory</option> is set for a delivery from a redirection, it is
39049 used to determine the file or directory name for the delivery. Normally, the
39050 contents of <varname>$address_file</varname> are used in some way in the string expansion.
39051 </para>
39052 </listitem>
39053 </itemizedlist>
39054 <para>
39055 <indexterm role="concept">
39056 <primary>Sieve filter</primary>
39057 <secondary>configuring <command>appendfile</command></secondary>
39058 </indexterm>
39059 <indexterm role="concept">
39060 <primary>Sieve filter</primary>
39061 <secondary>relative mailbox path handling</secondary>
39062 </indexterm>
39063 As an example of the second case, consider an environment where users do not
39064 have home directories. They may be permitted to use Exim filter commands of the
39065 form:
39066 </para>
39067 <literallayout class="monospaced">
39068 save folder23
39069 </literallayout>
39070 <para>
39071 or Sieve filter commands of the form:
39072 </para>
39073 <literallayout class="monospaced">
39074 require "fileinto";
39075 fileinto "folder23";
39076 </literallayout>
39077 <para>
39078 In this situation, the expansion of <option>file</option> or <option>directory</option> in the transport
39079 must transform the relative path into an appropriate absolute file name. In the
39080 case of Sieve filters, the name <emphasis>inbox</emphasis> must be handled. It is the name that
39081 is used as a result of a <quote>keep</quote> action in the filter. This example shows one
39082 way of handling this requirement:
39083 </para>
39084 <literallayout class="monospaced">
39085 file = ${if eq{$address_file}{inbox} \
39086             {/var/mail/$local_part} \
39087             {${if eq{${substr_0_1:$address_file}}{/} \
39088                   {$address_file} \
39089                   {$home/mail/$address_file} \
39090             }} \
39091        }
39092 </literallayout>
39093 <para>
39094 With this setting of <option>file</option>, <emphasis>inbox</emphasis> refers to the standard mailbox
39095 location, absolute paths are used without change, and other folders are in the
39096 <filename>mail</filename> directory within the home directory.
39097 </para>
39098 <para>
39099 <emphasis role="bold">Note 1</emphasis>: While processing an Exim filter, a relative path such as
39100 <filename>folder23</filename> is turned into an absolute path if a home directory is known to
39101 the router. In particular, this is the case if <option>check_local_user</option> is set. If
39102 you want to prevent this happening at routing time, you can set
39103 <option>router_home_directory</option> empty. This forces the router to pass the relative
39104 path to the transport.
39105 </para>
39106 <para>
39107 <emphasis role="bold">Note 2</emphasis>: An absolute path in <varname>$address_file</varname> is not treated specially;
39108 the <option>file</option> or <option>directory</option> option is still used if it is set.
39109 </para>
39110 </section>
39111 <section id="SECID134">
39112 <title>Private options for appendfile</title>
39113 <para>
39114 <indexterm role="concept">
39115 <primary>options</primary>
39116 <secondary><command>appendfile</command> transport</secondary>
39117 </indexterm>
39118 </para>
39119 <para>
39120 <indexterm role="option">
39121 <primary><option>allow_fifo</option></primary>
39122 </indexterm>
39123 </para>
39124 <informaltable frame="all">
39125 <tgroup cols="4" colsep="0" rowsep="0">
39126 <colspec colwidth="8*" align="left"/>
39127 <colspec colwidth="6*" align="center"/>
39128 <colspec colwidth="6*" align="center"/>
39129 <colspec colwidth="6*" align="right"/>
39130 <tbody>
39131 <row>
39132 <entry><option>allow_fifo</option></entry>
39133 <entry>Use: <emphasis>appendfile</emphasis></entry>
39134 <entry>Type: <emphasis>boolean</emphasis></entry>
39135 <entry>Default: <emphasis>false</emphasis></entry>
39136 </row>
39137 </tbody>
39138 </tgroup>
39139 </informaltable>
39140 <para>
39141 <indexterm role="concept">
39142 <primary>fifo (named pipe)</primary>
39143 </indexterm>
39144 <indexterm role="concept">
39145 <primary>named pipe (fifo)</primary>
39146 </indexterm>
39147 <indexterm role="concept">
39148 <primary>pipe</primary>
39149 <secondary>named (fifo)</secondary>
39150 </indexterm>
39151 Setting this option permits delivery to named pipes (FIFOs) as well as to
39152 regular files. If no process is reading the named pipe at delivery time, the
39153 delivery is deferred.
39154 </para>
39155 <para>
39156 <indexterm role="option">
39157 <primary><option>allow_symlink</option></primary>
39158 </indexterm>
39159 </para>
39160 <informaltable frame="all">
39161 <tgroup cols="4" colsep="0" rowsep="0">
39162 <colspec colwidth="8*" align="left"/>
39163 <colspec colwidth="6*" align="center"/>
39164 <colspec colwidth="6*" align="center"/>
39165 <colspec colwidth="6*" align="right"/>
39166 <tbody>
39167 <row>
39168 <entry><option>allow_symlink</option></entry>
39169 <entry>Use: <emphasis>appendfile</emphasis></entry>
39170 <entry>Type: <emphasis>boolean</emphasis></entry>
39171 <entry>Default: <emphasis>false</emphasis></entry>
39172 </row>
39173 </tbody>
39174 </tgroup>
39175 </informaltable>
39176 <para>
39177 <indexterm role="concept">
39178 <primary>symbolic link</primary>
39179 <secondary>to mailbox</secondary>
39180 </indexterm>
39181 <indexterm role="concept">
39182 <primary>mailbox</primary>
39183 <secondary>symbolic link</secondary>
39184 </indexterm>
39185 By default, <command>appendfile</command> will not deliver if the path name for the file is
39186 that of a symbolic link. Setting this option relaxes that constraint, but there
39187 are security issues involved in the use of symbolic links. Be sure you know
39188 what you are doing if you set this. Details of exactly what this option affects
39189 are included in the discussion which follows this list of options.
39190 </para>
39191 <para>
39192 <indexterm role="option">
39193 <primary><option>batch_id</option></primary>
39194 </indexterm>
39195 </para>
39196 <informaltable frame="all">
39197 <tgroup cols="4" colsep="0" rowsep="0">
39198 <colspec colwidth="8*" align="left"/>
39199 <colspec colwidth="6*" align="center"/>
39200 <colspec colwidth="6*" align="center"/>
39201 <colspec colwidth="6*" align="right"/>
39202 <tbody>
39203 <row>
39204 <entry><option>batch_id</option></entry>
39205 <entry>Use: <emphasis>appendfile</emphasis></entry>
39206 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
39207 <entry>Default: <emphasis>unset</emphasis></entry>
39208 </row>
39209 </tbody>
39210 </tgroup>
39211 </informaltable>
39212 <para>
39213 See the description of local delivery batching in chapter <xref linkend="CHAPbatching"/>.
39214 However, batching is automatically disabled for <command>appendfile</command> deliveries that
39215 happen as a result of forwarding or aliasing or other redirection directly to a
39216 file.
39217 </para>
39218 <para>
39219 <indexterm role="option">
39220 <primary><option>batch_max</option></primary>
39221 </indexterm>
39222 </para>
39223 <informaltable frame="all">
39224 <tgroup cols="4" colsep="0" rowsep="0">
39225 <colspec colwidth="8*" align="left"/>
39226 <colspec colwidth="6*" align="center"/>
39227 <colspec colwidth="6*" align="center"/>
39228 <colspec colwidth="6*" align="right"/>
39229 <tbody>
39230 <row>
39231 <entry><option>batch_max</option></entry>
39232 <entry>Use: <emphasis>appendfile</emphasis></entry>
39233 <entry>Type: <emphasis>integer</emphasis></entry>
39234 <entry>Default: <emphasis>1</emphasis></entry>
39235 </row>
39236 </tbody>
39237 </tgroup>
39238 </informaltable>
39239 <para>
39240 See the description of local delivery batching in chapter <xref linkend="CHAPbatching"/>.
39241 </para>
39242 <para>
39243 <indexterm role="option">
39244 <primary><option>check_group</option></primary>
39245 </indexterm>
39246 </para>
39247 <informaltable frame="all">
39248 <tgroup cols="4" colsep="0" rowsep="0">
39249 <colspec colwidth="8*" align="left"/>
39250 <colspec colwidth="6*" align="center"/>
39251 <colspec colwidth="6*" align="center"/>
39252 <colspec colwidth="6*" align="right"/>
39253 <tbody>
39254 <row>
39255 <entry><option>check_group</option></entry>
39256 <entry>Use: <emphasis>appendfile</emphasis></entry>
39257 <entry>Type: <emphasis>boolean</emphasis></entry>
39258 <entry>Default: <emphasis>false</emphasis></entry>
39259 </row>
39260 </tbody>
39261 </tgroup>
39262 </informaltable>
39263 <para>
39264 When this option is set, the group owner of the file defined by the <option>file</option>
39265 option is checked to see that it is the same as the group under which the
39266 delivery process is running. The default setting is false because the default
39267 file mode is 0600, which means that the group is irrelevant.
39268 </para>
39269 <para>
39270 <indexterm role="option">
39271 <primary><option>check_owner</option></primary>
39272 </indexterm>
39273 </para>
39274 <informaltable frame="all">
39275 <tgroup cols="4" colsep="0" rowsep="0">
39276 <colspec colwidth="8*" align="left"/>
39277 <colspec colwidth="6*" align="center"/>
39278 <colspec colwidth="6*" align="center"/>
39279 <colspec colwidth="6*" align="right"/>
39280 <tbody>
39281 <row>
39282 <entry><option>check_owner</option></entry>
39283 <entry>Use: <emphasis>appendfile</emphasis></entry>
39284 <entry>Type: <emphasis>boolean</emphasis></entry>
39285 <entry>Default: <emphasis>true</emphasis></entry>
39286 </row>
39287 </tbody>
39288 </tgroup>
39289 </informaltable>
39290 <para>
39291 When this option is set, the owner of the file defined by the <option>file</option> option
39292 is checked to ensure that it is the same as the user under which the delivery
39293 process is running.
39294 </para>
39295 <para>
39296 <indexterm role="option">
39297 <primary><option>check_string</option></primary>
39298 </indexterm>
39299 </para>
39300 <informaltable frame="all">
39301 <tgroup cols="4" colsep="0" rowsep="0">
39302 <colspec colwidth="8*" align="left"/>
39303 <colspec colwidth="6*" align="center"/>
39304 <colspec colwidth="6*" align="center"/>
39305 <colspec colwidth="6*" align="right"/>
39306 <tbody>
39307 <row>
39308 <entry><option>check_string</option></entry>
39309 <entry>Use: <emphasis>appendfile</emphasis></entry>
39310 <entry>Type: <emphasis>string</emphasis></entry>
39311 <entry>Default: <emphasis>see below</emphasis></entry>
39312 </row>
39313 </tbody>
39314 </tgroup>
39315 </informaltable>
39316 <para>
39317 <indexterm role="concept">
39318 <primary><quote>From</quote> line</primary>
39319 </indexterm>
39320 As <command>appendfile</command> writes the message, the start of each line is tested for
39321 matching <option>check_string</option>, and if it does, the initial matching characters are
39322 replaced by the contents of <option>escape_string</option>. The value of <option>check_string</option> is
39323 a literal string, not a regular expression, and the case of any letters it
39324 contains is significant.
39325 </para>
39326 <para>
39327 If <option>use_bsmtp</option> is set the values of <option>check_string</option> and <option>escape_string</option>
39328 are forced to <quote>.</quote> and <quote>..</quote> respectively, and any settings in the
39329 configuration are ignored. Otherwise, they default to <quote>From&nbsp;</quote> and
39330 <quote>&gt;From&nbsp;</quote> when the <option>file</option> option is set, and unset when any of the
39331 <option>directory</option>, <option>maildir</option>, or <option>mailstore</option> options are set.
39332 </para>
39333 <para>
39334 The default settings, along with <option>message_prefix</option> and <option>message_suffix</option>, are
39335 suitable for traditional <quote>BSD</quote> mailboxes, where a line beginning with
39336 <quote>From&nbsp;</quote> indicates the start of a new message. All four options need changing
39337 if another format is used. For example, to deliver to mailboxes in MMDF format:
39338 <indexterm role="concept">
39339 <primary>MMDF format mailbox</primary>
39340 </indexterm>
39341 <indexterm role="concept">
39342 <primary>mailbox</primary>
39343 <secondary>MMDF format</secondary>
39344 </indexterm>
39345 </para>
39346 <literallayout class="monospaced">
39347 check_string = "\1\1\1\1\n"
39348 escape_string = "\1\1\1\1 \n"
39349 message_prefix = "\1\1\1\1\n"
39350 message_suffix = "\1\1\1\1\n"
39351 </literallayout>
39352 <para>
39353 <indexterm role="option">
39354 <primary><option>create_directory</option></primary>
39355 </indexterm>
39356 </para>
39357 <informaltable frame="all">
39358 <tgroup cols="4" colsep="0" rowsep="0">
39359 <colspec colwidth="8*" align="left"/>
39360 <colspec colwidth="6*" align="center"/>
39361 <colspec colwidth="6*" align="center"/>
39362 <colspec colwidth="6*" align="right"/>
39363 <tbody>
39364 <row>
39365 <entry><option>create_directory</option></entry>
39366 <entry>Use: <emphasis>appendfile</emphasis></entry>
39367 <entry>Type: <emphasis>boolean</emphasis></entry>
39368 <entry>Default: <emphasis>true</emphasis></entry>
39369 </row>
39370 </tbody>
39371 </tgroup>
39372 </informaltable>
39373 <para>
39374 <indexterm role="concept">
39375 <primary>directory creation</primary>
39376 </indexterm>
39377 When this option is true, Exim attempts to create any missing superior
39378 directories for the file that it is about to write. A created directory&#x2019;s mode
39379 is given by the <option>directory_mode</option> option.
39380 </para>
39381 <para>
39382 The group ownership of a newly created directory is highly dependent on the
39383 operating system (and possibly the file system) that is being used. For
39384 example, in Solaris, if the parent directory has the setgid bit set, its group
39385 is propagated to the child; if not, the currently set group is used. However,
39386 in FreeBSD, the parent&#x2019;s group is always used.
39387 </para>
39388 <para>
39389 <indexterm role="option">
39390 <primary><option>create_file</option></primary>
39391 </indexterm>
39392 </para>
39393 <informaltable frame="all">
39394 <tgroup cols="4" colsep="0" rowsep="0">
39395 <colspec colwidth="8*" align="left"/>
39396 <colspec colwidth="6*" align="center"/>
39397 <colspec colwidth="6*" align="center"/>
39398 <colspec colwidth="6*" align="right"/>
39399 <tbody>
39400 <row>
39401 <entry><option>create_file</option></entry>
39402 <entry>Use: <emphasis>appendfile</emphasis></entry>
39403 <entry>Type: <emphasis>string</emphasis></entry>
39404 <entry>Default: <emphasis>anywhere</emphasis></entry>
39405 </row>
39406 </tbody>
39407 </tgroup>
39408 </informaltable>
39409 <para>
39410 This option constrains the location of files and directories that are created
39411 by this transport. It applies to files defined by the <option>file</option> option and
39412 directories defined by the <option>directory</option> option. In the case of maildir
39413 delivery, it applies to the top level directory, not the maildir directories
39414 beneath.
39415 </para>
39416 <para>
39417 The option must be set to one of the words <quote>anywhere</quote>, <quote>inhome</quote>, or
39418 <quote>belowhome</quote>. In the second and third cases, a home directory must have been
39419 set for the transport. This option is not useful when an explicit file name is
39420 given for normal mailbox deliveries. It is intended for the case when file
39421 names are generated from users&#x2019; <filename>.forward</filename> files. These are usually handled
39422 by an <command>appendfile</command> transport called <option>address_file</option>. See also
39423 <option>file_must_exist</option>.
39424 </para>
39425 <para>
39426 <indexterm role="option">
39427 <primary><option>directory</option></primary>
39428 </indexterm>
39429 </para>
39430 <informaltable frame="all">
39431 <tgroup cols="4" colsep="0" rowsep="0">
39432 <colspec colwidth="8*" align="left"/>
39433 <colspec colwidth="6*" align="center"/>
39434 <colspec colwidth="6*" align="center"/>
39435 <colspec colwidth="6*" align="right"/>
39436 <tbody>
39437 <row>
39438 <entry><option>directory</option></entry>
39439 <entry>Use: <emphasis>appendfile</emphasis></entry>
39440 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
39441 <entry>Default: <emphasis>unset</emphasis></entry>
39442 </row>
39443 </tbody>
39444 </tgroup>
39445 </informaltable>
39446 <para>
39447 This option is mutually exclusive with the <option>file</option> option, but one of <option>file</option>
39448 or <option>directory</option> must be set, unless the delivery is the direct result of a
39449 redirection (see section <xref linkend="SECTfildiropt"/>).
39450 </para>
39451 <para>
39452 When <option>directory</option> is set, the string is expanded, and the message is delivered
39453 into a new file or files in or below the given directory, instead of being
39454 appended to a single mailbox file. A number of different formats are provided
39455 (see <option>maildir_format</option> and <option>mailstore_format</option>), and see section
39456 <xref linkend="SECTopdir"/> for further details of this form of delivery.
39457 </para>
39458 <para>
39459 <indexterm role="option">
39460 <primary><option>directory_file</option></primary>
39461 </indexterm>
39462 </para>
39463 <informaltable frame="all">
39464 <tgroup cols="4" colsep="0" rowsep="0">
39465 <colspec colwidth="8*" align="left"/>
39466 <colspec colwidth="6*" align="center"/>
39467 <colspec colwidth="6*" align="center"/>
39468 <colspec colwidth="6*" align="right"/>
39469 <tbody>
39470 <row>
39471 <entry><option>directory_file</option></entry>
39472 <entry>Use: <emphasis>appendfile</emphasis></entry>
39473 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
39474 <entry>Default: <emphasis>see below</emphasis></entry>
39475 </row>
39476 </tbody>
39477 </tgroup>
39478 </informaltable>
39479 <para>
39480 <indexterm role="concept">
39481 <primary>base62</primary>
39482 </indexterm>
39483 <indexterm role="variable">
39484 <primary><varname>$inode</varname></primary>
39485 </indexterm>
39486 When <option>directory</option> is set, but neither <option>maildir_format</option> nor
39487 <option>mailstore_format</option> is set, <command>appendfile</command> delivers each message into a file
39488 whose name is obtained by expanding this string. The default value is:
39489 </para>
39490 <literallayout class="monospaced">
39491 q${base62:$tod_epoch}-$inode
39492 </literallayout>
39493 <para>
39494 This generates a unique name from the current time, in base 62 form, and the
39495 inode of the file. The variable <varname>$inode</varname> is available only when expanding this
39496 option.
39497 </para>
39498 <para>
39499 <indexterm role="option">
39500 <primary><option>directory_mode</option></primary>
39501 </indexterm>
39502 </para>
39503 <informaltable frame="all">
39504 <tgroup cols="4" colsep="0" rowsep="0">
39505 <colspec colwidth="8*" align="left"/>
39506 <colspec colwidth="6*" align="center"/>
39507 <colspec colwidth="6*" align="center"/>
39508 <colspec colwidth="6*" align="right"/>
39509 <tbody>
39510 <row>
39511 <entry><option>directory_mode</option></entry>
39512 <entry>Use: <emphasis>appendfile</emphasis></entry>
39513 <entry>Type: <emphasis>octal integer</emphasis></entry>
39514 <entry>Default: <emphasis>0700</emphasis></entry>
39515 </row>
39516 </tbody>
39517 </tgroup>
39518 </informaltable>
39519 <para>
39520 If <command>appendfile</command> creates any directories as a result of the
39521 <option>create_directory</option> option, their mode is specified by this option.
39522 </para>
39523 <para>
39524 <indexterm role="option">
39525 <primary><option>escape_string</option></primary>
39526 </indexterm>
39527 </para>
39528 <informaltable frame="all">
39529 <tgroup cols="4" colsep="0" rowsep="0">
39530 <colspec colwidth="8*" align="left"/>
39531 <colspec colwidth="6*" align="center"/>
39532 <colspec colwidth="6*" align="center"/>
39533 <colspec colwidth="6*" align="right"/>
39534 <tbody>
39535 <row>
39536 <entry><option>escape_string</option></entry>
39537 <entry>Use: <emphasis>appendfile</emphasis></entry>
39538 <entry>Type: <emphasis>string</emphasis></entry>
39539 <entry>Default: <emphasis>see description</emphasis></entry>
39540 </row>
39541 </tbody>
39542 </tgroup>
39543 </informaltable>
39544 <para>
39545 See <option>check_string</option> above.
39546 </para>
39547 <para>
39548 <indexterm role="option">
39549 <primary><option>file</option></primary>
39550 </indexterm>
39551 </para>
39552 <informaltable frame="all">
39553 <tgroup cols="4" colsep="0" rowsep="0">
39554 <colspec colwidth="8*" align="left"/>
39555 <colspec colwidth="6*" align="center"/>
39556 <colspec colwidth="6*" align="center"/>
39557 <colspec colwidth="6*" align="right"/>
39558 <tbody>
39559 <row>
39560 <entry><option>file</option></entry>
39561 <entry>Use: <emphasis>appendfile</emphasis></entry>
39562 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
39563 <entry>Default: <emphasis>unset</emphasis></entry>
39564 </row>
39565 </tbody>
39566 </tgroup>
39567 </informaltable>
39568 <para>
39569 This option is mutually exclusive with the <option>directory</option> option, but one of
39570 <option>file</option> or <option>directory</option> must be set, unless the delivery is the direct result
39571 of a redirection (see section <xref linkend="SECTfildiropt"/>). The <option>file</option> option
39572 specifies a single file, to which the message is appended. One or more of
39573 <option>use_fcntl_lock</option>, <option>use_flock_lock</option>, or <option>use_lockfile</option> must be set with
39574 <option>file</option>.
39575 </para>
39576 <para>
39577 <indexterm role="concept">
39578 <primary>NFS</primary>
39579 <secondary>lock file</secondary>
39580 </indexterm>
39581 <indexterm role="concept">
39582 <primary>locking files</primary>
39583 </indexterm>
39584 <indexterm role="concept">
39585 <primary>lock files</primary>
39586 </indexterm>
39587 If you are using more than one host to deliver over NFS into the same
39588 mailboxes, you should always use lock files.
39589 </para>
39590 <para>
39591 The string value is expanded for each delivery, and must yield an absolute
39592 path. The most common settings of this option are variations on one of these
39593 examples:
39594 </para>
39595 <literallayout class="monospaced">
39596 file = /var/spool/mail/$local_part
39597 file = /home/$local_part/inbox
39598 file = $home/inbox
39599 </literallayout>
39600 <para>
39601 <indexterm role="concept">
39602 <primary><quote>sticky</quote> bit</primary>
39603 </indexterm>
39604 In the first example, all deliveries are done into the same directory. If Exim
39605 is configured to use lock files (see <option>use_lockfile</option> below) it must be able to
39606 create a file in the directory, so the <quote>sticky</quote> bit must be turned on for
39607 deliveries to be possible, or alternatively the <option>group</option> option can be used to
39608 run the delivery under a group id which has write access to the directory.
39609 </para>
39610 <para>
39611 <indexterm role="option">
39612 <primary><option>file_format</option></primary>
39613 </indexterm>
39614 </para>
39615 <informaltable frame="all">
39616 <tgroup cols="4" colsep="0" rowsep="0">
39617 <colspec colwidth="8*" align="left"/>
39618 <colspec colwidth="6*" align="center"/>
39619 <colspec colwidth="6*" align="center"/>
39620 <colspec colwidth="6*" align="right"/>
39621 <tbody>
39622 <row>
39623 <entry><option>file_format</option></entry>
39624 <entry>Use: <emphasis>appendfile</emphasis></entry>
39625 <entry>Type: <emphasis>string</emphasis></entry>
39626 <entry>Default: <emphasis>unset</emphasis></entry>
39627 </row>
39628 </tbody>
39629 </tgroup>
39630 </informaltable>
39631 <para>
39632 <indexterm role="concept">
39633 <primary>file</primary>
39634 <secondary>mailbox; checking existing format</secondary>
39635 </indexterm>
39636 This option requests the transport to check the format of an existing file
39637 before adding to it. The check consists of matching a specific string at the
39638 start of the file. The value of the option consists of an even number of
39639 colon-separated strings. The first of each pair is the test string, and the
39640 second is the name of a transport. If the transport associated with a matched
39641 string is not the current transport, control is passed over to the other
39642 transport. For example, suppose the standard <command>local_delivery</command> transport has
39643 this added to it:
39644 </para>
39645 <literallayout class="monospaced">
39646 file_format = "From       : local_delivery :\
39647                \1\1\1\1\n : local_mmdf_delivery"
39648 </literallayout>
39649 <para>
39650 Mailboxes that begin with <quote>From</quote> are still handled by this transport, but if
39651 a mailbox begins with four binary ones followed by a newline, control is passed
39652 to a transport called <option>local_mmdf_delivery</option>, which presumably is configured
39653 to do the delivery in MMDF format. If a mailbox does not exist or is empty, it
39654 is assumed to match the current transport. If the start of a mailbox doesn&#x2019;t
39655 match any string, or if the transport named for a given string is not defined,
39656 delivery is deferred.
39657 </para>
39658 <para>
39659 <indexterm role="option">
39660 <primary><option>file_must_exist</option></primary>
39661 </indexterm>
39662 </para>
39663 <informaltable frame="all">
39664 <tgroup cols="4" colsep="0" rowsep="0">
39665 <colspec colwidth="8*" align="left"/>
39666 <colspec colwidth="6*" align="center"/>
39667 <colspec colwidth="6*" align="center"/>
39668 <colspec colwidth="6*" align="right"/>
39669 <tbody>
39670 <row>
39671 <entry><option>file_must_exist</option></entry>
39672 <entry>Use: <emphasis>appendfile</emphasis></entry>
39673 <entry>Type: <emphasis>boolean</emphasis></entry>
39674 <entry>Default: <emphasis>false</emphasis></entry>
39675 </row>
39676 </tbody>
39677 </tgroup>
39678 </informaltable>
39679 <para>
39680 If this option is true, the file specified by the <option>file</option> option must exist.
39681 A temporary error occurs if it does not, causing delivery to be deferred.
39682 If this option is false, the file is created if it does not exist.
39683 </para>
39684 <para>
39685 <indexterm role="option">
39686 <primary><option>lock_fcntl_timeout</option></primary>
39687 </indexterm>
39688 </para>
39689 <informaltable frame="all">
39690 <tgroup cols="4" colsep="0" rowsep="0">
39691 <colspec colwidth="8*" align="left"/>
39692 <colspec colwidth="6*" align="center"/>
39693 <colspec colwidth="6*" align="center"/>
39694 <colspec colwidth="6*" align="right"/>
39695 <tbody>
39696 <row>
39697 <entry><option>lock_fcntl_timeout</option></entry>
39698 <entry>Use: <emphasis>appendfile</emphasis></entry>
39699 <entry>Type: <emphasis>time</emphasis></entry>
39700 <entry>Default: <emphasis>0s</emphasis></entry>
39701 </row>
39702 </tbody>
39703 </tgroup>
39704 </informaltable>
39705 <para>
39706 <indexterm role="concept">
39707 <primary>timeout</primary>
39708 <secondary>mailbox locking</secondary>
39709 </indexterm>
39710 <indexterm role="concept">
39711 <primary>mailbox</primary>
39712 <secondary>locking, blocking and non-blocking</secondary>
39713 </indexterm>
39714 <indexterm role="concept">
39715 <primary>locking files</primary>
39716 </indexterm>
39717 By default, the <command>appendfile</command> transport uses non-blocking calls to <function>fcntl()</function>
39718 when locking an open mailbox file. If the call fails, the delivery process
39719 sleeps for <option>lock_interval</option> and tries again, up to <option>lock_retries</option> times.
39720 Non-blocking calls are used so that the file is not kept open during the wait
39721 for the lock; the reason for this is to make it as safe as possible for
39722 deliveries over NFS in the case when processes might be accessing an NFS
39723 mailbox without using a lock file. This should not be done, but
39724 misunderstandings and hence misconfigurations are not unknown.
39725 </para>
39726 <para>
39727 On a busy system, however, the performance of a non-blocking lock approach is
39728 not as good as using a blocking lock with a timeout. In this case, the waiting
39729 is done inside the system call, and Exim&#x2019;s delivery process acquires the lock
39730 and can proceed as soon as the previous lock holder releases it.
39731 </para>
39732 <para>
39733 If <option>lock_fcntl_timeout</option> is set to a non-zero time, blocking locks, with that
39734 timeout, are used. There may still be some retrying: the maximum number of
39735 retries is
39736 </para>
39737 <literallayout class="monospaced">
39738 (lock_retries * lock_interval) / lock_fcntl_timeout
39739 </literallayout>
39740 <para>
39741 rounded up to the next whole number. In other words, the total time during
39742 which <command>appendfile</command> is trying to get a lock is roughly the same, unless
39743 <option>lock_fcntl_timeout</option> is set very large.
39744 </para>
39745 <para>
39746 You should consider setting this option if you are getting a lot of delayed
39747 local deliveries because of errors of the form
39748 </para>
39749 <literallayout class="monospaced">
39750 failed to lock mailbox /some/file (fcntl)
39751 </literallayout>
39752 <para>
39753 <indexterm role="option">
39754 <primary><option>lock_flock_timeout</option></primary>
39755 </indexterm>
39756 </para>
39757 <informaltable frame="all">
39758 <tgroup cols="4" colsep="0" rowsep="0">
39759 <colspec colwidth="8*" align="left"/>
39760 <colspec colwidth="6*" align="center"/>
39761 <colspec colwidth="6*" align="center"/>
39762 <colspec colwidth="6*" align="right"/>
39763 <tbody>
39764 <row>
39765 <entry><option>lock_flock_timeout</option></entry>
39766 <entry>Use: <emphasis>appendfile</emphasis></entry>
39767 <entry>Type: <emphasis>time</emphasis></entry>
39768 <entry>Default: <emphasis>0s</emphasis></entry>
39769 </row>
39770 </tbody>
39771 </tgroup>
39772 </informaltable>
39773 <para>
39774 This timeout applies to file locking when using <function>flock()</function> (see
39775 <option>use_flock</option>); the timeout operates in a similar manner to
39776 <option>lock_fcntl_timeout</option>.
39777 </para>
39778 <para>
39779 <indexterm role="option">
39780 <primary><option>lock_interval</option></primary>
39781 </indexterm>
39782 </para>
39783 <informaltable frame="all">
39784 <tgroup cols="4" colsep="0" rowsep="0">
39785 <colspec colwidth="8*" align="left"/>
39786 <colspec colwidth="6*" align="center"/>
39787 <colspec colwidth="6*" align="center"/>
39788 <colspec colwidth="6*" align="right"/>
39789 <tbody>
39790 <row>
39791 <entry><option>lock_interval</option></entry>
39792 <entry>Use: <emphasis>appendfile</emphasis></entry>
39793 <entry>Type: <emphasis>time</emphasis></entry>
39794 <entry>Default: <emphasis>3s</emphasis></entry>
39795 </row>
39796 </tbody>
39797 </tgroup>
39798 </informaltable>
39799 <para>
39800 This specifies the time to wait between attempts to lock the file. See below
39801 for details of locking.
39802 </para>
39803 <para>
39804 <indexterm role="option">
39805 <primary><option>lock_retries</option></primary>
39806 </indexterm>
39807 </para>
39808 <informaltable frame="all">
39809 <tgroup cols="4" colsep="0" rowsep="0">
39810 <colspec colwidth="8*" align="left"/>
39811 <colspec colwidth="6*" align="center"/>
39812 <colspec colwidth="6*" align="center"/>
39813 <colspec colwidth="6*" align="right"/>
39814 <tbody>
39815 <row>
39816 <entry><option>lock_retries</option></entry>
39817 <entry>Use: <emphasis>appendfile</emphasis></entry>
39818 <entry>Type: <emphasis>integer</emphasis></entry>
39819 <entry>Default: <emphasis>10</emphasis></entry>
39820 </row>
39821 </tbody>
39822 </tgroup>
39823 </informaltable>
39824 <para>
39825 This specifies the maximum number of attempts to lock the file. A value of zero
39826 is treated as 1. See below for details of locking.
39827 </para>
39828 <para>
39829 <indexterm role="option">
39830 <primary><option>lockfile_mode</option></primary>
39831 </indexterm>
39832 </para>
39833 <informaltable frame="all">
39834 <tgroup cols="4" colsep="0" rowsep="0">
39835 <colspec colwidth="8*" align="left"/>
39836 <colspec colwidth="6*" align="center"/>
39837 <colspec colwidth="6*" align="center"/>
39838 <colspec colwidth="6*" align="right"/>
39839 <tbody>
39840 <row>
39841 <entry><option>lockfile_mode</option></entry>
39842 <entry>Use: <emphasis>appendfile</emphasis></entry>
39843 <entry>Type: <emphasis>octal integer</emphasis></entry>
39844 <entry>Default: <emphasis>0600</emphasis></entry>
39845 </row>
39846 </tbody>
39847 </tgroup>
39848 </informaltable>
39849 <para>
39850 This specifies the mode of the created lock file, when a lock file is being
39851 used (see <option>use_lockfile</option> and <option>use_mbx_lock</option>).
39852 </para>
39853 <para>
39854 <indexterm role="option">
39855 <primary><option>lockfile_timeout</option></primary>
39856 </indexterm>
39857 </para>
39858 <informaltable frame="all">
39859 <tgroup cols="4" colsep="0" rowsep="0">
39860 <colspec colwidth="8*" align="left"/>
39861 <colspec colwidth="6*" align="center"/>
39862 <colspec colwidth="6*" align="center"/>
39863 <colspec colwidth="6*" align="right"/>
39864 <tbody>
39865 <row>
39866 <entry><option>lockfile_timeout</option></entry>
39867 <entry>Use: <emphasis>appendfile</emphasis></entry>
39868 <entry>Type: <emphasis>time</emphasis></entry>
39869 <entry>Default: <emphasis>30m</emphasis></entry>
39870 </row>
39871 </tbody>
39872 </tgroup>
39873 </informaltable>
39874 <para>
39875 <indexterm role="concept">
39876 <primary>timeout</primary>
39877 <secondary>mailbox locking</secondary>
39878 </indexterm>
39879 When a lock file is being used (see <option>use_lockfile</option>), if a lock file already
39880 exists and is older than this value, it is assumed to have been left behind by
39881 accident, and Exim attempts to remove it.
39882 </para>
39883 <para>
39884 <indexterm role="option">
39885 <primary><option>mailbox_filecount</option></primary>
39886 </indexterm>
39887 </para>
39888 <informaltable frame="all">
39889 <tgroup cols="4" colsep="0" rowsep="0">
39890 <colspec colwidth="8*" align="left"/>
39891 <colspec colwidth="6*" align="center"/>
39892 <colspec colwidth="6*" align="center"/>
39893 <colspec colwidth="6*" align="right"/>
39894 <tbody>
39895 <row>
39896 <entry><option>mailbox_filecount</option></entry>
39897 <entry>Use: <emphasis>appendfile</emphasis></entry>
39898 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
39899 <entry>Default: <emphasis>unset</emphasis></entry>
39900 </row>
39901 </tbody>
39902 </tgroup>
39903 </informaltable>
39904 <para>
39905 <indexterm role="concept">
39906 <primary>mailbox</primary>
39907 <secondary>specifying size of</secondary>
39908 </indexterm>
39909 <indexterm role="concept">
39910 <primary>size</primary>
39911 <secondary>of mailbox</secondary>
39912 </indexterm>
39913 If this option is set, it is expanded, and the result is taken as the current
39914 number of files in the mailbox. It must be a decimal number, optionally
39915 followed by K or M. This provides a way of obtaining this information from an
39916 external source that maintains the data.
39917 </para>
39918 <para>
39919 <indexterm role="option">
39920 <primary><option>mailbox_size</option></primary>
39921 </indexterm>
39922 </para>
39923 <informaltable frame="all">
39924 <tgroup cols="4" colsep="0" rowsep="0">
39925 <colspec colwidth="8*" align="left"/>
39926 <colspec colwidth="6*" align="center"/>
39927 <colspec colwidth="6*" align="center"/>
39928 <colspec colwidth="6*" align="right"/>
39929 <tbody>
39930 <row>
39931 <entry><option>mailbox_size</option></entry>
39932 <entry>Use: <emphasis>appendfile</emphasis></entry>
39933 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
39934 <entry>Default: <emphasis>unset</emphasis></entry>
39935 </row>
39936 </tbody>
39937 </tgroup>
39938 </informaltable>
39939 <para>
39940 <indexterm role="concept">
39941 <primary>mailbox</primary>
39942 <secondary>specifying size of</secondary>
39943 </indexterm>
39944 <indexterm role="concept">
39945 <primary>size</primary>
39946 <secondary>of mailbox</secondary>
39947 </indexterm>
39948 If this option is set, it is expanded, and the result is taken as the current
39949 size the mailbox. It must be a decimal number, optionally followed by K or M.
39950 This provides a way of obtaining this information from an external source that
39951 maintains the data. This is likely to be helpful for maildir deliveries where
39952 it is computationally expensive to compute the size of a mailbox.
39953 </para>
39954 <para>
39955 <indexterm role="option">
39956 <primary><option>maildir_format</option></primary>
39957 </indexterm>
39958 </para>
39959 <informaltable frame="all">
39960 <tgroup cols="4" colsep="0" rowsep="0">
39961 <colspec colwidth="8*" align="left"/>
39962 <colspec colwidth="6*" align="center"/>
39963 <colspec colwidth="6*" align="center"/>
39964 <colspec colwidth="6*" align="right"/>
39965 <tbody>
39966 <row>
39967 <entry><option>maildir_format</option></entry>
39968 <entry>Use: <emphasis>appendfile</emphasis></entry>
39969 <entry>Type: <emphasis>boolean</emphasis></entry>
39970 <entry>Default: <emphasis>false</emphasis></entry>
39971 </row>
39972 </tbody>
39973 </tgroup>
39974 </informaltable>
39975 <para>
39976 <indexterm role="concept">
39977 <primary>maildir format</primary>
39978 <secondary>specifying</secondary>
39979 </indexterm>
39980 If this option is set with the <option>directory</option> option, the delivery is into a new
39981 file, in the <quote>maildir</quote> format that is used by other mail software. When the
39982 transport is activated directly from a <command>redirect</command> router (for example, the
39983 <command>address_file</command> transport in the default configuration), setting
39984 <option>maildir_format</option> causes the path received from the router to be treated as a
39985 directory, whether or not it ends with <literal>/</literal>. This option is available only if
39986 SUPPORT_MAILDIR is present in <filename>Local/Makefile</filename>. See section
39987 <xref linkend="SECTmaildirdelivery"/> below for further details.
39988 </para>
39989 <para>
39990 <indexterm role="option">
39991 <primary><option>maildir_quota_directory_regex</option></primary>
39992 </indexterm>
39993 </para>
39994 <informaltable frame="all">
39995 <tgroup cols="4" colsep="0" rowsep="0">
39996 <colspec colwidth="8*" align="left"/>
39997 <colspec colwidth="6*" align="center"/>
39998 <colspec colwidth="6*" align="center"/>
39999 <colspec colwidth="6*" align="right"/>
40000 <tbody>
40001 <row>
40002 <entry><option>maildir_quota_directory_regex</option></entry>
40003 <entry>Use: <emphasis>appendfile</emphasis></entry>
40004 <entry>Type: <emphasis>string</emphasis></entry>
40005 <entry>Default: <emphasis>See below</emphasis></entry>
40006 </row>
40007 </tbody>
40008 </tgroup>
40009 </informaltable>
40010 <para>
40011 <indexterm role="concept">
40012 <primary>maildir format</primary>
40013 <secondary>quota; directories included in</secondary>
40014 </indexterm>
40015 <indexterm role="concept">
40016 <primary>quota</primary>
40017 <secondary>maildir; directories included in</secondary>
40018 </indexterm>
40019 This option is relevant only when <option>maildir_use_size_file</option> is set. It defines
40020 a regular expression for specifying directories, relative to the quota
40021 directory (see <option>quota_directory</option>), that should be included in the quota
40022 calculation. The default value is:
40023 </para>
40024 <literallayout class="monospaced">
40025 maildir_quota_directory_regex = ^(?:cur|new|\..*)$
40026 </literallayout>
40027 <para>
40028 This includes the <filename>cur</filename> and <filename>new</filename> directories, and any maildir++ folders
40029 (directories whose names begin with a dot). If you want to exclude the
40030 <filename>Trash</filename>
40031 folder from the count (as some sites do), you need to change this setting to
40032 </para>
40033 <literallayout class="monospaced">
40034 maildir_quota_directory_regex = ^(?:cur|new|\.(?!Trash).*)$
40035 </literallayout>
40036 <para>
40037 This uses a negative lookahead in the regular expression to exclude the
40038 directory whose name is <filename>.Trash</filename>. When a directory is excluded from quota
40039 calculations, quota processing is bypassed for any messages that are delivered
40040 directly into that directory.
40041 </para>
40042 <para>
40043 <indexterm role="option">
40044 <primary><option>maildir_retries</option></primary>
40045 </indexterm>
40046 </para>
40047 <informaltable frame="all">
40048 <tgroup cols="4" colsep="0" rowsep="0">
40049 <colspec colwidth="8*" align="left"/>
40050 <colspec colwidth="6*" align="center"/>
40051 <colspec colwidth="6*" align="center"/>
40052 <colspec colwidth="6*" align="right"/>
40053 <tbody>
40054 <row>
40055 <entry><option>maildir_retries</option></entry>
40056 <entry>Use: <emphasis>appendfile</emphasis></entry>
40057 <entry>Type: <emphasis>integer</emphasis></entry>
40058 <entry>Default: <emphasis>10</emphasis></entry>
40059 </row>
40060 </tbody>
40061 </tgroup>
40062 </informaltable>
40063 <para>
40064 This option specifies the number of times to retry when writing a file in
40065 <quote>maildir</quote> format. See section <xref linkend="SECTmaildirdelivery"/> below.
40066 </para>
40067 <para>
40068 <indexterm role="option">
40069 <primary><option>maildir_tag</option></primary>
40070 </indexterm>
40071 </para>
40072 <informaltable frame="all">
40073 <tgroup cols="4" colsep="0" rowsep="0">
40074 <colspec colwidth="8*" align="left"/>
40075 <colspec colwidth="6*" align="center"/>
40076 <colspec colwidth="6*" align="center"/>
40077 <colspec colwidth="6*" align="right"/>
40078 <tbody>
40079 <row>
40080 <entry><option>maildir_tag</option></entry>
40081 <entry>Use: <emphasis>appendfile</emphasis></entry>
40082 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
40083 <entry>Default: <emphasis>unset</emphasis></entry>
40084 </row>
40085 </tbody>
40086 </tgroup>
40087 </informaltable>
40088 <para>
40089 This option applies only to deliveries in maildir format, and is described in
40090 section <xref linkend="SECTmaildirdelivery"/> below.
40091 </para>
40092 <para>
40093 <indexterm role="option">
40094 <primary><option>maildir_use_size_file</option></primary>
40095 </indexterm>
40096 </para>
40097 <informaltable frame="all">
40098 <tgroup cols="4" colsep="0" rowsep="0">
40099 <colspec colwidth="8*" align="left"/>
40100 <colspec colwidth="6*" align="center"/>
40101 <colspec colwidth="6*" align="center"/>
40102 <colspec colwidth="6*" align="right"/>
40103 <tbody>
40104 <row>
40105 <entry><option>maildir_use_size_file</option></entry>
40106 <entry>Use: <emphasis>appendfile</emphasis>&dagger;<emphasis></emphasis></entry>
40107 <entry>Type: <emphasis>boolean</emphasis></entry>
40108 <entry>Default: <emphasis>false</emphasis></entry>
40109 </row>
40110 </tbody>
40111 </tgroup>
40112 </informaltable>
40113 <para>
40114 <indexterm role="concept">
40115 <primary>maildir format</primary>
40116 <secondary><filename>maildirsize</filename> file</secondary>
40117 </indexterm>
40118 The result of string expansion for this option must be a valid boolean value.
40119 If it is true, it enables support for <filename>maildirsize</filename> files. Exim
40120 creates a <filename>maildirsize</filename> file in a maildir if one does not exist, taking the
40121 quota from the <option>quota</option> option of the transport. If <option>quota</option> is unset, the
40122 value is zero. See <option>maildir_quota_directory_regex</option> above and section
40123 <xref linkend="SECTmaildirdelivery"/> below for further details.
40124 </para>
40125 <para>
40126 <indexterm role="option">
40127 <primary><option>maildirfolder_create_regex</option></primary>
40128 </indexterm>
40129 </para>
40130 <informaltable frame="all">
40131 <tgroup cols="4" colsep="0" rowsep="0">
40132 <colspec colwidth="8*" align="left"/>
40133 <colspec colwidth="6*" align="center"/>
40134 <colspec colwidth="6*" align="center"/>
40135 <colspec colwidth="6*" align="right"/>
40136 <tbody>
40137 <row>
40138 <entry><option>maildirfolder_create_regex</option></entry>
40139 <entry>Use: <emphasis>appendfile</emphasis></entry>
40140 <entry>Type: <emphasis>string</emphasis></entry>
40141 <entry>Default: <emphasis>unset</emphasis></entry>
40142 </row>
40143 </tbody>
40144 </tgroup>
40145 </informaltable>
40146 <para>
40147 <indexterm role="concept">
40148 <primary>maildir format</primary>
40149 <secondary><filename>maildirfolder</filename> file</secondary>
40150 </indexterm>
40151 <indexterm role="concept">
40152 <primary><filename>maildirfolder</filename>, creating</primary>
40153 </indexterm>
40154 The value of this option is a regular expression. If it is unset, it has no
40155 effect. Otherwise, before a maildir delivery takes place, the pattern is
40156 matched against the name of the maildir directory, that is, the directory
40157 containing the <filename>new</filename> and <filename>tmp</filename> subdirectories that will be used for the
40158 delivery. If there is a match, Exim checks for the existence of a file called
40159 <filename>maildirfolder</filename> in the directory, and creates it if it does not exist.
40160 See section <xref linkend="SECTmaildirdelivery"/> for more details.
40161 </para>
40162 <para>
40163 <indexterm role="option">
40164 <primary><option>mailstore_format</option></primary>
40165 </indexterm>
40166 </para>
40167 <informaltable frame="all">
40168 <tgroup cols="4" colsep="0" rowsep="0">
40169 <colspec colwidth="8*" align="left"/>
40170 <colspec colwidth="6*" align="center"/>
40171 <colspec colwidth="6*" align="center"/>
40172 <colspec colwidth="6*" align="right"/>
40173 <tbody>
40174 <row>
40175 <entry><option>mailstore_format</option></entry>
40176 <entry>Use: <emphasis>appendfile</emphasis></entry>
40177 <entry>Type: <emphasis>boolean</emphasis></entry>
40178 <entry>Default: <emphasis>false</emphasis></entry>
40179 </row>
40180 </tbody>
40181 </tgroup>
40182 </informaltable>
40183 <para>
40184 <indexterm role="concept">
40185 <primary>mailstore format</primary>
40186 <secondary>specifying</secondary>
40187 </indexterm>
40188 If this option is set with the <option>directory</option> option, the delivery is into two
40189 new files in  <quote>mailstore</quote> format. The option is available only if
40190 SUPPORT_MAILSTORE is present in <filename>Local/Makefile</filename>. See section <xref linkend="SECTopdir"/>
40191 below for further details.
40192 </para>
40193 <para>
40194 <indexterm role="option">
40195 <primary><option>mailstore_prefix</option></primary>
40196 </indexterm>
40197 </para>
40198 <informaltable frame="all">
40199 <tgroup cols="4" colsep="0" rowsep="0">
40200 <colspec colwidth="8*" align="left"/>
40201 <colspec colwidth="6*" align="center"/>
40202 <colspec colwidth="6*" align="center"/>
40203 <colspec colwidth="6*" align="right"/>
40204 <tbody>
40205 <row>
40206 <entry><option>mailstore_prefix</option></entry>
40207 <entry>Use: <emphasis>appendfile</emphasis></entry>
40208 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
40209 <entry>Default: <emphasis>unset</emphasis></entry>
40210 </row>
40211 </tbody>
40212 </tgroup>
40213 </informaltable>
40214 <para>
40215 This option applies only to deliveries in mailstore format, and is described in
40216 section <xref linkend="SECTopdir"/> below.
40217 </para>
40218 <para>
40219 <indexterm role="option">
40220 <primary><option>mailstore_suffix</option></primary>
40221 </indexterm>
40222 </para>
40223 <informaltable frame="all">
40224 <tgroup cols="4" colsep="0" rowsep="0">
40225 <colspec colwidth="8*" align="left"/>
40226 <colspec colwidth="6*" align="center"/>
40227 <colspec colwidth="6*" align="center"/>
40228 <colspec colwidth="6*" align="right"/>
40229 <tbody>
40230 <row>
40231 <entry><option>mailstore_suffix</option></entry>
40232 <entry>Use: <emphasis>appendfile</emphasis></entry>
40233 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
40234 <entry>Default: <emphasis>unset</emphasis></entry>
40235 </row>
40236 </tbody>
40237 </tgroup>
40238 </informaltable>
40239 <para>
40240 This option applies only to deliveries in mailstore format, and is described in
40241 section <xref linkend="SECTopdir"/> below.
40242 </para>
40243 <para>
40244 <indexterm role="option">
40245 <primary><option>mbx_format</option></primary>
40246 </indexterm>
40247 </para>
40248 <informaltable frame="all">
40249 <tgroup cols="4" colsep="0" rowsep="0">
40250 <colspec colwidth="8*" align="left"/>
40251 <colspec colwidth="6*" align="center"/>
40252 <colspec colwidth="6*" align="center"/>
40253 <colspec colwidth="6*" align="right"/>
40254 <tbody>
40255 <row>
40256 <entry><option>mbx_format</option></entry>
40257 <entry>Use: <emphasis>appendfile</emphasis></entry>
40258 <entry>Type: <emphasis>boolean</emphasis></entry>
40259 <entry>Default: <emphasis>false</emphasis></entry>
40260 </row>
40261 </tbody>
40262 </tgroup>
40263 </informaltable>
40264 <para>
40265 <indexterm role="concept">
40266 <primary>locking files</primary>
40267 </indexterm>
40268 <indexterm role="concept">
40269 <primary>file</primary>
40270 <secondary>locking</secondary>
40271 </indexterm>
40272 <indexterm role="concept">
40273 <primary>file</primary>
40274 <secondary>MBX format</secondary>
40275 </indexterm>
40276 <indexterm role="concept">
40277 <primary>MBX format, specifying</primary>
40278 </indexterm>
40279 This option is available only if Exim has been compiled with SUPPORT_MBX
40280 set in <filename>Local/Makefile</filename>. If <option>mbx_format</option> is set with the <option>file</option> option,
40281 the message is appended to the mailbox file in MBX format instead of
40282 traditional Unix format. This format is supported by Pine4 and its associated
40283 IMAP and POP daemons, by means of the <emphasis>c-client</emphasis> library that they all use.
40284 </para>
40285 <para>
40286 <emphasis role="bold">Note</emphasis>: The <option>message_prefix</option> and <option>message_suffix</option> options are not
40287 automatically changed by the use of <option>mbx_format</option>. They should normally be set
40288 empty when using MBX format, so this option almost always appears in this
40289 combination:
40290 </para>
40291 <literallayout class="monospaced">
40292 mbx_format = true
40293 message_prefix =
40294 message_suffix =
40295 </literallayout>
40296 <para>
40297 If none of the locking options are mentioned in the configuration,
40298 <option>use_mbx_lock</option> is assumed and the other locking options default to false. It
40299 is possible to specify the other kinds of locking with <option>mbx_format</option>, but
40300 <option>use_fcntl_lock</option> and <option>use_mbx_lock</option> are mutually exclusive. MBX locking
40301 interworks with <emphasis>c-client</emphasis>, providing for shared access to the mailbox. It
40302 should not be used if any program that does not use this form of locking is
40303 going to access the mailbox, nor should it be used if the mailbox file is NFS
40304 mounted, because it works only when the mailbox is accessed from a single host.
40305 </para>
40306 <para>
40307 If you set <option>use_fcntl_lock</option> with an MBX-format mailbox, you cannot use
40308 the standard version of <emphasis>c-client</emphasis>, because as long as it has a mailbox open
40309 (this means for the whole of a Pine or IMAP session), Exim will not be able to
40310 append messages to it.
40311 </para>
40312 <para>
40313 <indexterm role="option">
40314 <primary><option>message_prefix</option></primary>
40315 </indexterm>
40316 </para>
40317 <informaltable frame="all">
40318 <tgroup cols="4" colsep="0" rowsep="0">
40319 <colspec colwidth="8*" align="left"/>
40320 <colspec colwidth="6*" align="center"/>
40321 <colspec colwidth="6*" align="center"/>
40322 <colspec colwidth="6*" align="right"/>
40323 <tbody>
40324 <row>
40325 <entry><option>message_prefix</option></entry>
40326 <entry>Use: <emphasis>appendfile</emphasis></entry>
40327 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
40328 <entry>Default: <emphasis>see below</emphasis></entry>
40329 </row>
40330 </tbody>
40331 </tgroup>
40332 </informaltable>
40333 <para>
40334 <indexterm role="concept">
40335 <primary><quote>From</quote> line</primary>
40336 </indexterm>
40337 The string specified here is expanded and output at the start of every message.
40338 The default is unset unless <option>file</option> is specified and <option>use_bsmtp</option> is not set,
40339 in which case it is:
40340 </para>
40341 <literallayout class="monospaced">
40342 message_prefix = "From ${if def:return_path{$return_path}\
40343   {MAILER-DAEMON}} $tod_bsdinbox\n"
40344 </literallayout>
40345 <para>
40346 <emphasis role="bold">Note:</emphasis> If you set <option>use_crlf</option> true, you must change any occurrences of
40347 <literal>\n</literal> to <literal>\r\n</literal> in <option>message_prefix</option>.
40348 </para>
40349 <para>
40350 <indexterm role="option">
40351 <primary><option>message_suffix</option></primary>
40352 </indexterm>
40353 </para>
40354 <informaltable frame="all">
40355 <tgroup cols="4" colsep="0" rowsep="0">
40356 <colspec colwidth="8*" align="left"/>
40357 <colspec colwidth="6*" align="center"/>
40358 <colspec colwidth="6*" align="center"/>
40359 <colspec colwidth="6*" align="right"/>
40360 <tbody>
40361 <row>
40362 <entry><option>message_suffix</option></entry>
40363 <entry>Use: <emphasis>appendfile</emphasis></entry>
40364 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
40365 <entry>Default: <emphasis>see below</emphasis></entry>
40366 </row>
40367 </tbody>
40368 </tgroup>
40369 </informaltable>
40370 <para>
40371 The string specified here is expanded and output at the end of every message.
40372 The default is unset unless <option>file</option> is specified and <option>use_bsmtp</option> is not set,
40373 in which case it is a single newline character. The suffix can be suppressed by
40374 setting
40375 </para>
40376 <literallayout class="monospaced">
40377 message_suffix =
40378 </literallayout>
40379 <para>
40380 <emphasis role="bold">Note:</emphasis> If you set <option>use_crlf</option> true, you must change any occurrences of
40381 <literal>\n</literal> to <literal>\r\n</literal> in <option>message_suffix</option>.
40382 </para>
40383 <para>
40384 <indexterm role="option">
40385 <primary><option>mode</option></primary>
40386 </indexterm>
40387 </para>
40388 <informaltable frame="all">
40389 <tgroup cols="4" colsep="0" rowsep="0">
40390 <colspec colwidth="8*" align="left"/>
40391 <colspec colwidth="6*" align="center"/>
40392 <colspec colwidth="6*" align="center"/>
40393 <colspec colwidth="6*" align="right"/>
40394 <tbody>
40395 <row>
40396 <entry><option>mode</option></entry>
40397 <entry>Use: <emphasis>appendfile</emphasis></entry>
40398 <entry>Type: <emphasis>octal integer</emphasis></entry>
40399 <entry>Default: <emphasis>0600</emphasis></entry>
40400 </row>
40401 </tbody>
40402 </tgroup>
40403 </informaltable>
40404 <para>
40405 If the output file is created, it is given this mode. If it already exists and
40406 has wider permissions, they are reduced to this mode. If it has narrower
40407 permissions, an error occurs unless <option>mode_fail_narrower</option> is false. However,
40408 if the delivery is the result of a <option>save</option> command in a filter file specifying
40409 a particular mode, the mode of the output file is always forced to take that
40410 value, and this option is ignored.
40411 </para>
40412 <para>
40413 <indexterm role="option">
40414 <primary><option>mode_fail_narrower</option></primary>
40415 </indexterm>
40416 </para>
40417 <informaltable frame="all">
40418 <tgroup cols="4" colsep="0" rowsep="0">
40419 <colspec colwidth="8*" align="left"/>
40420 <colspec colwidth="6*" align="center"/>
40421 <colspec colwidth="6*" align="center"/>
40422 <colspec colwidth="6*" align="right"/>
40423 <tbody>
40424 <row>
40425 <entry><option>mode_fail_narrower</option></entry>
40426 <entry>Use: <emphasis>appendfile</emphasis></entry>
40427 <entry>Type: <emphasis>boolean</emphasis></entry>
40428 <entry>Default: <emphasis>true</emphasis></entry>
40429 </row>
40430 </tbody>
40431 </tgroup>
40432 </informaltable>
40433 <para>
40434 This option applies in the case when an existing mailbox file has a narrower
40435 mode than that specified by the <option>mode</option> option. If <option>mode_fail_narrower</option> is
40436 true, the delivery is deferred (<quote>mailbox has the wrong mode</quote>); otherwise Exim
40437 continues with the delivery attempt, using the existing mode of the file.
40438 </para>
40439 <para>
40440 <indexterm role="option">
40441 <primary><option>notify_comsat</option></primary>
40442 </indexterm>
40443 </para>
40444 <informaltable frame="all">
40445 <tgroup cols="4" colsep="0" rowsep="0">
40446 <colspec colwidth="8*" align="left"/>
40447 <colspec colwidth="6*" align="center"/>
40448 <colspec colwidth="6*" align="center"/>
40449 <colspec colwidth="6*" align="right"/>
40450 <tbody>
40451 <row>
40452 <entry><option>notify_comsat</option></entry>
40453 <entry>Use: <emphasis>appendfile</emphasis></entry>
40454 <entry>Type: <emphasis>boolean</emphasis></entry>
40455 <entry>Default: <emphasis>false</emphasis></entry>
40456 </row>
40457 </tbody>
40458 </tgroup>
40459 </informaltable>
40460 <para>
40461 If this option is true, the <emphasis>comsat</emphasis> daemon is notified after every
40462 successful delivery to a user mailbox. This is the daemon that notifies logged
40463 on users about incoming mail.
40464 </para>
40465 <para>
40466 <indexterm role="option">
40467 <primary><option>quota</option></primary>
40468 </indexterm>
40469 </para>
40470 <informaltable frame="all">
40471 <tgroup cols="4" colsep="0" rowsep="0">
40472 <colspec colwidth="8*" align="left"/>
40473 <colspec colwidth="6*" align="center"/>
40474 <colspec colwidth="6*" align="center"/>
40475 <colspec colwidth="6*" align="right"/>
40476 <tbody>
40477 <row>
40478 <entry><option>quota</option></entry>
40479 <entry>Use: <emphasis>appendfile</emphasis></entry>
40480 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
40481 <entry>Default: <emphasis>unset</emphasis></entry>
40482 </row>
40483 </tbody>
40484 </tgroup>
40485 </informaltable>
40486 <para>
40487 <indexterm role="concept">
40488 <primary>quota</primary>
40489 <secondary>imposed by Exim</secondary>
40490 </indexterm>
40491 This option imposes a limit on the size of the file to which Exim is appending,
40492 or to the total space used in the directory tree when the <option>directory</option> option
40493 is set. In the latter case, computation of the space used is expensive, because
40494 all the files in the directory (and any sub-directories) have to be
40495 individually inspected and their sizes summed. (See <option>quota_size_regex</option> and
40496 <option>maildir_use_size_file</option> for ways to avoid this in environments where users
40497 have no shell access to their mailboxes).
40498 </para>
40499 <para>
40500 As there is no interlock against two simultaneous deliveries into a
40501 multi-file mailbox, it is possible for the quota to be overrun in this case.
40502 For single-file mailboxes, of course, an interlock is a necessity.
40503 </para>
40504 <para>
40505 A file&#x2019;s size is taken as its <emphasis>used</emphasis> value. Because of blocking effects, this
40506 may be a lot less than the actual amount of disk space allocated to the file.
40507 If the sizes of a number of files are being added up, the rounding effect can
40508 become quite noticeable, especially on systems that have large block sizes.
40509 Nevertheless, it seems best to stick to the <emphasis>used</emphasis> figure, because this is
40510 the obvious value which users understand most easily.
40511 </para>
40512 <para>
40513 The value of the option is expanded, and must then be a numerical value
40514 (decimal point allowed), optionally followed by one of the letters K, M, or G,
40515 for kilobytes, megabytes, or gigabytes. If Exim is running on a system with
40516 large file support (Linux and FreeBSD have this), mailboxes larger than 2G can
40517 be handled.
40518 </para>
40519 <para>
40520 <emphasis role="bold">Note</emphasis>: A value of zero is interpreted as <quote>no quota</quote>.
40521 </para>
40522 <para>
40523 The expansion happens while Exim is running as root, before it changes uid for
40524 the delivery. This means that files that are inaccessible to the end user can
40525 be used to hold quota values that are looked up in the expansion. When delivery
40526 fails because this quota is exceeded, the handling of the error is as for
40527 system quota failures.
40528 </para>
40529 <para>
40530 By default, Exim&#x2019;s quota checking mimics system quotas, and restricts the
40531 mailbox to the specified maximum size, though the value is not accurate to the
40532 last byte, owing to separator lines and additional headers that may get added
40533 during message delivery. When a mailbox is nearly full, large messages may get
40534 refused even though small ones are accepted, because the size of the current
40535 message is added to the quota when the check is made. This behaviour can be
40536 changed by setting <option>quota_is_inclusive</option> false. When this is done, the check
40537 for exceeding the quota does not include the current message. Thus, deliveries
40538 continue until the quota has been exceeded; thereafter, no further messages are
40539 delivered. See also <option>quota_warn_threshold</option>.
40540 </para>
40541 <para>
40542 <indexterm role="option">
40543 <primary><option>quota_directory</option></primary>
40544 </indexterm>
40545 </para>
40546 <informaltable frame="all">
40547 <tgroup cols="4" colsep="0" rowsep="0">
40548 <colspec colwidth="8*" align="left"/>
40549 <colspec colwidth="6*" align="center"/>
40550 <colspec colwidth="6*" align="center"/>
40551 <colspec colwidth="6*" align="right"/>
40552 <tbody>
40553 <row>
40554 <entry><option>quota_directory</option></entry>
40555 <entry>Use: <emphasis>appendfile</emphasis></entry>
40556 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
40557 <entry>Default: <emphasis>unset</emphasis></entry>
40558 </row>
40559 </tbody>
40560 </tgroup>
40561 </informaltable>
40562 <para>
40563 This option defines the directory to check for quota purposes when delivering
40564 into individual files. The default is the delivery directory, or, if a file
40565 called <filename>maildirfolder</filename> exists in a maildir directory, the parent of the
40566 delivery directory.
40567 </para>
40568 <para>
40569 <indexterm role="option">
40570 <primary><option>quota_filecount</option></primary>
40571 </indexterm>
40572 </para>
40573 <informaltable frame="all">
40574 <tgroup cols="4" colsep="0" rowsep="0">
40575 <colspec colwidth="8*" align="left"/>
40576 <colspec colwidth="6*" align="center"/>
40577 <colspec colwidth="6*" align="center"/>
40578 <colspec colwidth="6*" align="right"/>
40579 <tbody>
40580 <row>
40581 <entry><option>quota_filecount</option></entry>
40582 <entry>Use: <emphasis>appendfile</emphasis></entry>
40583 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
40584 <entry>Default: <emphasis>0</emphasis></entry>
40585 </row>
40586 </tbody>
40587 </tgroup>
40588 </informaltable>
40589 <para>
40590 This option applies when the <option>directory</option> option is set. It limits the total
40591 number of files in the directory (compare the inode limit in system quotas). It
40592 can only be used if <option>quota</option> is also set. The value is expanded; an expansion
40593 failure causes delivery to be deferred. A value of zero is interpreted as
40594 <quote>no quota</quote>.
40595 </para>
40596 <para>
40597 <indexterm role="option">
40598 <primary><option>quota_is_inclusive</option></primary>
40599 </indexterm>
40600 </para>
40601 <informaltable frame="all">
40602 <tgroup cols="4" colsep="0" rowsep="0">
40603 <colspec colwidth="8*" align="left"/>
40604 <colspec colwidth="6*" align="center"/>
40605 <colspec colwidth="6*" align="center"/>
40606 <colspec colwidth="6*" align="right"/>
40607 <tbody>
40608 <row>
40609 <entry><option>quota_is_inclusive</option></entry>
40610 <entry>Use: <emphasis>appendfile</emphasis></entry>
40611 <entry>Type: <emphasis>boolean</emphasis></entry>
40612 <entry>Default: <emphasis>true</emphasis></entry>
40613 </row>
40614 </tbody>
40615 </tgroup>
40616 </informaltable>
40617 <para>
40618 See <option>quota</option> above.
40619 </para>
40620 <para>
40621 <indexterm role="option">
40622 <primary><option>quota_size_regex</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>quota_size_regex</option></entry>
40634 <entry>Use: <emphasis>appendfile</emphasis></entry>
40635 <entry>Type: <emphasis>string</emphasis></entry>
40636 <entry>Default: <emphasis>unset</emphasis></entry>
40637 </row>
40638 </tbody>
40639 </tgroup>
40640 </informaltable>
40641 <para>
40642 This option applies when one of the delivery modes that writes a separate file
40643 for each message is being used. When Exim wants to find the size of one of
40644 these files in order to test the quota, it first checks <option>quota_size_regex</option>.
40645 If this is set to a regular expression that matches the file name, and it
40646 captures one string, that string is interpreted as a representation of the
40647 file&#x2019;s size. The value of <option>quota_size_regex</option> is not expanded.
40648 </para>
40649 <para>
40650 This feature is useful only when users have no shell access to their mailboxes
40651 &ndash; otherwise they could defeat the quota simply by renaming the files. This
40652 facility can be used with maildir deliveries, by setting <option>maildir_tag</option> to add
40653 the file length to the file name. For example:
40654 </para>
40655 <literallayout class="monospaced">
40656 maildir_tag = ,S=$message_size
40657 quota_size_regex = ,S=(\d+)
40658 </literallayout>
40659 <para>
40660 An alternative to <varname>$message_size</varname> is <varname>$message_linecount</varname>, which contains the
40661 number of lines in the message.
40662 </para>
40663 <para>
40664 The regular expression should not assume that the length is at the end of the
40665 file name (even though <option>maildir_tag</option> puts it there) because maildir MUAs
40666 sometimes add other information onto the ends of message file names.
40667 </para>
40668 <para>
40669 Section <xref linkend="SECID136"/> contains further information.
40670 </para>
40671 <para>
40672 <indexterm role="option">
40673 <primary><option>quota_warn_message</option></primary>
40674 </indexterm>
40675 </para>
40676 <informaltable frame="all">
40677 <tgroup cols="4" colsep="0" rowsep="0">
40678 <colspec colwidth="8*" align="left"/>
40679 <colspec colwidth="6*" align="center"/>
40680 <colspec colwidth="6*" align="center"/>
40681 <colspec colwidth="6*" align="right"/>
40682 <tbody>
40683 <row>
40684 <entry><option>quota_warn_message</option></entry>
40685 <entry>Use: <emphasis>appendfile</emphasis></entry>
40686 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
40687 <entry>Default: <emphasis>see below</emphasis></entry>
40688 </row>
40689 </tbody>
40690 </tgroup>
40691 </informaltable>
40692 <para>
40693 See below for the use of this option. If it is not set when
40694 <option>quota_warn_threshold</option> is set, it defaults to
40695 </para>
40696 <literallayout class="monospaced">
40697 quota_warn_message = "\
40698   To: $local_part@$domain\n\
40699   Subject: Your mailbox\n\n\
40700   This message is automatically created \
40701   by mail delivery software.\n\n\
40702   The size of your mailbox has exceeded \
40703   a warning threshold that is\n\
40704   set by the system administrator.\n"
40705 </literallayout>
40706 <para>
40707 <indexterm role="option">
40708 <primary><option>quota_warn_threshold</option></primary>
40709 </indexterm>
40710 </para>
40711 <informaltable frame="all">
40712 <tgroup cols="4" colsep="0" rowsep="0">
40713 <colspec colwidth="8*" align="left"/>
40714 <colspec colwidth="6*" align="center"/>
40715 <colspec colwidth="6*" align="center"/>
40716 <colspec colwidth="6*" align="right"/>
40717 <tbody>
40718 <row>
40719 <entry><option>quota_warn_threshold</option></entry>
40720 <entry>Use: <emphasis>appendfile</emphasis></entry>
40721 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
40722 <entry>Default: <emphasis>0</emphasis></entry>
40723 </row>
40724 </tbody>
40725 </tgroup>
40726 </informaltable>
40727 <para>
40728 <indexterm role="concept">
40729 <primary>quota</primary>
40730 <secondary>warning threshold</secondary>
40731 </indexterm>
40732 <indexterm role="concept">
40733 <primary>mailbox</primary>
40734 <secondary>size warning</secondary>
40735 </indexterm>
40736 <indexterm role="concept">
40737 <primary>size</primary>
40738 <secondary>of mailbox</secondary>
40739 </indexterm>
40740 This option is expanded in the same way as <option>quota</option> (see above). If the
40741 resulting value is greater than zero, and delivery of the message causes the
40742 size of the file or total space in the directory tree to cross the given
40743 threshold, a warning message is sent. If <option>quota</option> is also set, the threshold
40744 may be specified as a percentage of it by following the value with a percent
40745 sign. For example:
40746 </para>
40747 <literallayout class="monospaced">
40748 quota = 10M
40749 quota_warn_threshold = 75%
40750 </literallayout>
40751 <para>
40752 If <option>quota</option> is not set, a setting of <option>quota_warn_threshold</option> that ends with a
40753 percent sign is ignored.
40754 </para>
40755 <para>
40756 The warning message itself is specified by the <option>quota_warn_message</option> option,
40757 and it must start with a <emphasis>To:</emphasis> header line containing the recipient(s) of the
40758 warning message. These do not necessarily have to include the recipient(s) of
40759 the original message. A <emphasis>Subject:</emphasis> line should also normally be supplied. You
40760 can include any other header lines that you want. If you do not include a
40761 <emphasis>From:</emphasis> line, the default is:
40762 </para>
40763 <literallayout class="monospaced">
40764 From: Mail Delivery System &lt;mailer-daemon@$qualify_domain_sender&gt;
40765 </literallayout>
40766 <para>
40767 <indexterm role="option">
40768 <primary><option>errors_reply_to</option></primary>
40769 </indexterm>
40770 If you supply a <emphasis>Reply-To:</emphasis> line, it overrides the global <option>errors_reply_to</option>
40771 option.
40772 </para>
40773 <para>
40774 The <option>quota</option> option does not have to be set in order to use this option; they
40775 are independent of one another except when the threshold is specified as a
40776 percentage.
40777 </para>
40778 <para>
40779 <indexterm role="option">
40780 <primary><option>use_bsmtp</option></primary>
40781 </indexterm>
40782 </para>
40783 <informaltable frame="all">
40784 <tgroup cols="4" colsep="0" rowsep="0">
40785 <colspec colwidth="8*" align="left"/>
40786 <colspec colwidth="6*" align="center"/>
40787 <colspec colwidth="6*" align="center"/>
40788 <colspec colwidth="6*" align="right"/>
40789 <tbody>
40790 <row>
40791 <entry><option>use_bsmtp</option></entry>
40792 <entry>Use: <emphasis>appendfile</emphasis></entry>
40793 <entry>Type: <emphasis>boolean</emphasis></entry>
40794 <entry>Default: <emphasis>false</emphasis></entry>
40795 </row>
40796 </tbody>
40797 </tgroup>
40798 </informaltable>
40799 <para>
40800 <indexterm role="concept">
40801 <primary>envelope sender</primary>
40802 </indexterm>
40803 If this option is set true, <command>appendfile</command> writes messages in <quote>batch SMTP</quote>
40804 format, with the envelope sender and recipient(s) included as SMTP commands. If
40805 you want to include a leading HELO command with such messages, you can do
40806 so by setting the <option>message_prefix</option> option. See section <xref linkend="SECTbatchSMTP"/>
40807 for details of batch SMTP.
40808 </para>
40809 <para>
40810 <indexterm role="option">
40811 <primary><option>use_crlf</option></primary>
40812 </indexterm>
40813 </para>
40814 <informaltable frame="all">
40815 <tgroup cols="4" colsep="0" rowsep="0">
40816 <colspec colwidth="8*" align="left"/>
40817 <colspec colwidth="6*" align="center"/>
40818 <colspec colwidth="6*" align="center"/>
40819 <colspec colwidth="6*" align="right"/>
40820 <tbody>
40821 <row>
40822 <entry><option>use_crlf</option></entry>
40823 <entry>Use: <emphasis>appendfile</emphasis></entry>
40824 <entry>Type: <emphasis>boolean</emphasis></entry>
40825 <entry>Default: <emphasis>false</emphasis></entry>
40826 </row>
40827 </tbody>
40828 </tgroup>
40829 </informaltable>
40830 <para>
40831 <indexterm role="concept">
40832 <primary>carriage return</primary>
40833 </indexterm>
40834 <indexterm role="concept">
40835 <primary>linefeed</primary>
40836 </indexterm>
40837 This option causes lines to be terminated with the two-character CRLF sequence
40838 (carriage return, linefeed) instead of just a linefeed character. In the case
40839 of batched SMTP, the byte sequence written to the file is then an exact image
40840 of what would be sent down a real SMTP connection.
40841 </para>
40842 <para>
40843 <emphasis role="bold">Note:</emphasis> The contents of the <option>message_prefix</option> and <option>message_suffix</option> options
40844 (which are used to supply the traditional <quote>From&nbsp;</quote> and blank line separators
40845 in Berkeley-style mailboxes) are written verbatim, so must contain their own
40846 carriage return characters if these are needed. In cases where these options
40847 have non-empty defaults, the values end with a single linefeed, so they must be
40848 changed to end with <literal>\r\n</literal> if <option>use_crlf</option> is set.
40849 </para>
40850 <para>
40851 <indexterm role="option">
40852 <primary><option>use_fcntl_lock</option></primary>
40853 </indexterm>
40854 </para>
40855 <informaltable frame="all">
40856 <tgroup cols="4" colsep="0" rowsep="0">
40857 <colspec colwidth="8*" align="left"/>
40858 <colspec colwidth="6*" align="center"/>
40859 <colspec colwidth="6*" align="center"/>
40860 <colspec colwidth="6*" align="right"/>
40861 <tbody>
40862 <row>
40863 <entry><option>use_fcntl_lock</option></entry>
40864 <entry>Use: <emphasis>appendfile</emphasis></entry>
40865 <entry>Type: <emphasis>boolean</emphasis></entry>
40866 <entry>Default: <emphasis>see below</emphasis></entry>
40867 </row>
40868 </tbody>
40869 </tgroup>
40870 </informaltable>
40871 <para>
40872 This option controls the use of the <function>fcntl()</function> function to lock a file for
40873 exclusive use when a message is being appended. It is set by default unless
40874 <option>use_flock_lock</option> is set. Otherwise, it should be turned off only if you know
40875 that all your MUAs use lock file locking. When both <option>use_fcntl_lock</option> and
40876 <option>use_flock_lock</option> are unset, <option>use_lockfile</option> must be set.
40877 </para>
40878 <para>
40879 <indexterm role="option">
40880 <primary><option>use_flock_lock</option></primary>
40881 </indexterm>
40882 </para>
40883 <informaltable frame="all">
40884 <tgroup cols="4" colsep="0" rowsep="0">
40885 <colspec colwidth="8*" align="left"/>
40886 <colspec colwidth="6*" align="center"/>
40887 <colspec colwidth="6*" align="center"/>
40888 <colspec colwidth="6*" align="right"/>
40889 <tbody>
40890 <row>
40891 <entry><option>use_flock_lock</option></entry>
40892 <entry>Use: <emphasis>appendfile</emphasis></entry>
40893 <entry>Type: <emphasis>boolean</emphasis></entry>
40894 <entry>Default: <emphasis>false</emphasis></entry>
40895 </row>
40896 </tbody>
40897 </tgroup>
40898 </informaltable>
40899 <para>
40900 This option is provided to support the use of <function>flock()</function> for file locking, for
40901 the few situations where it is needed. Most modern operating systems support
40902 <function>fcntl()</function> and <function>lockf()</function> locking, and these two functions interwork with
40903 each other. Exim uses <function>fcntl()</function> locking by default.
40904 </para>
40905 <para>
40906 This option is required only if you are using an operating system where
40907 <function>flock()</function> is used by programs that access mailboxes (typically MUAs), and
40908 where <function>flock()</function> does not correctly interwork with <function>fcntl()</function>. You can use
40909 both <function>fcntl()</function> and <function>flock()</function> locking simultaneously if you want.
40910 </para>
40911 <para>
40912 <indexterm role="concept">
40913 <primary>Solaris</primary>
40914 <secondary><function>flock()</function> support</secondary>
40915 </indexterm>
40916 Not all operating systems provide <function>flock()</function>. Some versions of Solaris do not
40917 have it (and some, I think, provide a not quite right version built on top of
40918 <function>lockf()</function>). If the OS does not have <function>flock()</function>, Exim will be built without
40919 the ability to use it, and any attempt to do so will cause a configuration
40920 error.
40921 </para>
40922 <para>
40923 <emphasis role="bold">Warning</emphasis>: <function>flock()</function> locks do not work on NFS files (unless <function>flock()</function>
40924 is just being mapped onto <function>fcntl()</function> by the OS).
40925 </para>
40926 <para>
40927 <indexterm role="option">
40928 <primary><option>use_lockfile</option></primary>
40929 </indexterm>
40930 </para>
40931 <informaltable frame="all">
40932 <tgroup cols="4" colsep="0" rowsep="0">
40933 <colspec colwidth="8*" align="left"/>
40934 <colspec colwidth="6*" align="center"/>
40935 <colspec colwidth="6*" align="center"/>
40936 <colspec colwidth="6*" align="right"/>
40937 <tbody>
40938 <row>
40939 <entry><option>use_lockfile</option></entry>
40940 <entry>Use: <emphasis>appendfile</emphasis></entry>
40941 <entry>Type: <emphasis>boolean</emphasis></entry>
40942 <entry>Default: <emphasis>see below</emphasis></entry>
40943 </row>
40944 </tbody>
40945 </tgroup>
40946 </informaltable>
40947 <para>
40948 If this option is turned off, Exim does not attempt to create a lock file when
40949 appending to a mailbox file. In this situation, the only locking is by
40950 <function>fcntl()</function>. You should only turn <option>use_lockfile</option> off if you are absolutely
40951 sure that every MUA that is ever going to look at your users&#x2019; mailboxes uses
40952 <function>fcntl()</function> rather than a lock file, and even then only when you are not
40953 delivering over NFS from more than one host.
40954 </para>
40955 <para>
40956 <indexterm role="concept">
40957 <primary>NFS</primary>
40958 <secondary>lock file</secondary>
40959 </indexterm>
40960 In order to append to an NFS file safely from more than one host, it is
40961 necessary to take out a lock <emphasis>before</emphasis> opening the file, and the lock file
40962 achieves this. Otherwise, even with <function>fcntl()</function> locking, there is a risk of
40963 file corruption.
40964 </para>
40965 <para>
40966 The <option>use_lockfile</option> option is set by default unless <option>use_mbx_lock</option> is set.
40967 It is not possible to turn both <option>use_lockfile</option> and <option>use_fcntl_lock</option> off,
40968 except when <option>mbx_format</option> is set.
40969 </para>
40970 <para>
40971 <indexterm role="option">
40972 <primary><option>use_mbx_lock</option></primary>
40973 </indexterm>
40974 </para>
40975 <informaltable frame="all">
40976 <tgroup cols="4" colsep="0" rowsep="0">
40977 <colspec colwidth="8*" align="left"/>
40978 <colspec colwidth="6*" align="center"/>
40979 <colspec colwidth="6*" align="center"/>
40980 <colspec colwidth="6*" align="right"/>
40981 <tbody>
40982 <row>
40983 <entry><option>use_mbx_lock</option></entry>
40984 <entry>Use: <emphasis>appendfile</emphasis></entry>
40985 <entry>Type: <emphasis>boolean</emphasis></entry>
40986 <entry>Default: <emphasis>see below</emphasis></entry>
40987 </row>
40988 </tbody>
40989 </tgroup>
40990 </informaltable>
40991 <para>
40992 This option is available only if Exim has been compiled with SUPPORT_MBX
40993 set in <filename>Local/Makefile</filename>. Setting the option specifies that special MBX
40994 locking rules be used. It is set by default if <option>mbx_format</option> is set and none
40995 of the locking options are mentioned in the configuration. The locking rules
40996 are the same as are used by the <emphasis>c-client</emphasis> library that underlies Pine and
40997 the IMAP4 and POP daemons that come with it (see the discussion below). The
40998 rules allow for shared access to the mailbox. However, this kind of locking
40999 does not work when the mailbox is NFS mounted.
41000 </para>
41001 <para>
41002 You can set <option>use_mbx_lock</option> with either (or both) of <option>use_fcntl_lock</option> and
41003 <option>use_flock_lock</option> to control what kind of locking is used in implementing the
41004 MBX locking rules. The default is to use <function>fcntl()</function> if <option>use_mbx_lock</option> is set
41005 without <option>use_fcntl_lock</option> or <option>use_flock_lock</option>.
41006 </para>
41007 </section>
41008 <section id="SECTopappend">
41009 <title>Operational details for appending</title>
41010 <para>
41011 <indexterm role="concept">
41012 <primary>appending to a file</primary>
41013 </indexterm>
41014 <indexterm role="concept">
41015 <primary>file</primary>
41016 <secondary>appending</secondary>
41017 </indexterm>
41018 Before appending to a file, the following preparations are made:
41019 </para>
41020 <itemizedlist>
41021 <listitem>
41022 <para>
41023 If the name of the file is <filename>/dev/null</filename>, no action is taken, and a success
41024 return is given.
41025 </para>
41026 </listitem>
41027 <listitem>
41028 <para>
41029 <indexterm role="concept">
41030 <primary>directory creation</primary>
41031 </indexterm>
41032 If any directories on the file&#x2019;s path are missing, Exim creates them if the
41033 <option>create_directory</option> option is set. A created directory&#x2019;s mode is given by the
41034 <option>directory_mode</option> option.
41035 </para>
41036 </listitem>
41037 <listitem>
41038 <para>
41039 If <option>file_format</option> is set, the format of an existing file is checked. If this
41040 indicates that a different transport should be used, control is passed to that
41041 transport.
41042 </para>
41043 </listitem>
41044 <listitem>
41045 <para>
41046 <indexterm role="concept">
41047 <primary>file</primary>
41048 <secondary>locking</secondary>
41049 </indexterm>
41050 <indexterm role="concept">
41051 <primary>locking files</primary>
41052 </indexterm>
41053 <indexterm role="concept">
41054 <primary>NFS</primary>
41055 <secondary>lock file</secondary>
41056 </indexterm>
41057 If <option>use_lockfile</option> is set, a lock file is built in a way that will work
41058 reliably over NFS, as follows:
41059 </para>
41060 <orderedlist numeration="arabic">
41061 <listitem>
41062 <para>
41063 Create a <quote>hitching post</quote> file whose name is that of the lock file with the
41064 current time, primary host name, and process id added, by opening for writing
41065 as a new file. If this fails with an access error, delivery is deferred.
41066 </para>
41067 </listitem>
41068 <listitem>
41069 <para>
41070 Close the hitching post file, and hard link it to the lock file name.
41071 </para>
41072 </listitem>
41073 <listitem>
41074 <para>
41075 If the call to <function>link()</function> succeeds, creation of the lock file has succeeded.
41076 Unlink the hitching post name.
41077 </para>
41078 </listitem>
41079 <listitem>
41080 <para>
41081 Otherwise, use <function>stat()</function> to get information about the hitching post file, and
41082 then unlink hitching post name. If the number of links is exactly two, creation
41083 of the lock file succeeded but something (for example, an NFS server crash and
41084 restart) caused this fact not to be communicated to the <function>link()</function> call.
41085 </para>
41086 </listitem>
41087 <listitem>
41088 <para>
41089 If creation of the lock file failed, wait for <option>lock_interval</option> and try again,
41090 up to <option>lock_retries</option> times. However, since any program that writes to a
41091 mailbox should complete its task very quickly, it is reasonable to time out old
41092 lock files that are normally the result of user agent and system crashes. If an
41093 existing lock file is older than <option>lockfile_timeout</option> Exim attempts to unlink
41094 it before trying again.
41095 </para>
41096 </listitem>
41097 </orderedlist>
41098 </listitem>
41099 <listitem>
41100 <para>
41101 A call is made to <function>lstat()</function> to discover whether the main file exists, and if
41102 so, what its characteristics are. If <function>lstat()</function> fails for any reason other
41103 than non-existence, delivery is deferred.
41104 </para>
41105 </listitem>
41106 <listitem>
41107 <para>
41108 <indexterm role="concept">
41109 <primary>symbolic link</primary>
41110 <secondary>to mailbox</secondary>
41111 </indexterm>
41112 <indexterm role="concept">
41113 <primary>mailbox</primary>
41114 <secondary>symbolic link</secondary>
41115 </indexterm>
41116 If the file does exist and is a symbolic link, delivery is deferred, unless the
41117 <option>allow_symlink</option> option is set, in which case the ownership of the link is
41118 checked, and then <function>stat()</function> is called to find out about the real file, which
41119 is then subjected to the checks below. The check on the top-level link
41120 ownership prevents one user creating a link for another&#x2019;s mailbox in a sticky
41121 directory, though allowing symbolic links in this case is definitely not a good
41122 idea. If there is a chain of symbolic links, the intermediate ones are not
41123 checked.
41124 </para>
41125 </listitem>
41126 <listitem>
41127 <para>
41128 If the file already exists but is not a regular file, or if the file&#x2019;s owner
41129 and group (if the group is being checked &ndash; see <option>check_group</option> above) are
41130 different from the user and group under which the delivery is running,
41131 delivery is deferred.
41132 </para>
41133 </listitem>
41134 <listitem>
41135 <para>
41136 If the file&#x2019;s permissions are more generous than specified, they are reduced.
41137 If they are insufficient, delivery is deferred, unless <option>mode_fail_narrower</option>
41138 is set false, in which case the delivery is tried using the existing
41139 permissions.
41140 </para>
41141 </listitem>
41142 <listitem>
41143 <para>
41144 The file&#x2019;s inode number is saved, and the file is then opened for appending.
41145 If this fails because the file has vanished, <command>appendfile</command> behaves as if it
41146 hadn&#x2019;t existed (see below). For any other failures, delivery is deferred.
41147 </para>
41148 </listitem>
41149 <listitem>
41150 <para>
41151 If the file is opened successfully, check that the inode number hasn&#x2019;t
41152 changed, that it is still a regular file, and that the owner and permissions
41153 have not changed. If anything is wrong, defer delivery and freeze the message.
41154 </para>
41155 </listitem>
41156 <listitem>
41157 <para>
41158 If the file did not exist originally, defer delivery if the <option>file_must_exist</option>
41159 option is set. Otherwise, check that the file is being created in a permitted
41160 directory if the <option>create_file</option> option is set (deferring on failure), and then
41161 open for writing as a new file, with the O_EXCL and O_CREAT options,
41162 except when dealing with a symbolic link (the <option>allow_symlink</option> option must be
41163 set). In this case, which can happen if the link points to a non-existent file,
41164 the file is opened for writing using O_CREAT but not O_EXCL, because
41165 that prevents link following.
41166 </para>
41167 </listitem>
41168 <listitem>
41169 <para>
41170 <indexterm role="concept">
41171 <primary>loop</primary>
41172 <secondary>while file testing</secondary>
41173 </indexterm>
41174 If opening fails because the file exists, obey the tests given above for
41175 existing files. However, to avoid looping in a situation where the file is
41176 being continuously created and destroyed, the exists/not-exists loop is broken
41177 after 10 repetitions, and the message is then frozen.
41178 </para>
41179 </listitem>
41180 <listitem>
41181 <para>
41182 If opening fails with any other error, defer delivery.
41183 </para>
41184 </listitem>
41185 <listitem>
41186 <para>
41187 <indexterm role="concept">
41188 <primary>file</primary>
41189 <secondary>locking</secondary>
41190 </indexterm>
41191 <indexterm role="concept">
41192 <primary>locking files</primary>
41193 </indexterm>
41194 Once the file is open, unless both <option>use_fcntl_lock</option> and <option>use_flock_lock</option>
41195 are false, it is locked using <function>fcntl()</function> or <function>flock()</function> or both. If
41196 <option>use_mbx_lock</option> is false, an exclusive lock is requested in each case.
41197 However, if <option>use_mbx_lock</option> is true, Exim takes out a shared lock on the open
41198 file, and an exclusive lock on the file whose name is
41199 </para>
41200 <literallayout class="monospaced">
41201 /tmp/.&lt;device-number&gt;.&lt;inode-number&gt;
41202 </literallayout>
41203 <para>
41204 using the device and inode numbers of the open mailbox file, in accordance with
41205 the MBX locking rules. This file is created with a mode that is specified by
41206 the <option>lockfile_mode</option> option.
41207 </para>
41208 <para>
41209 If Exim fails to lock the file, there are two possible courses of action,
41210 depending on the value of the locking timeout. This is obtained from
41211 <option>lock_fcntl_timeout</option> or <option>lock_flock_timeout</option>, as appropriate.
41212 </para>
41213 <para>
41214 If the timeout value is zero, the file is closed, Exim waits for
41215 <option>lock_interval</option>, and then goes back and re-opens the file as above and tries
41216 to lock it again. This happens up to <option>lock_retries</option> times, after which the
41217 delivery is deferred.
41218 </para>
41219 <para>
41220 If the timeout has a value greater than zero, blocking calls to <function>fcntl()</function> or
41221 <function>flock()</function> are used (with the given timeout), so there has already been some
41222 waiting involved by the time locking fails. Nevertheless, Exim does not give up
41223 immediately. It retries up to
41224 </para>
41225 <literallayout class="monospaced">
41226 (lock_retries * lock_interval) / &lt;timeout&gt;
41227 </literallayout>
41228 <para>
41229 times (rounded up).
41230 </para>
41231 </listitem>
41232 </itemizedlist>
41233 <para>
41234 At the end of delivery, Exim closes the file (which releases the <function>fcntl()</function>
41235 and/or <function>flock()</function> locks) and then deletes the lock file if one was created.
41236 </para>
41237 </section>
41238 <section id="SECTopdir">
41239 <title>Operational details for delivery to a new file</title>
41240 <para>
41241 <indexterm role="concept">
41242 <primary>delivery</primary>
41243 <secondary>to single file</secondary>
41244 </indexterm>
41245 <indexterm role="concept">
41246 <primary><quote>From</quote> line</primary>
41247 </indexterm>
41248 When the <option>directory</option> option is set instead of <option>file</option>, each message is
41249 delivered into a newly-created file or set of files. When <command>appendfile</command> is
41250 activated directly from a <command>redirect</command> router, neither <option>file</option> nor
41251 <option>directory</option> is normally set, because the path for delivery is supplied by the
41252 router. (See for example, the <command>address_file</command> transport in the default
41253 configuration.) In this case, delivery is to a new file if either the path name
41254 ends in <literal>/</literal>, or the <option>maildir_format</option> or <option>mailstore_format</option> option is set.
41255 </para>
41256 <para>
41257 No locking is required while writing the message to a new file, so the various
41258 locking options of the transport are ignored. The <quote>From</quote> line that by default
41259 separates messages in a single file is not normally needed, nor is the escaping
41260 of message lines that start with <quote>From</quote>, and there is no need to ensure a
41261 newline at the end of each message. Consequently, the default values for
41262 <option>check_string</option>, <option>message_prefix</option>, and <option>message_suffix</option> are all unset when
41263 any of <option>directory</option>, <option>maildir_format</option>, or <option>mailstore_format</option> is set.
41264 </para>
41265 <para>
41266 If Exim is required to check a <option>quota</option> setting, it adds up the sizes of all
41267 the files in the delivery directory by default. However, you can specify a
41268 different directory by setting <option>quota_directory</option>. Also, for maildir
41269 deliveries (see below) the <filename>maildirfolder</filename> convention is honoured.
41270 </para>
41271 <para>
41272 <indexterm role="concept">
41273 <primary>maildir format</primary>
41274 </indexterm>
41275 <indexterm role="concept">
41276 <primary>mailstore format</primary>
41277 </indexterm>
41278 There are three different ways in which delivery to individual files can be
41279 done, controlled by the settings of the <option>maildir_format</option> and
41280 <option>mailstore_format</option> options. Note that code to support maildir or mailstore
41281 formats is not included in the binary unless SUPPORT_MAILDIR or
41282 SUPPORT_MAILSTORE, respectively, is set in <filename>Local/Makefile</filename>.
41283 </para>
41284 <para>
41285 <indexterm role="concept">
41286 <primary>directory creation</primary>
41287 </indexterm>
41288 In all three cases an attempt is made to create the directory and any necessary
41289 sub-directories if they do not exist, provided that the <option>create_directory</option>
41290 option is set (the default). The location of a created directory can be
41291 constrained by setting <option>create_file</option>. A created directory&#x2019;s mode is given by
41292 the <option>directory_mode</option> option. If creation fails, or if the
41293 <option>create_directory</option> option is not set when creation is required, delivery is
41294 deferred.
41295 </para>
41296 </section>
41297 <section id="SECTmaildirdelivery">
41298 <title>Maildir delivery</title>
41299 <para>
41300 <indexterm role="concept">
41301 <primary>maildir format</primary>
41302 <secondary>description of</secondary>
41303 </indexterm>
41304 If the <option>maildir_format</option> option is true, Exim delivers each message by writing
41305 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
41306 directory that is defined by the <option>directory</option> option (the <quote>delivery
41307 directory</quote>). If the delivery is successful, the file is renamed into the
41308 <filename>new</filename> subdirectory.
41309 </para>
41310 <para>
41311 In the file name, &lt;<emphasis>stime</emphasis>&gt; is the current time of day in seconds, and
41312 &lt;<emphasis>mtime</emphasis>&gt; is the microsecond fraction of the time. After a maildir delivery,
41313 Exim checks that the time-of-day clock has moved on by at least one microsecond
41314 before terminating the delivery process. This guarantees uniqueness for the
41315 file name. However, as a precaution, Exim calls <function>stat()</function> for the file before
41316 opening it. If any response other than ENOENT (does not exist) is given,
41317 Exim waits 2 seconds and tries again, up to <option>maildir_retries</option> times.
41318 </para>
41319 <para>
41320 Before Exim carries out a maildir delivery, it ensures that subdirectories
41321 called <filename>new</filename>, <filename>cur</filename>, and <filename>tmp</filename> exist in the delivery directory. If they
41322 do not exist, Exim tries to create them and any superior directories in their
41323 path, subject to the <option>create_directory</option> and <option>create_file</option> options. If the
41324 <option>maildirfolder_create_regex</option> option is set, and the regular expression it
41325 contains matches the delivery directory, Exim also ensures that a file called
41326 <filename>maildirfolder</filename> exists in the delivery directory. If a missing directory or
41327 <filename>maildirfolder</filename> file cannot be created, delivery is deferred.
41328 </para>
41329 <para>
41330 These features make it possible to use Exim to create all the necessary files
41331 and directories in a maildir mailbox, including subdirectories for maildir++
41332 folders. Consider this example:
41333 </para>
41334 <literallayout class="monospaced">
41335 maildir_format = true
41336 directory = /var/mail/$local_part\
41337            ${if eq{$local_part_suffix}{}{}\
41338            {/.${substr_1:$local_part_suffix}}}
41339 maildirfolder_create_regex = /\.[^/]+$
41340 </literallayout>
41341 <para>
41342 If <varname>$local_part_suffix</varname> is empty (there was no suffix for the local part),
41343 delivery is into a toplevel maildir with a name like <filename>/var/mail/pimbo</filename> (for
41344 the user called <emphasis>pimbo</emphasis>). The pattern in <option>maildirfolder_create_regex</option> does
41345 not match this name, so Exim will not look for or create the file
41346 <filename>/var/mail/pimbo/maildirfolder</filename>, though it will create
41347 <filename>/var/mail/pimbo/{cur,new,tmp}</filename> if necessary.
41348 </para>
41349 <para>
41350 However, if <varname>$local_part_suffix</varname> contains <literal>-eximusers</literal> (for example),
41351 delivery is into the maildir++ folder <filename>/var/mail/pimbo/.eximusers</filename>, which
41352 does match <option>maildirfolder_create_regex</option>. In this case, Exim will create
41353 <filename>/var/mail/pimbo/.eximusers/maildirfolder</filename> as well as the three maildir
41354 directories <filename>/var/mail/pimbo/.eximusers/{cur,new,tmp}</filename>.
41355 </para>
41356 <para>
41357 <emphasis role="bold">Warning:</emphasis> Take care when setting <option>maildirfolder_create_regex</option> that it does
41358 not inadvertently match the toplevel maildir directory, because a
41359 <filename>maildirfolder</filename> file at top level would completely break quota calculations.
41360 </para>
41361 <para>
41362 <indexterm role="concept">
41363 <primary>quota</primary>
41364 <secondary>in maildir delivery</secondary>
41365 </indexterm>
41366 <indexterm role="concept">
41367 <primary>maildir++</primary>
41368 </indexterm>
41369 If Exim is required to check a <option>quota</option> setting before a maildir delivery, and
41370 <option>quota_directory</option> is not set, it looks for a file called <filename>maildirfolder</filename> in
41371 the maildir directory (alongside <filename>new</filename>, <filename>cur</filename>, <filename>tmp</filename>). If this exists,
41372 Exim assumes the directory is a maildir++ folder directory, which is one level
41373 down from the user&#x2019;s top level mailbox directory. This causes it to start at
41374 the parent directory instead of the current directory when calculating the
41375 amount of space used.
41376 </para>
41377 <para>
41378 One problem with delivering into a multi-file mailbox is that it is
41379 computationally expensive to compute the size of the mailbox for quota
41380 checking. Various approaches have been taken to reduce the amount of work
41381 needed. The next two sections describe two of them. A third alternative is to
41382 use some external process for maintaining the size data, and use the expansion
41383 of the <option>mailbox_size</option> option as a way of importing it into Exim.
41384 </para>
41385 </section>
41386 <section id="SECID135">
41387 <title>Using tags to record message sizes</title>
41388 <para>
41389 If <option>maildir_tag</option> is set, the string is expanded for each delivery.
41390 When the maildir file is renamed into the <filename>new</filename> sub-directory, the
41391 tag is added to its name. However, if adding the tag takes the length of the
41392 name to the point where the test <function>stat()</function> call fails with ENAMETOOLONG,
41393 the tag is dropped and the maildir file is created with no tag.
41394 </para>
41395 <para>
41396 <indexterm role="variable">
41397 <primary><varname>$message_size</varname></primary>
41398 </indexterm>
41399 Tags can be used to encode the size of files in their names; see
41400 <option>quota_size_regex</option> above for an example. The expansion of <option>maildir_tag</option>
41401 happens after the message has been written. The value of the <varname>$message_size</varname>
41402 variable is set to the number of bytes actually written. If the expansion is
41403 forced to fail, the tag is ignored, but a non-forced failure causes delivery to
41404 be deferred. The expanded tag may contain any printing characters except <quote>/</quote>.
41405 Non-printing characters in the string are ignored; if the resulting string is
41406 empty, it is ignored. If it starts with an alphanumeric character, a leading
41407 colon is inserted; this default has not proven to be the path that popular
41408 maildir implementations have chosen (but changing it in Exim would break
41409 backwards compatibility).
41410 </para>
41411 <para>
41412 For one common implementation, you might set:
41413 </para>
41414 <literallayout class="monospaced">
41415 maildir_tag = ,S=${message_size}
41416 </literallayout>
41417 <para>
41418 but you should check the documentation of the other software to be sure.
41419 </para>
41420 <para>
41421 It is advisable to also set <option>quota_size_regex</option> when setting <option>maildir_tag</option>
41422 as this allows Exim to extract the size from your tag, instead of having to
41423 <function>stat()</function> each message file.
41424 </para>
41425 </section>
41426 <section id="SECID136">
41427 <title>Using a maildirsize file</title>
41428 <para>
41429 <indexterm role="concept">
41430 <primary>quota</primary>
41431 <secondary>in maildir delivery</secondary>
41432 </indexterm>
41433 <indexterm role="concept">
41434 <primary>maildir format</primary>
41435 <secondary><filename>maildirsize</filename> file</secondary>
41436 </indexterm>
41437 If <option>maildir_use_size_file</option> is true, Exim implements the maildir++ rules for
41438 storing quota and message size information in a file called <filename>maildirsize</filename>
41439 within the toplevel maildir directory. If this file does not exist, Exim
41440 creates it, setting the quota from the <option>quota</option> option of the transport. If
41441 the maildir directory itself does not exist, it is created before any attempt
41442 to write a <filename>maildirsize</filename> file.
41443 </para>
41444 <para>
41445 The <filename>maildirsize</filename> file is used to hold information about the sizes of
41446 messages in the maildir, thus speeding up quota calculations. The quota value
41447 in the file is just a cache; if the quota is changed in the transport, the new
41448 value overrides the cached value when the next message is delivered. The cache
41449 is maintained for the benefit of other programs that access the maildir and
41450 need to know the quota.
41451 </para>
41452 <para>
41453 If the <option>quota</option> option in the transport is unset or zero, the <filename>maildirsize</filename>
41454 file is maintained (with a zero quota setting), but no quota is imposed.
41455 </para>
41456 <para>
41457 A regular expression is available for controlling which directories in the
41458 maildir participate in quota calculations when a <filename>maildirsizefile</filename> is in use.
41459 See the description of the <option>maildir_quota_directory_regex</option> option above for
41460 details.
41461 </para>
41462 </section>
41463 <section id="SECID137">
41464 <title>Mailstore delivery</title>
41465 <para>
41466 <indexterm role="concept">
41467 <primary>mailstore format</primary>
41468 <secondary>description of</secondary>
41469 </indexterm>
41470 If the <option>mailstore_format</option> option is true, each message is written as two
41471 files in the given directory. A unique base name is constructed from the
41472 message id and the current delivery process, and the files that are written use
41473 this base name plus the suffixes <filename>.env</filename> and <filename>.msg</filename>. The <filename>.env</filename> file
41474 contains the message&#x2019;s envelope, and the <filename>.msg</filename> file contains the message
41475 itself. The base name is placed in the variable <varname>$mailstore_basename</varname>.
41476 </para>
41477 <para>
41478 During delivery, the envelope is first written to a file with the suffix
41479 <filename>.tmp</filename>. The <filename>.msg</filename> file is then written, and when it is complete, the
41480 <filename>.tmp</filename> file is renamed as the <filename>.env</filename> file. Programs that access messages in
41481 mailstore format should wait for the presence of both a <filename>.msg</filename> and a <filename>.env</filename>
41482 file before accessing either of them. An alternative approach is to wait for
41483 the absence of a <filename>.tmp</filename> file.
41484 </para>
41485 <para>
41486 The envelope file starts with any text defined by the <option>mailstore_prefix</option>
41487 option, expanded and terminated by a newline if there isn&#x2019;t one. Then follows
41488 the sender address on one line, then all the recipient addresses, one per line.
41489 There can be more than one recipient only if the <option>batch_max</option> option is set
41490 greater than one. Finally, <option>mailstore_suffix</option> is expanded and the result
41491 appended to the file, followed by a newline if it does not end with one.
41492 </para>
41493 <para>
41494 If expansion of <option>mailstore_prefix</option> or <option>mailstore_suffix</option> ends with a forced
41495 failure, it is ignored. Other expansion errors are treated as serious
41496 configuration errors, and delivery is deferred. The variable
41497 <varname>$mailstore_basename</varname> is available for use during these expansions.
41498 </para>
41499 </section>
41500 <section id="SECID138">
41501 <title>Non-special new file delivery</title>
41502 <para>
41503 If neither <option>maildir_format</option> nor <option>mailstore_format</option> is set, a single new
41504 file is created directly in the named directory. For example, when delivering
41505 messages into files in batched SMTP format for later delivery to some host (see
41506 section <xref linkend="SECTbatchSMTP"/>), a setting such as
41507 </para>
41508 <literallayout class="monospaced">
41509 directory = /var/bsmtp/$host
41510 </literallayout>
41511 <para>
41512 might be used. A message is written to a file with a temporary name, which is
41513 then renamed when the delivery is complete. The final name is obtained by
41514 expanding the contents of the <option>directory_file</option> option.
41515 <indexterm role="concept" startref="IIDapptra1" class="endofrange"/>
41516 <indexterm role="concept" startref="IIDapptra2" class="endofrange"/>
41517 </para>
41518 </section>
41519 </chapter>
41520
41521 <chapter id="CHID8">
41522 <title>The autoreply transport</title>
41523 <para>
41524 <indexterm role="concept" id="IIDauttra1" class="startofrange">
41525 <primary>transports</primary>
41526 <secondary><command>autoreply</command></secondary>
41527 </indexterm>
41528 <indexterm role="concept" id="IIDauttra2" class="startofrange">
41529 <primary><command>autoreply</command> transport</primary>
41530 </indexterm>
41531 The <command>autoreply</command> transport is not a true transport in that it does not cause
41532 the message to be transmitted. Instead, it generates a new mail message as an
41533 automatic reply to the incoming message. <emphasis>References:</emphasis> and
41534 <emphasis>Auto-Submitted:</emphasis> header lines are included. These are constructed according
41535 to the rules in RFCs 2822 and 3834, respectively.
41536 </para>
41537 <para>
41538 If the router that passes the message to this transport does not have the
41539 <option>unseen</option> option set, the original message (for the current recipient) is not
41540 delivered anywhere. However, when the <option>unseen</option> option is set on the router
41541 that passes the message to this transport, routing of the address continues, so
41542 another router can set up a normal message delivery.
41543 </para>
41544 <para>
41545 The <command>autoreply</command> transport is usually run as the result of mail filtering, a
41546 <quote>vacation</quote> message being the standard example. However, it can also be run
41547 directly from a router like any other transport. To reduce the possibility of
41548 message cascades, messages created by the <command>autoreply</command> transport always have
41549 empty envelope sender addresses, like bounce messages.
41550 </para>
41551 <para>
41552 The parameters of the message to be sent can be specified in the configuration
41553 by options described below. However, these are used only when the address
41554 passed to the transport does not contain its own reply information. When the
41555 transport is run as a consequence of a
41556 <option>mail</option>
41557 or <option>vacation</option> command in a filter file, the parameters of the message are
41558 supplied by the filter, and passed with the address. The transport&#x2019;s options
41559 that define the message are then ignored (so they are not usually set in this
41560 case). The message is specified entirely by the filter or by the transport; it
41561 is never built from a mixture of options. However, the <option>file_optional</option>,
41562 <option>mode</option>, and <option>return_message</option> options apply in all cases.
41563 </para>
41564 <para>
41565 <command>Autoreply</command> is implemented as a local transport. When used as a result of a
41566 command in a user&#x2019;s filter file, <command>autoreply</command> normally runs under the uid and
41567 gid of the user, and with appropriate current and home directories (see chapter
41568 <xref linkend="CHAPenvironment"/>).
41569 </para>
41570 <para>
41571 There is a subtle difference between routing a message to a <command>pipe</command> transport
41572 that generates some text to be returned to the sender, and routing it to an
41573 <command>autoreply</command> transport. This difference is noticeable only if more than one
41574 address from the same message is so handled. In the case of a pipe, the
41575 separate outputs from the different addresses are gathered up and returned to
41576 the sender in a single message, whereas if <command>autoreply</command> is used, a separate
41577 message is generated for each address that is passed to it.
41578 </para>
41579 <para>
41580 Non-printing characters are not permitted in the header lines generated for the
41581 message that <command>autoreply</command> creates, with the exception of newlines that are
41582 immediately followed by white space. If any non-printing characters are found,
41583 the transport defers.
41584 Whether characters with the top bit set count as printing characters or not is
41585 controlled by the <option>print_topbitchars</option> global option.
41586 </para>
41587 <para>
41588 If any of the generic options for manipulating headers (for example,
41589 <option>headers_add</option>) are set on an <command>autoreply</command> transport, they apply to the copy
41590 of the original message that is included in the generated message when
41591 <option>return_message</option> is set. They do not apply to the generated message itself.
41592 </para>
41593 <para>
41594 <indexterm role="variable">
41595 <primary><varname>$sender_address</varname></primary>
41596 </indexterm>
41597 If the <command>autoreply</command> transport receives return code 2 from Exim when it submits
41598 the message, indicating that there were no recipients, it does not treat this
41599 as an error. This means that autoreplies sent to <varname>$sender_address</varname> when this
41600 is empty (because the incoming message is a bounce message) do not cause
41601 problems. They are just discarded.
41602 </para>
41603 <section id="SECID139">
41604 <title>Private options for autoreply</title>
41605 <para>
41606 <indexterm role="concept">
41607 <primary>options</primary>
41608 <secondary><command>autoreply</command> transport</secondary>
41609 </indexterm>
41610 </para>
41611 <para>
41612 <indexterm role="option">
41613 <primary><option>bcc</option></primary>
41614 </indexterm>
41615 </para>
41616 <informaltable frame="all">
41617 <tgroup cols="4" colsep="0" rowsep="0">
41618 <colspec colwidth="8*" align="left"/>
41619 <colspec colwidth="6*" align="center"/>
41620 <colspec colwidth="6*" align="center"/>
41621 <colspec colwidth="6*" align="right"/>
41622 <tbody>
41623 <row>
41624 <entry><option>bcc</option></entry>
41625 <entry>Use: <emphasis>autoreply</emphasis></entry>
41626 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
41627 <entry>Default: <emphasis>unset</emphasis></entry>
41628 </row>
41629 </tbody>
41630 </tgroup>
41631 </informaltable>
41632 <para>
41633 This specifies the addresses that are to receive <quote>blind carbon copies</quote> of the
41634 message when the message is specified by the transport.
41635 </para>
41636 <para>
41637 <indexterm role="option">
41638 <primary><option>cc</option></primary>
41639 </indexterm>
41640 </para>
41641 <informaltable frame="all">
41642 <tgroup cols="4" colsep="0" rowsep="0">
41643 <colspec colwidth="8*" align="left"/>
41644 <colspec colwidth="6*" align="center"/>
41645 <colspec colwidth="6*" align="center"/>
41646 <colspec colwidth="6*" align="right"/>
41647 <tbody>
41648 <row>
41649 <entry><option>cc</option></entry>
41650 <entry>Use: <emphasis>autoreply</emphasis></entry>
41651 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
41652 <entry>Default: <emphasis>unset</emphasis></entry>
41653 </row>
41654 </tbody>
41655 </tgroup>
41656 </informaltable>
41657 <para>
41658 This specifies recipients of the message and the contents of the <emphasis>Cc:</emphasis> header
41659 when the message is specified by the transport.
41660 </para>
41661 <para>
41662 <indexterm role="option">
41663 <primary><option>file</option></primary>
41664 </indexterm>
41665 </para>
41666 <informaltable frame="all">
41667 <tgroup cols="4" colsep="0" rowsep="0">
41668 <colspec colwidth="8*" align="left"/>
41669 <colspec colwidth="6*" align="center"/>
41670 <colspec colwidth="6*" align="center"/>
41671 <colspec colwidth="6*" align="right"/>
41672 <tbody>
41673 <row>
41674 <entry><option>file</option></entry>
41675 <entry>Use: <emphasis>autoreply</emphasis></entry>
41676 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
41677 <entry>Default: <emphasis>unset</emphasis></entry>
41678 </row>
41679 </tbody>
41680 </tgroup>
41681 </informaltable>
41682 <para>
41683 The contents of the file are sent as the body of the message when the message
41684 is specified by the transport. If both <option>file</option> and <option>text</option> are set, the text
41685 string comes first.
41686 </para>
41687 <para>
41688 <indexterm role="option">
41689 <primary><option>file_expand</option></primary>
41690 </indexterm>
41691 </para>
41692 <informaltable frame="all">
41693 <tgroup cols="4" colsep="0" rowsep="0">
41694 <colspec colwidth="8*" align="left"/>
41695 <colspec colwidth="6*" align="center"/>
41696 <colspec colwidth="6*" align="center"/>
41697 <colspec colwidth="6*" align="right"/>
41698 <tbody>
41699 <row>
41700 <entry><option>file_expand</option></entry>
41701 <entry>Use: <emphasis>autoreply</emphasis></entry>
41702 <entry>Type: <emphasis>boolean</emphasis></entry>
41703 <entry>Default: <emphasis>false</emphasis></entry>
41704 </row>
41705 </tbody>
41706 </tgroup>
41707 </informaltable>
41708 <para>
41709 If this is set, the contents of the file named by the <option>file</option> option are
41710 subjected to string expansion as they are added to the message.
41711 </para>
41712 <para>
41713 <indexterm role="option">
41714 <primary><option>file_optional</option></primary>
41715 </indexterm>
41716 </para>
41717 <informaltable frame="all">
41718 <tgroup cols="4" colsep="0" rowsep="0">
41719 <colspec colwidth="8*" align="left"/>
41720 <colspec colwidth="6*" align="center"/>
41721 <colspec colwidth="6*" align="center"/>
41722 <colspec colwidth="6*" align="right"/>
41723 <tbody>
41724 <row>
41725 <entry><option>file_optional</option></entry>
41726 <entry>Use: <emphasis>autoreply</emphasis></entry>
41727 <entry>Type: <emphasis>boolean</emphasis></entry>
41728 <entry>Default: <emphasis>false</emphasis></entry>
41729 </row>
41730 </tbody>
41731 </tgroup>
41732 </informaltable>
41733 <para>
41734 If this option is true, no error is generated if the file named by the <option>file</option>
41735 option or passed with the address does not exist or cannot be read.
41736 </para>
41737 <para>
41738 <indexterm role="option">
41739 <primary><option>from</option></primary>
41740 </indexterm>
41741 </para>
41742 <informaltable frame="all">
41743 <tgroup cols="4" colsep="0" rowsep="0">
41744 <colspec colwidth="8*" align="left"/>
41745 <colspec colwidth="6*" align="center"/>
41746 <colspec colwidth="6*" align="center"/>
41747 <colspec colwidth="6*" align="right"/>
41748 <tbody>
41749 <row>
41750 <entry><option>from</option></entry>
41751 <entry>Use: <emphasis>autoreply</emphasis></entry>
41752 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
41753 <entry>Default: <emphasis>unset</emphasis></entry>
41754 </row>
41755 </tbody>
41756 </tgroup>
41757 </informaltable>
41758 <para>
41759 This specifies the contents of the <emphasis>From:</emphasis> header when the message is
41760 specified by the transport.
41761 </para>
41762 <para>
41763 <indexterm role="option">
41764 <primary><option>headers</option></primary>
41765 </indexterm>
41766 </para>
41767 <informaltable frame="all">
41768 <tgroup cols="4" colsep="0" rowsep="0">
41769 <colspec colwidth="8*" align="left"/>
41770 <colspec colwidth="6*" align="center"/>
41771 <colspec colwidth="6*" align="center"/>
41772 <colspec colwidth="6*" align="right"/>
41773 <tbody>
41774 <row>
41775 <entry><option>headers</option></entry>
41776 <entry>Use: <emphasis>autoreply</emphasis></entry>
41777 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
41778 <entry>Default: <emphasis>unset</emphasis></entry>
41779 </row>
41780 </tbody>
41781 </tgroup>
41782 </informaltable>
41783 <para>
41784 This specifies additional RFC 2822 headers that are to be added to the message
41785 when the message is specified by the transport. Several can be given by using
41786 <quote>\n</quote> to separate them. There is no check on the format.
41787 </para>
41788 <para>
41789 <indexterm role="option">
41790 <primary><option>log</option></primary>
41791 </indexterm>
41792 </para>
41793 <informaltable frame="all">
41794 <tgroup cols="4" colsep="0" rowsep="0">
41795 <colspec colwidth="8*" align="left"/>
41796 <colspec colwidth="6*" align="center"/>
41797 <colspec colwidth="6*" align="center"/>
41798 <colspec colwidth="6*" align="right"/>
41799 <tbody>
41800 <row>
41801 <entry><option>log</option></entry>
41802 <entry>Use: <emphasis>autoreply</emphasis></entry>
41803 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
41804 <entry>Default: <emphasis>unset</emphasis></entry>
41805 </row>
41806 </tbody>
41807 </tgroup>
41808 </informaltable>
41809 <para>
41810 This option names a file in which a record of every message sent is logged when
41811 the message is specified by the transport.
41812 </para>
41813 <para>
41814 <indexterm role="option">
41815 <primary><option>mode</option></primary>
41816 </indexterm>
41817 </para>
41818 <informaltable frame="all">
41819 <tgroup cols="4" colsep="0" rowsep="0">
41820 <colspec colwidth="8*" align="left"/>
41821 <colspec colwidth="6*" align="center"/>
41822 <colspec colwidth="6*" align="center"/>
41823 <colspec colwidth="6*" align="right"/>
41824 <tbody>
41825 <row>
41826 <entry><option>mode</option></entry>
41827 <entry>Use: <emphasis>autoreply</emphasis></entry>
41828 <entry>Type: <emphasis>octal integer</emphasis></entry>
41829 <entry>Default: <emphasis>0600</emphasis></entry>
41830 </row>
41831 </tbody>
41832 </tgroup>
41833 </informaltable>
41834 <para>
41835 If either the log file or the <quote>once</quote> file has to be created, this mode is
41836 used.
41837 </para>
41838 <para>
41839 <indexterm role="option">
41840 <primary><option>never_mail</option></primary>
41841 </indexterm>
41842 </para>
41843 <informaltable frame="all">
41844 <tgroup cols="4" colsep="0" rowsep="0">
41845 <colspec colwidth="8*" align="left"/>
41846 <colspec colwidth="6*" align="center"/>
41847 <colspec colwidth="6*" align="center"/>
41848 <colspec colwidth="6*" align="right"/>
41849 <tbody>
41850 <row>
41851 <entry><option>never_mail</option></entry>
41852 <entry>Use: <emphasis>autoreply</emphasis></entry>
41853 <entry>Type: <emphasis>address list</emphasis>&dagger;<emphasis></emphasis></entry>
41854 <entry>Default: <emphasis>unset</emphasis></entry>
41855 </row>
41856 </tbody>
41857 </tgroup>
41858 </informaltable>
41859 <para>
41860 If any run of the transport creates a message with a recipient that matches any
41861 item in the list, that recipient is quietly discarded. If all recipients are
41862 discarded, no message is created. This applies both when the recipients are
41863 generated by a filter and when they are specified in the transport.
41864 </para>
41865 <para>
41866 <indexterm role="option">
41867 <primary><option>once</option></primary>
41868 </indexterm>
41869 </para>
41870 <informaltable frame="all">
41871 <tgroup cols="4" colsep="0" rowsep="0">
41872 <colspec colwidth="8*" align="left"/>
41873 <colspec colwidth="6*" align="center"/>
41874 <colspec colwidth="6*" align="center"/>
41875 <colspec colwidth="6*" align="right"/>
41876 <tbody>
41877 <row>
41878 <entry><option>once</option></entry>
41879 <entry>Use: <emphasis>autoreply</emphasis></entry>
41880 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
41881 <entry>Default: <emphasis>unset</emphasis></entry>
41882 </row>
41883 </tbody>
41884 </tgroup>
41885 </informaltable>
41886 <para>
41887 This option names a file or DBM database in which a record of each <emphasis>To:</emphasis>
41888 recipient is kept when the message is specified by the transport. <emphasis role="bold">Note</emphasis>:
41889 This does not apply to <emphasis>Cc:</emphasis> or <emphasis>Bcc:</emphasis> recipients.
41890 </para>
41891 <para>
41892 If <option>once</option> is unset, or is set to an empty string, the message is always sent.
41893 By default, if <option>once</option> is set to a non-empty file name, the message
41894 is not sent if a potential recipient is already listed in the database.
41895 However, if the <option>once_repeat</option> option specifies a time greater than zero, the
41896 message is sent if that much time has elapsed since a message was last sent to
41897 this recipient. A setting of zero time for <option>once_repeat</option> (the default)
41898 prevents a message from being sent a second time &ndash; in this case, zero means
41899 infinity.
41900 </para>
41901 <para>
41902 If <option>once_file_size</option> is zero, a DBM database is used to remember recipients,
41903 and it is allowed to grow as large as necessary. If <option>once_file_size</option> is set
41904 greater than zero, it changes the way Exim implements the <option>once</option> option.
41905 Instead of using a DBM file to record every recipient it sends to, it uses a
41906 regular file, whose size will never get larger than the given value.
41907 </para>
41908 <para>
41909 In the file, Exim keeps a linear list of recipient addresses and the times at
41910 which they were sent messages. If the file is full when a new address needs to
41911 be added, the oldest address is dropped. If <option>once_repeat</option> is not set, this
41912 means that a given recipient may receive multiple messages, but at
41913 unpredictable intervals that depend on the rate of turnover of addresses in the
41914 file. If <option>once_repeat</option> is set, it specifies a maximum time between repeats.
41915 </para>
41916 <para>
41917 <indexterm role="option">
41918 <primary><option>once_file_size</option></primary>
41919 </indexterm>
41920 </para>
41921 <informaltable frame="all">
41922 <tgroup cols="4" colsep="0" rowsep="0">
41923 <colspec colwidth="8*" align="left"/>
41924 <colspec colwidth="6*" align="center"/>
41925 <colspec colwidth="6*" align="center"/>
41926 <colspec colwidth="6*" align="right"/>
41927 <tbody>
41928 <row>
41929 <entry><option>once_file_size</option></entry>
41930 <entry>Use: <emphasis>autoreply</emphasis></entry>
41931 <entry>Type: <emphasis>integer</emphasis></entry>
41932 <entry>Default: <emphasis>0</emphasis></entry>
41933 </row>
41934 </tbody>
41935 </tgroup>
41936 </informaltable>
41937 <para>
41938 See <option>once</option> above.
41939 </para>
41940 <para>
41941 <indexterm role="option">
41942 <primary><option>once_repeat</option></primary>
41943 </indexterm>
41944 </para>
41945 <informaltable frame="all">
41946 <tgroup cols="4" colsep="0" rowsep="0">
41947 <colspec colwidth="8*" align="left"/>
41948 <colspec colwidth="6*" align="center"/>
41949 <colspec colwidth="6*" align="center"/>
41950 <colspec colwidth="6*" align="right"/>
41951 <tbody>
41952 <row>
41953 <entry><option>once_repeat</option></entry>
41954 <entry>Use: <emphasis>autoreply</emphasis></entry>
41955 <entry>Type: <emphasis>time</emphasis>&dagger;<emphasis></emphasis></entry>
41956 <entry>Default: <emphasis>0s</emphasis></entry>
41957 </row>
41958 </tbody>
41959 </tgroup>
41960 </informaltable>
41961 <para>
41962 See <option>once</option> above.
41963 After expansion, the value of this option must be a valid time value.
41964 </para>
41965 <para>
41966 <indexterm role="option">
41967 <primary><option>reply_to</option></primary>
41968 </indexterm>
41969 </para>
41970 <informaltable frame="all">
41971 <tgroup cols="4" colsep="0" rowsep="0">
41972 <colspec colwidth="8*" align="left"/>
41973 <colspec colwidth="6*" align="center"/>
41974 <colspec colwidth="6*" align="center"/>
41975 <colspec colwidth="6*" align="right"/>
41976 <tbody>
41977 <row>
41978 <entry><option>reply_to</option></entry>
41979 <entry>Use: <emphasis>autoreply</emphasis></entry>
41980 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
41981 <entry>Default: <emphasis>unset</emphasis></entry>
41982 </row>
41983 </tbody>
41984 </tgroup>
41985 </informaltable>
41986 <para>
41987 This specifies the contents of the <emphasis>Reply-To:</emphasis> header when the message is
41988 specified by the transport.
41989 </para>
41990 <para>
41991 <indexterm role="option">
41992 <primary><option>return_message</option></primary>
41993 </indexterm>
41994 </para>
41995 <informaltable frame="all">
41996 <tgroup cols="4" colsep="0" rowsep="0">
41997 <colspec colwidth="8*" align="left"/>
41998 <colspec colwidth="6*" align="center"/>
41999 <colspec colwidth="6*" align="center"/>
42000 <colspec colwidth="6*" align="right"/>
42001 <tbody>
42002 <row>
42003 <entry><option>return_message</option></entry>
42004 <entry>Use: <emphasis>autoreply</emphasis></entry>
42005 <entry>Type: <emphasis>boolean</emphasis></entry>
42006 <entry>Default: <emphasis>false</emphasis></entry>
42007 </row>
42008 </tbody>
42009 </tgroup>
42010 </informaltable>
42011 <para>
42012 If this is set, a copy of the original message is returned with the new
42013 message, subject to the maximum size set in the <option>return_size_limit</option> global
42014 configuration option.
42015 </para>
42016 <para>
42017 <indexterm role="option">
42018 <primary><option>subject</option></primary>
42019 </indexterm>
42020 </para>
42021 <informaltable frame="all">
42022 <tgroup cols="4" colsep="0" rowsep="0">
42023 <colspec colwidth="8*" align="left"/>
42024 <colspec colwidth="6*" align="center"/>
42025 <colspec colwidth="6*" align="center"/>
42026 <colspec colwidth="6*" align="right"/>
42027 <tbody>
42028 <row>
42029 <entry><option>subject</option></entry>
42030 <entry>Use: <emphasis>autoreply</emphasis></entry>
42031 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
42032 <entry>Default: <emphasis>unset</emphasis></entry>
42033 </row>
42034 </tbody>
42035 </tgroup>
42036 </informaltable>
42037 <para>
42038 This specifies the contents of the <emphasis>Subject:</emphasis> header when the message is
42039 specified by the transport. It is tempting to quote the original subject in
42040 automatic responses. For example:
42041 </para>
42042 <literallayout class="monospaced">
42043 subject = Re: $h_subject:
42044 </literallayout>
42045 <para>
42046 There is a danger in doing this, however. It may allow a third party to
42047 subscribe your users to an opt-in mailing list, provided that the list accepts
42048 bounce messages as subscription confirmations. Well-managed lists require a
42049 non-bounce message to confirm a subscription, so the danger is relatively
42050 small.
42051 </para>
42052 <para>
42053 <indexterm role="option">
42054 <primary><option>text</option></primary>
42055 </indexterm>
42056 </para>
42057 <informaltable frame="all">
42058 <tgroup cols="4" colsep="0" rowsep="0">
42059 <colspec colwidth="8*" align="left"/>
42060 <colspec colwidth="6*" align="center"/>
42061 <colspec colwidth="6*" align="center"/>
42062 <colspec colwidth="6*" align="right"/>
42063 <tbody>
42064 <row>
42065 <entry><option>text</option></entry>
42066 <entry>Use: <emphasis>autoreply</emphasis></entry>
42067 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
42068 <entry>Default: <emphasis>unset</emphasis></entry>
42069 </row>
42070 </tbody>
42071 </tgroup>
42072 </informaltable>
42073 <para>
42074 This specifies a single string to be used as the body of the message when the
42075 message is specified by the transport. If both <option>text</option> and <option>file</option> are set,
42076 the text comes first.
42077 </para>
42078 <para>
42079 <indexterm role="option">
42080 <primary><option>to</option></primary>
42081 </indexterm>
42082 </para>
42083 <informaltable frame="all">
42084 <tgroup cols="4" colsep="0" rowsep="0">
42085 <colspec colwidth="8*" align="left"/>
42086 <colspec colwidth="6*" align="center"/>
42087 <colspec colwidth="6*" align="center"/>
42088 <colspec colwidth="6*" align="right"/>
42089 <tbody>
42090 <row>
42091 <entry><option>to</option></entry>
42092 <entry>Use: <emphasis>autoreply</emphasis></entry>
42093 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
42094 <entry>Default: <emphasis>unset</emphasis></entry>
42095 </row>
42096 </tbody>
42097 </tgroup>
42098 </informaltable>
42099 <para>
42100 This specifies recipients of the message and the contents of the <emphasis>To:</emphasis> header
42101 when the message is specified by the transport.
42102 <indexterm role="concept" startref="IIDauttra1" class="endofrange"/>
42103 <indexterm role="concept" startref="IIDauttra2" class="endofrange"/>
42104 </para>
42105 </section>
42106 </chapter>
42107
42108 <chapter id="CHAPLMTP">
42109 <title>The lmtp transport</title>
42110 <para>
42111 <indexterm role="concept">
42112 <primary>transports</primary>
42113 <secondary><command>lmtp</command></secondary>
42114 </indexterm>
42115 <indexterm role="concept">
42116 <primary><command>lmtp</command> transport</primary>
42117 </indexterm>
42118 <indexterm role="concept">
42119 <primary>LMTP</primary>
42120 <secondary>over a pipe</secondary>
42121 </indexterm>
42122 <indexterm role="concept">
42123 <primary>LMTP</primary>
42124 <secondary>over a socket</secondary>
42125 </indexterm>
42126 The <command>lmtp</command> transport runs the LMTP protocol (RFC 2033) over a pipe to a
42127 specified command
42128 or by interacting with a Unix domain socket.
42129 This transport is something of a cross between the <command>pipe</command> and <command>smtp</command>
42130 transports. Exim also has support for using LMTP over TCP/IP; this is
42131 implemented as an option for the <command>smtp</command> transport. Because LMTP is expected
42132 to be of minority interest, the default build-time configure in <filename>src/EDITME</filename>
42133 has it commented out. You need to ensure that
42134 </para>
42135 <literallayout class="monospaced">
42136 TRANSPORT_LMTP=yes
42137 </literallayout>
42138 <para>
42139 <indexterm role="concept">
42140 <primary>options</primary>
42141 <secondary><command>lmtp</command> transport</secondary>
42142 </indexterm>
42143 is present in your <filename>Local/Makefile</filename> in order to have the <command>lmtp</command> transport
42144 included in the Exim binary. The private options of the <command>lmtp</command> transport are
42145 as follows:
42146 </para>
42147 <para>
42148 <indexterm role="option">
42149 <primary><option>batch_id</option></primary>
42150 </indexterm>
42151 </para>
42152 <informaltable frame="all">
42153 <tgroup cols="4" colsep="0" rowsep="0">
42154 <colspec colwidth="8*" align="left"/>
42155 <colspec colwidth="6*" align="center"/>
42156 <colspec colwidth="6*" align="center"/>
42157 <colspec colwidth="6*" align="right"/>
42158 <tbody>
42159 <row>
42160 <entry><option>batch_id</option></entry>
42161 <entry>Use: <emphasis>lmtp</emphasis></entry>
42162 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
42163 <entry>Default: <emphasis>unset</emphasis></entry>
42164 </row>
42165 </tbody>
42166 </tgroup>
42167 </informaltable>
42168 <para>
42169 See the description of local delivery batching in chapter <xref linkend="CHAPbatching"/>.
42170 </para>
42171 <para>
42172 <indexterm role="option">
42173 <primary><option>batch_max</option></primary>
42174 </indexterm>
42175 </para>
42176 <informaltable frame="all">
42177 <tgroup cols="4" colsep="0" rowsep="0">
42178 <colspec colwidth="8*" align="left"/>
42179 <colspec colwidth="6*" align="center"/>
42180 <colspec colwidth="6*" align="center"/>
42181 <colspec colwidth="6*" align="right"/>
42182 <tbody>
42183 <row>
42184 <entry><option>batch_max</option></entry>
42185 <entry>Use: <emphasis>lmtp</emphasis></entry>
42186 <entry>Type: <emphasis>integer</emphasis></entry>
42187 <entry>Default: <emphasis>1</emphasis></entry>
42188 </row>
42189 </tbody>
42190 </tgroup>
42191 </informaltable>
42192 <para>
42193 This limits the number of addresses that can be handled in a single delivery.
42194 Most LMTP servers can handle several addresses at once, so it is normally a
42195 good idea to increase this value. See the description of local delivery
42196 batching in chapter <xref linkend="CHAPbatching"/>.
42197 </para>
42198 <para>
42199 <indexterm role="option">
42200 <primary><option>command</option></primary>
42201 </indexterm>
42202 </para>
42203 <informaltable frame="all">
42204 <tgroup cols="4" colsep="0" rowsep="0">
42205 <colspec colwidth="8*" align="left"/>
42206 <colspec colwidth="6*" align="center"/>
42207 <colspec colwidth="6*" align="center"/>
42208 <colspec colwidth="6*" align="right"/>
42209 <tbody>
42210 <row>
42211 <entry><option>command</option></entry>
42212 <entry>Use: <emphasis>lmtp</emphasis></entry>
42213 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
42214 <entry>Default: <emphasis>unset</emphasis></entry>
42215 </row>
42216 </tbody>
42217 </tgroup>
42218 </informaltable>
42219 <para>
42220 This option must be set if <option>socket</option> is not set. The string is a command which
42221 is run in a separate process. It is split up into a command name and list of
42222 arguments, each of which is separately expanded (so expansion cannot change the
42223 number of arguments). The command is run directly, not via a shell. The message
42224 is passed to the new process using the standard input and output to operate the
42225 LMTP protocol.
42226 </para>
42227 <para>
42228 <indexterm role="option">
42229 <primary><option>ignore_quota</option></primary>
42230 </indexterm>
42231 </para>
42232 <informaltable frame="all">
42233 <tgroup cols="4" colsep="0" rowsep="0">
42234 <colspec colwidth="8*" align="left"/>
42235 <colspec colwidth="6*" align="center"/>
42236 <colspec colwidth="6*" align="center"/>
42237 <colspec colwidth="6*" align="right"/>
42238 <tbody>
42239 <row>
42240 <entry><option>ignore_quota</option></entry>
42241 <entry>Use: <emphasis>lmtp</emphasis></entry>
42242 <entry>Type: <emphasis>boolean</emphasis></entry>
42243 <entry>Default: <emphasis>false</emphasis></entry>
42244 </row>
42245 </tbody>
42246 </tgroup>
42247 </informaltable>
42248 <para>
42249 <indexterm role="concept">
42250 <primary>LMTP</primary>
42251 <secondary>ignoring quota errors</secondary>
42252 </indexterm>
42253 If this option is set true, the string <literal>IGNOREQUOTA</literal> is added to RCPT
42254 commands, provided that the LMTP server has advertised support for IGNOREQUOTA
42255 in its response to the LHLO command.
42256 </para>
42257 <para>
42258 <indexterm role="option">
42259 <primary><option>socket</option></primary>
42260 </indexterm>
42261 </para>
42262 <informaltable frame="all">
42263 <tgroup cols="4" colsep="0" rowsep="0">
42264 <colspec colwidth="8*" align="left"/>
42265 <colspec colwidth="6*" align="center"/>
42266 <colspec colwidth="6*" align="center"/>
42267 <colspec colwidth="6*" align="right"/>
42268 <tbody>
42269 <row>
42270 <entry><option>socket</option></entry>
42271 <entry>Use: <emphasis>lmtp</emphasis></entry>
42272 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
42273 <entry>Default: <emphasis>unset</emphasis></entry>
42274 </row>
42275 </tbody>
42276 </tgroup>
42277 </informaltable>
42278 <para>
42279 This option must be set if <option>command</option> is not set. The result of expansion must
42280 be the name of a Unix domain socket. The transport connects to the socket and
42281 delivers the message to it using the LMTP protocol.
42282 </para>
42283 <para>
42284 <indexterm role="option">
42285 <primary><option>timeout</option></primary>
42286 </indexterm>
42287 </para>
42288 <informaltable frame="all">
42289 <tgroup cols="4" colsep="0" rowsep="0">
42290 <colspec colwidth="8*" align="left"/>
42291 <colspec colwidth="6*" align="center"/>
42292 <colspec colwidth="6*" align="center"/>
42293 <colspec colwidth="6*" align="right"/>
42294 <tbody>
42295 <row>
42296 <entry><option>timeout</option></entry>
42297 <entry>Use: <emphasis>lmtp</emphasis></entry>
42298 <entry>Type: <emphasis>time</emphasis></entry>
42299 <entry>Default: <emphasis>5m</emphasis></entry>
42300 </row>
42301 </tbody>
42302 </tgroup>
42303 </informaltable>
42304 <para>
42305 The transport is aborted if the created process or Unix domain socket does not
42306 respond to LMTP commands or message input within this timeout. Delivery
42307 is deferred, and will be tried again later. Here is an example of a typical
42308 LMTP transport:
42309 </para>
42310 <literallayout class="monospaced">
42311 lmtp:
42312   driver = lmtp
42313   command = /some/local/lmtp/delivery/program
42314   batch_max = 20
42315   user = exim
42316 </literallayout>
42317 <para>
42318 This delivers up to 20 addresses at a time, in a mixture of domains if
42319 necessary, running as the user <emphasis>exim</emphasis>.
42320 </para>
42321 </chapter>
42322
42323 <chapter id="CHAPpipetransport">
42324 <title>The pipe transport</title>
42325 <para>
42326 <indexterm role="concept" id="IIDpiptra1" class="startofrange">
42327 <primary>transports</primary>
42328 <secondary><command>pipe</command></secondary>
42329 </indexterm>
42330 <indexterm role="concept" id="IIDpiptra2" class="startofrange">
42331 <primary><command>pipe</command> transport</primary>
42332 </indexterm>
42333 The <command>pipe</command> transport is used to deliver messages via a pipe to a command
42334 running in another process. One example is the use of <command>pipe</command> as a
42335 pseudo-remote transport for passing messages to some other delivery mechanism
42336 (such as UUCP). Another is the use by individual users to automatically process
42337 their incoming messages. The <command>pipe</command> transport can be used in one of the
42338 following ways:
42339 </para>
42340 <itemizedlist>
42341 <listitem>
42342 <para>
42343 <indexterm role="variable">
42344 <primary><varname>$local_part</varname></primary>
42345 </indexterm>
42346 A router routes one address to a transport in the normal way, and the
42347 transport is configured as a <command>pipe</command> transport. In this case, <varname>$local_part</varname>
42348 contains the local part of the address (as usual), and the command that is run
42349 is specified by the <option>command</option> option on the transport.
42350 </para>
42351 </listitem>
42352 <listitem>
42353 <para>
42354 <indexterm role="variable">
42355 <primary><varname>$pipe_addresses</varname></primary>
42356 </indexterm>
42357 If the <option>batch_max</option> option is set greater than 1 (the default is 1), the
42358 transport can handle more than one address in a single run. In this case, when
42359 more than one address is routed to the transport, <varname>$local_part</varname> is not set
42360 (because it is not unique). However, the pseudo-variable <varname>$pipe_addresses</varname>
42361 (described in section <xref linkend="SECThowcommandrun"/> below) contains all the addresses
42362 that are routed to the transport.
42363 </para>
42364 </listitem>
42365 <listitem>
42366 <para>
42367 <indexterm role="variable">
42368 <primary><varname>$address_pipe</varname></primary>
42369 </indexterm>
42370 A router redirects an address directly to a pipe command (for example, from an
42371 alias or forward file). In this case, <varname>$address_pipe</varname> contains the text of the
42372 pipe command, and the <option>command</option> option on the transport is ignored unless
42373 <option>force_command</option> is set. If only one address is being transported
42374 (<option>batch_max</option> is not greater than one, or only one address was redirected to
42375 this pipe command), <varname>$local_part</varname> contains the local part that was redirected.
42376 </para>
42377 </listitem>
42378 </itemizedlist>
42379 <para>
42380 The <command>pipe</command> transport is a non-interactive delivery method. Exim can also
42381 deliver messages over pipes using the LMTP interactive protocol. This is
42382 implemented by the <command>lmtp</command> transport.
42383 </para>
42384 <para>
42385 In the case when <command>pipe</command> is run as a consequence of an entry in a local user&#x2019;s
42386 <filename>.forward</filename> file, the command runs under the uid and gid of that user. In
42387 other cases, the uid and gid have to be specified explicitly, either on the
42388 transport or on the router that handles the address. Current and <quote>home</quote>
42389 directories are also controllable. See chapter <xref linkend="CHAPenvironment"/> for
42390 details of the local delivery environment and chapter <xref linkend="CHAPbatching"/>
42391 for a discussion of local delivery batching.
42392 </para>
42393 <section id="SECID140">
42394 <title>Concurrent delivery</title>
42395 <para>
42396 If two messages arrive at almost the same time, and both are routed to a pipe
42397 delivery, the two pipe transports may be run concurrently. You must ensure that
42398 any pipe commands you set up are robust against this happening. If the commands
42399 write to a file, the <option>exim_lock</option> utility might be of use.
42400 </para>
42401 </section>
42402 <section id="SECID141">
42403 <title>Returned status and data</title>
42404 <para>
42405 <indexterm role="concept">
42406 <primary><command>pipe</command> transport</primary>
42407 <secondary>returned data</secondary>
42408 </indexterm>
42409 If the command exits with a non-zero return code, the delivery is deemed to
42410 have failed, unless either the <option>ignore_status</option> option is set (in which case
42411 the return code is treated as zero), or the return code is one of those listed
42412 in the <option>temp_errors</option> option, which are interpreted as meaning <quote>try again
42413 later</quote>. In this case, delivery is deferred. Details of a permanent failure are
42414 logged, but are not included in the bounce message, which merely contains
42415 <quote>local delivery failed</quote>.
42416 </para>
42417 <para>
42418 If the command exits on a signal and the <option>freeze_signal</option> option is set then
42419 the message will be frozen in the queue. If that option is not set, a bounce
42420 will be sent as normal.
42421 </para>
42422 <para>
42423 If the return code is greater than 128 and the command being run is a shell
42424 script, it normally means that the script was terminated by a signal whose
42425 value is the return code minus 128. The <option>freeze_signal</option> option does not
42426 apply in this case.
42427 </para>
42428 <para>
42429 If Exim is unable to run the command (that is, if <function>execve()</function> fails), the
42430 return code is set to 127. This is the value that a shell returns if it is
42431 asked to run a non-existent command. The wording for the log line suggests that
42432 a non-existent command may be the problem.
42433 </para>
42434 <para>
42435 The <option>return_output</option> option can affect the result of a pipe delivery. If it is
42436 set and the command produces any output on its standard output or standard
42437 error streams, the command is considered to have failed, even if it gave a zero
42438 return code or if <option>ignore_status</option> is set. The output from the command is
42439 included as part of the bounce message. The <option>return_fail_output</option> option is
42440 similar, except that output is returned only when the command exits with a
42441 failure return code, that is, a value other than zero or a code that matches
42442 <option>temp_errors</option>.
42443 </para>
42444 </section>
42445 <section id="SECThowcommandrun">
42446 <title>How the command is run</title>
42447 <para>
42448 <indexterm role="concept">
42449 <primary><command>pipe</command> transport</primary>
42450 <secondary>path for command</secondary>
42451 </indexterm>
42452 The command line is (by default) broken down into a command name and arguments
42453 by the <command>pipe</command> transport itself. The <option>allow_commands</option> and
42454 <option>restrict_to_path</option> options can be used to restrict the commands that may be
42455 run.
42456 </para>
42457 <para>
42458 <indexterm role="concept">
42459 <primary>quoting</primary>
42460 <secondary>in pipe command</secondary>
42461 </indexterm>
42462 Unquoted arguments are delimited by white space. If an argument appears in
42463 double quotes, backslash is interpreted as an escape character in the usual
42464 way. If an argument appears in single quotes, no escaping is done.
42465 </para>
42466 <para>
42467 String expansion is applied to the command line except when it comes from a
42468 traditional <filename>.forward</filename> file (commands from a filter file are expanded). The
42469 expansion is applied to each argument in turn rather than to the whole line.
42470 For this reason, any string expansion item that contains white space must be
42471 quoted so as to be contained within a single argument. A setting such as
42472 </para>
42473 <literallayout class="monospaced">
42474 command = /some/path ${if eq{$local_part}{postmaster}{xx}{yy}}
42475 </literallayout>
42476 <para>
42477 will not work, because the expansion item gets split between several
42478 arguments. You have to write
42479 </para>
42480 <literallayout class="monospaced">
42481 command = /some/path "${if eq{$local_part}{postmaster}{xx}{yy}}"
42482 </literallayout>
42483 <para>
42484 to ensure that it is all in one argument. The expansion is done in this way,
42485 argument by argument, so that the number of arguments cannot be changed as a
42486 result of expansion, and quotes or backslashes in inserted variables do not
42487 interact with external quoting. However, this leads to problems if you want to
42488 generate multiple arguments (or the command name plus arguments) from a single
42489 expansion. In this situation, the simplest solution is to use a shell. For
42490 example:
42491 </para>
42492 <literallayout class="monospaced">
42493 command = /bin/sh -c ${lookup{$local_part}lsearch{/some/file}}
42494 </literallayout>
42495 <para>
42496 <indexterm role="concept">
42497 <primary>transport</primary>
42498 <secondary>filter</secondary>
42499 </indexterm>
42500 <indexterm role="concept">
42501 <primary>filter</primary>
42502 <secondary>transport filter</secondary>
42503 </indexterm>
42504 <indexterm role="variable">
42505 <primary><varname>$pipe_addresses</varname></primary>
42506 </indexterm>
42507 Special handling takes place when an argument consists of precisely the text
42508 <literal>$pipe_addresses</literal>. This is not a general expansion variable; the only
42509 place this string is recognized is when it appears as an argument for a pipe or
42510 transport filter command. It causes each address that is being handled to be
42511 inserted in the argument list at that point <emphasis>as a separate argument</emphasis>. This
42512 avoids any problems with spaces or shell metacharacters, and is of use when a
42513 <command>pipe</command> transport is handling groups of addresses in a batch.
42514 </para>
42515 <para>
42516 If <option>force_command</option> is enabled on the transport, Special handling takes place
42517 for an argument that consists of precisely the text <literal>$address_pipe</literal>.  It
42518 is handled similarly to <varname>$pipe_addresses</varname> above.  It is expanded and each
42519 argument is inserted in the argument list at that point
42520 <emphasis>as a separate argument</emphasis>.  The <literal>$address_pipe</literal> item does not need to be
42521 the only item in the argument; in fact, if it were then <option>force_command</option>
42522 should behave as a no-op.  Rather, it should be used to adjust the command
42523 run while preserving the argument vector separation.
42524 </para>
42525 <para>
42526 After splitting up into arguments and expansion, the resulting command is run
42527 in a subprocess directly from the transport, <emphasis>not</emphasis> under a shell. The
42528 message that is being delivered is supplied on the standard input, and the
42529 standard output and standard error are both connected to a single pipe that is
42530 read by Exim. The <option>max_output</option> option controls how much output the command
42531 may produce, and the <option>return_output</option> and <option>return_fail_output</option> options
42532 control what is done with it.
42533 </para>
42534 <para>
42535 Not running the command under a shell (by default) lessens the security risks
42536 in cases when a command from a user&#x2019;s filter file is built out of data that was
42537 taken from an incoming message. If a shell is required, it can of course be
42538 explicitly specified as the command to be run. However, there are circumstances
42539 where existing commands (for example, in <filename>.forward</filename> files) expect to be run
42540 under a shell and cannot easily be modified. To allow for these cases, there is
42541 an option called <option>use_shell</option>, which changes the way the <command>pipe</command> transport
42542 works. Instead of breaking up the command line as just described, it expands it
42543 as a single string and passes the result to <filename>/bin/sh</filename>. The
42544 <option>restrict_to_path</option> option and the <varname>$pipe_addresses</varname> facility cannot be used
42545 with <option>use_shell</option>, and the whole mechanism is inherently less secure.
42546 </para>
42547 </section>
42548 <section id="SECTpipeenv">
42549 <title>Environment variables</title>
42550 <para>
42551 <indexterm role="concept">
42552 <primary><command>pipe</command> transport</primary>
42553 <secondary>environment for command</secondary>
42554 </indexterm>
42555 <indexterm role="concept">
42556 <primary>environment for pipe transport</primary>
42557 </indexterm>
42558 The environment variables listed below are set up when the command is invoked.
42559 This list is a compromise for maximum compatibility with other MTAs. Note that
42560 the <option>environment</option> option can be used to add additional variables to this
42561 environment.
42562 </para>
42563 <literallayout>
42564 <literal>DOMAIN            </literal>   the domain of the address
42565 <literal>HOME              </literal>   the home directory, if set
42566 <literal>HOST              </literal>   the host name when called from a router (see below)
42567 <literal>LOCAL_PART        </literal>   see below
42568 <literal>LOCAL_PART_PREFIX </literal>   see below
42569 <literal>LOCAL_PART_SUFFIX </literal>   see below
42570 <literal>LOGNAME           </literal>   see below
42571 <literal>MESSAGE_ID        </literal>   Exim&#x2019;s local ID for the message
42572 <literal>PATH              </literal>   as specified by the <option>path</option> option below
42573 <literal>QUALIFY_DOMAIN    </literal>   the sender qualification domain
42574 <literal>RECIPIENT         </literal>   the complete recipient address
42575 <literal>SENDER            </literal>   the sender of the message (empty if a bounce)
42576 <literal>SHELL             </literal>   <literal>/bin/sh</literal>
42577 <literal>TZ                </literal>   the value of the <option>timezone</option> option, if set
42578 <literal>USER              </literal>   see below
42579 </literallayout>
42580 <para>
42581 When a <command>pipe</command> transport is called directly from (for example) an <command>accept</command>
42582 router, LOCAL_PART is set to the local part of the address. When it is
42583 called as a result of a forward or alias expansion, LOCAL_PART is set to
42584 the local part of the address that was expanded. In both cases, any affixes are
42585 removed from the local part, and made available in LOCAL_PART_PREFIX and
42586 LOCAL_PART_SUFFIX, respectively. LOGNAME and USER are set to the
42587 same value as LOCAL_PART for compatibility with other MTAs.
42588 </para>
42589 <para>
42590 <indexterm role="concept">
42591 <primary>HOST</primary>
42592 </indexterm>
42593 HOST is set only when a <command>pipe</command> transport is called from a router that
42594 associates hosts with an address, typically when using <command>pipe</command> as a
42595 pseudo-remote transport. HOST is set to the first host name specified by
42596 the router.
42597 </para>
42598 <para>
42599 <indexterm role="concept">
42600 <primary>HOME</primary>
42601 </indexterm>
42602 If the transport&#x2019;s generic <option>home_directory</option> option is set, its value is used
42603 for the HOME environment variable. Otherwise, a home directory may be set
42604 by the router&#x2019;s <option>transport_home_directory</option> option, which defaults to the
42605 user&#x2019;s home directory if <option>check_local_user</option> is set.
42606 </para>
42607 </section>
42608 <section id="SECID142">
42609 <title>Private options for pipe</title>
42610 <para>
42611 <indexterm role="concept">
42612 <primary>options</primary>
42613 <secondary><command>pipe</command> transport</secondary>
42614 </indexterm>
42615 </para>
42616 <para>
42617 <indexterm role="option">
42618 <primary><option>allow_commands</option></primary>
42619 </indexterm>
42620 </para>
42621 <informaltable frame="all">
42622 <tgroup cols="4" colsep="0" rowsep="0">
42623 <colspec colwidth="8*" align="left"/>
42624 <colspec colwidth="6*" align="center"/>
42625 <colspec colwidth="6*" align="center"/>
42626 <colspec colwidth="6*" align="right"/>
42627 <tbody>
42628 <row>
42629 <entry><option>allow_commands</option></entry>
42630 <entry>Use: <emphasis>pipe</emphasis></entry>
42631 <entry>Type: <emphasis>string list</emphasis>&dagger;<emphasis></emphasis></entry>
42632 <entry>Default: <emphasis>unset</emphasis></entry>
42633 </row>
42634 </tbody>
42635 </tgroup>
42636 </informaltable>
42637 <para>
42638 <indexterm role="concept">
42639 <primary><command>pipe</command> transport</primary>
42640 <secondary>permitted commands</secondary>
42641 </indexterm>
42642 The string is expanded, and is then interpreted as a colon-separated list of
42643 permitted commands. If <option>restrict_to_path</option> is not set, the only commands
42644 permitted are those in the <option>allow_commands</option> list. They need not be absolute
42645 paths; the <option>path</option> option is still used for relative paths. If
42646 <option>restrict_to_path</option> is set with <option>allow_commands</option>, the command must either be
42647 in the <option>allow_commands</option> list, or a name without any slashes that is found on
42648 the path. In other words, if neither <option>allow_commands</option> nor
42649 <option>restrict_to_path</option> is set, there is no restriction on the command, but
42650 otherwise only commands that are permitted by one or the other are allowed. For
42651 example, if
42652 </para>
42653 <literallayout class="monospaced">
42654 allow_commands = /usr/bin/vacation
42655 </literallayout>
42656 <para>
42657 and <option>restrict_to_path</option> is not set, the only permitted command is
42658 <filename>/usr/bin/vacation</filename>. The <option>allow_commands</option> option may not be set if
42659 <option>use_shell</option> is set.
42660 </para>
42661 <para>
42662 <indexterm role="option">
42663 <primary><option>batch_id</option></primary>
42664 </indexterm>
42665 </para>
42666 <informaltable frame="all">
42667 <tgroup cols="4" colsep="0" rowsep="0">
42668 <colspec colwidth="8*" align="left"/>
42669 <colspec colwidth="6*" align="center"/>
42670 <colspec colwidth="6*" align="center"/>
42671 <colspec colwidth="6*" align="right"/>
42672 <tbody>
42673 <row>
42674 <entry><option>batch_id</option></entry>
42675 <entry>Use: <emphasis>pipe</emphasis></entry>
42676 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
42677 <entry>Default: <emphasis>unset</emphasis></entry>
42678 </row>
42679 </tbody>
42680 </tgroup>
42681 </informaltable>
42682 <para>
42683 See the description of local delivery batching in chapter <xref linkend="CHAPbatching"/>.
42684 </para>
42685 <para>
42686 <indexterm role="option">
42687 <primary><option>batch_max</option></primary>
42688 </indexterm>
42689 </para>
42690 <informaltable frame="all">
42691 <tgroup cols="4" colsep="0" rowsep="0">
42692 <colspec colwidth="8*" align="left"/>
42693 <colspec colwidth="6*" align="center"/>
42694 <colspec colwidth="6*" align="center"/>
42695 <colspec colwidth="6*" align="right"/>
42696 <tbody>
42697 <row>
42698 <entry><option>batch_max</option></entry>
42699 <entry>Use: <emphasis>pipe</emphasis></entry>
42700 <entry>Type: <emphasis>integer</emphasis></entry>
42701 <entry>Default: <emphasis>1</emphasis></entry>
42702 </row>
42703 </tbody>
42704 </tgroup>
42705 </informaltable>
42706 <para>
42707 This limits the number of addresses that can be handled in a single delivery.
42708 See the description of local delivery batching in chapter <xref linkend="CHAPbatching"/>.
42709 </para>
42710 <para>
42711 <indexterm role="option">
42712 <primary><option>check_string</option></primary>
42713 </indexterm>
42714 </para>
42715 <informaltable frame="all">
42716 <tgroup cols="4" colsep="0" rowsep="0">
42717 <colspec colwidth="8*" align="left"/>
42718 <colspec colwidth="6*" align="center"/>
42719 <colspec colwidth="6*" align="center"/>
42720 <colspec colwidth="6*" align="right"/>
42721 <tbody>
42722 <row>
42723 <entry><option>check_string</option></entry>
42724 <entry>Use: <emphasis>pipe</emphasis></entry>
42725 <entry>Type: <emphasis>string</emphasis></entry>
42726 <entry>Default: <emphasis>unset</emphasis></entry>
42727 </row>
42728 </tbody>
42729 </tgroup>
42730 </informaltable>
42731 <para>
42732 As <command>pipe</command> writes the message, the start of each line is tested for matching
42733 <option>check_string</option>, and if it does, the initial matching characters are replaced
42734 by the contents of <option>escape_string</option>, provided both are set. The value of
42735 <option>check_string</option> is a literal string, not a regular expression, and the case of
42736 any letters it contains is significant. When <option>use_bsmtp</option> is set, the contents
42737 of <option>check_string</option> and <option>escape_string</option> are forced to values that implement
42738 the SMTP escaping protocol. Any settings made in the configuration file are
42739 ignored.
42740 </para>
42741 <para>
42742 <indexterm role="option">
42743 <primary><option>command</option></primary>
42744 </indexterm>
42745 </para>
42746 <informaltable frame="all">
42747 <tgroup cols="4" colsep="0" rowsep="0">
42748 <colspec colwidth="8*" align="left"/>
42749 <colspec colwidth="6*" align="center"/>
42750 <colspec colwidth="6*" align="center"/>
42751 <colspec colwidth="6*" align="right"/>
42752 <tbody>
42753 <row>
42754 <entry><option>command</option></entry>
42755 <entry>Use: <emphasis>pipe</emphasis></entry>
42756 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
42757 <entry>Default: <emphasis>unset</emphasis></entry>
42758 </row>
42759 </tbody>
42760 </tgroup>
42761 </informaltable>
42762 <para>
42763 This option need not be set when <command>pipe</command> is being used to deliver to pipes
42764 obtained directly from address redirections. In other cases, the option must be
42765 set, to provide a command to be run. It need not yield an absolute path (see
42766 the <option>path</option> option below). The command is split up into separate arguments by
42767 Exim, and each argument is separately expanded, as described in section
42768 <xref linkend="SECThowcommandrun"/> above.
42769 </para>
42770 <para>
42771 <indexterm role="option">
42772 <primary><option>environment</option></primary>
42773 </indexterm>
42774 </para>
42775 <informaltable frame="all">
42776 <tgroup cols="4" colsep="0" rowsep="0">
42777 <colspec colwidth="8*" align="left"/>
42778 <colspec colwidth="6*" align="center"/>
42779 <colspec colwidth="6*" align="center"/>
42780 <colspec colwidth="6*" align="right"/>
42781 <tbody>
42782 <row>
42783 <entry><option>environment</option></entry>
42784 <entry>Use: <emphasis>pipe</emphasis></entry>
42785 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
42786 <entry>Default: <emphasis>unset</emphasis></entry>
42787 </row>
42788 </tbody>
42789 </tgroup>
42790 </informaltable>
42791 <para>
42792 <indexterm role="concept">
42793 <primary><command>pipe</command> transport</primary>
42794 <secondary>environment for command</secondary>
42795 </indexterm>
42796 <indexterm role="concept">
42797 <primary>environment for <command>pipe</command> transport</primary>
42798 </indexterm>
42799 This option is used to add additional variables to the environment in which the
42800 command runs (see section <xref linkend="SECTpipeenv"/> for the default list). Its value is
42801 a string which is expanded, and then interpreted as a colon-separated list of
42802 environment settings of the form &lt;<emphasis>name</emphasis>&gt;=&lt;<emphasis>value</emphasis>&gt;.
42803 </para>
42804 <para>
42805 <indexterm role="option">
42806 <primary><option>escape_string</option></primary>
42807 </indexterm>
42808 </para>
42809 <informaltable frame="all">
42810 <tgroup cols="4" colsep="0" rowsep="0">
42811 <colspec colwidth="8*" align="left"/>
42812 <colspec colwidth="6*" align="center"/>
42813 <colspec colwidth="6*" align="center"/>
42814 <colspec colwidth="6*" align="right"/>
42815 <tbody>
42816 <row>
42817 <entry><option>escape_string</option></entry>
42818 <entry>Use: <emphasis>pipe</emphasis></entry>
42819 <entry>Type: <emphasis>string</emphasis></entry>
42820 <entry>Default: <emphasis>unset</emphasis></entry>
42821 </row>
42822 </tbody>
42823 </tgroup>
42824 </informaltable>
42825 <para>
42826 See <option>check_string</option> above.
42827 </para>
42828 <para>
42829 <indexterm role="option">
42830 <primary><option>freeze_exec_fail</option></primary>
42831 </indexterm>
42832 </para>
42833 <informaltable frame="all">
42834 <tgroup cols="4" colsep="0" rowsep="0">
42835 <colspec colwidth="8*" align="left"/>
42836 <colspec colwidth="6*" align="center"/>
42837 <colspec colwidth="6*" align="center"/>
42838 <colspec colwidth="6*" align="right"/>
42839 <tbody>
42840 <row>
42841 <entry><option>freeze_exec_fail</option></entry>
42842 <entry>Use: <emphasis>pipe</emphasis></entry>
42843 <entry>Type: <emphasis>boolean</emphasis></entry>
42844 <entry>Default: <emphasis>false</emphasis></entry>
42845 </row>
42846 </tbody>
42847 </tgroup>
42848 </informaltable>
42849 <para>
42850 <indexterm role="concept">
42851 <primary>exec failure</primary>
42852 </indexterm>
42853 <indexterm role="concept">
42854 <primary>failure of exec</primary>
42855 </indexterm>
42856 <indexterm role="concept">
42857 <primary><command>pipe</command> transport</primary>
42858 <secondary>failure of exec</secondary>
42859 </indexterm>
42860 Failure to exec the command in a pipe transport is by default treated like
42861 any other failure while running the command. However, if <option>freeze_exec_fail</option>
42862 is set, failure to exec is treated specially, and causes the message to be
42863 frozen, whatever the setting of <option>ignore_status</option>.
42864 </para>
42865 <para>
42866 <indexterm role="option">
42867 <primary><option>freeze_signal</option></primary>
42868 </indexterm>
42869 </para>
42870 <informaltable frame="all">
42871 <tgroup cols="4" colsep="0" rowsep="0">
42872 <colspec colwidth="8*" align="left"/>
42873 <colspec colwidth="6*" align="center"/>
42874 <colspec colwidth="6*" align="center"/>
42875 <colspec colwidth="6*" align="right"/>
42876 <tbody>
42877 <row>
42878 <entry><option>freeze_signal</option></entry>
42879 <entry>Use: <emphasis>pipe</emphasis></entry>
42880 <entry>Type: <emphasis>boolean</emphasis></entry>
42881 <entry>Default: <emphasis>false</emphasis></entry>
42882 </row>
42883 </tbody>
42884 </tgroup>
42885 </informaltable>
42886 <para>
42887 <indexterm role="concept">
42888 <primary>signal exit</primary>
42889 </indexterm>
42890 <indexterm role="concept">
42891 <primary><command>pipe</command> transport</primary>
42892 <secondary>,</secondary>
42893 </indexterm>
42894 Normally if the process run by a command in a pipe transport exits on a signal,
42895 a bounce message is sent. If <option>freeze_signal</option> is set, the message will be
42896 frozen in Exim&#x2019;s queue instead.
42897 </para>
42898 <para>
42899 <indexterm role="option">
42900 <primary><option>force_command</option></primary>
42901 </indexterm>
42902 </para>
42903 <informaltable frame="all">
42904 <tgroup cols="4" colsep="0" rowsep="0">
42905 <colspec colwidth="8*" align="left"/>
42906 <colspec colwidth="6*" align="center"/>
42907 <colspec colwidth="6*" align="center"/>
42908 <colspec colwidth="6*" align="right"/>
42909 <tbody>
42910 <row>
42911 <entry><option>force_command</option></entry>
42912 <entry>Use: <emphasis>pipe</emphasis></entry>
42913 <entry>Type: <emphasis>boolean</emphasis></entry>
42914 <entry>Default: <emphasis>false</emphasis></entry>
42915 </row>
42916 </tbody>
42917 </tgroup>
42918 </informaltable>
42919 <para>
42920 <indexterm role="concept">
42921 <primary>force command</primary>
42922 </indexterm>
42923 <indexterm role="concept">
42924 <primary><command>pipe</command> transport</primary>
42925 <secondary>,</secondary>
42926 </indexterm>
42927 Normally when a router redirects an address directly to a pipe command
42928 the <option>command</option> option on the transport is ignored.  If <option>force_command</option>
42929 is set, the <option>command</option> option will used. This is especially
42930 useful for forcing a wrapper or additional argument to be added to the
42931 command. For example:
42932 </para>
42933 <literallayout class="monospaced">
42934 command = /usr/bin/remote_exec myhost -- $address_pipe
42935 force_command
42936 </literallayout>
42937 <para>
42938 Note that <varname>$address_pipe</varname> is handled specially in <option>command</option> when
42939 <option>force_command</option> is set, expanding out to the original argument vector as
42940 separate items, similarly to a Unix shell <literal>"$@"</literal> construct.
42941 </para>
42942 <para>
42943 <indexterm role="option">
42944 <primary><option>ignore_status</option></primary>
42945 </indexterm>
42946 </para>
42947 <informaltable frame="all">
42948 <tgroup cols="4" colsep="0" rowsep="0">
42949 <colspec colwidth="8*" align="left"/>
42950 <colspec colwidth="6*" align="center"/>
42951 <colspec colwidth="6*" align="center"/>
42952 <colspec colwidth="6*" align="right"/>
42953 <tbody>
42954 <row>
42955 <entry><option>ignore_status</option></entry>
42956 <entry>Use: <emphasis>pipe</emphasis></entry>
42957 <entry>Type: <emphasis>boolean</emphasis></entry>
42958 <entry>Default: <emphasis>false</emphasis></entry>
42959 </row>
42960 </tbody>
42961 </tgroup>
42962 </informaltable>
42963 <para>
42964 If this option is true, the status returned by the subprocess that is set up to
42965 run the command is ignored, and Exim behaves as if zero had been returned.
42966 Otherwise, a non-zero status or termination by signal causes an error return
42967 from the transport unless the status value is one of those listed in
42968 <option>temp_errors</option>; these cause the delivery to be deferred and tried again later.
42969 </para>
42970 <para>
42971 <emphasis role="bold">Note</emphasis>: This option does not apply to timeouts, which do not return a status.
42972 See the <option>timeout_defer</option> option for how timeouts are handled.
42973 </para>
42974 <para>
42975 <indexterm role="option">
42976 <primary><option>log_defer_output</option></primary>
42977 </indexterm>
42978 </para>
42979 <informaltable frame="all">
42980 <tgroup cols="4" colsep="0" rowsep="0">
42981 <colspec colwidth="8*" align="left"/>
42982 <colspec colwidth="6*" align="center"/>
42983 <colspec colwidth="6*" align="center"/>
42984 <colspec colwidth="6*" align="right"/>
42985 <tbody>
42986 <row>
42987 <entry><option>log_defer_output</option></entry>
42988 <entry>Use: <emphasis>pipe</emphasis></entry>
42989 <entry>Type: <emphasis>boolean</emphasis></entry>
42990 <entry>Default: <emphasis>false</emphasis></entry>
42991 </row>
42992 </tbody>
42993 </tgroup>
42994 </informaltable>
42995 <para>
42996 <indexterm role="concept">
42997 <primary><command>pipe</command> transport</primary>
42998 <secondary>logging output</secondary>
42999 </indexterm>
43000 If this option is set, and the status returned by the command is
43001 one of the codes listed in <option>temp_errors</option> (that is, delivery was deferred),
43002 and any output was produced, the first line of it is written to the main log.
43003 </para>
43004 <para>
43005 <indexterm role="option">
43006 <primary><option>log_fail_output</option></primary>
43007 </indexterm>
43008 </para>
43009 <informaltable frame="all">
43010 <tgroup cols="4" colsep="0" rowsep="0">
43011 <colspec colwidth="8*" align="left"/>
43012 <colspec colwidth="6*" align="center"/>
43013 <colspec colwidth="6*" align="center"/>
43014 <colspec colwidth="6*" align="right"/>
43015 <tbody>
43016 <row>
43017 <entry><option>log_fail_output</option></entry>
43018 <entry>Use: <emphasis>pipe</emphasis></entry>
43019 <entry>Type: <emphasis>boolean</emphasis></entry>
43020 <entry>Default: <emphasis>false</emphasis></entry>
43021 </row>
43022 </tbody>
43023 </tgroup>
43024 </informaltable>
43025 <para>
43026 If this option is set, and the command returns any output, and also ends with a
43027 return code that is neither zero nor one of the return codes listed in
43028 <option>temp_errors</option> (that is, the delivery failed), the first line of output is
43029 written to the main log. This option and <option>log_output</option> are mutually exclusive.
43030 Only one of them may be set.
43031 </para>
43032 <para>
43033 <indexterm role="option">
43034 <primary><option>log_output</option></primary>
43035 </indexterm>
43036 </para>
43037 <informaltable frame="all">
43038 <tgroup cols="4" colsep="0" rowsep="0">
43039 <colspec colwidth="8*" align="left"/>
43040 <colspec colwidth="6*" align="center"/>
43041 <colspec colwidth="6*" align="center"/>
43042 <colspec colwidth="6*" align="right"/>
43043 <tbody>
43044 <row>
43045 <entry><option>log_output</option></entry>
43046 <entry>Use: <emphasis>pipe</emphasis></entry>
43047 <entry>Type: <emphasis>boolean</emphasis></entry>
43048 <entry>Default: <emphasis>false</emphasis></entry>
43049 </row>
43050 </tbody>
43051 </tgroup>
43052 </informaltable>
43053 <para>
43054 If this option is set and the command returns any output, the first line of
43055 output is written to the main log, whatever the return code. This option and
43056 <option>log_fail_output</option> are mutually exclusive. Only one of them may be set.
43057 </para>
43058 <para>
43059 <indexterm role="option">
43060 <primary><option>max_output</option></primary>
43061 </indexterm>
43062 </para>
43063 <informaltable frame="all">
43064 <tgroup cols="4" colsep="0" rowsep="0">
43065 <colspec colwidth="8*" align="left"/>
43066 <colspec colwidth="6*" align="center"/>
43067 <colspec colwidth="6*" align="center"/>
43068 <colspec colwidth="6*" align="right"/>
43069 <tbody>
43070 <row>
43071 <entry><option>max_output</option></entry>
43072 <entry>Use: <emphasis>pipe</emphasis></entry>
43073 <entry>Type: <emphasis>integer</emphasis></entry>
43074 <entry>Default: <emphasis>20K</emphasis></entry>
43075 </row>
43076 </tbody>
43077 </tgroup>
43078 </informaltable>
43079 <para>
43080 This specifies the maximum amount of output that the command may produce on its
43081 standard output and standard error file combined. If the limit is exceeded, the
43082 process running the command is killed. This is intended as a safety measure to
43083 catch runaway processes. The limit is applied independently of the settings of
43084 the options that control what is done with such output (for example,
43085 <option>return_output</option>). Because of buffering effects, the amount of output may
43086 exceed the limit by a small amount before Exim notices.
43087 </para>
43088 <para>
43089 <indexterm role="option">
43090 <primary><option>message_prefix</option></primary>
43091 </indexterm>
43092 </para>
43093 <informaltable frame="all">
43094 <tgroup cols="4" colsep="0" rowsep="0">
43095 <colspec colwidth="8*" align="left"/>
43096 <colspec colwidth="6*" align="center"/>
43097 <colspec colwidth="6*" align="center"/>
43098 <colspec colwidth="6*" align="right"/>
43099 <tbody>
43100 <row>
43101 <entry><option>message_prefix</option></entry>
43102 <entry>Use: <emphasis>pipe</emphasis></entry>
43103 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
43104 <entry>Default: <emphasis>see below</emphasis></entry>
43105 </row>
43106 </tbody>
43107 </tgroup>
43108 </informaltable>
43109 <para>
43110 The string specified here is expanded and output at the start of every message.
43111 The default is unset if <option>use_bsmtp</option> is set. Otherwise it is
43112 </para>
43113 <literallayout class="monospaced">
43114 message_prefix = \
43115   From ${if def:return_path{$return_path}{MAILER-DAEMON}}\
43116   ${tod_bsdinbox}\n
43117 </literallayout>
43118 <para>
43119 <indexterm role="concept">
43120 <primary>Cyrus</primary>
43121 </indexterm>
43122 <indexterm role="concept">
43123 <primary><option>tmail</option></primary>
43124 </indexterm>
43125 <indexterm role="concept">
43126 <primary><quote>From</quote> line</primary>
43127 </indexterm>
43128 This is required by the commonly used <filename>/usr/bin/vacation</filename> program.
43129 However, it must <emphasis>not</emphasis> be present if delivery is to the Cyrus IMAP server,
43130 or to the <option>tmail</option> local delivery agent. The prefix can be suppressed by
43131 setting
43132 </para>
43133 <literallayout class="monospaced">
43134 message_prefix =
43135 </literallayout>
43136 <para>
43137 <emphasis role="bold">Note:</emphasis> If you set <option>use_crlf</option> true, you must change any occurrences of
43138 <literal>\n</literal> to <literal>\r\n</literal> in <option>message_prefix</option>.
43139 </para>
43140 <para>
43141 <indexterm role="option">
43142 <primary><option>message_suffix</option></primary>
43143 </indexterm>
43144 </para>
43145 <informaltable frame="all">
43146 <tgroup cols="4" colsep="0" rowsep="0">
43147 <colspec colwidth="8*" align="left"/>
43148 <colspec colwidth="6*" align="center"/>
43149 <colspec colwidth="6*" align="center"/>
43150 <colspec colwidth="6*" align="right"/>
43151 <tbody>
43152 <row>
43153 <entry><option>message_suffix</option></entry>
43154 <entry>Use: <emphasis>pipe</emphasis></entry>
43155 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
43156 <entry>Default: <emphasis>see below</emphasis></entry>
43157 </row>
43158 </tbody>
43159 </tgroup>
43160 </informaltable>
43161 <para>
43162 The string specified here is expanded and output at the end of every message.
43163 The default is unset if <option>use_bsmtp</option> is set. Otherwise it is a single newline.
43164 The suffix can be suppressed by setting
43165 </para>
43166 <literallayout class="monospaced">
43167 message_suffix =
43168 </literallayout>
43169 <para>
43170 <emphasis role="bold">Note:</emphasis> If you set <option>use_crlf</option> true, you must change any occurrences of
43171 <literal>\n</literal> to <literal>\r\n</literal> in <option>message_suffix</option>.
43172 </para>
43173 <para>
43174 <indexterm role="option">
43175 <primary><option>path</option></primary>
43176 </indexterm>
43177 </para>
43178 <informaltable frame="all">
43179 <tgroup cols="4" colsep="0" rowsep="0">
43180 <colspec colwidth="8*" align="left"/>
43181 <colspec colwidth="6*" align="center"/>
43182 <colspec colwidth="6*" align="center"/>
43183 <colspec colwidth="6*" align="right"/>
43184 <tbody>
43185 <row>
43186 <entry><option>path</option></entry>
43187 <entry>Use: <emphasis>pipe</emphasis></entry>
43188 <entry>Type: <emphasis>string</emphasis></entry>
43189 <entry>Default: <emphasis>see below</emphasis></entry>
43190 </row>
43191 </tbody>
43192 </tgroup>
43193 </informaltable>
43194 <para>
43195 This option specifies the string that is set up in the PATH environment
43196 variable of the subprocess. The default is:
43197 </para>
43198 <literallayout class="monospaced">
43199 /bin:/usr/bin
43200 </literallayout>
43201 <para>
43202 If the <option>command</option> option does not yield an absolute path name, the command is
43203 sought in the PATH directories, in the usual way. <emphasis role="bold">Warning</emphasis>: This does not
43204 apply to a command specified as a transport filter.
43205 </para>
43206 <para>
43207 <indexterm role="option">
43208 <primary><option>permit_coredump</option></primary>
43209 </indexterm>
43210 </para>
43211 <informaltable frame="all">
43212 <tgroup cols="4" colsep="0" rowsep="0">
43213 <colspec colwidth="8*" align="left"/>
43214 <colspec colwidth="6*" align="center"/>
43215 <colspec colwidth="6*" align="center"/>
43216 <colspec colwidth="6*" align="right"/>
43217 <tbody>
43218 <row>
43219 <entry><option>permit_coredump</option></entry>
43220 <entry>Use: <emphasis>pipe</emphasis></entry>
43221 <entry>Type: <emphasis>boolean</emphasis></entry>
43222 <entry>Default: <emphasis>false</emphasis></entry>
43223 </row>
43224 </tbody>
43225 </tgroup>
43226 </informaltable>
43227 <para>
43228 Normally Exim inhibits core-dumps during delivery.  If you have a need to get
43229 a core-dump of a pipe command, enable this command.  This enables core-dumps
43230 during delivery and affects both the Exim binary and the pipe command run.
43231 It is recommended that this option remain off unless and until you have a need
43232 for it and that this only be enabled when needed, as the risk of excessive
43233 resource consumption can be quite high.  Note also that Exim is typically
43234 installed as a setuid binary and most operating systems will inhibit coredumps
43235 of these by default, so further OS-specific action may be required.
43236 </para>
43237 <para>
43238 <indexterm role="option">
43239 <primary><option>pipe_as_creator</option></primary>
43240 </indexterm>
43241 </para>
43242 <informaltable frame="all">
43243 <tgroup cols="4" colsep="0" rowsep="0">
43244 <colspec colwidth="8*" align="left"/>
43245 <colspec colwidth="6*" align="center"/>
43246 <colspec colwidth="6*" align="center"/>
43247 <colspec colwidth="6*" align="right"/>
43248 <tbody>
43249 <row>
43250 <entry><option>pipe_as_creator</option></entry>
43251 <entry>Use: <emphasis>pipe</emphasis></entry>
43252 <entry>Type: <emphasis>boolean</emphasis></entry>
43253 <entry>Default: <emphasis>false</emphasis></entry>
43254 </row>
43255 </tbody>
43256 </tgroup>
43257 </informaltable>
43258 <para>
43259 <indexterm role="concept">
43260 <primary>uid (user id)</primary>
43261 <secondary>local delivery</secondary>
43262 </indexterm>
43263 If the generic <option>user</option> option is not set and this option is true, the delivery
43264 process is run under the uid that was in force when Exim was originally called
43265 to accept the message. If the group id is not otherwise set (via the generic
43266 <option>group</option> option), the gid that was in force when Exim was originally called to
43267 accept the message is used.
43268 </para>
43269 <para>
43270 <indexterm role="option">
43271 <primary><option>restrict_to_path</option></primary>
43272 </indexterm>
43273 </para>
43274 <informaltable frame="all">
43275 <tgroup cols="4" colsep="0" rowsep="0">
43276 <colspec colwidth="8*" align="left"/>
43277 <colspec colwidth="6*" align="center"/>
43278 <colspec colwidth="6*" align="center"/>
43279 <colspec colwidth="6*" align="right"/>
43280 <tbody>
43281 <row>
43282 <entry><option>restrict_to_path</option></entry>
43283 <entry>Use: <emphasis>pipe</emphasis></entry>
43284 <entry>Type: <emphasis>boolean</emphasis></entry>
43285 <entry>Default: <emphasis>false</emphasis></entry>
43286 </row>
43287 </tbody>
43288 </tgroup>
43289 </informaltable>
43290 <para>
43291 When this option is set, any command name not listed in <option>allow_commands</option> must
43292 contain no slashes. The command is searched for only in the directories listed
43293 in the <option>path</option> option. This option is intended for use in the case when a pipe
43294 command has been generated from a user&#x2019;s <filename>.forward</filename> file. This is usually
43295 handled by a <command>pipe</command> transport called <option>address_pipe</option>.
43296 </para>
43297 <para>
43298 <indexterm role="option">
43299 <primary><option>return_fail_output</option></primary>
43300 </indexterm>
43301 </para>
43302 <informaltable frame="all">
43303 <tgroup cols="4" colsep="0" rowsep="0">
43304 <colspec colwidth="8*" align="left"/>
43305 <colspec colwidth="6*" align="center"/>
43306 <colspec colwidth="6*" align="center"/>
43307 <colspec colwidth="6*" align="right"/>
43308 <tbody>
43309 <row>
43310 <entry><option>return_fail_output</option></entry>
43311 <entry>Use: <emphasis>pipe</emphasis></entry>
43312 <entry>Type: <emphasis>boolean</emphasis></entry>
43313 <entry>Default: <emphasis>false</emphasis></entry>
43314 </row>
43315 </tbody>
43316 </tgroup>
43317 </informaltable>
43318 <para>
43319 If this option is true, and the command produced any output and ended with a
43320 return code other than zero or one of the codes listed in <option>temp_errors</option> (that
43321 is, the delivery failed), the output is returned in the bounce message.
43322 However, if the message has a null sender (that is, it is itself a bounce
43323 message), output from the command is discarded. This option and
43324 <option>return_output</option> are mutually exclusive. Only one of them may be set.
43325 </para>
43326 <para>
43327 <indexterm role="option">
43328 <primary><option>return_output</option></primary>
43329 </indexterm>
43330 </para>
43331 <informaltable frame="all">
43332 <tgroup cols="4" colsep="0" rowsep="0">
43333 <colspec colwidth="8*" align="left"/>
43334 <colspec colwidth="6*" align="center"/>
43335 <colspec colwidth="6*" align="center"/>
43336 <colspec colwidth="6*" align="right"/>
43337 <tbody>
43338 <row>
43339 <entry><option>return_output</option></entry>
43340 <entry>Use: <emphasis>pipe</emphasis></entry>
43341 <entry>Type: <emphasis>boolean</emphasis></entry>
43342 <entry>Default: <emphasis>false</emphasis></entry>
43343 </row>
43344 </tbody>
43345 </tgroup>
43346 </informaltable>
43347 <para>
43348 If this option is true, and the command produced any output, the delivery is
43349 deemed to have failed whatever the return code from the command, and the output
43350 is returned in the bounce message. Otherwise, the output is just discarded.
43351 However, if the message has a null sender (that is, it is a bounce message),
43352 output from the command is always discarded, whatever the setting of this
43353 option. This option and <option>return_fail_output</option> are mutually exclusive. Only one
43354 of them may be set.
43355 </para>
43356 <para>
43357 <indexterm role="option">
43358 <primary><option>temp_errors</option></primary>
43359 </indexterm>
43360 </para>
43361 <informaltable frame="all">
43362 <tgroup cols="4" colsep="0" rowsep="0">
43363 <colspec colwidth="8*" align="left"/>
43364 <colspec colwidth="6*" align="center"/>
43365 <colspec colwidth="6*" align="center"/>
43366 <colspec colwidth="6*" align="right"/>
43367 <tbody>
43368 <row>
43369 <entry><option>temp_errors</option></entry>
43370 <entry>Use: <emphasis>pipe</emphasis></entry>
43371 <entry>Type: <emphasis>string list</emphasis></entry>
43372 <entry>Default: <emphasis>see below</emphasis></entry>
43373 </row>
43374 </tbody>
43375 </tgroup>
43376 </informaltable>
43377 <para>
43378 <indexterm role="concept">
43379 <primary><command>pipe</command> transport</primary>
43380 <secondary>temporary failure</secondary>
43381 </indexterm>
43382 This option contains either a colon-separated list of numbers, or a single
43383 asterisk. If <option>ignore_status</option> is false
43384 and <option>return_output</option> is not set,
43385 and the command exits with a non-zero return code, the failure is treated as
43386 temporary and the delivery is deferred if the return code matches one of the
43387 numbers, or if the setting is a single asterisk. Otherwise, non-zero return
43388 codes are treated as permanent errors. The default setting contains the codes
43389 defined by EX_TEMPFAIL and EX_CANTCREAT in <filename>sysexits.h</filename>. If Exim is
43390 compiled on a system that does not define these macros, it assumes values of 75
43391 and 73, respectively.
43392 </para>
43393 <para>
43394 <indexterm role="option">
43395 <primary><option>timeout</option></primary>
43396 </indexterm>
43397 </para>
43398 <informaltable frame="all">
43399 <tgroup cols="4" colsep="0" rowsep="0">
43400 <colspec colwidth="8*" align="left"/>
43401 <colspec colwidth="6*" align="center"/>
43402 <colspec colwidth="6*" align="center"/>
43403 <colspec colwidth="6*" align="right"/>
43404 <tbody>
43405 <row>
43406 <entry><option>timeout</option></entry>
43407 <entry>Use: <emphasis>pipe</emphasis></entry>
43408 <entry>Type: <emphasis>time</emphasis></entry>
43409 <entry>Default: <emphasis>1h</emphasis></entry>
43410 </row>
43411 </tbody>
43412 </tgroup>
43413 </informaltable>
43414 <para>
43415 If the command fails to complete within this time, it is killed. This normally
43416 causes the delivery to fail (but see <option>timeout_defer</option>). A zero time interval
43417 specifies no timeout. In order to ensure that any subprocesses created by the
43418 command are also killed, Exim makes the initial process a process group leader,
43419 and kills the whole process group on a timeout. However, this can be defeated
43420 if one of the processes starts a new process group.
43421 </para>
43422 <para>
43423 <indexterm role="option">
43424 <primary><option>timeout_defer</option></primary>
43425 </indexterm>
43426 </para>
43427 <informaltable frame="all">
43428 <tgroup cols="4" colsep="0" rowsep="0">
43429 <colspec colwidth="8*" align="left"/>
43430 <colspec colwidth="6*" align="center"/>
43431 <colspec colwidth="6*" align="center"/>
43432 <colspec colwidth="6*" align="right"/>
43433 <tbody>
43434 <row>
43435 <entry><option>timeout_defer</option></entry>
43436 <entry>Use: <emphasis>pipe</emphasis></entry>
43437 <entry>Type: <emphasis>boolean</emphasis></entry>
43438 <entry>Default: <emphasis>false</emphasis></entry>
43439 </row>
43440 </tbody>
43441 </tgroup>
43442 </informaltable>
43443 <para>
43444 A timeout in a <command>pipe</command> transport, either in the command that the transport
43445 runs, or in a transport filter that is associated with it, is by default
43446 treated as a hard error, and the delivery fails. However, if <option>timeout_defer</option>
43447 is set true, both kinds of timeout become temporary errors, causing the
43448 delivery to be deferred.
43449 </para>
43450 <para>
43451 <indexterm role="option">
43452 <primary><option>umask</option></primary>
43453 </indexterm>
43454 </para>
43455 <informaltable frame="all">
43456 <tgroup cols="4" colsep="0" rowsep="0">
43457 <colspec colwidth="8*" align="left"/>
43458 <colspec colwidth="6*" align="center"/>
43459 <colspec colwidth="6*" align="center"/>
43460 <colspec colwidth="6*" align="right"/>
43461 <tbody>
43462 <row>
43463 <entry><option>umask</option></entry>
43464 <entry>Use: <emphasis>pipe</emphasis></entry>
43465 <entry>Type: <emphasis>octal integer</emphasis></entry>
43466 <entry>Default: <emphasis>022</emphasis></entry>
43467 </row>
43468 </tbody>
43469 </tgroup>
43470 </informaltable>
43471 <para>
43472 This specifies the umask setting for the subprocess that runs the command.
43473 </para>
43474 <para>
43475 <indexterm role="option">
43476 <primary><option>use_bsmtp</option></primary>
43477 </indexterm>
43478 </para>
43479 <informaltable frame="all">
43480 <tgroup cols="4" colsep="0" rowsep="0">
43481 <colspec colwidth="8*" align="left"/>
43482 <colspec colwidth="6*" align="center"/>
43483 <colspec colwidth="6*" align="center"/>
43484 <colspec colwidth="6*" align="right"/>
43485 <tbody>
43486 <row>
43487 <entry><option>use_bsmtp</option></entry>
43488 <entry>Use: <emphasis>pipe</emphasis></entry>
43489 <entry>Type: <emphasis>boolean</emphasis></entry>
43490 <entry>Default: <emphasis>false</emphasis></entry>
43491 </row>
43492 </tbody>
43493 </tgroup>
43494 </informaltable>
43495 <para>
43496 <indexterm role="concept">
43497 <primary>envelope sender</primary>
43498 </indexterm>
43499 If this option is set true, the <command>pipe</command> transport writes messages in <quote>batch
43500 SMTP</quote> format, with the envelope sender and recipient(s) included as SMTP
43501 commands. If you want to include a leading HELO command with such messages,
43502 you can do so by setting the <option>message_prefix</option> option. See section
43503 <xref linkend="SECTbatchSMTP"/> for details of batch SMTP.
43504 </para>
43505 <para>
43506 <indexterm role="option">
43507 <primary><option>use_classresources</option></primary>
43508 </indexterm>
43509 </para>
43510 <informaltable frame="all">
43511 <tgroup cols="4" colsep="0" rowsep="0">
43512 <colspec colwidth="8*" align="left"/>
43513 <colspec colwidth="6*" align="center"/>
43514 <colspec colwidth="6*" align="center"/>
43515 <colspec colwidth="6*" align="right"/>
43516 <tbody>
43517 <row>
43518 <entry><option>use_classresources</option></entry>
43519 <entry>Use: <emphasis>pipe</emphasis></entry>
43520 <entry>Type: <emphasis>boolean</emphasis></entry>
43521 <entry>Default: <emphasis>false</emphasis></entry>
43522 </row>
43523 </tbody>
43524 </tgroup>
43525 </informaltable>
43526 <para>
43527 <indexterm role="concept">
43528 <primary>class resources (BSD)</primary>
43529 </indexterm>
43530 This option is available only when Exim is running on FreeBSD, NetBSD, or
43531 BSD/OS. If it is set true, the <function>setclassresources()</function> function is used to set
43532 resource limits when a <command>pipe</command> transport is run to perform a delivery. The
43533 limits for the uid under which the pipe is to run are obtained from the login
43534 class database.
43535 </para>
43536 <para>
43537 <indexterm role="option">
43538 <primary><option>use_crlf</option></primary>
43539 </indexterm>
43540 </para>
43541 <informaltable frame="all">
43542 <tgroup cols="4" colsep="0" rowsep="0">
43543 <colspec colwidth="8*" align="left"/>
43544 <colspec colwidth="6*" align="center"/>
43545 <colspec colwidth="6*" align="center"/>
43546 <colspec colwidth="6*" align="right"/>
43547 <tbody>
43548 <row>
43549 <entry><option>use_crlf</option></entry>
43550 <entry>Use: <emphasis>pipe</emphasis></entry>
43551 <entry>Type: <emphasis>boolean</emphasis></entry>
43552 <entry>Default: <emphasis>false</emphasis></entry>
43553 </row>
43554 </tbody>
43555 </tgroup>
43556 </informaltable>
43557 <para>
43558 <indexterm role="concept">
43559 <primary>carriage return</primary>
43560 </indexterm>
43561 <indexterm role="concept">
43562 <primary>linefeed</primary>
43563 </indexterm>
43564 This option causes lines to be terminated with the two-character CRLF sequence
43565 (carriage return, linefeed) instead of just a linefeed character. In the case
43566 of batched SMTP, the byte sequence written to the pipe is then an exact image
43567 of what would be sent down a real SMTP connection.
43568 </para>
43569 <para>
43570 The contents of the <option>message_prefix</option> and <option>message_suffix</option> options are
43571 written verbatim, so must contain their own carriage return characters if these
43572 are needed. When <option>use_bsmtp</option> is not set, the default values for both
43573 <option>message_prefix</option> and <option>message_suffix</option> end with a single linefeed, so their
43574 values must be changed to end with <literal>\r\n</literal> if <option>use_crlf</option> is set.
43575 </para>
43576 <para>
43577 <indexterm role="option">
43578 <primary><option>use_shell</option></primary>
43579 </indexterm>
43580 </para>
43581 <informaltable frame="all">
43582 <tgroup cols="4" colsep="0" rowsep="0">
43583 <colspec colwidth="8*" align="left"/>
43584 <colspec colwidth="6*" align="center"/>
43585 <colspec colwidth="6*" align="center"/>
43586 <colspec colwidth="6*" align="right"/>
43587 <tbody>
43588 <row>
43589 <entry><option>use_shell</option></entry>
43590 <entry>Use: <emphasis>pipe</emphasis></entry>
43591 <entry>Type: <emphasis>boolean</emphasis></entry>
43592 <entry>Default: <emphasis>false</emphasis></entry>
43593 </row>
43594 </tbody>
43595 </tgroup>
43596 </informaltable>
43597 <para>
43598 <indexterm role="variable">
43599 <primary><varname>$pipe_addresses</varname></primary>
43600 </indexterm>
43601 If this option is set, it causes the command to be passed to <filename>/bin/sh</filename>
43602 instead of being run directly from the transport, as described in section
43603 <xref linkend="SECThowcommandrun"/>. This is less secure, but is needed in some situations
43604 where the command is expected to be run under a shell and cannot easily be
43605 modified. The <option>allow_commands</option> and <option>restrict_to_path</option> options, and the
43606 <literal>$pipe_addresses</literal> facility are incompatible with <option>use_shell</option>. The
43607 command is expanded as a single string, and handed to <filename>/bin/sh</filename> as data for
43608 its <option>-c</option> option.
43609 </para>
43610 </section>
43611 <section id="SECID143">
43612 <title>Using an external local delivery agent</title>
43613 <para>
43614 <indexterm role="concept">
43615 <primary>local delivery</primary>
43616 <secondary>using an external agent</secondary>
43617 </indexterm>
43618 <indexterm role="concept">
43619 <primary><emphasis>procmail</emphasis></primary>
43620 </indexterm>
43621 <indexterm role="concept">
43622 <primary>external local delivery</primary>
43623 </indexterm>
43624 <indexterm role="concept">
43625 <primary>delivery</primary>
43626 <secondary><emphasis>procmail</emphasis></secondary>
43627 </indexterm>
43628 <indexterm role="concept">
43629 <primary>delivery</primary>
43630 <secondary>by external agent</secondary>
43631 </indexterm>
43632 The <command>pipe</command> transport can be used to pass all messages that require local
43633 delivery to a separate local delivery agent such as <option>procmail</option>. When doing
43634 this, care must be taken to ensure that the pipe is run under an appropriate
43635 uid and gid. In some configurations one wants this to be a uid that is trusted
43636 by the delivery agent to supply the correct sender of the message. It may be
43637 necessary to recompile or reconfigure the delivery agent so that it trusts an
43638 appropriate user. The following is an example transport and router
43639 configuration for <option>procmail</option>:
43640 </para>
43641 <literallayout class="monospaced">
43642 # transport
43643 procmail_pipe:
43644   driver = pipe
43645   command = /usr/local/bin/procmail -d $local_part
43646   return_path_add
43647   delivery_date_add
43648   envelope_to_add
43649   check_string = "From "
43650   escape_string = "&gt;From "
43651   umask = 077
43652   user = $local_part
43653   group = mail
43654
43655 # router
43656 procmail:
43657   driver = accept
43658   check_local_user
43659   transport = procmail_pipe
43660 </literallayout>
43661 <para>
43662 In this example, the pipe is run as the local user, but with the group set to
43663 <emphasis>mail</emphasis>. An alternative is to run the pipe as a specific user such as <emphasis>mail</emphasis>
43664 or <emphasis>exim</emphasis>, but in this case you must arrange for <option>procmail</option> to trust that
43665 user to supply a correct sender address. If you do not specify either a
43666 <option>group</option> or a <option>user</option> option, the pipe command is run as the local user. The
43667 home directory is the user&#x2019;s home directory by default.
43668 </para>
43669 <para>
43670 <emphasis role="bold">Note</emphasis>: The command that the pipe transport runs does <emphasis>not</emphasis> begin with
43671 </para>
43672 <literallayout class="monospaced">
43673 IFS=" "
43674 </literallayout>
43675 <para>
43676 as shown in some <option>procmail</option> documentation, because Exim does not by default
43677 use a shell to run pipe commands.
43678 </para>
43679 <para>
43680 <indexterm role="concept">
43681 <primary>Cyrus</primary>
43682 </indexterm>
43683 The next example shows a transport and a router for a system where local
43684 deliveries are handled by the Cyrus IMAP server.
43685 </para>
43686 <literallayout class="monospaced">
43687 # transport
43688 local_delivery_cyrus:
43689   driver = pipe
43690   command = /usr/cyrus/bin/deliver \
43691             -m ${substr_1:$local_part_suffix} -- $local_part
43692   user = cyrus
43693   group = mail
43694   return_output
43695   log_output
43696   message_prefix =
43697   message_suffix =
43698
43699 # router
43700 local_user_cyrus:
43701   driver = accept
43702   check_local_user
43703   local_part_suffix = .*
43704   transport = local_delivery_cyrus
43705 </literallayout>
43706 <para>
43707 Note the unsetting of <option>message_prefix</option> and <option>message_suffix</option>, and the use of
43708 <option>return_output</option> to cause any text written by Cyrus to be returned to the
43709 sender.
43710 <indexterm role="concept" startref="IIDpiptra1" class="endofrange"/>
43711 <indexterm role="concept" startref="IIDpiptra2" class="endofrange"/>
43712 </para>
43713 </section>
43714 </chapter>
43715
43716 <chapter id="CHAPsmtptrans">
43717 <title>The smtp transport</title>
43718 <para>
43719 <indexterm role="concept" id="IIDsmttra1" class="startofrange">
43720 <primary>transports</primary>
43721 <secondary><command>smtp</command></secondary>
43722 </indexterm>
43723 <indexterm role="concept" id="IIDsmttra2" class="startofrange">
43724 <primary><command>smtp</command> transport</primary>
43725 </indexterm>
43726 The <command>smtp</command> transport delivers messages over TCP/IP connections using the SMTP
43727 or LMTP protocol. The list of hosts to try can either be taken from the address
43728 that is being processed (having been set up by the router), or specified
43729 explicitly for the transport. Timeout and retry processing (see chapter
43730 <xref linkend="CHAPretry"/>) is applied to each IP address independently.
43731 </para>
43732 <section id="SECID144">
43733 <title>Multiple messages on a single connection</title>
43734 <para>
43735 The sending of multiple messages over a single TCP/IP connection can arise in
43736 two ways:
43737 </para>
43738 <itemizedlist>
43739 <listitem>
43740 <para>
43741 If a message contains more than <option>max_rcpt</option> (see below) addresses that are
43742 routed to the same host, more than one copy of the message has to be sent to
43743 that host. In this situation, multiple copies may be sent in a single run of
43744 the <command>smtp</command> transport over a single TCP/IP connection. (What Exim actually
43745 does when it has too many addresses to send in one message also depends on the
43746 value of the global <option>remote_max_parallel</option> option. Details are given in
43747 section <xref linkend="SECToutSMTPTCP"/>.)
43748 </para>
43749 </listitem>
43750 <listitem>
43751 <para>
43752 <indexterm role="concept">
43753 <primary>hints database</primary>
43754 <secondary>remembering routing</secondary>
43755 </indexterm>
43756 When a message has been successfully delivered over a TCP/IP connection, Exim
43757 looks in its hints database to see if there are any other messages awaiting a
43758 connection to the same host. If there are, a new delivery process is started
43759 for one of them, and the current TCP/IP connection is passed on to it. The new
43760 process may in turn send multiple copies and possibly create yet another
43761 process.
43762 </para>
43763 </listitem>
43764 </itemizedlist>
43765 <para>
43766 For each copy sent over the same TCP/IP connection, a sequence counter is
43767 incremented, and if it ever gets to the value of <option>connection_max_messages</option>,
43768 no further messages are sent over that connection.
43769 </para>
43770 </section>
43771 <section id="SECID145">
43772 <title>Use of the $host and $host_address variables</title>
43773 <para>
43774 <indexterm role="variable">
43775 <primary><varname>$host</varname></primary>
43776 </indexterm>
43777 <indexterm role="variable">
43778 <primary><varname>$host_address</varname></primary>
43779 </indexterm>
43780 At the start of a run of the <command>smtp</command> transport, the values of <varname>$host</varname> and
43781 <varname>$host_address</varname> are the name and IP address of the first host on the host list
43782 passed by the router. However, when the transport is about to connect to a
43783 specific host, and while it is connected to that host, <varname>$host</varname> and
43784 <varname>$host_address</varname> are set to the values for that host. These are the values
43785 that are in force when the <option>helo_data</option>, <option>hosts_try_auth</option>, <option>interface</option>,
43786 <option>serialize_hosts</option>, and the various TLS options are expanded.
43787 </para>
43788 </section>
43789 <section id="usecippeer">
43790 <title>Use of $tls_cipher and $tls_peerdn</title>
43791 <para>
43792 <indexterm role="variable">
43793 <primary><varname>$tls_bits</varname></primary>
43794 </indexterm>
43795 <indexterm role="variable">
43796 <primary><varname>$tls_cipher</varname></primary>
43797 </indexterm>
43798 <indexterm role="variable">
43799 <primary><varname>$tls_peerdn</varname></primary>
43800 </indexterm>
43801 <indexterm role="variable">
43802 <primary><varname>$tls_sni</varname></primary>
43803 </indexterm>
43804 At the start of a run of the <command>smtp</command> transport, the values of <varname>$tls_bits</varname>,
43805 <varname>$tls_cipher</varname>, <varname>$tls_peerdn</varname> and <varname>$tls_sni</varname>
43806 are the values that were set when the message was received.
43807 These are the values that are used for options that are expanded before any
43808 SMTP connections are made. Just before each connection is made, these four
43809 variables are emptied. If TLS is subsequently started, they are set to the
43810 appropriate values for the outgoing connection, and these are the values that
43811 are in force when any authenticators are run and when the
43812 <option>authenticated_sender</option> option is expanded.
43813 </para>
43814 <para>
43815 These variables are deprecated in favour of <varname>$tls_in_cipher</varname> et. al.
43816 and will be removed in a future release.
43817 </para>
43818 </section>
43819 <section id="SECID146">
43820 <title>Private options for smtp</title>
43821 <para>
43822 <indexterm role="concept">
43823 <primary>options</primary>
43824 <secondary><command>smtp</command> transport</secondary>
43825 </indexterm>
43826 The private options of the <command>smtp</command> transport are as follows:
43827 </para>
43828 <para>
43829 <indexterm role="option">
43830 <primary><option>address_retry_include_sender</option></primary>
43831 </indexterm>
43832 </para>
43833 <informaltable frame="all">
43834 <tgroup cols="4" colsep="0" rowsep="0">
43835 <colspec colwidth="8*" align="left"/>
43836 <colspec colwidth="6*" align="center"/>
43837 <colspec colwidth="6*" align="center"/>
43838 <colspec colwidth="6*" align="right"/>
43839 <tbody>
43840 <row>
43841 <entry><option>address_retry_include_sender</option></entry>
43842 <entry>Use: <emphasis>smtp</emphasis></entry>
43843 <entry>Type: <emphasis>boolean</emphasis></entry>
43844 <entry>Default: <emphasis>true</emphasis></entry>
43845 </row>
43846 </tbody>
43847 </tgroup>
43848 </informaltable>
43849 <para>
43850 <indexterm role="concept">
43851 <primary>4<emphasis>xx</emphasis> responses</primary>
43852 <secondary>retrying after</secondary>
43853 </indexterm>
43854 When an address is delayed because of a 4<emphasis>xx</emphasis> response to a RCPT command, it
43855 is the combination of sender and recipient that is delayed in subsequent queue
43856 runs until the retry time is reached. You can delay the recipient without
43857 reference to the sender (which is what earlier versions of Exim did), by
43858 setting <option>address_retry_include_sender</option> false. However, this can lead to
43859 problems with servers that regularly issue 4<emphasis>xx</emphasis> responses to RCPT commands.
43860 </para>
43861 <para>
43862 <indexterm role="option">
43863 <primary><option>allow_localhost</option></primary>
43864 </indexterm>
43865 </para>
43866 <informaltable frame="all">
43867 <tgroup cols="4" colsep="0" rowsep="0">
43868 <colspec colwidth="8*" align="left"/>
43869 <colspec colwidth="6*" align="center"/>
43870 <colspec colwidth="6*" align="center"/>
43871 <colspec colwidth="6*" align="right"/>
43872 <tbody>
43873 <row>
43874 <entry><option>allow_localhost</option></entry>
43875 <entry>Use: <emphasis>smtp</emphasis></entry>
43876 <entry>Type: <emphasis>boolean</emphasis></entry>
43877 <entry>Default: <emphasis>false</emphasis></entry>
43878 </row>
43879 </tbody>
43880 </tgroup>
43881 </informaltable>
43882 <para>
43883 <indexterm role="concept">
43884 <primary>local host</primary>
43885 <secondary>sending to</secondary>
43886 </indexterm>
43887 <indexterm role="concept">
43888 <primary>fallback</primary>
43889 <secondary>hosts specified on transport</secondary>
43890 </indexterm>
43891 When a host specified in <option>hosts</option> or <option>fallback_hosts</option> (see below) turns out
43892 to be the local host, or is listed in <option>hosts_treat_as_local</option>, delivery is
43893 deferred by default. However, if <option>allow_localhost</option> is set, Exim goes on to do
43894 the delivery anyway. This should be used only in special cases when the
43895 configuration ensures that no looping will result (for example, a differently
43896 configured Exim is listening on the port to which the message is sent).
43897 </para>
43898 <para>
43899 <indexterm role="option">
43900 <primary><option>authenticated_sender</option></primary>
43901 </indexterm>
43902 </para>
43903 <informaltable frame="all">
43904 <tgroup cols="4" colsep="0" rowsep="0">
43905 <colspec colwidth="8*" align="left"/>
43906 <colspec colwidth="6*" align="center"/>
43907 <colspec colwidth="6*" align="center"/>
43908 <colspec colwidth="6*" align="right"/>
43909 <tbody>
43910 <row>
43911 <entry><option>authenticated_sender</option></entry>
43912 <entry>Use: <emphasis>smtp</emphasis></entry>
43913 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
43914 <entry>Default: <emphasis>unset</emphasis></entry>
43915 </row>
43916 </tbody>
43917 </tgroup>
43918 </informaltable>
43919 <para>
43920 <indexterm role="concept">
43921 <primary>Cyrus</primary>
43922 </indexterm>
43923 When Exim has authenticated as a client, or if <option>authenticated_sender_force</option>
43924 is true, this option sets a value for the AUTH= item on outgoing MAIL commands,
43925 overriding any existing authenticated sender value. If the string expansion is
43926 forced to fail, the option is ignored. Other expansion failures cause delivery
43927 to be deferred. If the result of expansion is an empty string, that is also
43928 ignored.
43929 </para>
43930 <para>
43931 The expansion happens after the outgoing connection has been made and TLS
43932 started, if required. This means that the <varname>$host</varname>, <varname>$host_address</varname>,
43933 <varname>$tls_out_cipher</varname>, and <varname>$tls_out_peerdn</varname> variables are set according to the
43934 particular connection.
43935 </para>
43936 <para>
43937 If the SMTP session is not authenticated, the expansion of
43938 <option>authenticated_sender</option> still happens (and can cause the delivery to be
43939 deferred if it fails), but no AUTH= item is added to MAIL commands
43940 unless <option>authenticated_sender_force</option> is true.
43941 </para>
43942 <para>
43943 This option allows you to use the <command>smtp</command> transport in LMTP mode to
43944 deliver mail to Cyrus IMAP and provide the proper local part as the
43945 <quote>authenticated sender</quote>, via a setting such as:
43946 </para>
43947 <literallayout class="monospaced">
43948 authenticated_sender = $local_part
43949 </literallayout>
43950 <para>
43951 This removes the need for IMAP subfolders to be assigned special ACLs to
43952 allow direct delivery to those subfolders.
43953 </para>
43954 <para>
43955 Because of expected uses such as that just described for Cyrus (when no
43956 domain is involved), there is no checking on the syntax of the provided
43957 value.
43958 </para>
43959 <para>
43960 <indexterm role="option">
43961 <primary><option>authenticated_sender_force</option></primary>
43962 </indexterm>
43963 </para>
43964 <informaltable frame="all">
43965 <tgroup cols="4" colsep="0" rowsep="0">
43966 <colspec colwidth="8*" align="left"/>
43967 <colspec colwidth="6*" align="center"/>
43968 <colspec colwidth="6*" align="center"/>
43969 <colspec colwidth="6*" align="right"/>
43970 <tbody>
43971 <row>
43972 <entry><option>authenticated_sender_force</option></entry>
43973 <entry>Use: <emphasis>smtp</emphasis></entry>
43974 <entry>Type: <emphasis>boolean</emphasis></entry>
43975 <entry>Default: <emphasis>false</emphasis></entry>
43976 </row>
43977 </tbody>
43978 </tgroup>
43979 </informaltable>
43980 <para>
43981 If this option is set true, the <option>authenticated_sender</option> option&#x2019;s value
43982 is used for the AUTH= item on outgoing MAIL commands, even if Exim has not
43983 authenticated as a client.
43984 </para>
43985 <para>
43986 <indexterm role="option">
43987 <primary><option>command_timeout</option></primary>
43988 </indexterm>
43989 </para>
43990 <informaltable frame="all">
43991 <tgroup cols="4" colsep="0" rowsep="0">
43992 <colspec colwidth="8*" align="left"/>
43993 <colspec colwidth="6*" align="center"/>
43994 <colspec colwidth="6*" align="center"/>
43995 <colspec colwidth="6*" align="right"/>
43996 <tbody>
43997 <row>
43998 <entry><option>command_timeout</option></entry>
43999 <entry>Use: <emphasis>smtp</emphasis></entry>
44000 <entry>Type: <emphasis>time</emphasis></entry>
44001 <entry>Default: <emphasis>5m</emphasis></entry>
44002 </row>
44003 </tbody>
44004 </tgroup>
44005 </informaltable>
44006 <para>
44007 This sets a timeout for receiving a response to an SMTP command that has been
44008 sent out. It is also used when waiting for the initial banner line from the
44009 remote host. Its value must not be zero.
44010 </para>
44011 <para>
44012 <indexterm role="option">
44013 <primary><option>connect_timeout</option></primary>
44014 </indexterm>
44015 </para>
44016 <informaltable frame="all">
44017 <tgroup cols="4" colsep="0" rowsep="0">
44018 <colspec colwidth="8*" align="left"/>
44019 <colspec colwidth="6*" align="center"/>
44020 <colspec colwidth="6*" align="center"/>
44021 <colspec colwidth="6*" align="right"/>
44022 <tbody>
44023 <row>
44024 <entry><option>connect_timeout</option></entry>
44025 <entry>Use: <emphasis>smtp</emphasis></entry>
44026 <entry>Type: <emphasis>time</emphasis></entry>
44027 <entry>Default: <emphasis>5m</emphasis></entry>
44028 </row>
44029 </tbody>
44030 </tgroup>
44031 </informaltable>
44032 <para>
44033 This sets a timeout for the <function>connect()</function> function, which sets up a TCP/IP call
44034 to a remote host. A setting of zero allows the system timeout (typically
44035 several minutes) to act. To have any effect, the value of this option must be
44036 less than the system timeout. However, it has been observed that on some
44037 systems there is no system timeout, which is why the default value for this
44038 option is 5 minutes, a value recommended by RFC 1123.
44039 </para>
44040 <para>
44041 <indexterm role="option">
44042 <primary><option>connection_max_messages</option></primary>
44043 </indexterm>
44044 </para>
44045 <informaltable frame="all">
44046 <tgroup cols="4" colsep="0" rowsep="0">
44047 <colspec colwidth="8*" align="left"/>
44048 <colspec colwidth="6*" align="center"/>
44049 <colspec colwidth="6*" align="center"/>
44050 <colspec colwidth="6*" align="right"/>
44051 <tbody>
44052 <row>
44053 <entry><option>connection_max_messages</option></entry>
44054 <entry>Use: <emphasis>smtp</emphasis></entry>
44055 <entry>Type: <emphasis>integer</emphasis></entry>
44056 <entry>Default: <emphasis>500</emphasis></entry>
44057 </row>
44058 </tbody>
44059 </tgroup>
44060 </informaltable>
44061 <para>
44062 <indexterm role="concept">
44063 <primary>SMTP</primary>
44064 <secondary>passed connection</secondary>
44065 </indexterm>
44066 <indexterm role="concept">
44067 <primary>SMTP</primary>
44068 <secondary>multiple deliveries</secondary>
44069 </indexterm>
44070 <indexterm role="concept">
44071 <primary>multiple SMTP deliveries</primary>
44072 </indexterm>
44073 This controls the maximum number of separate message deliveries that are sent
44074 over a single TCP/IP connection. If the value is zero, there is no limit.
44075 For testing purposes, this value can be overridden by the <option>-oB</option> command line
44076 option.
44077 </para>
44078 <para>
44079 <indexterm role="option">
44080 <primary><option>data_timeout</option></primary>
44081 </indexterm>
44082 </para>
44083 <informaltable frame="all">
44084 <tgroup cols="4" colsep="0" rowsep="0">
44085 <colspec colwidth="8*" align="left"/>
44086 <colspec colwidth="6*" align="center"/>
44087 <colspec colwidth="6*" align="center"/>
44088 <colspec colwidth="6*" align="right"/>
44089 <tbody>
44090 <row>
44091 <entry><option>data_timeout</option></entry>
44092 <entry>Use: <emphasis>smtp</emphasis></entry>
44093 <entry>Type: <emphasis>time</emphasis></entry>
44094 <entry>Default: <emphasis>5m</emphasis></entry>
44095 </row>
44096 </tbody>
44097 </tgroup>
44098 </informaltable>
44099 <para>
44100 This sets a timeout for the transmission of each block in the data portion of
44101 the message. As a result, the overall timeout for a message depends on the size
44102 of the message. Its value must not be zero. See also <option>final_timeout</option>.
44103 </para>
44104 <para>
44105 <indexterm role="option">
44106 <primary><option>delay_after_cutoff</option></primary>
44107 </indexterm>
44108 </para>
44109 <informaltable frame="all">
44110 <tgroup cols="4" colsep="0" rowsep="0">
44111 <colspec colwidth="8*" align="left"/>
44112 <colspec colwidth="6*" align="center"/>
44113 <colspec colwidth="6*" align="center"/>
44114 <colspec colwidth="6*" align="right"/>
44115 <tbody>
44116 <row>
44117 <entry><option>delay_after_cutoff</option></entry>
44118 <entry>Use: <emphasis>smtp</emphasis></entry>
44119 <entry>Type: <emphasis>boolean</emphasis></entry>
44120 <entry>Default: <emphasis>true</emphasis></entry>
44121 </row>
44122 </tbody>
44123 </tgroup>
44124 </informaltable>
44125 <para>
44126 This option controls what happens when all remote IP addresses for a given
44127 domain have been inaccessible for so long that they have passed their retry
44128 cutoff times.
44129 </para>
44130 <para>
44131 In the default state, if the next retry time has not been reached for any of
44132 them, the address is bounced without trying any deliveries. In other words,
44133 Exim delays retrying an IP address after the final cutoff time until a new
44134 retry time is reached, and can therefore bounce an address without ever trying
44135 a delivery, when machines have been down for a long time. Some people are
44136 unhappy at this prospect, so...
44137 </para>
44138 <para>
44139 If <option>delay_after_cutoff</option> is set false, Exim behaves differently. If all IP
44140 addresses are past their final cutoff time, Exim tries to deliver to those
44141 IP addresses that have not been tried since the message arrived. If there are
44142 none, of if they all fail, the address is bounced. In other words, it does not
44143 delay when a new message arrives, but immediately tries those expired IP
44144 addresses that haven&#x2019;t been tried since the message arrived. If there is a
44145 continuous stream of messages for the dead hosts, unsetting
44146 <option>delay_after_cutoff</option> means that there will be many more attempts to deliver
44147 to them.
44148 </para>
44149 <para>
44150 <indexterm role="option">
44151 <primary><option>dns_qualify_single</option></primary>
44152 </indexterm>
44153 </para>
44154 <informaltable frame="all">
44155 <tgroup cols="4" colsep="0" rowsep="0">
44156 <colspec colwidth="8*" align="left"/>
44157 <colspec colwidth="6*" align="center"/>
44158 <colspec colwidth="6*" align="center"/>
44159 <colspec colwidth="6*" align="right"/>
44160 <tbody>
44161 <row>
44162 <entry><option>dns_qualify_single</option></entry>
44163 <entry>Use: <emphasis>smtp</emphasis></entry>
44164 <entry>Type: <emphasis>boolean</emphasis></entry>
44165 <entry>Default: <emphasis>true</emphasis></entry>
44166 </row>
44167 </tbody>
44168 </tgroup>
44169 </informaltable>
44170 <para>
44171 If the <option>hosts</option> or <option>fallback_hosts</option> option is being used,
44172 and the <option>gethostbyname</option> option is false,
44173 the RES_DEFNAMES resolver option is set. See the <option>qualify_single</option> option
44174 in chapter <xref linkend="CHAPdnslookup"/> for more details.
44175 </para>
44176 <para>
44177 <indexterm role="option">
44178 <primary><option>dns_search_parents</option></primary>
44179 </indexterm>
44180 </para>
44181 <informaltable frame="all">
44182 <tgroup cols="4" colsep="0" rowsep="0">
44183 <colspec colwidth="8*" align="left"/>
44184 <colspec colwidth="6*" align="center"/>
44185 <colspec colwidth="6*" align="center"/>
44186 <colspec colwidth="6*" align="right"/>
44187 <tbody>
44188 <row>
44189 <entry><option>dns_search_parents</option></entry>
44190 <entry>Use: <emphasis>smtp</emphasis></entry>
44191 <entry>Type: <emphasis>boolean</emphasis></entry>
44192 <entry>Default: <emphasis>false</emphasis></entry>
44193 </row>
44194 </tbody>
44195 </tgroup>
44196 </informaltable>
44197 <para>
44198 If the <option>hosts</option> or <option>fallback_hosts</option> option is being used, and the
44199 <option>gethostbyname</option> option is false, the RES_DNSRCH resolver option is set.
44200 See the <option>search_parents</option> option in chapter <xref linkend="CHAPdnslookup"/> for more
44201 details.
44202 </para>
44203 <para>
44204 <indexterm role="option">
44205 <primary><option>dnssec_request_domains</option></primary>
44206 </indexterm>
44207 </para>
44208 <informaltable frame="all">
44209 <tgroup cols="4" colsep="0" rowsep="0">
44210 <colspec colwidth="8*" align="left"/>
44211 <colspec colwidth="6*" align="center"/>
44212 <colspec colwidth="6*" align="center"/>
44213 <colspec colwidth="6*" align="right"/>
44214 <tbody>
44215 <row>
44216 <entry><option>dnssec_request_domains</option></entry>
44217 <entry>Use: <emphasis>smtp</emphasis></entry>
44218 <entry>Type: <emphasis>domain list</emphasis>&dagger;<emphasis></emphasis></entry>
44219 <entry>Default: <emphasis>unset</emphasis></entry>
44220 </row>
44221 </tbody>
44222 </tgroup>
44223 </informaltable>
44224 <para>
44225 <indexterm role="concept">
44226 <primary>MX record</primary>
44227 <secondary>security</secondary>
44228 </indexterm>
44229 <indexterm role="concept">
44230 <primary>DNSSEC</primary>
44231 <secondary>MX lookup</secondary>
44232 </indexterm>
44233 <indexterm role="concept">
44234 <primary>security</primary>
44235 <secondary>MX lookup</secondary>
44236 </indexterm>
44237 <indexterm role="concept">
44238 <primary>DNS</primary>
44239 <secondary>DNSSEC</secondary>
44240 </indexterm>
44241 DNS lookups for domains matching <option>dnssec_request_domains</option> will be done with
44242 the dnssec request bit set.
44243 This applies to all of the SRV, MX A6, AAAA, A lookup sequence.
44244 </para>
44245 <para>
44246 <indexterm role="option">
44247 <primary><option>dnssec_require_domains</option></primary>
44248 </indexterm>
44249 </para>
44250 <informaltable frame="all">
44251 <tgroup cols="4" colsep="0" rowsep="0">
44252 <colspec colwidth="8*" align="left"/>
44253 <colspec colwidth="6*" align="center"/>
44254 <colspec colwidth="6*" align="center"/>
44255 <colspec colwidth="6*" align="right"/>
44256 <tbody>
44257 <row>
44258 <entry><option>dnssec_require_domains</option></entry>
44259 <entry>Use: <emphasis>smtp</emphasis></entry>
44260 <entry>Type: <emphasis>domain list</emphasis>&dagger;<emphasis></emphasis></entry>
44261 <entry>Default: <emphasis>unset</emphasis></entry>
44262 </row>
44263 </tbody>
44264 </tgroup>
44265 </informaltable>
44266 <para>
44267 <indexterm role="concept">
44268 <primary>MX record</primary>
44269 <secondary>security</secondary>
44270 </indexterm>
44271 <indexterm role="concept">
44272 <primary>DNSSEC</primary>
44273 <secondary>MX lookup</secondary>
44274 </indexterm>
44275 <indexterm role="concept">
44276 <primary>security</primary>
44277 <secondary>MX lookup</secondary>
44278 </indexterm>
44279 <indexterm role="concept">
44280 <primary>DNS</primary>
44281 <secondary>DNSSEC</secondary>
44282 </indexterm>
44283 DNS lookups for domains matching <option>dnssec_request_domains</option> will be done with
44284 the dnssec request bit set.  Any returns not having the Authenticated Data bit
44285 (AD bit) set wil be ignored and logged as a host-lookup failure.
44286 This applies to all of the SRV, MX A6, AAAA, A lookup sequence.
44287 </para>
44288 <para>
44289 <indexterm role="option">
44290 <primary><option>dscp</option></primary>
44291 </indexterm>
44292 </para>
44293 <informaltable frame="all">
44294 <tgroup cols="4" colsep="0" rowsep="0">
44295 <colspec colwidth="8*" align="left"/>
44296 <colspec colwidth="6*" align="center"/>
44297 <colspec colwidth="6*" align="center"/>
44298 <colspec colwidth="6*" align="right"/>
44299 <tbody>
44300 <row>
44301 <entry><option>dscp</option></entry>
44302 <entry>Use: <emphasis>smtp</emphasis></entry>
44303 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
44304 <entry>Default: <emphasis>unset</emphasis></entry>
44305 </row>
44306 </tbody>
44307 </tgroup>
44308 </informaltable>
44309 <para>
44310 <indexterm role="concept">
44311 <primary>DCSP</primary>
44312 <secondary>outbound</secondary>
44313 </indexterm>
44314 This option causes the DSCP value associated with a socket to be set to one
44315 of a number of fixed strings or to numeric value.
44316 The <option>-bI:dscp</option> option may be used to ask Exim which names it knows of.
44317 Common values include <literal>throughput</literal>, <literal>mincost</literal>, and on newer systems
44318 <literal>ef</literal>, <literal>af41</literal>, etc.  Numeric values may be in the range 0 to 0x3F.
44319 </para>
44320 <para>
44321 The outbound packets from Exim will be marked with this value in the header
44322 (for IPv4, the TOS field; for IPv6, the TCLASS field); there is no guarantee
44323 that these values will have any effect, not be stripped by networking
44324 equipment, or do much of anything without cooperation with your Network
44325 Engineer and those of all network operators between the source and destination.
44326 </para>
44327 <para>
44328 <indexterm role="option">
44329 <primary><option>fallback_hosts</option></primary>
44330 </indexterm>
44331 </para>
44332 <informaltable frame="all">
44333 <tgroup cols="4" colsep="0" rowsep="0">
44334 <colspec colwidth="8*" align="left"/>
44335 <colspec colwidth="6*" align="center"/>
44336 <colspec colwidth="6*" align="center"/>
44337 <colspec colwidth="6*" align="right"/>
44338 <tbody>
44339 <row>
44340 <entry><option>fallback_hosts</option></entry>
44341 <entry>Use: <emphasis>smtp</emphasis></entry>
44342 <entry>Type: <emphasis>string list</emphasis></entry>
44343 <entry>Default: <emphasis>unset</emphasis></entry>
44344 </row>
44345 </tbody>
44346 </tgroup>
44347 </informaltable>
44348 <para>
44349 <indexterm role="concept">
44350 <primary>fallback</primary>
44351 <secondary>hosts specified on transport</secondary>
44352 </indexterm>
44353 String expansion is not applied to this option. The argument must be a
44354 colon-separated list of host names or IP addresses, optionally also including
44355 port numbers, though the separator can be changed, as described in section
44356 <xref linkend="SECTlistconstruct"/>. Each individual item in the list is the same as an
44357 item in a <option>route_list</option> setting for the <command>manualroute</command> router, as described
44358 in section <xref linkend="SECTformatonehostitem"/>.
44359 </para>
44360 <para>
44361 Fallback hosts can also be specified on routers, which associate them with the
44362 addresses they process. As for the <option>hosts</option> option without <option>hosts_override</option>,
44363 <option>fallback_hosts</option> specified on the transport is used only if the address does
44364 not have its own associated fallback host list. Unlike <option>hosts</option>, a setting of
44365 <option>fallback_hosts</option> on an address is not overridden by <option>hosts_override</option>.
44366 However, <option>hosts_randomize</option> does apply to fallback host lists.
44367 </para>
44368 <para>
44369 If Exim is unable to deliver to any of the hosts for a particular address, and
44370 the errors are not permanent rejections, the address is put on a separate
44371 transport queue with its host list replaced by the fallback hosts, unless the
44372 address was routed via MX records and the current host was in the original MX
44373 list. In that situation, the fallback host list is not used.
44374 </para>
44375 <para>
44376 Once normal deliveries are complete, the fallback queue is delivered by
44377 re-running the same transports with the new host lists. If several failing
44378 addresses have the same fallback hosts (and <option>max_rcpt</option> permits it), a single
44379 copy of the message is sent.
44380 </para>
44381 <para>
44382 The resolution of the host names on the fallback list is controlled by the
44383 <option>gethostbyname</option> option, as for the <option>hosts</option> option. Fallback hosts apply
44384 both to cases when the host list comes with the address and when it is taken
44385 from <option>hosts</option>. This option provides a <quote>use a smart host only if delivery
44386 fails</quote> facility.
44387 </para>
44388 <para>
44389 <indexterm role="option">
44390 <primary><option>final_timeout</option></primary>
44391 </indexterm>
44392 </para>
44393 <informaltable frame="all">
44394 <tgroup cols="4" colsep="0" rowsep="0">
44395 <colspec colwidth="8*" align="left"/>
44396 <colspec colwidth="6*" align="center"/>
44397 <colspec colwidth="6*" align="center"/>
44398 <colspec colwidth="6*" align="right"/>
44399 <tbody>
44400 <row>
44401 <entry><option>final_timeout</option></entry>
44402 <entry>Use: <emphasis>smtp</emphasis></entry>
44403 <entry>Type: <emphasis>time</emphasis></entry>
44404 <entry>Default: <emphasis>10m</emphasis></entry>
44405 </row>
44406 </tbody>
44407 </tgroup>
44408 </informaltable>
44409 <para>
44410 This is the timeout that applies while waiting for the response to the final
44411 line containing just <quote>.</quote> that terminates a message. Its value must not be
44412 zero.
44413 </para>
44414 <para>
44415 <indexterm role="option">
44416 <primary><option>gethostbyname</option></primary>
44417 </indexterm>
44418 </para>
44419 <informaltable frame="all">
44420 <tgroup cols="4" colsep="0" rowsep="0">
44421 <colspec colwidth="8*" align="left"/>
44422 <colspec colwidth="6*" align="center"/>
44423 <colspec colwidth="6*" align="center"/>
44424 <colspec colwidth="6*" align="right"/>
44425 <tbody>
44426 <row>
44427 <entry><option>gethostbyname</option></entry>
44428 <entry>Use: <emphasis>smtp</emphasis></entry>
44429 <entry>Type: <emphasis>boolean</emphasis></entry>
44430 <entry>Default: <emphasis>false</emphasis></entry>
44431 </row>
44432 </tbody>
44433 </tgroup>
44434 </informaltable>
44435 <para>
44436 If this option is true when the <option>hosts</option> and/or <option>fallback_hosts</option> options are
44437 being used, names are looked up using <function>gethostbyname()</function>
44438 (or <function>getipnodebyname()</function> when available)
44439 instead of using the DNS. Of course, that function may in fact use the DNS, but
44440 it may also consult other sources of information such as <filename>/etc/hosts</filename>.
44441 </para>
44442 <para>
44443 <indexterm role="option">
44444 <primary><option>gnutls_compat_mode</option></primary>
44445 </indexterm>
44446 </para>
44447 <informaltable frame="all">
44448 <tgroup cols="4" colsep="0" rowsep="0">
44449 <colspec colwidth="8*" align="left"/>
44450 <colspec colwidth="6*" align="center"/>
44451 <colspec colwidth="6*" align="center"/>
44452 <colspec colwidth="6*" align="right"/>
44453 <tbody>
44454 <row>
44455 <entry><option>gnutls_compat_mode</option></entry>
44456 <entry>Use: <emphasis>smtp</emphasis></entry>
44457 <entry>Type: <emphasis>boolean</emphasis></entry>
44458 <entry>Default: <emphasis>unset</emphasis></entry>
44459 </row>
44460 </tbody>
44461 </tgroup>
44462 </informaltable>
44463 <para>
44464 This option controls whether GnuTLS is used in compatibility mode in an Exim
44465 server. This reduces security slightly, but improves interworking with older
44466 implementations of TLS.
44467 </para>
44468 <para>
44469 <indexterm role="option">
44470 <primary><option>helo_data</option></primary>
44471 </indexterm>
44472 </para>
44473 <informaltable frame="all">
44474 <tgroup cols="4" colsep="0" rowsep="0">
44475 <colspec colwidth="8*" align="left"/>
44476 <colspec colwidth="6*" align="center"/>
44477 <colspec colwidth="6*" align="center"/>
44478 <colspec colwidth="6*" align="right"/>
44479 <tbody>
44480 <row>
44481 <entry><option>helo_data</option></entry>
44482 <entry>Use: <emphasis>smtp</emphasis></entry>
44483 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
44484 <entry>Default: <emphasis>see below</emphasis></entry>
44485 </row>
44486 </tbody>
44487 </tgroup>
44488 </informaltable>
44489 <para>
44490 <indexterm role="concept">
44491 <primary>HELO</primary>
44492 <secondary>argument, setting</secondary>
44493 </indexterm>
44494 <indexterm role="concept">
44495 <primary>EHLO</primary>
44496 <secondary>argument, setting</secondary>
44497 </indexterm>
44498 <indexterm role="concept">
44499 <primary>LHLO argument setting</primary>
44500 </indexterm>
44501 The value of this option is expanded after a connection to a another host has
44502 been set up. The result is used as the argument for the EHLO, HELO, or LHLO
44503 command that starts the outgoing SMTP or LMTP session. The default value of the
44504 option is:
44505 </para>
44506 <literallayout class="monospaced">
44507 $primary_hostname
44508 </literallayout>
44509 <para>
44510 During the expansion, the variables <varname>$host</varname> and <varname>$host_address</varname> are set to
44511 the identity of the remote host, and the variables <varname>$sending_ip_address</varname> and
44512 <varname>$sending_port</varname> are set to the local IP address and port number that are being
44513 used. These variables can be used to generate different values for different
44514 servers or different local IP addresses. For example, if you want the string
44515 that is used for <option>helo_data</option> to be obtained by a DNS lookup of the outgoing
44516 interface address, you could use this:
44517 </para>
44518 <literallayout class="monospaced">
44519 helo_data = ${lookup dnsdb{ptr=$sending_ip_address}{$value}\
44520   {$primary_hostname}}
44521 </literallayout>
44522 <para>
44523 The use of <option>helo_data</option> applies both to sending messages and when doing
44524 callouts.
44525 </para>
44526 <para>
44527 <indexterm role="option">
44528 <primary><option>hosts</option></primary>
44529 </indexterm>
44530 </para>
44531 <informaltable frame="all">
44532 <tgroup cols="4" colsep="0" rowsep="0">
44533 <colspec colwidth="8*" align="left"/>
44534 <colspec colwidth="6*" align="center"/>
44535 <colspec colwidth="6*" align="center"/>
44536 <colspec colwidth="6*" align="right"/>
44537 <tbody>
44538 <row>
44539 <entry><option>hosts</option></entry>
44540 <entry>Use: <emphasis>smtp</emphasis></entry>
44541 <entry>Type: <emphasis>string list</emphasis>&dagger;<emphasis></emphasis></entry>
44542 <entry>Default: <emphasis>unset</emphasis></entry>
44543 </row>
44544 </tbody>
44545 </tgroup>
44546 </informaltable>
44547 <para>
44548 Hosts are associated with an address by a router such as <command>dnslookup</command>, which
44549 finds the hosts by looking up the address domain in the DNS, or by
44550 <command>manualroute</command>, which has lists of hosts in its configuration. However,
44551 email addresses can be passed to the <command>smtp</command> transport by any router, and not
44552 all of them can provide an associated list of hosts.
44553 </para>
44554 <para>
44555 The <option>hosts</option> option specifies a list of hosts to be used if the address being
44556 processed does not have any hosts associated with it. The hosts specified by
44557 <option>hosts</option> are also used, whether or not the address has its own hosts, if
44558 <option>hosts_override</option> is set.
44559 </para>
44560 <para>
44561 The string is first expanded, before being interpreted as a colon-separated
44562 list of host names or IP addresses, possibly including port numbers. The
44563 separator may be changed to something other than colon, as described in section
44564 <xref linkend="SECTlistconstruct"/>. Each individual item in the list is the same as an
44565 item in a <option>route_list</option> setting for the <command>manualroute</command> router, as described
44566 in section <xref linkend="SECTformatonehostitem"/>. However, note that the <literal>/MX</literal> facility
44567 of the <command>manualroute</command> router is not available here.
44568 </para>
44569 <para>
44570 If the expansion fails, delivery is deferred. Unless the failure was caused by
44571 the inability to complete a lookup, the error is logged to the panic log as
44572 well as the main log. Host names are looked up either by searching directly for
44573 address records in the DNS or by calling <function>gethostbyname()</function> (or
44574 <function>getipnodebyname()</function> when available), depending on the setting of the
44575 <option>gethostbyname</option> option. When Exim is compiled with IPv6 support, if a host
44576 that is looked up in the DNS has both IPv4 and IPv6 addresses, both types of
44577 address are used.
44578 </para>
44579 <para>
44580 During delivery, the hosts are tried in order, subject to their retry status,
44581 unless <option>hosts_randomize</option> is set.
44582 </para>
44583 <para>
44584 <indexterm role="option">
44585 <primary><option>hosts_avoid_esmtp</option></primary>
44586 </indexterm>
44587 </para>
44588 <informaltable frame="all">
44589 <tgroup cols="4" colsep="0" rowsep="0">
44590 <colspec colwidth="8*" align="left"/>
44591 <colspec colwidth="6*" align="center"/>
44592 <colspec colwidth="6*" align="center"/>
44593 <colspec colwidth="6*" align="right"/>
44594 <tbody>
44595 <row>
44596 <entry><option>hosts_avoid_esmtp</option></entry>
44597 <entry>Use: <emphasis>smtp</emphasis></entry>
44598 <entry>Type: <emphasis>host list</emphasis>&dagger;<emphasis></emphasis></entry>
44599 <entry>Default: <emphasis>unset</emphasis></entry>
44600 </row>
44601 </tbody>
44602 </tgroup>
44603 </informaltable>
44604 <para>
44605 <indexterm role="concept">
44606 <primary>ESMTP, avoiding use of</primary>
44607 </indexterm>
44608 <indexterm role="concept">
44609 <primary>HELO</primary>
44610 <secondary>forcing use of</secondary>
44611 </indexterm>
44612 <indexterm role="concept">
44613 <primary>EHLO</primary>
44614 <secondary>avoiding use of</secondary>
44615 </indexterm>
44616 <indexterm role="concept">
44617 <primary>PIPELINING</primary>
44618 <secondary>avoiding the use of</secondary>
44619 </indexterm>
44620 This option is for use with broken hosts that announce ESMTP facilities (for
44621 example, PIPELINING) and then fail to implement them properly. When a host
44622 matches <option>hosts_avoid_esmtp</option>, Exim sends HELO rather than EHLO at the
44623 start of the SMTP session. This means that it cannot use any of the ESMTP
44624 facilities such as AUTH, PIPELINING, SIZE, and STARTTLS.
44625 </para>
44626 <para>
44627 <indexterm role="option">
44628 <primary><option>hosts_avoid_pipelining</option></primary>
44629 </indexterm>
44630 </para>
44631 <informaltable frame="all">
44632 <tgroup cols="4" colsep="0" rowsep="0">
44633 <colspec colwidth="8*" align="left"/>
44634 <colspec colwidth="6*" align="center"/>
44635 <colspec colwidth="6*" align="center"/>
44636 <colspec colwidth="6*" align="right"/>
44637 <tbody>
44638 <row>
44639 <entry><option>hosts_avoid_pipelining</option></entry>
44640 <entry>Use: <emphasis>smtp</emphasis></entry>
44641 <entry>Type: <emphasis>host list</emphasis>&dagger;<emphasis></emphasis></entry>
44642 <entry>Default: <emphasis>unset</emphasis></entry>
44643 </row>
44644 </tbody>
44645 </tgroup>
44646 </informaltable>
44647 <para>
44648 <indexterm role="concept">
44649 <primary>PIPELINING</primary>
44650 <secondary>avoiding the use of</secondary>
44651 </indexterm>
44652 Exim will not use the SMTP PIPELINING extension when delivering to any host
44653 that matches this list, even if the server host advertises PIPELINING support.
44654 </para>
44655 <para>
44656 <indexterm role="option">
44657 <primary><option>hosts_avoid_tls</option></primary>
44658 </indexterm>
44659 </para>
44660 <informaltable frame="all">
44661 <tgroup cols="4" colsep="0" rowsep="0">
44662 <colspec colwidth="8*" align="left"/>
44663 <colspec colwidth="6*" align="center"/>
44664 <colspec colwidth="6*" align="center"/>
44665 <colspec colwidth="6*" align="right"/>
44666 <tbody>
44667 <row>
44668 <entry><option>hosts_avoid_tls</option></entry>
44669 <entry>Use: <emphasis>smtp</emphasis></entry>
44670 <entry>Type: <emphasis>host list</emphasis>&dagger;<emphasis></emphasis></entry>
44671 <entry>Default: <emphasis>unset</emphasis></entry>
44672 </row>
44673 </tbody>
44674 </tgroup>
44675 </informaltable>
44676 <para>
44677 <indexterm role="concept">
44678 <primary>TLS</primary>
44679 <secondary>avoiding for certain hosts</secondary>
44680 </indexterm>
44681 Exim will not try to start a TLS session when delivering to any host that
44682 matches this list. See chapter <xref linkend="CHAPTLS"/> for details of TLS.
44683 </para>
44684 <para>
44685 <indexterm role="option">
44686 <primary><option>hosts_verify_avoid_tls</option></primary>
44687 </indexterm>
44688 </para>
44689 <informaltable frame="all">
44690 <tgroup cols="4" colsep="0" rowsep="0">
44691 <colspec colwidth="8*" align="left"/>
44692 <colspec colwidth="6*" align="center"/>
44693 <colspec colwidth="6*" align="center"/>
44694 <colspec colwidth="6*" align="right"/>
44695 <tbody>
44696 <row>
44697 <entry><option>hosts_verify_avoid_tls</option></entry>
44698 <entry>Use: <emphasis>smtp</emphasis></entry>
44699 <entry>Type: <emphasis>host list</emphasis>&dagger;<emphasis></emphasis></entry>
44700 <entry>Default: <emphasis>*</emphasis></entry>
44701 </row>
44702 </tbody>
44703 </tgroup>
44704 </informaltable>
44705 <para>
44706 <indexterm role="concept">
44707 <primary>TLS</primary>
44708 <secondary>avoiding for certain hosts</secondary>
44709 </indexterm>
44710 Exim will not try to start a TLS session for a verify callout,
44711 or when delivering in cutthrough mode,
44712 to any host that matches this list.
44713 Note that the default is to not use TLS.
44714 </para>
44715 <para>
44716 <indexterm role="option">
44717 <primary><option>hosts_max_try</option></primary>
44718 </indexterm>
44719 </para>
44720 <informaltable frame="all">
44721 <tgroup cols="4" colsep="0" rowsep="0">
44722 <colspec colwidth="8*" align="left"/>
44723 <colspec colwidth="6*" align="center"/>
44724 <colspec colwidth="6*" align="center"/>
44725 <colspec colwidth="6*" align="right"/>
44726 <tbody>
44727 <row>
44728 <entry><option>hosts_max_try</option></entry>
44729 <entry>Use: <emphasis>smtp</emphasis></entry>
44730 <entry>Type: <emphasis>integer</emphasis></entry>
44731 <entry>Default: <emphasis>5</emphasis></entry>
44732 </row>
44733 </tbody>
44734 </tgroup>
44735 </informaltable>
44736 <para>
44737 <indexterm role="concept">
44738 <primary>host</primary>
44739 <secondary>maximum number to try</secondary>
44740 </indexterm>
44741 <indexterm role="concept">
44742 <primary>limit</primary>
44743 <secondary>number of hosts tried</secondary>
44744 </indexterm>
44745 <indexterm role="concept">
44746 <primary>limit</primary>
44747 <secondary>number of MX tried</secondary>
44748 </indexterm>
44749 <indexterm role="concept">
44750 <primary>MX record</primary>
44751 <secondary>maximum tried</secondary>
44752 </indexterm>
44753 This option limits the number of IP addresses that are tried for any one
44754 delivery in cases where there are temporary delivery errors. Section
44755 <xref linkend="SECTvalhosmax"/> describes in detail how the value of this option is used.
44756 </para>
44757 <para>
44758 <indexterm role="option">
44759 <primary><option>hosts_max_try_hardlimit</option></primary>
44760 </indexterm>
44761 </para>
44762 <informaltable frame="all">
44763 <tgroup cols="4" colsep="0" rowsep="0">
44764 <colspec colwidth="8*" align="left"/>
44765 <colspec colwidth="6*" align="center"/>
44766 <colspec colwidth="6*" align="center"/>
44767 <colspec colwidth="6*" align="right"/>
44768 <tbody>
44769 <row>
44770 <entry><option>hosts_max_try_hardlimit</option></entry>
44771 <entry>Use: <emphasis>smtp</emphasis></entry>
44772 <entry>Type: <emphasis>integer</emphasis></entry>
44773 <entry>Default: <emphasis>50</emphasis></entry>
44774 </row>
44775 </tbody>
44776 </tgroup>
44777 </informaltable>
44778 <para>
44779 This is an additional check on the maximum number of IP addresses that Exim
44780 tries for any one delivery. Section <xref linkend="SECTvalhosmax"/> describes its use and
44781 why it exists.
44782 </para>
44783 <para>
44784 <indexterm role="option">
44785 <primary><option>hosts_nopass_tls</option></primary>
44786 </indexterm>
44787 </para>
44788 <informaltable frame="all">
44789 <tgroup cols="4" colsep="0" rowsep="0">
44790 <colspec colwidth="8*" align="left"/>
44791 <colspec colwidth="6*" align="center"/>
44792 <colspec colwidth="6*" align="center"/>
44793 <colspec colwidth="6*" align="right"/>
44794 <tbody>
44795 <row>
44796 <entry><option>hosts_nopass_tls</option></entry>
44797 <entry>Use: <emphasis>smtp</emphasis></entry>
44798 <entry>Type: <emphasis>host list</emphasis>&dagger;<emphasis></emphasis></entry>
44799 <entry>Default: <emphasis>unset</emphasis></entry>
44800 </row>
44801 </tbody>
44802 </tgroup>
44803 </informaltable>
44804 <para>
44805 <indexterm role="concept">
44806 <primary>TLS</primary>
44807 <secondary>passing connection</secondary>
44808 </indexterm>
44809 <indexterm role="concept">
44810 <primary>multiple SMTP deliveries</primary>
44811 </indexterm>
44812 <indexterm role="concept">
44813 <primary>TLS</primary>
44814 <secondary>multiple message deliveries</secondary>
44815 </indexterm>
44816 For any host that matches this list, a connection on which a TLS session has
44817 been started will not be passed to a new delivery process for sending another
44818 message on the same connection. See section <xref linkend="SECTmulmessam"/> for an
44819 explanation of when this might be needed.
44820 </para>
44821 <para>
44822 <indexterm role="option">
44823 <primary><option>hosts_override</option></primary>
44824 </indexterm>
44825 </para>
44826 <informaltable frame="all">
44827 <tgroup cols="4" colsep="0" rowsep="0">
44828 <colspec colwidth="8*" align="left"/>
44829 <colspec colwidth="6*" align="center"/>
44830 <colspec colwidth="6*" align="center"/>
44831 <colspec colwidth="6*" align="right"/>
44832 <tbody>
44833 <row>
44834 <entry><option>hosts_override</option></entry>
44835 <entry>Use: <emphasis>smtp</emphasis></entry>
44836 <entry>Type: <emphasis>boolean</emphasis></entry>
44837 <entry>Default: <emphasis>false</emphasis></entry>
44838 </row>
44839 </tbody>
44840 </tgroup>
44841 </informaltable>
44842 <para>
44843 If this option is set and the <option>hosts</option> option is also set, any hosts that are
44844 attached to the address are ignored, and instead the hosts specified by the
44845 <option>hosts</option> option are always used. This option does not apply to
44846 <option>fallback_hosts</option>.
44847 </para>
44848 <para>
44849 <indexterm role="option">
44850 <primary><option>hosts_randomize</option></primary>
44851 </indexterm>
44852 </para>
44853 <informaltable frame="all">
44854 <tgroup cols="4" colsep="0" rowsep="0">
44855 <colspec colwidth="8*" align="left"/>
44856 <colspec colwidth="6*" align="center"/>
44857 <colspec colwidth="6*" align="center"/>
44858 <colspec colwidth="6*" align="right"/>
44859 <tbody>
44860 <row>
44861 <entry><option>hosts_randomize</option></entry>
44862 <entry>Use: <emphasis>smtp</emphasis></entry>
44863 <entry>Type: <emphasis>boolean</emphasis></entry>
44864 <entry>Default: <emphasis>false</emphasis></entry>
44865 </row>
44866 </tbody>
44867 </tgroup>
44868 </informaltable>
44869 <para>
44870 <indexterm role="concept">
44871 <primary>randomized host list</primary>
44872 </indexterm>
44873 <indexterm role="concept">
44874 <primary>host</primary>
44875 <secondary>list of; randomized</secondary>
44876 </indexterm>
44877 <indexterm role="concept">
44878 <primary>fallback</primary>
44879 <secondary>randomized hosts</secondary>
44880 </indexterm>
44881 If this option is set, and either the list of hosts is taken from the
44882 <option>hosts</option> or the <option>fallback_hosts</option> option, or the hosts supplied by the router
44883 were not obtained from MX records (this includes fallback hosts from the
44884 router), and were not randomized by the router, the order of trying the hosts
44885 is randomized each time the transport runs. Randomizing the order of a host
44886 list can be used to do crude load sharing.
44887 </para>
44888 <para>
44889 When <option>hosts_randomize</option> is true, a host list may be split into groups whose
44890 order is separately randomized. This makes it possible to set up MX-like
44891 behaviour. The boundaries between groups are indicated by an item that is just
44892 <literal>+</literal> in the host list. For example:
44893 </para>
44894 <literallayout class="monospaced">
44895 hosts = host1:host2:host3:+:host4:host5
44896 </literallayout>
44897 <para>
44898 The order of the first three hosts and the order of the last two hosts is
44899 randomized for each use, but the first three always end up before the last two.
44900 If <option>hosts_randomize</option> is not set, a <literal>+</literal> item in the list is ignored.
44901 </para>
44902 <para>
44903 <indexterm role="option">
44904 <primary><option>hosts_require_auth</option></primary>
44905 </indexterm>
44906 </para>
44907 <informaltable frame="all">
44908 <tgroup cols="4" colsep="0" rowsep="0">
44909 <colspec colwidth="8*" align="left"/>
44910 <colspec colwidth="6*" align="center"/>
44911 <colspec colwidth="6*" align="center"/>
44912 <colspec colwidth="6*" align="right"/>
44913 <tbody>
44914 <row>
44915 <entry><option>hosts_require_auth</option></entry>
44916 <entry>Use: <emphasis>smtp</emphasis></entry>
44917 <entry>Type: <emphasis>host list</emphasis>&dagger;<emphasis></emphasis></entry>
44918 <entry>Default: <emphasis>unset</emphasis></entry>
44919 </row>
44920 </tbody>
44921 </tgroup>
44922 </informaltable>
44923 <para>
44924 <indexterm role="concept">
44925 <primary>authentication</primary>
44926 <secondary>required by client</secondary>
44927 </indexterm>
44928 This option provides a list of servers for which authentication must succeed
44929 before Exim will try to transfer a message. If authentication fails for
44930 servers which are not in this list, Exim tries to send unauthenticated. If
44931 authentication fails for one of these servers, delivery is deferred. This
44932 temporary error is detectable in the retry rules, so it can be turned into a
44933 hard failure if required. See also <option>hosts_try_auth</option>, and chapter
44934 <xref linkend="CHAPSMTPAUTH"/> for details of authentication.
44935 </para>
44936 <para>
44937 <indexterm role="option">
44938 <primary><option>hosts_request_ocsp</option></primary>
44939 </indexterm>
44940 </para>
44941 <informaltable frame="all">
44942 <tgroup cols="4" colsep="0" rowsep="0">
44943 <colspec colwidth="8*" align="left"/>
44944 <colspec colwidth="6*" align="center"/>
44945 <colspec colwidth="6*" align="center"/>
44946 <colspec colwidth="6*" align="right"/>
44947 <tbody>
44948 <row>
44949 <entry><option>hosts_request_ocsp</option></entry>
44950 <entry>Use: <emphasis>smtp</emphasis></entry>
44951 <entry>Type: <emphasis>host list</emphasis>&dagger;<emphasis></emphasis></entry>
44952 <entry>Default: <emphasis>*</emphasis></entry>
44953 </row>
44954 </tbody>
44955 </tgroup>
44956 </informaltable>
44957 <para>
44958 <indexterm role="concept">
44959 <primary>TLS</primary>
44960 <secondary>requiring for certain servers</secondary>
44961 </indexterm>
44962 Exim will request a Certificate Status on a
44963 TLS session for any host that matches this list.
44964 <option>tls_verify_certificates</option> should also be set for the transport.
44965 </para>
44966 <para>
44967 <indexterm role="option">
44968 <primary><option>hosts_require_ocsp</option></primary>
44969 </indexterm>
44970 </para>
44971 <informaltable frame="all">
44972 <tgroup cols="4" colsep="0" rowsep="0">
44973 <colspec colwidth="8*" align="left"/>
44974 <colspec colwidth="6*" align="center"/>
44975 <colspec colwidth="6*" align="center"/>
44976 <colspec colwidth="6*" align="right"/>
44977 <tbody>
44978 <row>
44979 <entry><option>hosts_require_ocsp</option></entry>
44980 <entry>Use: <emphasis>smtp</emphasis></entry>
44981 <entry>Type: <emphasis>host list</emphasis>&dagger;<emphasis></emphasis></entry>
44982 <entry>Default: <emphasis>unset</emphasis></entry>
44983 </row>
44984 </tbody>
44985 </tgroup>
44986 </informaltable>
44987 <para>
44988 <indexterm role="concept">
44989 <primary>TLS</primary>
44990 <secondary>requiring for certain servers</secondary>
44991 </indexterm>
44992 Exim will request, and check for a valid Certificate Status being given, on a
44993 TLS session for any host that matches this list.
44994 <option>tls_verify_certificates</option> should also be set for the transport.
44995 </para>
44996 <para>
44997 <indexterm role="option">
44998 <primary><option>hosts_require_tls</option></primary>
44999 </indexterm>
45000 </para>
45001 <informaltable frame="all">
45002 <tgroup cols="4" colsep="0" rowsep="0">
45003 <colspec colwidth="8*" align="left"/>
45004 <colspec colwidth="6*" align="center"/>
45005 <colspec colwidth="6*" align="center"/>
45006 <colspec colwidth="6*" align="right"/>
45007 <tbody>
45008 <row>
45009 <entry><option>hosts_require_tls</option></entry>
45010 <entry>Use: <emphasis>smtp</emphasis></entry>
45011 <entry>Type: <emphasis>host list</emphasis>&dagger;<emphasis></emphasis></entry>
45012 <entry>Default: <emphasis>unset</emphasis></entry>
45013 </row>
45014 </tbody>
45015 </tgroup>
45016 </informaltable>
45017 <para>
45018 <indexterm role="concept">
45019 <primary>TLS</primary>
45020 <secondary>requiring for certain servers</secondary>
45021 </indexterm>
45022 Exim will insist on using a TLS session when delivering to any host that
45023 matches this list. See chapter <xref linkend="CHAPTLS"/> for details of TLS.
45024 <emphasis role="bold">Note</emphasis>: This option affects outgoing mail only. To insist on TLS for
45025 incoming messages, use an appropriate ACL.
45026 </para>
45027 <para>
45028 <indexterm role="option">
45029 <primary><option>hosts_try_auth</option></primary>
45030 </indexterm>
45031 </para>
45032 <informaltable frame="all">
45033 <tgroup cols="4" colsep="0" rowsep="0">
45034 <colspec colwidth="8*" align="left"/>
45035 <colspec colwidth="6*" align="center"/>
45036 <colspec colwidth="6*" align="center"/>
45037 <colspec colwidth="6*" align="right"/>
45038 <tbody>
45039 <row>
45040 <entry><option>hosts_try_auth</option></entry>
45041 <entry>Use: <emphasis>smtp</emphasis></entry>
45042 <entry>Type: <emphasis>host list</emphasis>&dagger;<emphasis></emphasis></entry>
45043 <entry>Default: <emphasis>unset</emphasis></entry>
45044 </row>
45045 </tbody>
45046 </tgroup>
45047 </informaltable>
45048 <para>
45049 <indexterm role="concept">
45050 <primary>authentication</primary>
45051 <secondary>optional in client</secondary>
45052 </indexterm>
45053 This option provides a list of servers to which, provided they announce
45054 authentication support, Exim will attempt to authenticate as a client when it
45055 connects. If authentication fails, Exim will try to transfer the message
45056 unauthenticated. See also <option>hosts_require_auth</option>, and chapter
45057 <xref linkend="CHAPSMTPAUTH"/> for details of authentication.
45058 </para>
45059 <para>
45060 <indexterm role="option">
45061 <primary><option>hosts_try_prdr</option></primary>
45062 </indexterm>
45063 </para>
45064 <informaltable frame="all">
45065 <tgroup cols="4" colsep="0" rowsep="0">
45066 <colspec colwidth="8*" align="left"/>
45067 <colspec colwidth="6*" align="center"/>
45068 <colspec colwidth="6*" align="center"/>
45069 <colspec colwidth="6*" align="right"/>
45070 <tbody>
45071 <row>
45072 <entry><option>hosts_try_prdr</option></entry>
45073 <entry>Use: <emphasis>smtp</emphasis></entry>
45074 <entry>Type: <emphasis>host list</emphasis>&dagger;<emphasis></emphasis></entry>
45075 <entry>Default: <emphasis>unset</emphasis></entry>
45076 </row>
45077 </tbody>
45078 </tgroup>
45079 </informaltable>
45080 <para>
45081 <indexterm role="concept">
45082 <primary>PRDR</primary>
45083 <secondary>enabling, optional in client</secondary>
45084 </indexterm>
45085 This option provides a list of servers to which, provided they announce
45086 PRDR support, Exim will attempt to negotiate PRDR
45087 for multi-recipient messages.
45088 </para>
45089 <para>
45090 <indexterm role="option">
45091 <primary><option>interface</option></primary>
45092 </indexterm>
45093 </para>
45094 <informaltable frame="all">
45095 <tgroup cols="4" colsep="0" rowsep="0">
45096 <colspec colwidth="8*" align="left"/>
45097 <colspec colwidth="6*" align="center"/>
45098 <colspec colwidth="6*" align="center"/>
45099 <colspec colwidth="6*" align="right"/>
45100 <tbody>
45101 <row>
45102 <entry><option>interface</option></entry>
45103 <entry>Use: <emphasis>smtp</emphasis></entry>
45104 <entry>Type: <emphasis>string list</emphasis>&dagger;<emphasis></emphasis></entry>
45105 <entry>Default: <emphasis>unset</emphasis></entry>
45106 </row>
45107 </tbody>
45108 </tgroup>
45109 </informaltable>
45110 <para>
45111 <indexterm role="concept">
45112 <primary>bind IP address</primary>
45113 </indexterm>
45114 <indexterm role="concept">
45115 <primary>IP address</primary>
45116 <secondary>binding</secondary>
45117 </indexterm>
45118 <indexterm role="variable">
45119 <primary><varname>$host</varname></primary>
45120 </indexterm>
45121 <indexterm role="variable">
45122 <primary><varname>$host_address</varname></primary>
45123 </indexterm>
45124 This option specifies which interface to bind to when making an outgoing SMTP
45125 call. The value is an IP address, not an interface name such as
45126 <literal>eth0</literal>. Do not confuse this with the interface address that was used when a
45127 message was received, which is in <varname>$received_ip_address</varname>, formerly known as
45128 <varname>$interface_address</varname>. The name was changed to minimize confusion with the
45129 outgoing interface address. There is no variable that contains an outgoing
45130 interface address because, unless it is set by this option, its value is
45131 unknown.
45132 </para>
45133 <para>
45134 During the expansion of the <option>interface</option> option the variables <varname>$host</varname> and
45135 <varname>$host_address</varname> refer to the host to which a connection is about to be made
45136 during the expansion of the string. Forced expansion failure, or an empty
45137 string result causes the option to be ignored. Otherwise, after expansion, the
45138 string must be a list of IP addresses, colon-separated by default, but the
45139 separator can be changed in the usual way. For example:
45140 </para>
45141 <literallayout class="monospaced">
45142 interface = &lt;; 192.168.123.123 ; 3ffe:ffff:836f::fe86:a061
45143 </literallayout>
45144 <para>
45145 The first interface of the correct type (IPv4 or IPv6) is used for the outgoing
45146 connection. If none of them are the correct type, the option is ignored. If
45147 <option>interface</option> is not set, or is ignored, the system&#x2019;s IP functions choose which
45148 interface to use if the host has more than one.
45149 </para>
45150 <para>
45151 <indexterm role="option">
45152 <primary><option>keepalive</option></primary>
45153 </indexterm>
45154 </para>
45155 <informaltable frame="all">
45156 <tgroup cols="4" colsep="0" rowsep="0">
45157 <colspec colwidth="8*" align="left"/>
45158 <colspec colwidth="6*" align="center"/>
45159 <colspec colwidth="6*" align="center"/>
45160 <colspec colwidth="6*" align="right"/>
45161 <tbody>
45162 <row>
45163 <entry><option>keepalive</option></entry>
45164 <entry>Use: <emphasis>smtp</emphasis></entry>
45165 <entry>Type: <emphasis>boolean</emphasis></entry>
45166 <entry>Default: <emphasis>true</emphasis></entry>
45167 </row>
45168 </tbody>
45169 </tgroup>
45170 </informaltable>
45171 <para>
45172 <indexterm role="concept">
45173 <primary>keepalive</primary>
45174 <secondary>on outgoing connection</secondary>
45175 </indexterm>
45176 This option controls the setting of SO_KEEPALIVE on outgoing TCP/IP socket
45177 connections. When set, it causes the kernel to probe idle connections
45178 periodically, by sending packets with <quote>old</quote> sequence numbers. The other end
45179 of the connection should send a acknowledgment if the connection is still okay
45180 or a reset if the connection has been aborted. The reason for doing this is
45181 that it has the beneficial effect of freeing up certain types of connection
45182 that can get stuck when the remote host is disconnected without tidying up the
45183 TCP/IP call properly. The keepalive mechanism takes several hours to detect
45184 unreachable hosts.
45185 </para>
45186 <para>
45187 <indexterm role="option">
45188 <primary><option>lmtp_ignore_quota</option></primary>
45189 </indexterm>
45190 </para>
45191 <informaltable frame="all">
45192 <tgroup cols="4" colsep="0" rowsep="0">
45193 <colspec colwidth="8*" align="left"/>
45194 <colspec colwidth="6*" align="center"/>
45195 <colspec colwidth="6*" align="center"/>
45196 <colspec colwidth="6*" align="right"/>
45197 <tbody>
45198 <row>
45199 <entry><option>lmtp_ignore_quota</option></entry>
45200 <entry>Use: <emphasis>smtp</emphasis></entry>
45201 <entry>Type: <emphasis>boolean</emphasis></entry>
45202 <entry>Default: <emphasis>false</emphasis></entry>
45203 </row>
45204 </tbody>
45205 </tgroup>
45206 </informaltable>
45207 <para>
45208 <indexterm role="concept">
45209 <primary>LMTP</primary>
45210 <secondary>ignoring quota errors</secondary>
45211 </indexterm>
45212 If this option is set true when the <option>protocol</option> option is set to <quote>lmtp</quote>, the
45213 string <literal>IGNOREQUOTA</literal> is added to RCPT commands, provided that the LMTP server
45214 has advertised support for IGNOREQUOTA in its response to the LHLO command.
45215 </para>
45216 <para>
45217 <indexterm role="option">
45218 <primary><option>max_rcpt</option></primary>
45219 </indexterm>
45220 </para>
45221 <informaltable frame="all">
45222 <tgroup cols="4" colsep="0" rowsep="0">
45223 <colspec colwidth="8*" align="left"/>
45224 <colspec colwidth="6*" align="center"/>
45225 <colspec colwidth="6*" align="center"/>
45226 <colspec colwidth="6*" align="right"/>
45227 <tbody>
45228 <row>
45229 <entry><option>max_rcpt</option></entry>
45230 <entry>Use: <emphasis>smtp</emphasis></entry>
45231 <entry>Type: <emphasis>integer</emphasis></entry>
45232 <entry>Default: <emphasis>100</emphasis></entry>
45233 </row>
45234 </tbody>
45235 </tgroup>
45236 </informaltable>
45237 <para>
45238 <indexterm role="concept">
45239 <primary>RCPT</primary>
45240 <secondary>maximum number of outgoing</secondary>
45241 </indexterm>
45242 This option limits the number of RCPT commands that are sent in a single
45243 SMTP message transaction. Each set of addresses is treated independently, and
45244 so can cause parallel connections to the same host if <option>remote_max_parallel</option>
45245 permits this.
45246 </para>
45247 <para>
45248 <indexterm role="option">
45249 <primary><option>multi_domain</option></primary>
45250 </indexterm>
45251 </para>
45252 <informaltable frame="all">
45253 <tgroup cols="4" colsep="0" rowsep="0">
45254 <colspec colwidth="8*" align="left"/>
45255 <colspec colwidth="6*" align="center"/>
45256 <colspec colwidth="6*" align="center"/>
45257 <colspec colwidth="6*" align="right"/>
45258 <tbody>
45259 <row>
45260 <entry><option>multi_domain</option></entry>
45261 <entry>Use: <emphasis>smtp</emphasis></entry>
45262 <entry>Type: <emphasis>boolean</emphasis></entry>
45263 <entry>Default: <emphasis>true</emphasis></entry>
45264 </row>
45265 </tbody>
45266 </tgroup>
45267 </informaltable>
45268 <para>
45269 <indexterm role="variable">
45270 <primary><varname>$domain</varname></primary>
45271 </indexterm>
45272 When this option is set, the <command>smtp</command> transport can handle a number of
45273 addresses containing a mixture of different domains provided they all resolve
45274 to the same list of hosts. Turning the option off restricts the transport to
45275 handling only one domain at a time. This is useful if you want to use
45276 <varname>$domain</varname> in an expansion for the transport, because it is set only when there
45277 is a single domain involved in a remote delivery.
45278 </para>
45279 <para>
45280 <indexterm role="option">
45281 <primary><option>port</option></primary>
45282 </indexterm>
45283 </para>
45284 <informaltable frame="all">
45285 <tgroup cols="4" colsep="0" rowsep="0">
45286 <colspec colwidth="8*" align="left"/>
45287 <colspec colwidth="6*" align="center"/>
45288 <colspec colwidth="6*" align="center"/>
45289 <colspec colwidth="6*" align="right"/>
45290 <tbody>
45291 <row>
45292 <entry><option>port</option></entry>
45293 <entry>Use: <emphasis>smtp</emphasis></entry>
45294 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
45295 <entry>Default: <emphasis>see below</emphasis></entry>
45296 </row>
45297 </tbody>
45298 </tgroup>
45299 </informaltable>
45300 <para>
45301 <indexterm role="concept">
45302 <primary>port</primary>
45303 <secondary>sending TCP/IP</secondary>
45304 </indexterm>
45305 <indexterm role="concept">
45306 <primary>TCP/IP</primary>
45307 <secondary>setting outgoing port</secondary>
45308 </indexterm>
45309 This option specifies the TCP/IP port on the server to which Exim connects.
45310 <emphasis role="bold">Note:</emphasis> Do not confuse this with the port that was used when a message was
45311 received, which is in <varname>$received_port</varname>, formerly known as <varname>$interface_port</varname>.
45312 The name was changed to minimize confusion with the outgoing port. There is no
45313 variable that contains an outgoing port.
45314 </para>
45315 <para>
45316 If the value of this option begins with a digit it is taken as a port number;
45317 otherwise it is looked up using <function>getservbyname()</function>. The default value is
45318 normally <quote>smtp</quote>, but if <option>protocol</option> is set to <quote>lmtp</quote>, the default is
45319 <quote>lmtp</quote>. If the expansion fails, or if a port number cannot be found, delivery
45320 is deferred.
45321 </para>
45322 <para>
45323 <indexterm role="option">
45324 <primary><option>protocol</option></primary>
45325 </indexterm>
45326 </para>
45327 <informaltable frame="all">
45328 <tgroup cols="4" colsep="0" rowsep="0">
45329 <colspec colwidth="8*" align="left"/>
45330 <colspec colwidth="6*" align="center"/>
45331 <colspec colwidth="6*" align="center"/>
45332 <colspec colwidth="6*" align="right"/>
45333 <tbody>
45334 <row>
45335 <entry><option>protocol</option></entry>
45336 <entry>Use: <emphasis>smtp</emphasis></entry>
45337 <entry>Type: <emphasis>string</emphasis></entry>
45338 <entry>Default: <emphasis>smtp</emphasis></entry>
45339 </row>
45340 </tbody>
45341 </tgroup>
45342 </informaltable>
45343 <para>
45344 <indexterm role="concept">
45345 <primary>LMTP</primary>
45346 <secondary>over TCP/IP</secondary>
45347 </indexterm>
45348 <indexterm role="concept">
45349 <primary>ssmtp protocol</primary>
45350 <secondary>outbound</secondary>
45351 </indexterm>
45352 <indexterm role="concept">
45353 <primary>TLS</primary>
45354 <secondary>SSL-on-connect outbound</secondary>
45355 </indexterm>
45356 <indexterm role="variable">
45357 <primary><varname>$port</varname></primary>
45358 </indexterm>
45359 If this option is set to <quote>lmtp</quote> instead of <quote>smtp</quote>, the default value for
45360 the <option>port</option> option changes to <quote>lmtp</quote>, and the transport operates the LMTP
45361 protocol (RFC 2033) instead of SMTP. This protocol is sometimes used for local
45362 deliveries into closed message stores. Exim also has support for running LMTP
45363 over a pipe to a local process &ndash; see chapter <xref linkend="CHAPLMTP"/>.
45364 </para>
45365 <para>
45366 If this option is set to <quote>smtps</quote>, the default vaule for the <option>port</option> option
45367 changes to <quote>smtps</quote>, and the transport initiates TLS immediately after
45368 connecting, as an outbound SSL-on-connect, instead of using STARTTLS to upgrade.
45369 The Internet standards bodies strongly discourage use of this mode.
45370 </para>
45371 <para>
45372 <indexterm role="option">
45373 <primary><option>retry_include_ip_address</option></primary>
45374 </indexterm>
45375 </para>
45376 <informaltable frame="all">
45377 <tgroup cols="4" colsep="0" rowsep="0">
45378 <colspec colwidth="8*" align="left"/>
45379 <colspec colwidth="6*" align="center"/>
45380 <colspec colwidth="6*" align="center"/>
45381 <colspec colwidth="6*" align="right"/>
45382 <tbody>
45383 <row>
45384 <entry><option>retry_include_ip_address</option></entry>
45385 <entry>Use: <emphasis>smtp</emphasis></entry>
45386 <entry>Type: <emphasis>boolean</emphasis></entry>
45387 <entry>Default: <emphasis>true</emphasis></entry>
45388 </row>
45389 </tbody>
45390 </tgroup>
45391 </informaltable>
45392 <para>
45393 Exim normally includes both the host name and the IP address in the key it
45394 constructs for indexing retry data after a temporary delivery failure. This
45395 means that when one of several IP addresses for a host is failing, it gets
45396 tried periodically (controlled by the retry rules), but use of the other IP
45397 addresses is not affected.
45398 </para>
45399 <para>
45400 However, in some dialup environments hosts are assigned a different IP address
45401 each time they connect. In this situation the use of the IP address as part of
45402 the retry key leads to undesirable behaviour. Setting this option false causes
45403 Exim to use only the host name. This should normally be done on a separate
45404 instance of the <command>smtp</command> transport, set up specially to handle the dialup
45405 hosts.
45406 </para>
45407 <para>
45408 <indexterm role="option">
45409 <primary><option>serialize_hosts</option></primary>
45410 </indexterm>
45411 </para>
45412 <informaltable frame="all">
45413 <tgroup cols="4" colsep="0" rowsep="0">
45414 <colspec colwidth="8*" align="left"/>
45415 <colspec colwidth="6*" align="center"/>
45416 <colspec colwidth="6*" align="center"/>
45417 <colspec colwidth="6*" align="right"/>
45418 <tbody>
45419 <row>
45420 <entry><option>serialize_hosts</option></entry>
45421 <entry>Use: <emphasis>smtp</emphasis></entry>
45422 <entry>Type: <emphasis>host list</emphasis>&dagger;<emphasis></emphasis></entry>
45423 <entry>Default: <emphasis>unset</emphasis></entry>
45424 </row>
45425 </tbody>
45426 </tgroup>
45427 </informaltable>
45428 <para>
45429 <indexterm role="concept">
45430 <primary>serializing connections</primary>
45431 </indexterm>
45432 <indexterm role="concept">
45433 <primary>host</primary>
45434 <secondary>serializing connections</secondary>
45435 </indexterm>
45436 Because Exim operates in a distributed manner, if several messages for the same
45437 host arrive at around the same time, more than one simultaneous connection to
45438 the remote host can occur. This is not usually a problem except when there is a
45439 slow link between the hosts. In that situation it may be helpful to restrict
45440 Exim to one connection at a time. This can be done by setting
45441 <option>serialize_hosts</option> to match the relevant hosts.
45442 </para>
45443 <para>
45444 <indexterm role="concept">
45445 <primary>hints database</primary>
45446 <secondary>serializing deliveries to a host</secondary>
45447 </indexterm>
45448 Exim implements serialization by means of a hints database in which a record is
45449 written whenever a process connects to one of the restricted hosts. The record
45450 is deleted when the connection is completed. Obviously there is scope for
45451 records to get left lying around if there is a system or program crash. To
45452 guard against this, Exim ignores any records that are more than six hours old.
45453 </para>
45454 <para>
45455 If you set up this kind of serialization, you should also arrange to delete the
45456 relevant hints database whenever your system reboots. The names of the files
45457 start with <filename>misc</filename> and they are kept in the <filename>spool/db</filename> directory. There
45458 may be one or two files, depending on the type of DBM in use. The same files
45459 are used for ETRN serialization.
45460 </para>
45461 <para>
45462 <indexterm role="option">
45463 <primary><option>size_addition</option></primary>
45464 </indexterm>
45465 </para>
45466 <informaltable frame="all">
45467 <tgroup cols="4" colsep="0" rowsep="0">
45468 <colspec colwidth="8*" align="left"/>
45469 <colspec colwidth="6*" align="center"/>
45470 <colspec colwidth="6*" align="center"/>
45471 <colspec colwidth="6*" align="right"/>
45472 <tbody>
45473 <row>
45474 <entry><option>size_addition</option></entry>
45475 <entry>Use: <emphasis>smtp</emphasis></entry>
45476 <entry>Type: <emphasis>integer</emphasis></entry>
45477 <entry>Default: <emphasis>1024</emphasis></entry>
45478 </row>
45479 </tbody>
45480 </tgroup>
45481 </informaltable>
45482 <para>
45483 <indexterm role="concept">
45484 <primary>SMTP</primary>
45485 <secondary>SIZE</secondary>
45486 </indexterm>
45487 <indexterm role="concept">
45488 <primary>message</primary>
45489 <secondary>size issue for transport filter</secondary>
45490 </indexterm>
45491 <indexterm role="concept">
45492 <primary>size</primary>
45493 <secondary>of message</secondary>
45494 </indexterm>
45495 <indexterm role="concept">
45496 <primary>transport</primary>
45497 <secondary>filter</secondary>
45498 </indexterm>
45499 <indexterm role="concept">
45500 <primary>filter</primary>
45501 <secondary>transport filter</secondary>
45502 </indexterm>
45503 If a remote SMTP server indicates that it supports the SIZE option of the
45504 MAIL command, Exim uses this to pass over the message size at the start of
45505 an SMTP transaction. It adds the value of <option>size_addition</option> to the value it
45506 sends, to allow for headers and other text that may be added during delivery by
45507 configuration options or in a transport filter. It may be necessary to increase
45508 this if a lot of text is added to messages.
45509 </para>
45510 <para>
45511 Alternatively, if the value of <option>size_addition</option> is set negative, it disables
45512 the use of the SIZE option altogether.
45513 </para>
45514 <para>
45515 <indexterm role="option">
45516 <primary><option>tls_certificate</option></primary>
45517 </indexterm>
45518 </para>
45519 <informaltable frame="all">
45520 <tgroup cols="4" colsep="0" rowsep="0">
45521 <colspec colwidth="8*" align="left"/>
45522 <colspec colwidth="6*" align="center"/>
45523 <colspec colwidth="6*" align="center"/>
45524 <colspec colwidth="6*" align="right"/>
45525 <tbody>
45526 <row>
45527 <entry><option>tls_certificate</option></entry>
45528 <entry>Use: <emphasis>smtp</emphasis></entry>
45529 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
45530 <entry>Default: <emphasis>unset</emphasis></entry>
45531 </row>
45532 </tbody>
45533 </tgroup>
45534 </informaltable>
45535 <para>
45536 <indexterm role="concept">
45537 <primary>TLS</primary>
45538 <secondary>client certificate, location of</secondary>
45539 </indexterm>
45540 <indexterm role="concept">
45541 <primary>certificate</primary>
45542 <secondary>client, location of</secondary>
45543 </indexterm>
45544 <indexterm role="variable">
45545 <primary><varname>$host</varname></primary>
45546 </indexterm>
45547 <indexterm role="variable">
45548 <primary><varname>$host_address</varname></primary>
45549 </indexterm>
45550 The value of this option must be the absolute path to a file which contains the
45551 client&#x2019;s certificate, for possible use when sending a message over an encrypted
45552 connection. The values of <varname>$host</varname> and <varname>$host_address</varname> are set to the name and
45553 address of the server during the expansion. See chapter <xref linkend="CHAPTLS"/> for
45554 details of TLS.
45555 </para>
45556 <para>
45557 <emphasis role="bold">Note</emphasis>: This option must be set if you want Exim to be able to use a TLS
45558 certificate when sending messages as a client. The global option of the same
45559 name specifies the certificate for Exim as a server; it is not automatically
45560 assumed that the same certificate should be used when Exim is operating as a
45561 client.
45562 </para>
45563 <para>
45564 <indexterm role="option">
45565 <primary><option>tls_crl</option></primary>
45566 </indexterm>
45567 </para>
45568 <informaltable frame="all">
45569 <tgroup cols="4" colsep="0" rowsep="0">
45570 <colspec colwidth="8*" align="left"/>
45571 <colspec colwidth="6*" align="center"/>
45572 <colspec colwidth="6*" align="center"/>
45573 <colspec colwidth="6*" align="right"/>
45574 <tbody>
45575 <row>
45576 <entry><option>tls_crl</option></entry>
45577 <entry>Use: <emphasis>smtp</emphasis></entry>
45578 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
45579 <entry>Default: <emphasis>unset</emphasis></entry>
45580 </row>
45581 </tbody>
45582 </tgroup>
45583 </informaltable>
45584 <para>
45585 <indexterm role="concept">
45586 <primary>TLS</primary>
45587 <secondary>client certificate revocation list</secondary>
45588 </indexterm>
45589 <indexterm role="concept">
45590 <primary>certificate</primary>
45591 <secondary>revocation list for client</secondary>
45592 </indexterm>
45593 This option specifies a certificate revocation list. The expanded value must
45594 be the name of a file that contains a CRL in PEM format.
45595 </para>
45596 <para>
45597 <indexterm role="option">
45598 <primary><option>tls_dh_min_bits</option></primary>
45599 </indexterm>
45600 </para>
45601 <informaltable frame="all">
45602 <tgroup cols="4" colsep="0" rowsep="0">
45603 <colspec colwidth="8*" align="left"/>
45604 <colspec colwidth="6*" align="center"/>
45605 <colspec colwidth="6*" align="center"/>
45606 <colspec colwidth="6*" align="right"/>
45607 <tbody>
45608 <row>
45609 <entry><option>tls_dh_min_bits</option></entry>
45610 <entry>Use: <emphasis>smtp</emphasis></entry>
45611 <entry>Type: <emphasis>integer</emphasis></entry>
45612 <entry>Default: <emphasis>1024</emphasis></entry>
45613 </row>
45614 </tbody>
45615 </tgroup>
45616 </informaltable>
45617 <para>
45618 <indexterm role="concept">
45619 <primary>TLS</primary>
45620 <secondary>Diffie-Hellman minimum acceptable size</secondary>
45621 </indexterm>
45622 When establishing a TLS session, if a ciphersuite which uses Diffie-Hellman
45623 key agreement is negotiated, the server will provide a large prime number
45624 for use.  This option establishes the minimum acceptable size of that number.
45625 If the parameter offered by the server is too small, then the TLS handshake
45626 will fail.
45627 </para>
45628 <para>
45629 Only supported when using GnuTLS.
45630 </para>
45631 <para>
45632 <indexterm role="option">
45633 <primary><option>tls_privatekey</option></primary>
45634 </indexterm>
45635 </para>
45636 <informaltable frame="all">
45637 <tgroup cols="4" colsep="0" rowsep="0">
45638 <colspec colwidth="8*" align="left"/>
45639 <colspec colwidth="6*" align="center"/>
45640 <colspec colwidth="6*" align="center"/>
45641 <colspec colwidth="6*" align="right"/>
45642 <tbody>
45643 <row>
45644 <entry><option>tls_privatekey</option></entry>
45645 <entry>Use: <emphasis>smtp</emphasis></entry>
45646 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
45647 <entry>Default: <emphasis>unset</emphasis></entry>
45648 </row>
45649 </tbody>
45650 </tgroup>
45651 </informaltable>
45652 <para>
45653 <indexterm role="concept">
45654 <primary>TLS</primary>
45655 <secondary>client private key, location of</secondary>
45656 </indexterm>
45657 <indexterm role="variable">
45658 <primary><varname>$host</varname></primary>
45659 </indexterm>
45660 <indexterm role="variable">
45661 <primary><varname>$host_address</varname></primary>
45662 </indexterm>
45663 The value of this option must be the absolute path to a file which contains the
45664 client&#x2019;s private key. This is used when sending a message over an encrypted
45665 connection using a client certificate. The values of <varname>$host</varname> and
45666 <varname>$host_address</varname> are set to the name and address of the server during the
45667 expansion. If this option is unset, or the expansion is forced to fail, or the
45668 result is an empty string, the private key is assumed to be in the same file as
45669 the certificate. See chapter <xref linkend="CHAPTLS"/> for details of TLS.
45670 </para>
45671 <para>
45672 <indexterm role="option">
45673 <primary><option>tls_require_ciphers</option></primary>
45674 </indexterm>
45675 </para>
45676 <informaltable frame="all">
45677 <tgroup cols="4" colsep="0" rowsep="0">
45678 <colspec colwidth="8*" align="left"/>
45679 <colspec colwidth="6*" align="center"/>
45680 <colspec colwidth="6*" align="center"/>
45681 <colspec colwidth="6*" align="right"/>
45682 <tbody>
45683 <row>
45684 <entry><option>tls_require_ciphers</option></entry>
45685 <entry>Use: <emphasis>smtp</emphasis></entry>
45686 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
45687 <entry>Default: <emphasis>unset</emphasis></entry>
45688 </row>
45689 </tbody>
45690 </tgroup>
45691 </informaltable>
45692 <para>
45693 <indexterm role="concept">
45694 <primary>TLS</primary>
45695 <secondary>requiring specific ciphers</secondary>
45696 </indexterm>
45697 <indexterm role="concept">
45698 <primary>cipher</primary>
45699 <secondary>requiring specific</secondary>
45700 </indexterm>
45701 <indexterm role="variable">
45702 <primary><varname>$host</varname></primary>
45703 </indexterm>
45704 <indexterm role="variable">
45705 <primary><varname>$host_address</varname></primary>
45706 </indexterm>
45707 The value of this option must be a list of permitted cipher suites, for use
45708 when setting up an outgoing encrypted connection. (There is a global option of
45709 the same name for controlling incoming connections.) The values of <varname>$host</varname> and
45710 <varname>$host_address</varname> are set to the name and address of the server during the
45711 expansion. See chapter <xref linkend="CHAPTLS"/> for details of TLS; note that this option
45712 is used in different ways by OpenSSL and GnuTLS (see sections
45713 <xref linkend="SECTreqciphssl"/> and <xref linkend="SECTreqciphgnu"/>). For GnuTLS, the order of the
45714 ciphers is a preference order.
45715 </para>
45716 <para>
45717 <indexterm role="option">
45718 <primary><option>tls_sni</option></primary>
45719 </indexterm>
45720 </para>
45721 <informaltable frame="all">
45722 <tgroup cols="4" colsep="0" rowsep="0">
45723 <colspec colwidth="8*" align="left"/>
45724 <colspec colwidth="6*" align="center"/>
45725 <colspec colwidth="6*" align="center"/>
45726 <colspec colwidth="6*" align="right"/>
45727 <tbody>
45728 <row>
45729 <entry><option>tls_sni</option></entry>
45730 <entry>Use: <emphasis>smtp</emphasis></entry>
45731 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
45732 <entry>Default: <emphasis>unset</emphasis></entry>
45733 </row>
45734 </tbody>
45735 </tgroup>
45736 </informaltable>
45737 <para>
45738 <indexterm role="concept">
45739 <primary>TLS</primary>
45740 <secondary>Server Name Indication</secondary>
45741 </indexterm>
45742 <indexterm role="variable">
45743 <primary><varname>$tls_sni</varname></primary>
45744 </indexterm>
45745 If this option is set then it sets the $tls_out_sni variable and causes any
45746 TLS session to pass this value as the Server Name Indication extension to
45747 the remote side, which can be used by the remote side to select an appropriate
45748 certificate and private key for the session.
45749 </para>
45750 <para>
45751 See <xref linkend="SECTtlssni"/> for more information.
45752 </para>
45753 <para>
45754 Note that for OpenSSL, this feature requires a build of OpenSSL that supports
45755 TLS extensions.
45756 </para>
45757 <para>
45758 <indexterm role="option">
45759 <primary><option>tls_tempfail_tryclear</option></primary>
45760 </indexterm>
45761 </para>
45762 <informaltable frame="all">
45763 <tgroup cols="4" colsep="0" rowsep="0">
45764 <colspec colwidth="8*" align="left"/>
45765 <colspec colwidth="6*" align="center"/>
45766 <colspec colwidth="6*" align="center"/>
45767 <colspec colwidth="6*" align="right"/>
45768 <tbody>
45769 <row>
45770 <entry><option>tls_tempfail_tryclear</option></entry>
45771 <entry>Use: <emphasis>smtp</emphasis></entry>
45772 <entry>Type: <emphasis>boolean</emphasis></entry>
45773 <entry>Default: <emphasis>true</emphasis></entry>
45774 </row>
45775 </tbody>
45776 </tgroup>
45777 </informaltable>
45778 <para>
45779 <indexterm role="concept">
45780 <primary>4<emphasis>xx</emphasis> responses</primary>
45781 <secondary>to STARTTLS</secondary>
45782 </indexterm>
45783 When the server host is not in <option>hosts_require_tls</option>, and there is a problem in
45784 setting up a TLS session, this option determines whether or not Exim should try
45785 to deliver the message unencrypted. If it is set false, delivery to the
45786 current host is deferred; if there are other hosts, they are tried. If this
45787 option is set true, Exim attempts to deliver unencrypted after a 4<emphasis>xx</emphasis>
45788 response to STARTTLS. Also, if STARTTLS is accepted, but the subsequent
45789 TLS negotiation fails, Exim closes the current connection (because it is in an
45790 unknown state), opens a new one to the same host, and then tries the delivery
45791 in clear.
45792 </para>
45793 <para>
45794 <indexterm role="option">
45795 <primary><option>tls_try_verify_hosts</option></primary>
45796 </indexterm>
45797 </para>
45798 <informaltable frame="all">
45799 <tgroup cols="4" colsep="0" rowsep="0">
45800 <colspec colwidth="8*" align="left"/>
45801 <colspec colwidth="6*" align="center"/>
45802 <colspec colwidth="6*" align="center"/>
45803 <colspec colwidth="6*" align="right"/>
45804 <tbody>
45805 <row>
45806 <entry><option>tls_try_verify_hosts</option></entry>
45807 <entry>Use: <emphasis>smtp</emphasis></entry>
45808 <entry>Type: <emphasis>host list</emphasis>&dagger;<emphasis> unset</emphasis></entry>
45809 <entry>Default: <emphasis></emphasis></entry>
45810 </row>
45811 </tbody>
45812 </tgroup>
45813 </informaltable>
45814 <para>
45815 <indexterm role="concept">
45816 <primary>TLS</primary>
45817 <secondary>server certificate verification</secondary>
45818 </indexterm>
45819 <indexterm role="concept">
45820 <primary>certificate</primary>
45821 <secondary>verification of server</secondary>
45822 </indexterm>
45823 This option gives a list of hosts for which, on encrypted connections,
45824 certificate verification will be tried but need not succeed.
45825 The <option>tls_verify_certificates</option> option must also be set.
45826 Note that unless the host is in this list
45827 TLS connections will be denied to hosts using self-signed certificates
45828 when <option>tls_verify_certificates</option> is set.
45829 The <varname>$tls_out_certificate_verified</varname> variable is set when
45830 certificate verification succeeds.
45831 </para>
45832 <para>
45833 <indexterm role="option">
45834 <primary><option>tls_verify_certificates</option></primary>
45835 </indexterm>
45836 </para>
45837 <informaltable frame="all">
45838 <tgroup cols="4" colsep="0" rowsep="0">
45839 <colspec colwidth="8*" align="left"/>
45840 <colspec colwidth="6*" align="center"/>
45841 <colspec colwidth="6*" align="center"/>
45842 <colspec colwidth="6*" align="right"/>
45843 <tbody>
45844 <row>
45845 <entry><option>tls_verify_certificates</option></entry>
45846 <entry>Use: <emphasis>smtp</emphasis></entry>
45847 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
45848 <entry>Default: <emphasis>unset</emphasis></entry>
45849 </row>
45850 </tbody>
45851 </tgroup>
45852 </informaltable>
45853 <para>
45854 <indexterm role="concept">
45855 <primary>TLS</primary>
45856 <secondary>server certificate verification</secondary>
45857 </indexterm>
45858 <indexterm role="concept">
45859 <primary>certificate</primary>
45860 <secondary>verification of server</secondary>
45861 </indexterm>
45862 <indexterm role="variable">
45863 <primary><varname>$host</varname></primary>
45864 </indexterm>
45865 <indexterm role="variable">
45866 <primary><varname>$host_address</varname></primary>
45867 </indexterm>
45868 The value of this option must be the absolute path to a file containing
45869 permitted server certificates, for use when setting up an encrypted connection.
45870 Alternatively, if you are using OpenSSL, you can set
45871 <option>tls_verify_certificates</option> to the name of a directory containing certificate
45872 files. This does not work with GnuTLS; the option must be set to the name of a
45873 single file if you are using GnuTLS. The values of <varname>$host</varname> and
45874 <varname>$host_address</varname> are set to the name and address of the server during the
45875 expansion of this option. See chapter <xref linkend="CHAPTLS"/> for details of TLS.
45876 </para>
45877 <para>
45878 For back-compatability,
45879 if neither tls_verify_hosts nor tls_try_verify_hosts are set
45880 and certificate verification fails the TLS connection is closed.
45881 </para>
45882 <para>
45883 <indexterm role="option">
45884 <primary><option>tls_verify_hosts</option></primary>
45885 </indexterm>
45886 </para>
45887 <informaltable frame="all">
45888 <tgroup cols="4" colsep="0" rowsep="0">
45889 <colspec colwidth="8*" align="left"/>
45890 <colspec colwidth="6*" align="center"/>
45891 <colspec colwidth="6*" align="center"/>
45892 <colspec colwidth="6*" align="right"/>
45893 <tbody>
45894 <row>
45895 <entry><option>tls_verify_hosts</option></entry>
45896 <entry>Use: <emphasis>smtp</emphasis></entry>
45897 <entry>Type: <emphasis>host list</emphasis>&dagger;<emphasis> unset</emphasis></entry>
45898 <entry>Default: <emphasis></emphasis></entry>
45899 </row>
45900 </tbody>
45901 </tgroup>
45902 </informaltable>
45903 <para>
45904 <indexterm role="concept">
45905 <primary>TLS</primary>
45906 <secondary>server certificate verification</secondary>
45907 </indexterm>
45908 <indexterm role="concept">
45909 <primary>certificate</primary>
45910 <secondary>verification of server</secondary>
45911 </indexterm>
45912 This option gives a list of hosts for which. on encrypted connections,
45913 certificate verification must succeed.
45914 The <option>tls_verify_certificates</option> option must also be set.
45915 If both this option and <option>tls_try_verify_hosts</option> are unset
45916 operation is as if this option selected all hosts.
45917 </para>
45918 </section>
45919 <section id="SECTvalhosmax">
45920 <title>How the limits for the number of hosts to try are used</title>
45921 <para>
45922 <indexterm role="concept">
45923 <primary>host</primary>
45924 <secondary>maximum number to try</secondary>
45925 </indexterm>
45926 <indexterm role="concept">
45927 <primary>limit</primary>
45928 <secondary>hosts; maximum number tried</secondary>
45929 </indexterm>
45930 There are two options that are concerned with the number of hosts that are
45931 tried when an SMTP delivery takes place. They are <option>hosts_max_try</option> and
45932 <option>hosts_max_try_hardlimit</option>.
45933 </para>
45934 <para>
45935 The <option>hosts_max_try</option> option limits the number of hosts that are tried
45936 for a single delivery. However, despite the term <quote>host</quote> in its name, the
45937 option actually applies to each IP address independently. In other words, a
45938 multihomed host is treated as several independent hosts, just as it is for
45939 retrying.
45940 </para>
45941 <para>
45942 Many of the larger ISPs have multiple MX records which often point to
45943 multihomed hosts. As a result, a list of a dozen or more IP addresses may be
45944 created as a result of routing one of these domains.
45945 </para>
45946 <para>
45947 Trying every single IP address on such a long list does not seem sensible; if
45948 several at the top of the list fail, it is reasonable to assume there is some
45949 problem that is likely to affect all of them. Roughly speaking, the value of
45950 <option>hosts_max_try</option> is the maximum number that are tried before deferring the
45951 delivery. However, the logic cannot be quite that simple.
45952 </para>
45953 <para>
45954 Firstly, IP addresses that are skipped because their retry times have not
45955 arrived do not count, and in addition, addresses that are past their retry
45956 limits are also not counted, even when they are tried. This means that when
45957 some IP addresses are past their retry limits, more than the value of
45958 <option>hosts_max_retry</option> may be tried. The reason for this behaviour is to ensure
45959 that all IP addresses are considered before timing out an email address (but
45960 see below for an exception).
45961 </para>
45962 <para>
45963 Secondly, when the <option>hosts_max_try</option> limit is reached, Exim looks down the host
45964 list to see if there is a subsequent host with a different (higher valued) MX.
45965 If there is, that host is considered next, and the current IP address is used
45966 but not counted. This behaviour helps in the case of a domain with a retry rule
45967 that hardly ever delays any hosts, as is now explained:
45968 </para>
45969 <para>
45970 Consider the case of a long list of hosts with one MX value, and a few with a
45971 higher MX value. If <option>hosts_max_try</option> is small (the default is 5) only a few
45972 hosts at the top of the list are tried at first. With the default retry rule,
45973 which specifies increasing retry times, the higher MX hosts are eventually
45974 tried when those at the top of the list are skipped because they have not
45975 reached their retry times.
45976 </para>
45977 <para>
45978 However, it is common practice to put a fixed short retry time on domains for
45979 large ISPs, on the grounds that their servers are rarely down for very long.
45980 Unfortunately, these are exactly the domains that tend to resolve to long lists
45981 of hosts. The short retry time means that the lowest MX hosts are tried every
45982 time. The attempts may be in a different order because of random sorting, but
45983 without the special MX check, the higher MX hosts would never be tried until
45984 all the lower MX hosts had timed out (which might be several days), because
45985 there are always some lower MX hosts that have reached their retry times. With
45986 the special check, Exim considers at least one IP address from each MX value at
45987 every delivery attempt, even if the <option>hosts_max_try</option> limit has already been
45988 reached.
45989 </para>
45990 <para>
45991 The above logic means that <option>hosts_max_try</option> is not a hard limit, and in
45992 particular, Exim normally eventually tries all the IP addresses before timing
45993 out an email address. When <option>hosts_max_try</option> was implemented, this seemed a
45994 reasonable thing to do. Recently, however, some lunatic DNS configurations have
45995 been set up with hundreds of IP addresses for some domains. It can
45996 take a very long time indeed for an address to time out in these cases.
45997 </para>
45998 <para>
45999 The <option>hosts_max_try_hardlimit</option> option was added to help with this problem.
46000 Exim never tries more than this number of IP addresses; if it hits this limit
46001 and they are all timed out, the email address is bounced, even though not all
46002 possible IP addresses have been tried.
46003 <indexterm role="concept" startref="IIDsmttra1" class="endofrange"/>
46004 <indexterm role="concept" startref="IIDsmttra2" class="endofrange"/>
46005 </para>
46006 </section>
46007 </chapter>
46008
46009 <chapter id="CHAPrewrite">
46010 <title>Address rewriting</title>
46011 <para>
46012 <indexterm role="concept" id="IIDaddrew" class="startofrange">
46013 <primary>rewriting</primary>
46014 <secondary>addresses</secondary>
46015 </indexterm>
46016 There are some circumstances in which Exim automatically rewrites domains in
46017 addresses. The two most common are when an address is given without a domain
46018 (referred to as an <quote>unqualified address</quote>) or when an address contains an
46019 abbreviated domain that is expanded by DNS lookup.
46020 </para>
46021 <para>
46022 Unqualified envelope addresses are accepted only for locally submitted
46023 messages, or for messages that are received from hosts matching
46024 <option>sender_unqualified_hosts</option> or <option>recipient_unqualified_hosts</option>, as
46025 appropriate. Unqualified addresses in header lines are qualified if they are in
46026 locally submitted messages, or messages from hosts that are permitted to send
46027 unqualified envelope addresses. Otherwise, unqualified addresses in header
46028 lines are neither qualified nor rewritten.
46029 </para>
46030 <para>
46031 One situation in which Exim does <emphasis>not</emphasis> automatically rewrite a domain is
46032 when it is the name of a CNAME record in the DNS. The older RFCs suggest that
46033 such a domain should be rewritten using the <quote>canonical</quote> name, and some MTAs
46034 do this. The new RFCs do not contain this suggestion.
46035 </para>
46036 <section id="SECID147">
46037 <title>Explicitly configured address rewriting</title>
46038 <para>
46039 This chapter describes the rewriting rules that can be used in the
46040 main rewrite section of the configuration file, and also in the generic
46041 <option>headers_rewrite</option> option that can be set on any transport.
46042 </para>
46043 <para>
46044 Some people believe that configured address rewriting is a Mortal Sin.
46045 Others believe that life is not possible without it. Exim provides the
46046 facility; you do not have to use it.
46047 </para>
46048 <para>
46049 The main rewriting rules that appear in the <quote>rewrite</quote> section of the
46050 configuration file are applied to addresses in incoming messages, both envelope
46051 addresses and addresses in header lines. Each rule specifies the types of
46052 address to which it applies.
46053 </para>
46054 <para>
46055 Whether or not addresses in header lines are rewritten depends on the origin of
46056 the headers and the type of rewriting. Global rewriting, that is, rewriting
46057 rules from the rewrite section of the configuration file, is applied only to
46058 those headers that were received with the message. Header lines that are added
46059 by ACLs or by a system filter or by individual routers or transports (which
46060 are specific to individual recipient addresses) are not rewritten by the global
46061 rules.
46062 </para>
46063 <para>
46064 Rewriting at transport time, by means of the <option>headers_rewrite</option> option,
46065 applies all headers except those added by routers and transports. That is, as
46066 well as the headers that were received with the message, it also applies to
46067 headers that were added by an ACL or a system filter.
46068 </para>
46069 <para>
46070 In general, rewriting addresses from your own system or domain has some
46071 legitimacy. Rewriting other addresses should be done only with great care and
46072 in special circumstances. The author of Exim believes that rewriting should be
46073 used sparingly, and mainly for <quote>regularizing</quote> addresses in your own domains.
46074 Although it can sometimes be used as a routing tool, this is very strongly
46075 discouraged.
46076 </para>
46077 <para>
46078 There are two commonly encountered circumstances where rewriting is used, as
46079 illustrated by these examples:
46080 </para>
46081 <itemizedlist>
46082 <listitem>
46083 <para>
46084 The company whose domain is <emphasis>hitch.fict.example</emphasis> has a number of hosts that
46085 exchange mail with each other behind a firewall, but there is only a single
46086 gateway to the outer world. The gateway rewrites <emphasis>*.hitch.fict.example</emphasis> as
46087 <emphasis>hitch.fict.example</emphasis> when sending mail off-site.
46088 </para>
46089 </listitem>
46090 <listitem>
46091 <para>
46092 A host rewrites the local parts of its own users so that, for example,
46093 <emphasis>fp42@hitch.fict.example</emphasis> becomes <emphasis>Ford.Prefect@hitch.fict.example</emphasis>.
46094 </para>
46095 </listitem>
46096 </itemizedlist>
46097 </section>
46098 <section id="SECID148">
46099 <title>When does rewriting happen?</title>
46100 <para>
46101 <indexterm role="concept">
46102 <primary>rewriting</primary>
46103 <secondary>timing of</secondary>
46104 </indexterm>
46105 <indexterm role="concept">
46106 <primary>access control lists (ACLs)</primary>
46107 <secondary>rewriting addresses in</secondary>
46108 </indexterm>
46109 Configured address rewriting can take place at several different stages of a
46110 message&#x2019;s processing.
46111 </para>
46112 <para>
46113 <indexterm role="variable">
46114 <primary><varname>$sender_address</varname></primary>
46115 </indexterm>
46116 At the start of an ACL for MAIL, the sender address may have been rewritten
46117 by a special SMTP-time rewrite rule (see section <xref linkend="SECTrewriteS"/>), but no
46118 ordinary rewrite rules have yet been applied. If, however, the sender address
46119 is verified in the ACL, it is rewritten before verification, and remains
46120 rewritten thereafter. The subsequent value of <varname>$sender_address</varname> is the
46121 rewritten address. This also applies if sender verification happens in a
46122 RCPT ACL. Otherwise, when the sender address is not verified, it is
46123 rewritten as soon as a message&#x2019;s header lines have been received.
46124 </para>
46125 <para>
46126 <indexterm role="variable">
46127 <primary><varname>$domain</varname></primary>
46128 </indexterm>
46129 <indexterm role="variable">
46130 <primary><varname>$local_part</varname></primary>
46131 </indexterm>
46132 Similarly, at the start of an ACL for RCPT, the current recipient&#x2019;s address
46133 may have been rewritten by a special SMTP-time rewrite rule, but no ordinary
46134 rewrite rules have yet been applied to it. However, the behaviour is different
46135 from the sender address when a recipient is verified. The address is rewritten
46136 for the verification, but the rewriting is not remembered at this stage. The
46137 value of <varname>$local_part</varname> and <varname>$domain</varname> after verification are always the same
46138 as they were before (that is, they contain the unrewritten &ndash; except for
46139 SMTP-time rewriting &ndash; address).
46140 </para>
46141 <para>
46142 As soon as a message&#x2019;s header lines have been received, all the envelope
46143 recipient addresses are permanently rewritten, and rewriting is also applied to
46144 the addresses in the header lines (if configured). This happens before adding
46145 any header lines that were specified in MAIL or RCPT ACLs, and
46146 <indexterm role="concept">
46147 <primary><function>local_scan()</function> function</primary>
46148 <secondary>address rewriting; timing of</secondary>
46149 </indexterm>
46150 before the DATA ACL and <function>local_scan()</function> functions are run.
46151 </para>
46152 <para>
46153 When an address is being routed, either for delivery or for verification,
46154 rewriting is applied immediately to child addresses that are generated by
46155 redirection, unless <option>no_rewrite</option> is set on the router.
46156 </para>
46157 <para>
46158 <indexterm role="concept">
46159 <primary>envelope sender</primary>
46160 <secondary>rewriting at transport time</secondary>
46161 </indexterm>
46162 <indexterm role="concept">
46163 <primary>rewriting</primary>
46164 <secondary>at transport time</secondary>
46165 </indexterm>
46166 <indexterm role="concept">
46167 <primary>header lines</primary>
46168 <secondary>rewriting at transport time</secondary>
46169 </indexterm>
46170 At transport time, additional rewriting of addresses in header lines can be
46171 specified by setting the generic <option>headers_rewrite</option> option on a transport.
46172 This option contains rules that are identical in form to those in the rewrite
46173 section of the configuration file. They are applied to the original message
46174 header lines and any that were added by ACLs or a system filter. They are not
46175 applied to header lines that are added by routers or the transport.
46176 </para>
46177 <para>
46178 The outgoing envelope sender can be rewritten by means of the <option>return_path</option>
46179 transport option. However, it is not possible to rewrite envelope recipients at
46180 transport time.
46181 </para>
46182 </section>
46183 <section id="SECID149">
46184 <title>Testing the rewriting rules that apply on input</title>
46185 <para>
46186 <indexterm role="concept">
46187 <primary>rewriting</primary>
46188 <secondary>testing</secondary>
46189 </indexterm>
46190 <indexterm role="concept">
46191 <primary>testing</primary>
46192 <secondary>rewriting</secondary>
46193 </indexterm>
46194 Exim&#x2019;s input rewriting configuration appears in a part of the run time
46195 configuration file headed by <quote>begin rewrite</quote>. It can be tested by the
46196 <option>-brw</option> command line option. This takes an address (which can be a full RFC
46197 2822 address) as its argument. The output is a list of how the address would be
46198 transformed by the rewriting rules for each of the different places it might
46199 appear in an incoming message, that is, for each different header and for the
46200 envelope sender and recipient fields. For example,
46201 </para>
46202 <literallayout class="monospaced">
46203 exim -brw ph10@exim.workshop.example
46204 </literallayout>
46205 <para>
46206 might produce the output
46207 </para>
46208 <literallayout class="monospaced">
46209 sender: Philip.Hazel@exim.workshop.example
46210 from: Philip.Hazel@exim.workshop.example
46211 to: ph10@exim.workshop.example
46212 cc: ph10@exim.workshop.example
46213 bcc: ph10@exim.workshop.example
46214 reply-to: Philip.Hazel@exim.workshop.example
46215 env-from: Philip.Hazel@exim.workshop.example
46216 env-to: ph10@exim.workshop.example
46217 </literallayout>
46218 <para>
46219 which shows that rewriting has been set up for that address when used in any of
46220 the source fields, but not when it appears as a recipient address. At the
46221 present time, there is no equivalent way of testing rewriting rules that are
46222 set for a particular transport.
46223 </para>
46224 </section>
46225 <section id="SECID150">
46226 <title>Rewriting rules</title>
46227 <para>
46228 <indexterm role="concept">
46229 <primary>rewriting</primary>
46230 <secondary>rules</secondary>
46231 </indexterm>
46232 The rewrite section of the configuration file consists of lines of rewriting
46233 rules in the form
46234 </para>
46235 <literallayout>
46236 &lt;<emphasis>source pattern</emphasis>&gt;  &lt;<emphasis>replacement</emphasis>&gt;  &lt;<emphasis>flags</emphasis>&gt;
46237 </literallayout>
46238 <para>
46239 Rewriting rules that are specified for the <option>headers_rewrite</option> generic
46240 transport option are given as a colon-separated list. Each item in the list
46241 takes the same form as a line in the main rewriting configuration (except that
46242 any colons must be doubled, of course).
46243 </para>
46244 <para>
46245 The formats of source patterns and replacement strings are described below.
46246 Each is terminated by white space, unless enclosed in double quotes, in which
46247 case normal quoting conventions apply inside the quotes. The flags are single
46248 characters which may appear in any order. Spaces and tabs between them are
46249 ignored.
46250 </para>
46251 <para>
46252 For each address that could potentially be rewritten, the rules are scanned in
46253 order, and replacements for the address from earlier rules can themselves be
46254 replaced by later rules (but see the <quote>q</quote> and <quote>R</quote> flags).
46255 </para>
46256 <para>
46257 The order in which addresses are rewritten is undefined, may change between
46258 releases, and must not be relied on, with one exception: when a message is
46259 received, the envelope sender is always rewritten first, before any header
46260 lines are rewritten. For example, the replacement string for a rewrite of an
46261 address in <emphasis>To:</emphasis> must not assume that the message&#x2019;s address in <emphasis>From:</emphasis> has
46262 (or has not) already been rewritten. However, a rewrite of <emphasis>From:</emphasis> may assume
46263 that the envelope sender has already been rewritten.
46264 </para>
46265 <para>
46266 <indexterm role="variable">
46267 <primary><varname>$domain</varname></primary>
46268 </indexterm>
46269 <indexterm role="variable">
46270 <primary><varname>$local_part</varname></primary>
46271 </indexterm>
46272 The variables <varname>$local_part</varname> and <varname>$domain</varname> can be used in the replacement
46273 string to refer to the address that is being rewritten. Note that lookup-driven
46274 rewriting can be done by a rule of the form
46275 </para>
46276 <literallayout class="monospaced">
46277 *@*   ${lookup ...
46278 </literallayout>
46279 <para>
46280 where the lookup key uses <varname>$1</varname> and <varname>$2</varname> or <varname>$local_part</varname> and <varname>$domain</varname> to
46281 refer to the address that is being rewritten.
46282 </para>
46283 </section>
46284 <section id="SECID151">
46285 <title>Rewriting patterns</title>
46286 <para>
46287 <indexterm role="concept">
46288 <primary>rewriting</primary>
46289 <secondary>patterns</secondary>
46290 </indexterm>
46291 <indexterm role="concept">
46292 <primary>address list</primary>
46293 <secondary>in a rewriting pattern</secondary>
46294 </indexterm>
46295 The source pattern in a rewriting rule is any item which may appear in an
46296 address list (see section <xref linkend="SECTaddresslist"/>). It is in fact processed as a
46297 single-item address list, which means that it is expanded before being tested
46298 against the address. As always, if you use a regular expression as a pattern,
46299 you must take care to escape dollar and backslash characters, or use the <literal>\N</literal>
46300 facility to suppress string expansion within the regular expression.
46301 </para>
46302 <para>
46303 Domains in patterns should be given in lower case. Local parts in patterns are
46304 case-sensitive. If you want to do case-insensitive matching of local parts, you
46305 can use a regular expression that starts with <literal>^(?i)</literal>.
46306 </para>
46307 <para>
46308 <indexterm role="concept">
46309 <primary>numerical variables (<varname>$1</varname> <varname>$2</varname> etc)</primary>
46310 <secondary>in rewriting rules</secondary>
46311 </indexterm>
46312 After matching, the numerical variables <varname>$1</varname>, <varname>$2</varname>, etc. may be set,
46313 depending on the type of match which occurred. These can be used in the
46314 replacement string to insert portions of the incoming address. <varname>$0</varname> always
46315 refers to the complete incoming address. When a regular expression is used, the
46316 numerical variables are set from its capturing subexpressions. For other types
46317 of pattern they are set as follows:
46318 </para>
46319 <itemizedlist>
46320 <listitem>
46321 <para>
46322 If a local part or domain starts with an asterisk, the numerical variables
46323 refer to the character strings matched by asterisks, with <varname>$1</varname> associated with
46324 the first asterisk, and <varname>$2</varname> with the second, if present. For example, if the
46325 pattern
46326 </para>
46327 <literallayout class="monospaced">
46328 *queen@*.fict.example
46329 </literallayout>
46330 <para>
46331 is matched against the address <emphasis>hearts-queen@wonderland.fict.example</emphasis> then
46332 </para>
46333 <literallayout class="monospaced">
46334 $0 = hearts-queen@wonderland.fict.example
46335 $1 = hearts-
46336 $2 = wonderland
46337 </literallayout>
46338 <para>
46339 Note that if the local part does not start with an asterisk, but the domain
46340 does, it is <varname>$1</varname> that contains the wild part of the domain.
46341 </para>
46342 </listitem>
46343 <listitem>
46344 <para>
46345 If the domain part of the pattern is a partial lookup, the wild and fixed parts
46346 of the domain are placed in the next available numerical variables. Suppose,
46347 for example, that the address <emphasis>foo@bar.baz.example</emphasis> is processed by a
46348 rewriting rule of the form
46349 </para>
46350 <literallayout>
46351 <literal>*@partial-dbm;/some/dbm/file</literal>    &lt;<emphasis>replacement string</emphasis>&gt;
46352 </literallayout>
46353 <para>
46354 and the key in the file that matches the domain is <literal>*.baz.example</literal>. Then
46355 </para>
46356 <literallayout class="monospaced">
46357 $1 = foo
46358 $2 = bar
46359 $3 = baz.example
46360 </literallayout>
46361 <para>
46362 If the address <emphasis>foo@baz.example</emphasis> is looked up, this matches the same
46363 wildcard file entry, and in this case <varname>$2</varname> is set to the empty string, but
46364 <varname>$3</varname> is still set to <emphasis>baz.example</emphasis>. If a non-wild key is matched in a
46365 partial lookup, <varname>$2</varname> is again set to the empty string and <varname>$3</varname> is set to the
46366 whole domain. For non-partial domain lookups, no numerical variables are set.
46367 </para>
46368 </listitem>
46369 </itemizedlist>
46370 </section>
46371 <section id="SECID152">
46372 <title>Rewriting replacements</title>
46373 <para>
46374 <indexterm role="concept">
46375 <primary>rewriting</primary>
46376 <secondary>replacements</secondary>
46377 </indexterm>
46378 If the replacement string for a rule is a single asterisk, addresses that
46379 match the pattern and the flags are <emphasis>not</emphasis> rewritten, and no subsequent
46380 rewriting rules are scanned. For example,
46381 </para>
46382 <literallayout class="monospaced">
46383 hatta@lookingglass.fict.example  *  f
46384 </literallayout>
46385 <para>
46386 specifies that <emphasis>hatta@lookingglass.fict.example</emphasis> is never to be rewritten in
46387 <emphasis>From:</emphasis> headers.
46388 </para>
46389 <para>
46390 <indexterm role="variable">
46391 <primary><varname>$domain</varname></primary>
46392 </indexterm>
46393 <indexterm role="variable">
46394 <primary><varname>$local_part</varname></primary>
46395 </indexterm>
46396 If the replacement string is not a single asterisk, it is expanded, and must
46397 yield a fully qualified address. Within the expansion, the variables
46398 <varname>$local_part</varname> and <varname>$domain</varname> refer to the address that is being rewritten.
46399 Any letters they contain retain their original case &ndash; they are not lower
46400 cased. The numerical variables are set up according to the type of pattern that
46401 matched the address, as described above. If the expansion is forced to fail by
46402 the presence of <quote>fail</quote> in a conditional or lookup item, rewriting by the
46403 current rule is abandoned, but subsequent rules may take effect. Any other
46404 expansion failure causes the entire rewriting operation to be abandoned, and an
46405 entry written to the panic log.
46406 </para>
46407 </section>
46408 <section id="SECID153">
46409 <title>Rewriting flags</title>
46410 <para>
46411 There are three different kinds of flag that may appear on rewriting rules:
46412 </para>
46413 <itemizedlist>
46414 <listitem>
46415 <para>
46416 Flags that specify which headers and envelope addresses to rewrite: E, F, T, b,
46417 c, f, h, r, s, t.
46418 </para>
46419 </listitem>
46420 <listitem>
46421 <para>
46422 A flag that specifies rewriting at SMTP time: S.
46423 </para>
46424 </listitem>
46425 <listitem>
46426 <para>
46427 Flags that control the rewriting process: Q, q, R, w.
46428 </para>
46429 </listitem>
46430 </itemizedlist>
46431 <para>
46432 For rules that are part of the <option>headers_rewrite</option> generic transport option,
46433 E, F, T, and S are not permitted.
46434 </para>
46435 </section>
46436 <section id="SECID154">
46437 <title>Flags specifying which headers and envelope addresses to rewrite</title>
46438 <para>
46439 <indexterm role="concept">
46440 <primary>rewriting</primary>
46441 <secondary>flags</secondary>
46442 </indexterm>
46443 If none of the following flag letters, nor the <quote>S</quote> flag (see section
46444 <xref linkend="SECTrewriteS"/>) are present, a main rewriting rule applies to all headers
46445 and to both the sender and recipient fields of the envelope, whereas a
46446 transport-time rewriting rule just applies to all headers. Otherwise, the
46447 rewriting rule is skipped unless the relevant addresses are being processed.
46448 </para>
46449 <literallayout>
46450 <literal>E</literal>       rewrite all envelope fields
46451 <literal>F</literal>       rewrite the envelope From field
46452 <literal>T</literal>       rewrite the envelope To field
46453 <literal>b</literal>       rewrite the <emphasis>Bcc:</emphasis> header
46454 <literal>c</literal>       rewrite the <emphasis>Cc:</emphasis> header
46455 <literal>f</literal>       rewrite the <emphasis>From:</emphasis> header
46456 <literal>h</literal>       rewrite all headers
46457 <literal>r</literal>       rewrite the <emphasis>Reply-To:</emphasis> header
46458 <literal>s</literal>       rewrite the <emphasis>Sender:</emphasis> header
46459 <literal>t</literal>       rewrite the <emphasis>To:</emphasis> header
46460 </literallayout>
46461 <para>
46462 "All headers" means all of the headers listed above that can be selected
46463 individually, plus their <emphasis>Resent-</emphasis> versions. It does not include
46464 other headers such as <emphasis>Subject:</emphasis> etc.
46465 </para>
46466 <para>
46467 You should be particularly careful about rewriting <emphasis>Sender:</emphasis> headers, and
46468 restrict this to special known cases in your own domains.
46469 </para>
46470 </section>
46471 <section id="SECTrewriteS">
46472 <title>The SMTP-time rewriting flag</title>
46473 <para>
46474 <indexterm role="concept">
46475 <primary>SMTP</primary>
46476 <secondary>rewriting malformed addresses</secondary>
46477 </indexterm>
46478 <indexterm role="concept">
46479 <primary>RCPT</primary>
46480 <secondary>rewriting argument of</secondary>
46481 </indexterm>
46482 <indexterm role="concept">
46483 <primary>MAIL</primary>
46484 <secondary>rewriting argument of</secondary>
46485 </indexterm>
46486 The rewrite flag <quote>S</quote> specifies a rewrite of incoming envelope addresses at
46487 SMTP time, as soon as an address is received in a MAIL or RCPT command, and
46488 before any other processing; even before syntax checking. The pattern is
46489 required to be a regular expression, and it is matched against the whole of the
46490 data for the command, including any surrounding angle brackets.
46491 </para>
46492 <para>
46493 <indexterm role="variable">
46494 <primary><varname>$domain</varname></primary>
46495 </indexterm>
46496 <indexterm role="variable">
46497 <primary><varname>$local_part</varname></primary>
46498 </indexterm>
46499 This form of rewrite rule allows for the handling of addresses that are not
46500 compliant with RFCs 2821 and 2822 (for example, <quote>bang paths</quote> in batched SMTP
46501 input). Because the input is not required to be a syntactically valid address,
46502 the variables <varname>$local_part</varname> and <varname>$domain</varname> are not available during the
46503 expansion of the replacement string. The result of rewriting replaces the
46504 original address in the MAIL or RCPT command.
46505 </para>
46506 </section>
46507 <section id="SECID155">
46508 <title>Flags controlling the rewriting process</title>
46509 <para>
46510 There are four flags which control the way the rewriting process works. These
46511 take effect only when a rule is invoked, that is, when the address is of the
46512 correct type (matches the flags) and matches the pattern:
46513 </para>
46514 <itemizedlist>
46515 <listitem>
46516 <para>
46517 If the <quote>Q</quote> flag is set on a rule, the rewritten address is permitted to be an
46518 unqualified local part. It is qualified with <option>qualify_recipient</option>. In the
46519 absence of <quote>Q</quote> the rewritten address must always include a domain.
46520 </para>
46521 </listitem>
46522 <listitem>
46523 <para>
46524 If the <quote>q</quote> flag is set on a rule, no further rewriting rules are considered,
46525 even if no rewriting actually takes place because of a <quote>fail</quote> in the
46526 expansion. The <quote>q</quote> flag is not effective if the address is of the wrong type
46527 (does not match the flags) or does not match the pattern.
46528 </para>
46529 </listitem>
46530 <listitem>
46531 <para>
46532 The <quote>R</quote> flag causes a successful rewriting rule to be re-applied to the new
46533 address, up to ten times. It can be combined with the <quote>q</quote> flag, to stop
46534 rewriting once it fails to match (after at least one successful rewrite).
46535 </para>
46536 </listitem>
46537 <listitem>
46538 <para>
46539 <indexterm role="concept">
46540 <primary>rewriting</primary>
46541 <secondary>whole addresses</secondary>
46542 </indexterm>
46543 When an address in a header is rewritten, the rewriting normally applies only
46544 to the working part of the address, with any comments and RFC 2822 <quote>phrase</quote>
46545 left unchanged. For example, rewriting might change
46546 </para>
46547 <literallayout class="monospaced">
46548 From: Ford Prefect &lt;fp42@restaurant.hitch.fict.example&gt;
46549 </literallayout>
46550 <para>
46551 into
46552 </para>
46553 <literallayout class="monospaced">
46554 From: Ford Prefect &lt;prefectf@hitch.fict.example&gt;
46555 </literallayout>
46556 <para>
46557 <indexterm role="concept">
46558 <primary>RFC 2047</primary>
46559 </indexterm>
46560 Sometimes there is a need to replace the whole address item, and this can be
46561 done by adding the flag letter <quote>w</quote> to a rule. If this is set on a rule that
46562 causes an address in a header line to be rewritten, the entire address is
46563 replaced, not just the working part. The replacement must be a complete RFC
46564 2822 address, including the angle brackets if necessary. If text outside angle
46565 brackets contains a character whose value is greater than 126 or less than 32
46566 (except for tab), the text is encoded according to RFC 2047. The character set
46567 is taken from <option>headers_charset</option>, which defaults to ISO-8859-1.
46568 </para>
46569 <para>
46570 When the <quote>w</quote> flag is set on a rule that causes an envelope address to be
46571 rewritten, all but the working part of the replacement address is discarded.
46572 </para>
46573 </listitem>
46574 </itemizedlist>
46575 </section>
46576 <section id="SECID156">
46577 <title>Rewriting examples</title>
46578 <para>
46579 Here is an example of the two common rewriting paradigms:
46580 </para>
46581 <literallayout class="monospaced">
46582 *@*.hitch.fict.example  $1@hitch.fict.example
46583 *@hitch.fict.example    ${lookup{$1}dbm{/etc/realnames}\
46584                      {$value}fail}@hitch.fict.example bctfrF
46585 </literallayout>
46586 <para>
46587 Note the use of <quote>fail</quote> in the lookup expansion in the second rule, forcing
46588 the string expansion to fail if the lookup does not succeed. In this context it
46589 has the effect of leaving the original address unchanged, but Exim goes on to
46590 consider subsequent rewriting rules, if any, because the <quote>q</quote> flag is not
46591 present in that rule. An alternative to <quote>fail</quote> would be to supply <varname>$1</varname>
46592 explicitly, which would cause the rewritten address to be the same as before,
46593 at the cost of a small bit of processing. Not supplying either of these is an
46594 error, since the rewritten address would then contain no local part.
46595 </para>
46596 <para>
46597 The first example above replaces the domain with a superior, more general
46598 domain. This may not be desirable for certain local parts. If the rule
46599 </para>
46600 <literallayout class="monospaced">
46601 root@*.hitch.fict.example  *
46602 </literallayout>
46603 <para>
46604 were inserted before the first rule, rewriting would be suppressed for the
46605 local part <emphasis>root</emphasis> at any domain ending in <emphasis>hitch.fict.example</emphasis>.
46606 </para>
46607 <para>
46608 Rewriting can be made conditional on a number of tests, by making use of
46609 <varname>${if</varname> in the expansion item. For example, to apply a rewriting rule only to
46610 messages that originate outside the local host:
46611 </para>
46612 <literallayout class="monospaced">
46613 *@*.hitch.fict.example  "${if !eq {$sender_host_address}{}\
46614                          {$1@hitch.fict.example}fail}"
46615 </literallayout>
46616 <para>
46617 The replacement string is quoted in this example because it contains white
46618 space.
46619 </para>
46620 <para>
46621 <indexterm role="concept">
46622 <primary>rewriting</primary>
46623 <secondary>bang paths</secondary>
46624 </indexterm>
46625 <indexterm role="concept">
46626 <primary>bang paths</primary>
46627 <secondary>rewriting</secondary>
46628 </indexterm>
46629 Exim does not handle addresses in the form of <quote>bang paths</quote>. If it sees such
46630 an address it treats it as an unqualified local part which it qualifies with
46631 the local qualification domain (if the source of the message is local or if the
46632 remote host is permitted to send unqualified addresses). Rewriting can
46633 sometimes be used to handle simple bang paths with a fixed number of
46634 components. For example, the rule
46635 </para>
46636 <literallayout class="monospaced">
46637 \N^([^!]+)!(.*)@your.domain.example$\N   $2@$1
46638 </literallayout>
46639 <para>
46640 rewrites a two-component bang path <emphasis>host.name!user</emphasis> as the domain address
46641 <emphasis>user@host.name</emphasis>. However, there is a security implication in using this as
46642 a global rewriting rule for envelope addresses. It can provide a backdoor
46643 method for using your system as a relay, because the incoming addresses appear
46644 to be local. If the bang path addresses are received via SMTP, it is safer to
46645 use the <quote>S</quote> flag to rewrite them as they are received, so that relay checking
46646 can be done on the rewritten addresses.
46647 <indexterm role="concept" startref="IIDaddrew" class="endofrange"/>
46648 </para>
46649 </section>
46650 </chapter>
46651
46652 <chapter id="CHAPretry">
46653 <title>Retry configuration</title>
46654 <para>
46655 <indexterm role="concept" id="IIDretconf1" class="startofrange">
46656 <primary>retry</primary>
46657 <secondary>configuration, description of</secondary>
46658 </indexterm>
46659 <indexterm role="concept" id="IIDregconf2" class="startofrange">
46660 <primary>configuration file</primary>
46661 <secondary>retry section</secondary>
46662 </indexterm>
46663 The <quote>retry</quote> section of the runtime configuration file contains a list of
46664 retry rules that control how often Exim tries to deliver messages that cannot
46665 be delivered at the first attempt. If there are no retry rules (the section is
46666 empty or not present), there are no retries. In this situation, temporary
46667 errors are treated as permanent. The default configuration contains a single,
46668 general-purpose retry rule (see section <xref linkend="SECID57"/>). The <option>-brt</option> command
46669 line option can be used to test which retry rule will be used for a given
46670 address, domain and error.
46671 </para>
46672 <para>
46673 The most common cause of retries is temporary failure to deliver to a remote
46674 host because the host is down, or inaccessible because of a network problem.
46675 Exim&#x2019;s retry processing in this case is applied on a per-host (strictly, per IP
46676 address) basis, not on a per-message basis. Thus, if one message has recently
46677 been delayed, delivery of a new message to the same host is not immediately
46678 tried, but waits for the host&#x2019;s retry time to arrive. If the <option>retry_defer</option>
46679 log selector is set, the message
46680 <indexterm role="concept">
46681 <primary>retry</primary>
46682 <secondary>time not reached</secondary>
46683 </indexterm>
46684 <quote>retry time not reached</quote> is written to the main log whenever a delivery is
46685 skipped for this reason. Section <xref linkend="SECToutSMTPerr"/> contains more details of
46686 the handling of errors during remote deliveries.
46687 </para>
46688 <para>
46689 Retry processing applies to routing as well as to delivering, except as covered
46690 in the next paragraph. The retry rules do not distinguish between these
46691 actions. It is not possible, for example, to specify different behaviour for
46692 failures to route the domain <emphasis>snark.fict.example</emphasis> and failures to deliver to
46693 the host <emphasis>snark.fict.example</emphasis>. I didn&#x2019;t think anyone would ever need this
46694 added complication, so did not implement it. However, although they share the
46695 same retry rule, the actual retry times for routing and transporting a given
46696 domain are maintained independently.
46697 </para>
46698 <para>
46699 When a delivery is not part of a queue run (typically an immediate delivery on
46700 receipt of a message), the routers are always run, and local deliveries are
46701 always attempted, even if retry times are set for them. This makes for better
46702 behaviour if one particular message is causing problems (for example, causing
46703 quota overflow, or provoking an error in a filter file). If such a delivery
46704 suffers a temporary failure, the retry data is updated as normal, and
46705 subsequent delivery attempts from queue runs occur only when the retry time for
46706 the local address is reached.
46707 </para>
46708 <section id="SECID157">
46709 <title>Changing retry rules</title>
46710 <para>
46711 If you change the retry rules in your configuration, you should consider
46712 whether or not to delete the retry data that is stored in Exim&#x2019;s spool area in
46713 files with names like <filename>db/retry</filename>. Deleting any of Exim&#x2019;s hints files is
46714 always safe; that is why they are called <quote>hints</quote>.
46715 </para>
46716 <para>
46717 The hints retry data contains suggested retry times based on the previous
46718 rules. In the case of a long-running problem with a remote host, it might
46719 record the fact that the host has timed out. If your new rules increase the
46720 timeout time for such a host, you should definitely remove the old retry data
46721 and let Exim recreate it, based on the new rules. Otherwise Exim might bounce
46722 messages that it should now be retaining.
46723 </para>
46724 </section>
46725 <section id="SECID158">
46726 <title>Format of retry rules</title>
46727 <para>
46728 <indexterm role="concept">
46729 <primary>retry</primary>
46730 <secondary>rules</secondary>
46731 </indexterm>
46732 Each retry rule occupies one line and consists of three or four parts,
46733 separated by white space: a pattern, an error name, an optional list of sender
46734 addresses, and a list of retry parameters. The pattern and sender lists must be
46735 enclosed in double quotes if they contain white space. The rules are searched
46736 in order until one is found where the pattern, error name, and sender list (if
46737 present) match the failing host or address, the error that occurred, and the
46738 message&#x2019;s sender, respectively.
46739 </para>
46740 <para>
46741 The pattern is any single item that may appear in an address list (see section
46742 <xref linkend="SECTaddresslist"/>). It is in fact processed as a one-item address list,
46743 which means that it is expanded before being tested against the address that
46744 has been delayed. A negated address list item is permitted. Address
46745 list processing treats a plain domain name as if it were preceded by <quote>*@</quote>,
46746 which makes it possible for many retry rules to start with just a domain. For
46747 example,
46748 </para>
46749 <literallayout class="monospaced">
46750 lookingglass.fict.example        *  F,24h,30m;
46751 </literallayout>
46752 <para>
46753 provides a rule for any address in the <emphasis>lookingglass.fict.example</emphasis> domain,
46754 whereas
46755 </para>
46756 <literallayout class="monospaced">
46757 alice@lookingglass.fict.example  *  F,24h,30m;
46758 </literallayout>
46759 <para>
46760 applies only to temporary failures involving the local part <option>alice</option>.
46761 In practice, almost all rules start with a domain name pattern without a local
46762 part.
46763 </para>
46764 <para>
46765 <indexterm role="concept">
46766 <primary>regular expressions</primary>
46767 <secondary>in retry rules</secondary>
46768 </indexterm>
46769 <emphasis role="bold">Warning</emphasis>: If you use a regular expression in a retry rule pattern, it
46770 must match a complete address, not just a domain, because that is how regular
46771 expressions work in address lists.
46772 </para>
46773 <literallayout>
46774 <literal>^\Nxyz\d+\.abc\.example$\N        *  G,1h,10m,2</literal>     <option>Wrong</option>
46775 <literal>^\N[^@]+@xyz\d+\.abc\.example$\N  *  G,1h,10m,2</literal>     <option>Right</option>
46776 </literallayout>
46777 </section>
46778 <section id="SECID159">
46779 <title>Choosing which retry rule to use for address errors</title>
46780 <para>
46781 When Exim is looking for a retry rule after a routing attempt has failed (for
46782 example, after a DNS timeout), each line in the retry configuration is tested
46783 against the complete address only if <option>retry_use_local_part</option> is set for the
46784 router. Otherwise, only the domain is used, except when matching against a
46785 regular expression, when the local part of the address is replaced with <quote>*</quote>.
46786 A domain on its own can match a domain pattern, or a pattern that starts with
46787 <quote>*@</quote>. By default, <option>retry_use_local_part</option> is true for routers where
46788 <option>check_local_user</option> is true, and false for other routers.
46789 </para>
46790 <para>
46791 Similarly, when Exim is looking for a retry rule after a local delivery has
46792 failed (for example, after a mailbox full error), each line in the retry
46793 configuration is tested against the complete address only if
46794 <option>retry_use_local_part</option> is set for the transport (it defaults true for all
46795 local transports).
46796 </para>
46797 <para>
46798 <indexterm role="concept">
46799 <primary>4<emphasis>xx</emphasis> responses</primary>
46800 <secondary>retry rules for</secondary>
46801 </indexterm>
46802 However, when Exim is looking for a retry rule after a remote delivery attempt
46803 suffers an address error (a 4<emphasis>xx</emphasis> SMTP response for a recipient address), the
46804 whole address is always used as the key when searching the retry rules. The
46805 rule that is found is used to create a retry time for the combination of the
46806 failing address and the message&#x2019;s sender. It is the combination of sender and
46807 recipient that is delayed in subsequent queue runs until its retry time is
46808 reached. You can delay the recipient without regard to the sender by setting
46809 <option>address_retry_include_sender</option> false in the <command>smtp</command> transport but this can
46810 lead to problems with servers that regularly issue 4<emphasis>xx</emphasis> responses to RCPT
46811 commands.
46812 </para>
46813 </section>
46814 <section id="SECID160">
46815 <title>Choosing which retry rule to use for host and message errors</title>
46816 <para>
46817 For a temporary error that is not related to an individual address (for
46818 example, a connection timeout), each line in the retry configuration is checked
46819 twice. First, the name of the remote host is used as a domain name (preceded by
46820 <quote>*@</quote> when matching a regular expression). If this does not match the line,
46821 the domain from the email address is tried in a similar fashion. For example,
46822 suppose the MX records for <emphasis>a.b.c.example</emphasis> are
46823 </para>
46824 <literallayout class="monospaced">
46825 a.b.c.example  MX  5  x.y.z.example
46826                MX  6  p.q.r.example
46827                MX  7  m.n.o.example
46828 </literallayout>
46829 <para>
46830 and the retry rules are
46831 </para>
46832 <literallayout class="monospaced">
46833 p.q.r.example    *      F,24h,30m;
46834 a.b.c.example    *      F,4d,45m;
46835 </literallayout>
46836 <para>
46837 and a delivery to the host <emphasis>x.y.z.example</emphasis> suffers a connection failure. The
46838 first rule matches neither the host nor the domain, so Exim looks at the second
46839 rule. This does not match the host, but it does match the domain, so it is used
46840 to calculate the retry time for the host <emphasis>x.y.z.example</emphasis>. Meanwhile, Exim
46841 tries to deliver to <emphasis>p.q.r.example</emphasis>. If this also suffers a host error, the
46842 first retry rule is used, because it matches the host.
46843 </para>
46844 <para>
46845 In other words, temporary failures to deliver to host <emphasis>p.q.r.example</emphasis> use the
46846 first rule to determine retry times, but for all the other hosts for the domain
46847 <emphasis>a.b.c.example</emphasis>, the second rule is used. The second rule is also used if
46848 routing to <emphasis>a.b.c.example</emphasis> suffers a temporary failure.
46849 </para>
46850 <para>
46851 <emphasis role="bold">Note</emphasis>: The host name is used when matching the patterns, not its IP address.
46852 However, if a message is routed directly to an IP address without the use of a
46853 host name, for example, if a <command>manualroute</command> router contains a setting such as:
46854 </para>
46855 <literallayout class="monospaced">
46856 route_list = *.a.example  192.168.34.23
46857 </literallayout>
46858 <para>
46859 then the <quote>host name</quote> that is used when searching for a retry rule is the
46860 textual form of the IP address.
46861 </para>
46862 </section>
46863 <section id="SECID161">
46864 <title>Retry rules for specific errors</title>
46865 <para>
46866 <indexterm role="concept">
46867 <primary>retry</primary>
46868 <secondary>specific errors; specifying</secondary>
46869 </indexterm>
46870 The second field in a retry rule is the name of a particular error, or an
46871 asterisk, which matches any error. The errors that can be tested for are:
46872 </para>
46873 <variablelist>
46874 <varlistentry>
46875 <term><option>auth_failed</option></term>
46876 <listitem>
46877 <para>
46878 Authentication failed when trying to send to a host in the
46879 <option>hosts_require_auth</option> list in an <command>smtp</command> transport.
46880 </para>
46881 </listitem></varlistentry>
46882 <varlistentry>
46883 <term><option>data_4xx</option></term>
46884 <listitem>
46885 <para>
46886 A 4<emphasis>xx</emphasis> error was received for an outgoing DATA command, either immediately
46887 after the command, or after sending the message&#x2019;s data.
46888 </para>
46889 </listitem></varlistentry>
46890 <varlistentry>
46891 <term><option>mail_4xx</option></term>
46892 <listitem>
46893 <para>
46894 A 4<emphasis>xx</emphasis> error was received for an outgoing MAIL command.
46895 </para>
46896 </listitem></varlistentry>
46897 <varlistentry>
46898 <term><option>rcpt_4xx</option></term>
46899 <listitem>
46900 <para>
46901 A 4<emphasis>xx</emphasis> error was received for an outgoing RCPT command.
46902 </para>
46903 </listitem></varlistentry>
46904 </variablelist>
46905 <para>
46906 For the three 4<emphasis>xx</emphasis> errors, either the first or both of the x&#x2019;s can be given
46907 as specific digits, for example: <literal>mail_45x</literal> or <literal>rcpt_436</literal>. For example, to
46908 recognize 452 errors given to RCPT commands for addresses in a certain domain,
46909 and have retries every ten minutes with a one-hour timeout, you could set up a
46910 retry rule of this form:
46911 </para>
46912 <literallayout class="monospaced">
46913 the.domain.name  rcpt_452   F,1h,10m
46914 </literallayout>
46915 <para>
46916 These errors apply to both outgoing SMTP (the <command>smtp</command> transport) and outgoing
46917 LMTP (either the <command>lmtp</command> transport, or the <command>smtp</command> transport in LMTP mode).
46918 </para>
46919 <variablelist>
46920 <varlistentry>
46921 <term><option>lost_connection</option></term>
46922 <listitem>
46923 <para>
46924 A server unexpectedly closed the SMTP connection. There may, of course,
46925 legitimate reasons for this (host died, network died), but if it repeats a lot
46926 for the same host, it indicates something odd.
46927 </para>
46928 </listitem></varlistentry>
46929 <varlistentry>
46930 <term><option>refused_MX</option></term>
46931 <listitem>
46932 <para>
46933 A connection to a host obtained from an MX record was refused.
46934 </para>
46935 </listitem></varlistentry>
46936 <varlistentry>
46937 <term><option>refused_A</option></term>
46938 <listitem>
46939 <para>
46940 A connection to a host not obtained from an MX record was refused.
46941 </para>
46942 </listitem></varlistentry>
46943 <varlistentry>
46944 <term><option>refused</option></term>
46945 <listitem>
46946 <para>
46947 A connection was refused.
46948 </para>
46949 </listitem></varlistentry>
46950 <varlistentry>
46951 <term><option>timeout_connect_MX</option></term>
46952 <listitem>
46953 <para>
46954 A connection attempt to a host obtained from an MX record timed out.
46955 </para>
46956 </listitem></varlistentry>
46957 <varlistentry>
46958 <term><option>timeout_connect_A</option></term>
46959 <listitem>
46960 <para>
46961 A connection attempt to a host not obtained from an MX record timed out.
46962 </para>
46963 </listitem></varlistentry>
46964 <varlistentry>
46965 <term><option>timeout_connect</option></term>
46966 <listitem>
46967 <para>
46968 A connection attempt timed out.
46969 </para>
46970 </listitem></varlistentry>
46971 <varlistentry>
46972 <term><option>timeout_MX</option></term>
46973 <listitem>
46974 <para>
46975 There was a timeout while connecting or during an SMTP session with a host
46976 obtained from an MX record.
46977 </para>
46978 </listitem></varlistentry>
46979 <varlistentry>
46980 <term><option>timeout_A</option></term>
46981 <listitem>
46982 <para>
46983 There was a timeout while connecting or during an SMTP session with a host not
46984 obtained from an MX record.
46985 </para>
46986 </listitem></varlistentry>
46987 <varlistentry>
46988 <term><option>timeout</option></term>
46989 <listitem>
46990 <para>
46991 There was a timeout while connecting or during an SMTP session.
46992 </para>
46993 </listitem></varlistentry>
46994 <varlistentry>
46995 <term><option>tls_required</option></term>
46996 <listitem>
46997 <para>
46998 The server was required to use TLS (it matched <option>hosts_require_tls</option> in the
46999 <command>smtp</command> transport), but either did not offer TLS, or it responded with 4<emphasis>xx</emphasis>
47000 to STARTTLS, or there was a problem setting up the TLS connection.
47001 </para>
47002 </listitem></varlistentry>
47003 <varlistentry>
47004 <term><option>quota</option></term>
47005 <listitem>
47006 <para>
47007 A mailbox quota was exceeded in a local delivery by the <command>appendfile</command>
47008 transport.
47009 </para>
47010 </listitem></varlistentry>
47011 <varlistentry>
47012 <term><option>quota_</option>&lt;<emphasis>time</emphasis>&gt;</term>
47013 <listitem>
47014 <para>
47015 <indexterm role="concept">
47016 <primary>quota</primary>
47017 <secondary>error testing in retry rule</secondary>
47018 </indexterm>
47019 <indexterm role="concept">
47020 <primary>retry</primary>
47021 <secondary>quota error testing</secondary>
47022 </indexterm>
47023 A mailbox quota was exceeded in a local delivery by the <command>appendfile</command>
47024 transport, and the mailbox has not been accessed for &lt;<emphasis>time</emphasis>&gt;. For example,
47025 <emphasis>quota_4d</emphasis> applies to a quota error when the mailbox has not been accessed
47026 for four days.
47027 </para>
47028 </listitem></varlistentry>
47029 </variablelist>
47030 <para>
47031 <indexterm role="concept">
47032 <primary>mailbox</primary>
47033 <secondary>time of last read</secondary>
47034 </indexterm>
47035 The idea of <option>quota_</option>&lt;<emphasis>time</emphasis>&gt; is to make it possible to have shorter
47036 timeouts when the mailbox is full and is not being read by its owner. Ideally,
47037 it should be based on the last time that the user accessed the mailbox.
47038 However, it is not always possible to determine this. Exim uses the following
47039 heuristic rules:
47040 </para>
47041 <itemizedlist>
47042 <listitem>
47043 <para>
47044 If the mailbox is a single file, the time of last access (the <quote>atime</quote>) is
47045 used. As no new messages are being delivered (because the mailbox is over
47046 quota), Exim does not access the file, so this is the time of last user access.
47047 </para>
47048 </listitem>
47049 <listitem>
47050 <para>
47051 <indexterm role="concept">
47052 <primary>maildir format</primary>
47053 <secondary>time of last read</secondary>
47054 </indexterm>
47055 For a maildir delivery, the time of last modification of the <filename>new</filename>
47056 subdirectory is used. As the mailbox is over quota, no new files are created in
47057 the <filename>new</filename> subdirectory, because no new messages are being delivered. Any
47058 change to the <filename>new</filename> subdirectory is therefore assumed to be the result of an
47059 MUA moving a new message to the <filename>cur</filename> directory when it is first read. The
47060 time that is used is therefore the last time that the user read a new message.
47061 </para>
47062 </listitem>
47063 <listitem>
47064 <para>
47065 For other kinds of multi-file mailbox, the time of last access cannot be
47066 obtained, so a retry rule that uses this type of error field is never matched.
47067 </para>
47068 </listitem>
47069 </itemizedlist>
47070 <para>
47071 The quota errors apply both to system-enforced quotas and to Exim&#x2019;s own quota
47072 mechanism in the <command>appendfile</command> transport. The <emphasis>quota</emphasis> error also applies
47073 when a local delivery is deferred because a partition is full (the ENOSPC
47074 error).
47075 </para>
47076 </section>
47077 <section id="SECID162">
47078 <title>Retry rules for specified senders</title>
47079 <para>
47080 <indexterm role="concept">
47081 <primary>retry</primary>
47082 <secondary>rules; sender-specific</secondary>
47083 </indexterm>
47084 You can specify retry rules that apply only when the failing message has a
47085 specific sender. In particular, this can be used to define retry rules that
47086 apply only to bounce messages. The third item in a retry rule can be of this
47087 form:
47088 </para>
47089 <literallayout>
47090 <literal>senders=</literal>&lt;<emphasis>address list</emphasis>&gt;
47091 </literallayout>
47092 <para>
47093 The retry timings themselves are then the fourth item. For example:
47094 </para>
47095 <literallayout class="monospaced">
47096 *   rcpt_4xx   senders=:   F,1h,30m
47097 </literallayout>
47098 <para>
47099 matches recipient 4<emphasis>xx</emphasis> errors for bounce messages sent to any address at any
47100 host. If the address list contains white space, it must be enclosed in quotes.
47101 For example:
47102 </para>
47103 <literallayout class="monospaced">
47104 a.domain  rcpt_452  senders="xb.dom : yc.dom"  G,8h,10m,1.5
47105 </literallayout>
47106 <para>
47107 <emphasis role="bold">Warning</emphasis>: This facility can be unhelpful if it is used for host errors
47108 (which do not depend on the recipient). The reason is that the sender is used
47109 only to match the retry rule. Once the rule has been found for a host error,
47110 its contents are used to set a retry time for the host, and this will apply to
47111 all messages, not just those with specific senders.
47112 </para>
47113 <para>
47114 When testing retry rules using <option>-brt</option>, you can supply a sender using the
47115 <option>-f</option> command line option, like this:
47116 </para>
47117 <literallayout class="monospaced">
47118 exim -f "" -brt user@dom.ain
47119 </literallayout>
47120 <para>
47121 If you do not set <option>-f</option> with <option>-brt</option>, a retry rule that contains a senders
47122 list is never matched.
47123 </para>
47124 </section>
47125 <section id="SECID163">
47126 <title>Retry parameters</title>
47127 <para>
47128 <indexterm role="concept">
47129 <primary>retry</primary>
47130 <secondary>parameters in rules</secondary>
47131 </indexterm>
47132 The third (or fourth, if a senders list is present) field in a retry rule is a
47133 sequence of retry parameter sets, separated by semicolons. Each set consists of
47134 </para>
47135 <literallayout>
47136 &lt;<emphasis>letter</emphasis>&gt;,&lt;<emphasis>cutoff time</emphasis>&gt;,&lt;<emphasis>arguments</emphasis>&gt;
47137 </literallayout>
47138 <para>
47139 The letter identifies the algorithm for computing a new retry time; the cutoff
47140 time is the time beyond which this algorithm no longer applies, and the
47141 arguments vary the algorithm&#x2019;s action. The cutoff time is measured from the
47142 time that the first failure for the domain (combined with the local part if
47143 relevant) was detected, not from the time the message was received.
47144 </para>
47145 <para>
47146 <indexterm role="concept">
47147 <primary>retry</primary>
47148 <secondary>algorithms</secondary>
47149 </indexterm>
47150 <indexterm role="concept">
47151 <primary>retry</primary>
47152 <secondary>fixed intervals</secondary>
47153 </indexterm>
47154 <indexterm role="concept">
47155 <primary>retry</primary>
47156 <secondary>increasing intervals</secondary>
47157 </indexterm>
47158 <indexterm role="concept">
47159 <primary>retry</primary>
47160 <secondary>random intervals</secondary>
47161 </indexterm>
47162 The available algorithms are:
47163 </para>
47164 <itemizedlist>
47165 <listitem>
47166 <para>
47167 <emphasis>F</emphasis>: retry at fixed intervals. There is a single time parameter specifying
47168 the interval.
47169 </para>
47170 </listitem>
47171 <listitem>
47172 <para>
47173 <emphasis>G</emphasis>: retry at geometrically increasing intervals. The first argument
47174 specifies a starting value for the interval, and the second a multiplier, which
47175 is used to increase the size of the interval at each retry.
47176 </para>
47177 </listitem>
47178 <listitem>
47179 <para>
47180 <emphasis>H</emphasis>: retry at randomized intervals. The arguments are as for <emphasis>G</emphasis>. For each
47181 retry, the previous interval is multiplied by the factor in order to get a
47182 maximum for the next interval. The minimum interval is the first argument of
47183 the parameter, and an actual interval is chosen randomly between them. Such a
47184 rule has been found to be helpful in cluster configurations when all the
47185 members of the cluster restart at once, and may therefore synchronize their
47186 queue processing times.
47187 </para>
47188 </listitem>
47189 </itemizedlist>
47190 <para>
47191 When computing the next retry time, the algorithm definitions are scanned in
47192 order until one whose cutoff time has not yet passed is reached. This is then
47193 used to compute a new retry time that is later than the current time. In the
47194 case of fixed interval retries, this simply means adding the interval to the
47195 current time. For geometrically increasing intervals, retry intervals are
47196 computed from the rule&#x2019;s parameters until one that is greater than the previous
47197 interval is found. The main configuration variable
47198 <indexterm role="concept">
47199 <primary>limit</primary>
47200 <secondary>retry interval</secondary>
47201 </indexterm>
47202 <indexterm role="concept">
47203 <primary>retry</primary>
47204 <secondary>interval, maximum</secondary>
47205 </indexterm>
47206 <indexterm role="option">
47207 <primary><option>retry_interval_max</option></primary>
47208 </indexterm>
47209 <option>retry_interval_max</option> limits the maximum interval between retries. It
47210 cannot be set greater than <literal>24h</literal>, which is its default value.
47211 </para>
47212 <para>
47213 A single remote domain may have a number of hosts associated with it, and each
47214 host may have more than one IP address. Retry algorithms are selected on the
47215 basis of the domain name, but are applied to each IP address independently. If,
47216 for example, a host has two IP addresses and one is unusable, Exim will
47217 generate retry times for it and will not try to use it until its next retry
47218 time comes. Thus the good IP address is likely to be tried first most of the
47219 time.
47220 </para>
47221 <para>
47222 <indexterm role="concept">
47223 <primary>hints database</primary>
47224 <secondary>use for retrying</secondary>
47225 </indexterm>
47226 Retry times are hints rather than promises. Exim does not make any attempt to
47227 run deliveries exactly at the computed times. Instead, a queue runner process
47228 starts delivery processes for delayed messages periodically, and these attempt
47229 new deliveries only for those addresses that have passed their next retry time.
47230 If a new message arrives for a deferred address, an immediate delivery attempt
47231 occurs only if the address has passed its retry time. In the absence of new
47232 messages, the minimum time between retries is the interval between queue runner
47233 processes. There is not much point in setting retry times of five minutes if
47234 your queue runners happen only once an hour, unless there are a significant
47235 number of incoming messages (which might be the case on a system that is
47236 sending everything to a smart host, for example).
47237 </para>
47238 <para>
47239 The data in the retry hints database can be inspected by using the
47240 <emphasis>exim_dumpdb</emphasis> or <emphasis>exim_fixdb</emphasis> utility programs (see chapter
47241 <xref linkend="CHAPutils"/>). The latter utility can also be used to change the data. The
47242 <emphasis>exinext</emphasis> utility script can be used to find out what the next retry times
47243 are for the hosts associated with a particular mail domain, and also for local
47244 deliveries that have been deferred.
47245 </para>
47246 </section>
47247 <section id="SECID164">
47248 <title>Retry rule examples</title>
47249 <para>
47250 Here are some example retry rules:
47251 </para>
47252 <literallayout class="monospaced">
47253 alice@wonderland.fict.example quota_5d  F,7d,3h
47254 wonderland.fict.example       quota_5d
47255 wonderland.fict.example       *         F,1h,15m; G,2d,1h,2;
47256 lookingglass.fict.example     *         F,24h,30m;
47257 *                 refused_A   F,2h,20m;
47258 *                 *           F,2h,15m; G,16h,1h,1.5; F,5d,8h
47259 </literallayout>
47260 <para>
47261 The first rule sets up special handling for mail to
47262 <emphasis>alice@wonderland.fict.example</emphasis> when there is an over-quota error and the
47263 mailbox has not been read for at least 5 days. Retries continue every three
47264 hours for 7 days. The second rule handles over-quota errors for all other local
47265 parts at <emphasis>wonderland.fict.example</emphasis>; the absence of a local part has the same
47266 effect as supplying <quote>*@</quote>. As no retry algorithms are supplied, messages that
47267 fail are bounced immediately if the mailbox has not been read for at least 5
47268 days.
47269 </para>
47270 <para>
47271 The third rule handles all other errors at <emphasis>wonderland.fict.example</emphasis>; retries
47272 happen every 15 minutes for an hour, then with geometrically increasing
47273 intervals until two days have passed since a delivery first failed. After the
47274 first hour there is a delay of one hour, then two hours, then four hours, and
47275 so on (this is a rather extreme example).
47276 </para>
47277 <para>
47278 The fourth rule controls retries for the domain <emphasis>lookingglass.fict.example</emphasis>.
47279 They happen every 30 minutes for 24 hours only. The remaining two rules handle
47280 all other domains, with special action for connection refusal from hosts that
47281 were not obtained from an MX record.
47282 </para>
47283 <para>
47284 The final rule in a retry configuration should always have asterisks in the
47285 first two fields so as to provide a general catch-all for any addresses that do
47286 not have their own special handling. This example tries every 15 minutes for 2
47287 hours, then with intervals starting at one hour and increasing by a factor of
47288 1.5 up to 16 hours, then every 8 hours up to 5 days.
47289 </para>
47290 </section>
47291 <section id="SECID165">
47292 <title>Timeout of retry data</title>
47293 <para>
47294 <indexterm role="concept">
47295 <primary>timeout</primary>
47296 <secondary>of retry data</secondary>
47297 </indexterm>
47298 <indexterm role="option">
47299 <primary><option>retry_data_expire</option></primary>
47300 </indexterm>
47301 <indexterm role="concept">
47302 <primary>hints database</primary>
47303 <secondary>data expiry</secondary>
47304 </indexterm>
47305 <indexterm role="concept">
47306 <primary>retry</primary>
47307 <secondary>timeout of data</secondary>
47308 </indexterm>
47309 Exim timestamps the data that it writes to its retry hints database. When it
47310 consults the data during a delivery it ignores any that is older than the value
47311 set in <option>retry_data_expire</option> (default 7 days). If, for example, a host hasn&#x2019;t
47312 been tried for 7 days, Exim will try to deliver to it immediately a message
47313 arrives, and if that fails, it will calculate a retry time as if it were
47314 failing for the first time.
47315 </para>
47316 <para>
47317 This improves the behaviour for messages routed to rarely-used hosts such as MX
47318 backups. If such a host was down at one time, and happens to be down again when
47319 Exim tries a month later, using the old retry data would imply that it had been
47320 down all the time, which is not a justified assumption.
47321 </para>
47322 <para>
47323 If a host really is permanently dead, this behaviour causes a burst of retries
47324 every now and again, but only if messages routed to it are rare. If there is a
47325 message at least once every 7 days the retry data never expires.
47326 </para>
47327 </section>
47328 <section id="SECID166">
47329 <title>Long-term failures</title>
47330 <para>
47331 <indexterm role="concept">
47332 <primary>delivery failure, long-term</primary>
47333 </indexterm>
47334 <indexterm role="concept">
47335 <primary>retry</primary>
47336 <secondary>after long-term failure</secondary>
47337 </indexterm>
47338 Special processing happens when an email address has been failing for so long
47339 that the cutoff time for the last algorithm is reached. For example, using the
47340 default retry rule:
47341 </para>
47342 <literallayout class="monospaced">
47343 * * F,2h,15m; G,16h,1h,1.5; F,4d,6h
47344 </literallayout>
47345 <para>
47346 the cutoff time is four days. Reaching the retry cutoff is independent of how
47347 long any specific message has been failing; it is the length of continuous
47348 failure for the recipient address that counts.
47349 </para>
47350 <para>
47351 When the cutoff time is reached for a local delivery, or for all the IP
47352 addresses associated with a remote delivery, a subsequent delivery failure
47353 causes Exim to give up on the address, and a bounce message is generated.
47354 In order to cater for new messages that use the failing address, a next retry
47355 time is still computed from the final algorithm, and is used as follows:
47356 </para>
47357 <para>
47358 For local deliveries, one delivery attempt is always made for any subsequent
47359 messages. If this delivery fails, the address fails immediately. The
47360 post-cutoff retry time is not used.
47361 </para>
47362 <para>
47363 If the delivery is remote, there are two possibilities, controlled by the
47364 <indexterm role="option">
47365 <primary><option>delay_after_cutoff</option></primary>
47366 </indexterm>
47367 <option>delay_after_cutoff</option> option of the <command>smtp</command> transport. The option is true by
47368 default. Until the post-cutoff retry time for one of the IP addresses is
47369 reached, the failing email address is bounced immediately, without a delivery
47370 attempt taking place. After that time, one new delivery attempt is made to
47371 those IP addresses that are past their retry times, and if that still fails,
47372 the address is bounced and new retry times are computed.
47373 </para>
47374 <para>
47375 In other words, when all the hosts for a given email address have been failing
47376 for a long time, Exim bounces rather then defers until one of the hosts&#x2019; retry
47377 times is reached. Then it tries once, and bounces if that attempt fails. This
47378 behaviour ensures that few resources are wasted in repeatedly trying to deliver
47379 to a broken destination, but if the host does recover, Exim will eventually
47380 notice.
47381 </para>
47382 <para>
47383 If <option>delay_after_cutoff</option> is set false, Exim behaves differently. If all IP
47384 addresses are past their final cutoff time, Exim tries to deliver to those IP
47385 addresses that have not been tried since the message arrived. If there are
47386 no suitable IP addresses, or if they all fail, the address is bounced. In other
47387 words, it does not delay when a new message arrives, but tries the expired
47388 addresses immediately, unless they have been tried since the message arrived.
47389 If there is a continuous stream of messages for the failing domains, setting
47390 <option>delay_after_cutoff</option> false means that there will be many more attempts to
47391 deliver to permanently failing IP addresses than when <option>delay_after_cutoff</option> is
47392 true.
47393 </para>
47394 </section>
47395 <section id="SECID167">
47396 <title>Deliveries that work intermittently</title>
47397 <para>
47398 <indexterm role="concept">
47399 <primary>retry</primary>
47400 <secondary>intermittently working deliveries</secondary>
47401 </indexterm>
47402 Some additional logic is needed to cope with cases where a host is
47403 intermittently available, or when a message has some attribute that prevents
47404 its delivery when others to the same address get through. In this situation,
47405 because some messages are successfully delivered, the <quote>retry clock</quote> for the
47406 host or address keeps getting reset by the successful deliveries, and so
47407 failing messages remain on the queue for ever because the cutoff time is never
47408 reached.
47409 </para>
47410 <para>
47411 Two exceptional actions are applied to prevent this happening. The first
47412 applies to errors that are related to a message rather than a remote host.
47413 Section <xref linkend="SECToutSMTPerr"/> has a discussion of the different kinds of error;
47414 examples of message-related errors are 4<emphasis>xx</emphasis> responses to MAIL or DATA
47415 commands, and quota failures. For this type of error, if a message&#x2019;s arrival
47416 time is earlier than the <quote>first failed</quote> time for the error, the earlier time
47417 is used when scanning the retry rules to decide when to try next and when to
47418 time out the address.
47419 </para>
47420 <para>
47421 The exceptional second action applies in all cases. If a message has been on
47422 the queue for longer than the cutoff time of any applicable retry rule for a
47423 given address, a delivery is attempted for that address, even if it is not yet
47424 time, and if this delivery fails, the address is timed out. A new retry time is
47425 not computed in this case, so that other messages for the same address are
47426 considered immediately.
47427 <indexterm role="concept" startref="IIDretconf1" class="endofrange"/>
47428 <indexterm role="concept" startref="IIDregconf2" class="endofrange"/>
47429 </para>
47430 </section>
47431 </chapter>
47432
47433 <chapter id="CHAPSMTPAUTH">
47434 <title>SMTP authentication</title>
47435 <para>
47436 <indexterm role="concept" id="IIDauthconf1" class="startofrange">
47437 <primary>SMTP</primary>
47438 <secondary>authentication configuration</secondary>
47439 </indexterm>
47440 <indexterm role="concept" id="IIDauthconf2" class="startofrange">
47441 <primary>authentication</primary>
47442 </indexterm>
47443 The <quote>authenticators</quote> section of Exim&#x2019;s run time configuration is concerned
47444 with SMTP authentication. This facility is an extension to the SMTP protocol,
47445 described in RFC 2554, which allows a client SMTP host to authenticate itself
47446 to a server. This is a common way for a server to recognize clients that are
47447 permitted to use it as a relay. SMTP authentication is not of relevance to the
47448 transfer of mail between servers that have no managerial connection with each
47449 other.
47450 </para>
47451 <para>
47452 <indexterm role="concept">
47453 <primary>AUTH</primary>
47454 <secondary>description of</secondary>
47455 </indexterm>
47456 Very briefly, the way SMTP authentication works is as follows:
47457 </para>
47458 <itemizedlist>
47459 <listitem>
47460 <para>
47461 The server advertises a number of authentication <emphasis>mechanisms</emphasis> in response to
47462 the client&#x2019;s EHLO command.
47463 </para>
47464 </listitem>
47465 <listitem>
47466 <para>
47467 The client issues an AUTH command, naming a specific mechanism. The command
47468 may, optionally, contain some authentication data.
47469 </para>
47470 </listitem>
47471 <listitem>
47472 <para>
47473 The server may issue one or more <emphasis>challenges</emphasis>, to which the client must send
47474 appropriate responses. In simple authentication mechanisms, the challenges are
47475 just prompts for user names and passwords. The server does not have to issue
47476 any challenges &ndash; in some mechanisms the relevant data may all be transmitted
47477 with the AUTH command.
47478 </para>
47479 </listitem>
47480 <listitem>
47481 <para>
47482 The server either accepts or denies authentication.
47483 </para>
47484 </listitem>
47485 <listitem>
47486 <para>
47487 If authentication succeeds, the client may optionally make use of the AUTH
47488 option on the MAIL command to pass an authenticated sender in subsequent
47489 mail transactions. Authentication lasts for the remainder of the SMTP
47490 connection.
47491 </para>
47492 </listitem>
47493 <listitem>
47494 <para>
47495 If authentication fails, the client may give up, or it may try a different
47496 authentication mechanism, or it may try transferring mail over the
47497 unauthenticated connection.
47498 </para>
47499 </listitem>
47500 </itemizedlist>
47501 <para>
47502 If you are setting up a client, and want to know which authentication
47503 mechanisms the server supports, you can use Telnet to connect to port 25 (the
47504 SMTP port) on the server, and issue an EHLO command. The response to this
47505 includes the list of supported mechanisms. For example:
47506 </para>
47507 <literallayout>
47508 <literal>$ </literal><emphasis role="bold"><literal>telnet server.example 25</literal></emphasis>
47509 <literal>Trying 192.168.34.25...</literal>
47510 <literal>Connected to server.example.</literal>
47511 <literal>Escape character is &#x0027;^]&#x0027;.</literal>
47512 <literal>220 server.example ESMTP Exim 4.20 ...</literal>
47513 <emphasis role="bold"><literal>ehlo client.example</literal></emphasis>
47514 <literal>250-server.example Hello client.example [10.8.4.5]</literal>
47515 <literal>250-SIZE 52428800</literal>
47516 <literal>250-PIPELINING</literal>
47517 <literal>250-AUTH PLAIN</literal>
47518 <literal>250 HELP</literal>
47519 </literallayout>
47520 <para>
47521 The second-last line of this example output shows that the server supports
47522 authentication using the PLAIN mechanism. In Exim, the different authentication
47523 mechanisms are configured by specifying <emphasis>authenticator</emphasis> drivers. Like the
47524 routers and transports, which authenticators are included in the binary is
47525 controlled by build-time definitions. The following are currently available,
47526 included by setting
47527 </para>
47528 <literallayout class="monospaced">
47529 AUTH_CRAM_MD5=yes
47530 AUTH_CYRUS_SASL=yes
47531 AUTH_DOVECOT=yes
47532 AUTH_GSASL=yes
47533 AUTH_HEIMDAL_GSSAPI=yes
47534 AUTH_PLAINTEXT=yes
47535 AUTH_SPA=yes
47536 </literallayout>
47537 <para>
47538 in <filename>Local/Makefile</filename>, respectively. The first of these supports the CRAM-MD5
47539 authentication mechanism (RFC 2195), and the second provides an interface to
47540 the Cyrus SASL authentication library.
47541 The third is an interface to Dovecot&#x2019;s authentication system, delegating the
47542 work via a socket interface.
47543 The fourth provides an interface to the GNU SASL authentication library, which
47544 provides mechanisms but typically not data sources.
47545 The fifth provides direct access to Heimdal GSSAPI, geared for Kerberos, but
47546 supporting setting a server keytab.
47547 The sixth can be configured to support
47548 the PLAIN authentication mechanism (RFC 2595) or the LOGIN mechanism, which is
47549 not formally documented, but used by several MUAs. The seventh authenticator
47550 supports Microsoft&#x2019;s <emphasis>Secure Password Authentication</emphasis> mechanism.
47551 </para>
47552 <para>
47553 The authenticators are configured using the same syntax as other drivers (see
47554 section <xref linkend="SECTfordricon"/>). If no authenticators are required, no
47555 authentication section need be present in the configuration file. Each
47556 authenticator can in principle have both server and client functions. When Exim
47557 is receiving SMTP mail, it is acting as a server; when it is sending out
47558 messages over SMTP, it is acting as a client. Authenticator configuration
47559 options are provided for use in both these circumstances.
47560 </para>
47561 <para>
47562 To make it clear which options apply to which situation, the prefixes
47563 <option>server_</option> and <option>client_</option> are used on option names that are specific to
47564 either the server or the client function, respectively. Server and client
47565 functions are disabled if none of their options are set. If an authenticator is
47566 to be used for both server and client functions, a single definition, using
47567 both sets of options, is required. For example:
47568 </para>
47569 <literallayout class="monospaced">
47570 cram:
47571   driver = cram_md5
47572   public_name = CRAM-MD5
47573   server_secret = ${if eq{$auth1}{ph10}{secret1}fail}
47574   client_name = ph10
47575   client_secret = secret2
47576 </literallayout>
47577 <para>
47578 The <option>server_</option> option is used when Exim is acting as a server, and the
47579 <option>client_</option> options when it is acting as a client.
47580 </para>
47581 <para>
47582 Descriptions of the individual authenticators are given in subsequent chapters.
47583 The remainder of this chapter covers the generic options for the
47584 authenticators, followed by general discussion of the way authentication works
47585 in Exim.
47586 </para>
47587 <para>
47588 <emphasis role="bold">Beware:</emphasis> the meaning of <varname>$auth1</varname>, <varname>$auth2</varname>, ... varies on a per-driver and
47589 per-mechanism basis.  Please read carefully to determine which variables hold
47590 account labels such as usercodes and which hold passwords or other
47591 authenticating data.
47592 </para>
47593 <para>
47594 Note that some mechanisms support two different identifiers for accounts: the
47595 <emphasis>authentication id</emphasis> and the <emphasis>authorization id</emphasis>.  The contractions <emphasis>authn</emphasis>
47596 and <emphasis>authz</emphasis> are commonly encountered.  The American spelling is standard here.
47597 Conceptually, authentication data such as passwords are tied to the identifier
47598 used to authenticate; servers may have rules to permit one user to act as a
47599 second user, so that after login the session is treated as though that second
47600 user had logged in.  That second user is the <emphasis>authorization id</emphasis>.  A robust
47601 configuration might confirm that the <emphasis>authz</emphasis> field is empty or matches the
47602 <emphasis>authn</emphasis> field.  Often this is just ignored.  The <emphasis>authn</emphasis> can be considered
47603 as verified data, the <emphasis>authz</emphasis> as an unverified request which the server might
47604 choose to honour.
47605 </para>
47606 <para>
47607 A <emphasis>realm</emphasis> is a text string, typically a domain name, presented by a server
47608 to a client to help it select an account and credentials to use.  In some
47609 mechanisms, the client and server provably agree on the realm, but clients
47610 typically can not treat the realm as secure data to be blindly trusted.
47611 </para>
47612 <section id="SECID168">
47613 <title>Generic options for authenticators</title>
47614 <para>
47615 <indexterm role="concept">
47616 <primary>authentication</primary>
47617 <secondary>generic options</secondary>
47618 </indexterm>
47619 <indexterm role="concept">
47620 <primary>options</primary>
47621 <secondary>generic; for authenticators</secondary>
47622 </indexterm>
47623 </para>
47624 <para>
47625 <indexterm role="option">
47626 <primary><option>client_condition</option></primary>
47627 </indexterm>
47628 </para>
47629 <informaltable frame="all">
47630 <tgroup cols="4" colsep="0" rowsep="0">
47631 <colspec colwidth="8*" align="left"/>
47632 <colspec colwidth="6*" align="center"/>
47633 <colspec colwidth="6*" align="center"/>
47634 <colspec colwidth="6*" align="right"/>
47635 <tbody>
47636 <row>
47637 <entry><option>client_condition</option></entry>
47638 <entry>Use: <emphasis>authenticators</emphasis></entry>
47639 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
47640 <entry>Default: <emphasis>unset</emphasis></entry>
47641 </row>
47642 </tbody>
47643 </tgroup>
47644 </informaltable>
47645 <para>
47646 When Exim is authenticating as a client, it skips any authenticator whose
47647 <option>client_condition</option> expansion yields <quote>0</quote>, <quote>no</quote>, or <quote>false</quote>. This can be
47648 used, for example, to skip plain text authenticators when the connection is not
47649 encrypted by a setting such as:
47650 </para>
47651 <literallayout class="monospaced">
47652 client_condition = ${if !eq{$tls_out_cipher}{}}
47653 </literallayout>
47654 <para>
47655 <indexterm role="option">
47656 <primary><option>client_set_id</option></primary>
47657 </indexterm>
47658 </para>
47659 <informaltable frame="all">
47660 <tgroup cols="4" colsep="0" rowsep="0">
47661 <colspec colwidth="8*" align="left"/>
47662 <colspec colwidth="6*" align="center"/>
47663 <colspec colwidth="6*" align="center"/>
47664 <colspec colwidth="6*" align="right"/>
47665 <tbody>
47666 <row>
47667 <entry><option>client_set_id</option></entry>
47668 <entry>Use: <emphasis>authenticators</emphasis></entry>
47669 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
47670 <entry>Default: <emphasis>unset</emphasis></entry>
47671 </row>
47672 </tbody>
47673 </tgroup>
47674 </informaltable>
47675 <para>
47676 When client authentication succeeds, this condition is expanded; the
47677 result is used in the log lines for outbound messasges.
47678 Typically it will be the user name used for authentication.
47679 </para>
47680 <para>
47681 <indexterm role="option">
47682 <primary><option>driver</option></primary>
47683 </indexterm>
47684 </para>
47685 <informaltable frame="all">
47686 <tgroup cols="4" colsep="0" rowsep="0">
47687 <colspec colwidth="8*" align="left"/>
47688 <colspec colwidth="6*" align="center"/>
47689 <colspec colwidth="6*" align="center"/>
47690 <colspec colwidth="6*" align="right"/>
47691 <tbody>
47692 <row>
47693 <entry><option>driver</option></entry>
47694 <entry>Use: <emphasis>authenticators</emphasis></entry>
47695 <entry>Type: <emphasis>string</emphasis></entry>
47696 <entry>Default: <emphasis>unset</emphasis></entry>
47697 </row>
47698 </tbody>
47699 </tgroup>
47700 </informaltable>
47701 <para>
47702 This option must always be set. It specifies which of the available
47703 authenticators is to be used.
47704 </para>
47705 <para>
47706 <indexterm role="option">
47707 <primary><option>public_name</option></primary>
47708 </indexterm>
47709 </para>
47710 <informaltable frame="all">
47711 <tgroup cols="4" colsep="0" rowsep="0">
47712 <colspec colwidth="8*" align="left"/>
47713 <colspec colwidth="6*" align="center"/>
47714 <colspec colwidth="6*" align="center"/>
47715 <colspec colwidth="6*" align="right"/>
47716 <tbody>
47717 <row>
47718 <entry><option>public_name</option></entry>
47719 <entry>Use: <emphasis>authenticators</emphasis></entry>
47720 <entry>Type: <emphasis>string</emphasis></entry>
47721 <entry>Default: <emphasis>unset</emphasis></entry>
47722 </row>
47723 </tbody>
47724 </tgroup>
47725 </informaltable>
47726 <para>
47727 This option specifies the name of the authentication mechanism that the driver
47728 implements, and by which it is known to the outside world. These names should
47729 contain only upper case letters, digits, underscores, and hyphens (RFC 2222),
47730 but Exim in fact matches them caselessly. If <option>public_name</option> is not set, it
47731 defaults to the driver&#x2019;s instance name.
47732 </para>
47733 <para>
47734 <indexterm role="option">
47735 <primary><option>server_advertise_condition</option></primary>
47736 </indexterm>
47737 </para>
47738 <informaltable frame="all">
47739 <tgroup cols="4" colsep="0" rowsep="0">
47740 <colspec colwidth="8*" align="left"/>
47741 <colspec colwidth="6*" align="center"/>
47742 <colspec colwidth="6*" align="center"/>
47743 <colspec colwidth="6*" align="right"/>
47744 <tbody>
47745 <row>
47746 <entry><option>server_advertise_condition</option></entry>
47747 <entry>Use: <emphasis>authenticators</emphasis></entry>
47748 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
47749 <entry>Default: <emphasis>unset</emphasis></entry>
47750 </row>
47751 </tbody>
47752 </tgroup>
47753 </informaltable>
47754 <para>
47755 When a server is about to advertise an authentication mechanism, the condition
47756 is expanded. If it yields the empty string, <quote>0</quote>, <quote>no</quote>, or <quote>false</quote>, the
47757 mechanism is not advertised.
47758 If the expansion fails, the mechanism is not advertised. If the failure was not
47759 forced, and was not caused by a lookup defer, the incident is logged.
47760 See section <xref linkend="SECTauthexiser"/> below for further discussion.
47761 </para>
47762 <para>
47763 <indexterm role="option">
47764 <primary><option>server_condition</option></primary>
47765 </indexterm>
47766 </para>
47767 <informaltable frame="all">
47768 <tgroup cols="4" colsep="0" rowsep="0">
47769 <colspec colwidth="8*" align="left"/>
47770 <colspec colwidth="6*" align="center"/>
47771 <colspec colwidth="6*" align="center"/>
47772 <colspec colwidth="6*" align="right"/>
47773 <tbody>
47774 <row>
47775 <entry><option>server_condition</option></entry>
47776 <entry>Use: <emphasis>authenticators</emphasis></entry>
47777 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
47778 <entry>Default: <emphasis>unset</emphasis></entry>
47779 </row>
47780 </tbody>
47781 </tgroup>
47782 </informaltable>
47783 <para>
47784 This option must be set for a <option>plaintext</option> server authenticator, where it
47785 is used directly to control authentication. See section <xref linkend="SECTplainserver"/>
47786 for details.
47787 </para>
47788 <para>
47789 For the <command>gsasl</command> authenticator, this option is required for various
47790 mechanisms; see chapter <xref linkend="CHAPgsasl"/> for details.
47791 </para>
47792 <para>
47793 For the other authenticators, <option>server_condition</option> can be used as an additional
47794 authentication or authorization mechanism that is applied after the other
47795 authenticator conditions succeed. If it is set, it is expanded when the
47796 authenticator would otherwise return a success code. If the expansion is forced
47797 to fail, authentication fails. Any other expansion failure causes a temporary
47798 error code to be returned. If the result of a successful expansion is an empty
47799 string, <quote>0</quote>, <quote>no</quote>, or <quote>false</quote>, authentication fails. If the result of the
47800 expansion is <quote>1</quote>, <quote>yes</quote>, or <quote>true</quote>, authentication succeeds. For any
47801 other result, a temporary error code is returned, with the expanded string as
47802 the error text.
47803 </para>
47804 <para>
47805 <indexterm role="option">
47806 <primary><option>server_debug_print</option></primary>
47807 </indexterm>
47808 </para>
47809 <informaltable frame="all">
47810 <tgroup cols="4" colsep="0" rowsep="0">
47811 <colspec colwidth="8*" align="left"/>
47812 <colspec colwidth="6*" align="center"/>
47813 <colspec colwidth="6*" align="center"/>
47814 <colspec colwidth="6*" align="right"/>
47815 <tbody>
47816 <row>
47817 <entry><option>server_debug_print</option></entry>
47818 <entry>Use: <emphasis>authenticators</emphasis></entry>
47819 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
47820 <entry>Default: <emphasis>unset</emphasis></entry>
47821 </row>
47822 </tbody>
47823 </tgroup>
47824 </informaltable>
47825 <para>
47826 If this option is set and authentication debugging is enabled (see the <option>-d</option>
47827 command line option), the string is expanded and included in the debugging
47828 output when the authenticator is run as a server. This can help with checking
47829 out the values of variables.
47830 If expansion of the string fails, the error message is written to the debugging
47831 output, and Exim carries on processing.
47832 </para>
47833 <para>
47834 <indexterm role="option">
47835 <primary><option>server_set_id</option></primary>
47836 </indexterm>
47837 </para>
47838 <informaltable frame="all">
47839 <tgroup cols="4" colsep="0" rowsep="0">
47840 <colspec colwidth="8*" align="left"/>
47841 <colspec colwidth="6*" align="center"/>
47842 <colspec colwidth="6*" align="center"/>
47843 <colspec colwidth="6*" align="right"/>
47844 <tbody>
47845 <row>
47846 <entry><option>server_set_id</option></entry>
47847 <entry>Use: <emphasis>authenticators</emphasis></entry>
47848 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
47849 <entry>Default: <emphasis>unset</emphasis></entry>
47850 </row>
47851 </tbody>
47852 </tgroup>
47853 </informaltable>
47854 <para>
47855 <indexterm role="variable">
47856 <primary><varname>$authenticated_id</varname></primary>
47857 </indexterm>
47858 When an Exim server successfully authenticates a client, this string is
47859 expanded using data from the authentication, and preserved for any incoming
47860 messages in the variable <varname>$authenticated_id</varname>. It is also included in the log
47861 lines for incoming messages. For example, a user/password authenticator
47862 configuration might preserve the user name that was used to authenticate, and
47863 refer to it subsequently during delivery of the message.
47864 If expansion fails, the option is ignored.
47865 </para>
47866 <para>
47867 <indexterm role="option">
47868 <primary><option>server_mail_auth_condition</option></primary>
47869 </indexterm>
47870 </para>
47871 <informaltable frame="all">
47872 <tgroup cols="4" colsep="0" rowsep="0">
47873 <colspec colwidth="8*" align="left"/>
47874 <colspec colwidth="6*" align="center"/>
47875 <colspec colwidth="6*" align="center"/>
47876 <colspec colwidth="6*" align="right"/>
47877 <tbody>
47878 <row>
47879 <entry><option>server_mail_auth_condition</option></entry>
47880 <entry>Use: <emphasis>authenticators</emphasis></entry>
47881 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
47882 <entry>Default: <emphasis>unset</emphasis></entry>
47883 </row>
47884 </tbody>
47885 </tgroup>
47886 </informaltable>
47887 <para>
47888 This option allows a server to discard authenticated sender addresses supplied
47889 as part of MAIL commands in SMTP connections that are authenticated by the
47890 driver on which <option>server_mail_auth_condition</option> is set. The option is not used
47891 as part of the authentication process; instead its (unexpanded) value is
47892 remembered for later use.
47893 How it is used is described in the following section.
47894 </para>
47895 </section>
47896 <section id="SECTauthparamail">
47897 <title>The AUTH parameter on MAIL commands</title>
47898 <para>
47899 <indexterm role="concept">
47900 <primary>authentication</primary>
47901 <secondary>sender; authenticated</secondary>
47902 </indexterm>
47903 <indexterm role="concept">
47904 <primary>AUTH</primary>
47905 <secondary>on MAIL command</secondary>
47906 </indexterm>
47907 When a client supplied an AUTH= item on a MAIL command, Exim applies
47908 the following checks before accepting it as the authenticated sender of the
47909 message:
47910 </para>
47911 <itemizedlist>
47912 <listitem>
47913 <para>
47914 If the connection is not using extended SMTP (that is, HELO was used rather
47915 than EHLO), the use of AUTH= is a syntax error.
47916 </para>
47917 </listitem>
47918 <listitem>
47919 <para>
47920 If the value of the AUTH= parameter is <quote>&lt;&gt;</quote>, it is ignored.
47921 </para>
47922 </listitem>
47923 <listitem>
47924 <para>
47925 <indexterm role="variable">
47926 <primary><varname>$authenticated_sender</varname></primary>
47927 </indexterm>
47928 If <option>acl_smtp_mailauth</option> is defined, the ACL it specifies is run. While it is
47929 running, the value of <varname>$authenticated_sender</varname> is set to the value obtained
47930 from the AUTH= parameter. If the ACL does not yield <quote>accept</quote>, the value of
47931 <varname>$authenticated_sender</varname> is deleted. The <option>acl_smtp_mailauth</option> ACL may not
47932 return <quote>drop</quote> or <quote>discard</quote>. If it defers, a temporary error code (451) is
47933 given for the MAIL command.
47934 </para>
47935 </listitem>
47936 <listitem>
47937 <para>
47938 If <option>acl_smtp_mailauth</option> is not defined, the value of the AUTH= parameter
47939 is accepted and placed in <varname>$authenticated_sender</varname> only if the client has
47940 authenticated.
47941 </para>
47942 </listitem>
47943 <listitem>
47944 <para>
47945 If the AUTH= value was accepted by either of the two previous rules, and
47946 the client has authenticated, and the authenticator has a setting for the
47947 <option>server_mail_auth_condition</option>, the condition is checked at this point. The
47948 valued that was saved from the authenticator is expanded. If the expansion
47949 fails, or yields an empty string, <quote>0</quote>, <quote>no</quote>, or <quote>false</quote>, the value of
47950 <varname>$authenticated_sender</varname> is deleted. If the expansion yields any other value,
47951 the value of <varname>$authenticated_sender</varname> is retained and passed on with the
47952 message.
47953 </para>
47954 </listitem>
47955 </itemizedlist>
47956 <para>
47957 When <varname>$authenticated_sender</varname> is set for a message, it is passed on to other
47958 hosts to which Exim authenticates as a client. Do not confuse this value with
47959 <varname>$authenticated_id</varname>, which is a string obtained from the authentication
47960 process, and which is not usually a complete email address.
47961 </para>
47962 <para>
47963 <indexterm role="variable">
47964 <primary><varname>$sender_address</varname></primary>
47965 </indexterm>
47966 Whenever an AUTH= value is ignored, the incident is logged. The ACL for
47967 MAIL, if defined, is run after AUTH= is accepted or ignored. It can
47968 therefore make use of <varname>$authenticated_sender</varname>. The converse is not true: the
47969 value of <varname>$sender_address</varname> is not yet set up when the <option>acl_smtp_mailauth</option>
47970 ACL is run.
47971 </para>
47972 </section>
47973 <section id="SECTauthexiser">
47974 <title>Authentication on an Exim server</title>
47975 <para>
47976 <indexterm role="concept">
47977 <primary>authentication</primary>
47978 <secondary>on an Exim server</secondary>
47979 </indexterm>
47980 When Exim receives an EHLO command, it advertises the public names of those
47981 authenticators that are configured as servers, subject to the following
47982 conditions:
47983 </para>
47984 <itemizedlist>
47985 <listitem>
47986 <para>
47987 The client host must match <option>auth_advertise_hosts</option> (default *).
47988 </para>
47989 </listitem>
47990 <listitem>
47991 <para>
47992 It the <option>server_advertise_condition</option> option is set, its expansion must not
47993 yield the empty string, <quote>0</quote>, <quote>no</quote>, or <quote>false</quote>.
47994 </para>
47995 </listitem>
47996 </itemizedlist>
47997 <para>
47998 The order in which the authenticators are defined controls the order in which
47999 the mechanisms are advertised.
48000 </para>
48001 <para>
48002 Some mail clients (for example, some versions of Netscape) require the user to
48003 provide a name and password for authentication whenever AUTH is advertised,
48004 even though authentication may not in fact be needed (for example, Exim may be
48005 set up to allow unconditional relaying from the client by an IP address check).
48006 You can make such clients more friendly by not advertising AUTH to them.
48007 For example, if clients on the 10.9.8.0/24 network are permitted (by the ACL
48008 that runs for RCPT) to relay without authentication, you should set
48009 </para>
48010 <literallayout class="monospaced">
48011 auth_advertise_hosts = ! 10.9.8.0/24
48012 </literallayout>
48013 <para>
48014 so that no authentication mechanisms are advertised to them.
48015 </para>
48016 <para>
48017 The <option>server_advertise_condition</option> controls the advertisement of individual
48018 authentication mechanisms. For example, it can be used to restrict the
48019 advertisement of a particular mechanism to encrypted connections, by a setting
48020 such as:
48021 </para>
48022 <literallayout class="monospaced">
48023 server_advertise_condition = ${if eq{$tls_in_cipher}{}{no}{yes}}
48024 </literallayout>
48025 <para>
48026 <indexterm role="variable">
48027 <primary><varname>$tls_in_cipher</varname></primary>
48028 </indexterm>
48029 If the session is encrypted, <varname>$tls_in_cipher</varname> is not empty, and so the expansion
48030 yields <quote>yes</quote>, which allows the advertisement to happen.
48031 </para>
48032 <para>
48033 When an Exim server receives an AUTH command from a client, it rejects it
48034 immediately if AUTH was not advertised in response to an earlier EHLO
48035 command. This is the case if
48036 </para>
48037 <itemizedlist>
48038 <listitem>
48039 <para>
48040 The client host does not match <option>auth_advertise_hosts</option>; or
48041 </para>
48042 </listitem>
48043 <listitem>
48044 <para>
48045 No authenticators are configured with server options; or
48046 </para>
48047 </listitem>
48048 <listitem>
48049 <para>
48050 Expansion of <option>server_advertise_condition</option> blocked the advertising of all the
48051 server authenticators.
48052 </para>
48053 </listitem>
48054 </itemizedlist>
48055 <para>
48056 Otherwise, Exim runs the ACL specified by <option>acl_smtp_auth</option> in order
48057 to decide whether to accept the command. If <option>acl_smtp_auth</option> is not set,
48058 AUTH is accepted from any client host.
48059 </para>
48060 <para>
48061 If AUTH is not rejected by the ACL, Exim searches its configuration for a
48062 server authentication mechanism that was advertised in response to EHLO and
48063 that matches the one named in the AUTH command. If it finds one, it runs
48064 the appropriate authentication protocol, and authentication either succeeds or
48065 fails. If there is no matching advertised mechanism, the AUTH command is
48066 rejected with a 504 error.
48067 </para>
48068 <para>
48069 <indexterm role="variable">
48070 <primary><varname>$received_protocol</varname></primary>
48071 </indexterm>
48072 <indexterm role="variable">
48073 <primary><varname>$sender_host_authenticated</varname></primary>
48074 </indexterm>
48075 When a message is received from an authenticated host, the value of
48076 <varname>$received_protocol</varname> is set to <quote>esmtpa</quote> or <quote>esmtpsa</quote> instead of <quote>esmtp</quote>
48077 or <quote>esmtps</quote>, and <varname>$sender_host_authenticated</varname> contains the name (not the
48078 public name) of the authenticator driver that successfully authenticated the
48079 client from which the message was received. This variable is empty if there was
48080 no successful authentication.
48081 </para>
48082 </section>
48083 <section id="SECID169">
48084 <title>Testing server authentication</title>
48085 <para>
48086 <indexterm role="concept">
48087 <primary>authentication</primary>
48088 <secondary>testing a server</secondary>
48089 </indexterm>
48090 <indexterm role="concept">
48091 <primary>AUTH</primary>
48092 <secondary>testing a server</secondary>
48093 </indexterm>
48094 <indexterm role="concept">
48095 <primary>base64 encoding</primary>
48096 <secondary>creating authentication test data</secondary>
48097 </indexterm>
48098 Exim&#x2019;s <option>-bh</option> option can be useful for testing server authentication
48099 configurations. The data for the AUTH command has to be sent using base64
48100 encoding. A quick way to produce such data for testing is the following Perl
48101 script:
48102 </para>
48103 <literallayout class="monospaced">
48104 use MIME::Base64;
48105 printf ("%s", encode_base64(eval "\"$ARGV[0]\""));
48106 </literallayout>
48107 <para>
48108 <indexterm role="concept">
48109 <primary>binary zero</primary>
48110 <secondary>in authentication data</secondary>
48111 </indexterm>
48112 This interprets its argument as a Perl string, and then encodes it. The
48113 interpretation as a Perl string allows binary zeros, which are required for
48114 some kinds of authentication, to be included in the data. For example, a
48115 command line to run this script on such data might be
48116 </para>
48117 <literallayout class="monospaced">
48118 encode '\0user\0password'
48119 </literallayout>
48120 <para>
48121 Note the use of single quotes to prevent the shell interpreting the
48122 backslashes, so that they can be interpreted by Perl to specify characters
48123 whose code value is zero.
48124 </para>
48125 <para>
48126 <emphasis role="bold">Warning 1</emphasis>: If either of the user or password strings starts with an octal
48127 digit, you must use three zeros instead of one after the leading backslash. If
48128 you do not, the octal digit that starts your string will be incorrectly
48129 interpreted as part of the code for the first character.
48130 </para>
48131 <para>
48132 <emphasis role="bold">Warning 2</emphasis>: If there are characters in the strings that Perl interprets
48133 specially, you must use a Perl escape to prevent them being misinterpreted. For
48134 example, a command such as
48135 </para>
48136 <literallayout class="monospaced">
48137 encode '\0user@domain.com\0pas$$word'
48138 </literallayout>
48139 <para>
48140 gives an incorrect answer because of the unescaped <quote>@</quote> and <quote>$</quote> characters.
48141 </para>
48142 <para>
48143 If you have the <option>mimencode</option> command installed, another way to do produce
48144 base64-encoded strings is to run the command
48145 </para>
48146 <literallayout class="monospaced">
48147 echo -e -n `\0user\0password' | mimencode
48148 </literallayout>
48149 <para>
48150 The <option>-e</option> option of <option>echo</option> enables the interpretation of backslash escapes
48151 in the argument, and the <option>-n</option> option specifies no newline at the end of its
48152 output. However, not all versions of <option>echo</option> recognize these options, so you
48153 should check your version before relying on this suggestion.
48154 </para>
48155 </section>
48156 <section id="SECID170">
48157 <title>Authentication by an Exim client</title>
48158 <para>
48159 <indexterm role="concept">
48160 <primary>authentication</primary>
48161 <secondary>on an Exim client</secondary>
48162 </indexterm>
48163 The <command>smtp</command> transport has two options called <option>hosts_require_auth</option> and
48164 <option>hosts_try_auth</option>. When the <command>smtp</command> transport connects to a server that
48165 announces support for authentication, and the host matches an entry in either
48166 of these options, Exim (as a client) tries to authenticate as follows:
48167 </para>
48168 <itemizedlist>
48169 <listitem>
48170 <para>
48171 For each authenticator that is configured as a client, in the order in which
48172 they are defined in the configuration, it searches the authentication
48173 mechanisms announced by the server for one whose name matches the public name
48174 of the authenticator.
48175 </para>
48176 </listitem>
48177 <listitem>
48178 <para>
48179 <indexterm role="variable">
48180 <primary><varname>$host</varname></primary>
48181 </indexterm>
48182 <indexterm role="variable">
48183 <primary><varname>$host_address</varname></primary>
48184 </indexterm>
48185 When it finds one that matches, it runs the authenticator&#x2019;s client code. The
48186 variables <varname>$host</varname> and <varname>$host_address</varname> are available for any string expansions
48187 that the client might do. They are set to the server&#x2019;s name and IP address. If
48188 any expansion is forced to fail, the authentication attempt is abandoned, and
48189 Exim moves on to the next authenticator. Otherwise an expansion failure causes
48190 delivery to be deferred.
48191 </para>
48192 </listitem>
48193 <listitem>
48194 <para>
48195 If the result of the authentication attempt is a temporary error or a timeout,
48196 Exim abandons trying to send the message to the host for the moment. It will
48197 try again later. If there are any backup hosts available, they are tried in the
48198 usual way.
48199 </para>
48200 </listitem>
48201 <listitem>
48202 <para>
48203 If the response to authentication is a permanent error (5<emphasis>xx</emphasis> code), Exim
48204 carries on searching the list of authenticators and tries another one if
48205 possible. If all authentication attempts give permanent errors, or if there are
48206 no attempts because no mechanisms match (or option expansions force failure),
48207 what happens depends on whether the host matches <option>hosts_require_auth</option> or
48208 <option>hosts_try_auth</option>. In the first case, a temporary error is generated, and
48209 delivery is deferred. The error can be detected in the retry rules, and thereby
48210 turned into a permanent error if you wish. In the second case, Exim tries to
48211 deliver the message unauthenticated.
48212 </para>
48213 </listitem>
48214 </itemizedlist>
48215 <para>
48216 <indexterm role="concept">
48217 <primary>AUTH</primary>
48218 <secondary>on MAIL command</secondary>
48219 </indexterm>
48220 When Exim has authenticated itself to a remote server, it adds the AUTH
48221 parameter to the MAIL commands it sends, if it has an authenticated sender for
48222 the message. If the message came from a remote host, the authenticated sender
48223 is the one that was receiving on an incoming MAIL command, provided that the
48224 incoming connection was authenticated and the <option>server_mail_auth</option> condition
48225 allowed the authenticated sender to be retained. If a local process calls Exim
48226 to send a message, the sender address that is built from the login name and
48227 <option>qualify_domain</option> is treated as authenticated. However, if the
48228 <option>authenticated_sender</option> option is set on the <command>smtp</command> transport, it overrides
48229 the authenticated sender that was received with the message.
48230 <indexterm role="concept" startref="IIDauthconf1" class="endofrange"/>
48231 <indexterm role="concept" startref="IIDauthconf2" class="endofrange"/>
48232 </para>
48233 </section>
48234 </chapter>
48235
48236 <chapter id="CHAPplaintext">
48237 <title>The plaintext authenticator</title>
48238 <para>
48239 <indexterm role="concept" id="IIDplaiauth1" class="startofrange">
48240 <primary><command>plaintext</command> authenticator</primary>
48241 </indexterm>
48242 <indexterm role="concept" id="IIDplaiauth2" class="startofrange">
48243 <primary>authenticators</primary>
48244 <secondary><command>plaintext</command></secondary>
48245 </indexterm>
48246 The <command>plaintext</command> authenticator can be configured to support the PLAIN and
48247 LOGIN authentication mechanisms, both of which transfer authentication data as
48248 plain (unencrypted) text (though base64 encoded). The use of plain text is a
48249 security risk; you are strongly advised to insist on the use of SMTP encryption
48250 (see chapter <xref linkend="CHAPTLS"/>) if you use the PLAIN or LOGIN mechanisms. If you do
48251 use unencrypted plain text, you should not use the same passwords for SMTP
48252 connections as you do for login accounts.
48253 </para>
48254 <section id="SECID171">
48255 <title>Plaintext options</title>
48256 <para>
48257 <indexterm role="concept">
48258 <primary>options</primary>
48259 <secondary><command>plaintext</command> authenticator (server)</secondary>
48260 </indexterm>
48261 When configured as a server, <command>plaintext</command> uses the following options:
48262 </para>
48263 <para>
48264 <indexterm role="option">
48265 <primary><option>server_condition</option></primary>
48266 </indexterm>
48267 </para>
48268 <informaltable frame="all">
48269 <tgroup cols="4" colsep="0" rowsep="0">
48270 <colspec colwidth="8*" align="left"/>
48271 <colspec colwidth="6*" align="center"/>
48272 <colspec colwidth="6*" align="center"/>
48273 <colspec colwidth="6*" align="right"/>
48274 <tbody>
48275 <row>
48276 <entry><option>server_condition</option></entry>
48277 <entry>Use: <emphasis>authenticators</emphasis></entry>
48278 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
48279 <entry>Default: <emphasis>unset</emphasis></entry>
48280 </row>
48281 </tbody>
48282 </tgroup>
48283 </informaltable>
48284 <para>
48285 This is actually a global authentication option, but it must be set in order to
48286 configure the <command>plaintext</command> driver as a server. Its use is described below.
48287 </para>
48288 <para>
48289 <indexterm role="option">
48290 <primary><option>server_prompts</option></primary>
48291 </indexterm>
48292 </para>
48293 <informaltable frame="all">
48294 <tgroup cols="4" colsep="0" rowsep="0">
48295 <colspec colwidth="8*" align="left"/>
48296 <colspec colwidth="6*" align="center"/>
48297 <colspec colwidth="6*" align="center"/>
48298 <colspec colwidth="6*" align="right"/>
48299 <tbody>
48300 <row>
48301 <entry><option>server_prompts</option></entry>
48302 <entry>Use: <emphasis>plaintext</emphasis></entry>
48303 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
48304 <entry>Default: <emphasis>unset</emphasis></entry>
48305 </row>
48306 </tbody>
48307 </tgroup>
48308 </informaltable>
48309 <para>
48310 The contents of this option, after expansion, must be a colon-separated list of
48311 prompt strings. If expansion fails, a temporary authentication rejection is
48312 given.
48313 </para>
48314 </section>
48315 <section id="SECTplainserver">
48316 <title>Using plaintext in a server</title>
48317 <para>
48318 <indexterm role="concept">
48319 <primary>AUTH</primary>
48320 <secondary>in <command>plaintext</command> authenticator</secondary>
48321 </indexterm>
48322 <indexterm role="concept">
48323 <primary>binary zero</primary>
48324 <secondary>in <command>plaintext</command> authenticator</secondary>
48325 </indexterm>
48326 <indexterm role="concept">
48327 <primary>numerical variables (<varname>$1</varname> <varname>$2</varname> etc)</primary>
48328 <secondary>in <command>plaintext</command> authenticator</secondary>
48329 </indexterm>
48330 <indexterm role="variable">
48331 <primary><varname>$auth1</varname>, <varname>$auth2</varname>, etc</primary>
48332 </indexterm>
48333 <indexterm role="concept">
48334 <primary>base64 encoding</primary>
48335 <secondary>in <command>plaintext</command> authenticator</secondary>
48336 </indexterm>
48337 </para>
48338 <para>
48339 When running as a server, <command>plaintext</command> performs the authentication test by
48340 expanding a string. The data sent by the client with the AUTH command, or in
48341 response to subsequent prompts, is base64 encoded, and so may contain any byte
48342 values when decoded. If any data is supplied with the command, it is treated as
48343 a list of strings, separated by NULs (binary zeros), the first three of which
48344 are placed in the expansion variables <varname>$auth1</varname>, <varname>$auth2</varname>, and <varname>$auth3</varname>
48345 (neither LOGIN nor PLAIN uses more than three strings).
48346 </para>
48347 <para>
48348 For compatibility with previous releases of Exim, the values are also placed in
48349 the expansion variables <varname>$1</varname>, <varname>$2</varname>, and <varname>$3</varname>. However, the use of these
48350 variables for this purpose is now deprecated, as it can lead to confusion in
48351 string expansions that also use them for other things.
48352 </para>
48353 <para>
48354 If there are more strings in <option>server_prompts</option> than the number of strings
48355 supplied with the AUTH command, the remaining prompts are used to obtain more
48356 data. Each response from the client may be a list of NUL-separated strings.
48357 </para>
48358 <para>
48359 <indexterm role="variable">
48360 <primary><varname>$authenticated_id</varname></primary>
48361 </indexterm>
48362 Once a sufficient number of data strings have been received,
48363 <option>server_condition</option> is expanded. If the expansion is forced to fail,
48364 authentication fails. Any other expansion failure causes a temporary error code
48365 to be returned. If the result of a successful expansion is an empty string,
48366 <quote>0</quote>, <quote>no</quote>, or <quote>false</quote>, authentication fails. If the result of the
48367 expansion is <quote>1</quote>, <quote>yes</quote>, or <quote>true</quote>, authentication succeeds and the
48368 generic <option>server_set_id</option> option is expanded and saved in <varname>$authenticated_id</varname>.
48369 For any other result, a temporary error code is returned, with the expanded
48370 string as the error text
48371 </para>
48372 <para>
48373 <emphasis role="bold">Warning</emphasis>: If you use a lookup in the expansion to find the user&#x2019;s
48374 password, be sure to make the authentication fail if the user is unknown.
48375 There are good and bad examples at the end of the next section.
48376 </para>
48377 </section>
48378 <section id="SECID172">
48379 <title>The PLAIN authentication mechanism</title>
48380 <para>
48381 <indexterm role="concept">
48382 <primary>PLAIN authentication mechanism</primary>
48383 </indexterm>
48384 <indexterm role="concept">
48385 <primary>authentication</primary>
48386 <secondary>PLAIN mechanism</secondary>
48387 </indexterm>
48388 <indexterm role="concept">
48389 <primary>binary zero</primary>
48390 <secondary>in <command>plaintext</command> authenticator</secondary>
48391 </indexterm>
48392 The PLAIN authentication mechanism (RFC 2595) specifies that three strings be
48393 sent as one item of data (that is, one combined string containing two NUL
48394 separators). The data is sent either as part of the AUTH command, or
48395 subsequently in response to an empty prompt from the server.
48396 </para>
48397 <para>
48398 The second and third strings are a user name and a corresponding password.
48399 Using a single fixed user name and password as an example, this could be
48400 configured as follows:
48401 </para>
48402 <literallayout class="monospaced">
48403 fixed_plain:
48404   driver = plaintext
48405   public_name = PLAIN
48406   server_prompts = :
48407   server_condition = \
48408     ${if and {{eq{$auth2}{username}}{eq{$auth3}{mysecret}}}}
48409   server_set_id = $auth2
48410 </literallayout>
48411 <para>
48412 Note that the default result strings from <option>if</option> (<quote>true</quote> or an empty string)
48413 are exactly what we want here, so they need not be specified. Obviously, if the
48414 password contains expansion-significant characters such as dollar, backslash,
48415 or closing brace, they have to be escaped.
48416 </para>
48417 <para>
48418 The <option>server_prompts</option> setting specifies a single, empty prompt (empty items at
48419 the end of a string list are ignored). If all the data comes as part of the
48420 AUTH command, as is commonly the case, the prompt is not used. This
48421 authenticator is advertised in the response to EHLO as
48422 </para>
48423 <literallayout class="monospaced">
48424 250-AUTH PLAIN
48425 </literallayout>
48426 <para>
48427 and a client host can authenticate itself by sending the command
48428 </para>
48429 <literallayout class="monospaced">
48430 AUTH PLAIN AHVzZXJuYW1lAG15c2VjcmV0
48431 </literallayout>
48432 <para>
48433 As this contains three strings (more than the number of prompts), no further
48434 data is required from the client. Alternatively, the client may just send
48435 </para>
48436 <literallayout class="monospaced">
48437 AUTH PLAIN
48438 </literallayout>
48439 <para>
48440 to initiate authentication, in which case the server replies with an empty
48441 prompt. The client must respond with the combined data string.
48442 </para>
48443 <para>
48444 The data string is base64 encoded, as required by the RFC. This example,
48445 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;
48446 represents a zero byte. This is split up into three strings, the first of which
48447 is empty. The <option>server_condition</option> option in the authenticator checks that the
48448 second two are <literal>username</literal> and <literal>mysecret</literal> respectively.
48449 </para>
48450 <para>
48451 Having just one fixed user name and password, as in this example, is not very
48452 realistic, though for a small organization with only a handful of
48453 authenticating clients it could make sense.
48454 </para>
48455 <para>
48456 A more sophisticated instance of this authenticator could use the user name in
48457 <varname>$auth2</varname> to look up a password in a file or database, and maybe do an encrypted
48458 comparison (see <option>crypteq</option> in chapter <xref linkend="CHAPexpand"/>). Here is a example of
48459 this approach, where the passwords are looked up in a DBM file. <emphasis role="bold">Warning</emphasis>:
48460 This is an incorrect example:
48461 </para>
48462 <literallayout class="monospaced">
48463 server_condition = \
48464   ${if eq{$auth3}{${lookup{$auth2}dbm{/etc/authpwd}}}}
48465 </literallayout>
48466 <para>
48467 The expansion uses the user name (<varname>$auth2</varname>) as the key to look up a password,
48468 which it then compares to the supplied password (<varname>$auth3</varname>). Why is this example
48469 incorrect? It works fine for existing users, but consider what happens if a
48470 non-existent user name is given. The lookup fails, but as no success/failure
48471 strings are given for the lookup, it yields an empty string. Thus, to defeat
48472 the authentication, all a client has to do is to supply a non-existent user
48473 name and an empty password. The correct way of writing this test is:
48474 </para>
48475 <literallayout class="monospaced">
48476 server_condition = ${lookup{$auth2}dbm{/etc/authpwd}\
48477   {${if eq{$value}{$auth3}}} {false}}
48478 </literallayout>
48479 <para>
48480 In this case, if the lookup succeeds, the result is checked; if the lookup
48481 fails, <quote>false</quote> is returned and authentication fails. If <option>crypteq</option> is being
48482 used instead of <option>eq</option>, the first example is in fact safe, because <option>crypteq</option>
48483 always fails if its second argument is empty. However, the second way of
48484 writing the test makes the logic clearer.
48485 </para>
48486 </section>
48487 <section id="SECID173">
48488 <title>The LOGIN authentication mechanism</title>
48489 <para>
48490 <indexterm role="concept">
48491 <primary>LOGIN authentication mechanism</primary>
48492 </indexterm>
48493 <indexterm role="concept">
48494 <primary>authentication</primary>
48495 <secondary>LOGIN mechanism</secondary>
48496 </indexterm>
48497 The LOGIN authentication mechanism is not documented in any RFC, but is in use
48498 in a number of programs. No data is sent with the AUTH command. Instead, a
48499 user name and password are supplied separately, in response to prompts. The
48500 plaintext authenticator can be configured to support this as in this example:
48501 </para>
48502 <literallayout class="monospaced">
48503 fixed_login:
48504   driver = plaintext
48505   public_name = LOGIN
48506   server_prompts = User Name : Password
48507   server_condition = \
48508     ${if and {{eq{$auth1}{username}}{eq{$auth2}{mysecret}}}}
48509   server_set_id = $auth1
48510 </literallayout>
48511 <para>
48512 Because of the way plaintext operates, this authenticator accepts data supplied
48513 with the AUTH command (in contravention of the specification of LOGIN), but
48514 if the client does not supply it (as is the case for LOGIN clients), the prompt
48515 strings are used to obtain two data items.
48516 </para>
48517 <para>
48518 Some clients are very particular about the precise text of the prompts. For
48519 example, Outlook Express is reported to recognize only <quote>Username:</quote> and
48520 <quote>Password:</quote>. Here is an example of a LOGIN authenticator that uses those
48521 strings. It uses the <option>ldapauth</option> expansion condition to check the user
48522 name and password by binding to an LDAP server:
48523 </para>
48524 <literallayout class="monospaced">
48525 login:
48526   driver = plaintext
48527   public_name = LOGIN
48528   server_prompts = Username:: : Password::
48529   server_condition = ${if and{{ \
48530     !eq{}{$auth1} }{ \
48531     ldapauth{\
48532       user="uid=${quote_ldap_dn:$auth1},ou=people,o=example.org" \
48533       pass=${quote:$auth2} \
48534       ldap://ldap.example.org/} }} }
48535   server_set_id = uid=$auth1,ou=people,o=example.org
48536 </literallayout>
48537 <para>
48538 We have to check that the username is not empty before using it, because LDAP
48539 does not permit empty DN components. We must also use the <option>quote_ldap_dn</option>
48540 operator to correctly quote the DN for authentication. However, the basic
48541 <option>quote</option> operator, rather than any of the LDAP quoting operators, is the
48542 correct one to use for the password, because quoting is needed only to make
48543 the password conform to the Exim syntax. At the LDAP level, the password is an
48544 uninterpreted string.
48545 </para>
48546 </section>
48547 <section id="SECID174">
48548 <title>Support for different kinds of authentication</title>
48549 <para>
48550 A number of string expansion features are provided for the purpose of
48551 interfacing to different ways of user authentication. These include checking
48552 traditionally encrypted passwords from <filename>/etc/passwd</filename> (or equivalent), PAM,
48553 Radius, <option>ldapauth</option>, <emphasis>pwcheck</emphasis>, and <emphasis>saslauthd</emphasis>. For details see section
48554 <xref linkend="SECTexpcond"/>.
48555 </para>
48556 </section>
48557 <section id="SECID175">
48558 <title>Using plaintext in a client</title>
48559 <para>
48560 <indexterm role="concept">
48561 <primary>options</primary>
48562 <secondary><command>plaintext</command> authenticator (client)</secondary>
48563 </indexterm>
48564 The <command>plaintext</command> authenticator has two client options:
48565 </para>
48566 <para>
48567 <indexterm role="option">
48568 <primary><option>client_ignore_invalid_base64</option></primary>
48569 </indexterm>
48570 </para>
48571 <informaltable frame="all">
48572 <tgroup cols="4" colsep="0" rowsep="0">
48573 <colspec colwidth="8*" align="left"/>
48574 <colspec colwidth="6*" align="center"/>
48575 <colspec colwidth="6*" align="center"/>
48576 <colspec colwidth="6*" align="right"/>
48577 <tbody>
48578 <row>
48579 <entry><option>client_ignore_invalid_base64</option></entry>
48580 <entry>Use: <emphasis>plaintext</emphasis></entry>
48581 <entry>Type: <emphasis>boolean</emphasis></entry>
48582 <entry>Default: <emphasis>false</emphasis></entry>
48583 </row>
48584 </tbody>
48585 </tgroup>
48586 </informaltable>
48587 <para>
48588 If the client receives a server prompt that is not a valid base64 string,
48589 authentication is abandoned by default. However, if this option is set true,
48590 the error in the challenge is ignored and the client sends the response as
48591 usual.
48592 </para>
48593 <para>
48594 <indexterm role="option">
48595 <primary><option>client_send</option></primary>
48596 </indexterm>
48597 </para>
48598 <informaltable frame="all">
48599 <tgroup cols="4" colsep="0" rowsep="0">
48600 <colspec colwidth="8*" align="left"/>
48601 <colspec colwidth="6*" align="center"/>
48602 <colspec colwidth="6*" align="center"/>
48603 <colspec colwidth="6*" align="right"/>
48604 <tbody>
48605 <row>
48606 <entry><option>client_send</option></entry>
48607 <entry>Use: <emphasis>plaintext</emphasis></entry>
48608 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
48609 <entry>Default: <emphasis>unset</emphasis></entry>
48610 </row>
48611 </tbody>
48612 </tgroup>
48613 </informaltable>
48614 <para>
48615 The string is a colon-separated list of authentication data strings. Each
48616 string is independently expanded before being sent to the server. The first
48617 string is sent with the AUTH command; any more strings are sent in response
48618 to prompts from the server. Before each string is expanded, the value of the
48619 most recent prompt is placed in the next <varname>$auth</varname>&lt;<emphasis>n</emphasis>&gt; variable, starting
48620 with <varname>$auth1</varname> for the first prompt. Up to three prompts are stored in this
48621 way. Thus, the prompt that is received in response to sending the first string
48622 (with the AUTH command) can be used in the expansion of the second string, and
48623 so on. If an invalid base64 string is received when
48624 <option>client_ignore_invalid_base64</option> is set, an empty string is put in the
48625 <varname>$auth</varname>&lt;<emphasis>n</emphasis>&gt; variable.
48626 </para>
48627 <para>
48628 <emphasis role="bold">Note</emphasis>: You cannot use expansion to create multiple strings, because
48629 splitting takes priority and happens first.
48630 </para>
48631 <para>
48632 Because the PLAIN authentication mechanism requires NUL (binary zero) bytes in
48633 the data, further processing is applied to each string before it is sent. If
48634 there are any single circumflex characters in the string, they are converted to
48635 NULs. Should an actual circumflex be required as data, it must be doubled in
48636 the string.
48637 </para>
48638 <para>
48639 This is an example of a client configuration that implements the PLAIN
48640 authentication mechanism with a fixed user name and password:
48641 </para>
48642 <literallayout class="monospaced">
48643 fixed_plain:
48644   driver = plaintext
48645   public_name = PLAIN
48646   client_send = ^username^mysecret
48647 </literallayout>
48648 <para>
48649 The lack of colons means that the entire text is sent with the AUTH
48650 command, with the circumflex characters converted to NULs. A similar example
48651 that uses the LOGIN mechanism is:
48652 </para>
48653 <literallayout class="monospaced">
48654 fixed_login:
48655   driver = plaintext
48656   public_name = LOGIN
48657   client_send = : username : mysecret
48658 </literallayout>
48659 <para>
48660 The initial colon means that the first string is empty, so no data is sent with
48661 the AUTH command itself. The remaining strings are sent in response to
48662 prompts.
48663 <indexterm role="concept" startref="IIDplaiauth1" class="endofrange"/>
48664 <indexterm role="concept" startref="IIDplaiauth2" class="endofrange"/>
48665 </para>
48666 </section>
48667 </chapter>
48668
48669 <chapter id="CHID9">
48670 <title>The cram_md5 authenticator</title>
48671 <para>
48672 <indexterm role="concept" id="IIDcramauth1" class="startofrange">
48673 <primary><command>cram_md5</command> authenticator</primary>
48674 </indexterm>
48675 <indexterm role="concept" id="IIDcramauth2" class="startofrange">
48676 <primary>authenticators</primary>
48677 <secondary><command>cram_md5</command></secondary>
48678 </indexterm>
48679 <indexterm role="concept">
48680 <primary>CRAM-MD5 authentication mechanism</primary>
48681 </indexterm>
48682 <indexterm role="concept">
48683 <primary>authentication</primary>
48684 <secondary>CRAM-MD5 mechanism</secondary>
48685 </indexterm>
48686 The CRAM-MD5 authentication mechanism is described in RFC 2195. The server
48687 sends a challenge string to the client, and the response consists of a user
48688 name and the CRAM-MD5 digest of the challenge string combined with a secret
48689 string (password) which is known to both server and client. Thus, the secret
48690 is not sent over the network as plain text, which makes this authenticator more
48691 secure than <command>plaintext</command>. However, the downside is that the secret has to be
48692 available in plain text at either end.
48693 </para>
48694 <section id="SECID176">
48695 <title>Using cram_md5 as a server</title>
48696 <para>
48697 <indexterm role="concept">
48698 <primary>options</primary>
48699 <secondary><command>cram_md5</command> authenticator (server)</secondary>
48700 </indexterm>
48701 This authenticator has one server option, which must be set to configure the
48702 authenticator as a server:
48703 </para>
48704 <para>
48705 <indexterm role="option">
48706 <primary><option>server_secret</option></primary>
48707 </indexterm>
48708 </para>
48709 <informaltable frame="all">
48710 <tgroup cols="4" colsep="0" rowsep="0">
48711 <colspec colwidth="8*" align="left"/>
48712 <colspec colwidth="6*" align="center"/>
48713 <colspec colwidth="6*" align="center"/>
48714 <colspec colwidth="6*" align="right"/>
48715 <tbody>
48716 <row>
48717 <entry><option>server_secret</option></entry>
48718 <entry>Use: <emphasis>cram_md5</emphasis></entry>
48719 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
48720 <entry>Default: <emphasis>unset</emphasis></entry>
48721 </row>
48722 </tbody>
48723 </tgroup>
48724 </informaltable>
48725 <para>
48726 <indexterm role="concept">
48727 <primary>numerical variables (<varname>$1</varname> <varname>$2</varname> etc)</primary>
48728 <secondary>in <command>cram_md5</command> authenticator</secondary>
48729 </indexterm>
48730 When the server receives the client&#x2019;s response, the user name is placed in
48731 the expansion variable <varname>$auth1</varname>, and <option>server_secret</option> is expanded to
48732 obtain the password for that user. The server then computes the CRAM-MD5 digest
48733 that the client should have sent, and checks that it received the correct
48734 string. If the expansion of <option>server_secret</option> is forced to fail, authentication
48735 fails. If the expansion fails for some other reason, a temporary error code is
48736 returned to the client.
48737 </para>
48738 <para>
48739 For compatibility with previous releases of Exim, the user name is also placed
48740 in <varname>$1</varname>. However, the use of this variables for this purpose is now
48741 deprecated, as it can lead to confusion in string expansions that also use
48742 numeric variables for other things.
48743 </para>
48744 <para>
48745 For example, the following authenticator checks that the user name given by the
48746 client is <quote>ph10</quote>, and if so, uses <quote>secret</quote> as the password. For any other
48747 user name, authentication fails.
48748 </para>
48749 <literallayout class="monospaced">
48750 fixed_cram:
48751   driver = cram_md5
48752   public_name = CRAM-MD5
48753   server_secret = ${if eq{$auth1}{ph10}{secret}fail}
48754   server_set_id = $auth1
48755 </literallayout>
48756 <para>
48757 <indexterm role="variable">
48758 <primary><varname>$authenticated_id</varname></primary>
48759 </indexterm>
48760 If authentication succeeds, the setting of <option>server_set_id</option> preserves the user
48761 name in <varname>$authenticated_id</varname>. A more typical configuration might look up the
48762 secret string in a file, using the user name as the key. For example:
48763 </para>
48764 <literallayout class="monospaced">
48765 lookup_cram:
48766   driver = cram_md5
48767   public_name = CRAM-MD5
48768   server_secret = ${lookup{$auth1}lsearch{/etc/authpwd}\
48769                   {$value}fail}
48770   server_set_id = $auth1
48771 </literallayout>
48772 <para>
48773 Note that this expansion explicitly forces failure if the lookup fails
48774 because <varname>$auth1</varname> contains an unknown user name.
48775 </para>
48776 <para>
48777 As another example, if you wish to re-use a Cyrus SASL sasldb2 file without
48778 using the relevant libraries, you need to know the realm to specify in the
48779 lookup and then ask for the <quote>userPassword</quote> attribute for that user in that
48780 realm, with:
48781 </para>
48782 <literallayout class="monospaced">
48783 cyrusless_crammd5:
48784   driver = cram_md5
48785   public_name = CRAM-MD5
48786   server_secret = ${lookup{$auth1:mail.example.org:userPassword}\
48787                   dbmjz{/etc/sasldb2}}
48788   server_set_id = $auth1
48789 </literallayout>
48790 </section>
48791 <section id="SECID177">
48792 <title>Using cram_md5 as a client</title>
48793 <para>
48794 <indexterm role="concept">
48795 <primary>options</primary>
48796 <secondary><command>cram_md5</command> authenticator (client)</secondary>
48797 </indexterm>
48798 When used as a client, the <command>cram_md5</command> authenticator has two options:
48799 </para>
48800 <para>
48801 <indexterm role="option">
48802 <primary><option>client_name</option></primary>
48803 </indexterm>
48804 </para>
48805 <informaltable frame="all">
48806 <tgroup cols="4" colsep="0" rowsep="0">
48807 <colspec colwidth="8*" align="left"/>
48808 <colspec colwidth="6*" align="center"/>
48809 <colspec colwidth="6*" align="center"/>
48810 <colspec colwidth="6*" align="right"/>
48811 <tbody>
48812 <row>
48813 <entry><option>client_name</option></entry>
48814 <entry>Use: <emphasis>cram_md5</emphasis></entry>
48815 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
48816 <entry>Default: <emphasis>the primary host name</emphasis></entry>
48817 </row>
48818 </tbody>
48819 </tgroup>
48820 </informaltable>
48821 <para>
48822 This string is expanded, and the result used as the user name data when
48823 computing the response to the server&#x2019;s challenge.
48824 </para>
48825 <para>
48826 <indexterm role="option">
48827 <primary><option>client_secret</option></primary>
48828 </indexterm>
48829 </para>
48830 <informaltable frame="all">
48831 <tgroup cols="4" colsep="0" rowsep="0">
48832 <colspec colwidth="8*" align="left"/>
48833 <colspec colwidth="6*" align="center"/>
48834 <colspec colwidth="6*" align="center"/>
48835 <colspec colwidth="6*" align="right"/>
48836 <tbody>
48837 <row>
48838 <entry><option>client_secret</option></entry>
48839 <entry>Use: <emphasis>cram_md5</emphasis></entry>
48840 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
48841 <entry>Default: <emphasis>unset</emphasis></entry>
48842 </row>
48843 </tbody>
48844 </tgroup>
48845 </informaltable>
48846 <para>
48847 This option must be set for the authenticator to work as a client. Its value is
48848 expanded and the result used as the secret string when computing the response.
48849 </para>
48850 <para>
48851 <indexterm role="variable">
48852 <primary><varname>$host</varname></primary>
48853 </indexterm>
48854 <indexterm role="variable">
48855 <primary><varname>$host_address</varname></primary>
48856 </indexterm>
48857 Different user names and secrets can be used for different servers by referring
48858 to <varname>$host</varname> or <varname>$host_address</varname> in the options. Forced failure of either
48859 expansion string is treated as an indication that this authenticator is not
48860 prepared to handle this case. Exim moves on to the next configured client
48861 authenticator. Any other expansion failure causes Exim to give up trying to
48862 send the message to the current server.
48863 </para>
48864 <para>
48865 A simple example configuration of a <command>cram_md5</command> authenticator, using fixed
48866 strings, is:
48867 </para>
48868 <literallayout class="monospaced">
48869 fixed_cram:
48870   driver = cram_md5
48871   public_name = CRAM-MD5
48872   client_name = ph10
48873   client_secret = secret
48874 </literallayout>
48875 <para>
48876 <indexterm role="concept" startref="IIDcramauth1" class="endofrange"/>
48877 <indexterm role="concept" startref="IIDcramauth2" class="endofrange"/>
48878 </para>
48879 </section>
48880 </chapter>
48881
48882 <chapter id="CHID10">
48883 <title>The cyrus_sasl authenticator</title>
48884 <para>
48885 <indexterm role="concept" id="IIDcyrauth1" class="startofrange">
48886 <primary><command>cyrus_sasl</command> authenticator</primary>
48887 </indexterm>
48888 <indexterm role="concept" id="IIDcyrauth2" class="startofrange">
48889 <primary>authenticators</primary>
48890 <secondary><command>cyrus_sasl</command></secondary>
48891 </indexterm>
48892 <indexterm role="concept">
48893 <primary>Cyrus</primary>
48894 <secondary>SASL library</secondary>
48895 </indexterm>
48896 <indexterm role="concept">
48897 <primary>Kerberos</primary>
48898 </indexterm>
48899 The code for this authenticator was provided by Matthew Byng-Maddick of A L
48900 Digital Ltd (<emphasis role="bold"><ulink url="http://www.aldigital.co.uk">http://www.aldigital.co.uk</ulink></emphasis>).
48901 </para>
48902 <para>
48903 The <command>cyrus_sasl</command> authenticator provides server support for the Cyrus SASL
48904 library implementation of the RFC 2222 (<quote>Simple Authentication and Security
48905 Layer</quote>). This library supports a number of authentication mechanisms,
48906 including PLAIN and LOGIN, but also several others that Exim does not support
48907 directly. In particular, there is support for Kerberos authentication.
48908 </para>
48909 <para>
48910 The <command>cyrus_sasl</command> authenticator provides a gatewaying mechanism directly to
48911 the Cyrus interface, so if your Cyrus library can do, for example, CRAM-MD5,
48912 then so can the <command>cyrus_sasl</command> authenticator. By default it uses the public
48913 name of the driver to determine which mechanism to support.
48914 </para>
48915 <para>
48916 Where access to some kind of secret file is required, for example in GSSAPI
48917 or CRAM-MD5, it is worth noting that the authenticator runs as the Exim
48918 user, and that the Cyrus SASL library has no way of escalating privileges
48919 by default. You may also find you need to set environment variables,
48920 depending on the driver you are using.
48921 </para>
48922 <para>
48923 The application name provided by Exim is <quote>exim</quote>, so various SASL options may
48924 be set in <filename>exim.conf</filename> in your SASL directory. If you are using GSSAPI for
48925 Kerberos, note that because of limitations in the GSSAPI interface,
48926 changing the server keytab might need to be communicated down to the Kerberos
48927 layer independently. The mechanism for doing so is dependent upon the Kerberos
48928 implementation.
48929 </para>
48930 <para>
48931 For example, for older releases of Heimdal, the environment variable KRB5_KTNAME
48932 may be set to point to an alternative keytab file. Exim will pass this
48933 variable through from its own inherited environment when started as root or the
48934 Exim user. The keytab file needs to be readable by the Exim user.
48935 With newer releases of Heimdal, a setuid Exim may cause Heimdal to discard the
48936 environment variable.  In practice, for those releases, the Cyrus authenticator
48937 is not a suitable interface for GSSAPI (Kerberos) support.  Instead, consider
48938 the <command>heimdal_gssapi</command> authenticator, described in chapter <xref linkend="CHAPheimdalgss"/>
48939 </para>
48940 <section id="SECID178">
48941 <title>Using cyrus_sasl as a server</title>
48942 <para>
48943 The <command>cyrus_sasl</command> authenticator has four private options. It puts the username
48944 (on a successful authentication) into <varname>$auth1</varname>. For compatibility with
48945 previous releases of Exim, the username is also placed in <varname>$1</varname>. However, the
48946 use of this variable for this purpose is now deprecated, as it can lead to
48947 confusion in string expansions that also use numeric variables for other
48948 things.
48949 </para>
48950 <para>
48951 <indexterm role="option">
48952 <primary><option>server_hostname</option></primary>
48953 </indexterm>
48954 </para>
48955 <informaltable frame="all">
48956 <tgroup cols="4" colsep="0" rowsep="0">
48957 <colspec colwidth="8*" align="left"/>
48958 <colspec colwidth="6*" align="center"/>
48959 <colspec colwidth="6*" align="center"/>
48960 <colspec colwidth="6*" align="right"/>
48961 <tbody>
48962 <row>
48963 <entry><option>server_hostname</option></entry>
48964 <entry>Use: <emphasis>cyrus_sasl</emphasis></entry>
48965 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
48966 <entry>Default: <emphasis>see below</emphasis></entry>
48967 </row>
48968 </tbody>
48969 </tgroup>
48970 </informaltable>
48971 <para>
48972 This option selects the hostname that is used when communicating with the
48973 library. The default value is <literal>$primary_hostname</literal>. It is up to the underlying
48974 SASL plug-in what it does with this data.
48975 </para>
48976 <para>
48977 <indexterm role="option">
48978 <primary><option>server_mech</option></primary>
48979 </indexterm>
48980 </para>
48981 <informaltable frame="all">
48982 <tgroup cols="4" colsep="0" rowsep="0">
48983 <colspec colwidth="8*" align="left"/>
48984 <colspec colwidth="6*" align="center"/>
48985 <colspec colwidth="6*" align="center"/>
48986 <colspec colwidth="6*" align="right"/>
48987 <tbody>
48988 <row>
48989 <entry><option>server_mech</option></entry>
48990 <entry>Use: <emphasis>cyrus_sasl</emphasis></entry>
48991 <entry>Type: <emphasis>string</emphasis></entry>
48992 <entry>Default: <emphasis>see below</emphasis></entry>
48993 </row>
48994 </tbody>
48995 </tgroup>
48996 </informaltable>
48997 <para>
48998 This option selects the authentication mechanism this driver should use. The
48999 default is the value of the generic <option>public_name</option> option. This option allows
49000 you to use a different underlying mechanism from the advertised name. For
49001 example:
49002 </para>
49003 <literallayout class="monospaced">
49004 sasl:
49005   driver = cyrus_sasl
49006   public_name = X-ANYTHING
49007   server_mech = CRAM-MD5
49008   server_set_id = $auth1
49009 </literallayout>
49010 <para>
49011 <indexterm role="option">
49012 <primary><option>server_realm</option></primary>
49013 </indexterm>
49014 </para>
49015 <informaltable frame="all">
49016 <tgroup cols="4" colsep="0" rowsep="0">
49017 <colspec colwidth="8*" align="left"/>
49018 <colspec colwidth="6*" align="center"/>
49019 <colspec colwidth="6*" align="center"/>
49020 <colspec colwidth="6*" align="right"/>
49021 <tbody>
49022 <row>
49023 <entry><option>server_realm</option></entry>
49024 <entry>Use: <emphasis>cyrus_sasl</emphasis></entry>
49025 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
49026 <entry>Default: <emphasis>unset</emphasis></entry>
49027 </row>
49028 </tbody>
49029 </tgroup>
49030 </informaltable>
49031 <para>
49032 This specifies the SASL realm that the server claims to be in.
49033 </para>
49034 <para>
49035 <indexterm role="option">
49036 <primary><option>server_service</option></primary>
49037 </indexterm>
49038 </para>
49039 <informaltable frame="all">
49040 <tgroup cols="4" colsep="0" rowsep="0">
49041 <colspec colwidth="8*" align="left"/>
49042 <colspec colwidth="6*" align="center"/>
49043 <colspec colwidth="6*" align="center"/>
49044 <colspec colwidth="6*" align="right"/>
49045 <tbody>
49046 <row>
49047 <entry><option>server_service</option></entry>
49048 <entry>Use: <emphasis>cyrus_sasl</emphasis></entry>
49049 <entry>Type: <emphasis>string</emphasis></entry>
49050 <entry>Default: <emphasis><literal>smtp</literal></emphasis></entry>
49051 </row>
49052 </tbody>
49053 </tgroup>
49054 </informaltable>
49055 <para>
49056 This is the SASL service that the server claims to implement.
49057 </para>
49058 <para>
49059 For straightforward cases, you do not need to set any of the authenticator&#x2019;s
49060 private options. All you need to do is to specify an appropriate mechanism as
49061 the public name. Thus, if you have a SASL library that supports CRAM-MD5 and
49062 PLAIN, you could have two authenticators as follows:
49063 </para>
49064 <literallayout class="monospaced">
49065 sasl_cram_md5:
49066   driver = cyrus_sasl
49067   public_name = CRAM-MD5
49068   server_set_id = $auth1
49069
49070 sasl_plain:
49071   driver = cyrus_sasl
49072   public_name = PLAIN
49073   server_set_id = $auth2
49074 </literallayout>
49075 <para>
49076 Cyrus SASL does implement the LOGIN authentication method, even though it is
49077 not a standard method. It is disabled by default in the source distribution,
49078 but it is present in many binary distributions.
49079 <indexterm role="concept" startref="IIDcyrauth1" class="endofrange"/>
49080 <indexterm role="concept" startref="IIDcyrauth2" class="endofrange"/>
49081 </para>
49082 </section>
49083 </chapter>
49084
49085 <chapter id="CHAPdovecot">
49086 <title>The dovecot authenticator</title>
49087 <para>
49088 <indexterm role="concept" id="IIDdcotauth1" class="startofrange">
49089 <primary><command>dovecot</command> authenticator</primary>
49090 </indexterm>
49091 <indexterm role="concept" id="IIDdcotauth2" class="startofrange">
49092 <primary>authenticators</primary>
49093 <secondary><command>dovecot</command></secondary>
49094 </indexterm>
49095 This authenticator is an interface to the authentication facility of the
49096 Dovecot POP/IMAP server, which can support a number of authentication methods.
49097 </para>
49098 <para revisionflag="changed">
49099 Note that Dovecot must be configured to use auth-client not auth-userdb.
49100 </para>
49101 <para>
49102 If you are using Dovecot to authenticate POP/IMAP clients, it might be helpful
49103 to use the same mechanisms for SMTP authentication. This is a server
49104 authenticator only. There is only one option:
49105 </para>
49106 <para>
49107 <indexterm role="option">
49108 <primary><option>server_socket</option></primary>
49109 </indexterm>
49110 </para>
49111 <informaltable frame="all">
49112 <tgroup cols="4" colsep="0" rowsep="0">
49113 <colspec colwidth="8*" align="left"/>
49114 <colspec colwidth="6*" align="center"/>
49115 <colspec colwidth="6*" align="center"/>
49116 <colspec colwidth="6*" align="right"/>
49117 <tbody>
49118 <row>
49119 <entry><option>server_socket</option></entry>
49120 <entry>Use: <emphasis>dovecot</emphasis></entry>
49121 <entry>Type: <emphasis>string</emphasis></entry>
49122 <entry>Default: <emphasis>unset</emphasis></entry>
49123 </row>
49124 </tbody>
49125 </tgroup>
49126 </informaltable>
49127 <para>
49128 This option must specify the socket that is the interface to Dovecot
49129 authentication. The <option>public_name</option> option must specify an authentication
49130 mechanism that Dovecot is configured to support. You can have several
49131 authenticators for different mechanisms. For example:
49132 </para>
49133 <literallayout class="monospaced">
49134 dovecot_plain:
49135   driver = dovecot
49136   public_name = PLAIN
49137   server_socket = /var/run/dovecot/auth-client
49138   server_set_id = $auth1
49139
49140 dovecot_ntlm:
49141   driver = dovecot
49142   public_name = NTLM
49143   server_socket = /var/run/dovecot/auth-client
49144   server_set_id = $auth1
49145 </literallayout>
49146 <para>
49147 If the SMTP connection is encrypted, or if <varname>$sender_host_address</varname> is equal to
49148 <varname>$received_ip_address</varname> (that is, the connection is local), the <quote>secured</quote>
49149 option is passed in the Dovecot authentication command. If, for a TLS
49150 connection, a client certificate has been verified, the <quote>valid-client-cert</quote>
49151 option is passed. When authentication succeeds, the identity of the user
49152 who authenticated is placed in <varname>$auth1</varname>.
49153 <indexterm role="concept" startref="IIDdcotauth1" class="endofrange"/>
49154 <indexterm role="concept" startref="IIDdcotauth2" class="endofrange"/>
49155 </para>
49156 </chapter>
49157
49158 <chapter id="CHAPgsasl">
49159 <title>The gsasl authenticator</title>
49160 <para>
49161 <indexterm role="concept" id="IIDgsaslauth1" class="startofrange">
49162 <primary><command>gsasl</command> authenticator</primary>
49163 </indexterm>
49164 <indexterm role="concept" id="IIDgsaslauth2" class="startofrange">
49165 <primary>authenticators</primary>
49166 <secondary><command>gsasl</command></secondary>
49167 </indexterm>
49168 <indexterm role="concept">
49169 <primary>authentication</primary>
49170 <secondary>GNU SASL</secondary>
49171 </indexterm>
49172 <indexterm role="concept">
49173 <primary>authentication</primary>
49174 <secondary>SASL</secondary>
49175 </indexterm>
49176 <indexterm role="concept">
49177 <primary>authentication</primary>
49178 <secondary>EXTERNAL</secondary>
49179 </indexterm>
49180 <indexterm role="concept">
49181 <primary>authentication</primary>
49182 <secondary>ANONYMOUS</secondary>
49183 </indexterm>
49184 <indexterm role="concept">
49185 <primary>authentication</primary>
49186 <secondary>PLAIN</secondary>
49187 </indexterm>
49188 <indexterm role="concept">
49189 <primary>authentication</primary>
49190 <secondary>LOGIN</secondary>
49191 </indexterm>
49192 <indexterm role="concept">
49193 <primary>authentication</primary>
49194 <secondary>DIGEST-MD5</secondary>
49195 </indexterm>
49196 <indexterm role="concept">
49197 <primary>authentication</primary>
49198 <secondary>CRAM-MD5</secondary>
49199 </indexterm>
49200 <indexterm role="concept">
49201 <primary>authentication</primary>
49202 <secondary>SCRAM-SHA-1</secondary>
49203 </indexterm>
49204 The <command>gsasl</command> authenticator provides server integration for the GNU SASL
49205 library and the mechanisms it provides.  This is new as of the 4.80 release
49206 and there are a few areas where the library does not let Exim smoothly
49207 scale to handle future authentication mechanisms, so no guarantee can be
49208 made that any particular new authentication mechanism will be supported
49209 without code changes in Exim.
49210 </para>
49211 <para>
49212 <indexterm role="option">
49213 <primary><option>server_channelbinding</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_channelbinding</option></entry>
49225 <entry>Use: <emphasis>gsasl</emphasis></entry>
49226 <entry>Type: <emphasis>boolean</emphasis></entry>
49227 <entry>Default: <emphasis>false</emphasis></entry>
49228 </row>
49229 </tbody>
49230 </tgroup>
49231 </informaltable>
49232 <para>
49233 Some authentication mechanisms are able to use external context at both ends
49234 of the session to bind the authentication to that context, and fail the
49235 authentication process if that context differs.  Specifically, some TLS
49236 ciphersuites can provide identifying information about the cryptographic
49237 context.
49238 </para>
49239 <para>
49240 This means that certificate identity and verification becomes a non-issue,
49241 as a man-in-the-middle attack will cause the correct client and server to
49242 see different identifiers and authentication will fail.
49243 </para>
49244 <para>
49245 This is currently only supported when using the GnuTLS library.  This is
49246 only usable by mechanisms which support "channel binding"; at time of
49247 writing, that&#x2019;s the SCRAM family.
49248 </para>
49249 <para>
49250 This defaults off to ensure smooth upgrade across Exim releases, in case
49251 this option causes some clients to start failing.  Some future release
49252 of Exim may switch the default to be true.
49253 </para>
49254 <para>
49255 <indexterm role="option">
49256 <primary><option>server_hostname</option></primary>
49257 </indexterm>
49258 </para>
49259 <informaltable frame="all">
49260 <tgroup cols="4" colsep="0" rowsep="0">
49261 <colspec colwidth="8*" align="left"/>
49262 <colspec colwidth="6*" align="center"/>
49263 <colspec colwidth="6*" align="center"/>
49264 <colspec colwidth="6*" align="right"/>
49265 <tbody>
49266 <row>
49267 <entry><option>server_hostname</option></entry>
49268 <entry>Use: <emphasis>gsasl</emphasis></entry>
49269 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
49270 <entry>Default: <emphasis>see below</emphasis></entry>
49271 </row>
49272 </tbody>
49273 </tgroup>
49274 </informaltable>
49275 <para>
49276 This option selects the hostname that is used when communicating with the
49277 library. The default value is <literal>$primary_hostname</literal>.
49278 Some mechanisms will use this data.
49279 </para>
49280 <para>
49281 <indexterm role="option">
49282 <primary><option>server_mech</option></primary>
49283 </indexterm>
49284 </para>
49285 <informaltable frame="all">
49286 <tgroup cols="4" colsep="0" rowsep="0">
49287 <colspec colwidth="8*" align="left"/>
49288 <colspec colwidth="6*" align="center"/>
49289 <colspec colwidth="6*" align="center"/>
49290 <colspec colwidth="6*" align="right"/>
49291 <tbody>
49292 <row>
49293 <entry><option>server_mech</option></entry>
49294 <entry>Use: <emphasis>gsasl</emphasis></entry>
49295 <entry>Type: <emphasis>string</emphasis></entry>
49296 <entry>Default: <emphasis>see below</emphasis></entry>
49297 </row>
49298 </tbody>
49299 </tgroup>
49300 </informaltable>
49301 <para>
49302 This option selects the authentication mechanism this driver should use. The
49303 default is the value of the generic <option>public_name</option> option. This option allows
49304 you to use a different underlying mechanism from the advertised name. For
49305 example:
49306 </para>
49307 <literallayout class="monospaced">
49308 sasl:
49309   driver = gsasl
49310   public_name = X-ANYTHING
49311   server_mech = CRAM-MD5
49312   server_set_id = $auth1
49313 </literallayout>
49314 <para>
49315 <indexterm role="option">
49316 <primary><option>server_password</option></primary>
49317 </indexterm>
49318 </para>
49319 <informaltable frame="all">
49320 <tgroup cols="4" colsep="0" rowsep="0">
49321 <colspec colwidth="8*" align="left"/>
49322 <colspec colwidth="6*" align="center"/>
49323 <colspec colwidth="6*" align="center"/>
49324 <colspec colwidth="6*" align="right"/>
49325 <tbody>
49326 <row>
49327 <entry><option>server_password</option></entry>
49328 <entry>Use: <emphasis>gsasl</emphasis></entry>
49329 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
49330 <entry>Default: <emphasis>unset</emphasis></entry>
49331 </row>
49332 </tbody>
49333 </tgroup>
49334 </informaltable>
49335 <para>
49336 Various mechanisms need access to the cleartext password on the server, so
49337 that proof-of-possession can be demonstrated on the wire, without sending
49338 the password itself.
49339 </para>
49340 <para>
49341 The data available for lookup varies per mechanism.
49342 In all cases, <varname>$auth1</varname> is set to the <emphasis>authentication id</emphasis>.
49343 The <varname>$auth2</varname> variable will always be the <emphasis>authorization id</emphasis> (<emphasis>authz</emphasis>)
49344 if available, else the empty string.
49345 The <varname>$auth3</varname> variable will always be the <emphasis>realm</emphasis> if available,
49346 else the empty string.
49347 </para>
49348 <para>
49349 A forced failure will cause authentication to defer.
49350 </para>
49351 <para>
49352 If using this option, it may make sense to set the <option>server_condition</option>
49353 option to be simply "true".
49354 </para>
49355 <para>
49356 <indexterm role="option">
49357 <primary><option>server_realm</option></primary>
49358 </indexterm>
49359 </para>
49360 <informaltable frame="all">
49361 <tgroup cols="4" colsep="0" rowsep="0">
49362 <colspec colwidth="8*" align="left"/>
49363 <colspec colwidth="6*" align="center"/>
49364 <colspec colwidth="6*" align="center"/>
49365 <colspec colwidth="6*" align="right"/>
49366 <tbody>
49367 <row>
49368 <entry><option>server_realm</option></entry>
49369 <entry>Use: <emphasis>gsasl</emphasis></entry>
49370 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
49371 <entry>Default: <emphasis>unset</emphasis></entry>
49372 </row>
49373 </tbody>
49374 </tgroup>
49375 </informaltable>
49376 <para>
49377 This specifies the SASL realm that the server claims to be in.
49378 Some mechanisms will use this data.
49379 </para>
49380 <para>
49381 <indexterm role="option">
49382 <primary><option>server_scram_iter</option></primary>
49383 </indexterm>
49384 </para>
49385 <informaltable frame="all">
49386 <tgroup cols="4" colsep="0" rowsep="0">
49387 <colspec colwidth="8*" align="left"/>
49388 <colspec colwidth="6*" align="center"/>
49389 <colspec colwidth="6*" align="center"/>
49390 <colspec colwidth="6*" align="right"/>
49391 <tbody>
49392 <row>
49393 <entry><option>server_scram_iter</option></entry>
49394 <entry>Use: <emphasis>gsasl</emphasis></entry>
49395 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
49396 <entry>Default: <emphasis>unset</emphasis></entry>
49397 </row>
49398 </tbody>
49399 </tgroup>
49400 </informaltable>
49401 <para>
49402 This option provides data for the SCRAM family of mechanisms.
49403 <varname>$auth1</varname> is not available at evaluation time.
49404 (This may change, as we receive feedback on use)
49405 </para>
49406 <para>
49407 <indexterm role="option">
49408 <primary><option>server_scram_salt</option></primary>
49409 </indexterm>
49410 </para>
49411 <informaltable frame="all">
49412 <tgroup cols="4" colsep="0" rowsep="0">
49413 <colspec colwidth="8*" align="left"/>
49414 <colspec colwidth="6*" align="center"/>
49415 <colspec colwidth="6*" align="center"/>
49416 <colspec colwidth="6*" align="right"/>
49417 <tbody>
49418 <row>
49419 <entry><option>server_scram_salt</option></entry>
49420 <entry>Use: <emphasis>gsasl</emphasis></entry>
49421 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
49422 <entry>Default: <emphasis>unset</emphasis></entry>
49423 </row>
49424 </tbody>
49425 </tgroup>
49426 </informaltable>
49427 <para>
49428 This option provides data for the SCRAM family of mechanisms.
49429 <varname>$auth1</varname> is not available at evaluation time.
49430 (This may change, as we receive feedback on use)
49431 </para>
49432 <para>
49433 <indexterm role="option">
49434 <primary><option>server_service</option></primary>
49435 </indexterm>
49436 </para>
49437 <informaltable frame="all">
49438 <tgroup cols="4" colsep="0" rowsep="0">
49439 <colspec colwidth="8*" align="left"/>
49440 <colspec colwidth="6*" align="center"/>
49441 <colspec colwidth="6*" align="center"/>
49442 <colspec colwidth="6*" align="right"/>
49443 <tbody>
49444 <row>
49445 <entry><option>server_service</option></entry>
49446 <entry>Use: <emphasis>gsasl</emphasis></entry>
49447 <entry>Type: <emphasis>string</emphasis></entry>
49448 <entry>Default: <emphasis><literal>smtp</literal></emphasis></entry>
49449 </row>
49450 </tbody>
49451 </tgroup>
49452 </informaltable>
49453 <para>
49454 This is the SASL service that the server claims to implement.
49455 Some mechanisms will use this data.
49456 </para>
49457 <section id="SECTgsaslauthvar">
49458 <title><command>gsasl</command> auth variables</title>
49459 <para>
49460 <indexterm role="variable">
49461 <primary><varname>$auth1</varname>, <varname>$auth2</varname>, etc</primary>
49462 </indexterm>
49463 These may be set when evaluating specific options, as detailed above.
49464 They will also be set when evaluating <option>server_condition</option>.
49465 </para>
49466 <para>
49467 Unless otherwise stated below, the <command>gsasl</command> integration will use the following
49468 meanings for these variables:
49469 </para>
49470 <itemizedlist>
49471 <listitem>
49472 <para>
49473 <indexterm role="variable">
49474 <primary><varname>$auth1</varname></primary>
49475 </indexterm>
49476 <varname>$auth1</varname>: the <emphasis>authentication id</emphasis>
49477 </para>
49478 </listitem>
49479 <listitem>
49480 <para>
49481 <indexterm role="variable">
49482 <primary><varname>$auth2</varname></primary>
49483 </indexterm>
49484 <varname>$auth2</varname>: the <emphasis>authorization id</emphasis>
49485 </para>
49486 </listitem>
49487 <listitem>
49488 <para>
49489 <indexterm role="variable">
49490 <primary><varname>$auth3</varname></primary>
49491 </indexterm>
49492 <varname>$auth3</varname>: the <emphasis>realm</emphasis>
49493 </para>
49494 </listitem>
49495 </itemizedlist>
49496 <para>
49497 On a per-mechanism basis:
49498 </para>
49499 <itemizedlist>
49500 <listitem>
49501 <para>
49502 <indexterm role="concept">
49503 <primary>authentication</primary>
49504 <secondary>EXTERNAL</secondary>
49505 </indexterm>
49506 EXTERNAL: only <varname>$auth1</varname> is set, to the possibly empty <emphasis>authorization id</emphasis>;
49507 the <option>server_condition</option> option must be present.
49508 </para>
49509 </listitem>
49510 <listitem>
49511 <para>
49512 <indexterm role="concept">
49513 <primary>authentication</primary>
49514 <secondary>ANONYMOUS</secondary>
49515 </indexterm>
49516 ANONYMOUS: only <varname>$auth1</varname> is set, to the possibly empty <emphasis>anonymous token</emphasis>;
49517 the <option>server_condition</option> option must be present.
49518 </para>
49519 </listitem>
49520 <listitem>
49521 <para>
49522 <indexterm role="concept">
49523 <primary>authentication</primary>
49524 <secondary>GSSAPI</secondary>
49525 </indexterm>
49526 GSSAPI: <varname>$auth1</varname> will be set to the <emphasis>GSSAPI Display Name</emphasis>;
49527 <varname>$auth2</varname> will be set to the <emphasis>authorization id</emphasis>,
49528 the <option>server_condition</option> option must be present.
49529 </para>
49530 </listitem>
49531 </itemizedlist>
49532 <para>
49533 An <emphasis>anonymous token</emphasis> is something passed along as an unauthenticated
49534 identifier; this is analogous to FTP anonymous authentication passing an
49535 email address, or software-identifier@, as the "password".
49536 </para>
49537 <para>
49538 An example showing the password having the realm specified in the callback
49539 and demonstrating a Cyrus SASL to GSASL migration approach is:
49540 </para>
49541 <literallayout class="monospaced">
49542 gsasl_cyrusless_crammd5:
49543   driver = gsasl
49544   public_name = CRAM-MD5
49545   server_realm = imap.example.org
49546   server_password = ${lookup{$auth1:$auth3:userPassword}\
49547                     dbmjz{/etc/sasldb2}{$value}fail}
49548   server_set_id = ${quote:$auth1}
49549   server_condition = yes
49550 </literallayout>
49551 </section>
49552 </chapter>
49553
49554 <chapter id="CHAPheimdalgss">
49555 <title>The heimdal_gssapi authenticator</title>
49556 <para>
49557 <indexterm role="concept" id="IIDheimdalgssauth1" class="startofrange">
49558 <primary><command>heimdal_gssapi</command> authenticator</primary>
49559 </indexterm>
49560 <indexterm role="concept" id="IIDheimdalgssauth2" class="startofrange">
49561 <primary>authenticators</primary>
49562 <secondary><command>heimdal_gssapi</command></secondary>
49563 </indexterm>
49564 <indexterm role="concept">
49565 <primary>authentication</primary>
49566 <secondary>GSSAPI</secondary>
49567 </indexterm>
49568 <indexterm role="concept">
49569 <primary>authentication</primary>
49570 <secondary>Kerberos</secondary>
49571 </indexterm>
49572 The <command>heimdal_gssapi</command> authenticator provides server integration for the
49573 Heimdal GSSAPI/Kerberos library, permitting Exim to set a keytab pathname
49574 reliably.
49575 </para>
49576 <para>
49577 <indexterm role="option">
49578 <primary><option>server_hostname</option></primary>
49579 </indexterm>
49580 </para>
49581 <informaltable frame="all">
49582 <tgroup cols="4" colsep="0" rowsep="0">
49583 <colspec colwidth="8*" align="left"/>
49584 <colspec colwidth="6*" align="center"/>
49585 <colspec colwidth="6*" align="center"/>
49586 <colspec colwidth="6*" align="right"/>
49587 <tbody>
49588 <row>
49589 <entry><option>server_hostname</option></entry>
49590 <entry>Use: <emphasis>heimdal_gssapi</emphasis></entry>
49591 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
49592 <entry>Default: <emphasis>see below</emphasis></entry>
49593 </row>
49594 </tbody>
49595 </tgroup>
49596 </informaltable>
49597 <para>
49598 This option selects the hostname that is used, with <option>server_service</option>,
49599 for constructing the GSS server name, as a <emphasis>GSS_C_NT_HOSTBASED_SERVICE</emphasis>
49600 identifier.  The default value is <literal>$primary_hostname</literal>.
49601 </para>
49602 <para>
49603 <indexterm role="option">
49604 <primary><option>server_keytab</option></primary>
49605 </indexterm>
49606 </para>
49607 <informaltable frame="all">
49608 <tgroup cols="4" colsep="0" rowsep="0">
49609 <colspec colwidth="8*" align="left"/>
49610 <colspec colwidth="6*" align="center"/>
49611 <colspec colwidth="6*" align="center"/>
49612 <colspec colwidth="6*" align="right"/>
49613 <tbody>
49614 <row>
49615 <entry><option>server_keytab</option></entry>
49616 <entry>Use: <emphasis>heimdal_gssapi</emphasis></entry>
49617 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
49618 <entry>Default: <emphasis>unset</emphasis></entry>
49619 </row>
49620 </tbody>
49621 </tgroup>
49622 </informaltable>
49623 <para>
49624 If set, then Heimdal will not use the system default keytab (typically
49625 <filename>/etc/krb5.keytab</filename>) but instead the pathname given in this option.
49626 The value should be a pathname, with no <quote>file:</quote> prefix.
49627 </para>
49628 <para>
49629 <indexterm role="option">
49630 <primary><option>server_service</option></primary>
49631 </indexterm>
49632 </para>
49633 <informaltable frame="all">
49634 <tgroup cols="4" colsep="0" rowsep="0">
49635 <colspec colwidth="8*" align="left"/>
49636 <colspec colwidth="6*" align="center"/>
49637 <colspec colwidth="6*" align="center"/>
49638 <colspec colwidth="6*" align="right"/>
49639 <tbody>
49640 <row>
49641 <entry><option>server_service</option></entry>
49642 <entry>Use: <emphasis>heimdal_gssapi</emphasis></entry>
49643 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
49644 <entry>Default: <emphasis>smtp</emphasis></entry>
49645 </row>
49646 </tbody>
49647 </tgroup>
49648 </informaltable>
49649 <para>
49650 This option specifies the service identifier used, in conjunction with
49651 <option>server_hostname</option>, for building the identifer for finding credentials
49652 from the keytab.
49653 </para>
49654 <section id="SECTheimdalgssauthvar">
49655 <title><command>heimdal_gssapi</command> auth variables</title>
49656 <para>
49657 Beware that these variables will typically include a realm, thus will appear
49658 to be roughly like an email address already.  The <emphasis>authzid</emphasis> in <varname>$auth2</varname> is
49659 not verified, so a malicious client can set it to anything.
49660 </para>
49661 <para>
49662 The <varname>$auth1</varname> field should be safely trustable as a value from the Key
49663 Distribution Center.  Note that these are not quite email addresses.
49664 Each identifier is for a role, and so the left-hand-side may include a
49665 role suffix.  For instance, <quote>joe/admin@EXAMPLE.ORG</quote>.
49666 </para>
49667 <para>
49668 <indexterm role="variable">
49669 <primary><varname>$auth1</varname>, <varname>$auth2</varname>, etc</primary>
49670 </indexterm>
49671 </para>
49672 <itemizedlist>
49673 <listitem>
49674 <para>
49675 <indexterm role="variable">
49676 <primary><varname>$auth1</varname></primary>
49677 </indexterm>
49678 <varname>$auth1</varname>: the <emphasis>authentication id</emphasis>, set to the GSS Display Name.
49679 </para>
49680 </listitem>
49681 <listitem>
49682 <para>
49683 <indexterm role="variable">
49684 <primary><varname>$auth2</varname></primary>
49685 </indexterm>
49686 <varname>$auth2</varname>: the <emphasis>authorization id</emphasis>, sent within SASL encapsulation after
49687 authentication.  If that was empty, this will also be set to the
49688 GSS Display Name.
49689 </para>
49690 </listitem>
49691 </itemizedlist>
49692 </section>
49693 </chapter>
49694
49695 <chapter id="CHAPspa">
49696 <title>The spa authenticator</title>
49697 <para>
49698 <indexterm role="concept" id="IIDspaauth1" class="startofrange">
49699 <primary><command>spa</command> authenticator</primary>
49700 </indexterm>
49701 <indexterm role="concept" id="IIDspaauth2" class="startofrange">
49702 <primary>authenticators</primary>
49703 <secondary><command>spa</command></secondary>
49704 </indexterm>
49705 <indexterm role="concept">
49706 <primary>authentication</primary>
49707 <secondary>Microsoft Secure Password</secondary>
49708 </indexterm>
49709 <indexterm role="concept">
49710 <primary>authentication</primary>
49711 <secondary>NTLM</secondary>
49712 </indexterm>
49713 <indexterm role="concept">
49714 <primary>Microsoft Secure Password Authentication</primary>
49715 </indexterm>
49716 <indexterm role="concept">
49717 <primary>NTLM authentication</primary>
49718 </indexterm>
49719 The <command>spa</command> authenticator provides client support for Microsoft&#x2019;s <emphasis>Secure
49720 Password Authentication</emphasis> mechanism,
49721 which is also sometimes known as NTLM (NT LanMan). The code for client side of
49722 this authenticator was contributed by Marc Prud&#x2019;hommeaux, and much of it is
49723 taken from the Samba project (<emphasis role="bold"><ulink url="http://www.samba.org">http://www.samba.org</ulink></emphasis>). The code for the
49724 server side was subsequently contributed by Tom Kistner. The mechanism works as
49725 follows:
49726 </para>
49727 <itemizedlist>
49728 <listitem>
49729 <para>
49730 After the AUTH command has been accepted, the client sends an SPA
49731 authentication request based on the user name and optional domain.
49732 </para>
49733 </listitem>
49734 <listitem>
49735 <para>
49736 The server sends back a challenge.
49737 </para>
49738 </listitem>
49739 <listitem>
49740 <para>
49741 The client builds a challenge response which makes use of the user&#x2019;s password
49742 and sends it to the server, which then accepts or rejects it.
49743 </para>
49744 </listitem>
49745 </itemizedlist>
49746 <para>
49747 Encryption is used to protect the password in transit.
49748 </para>
49749 <section id="SECID179">
49750 <title>Using spa as a server</title>
49751 <para>
49752 <indexterm role="concept">
49753 <primary>options</primary>
49754 <secondary><command>spa</command> authenticator (server)</secondary>
49755 </indexterm>
49756 The <command>spa</command> authenticator has just one server option:
49757 </para>
49758 <para>
49759 <indexterm role="option">
49760 <primary><option>server_password</option></primary>
49761 </indexterm>
49762 </para>
49763 <informaltable frame="all">
49764 <tgroup cols="4" colsep="0" rowsep="0">
49765 <colspec colwidth="8*" align="left"/>
49766 <colspec colwidth="6*" align="center"/>
49767 <colspec colwidth="6*" align="center"/>
49768 <colspec colwidth="6*" align="right"/>
49769 <tbody>
49770 <row>
49771 <entry><option>server_password</option></entry>
49772 <entry>Use: <emphasis>spa</emphasis></entry>
49773 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
49774 <entry>Default: <emphasis>unset</emphasis></entry>
49775 </row>
49776 </tbody>
49777 </tgroup>
49778 </informaltable>
49779 <para>
49780 <indexterm role="concept">
49781 <primary>numerical variables (<varname>$1</varname> <varname>$2</varname> etc)</primary>
49782 <secondary>in <command>spa</command> authenticator</secondary>
49783 </indexterm>
49784 This option is expanded, and the result must be the cleartext password for the
49785 authenticating user, whose name is at this point in <varname>$auth1</varname>. For
49786 compatibility with previous releases of Exim, the user name is also placed in
49787 <varname>$1</varname>. However, the use of this variable for this purpose is now deprecated, as
49788 it can lead to confusion in string expansions that also use numeric variables
49789 for other things. For example:
49790 </para>
49791 <literallayout class="monospaced">
49792 spa:
49793   driver = spa
49794   public_name = NTLM
49795   server_password = \
49796     ${lookup{$auth1}lsearch{/etc/exim/spa_clearpass}{$value}fail}
49797 </literallayout>
49798 <para>
49799 If the expansion is forced to fail, authentication fails. Any other expansion
49800 failure causes a temporary error code to be returned.
49801 </para>
49802 </section>
49803 <section id="SECID180">
49804 <title>Using spa as a client</title>
49805 <para>
49806 <indexterm role="concept">
49807 <primary>options</primary>
49808 <secondary><command>spa</command> authenticator (client)</secondary>
49809 </indexterm>
49810 The <command>spa</command> authenticator has the following client options:
49811 </para>
49812 <para>
49813 <indexterm role="option">
49814 <primary><option>client_domain</option></primary>
49815 </indexterm>
49816 </para>
49817 <informaltable frame="all">
49818 <tgroup cols="4" colsep="0" rowsep="0">
49819 <colspec colwidth="8*" align="left"/>
49820 <colspec colwidth="6*" align="center"/>
49821 <colspec colwidth="6*" align="center"/>
49822 <colspec colwidth="6*" align="right"/>
49823 <tbody>
49824 <row>
49825 <entry><option>client_domain</option></entry>
49826 <entry>Use: <emphasis>spa</emphasis></entry>
49827 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
49828 <entry>Default: <emphasis>unset</emphasis></entry>
49829 </row>
49830 </tbody>
49831 </tgroup>
49832 </informaltable>
49833 <para>
49834 This option specifies an optional domain for the authentication.
49835 </para>
49836 <para>
49837 <indexterm role="option">
49838 <primary><option>client_password</option></primary>
49839 </indexterm>
49840 </para>
49841 <informaltable frame="all">
49842 <tgroup cols="4" colsep="0" rowsep="0">
49843 <colspec colwidth="8*" align="left"/>
49844 <colspec colwidth="6*" align="center"/>
49845 <colspec colwidth="6*" align="center"/>
49846 <colspec colwidth="6*" align="right"/>
49847 <tbody>
49848 <row>
49849 <entry><option>client_password</option></entry>
49850 <entry>Use: <emphasis>spa</emphasis></entry>
49851 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
49852 <entry>Default: <emphasis>unset</emphasis></entry>
49853 </row>
49854 </tbody>
49855 </tgroup>
49856 </informaltable>
49857 <para>
49858 This option specifies the user&#x2019;s password, and must be set.
49859 </para>
49860 <para>
49861 <indexterm role="option">
49862 <primary><option>client_username</option></primary>
49863 </indexterm>
49864 </para>
49865 <informaltable frame="all">
49866 <tgroup cols="4" colsep="0" rowsep="0">
49867 <colspec colwidth="8*" align="left"/>
49868 <colspec colwidth="6*" align="center"/>
49869 <colspec colwidth="6*" align="center"/>
49870 <colspec colwidth="6*" align="right"/>
49871 <tbody>
49872 <row>
49873 <entry><option>client_username</option></entry>
49874 <entry>Use: <emphasis>spa</emphasis></entry>
49875 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
49876 <entry>Default: <emphasis>unset</emphasis></entry>
49877 </row>
49878 </tbody>
49879 </tgroup>
49880 </informaltable>
49881 <para>
49882 This option specifies the user name, and must be set. Here is an example of a
49883 configuration of this authenticator for use with the mail servers at
49884 <emphasis>msn.com</emphasis>:
49885 </para>
49886 <literallayout class="monospaced">
49887 msn:
49888   driver = spa
49889   public_name = MSN
49890   client_username = msn/msn_username
49891   client_password = msn_plaintext_password
49892   client_domain = DOMAIN_OR_UNSET
49893 </literallayout>
49894 <para>
49895 <indexterm role="concept" startref="IIDspaauth1" class="endofrange"/>
49896 <indexterm role="concept" startref="IIDspaauth2" class="endofrange"/>
49897 </para>
49898 </section>
49899 </chapter>
49900
49901 <chapter id="CHAPTLS">
49902 <title>Encrypted SMTP connections using TLS/SSL</title>
49903 <titleabbrev>Encrypted SMTP connections</titleabbrev>
49904 <para>
49905 <indexterm role="concept" id="IIDencsmtp1" class="startofrange">
49906 <primary>encryption</primary>
49907 <secondary>on SMTP connection</secondary>
49908 </indexterm>
49909 <indexterm role="concept" id="IIDencsmtp2" class="startofrange">
49910 <primary>SMTP</primary>
49911 <secondary>encryption</secondary>
49912 </indexterm>
49913 <indexterm role="concept">
49914 <primary>TLS</primary>
49915 <secondary>on SMTP connection</secondary>
49916 </indexterm>
49917 <indexterm role="concept">
49918 <primary>OpenSSL</primary>
49919 </indexterm>
49920 <indexterm role="concept">
49921 <primary>GnuTLS</primary>
49922 </indexterm>
49923 Support for TLS (Transport Layer Security), formerly known as SSL (Secure
49924 Sockets Layer), is implemented by making use of the OpenSSL library or the
49925 GnuTLS library (Exim requires GnuTLS release 1.0 or later). There is no
49926 cryptographic code in the Exim distribution itself for implementing TLS. In
49927 order to use this feature you must install OpenSSL or GnuTLS, and then build a
49928 version of Exim that includes TLS support (see section <xref linkend="SECTinctlsssl"/>).
49929 You also need to understand the basic concepts of encryption at a managerial
49930 level, and in particular, the way that public keys, private keys, and
49931 certificates are used.
49932 </para>
49933 <para>
49934 RFC 3207 defines how SMTP connections can make use of encryption. Once a
49935 connection is established, the client issues a STARTTLS command. If the
49936 server accepts this, the client and the server negotiate an encryption
49937 mechanism. If the negotiation succeeds, the data that subsequently passes
49938 between them is encrypted.
49939 </para>
49940 <para>
49941 Exim&#x2019;s ACLs can detect whether the current SMTP session is encrypted or not,
49942 and if so, what cipher suite is in use, whether the client supplied a
49943 certificate, and whether or not that certificate was verified. This makes it
49944 possible for an Exim server to deny or accept certain commands based on the
49945 encryption state.
49946 </para>
49947 <para>
49948 <emphasis role="bold">Warning</emphasis>: Certain types of firewall and certain anti-virus products can
49949 disrupt TLS connections. You need to turn off SMTP scanning for these products
49950 in order to get TLS to work.
49951 </para>
49952 <section id="SECID284">
49953 <title>Support for the legacy <quote>ssmtp</quote> (aka <quote>smtps</quote>) protocol</title>
49954 <para>
49955 <indexterm role="concept">
49956 <primary>ssmtp protocol</primary>
49957 </indexterm>
49958 <indexterm role="concept">
49959 <primary>smtps protocol</primary>
49960 </indexterm>
49961 <indexterm role="concept">
49962 <primary>SMTP</primary>
49963 <secondary>ssmtp protocol</secondary>
49964 </indexterm>
49965 <indexterm role="concept">
49966 <primary>SMTP</primary>
49967 <secondary>smtps protocol</secondary>
49968 </indexterm>
49969 Early implementations of encrypted SMTP used a different TCP port from normal
49970 SMTP, and expected an encryption negotiation to start immediately, instead of
49971 waiting for a STARTTLS command from the client using the standard SMTP
49972 port. The protocol was called <quote>ssmtp</quote> or <quote>smtps</quote>, and port 465 was
49973 allocated for this purpose.
49974 </para>
49975 <para>
49976 This approach was abandoned when encrypted SMTP was standardized, but there are
49977 still some legacy clients that use it. Exim supports these clients by means of
49978 the <option>tls_on_connect_ports</option> global option. Its value must be a list of port
49979 numbers; the most common use is expected to be:
49980 </para>
49981 <literallayout class="monospaced">
49982 tls_on_connect_ports = 465
49983 </literallayout>
49984 <para>
49985 The port numbers specified by this option apply to all SMTP connections, both
49986 via the daemon and via <emphasis>inetd</emphasis>. You still need to specify all the ports that
49987 the daemon uses (by setting <option>daemon_smtp_ports</option> or <option>local_interfaces</option> or
49988 the <option>-oX</option> command line option) because <option>tls_on_connect_ports</option> does not add
49989 an extra port &ndash; rather, it specifies different behaviour on a port that is
49990 defined elsewhere.
49991 </para>
49992 <para>
49993 There is also a <option>-tls-on-connect</option> command line option. This overrides
49994 <option>tls_on_connect_ports</option>; it forces the legacy behaviour for all ports.
49995 </para>
49996 </section>
49997 <section id="SECTopenvsgnu">
49998 <title>OpenSSL vs GnuTLS</title>
49999 <para>
50000 <indexterm role="concept">
50001 <primary>TLS</primary>
50002 <secondary>OpenSSL <emphasis>vs</emphasis> GnuTLS</secondary>
50003 </indexterm>
50004 The first TLS support in Exim was implemented using OpenSSL. Support for GnuTLS
50005 followed later, when the first versions of GnuTLS were released. To build Exim
50006 to use GnuTLS, you need to set
50007 </para>
50008 <literallayout class="monospaced">
50009 USE_GNUTLS=yes
50010 </literallayout>
50011 <para>
50012 in Local/Makefile, in addition to
50013 </para>
50014 <literallayout class="monospaced">
50015 SUPPORT_TLS=yes
50016 </literallayout>
50017 <para>
50018 You must also set TLS_LIBS and TLS_INCLUDE appropriately, so that the
50019 include files and libraries for GnuTLS can be found.
50020 </para>
50021 <para>
50022 There are some differences in usage when using GnuTLS instead of OpenSSL:
50023 </para>
50024 <itemizedlist>
50025 <listitem>
50026 <para>
50027 The <option>tls_verify_certificates</option> option must contain the name of a file, not the
50028 name of a directory (for OpenSSL it can be either).
50029 </para>
50030 </listitem>
50031 <listitem>
50032 <para>
50033 The default value for <option>tls_dhparam</option> differs for historical reasons.
50034 </para>
50035 </listitem>
50036 <listitem>
50037 <para>
50038 <indexterm role="variable">
50039 <primary><varname>$tls_in_peerdn</varname></primary>
50040 </indexterm>
50041 <indexterm role="variable">
50042 <primary><varname>$tls_out_peerdn</varname></primary>
50043 </indexterm>
50044 Distinguished Name (DN) strings reported by the OpenSSL library use a slash for
50045 separating fields; GnuTLS uses commas, in accordance with RFC 2253. This
50046 affects the value of the <varname>$tls_in_peerdn</varname> and <varname>$tls_out_peerdn</varname> variables.
50047 </para>
50048 </listitem>
50049 <listitem>
50050 <para>
50051 OpenSSL identifies cipher suites using hyphens as separators, for example:
50052 DES-CBC3-SHA. GnuTLS historically used underscores, for example:
50053 RSA_ARCFOUR_SHA. What is more, OpenSSL complains if underscores are present
50054 in a cipher list. To make life simpler, Exim changes underscores to hyphens
50055 for OpenSSL and passes the string unchanged to GnuTLS (expecting the library
50056 to handle its own older variants) when processing lists of cipher suites in the
50057 <option>tls_require_ciphers</option> options (the global option and the <command>smtp</command> transport
50058 option).
50059 </para>
50060 </listitem>
50061 <listitem>
50062 <para>
50063 The <option>tls_require_ciphers</option> options operate differently, as described in the
50064 sections <xref linkend="SECTreqciphssl"/> and <xref linkend="SECTreqciphgnu"/>.
50065 </para>
50066 </listitem>
50067 <listitem>
50068 <para>
50069 The <option>tls_dh_min_bits</option> SMTP transport option is only honoured by GnuTLS.
50070 When using OpenSSL, this option is ignored.
50071 (If an API is found to let OpenSSL be configured in this way,
50072 let the Exim Maintainers know and we&#x2019;ll likely use it).
50073 </para>
50074 </listitem>
50075 <listitem>
50076 <para>
50077 Some other recently added features may only be available in one or the other.
50078 This should be documented with the feature.  If the documentation does not
50079 explicitly state that the feature is infeasible in the other TLS
50080 implementation, then patches are welcome.
50081 </para>
50082 </listitem>
50083 </itemizedlist>
50084 </section>
50085 <section id="SECTgnutlsparam">
50086 <title>GnuTLS parameter computation</title>
50087 <para>
50088 This section only applies if <option>tls_dhparam</option> is set to <literal>historic</literal> or to
50089 an explicit path; if the latter, then the text about generation still applies,
50090 but not the chosen filename.
50091 By default, as of Exim 4.80 a hard-coded D-H prime is used.
50092 See the documentation of <option>tls_dhparam</option> for more information.
50093 </para>
50094 <para>
50095 GnuTLS uses D-H parameters that may take a substantial amount of time
50096 to compute. It is unreasonable to re-compute them for every TLS session.
50097 Therefore, Exim keeps this data in a file in its spool directory, called
50098 <filename>gnutls-params-NNNN</filename> for some value of NNNN, corresponding to the number
50099 of bits requested.
50100 The file is owned by the Exim user and is readable only by
50101 its owner. Every Exim process that start up GnuTLS reads the D-H
50102 parameters from this file. If the file does not exist, the first Exim process
50103 that needs it computes the data and writes it to a temporary file which is
50104 renamed once it is complete. It does not matter if several Exim processes do
50105 this simultaneously (apart from wasting a few resources). Once a file is in
50106 place, new Exim processes immediately start using it.
50107 </para>
50108 <para>
50109 For maximum security, the parameters that are stored in this file should be
50110 recalculated periodically, the frequency depending on your paranoia level.
50111 If you are avoiding using the fixed D-H primes published in RFCs, then you
50112 are concerned about some advanced attacks and will wish to do this; if you do
50113 not regenerate then you might as well stick to the standard primes.
50114 </para>
50115 <para>
50116 Arranging this is easy in principle; just delete the file when you want new
50117 values to be computed. However, there may be a problem. The calculation of new
50118 parameters needs random numbers, and these are obtained from <filename>/dev/random</filename>.
50119 If the system is not very active, <filename>/dev/random</filename> may delay returning data
50120 until enough randomness (entropy) is available. This may cause Exim to hang for
50121 a substantial amount of time, causing timeouts on incoming connections.
50122 </para>
50123 <para>
50124 The solution is to generate the parameters externally to Exim. They are stored
50125 in <filename>gnutls-params-N</filename> in PEM format, which means that they can be
50126 generated externally using the <command>certtool</command> command that is part of GnuTLS.
50127 </para>
50128 <para>
50129 To replace the parameters with new ones, instead of deleting the file
50130 and letting Exim re-create it, you can generate new parameters using
50131 <command>certtool</command> and, when this has been done, replace Exim&#x2019;s cache file by
50132 renaming. The relevant commands are something like this:
50133 </para>
50134 <literallayout class="monospaced">
50135 # ls
50136 [ look for file; assume gnutls-params-2236 is the most recent ]
50137 # rm -f new-params
50138 # touch new-params
50139 # chown exim:exim new-params
50140 # chmod 0600 new-params
50141 # certtool --generate-dh-params --bits 2236 &gt;&gt;new-params
50142 # openssl dhparam -noout -text -in new-params | head
50143 [ check the first line, make sure it's not more than 2236;
50144   if it is, then go back to the start ("rm") and repeat
50145   until the size generated is at most the size requested ]
50146 # chmod 0400 new-params
50147 # mv new-params gnutls-params-2236
50148 </literallayout>
50149 <para>
50150 If Exim never has to generate the parameters itself, the possibility of
50151 stalling is removed.
50152 </para>
50153 <para>
50154 The filename changed in Exim 4.80, to gain the -bits suffix.  The value which
50155 Exim will choose depends upon the version of GnuTLS in use.  For older GnuTLS,
50156 the value remains hard-coded in Exim as 1024.  As of GnuTLS 2.12.x, there is
50157 a way for Exim to ask for the "normal" number of bits for D-H public-key usage,
50158 and Exim does so.  This attempt to remove Exim from TLS policy decisions
50159 failed, as GnuTLS 2.12 returns a value higher than the current hard-coded limit
50160 of the NSS library.  Thus Exim gains the <option>tls_dh_max_bits</option> global option,
50161 which applies to all D-H usage, client or server.  If the value returned by
50162 GnuTLS is greater than <option>tls_dh_max_bits</option> then the value will be clamped down
50163 to <option>tls_dh_max_bits</option>.  The default value has been set at the current NSS
50164 limit, which is still much higher than Exim historically used.
50165 </para>
50166 <para>
50167 The filename and bits used will change as the GnuTLS maintainers change the
50168 value for their parameter <literal>GNUTLS_SEC_PARAM_NORMAL</literal>, as clamped by
50169 <option>tls_dh_max_bits</option>.  At the time of writing (mid 2012), GnuTLS 2.12 recommends
50170 2432 bits, while NSS is limited to 2236 bits.
50171 </para>
50172 <para>
50173 In fact, the requested value will be *lower* than <option>tls_dh_max_bits</option>, to
50174 increase the chance of the generated prime actually being within acceptable
50175 bounds, as GnuTLS has been observed to overshoot.  Note the check step in the
50176 procedure above.  There is no sane procedure available to Exim to double-check
50177 the size of the generated prime, so it might still be too large.
50178 </para>
50179 </section>
50180 <section id="SECTreqciphssl">
50181 <title>Requiring specific ciphers in OpenSSL</title>
50182 <para>
50183 <indexterm role="concept">
50184 <primary>TLS</primary>
50185 <secondary>requiring specific ciphers (OpenSSL)</secondary>
50186 </indexterm>
50187 <indexterm role="option">
50188 <primary><option>tls_require_ciphers</option></primary>
50189 <secondary>OpenSSL</secondary>
50190 </indexterm>
50191 There is a function in the OpenSSL library that can be passed a list of cipher
50192 suites before the cipher negotiation takes place. This specifies which ciphers
50193 are acceptable. The list is colon separated and may contain names like
50194 DES-CBC3-SHA. Exim passes the expanded value of <option>tls_require_ciphers</option>
50195 directly to this function call.
50196 Many systems will install the OpenSSL manual-pages, so you may have
50197 <emphasis>ciphers(1)</emphasis> available to you.
50198 The following quotation from the OpenSSL
50199 documentation specifies what forms of item are allowed in the cipher string:
50200 </para>
50201 <itemizedlist>
50202 <listitem>
50203 <para>
50204 It can consist of a single cipher suite such as RC4-SHA.
50205 </para>
50206 </listitem>
50207 <listitem>
50208 <para>
50209 It can represent a list of cipher suites containing a certain algorithm,
50210 or cipher suites of a certain type. For example SHA1 represents all
50211 ciphers suites using the digest algorithm SHA1 and SSLv3 represents all
50212 SSL v3 algorithms.
50213 </para>
50214 </listitem>
50215 <listitem>
50216 <para>
50217 Lists of cipher suites can be combined in a single cipher string using
50218 the + character. This is used as a logical and operation. For example
50219 SHA1+DES represents all cipher suites containing the SHA1 and the DES
50220 algorithms.
50221 </para>
50222 </listitem>
50223 </itemizedlist>
50224 <para>
50225 Each cipher string can be optionally preceded by one of the characters <literal>!</literal>,
50226 <literal>-</literal> or <literal>+</literal>.
50227 </para>
50228 <itemizedlist>
50229 <listitem>
50230 <para>
50231 If <literal>!</literal> is used, the ciphers are permanently deleted from the list. The
50232 ciphers deleted can never reappear in the list even if they are explicitly
50233 stated.
50234 </para>
50235 </listitem>
50236 <listitem>
50237 <para>
50238 If <literal>-</literal> is used, the ciphers are deleted from the list, but some or all
50239 of the ciphers can be added again by later options.
50240 </para>
50241 </listitem>
50242 <listitem>
50243 <para>
50244 If <literal>+</literal> is used, the ciphers are moved to the end of the list. This
50245 option does not add any new ciphers; it just moves matching existing ones.
50246 </para>
50247 </listitem>
50248 </itemizedlist>
50249 <para>
50250 If none of these characters is present, the string is interpreted as
50251 a list of ciphers to be appended to the current preference list. If the list
50252 includes any ciphers already present they will be ignored: that is, they will
50253 not be moved to the end of the list.
50254 </para>
50255 <para>
50256 The OpenSSL <emphasis>ciphers(1)</emphasis> command may be used to test the results of a given
50257 string:
50258 </para>
50259 <literallayout class="monospaced">
50260 # note single-quotes to get ! past any shell history expansion
50261 $ openssl ciphers 'HIGH:!MD5:!SHA1'
50262 </literallayout>
50263 <para>
50264 This example will let the library defaults be permitted on the MX port, where
50265 there&#x2019;s probably no identity verification anyway, but ups the ante on the
50266 submission ports where the administrator might have some influence on the
50267 choice of clients used:
50268 </para>
50269 <literallayout class="monospaced">
50270 # OpenSSL variant; see man ciphers(1)
50271 tls_require_ciphers = ${if =={$received_port}{25}\
50272                            {DEFAULT}\
50273                            {HIGH:!MD5:!SHA1}}
50274 </literallayout>
50275 </section>
50276 <section id="SECTreqciphgnu">
50277 <title>Requiring specific ciphers or other parameters in GnuTLS</title>
50278 <para>
50279 <indexterm role="concept">
50280 <primary>GnuTLS</primary>
50281 <secondary>specifying parameters for</secondary>
50282 </indexterm>
50283 <indexterm role="concept">
50284 <primary>TLS</primary>
50285 <secondary>specifying ciphers (GnuTLS)</secondary>
50286 </indexterm>
50287 <indexterm role="concept">
50288 <primary>TLS</primary>
50289 <secondary>specifying key exchange methods (GnuTLS)</secondary>
50290 </indexterm>
50291 <indexterm role="concept">
50292 <primary>TLS</primary>
50293 <secondary>specifying MAC algorithms (GnuTLS)</secondary>
50294 </indexterm>
50295 <indexterm role="concept">
50296 <primary>TLS</primary>
50297 <secondary>specifying protocols (GnuTLS)</secondary>
50298 </indexterm>
50299 <indexterm role="concept">
50300 <primary>TLS</primary>
50301 <secondary>specifying priority string (GnuTLS)</secondary>
50302 </indexterm>
50303 <indexterm role="option">
50304 <primary><option>tls_require_ciphers</option></primary>
50305 <secondary>GnuTLS</secondary>
50306 </indexterm>
50307 The GnuTLS library allows the caller to provide a "priority string", documented
50308 as part of the <function>gnutls_priority_init</function> function.  This is very similar to the
50309 ciphersuite specification in OpenSSL.
50310 </para>
50311 <para>
50312 The <option>tls_require_ciphers</option> option is treated as the GnuTLS priority string.
50313 </para>
50314 <para>
50315 The <option>tls_require_ciphers</option> option is available both as an global option,
50316 controlling how Exim behaves as a server, and also as an option of the
50317 <command>smtp</command> transport, controlling how Exim behaves as a client.  In both cases
50318 the value is string expanded.  The resulting string is not an Exim list and
50319 the string is given to the GnuTLS library, so that Exim does not need to be
50320 aware of future feature enhancements of GnuTLS.
50321 </para>
50322 <para>
50323 Documentation of the strings accepted may be found in the GnuTLS manual, under
50324 "Priority strings".  This is online as
50325 <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>,
50326 but beware that this relates to GnuTLS 3, which may be newer than the version
50327 installed on your system.  If you are using GnuTLS 3,
50328 <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>
50329 on that site can be used to test a given string.
50330 </para>
50331 <para>
50332 Prior to Exim 4.80, an older API of GnuTLS was used, and Exim supported three
50333 additional options, "<option>gnutls_require_kx</option>", "<option>gnutls_require_mac</option>" and
50334 "<option>gnutls_require_protocols</option>".  <option>tls_require_ciphers</option> was an Exim list.
50335 </para>
50336 <para>
50337 This example will let the library defaults be permitted on the MX port, where
50338 there&#x2019;s probably no identity verification anyway, and lowers security further
50339 by increasing compatibility; but this ups the ante on the submission ports
50340 where the administrator might have some influence on the choice of clients
50341 used:
50342 </para>
50343 <literallayout class="monospaced">
50344 # GnuTLS variant
50345 tls_require_ciphers = ${if =={$received_port}{25}\
50346                            {NORMAL:%COMPAT}\
50347                            {SECURE128}}
50348 </literallayout>
50349 </section>
50350 <section id="SECID182">
50351 <title>Configuring an Exim server to use TLS</title>
50352 <para>
50353 <indexterm role="concept">
50354 <primary>TLS</primary>
50355 <secondary>configuring an Exim server</secondary>
50356 </indexterm>
50357 When Exim has been built with TLS support, it advertises the availability of
50358 the STARTTLS command to client hosts that match <option>tls_advertise_hosts</option>,
50359 but not to any others. The default value of this option is unset, which means
50360 that STARTTLS is not advertised at all. This default is chosen because you
50361 need to set some other options in order to make TLS available, and also it is
50362 sensible for systems that want to use TLS only as a client.
50363 </para>
50364 <para>
50365 If a client issues a STARTTLS command and there is some configuration
50366 problem in the server, the command is rejected with a 454 error. If the client
50367 persists in trying to issue SMTP commands, all except QUIT are rejected
50368 with the error
50369 </para>
50370 <literallayout class="monospaced">
50371 554 Security failure
50372 </literallayout>
50373 <para>
50374 If a STARTTLS command is issued within an existing TLS session, it is
50375 rejected with a 554 error code.
50376 </para>
50377 <para>
50378 To enable TLS operations on a server, you must set <option>tls_advertise_hosts</option> to
50379 match some hosts. You can, of course, set it to * to match all hosts.
50380 However, this is not all you need to do. TLS sessions to a server won&#x2019;t work
50381 without some further configuration at the server end.
50382 </para>
50383 <para>
50384 It is rumoured that all existing clients that support TLS/SSL use RSA
50385 encryption. To make this work you need to set, in the server,
50386 </para>
50387 <literallayout class="monospaced">
50388 tls_certificate = /some/file/name
50389 tls_privatekey = /some/file/name
50390 </literallayout>
50391 <para>
50392 These options are, in fact, expanded strings, so you can make them depend on
50393 the identity of the client that is connected if you wish. The first file
50394 contains the server&#x2019;s X509 certificate, and the second contains the private key
50395 that goes with it. These files need to be readable by the Exim user, and must
50396 always be given as full path names. They can be the same file if both the
50397 certificate and the key are contained within it. If <option>tls_privatekey</option> is not
50398 set, or if its expansion is forced to fail or results in an empty string, this
50399 is assumed to be the case. The certificate file may also contain intermediate
50400 certificates that need to be sent to the client to enable it to authenticate
50401 the server&#x2019;s certificate.
50402 </para>
50403 <para>
50404 If you do not understand about certificates and keys, please try to find a
50405 source of this background information, which is not Exim-specific. (There are a
50406 few comments below in section <xref linkend="SECTcerandall"/>.)
50407 </para>
50408 <para>
50409 <emphasis role="bold">Note</emphasis>: These options do not apply when Exim is operating as a client &ndash;
50410 they apply only in the case of a server. If you need to use a certificate in an
50411 Exim client, you must set the options of the same names in an <command>smtp</command>
50412 transport.
50413 </para>
50414 <para>
50415 With just these options, an Exim server will be able to use TLS. It does not
50416 require the client to have a certificate (but see below for how to insist on
50417 this). There is one other option that may be needed in other situations. If
50418 </para>
50419 <literallayout class="monospaced">
50420 tls_dhparam = /some/file/name
50421 </literallayout>
50422 <para>
50423 is set, the SSL library is initialized for the use of Diffie-Hellman ciphers
50424 with the parameters contained in the file.
50425 Set this to <literal>none</literal> to disable use of DH entirely, by making no prime
50426 available:
50427 </para>
50428 <literallayout class="monospaced">
50429 tls_dhparam = none
50430 </literallayout>
50431 <para>
50432 This may also be set to a string identifying a standard prime to be used for
50433 DH; if it is set to <literal>default</literal> or, for OpenSSL, is unset, then the prime
50434 used is <literal>ike23</literal>.  There are a few standard primes available, see the
50435 documentation for <option>tls_dhparam</option> for the complete list.
50436 </para>
50437 <para>
50438 See the command
50439 </para>
50440 <literallayout class="monospaced">
50441 openssl dhparam
50442 </literallayout>
50443 <para>
50444 for a way of generating file data.
50445 </para>
50446 <para>
50447 The strings supplied for these three options are expanded every time a client
50448 host connects. It is therefore possible to use different certificates and keys
50449 for different hosts, if you so wish, by making use of the client&#x2019;s IP address
50450 in <varname>$sender_host_address</varname> to control the expansion. If a string expansion is
50451 forced to fail, Exim behaves as if the option is not set.
50452 </para>
50453 <para>
50454 <indexterm role="concept">
50455 <primary>cipher</primary>
50456 <secondary>logging</secondary>
50457 </indexterm>
50458 <indexterm role="concept">
50459 <primary>log</primary>
50460 <secondary>TLS cipher</secondary>
50461 </indexterm>
50462 <indexterm role="variable">
50463 <primary><varname>$tls_in_cipher</varname></primary>
50464 </indexterm>
50465 The variable <varname>$tls_in_cipher</varname> is set to the cipher suite that was negotiated for
50466 an incoming TLS connection. It is included in the <emphasis>Received:</emphasis> header of an
50467 incoming message (by default &ndash; you can, of course, change this), and it is
50468 also included in the log line that records a message&#x2019;s arrival, keyed by
50469 <quote>X=</quote>, unless the <option>tls_cipher</option> log selector is turned off. The <option>encrypted</option>
50470 condition can be used to test for specific cipher suites in ACLs.
50471 </para>
50472 <para>
50473 Once TLS has been established, the ACLs that run for subsequent SMTP commands
50474 can check the name of the cipher suite and vary their actions accordingly. The
50475 cipher suite names vary, depending on which TLS library is being used. For
50476 example, OpenSSL uses the name DES-CBC3-SHA for the cipher suite which in other
50477 contexts is known as TLS_RSA_WITH_3DES_EDE_CBC_SHA. Check the OpenSSL or GnuTLS
50478 documentation for more details.
50479 </para>
50480 <para>
50481 For outgoing SMTP deliveries, <varname>$tls_out_cipher</varname> is used and logged
50482 (again depending on the <option>tls_cipher</option> log selector).
50483 </para>
50484 </section>
50485 <section id="SECID183">
50486 <title>Requesting and verifying client certificates</title>
50487 <para>
50488 <indexterm role="concept">
50489 <primary>certificate</primary>
50490 <secondary>verification of client</secondary>
50491 </indexterm>
50492 <indexterm role="concept">
50493 <primary>TLS</primary>
50494 <secondary>client certificate verification</secondary>
50495 </indexterm>
50496 If you want an Exim server to request a certificate when negotiating a TLS
50497 session with a client, you must set either <option>tls_verify_hosts</option> or
50498 <option>tls_try_verify_hosts</option>. You can, of course, set either of them to * to
50499 apply to all TLS connections. For any host that matches one of these options,
50500 Exim requests a certificate as part of the setup of the TLS session. The
50501 contents of the certificate are verified by comparing it with a list of
50502 expected certificates. These must be available in a file or,
50503 for OpenSSL only (not GnuTLS), a directory, identified by
50504 <option>tls_verify_certificates</option>.
50505 </para>
50506 <para>
50507 A file can contain multiple certificates, concatenated end to end. If a
50508 directory is used
50509 (OpenSSL only),
50510 each certificate must be in a separate file, with a name (or a symbolic link)
50511 of the form &lt;<emphasis>hash</emphasis>&gt;.0, where &lt;<emphasis>hash</emphasis>&gt; is a hash value constructed from the
50512 certificate. You can compute the relevant hash by running the command
50513 </para>
50514 <literallayout class="monospaced">
50515 openssl x509 -hash -noout -in /cert/file
50516 </literallayout>
50517 <para>
50518 where <filename>/cert/file</filename> contains a single certificate.
50519 </para>
50520 <para>
50521 The difference between <option>tls_verify_hosts</option> and <option>tls_try_verify_hosts</option> is
50522 what happens if the client does not supply a certificate, or if the certificate
50523 does not match any of the certificates in the collection named by
50524 <option>tls_verify_certificates</option>. If the client matches <option>tls_verify_hosts</option>, the
50525 attempt to set up a TLS session is aborted, and the incoming connection is
50526 dropped. If the client matches <option>tls_try_verify_hosts</option>, the (encrypted) SMTP
50527 session continues. ACLs that run for subsequent SMTP commands can detect the
50528 fact that no certificate was verified, and vary their actions accordingly. For
50529 example, you can insist on a certificate before accepting a message for
50530 relaying, but not when the message is destined for local delivery.
50531 </para>
50532 <para>
50533 <indexterm role="variable">
50534 <primary><varname>$tls_in_peerdn</varname></primary>
50535 </indexterm>
50536 When a client supplies a certificate (whether it verifies or not), the value of
50537 the Distinguished Name of the certificate is made available in the variable
50538 <varname>$tls_in_peerdn</varname> during subsequent processing of the message.
50539 </para>
50540 <para>
50541 <indexterm role="concept">
50542 <primary>log</primary>
50543 <secondary>distinguished name</secondary>
50544 </indexterm>
50545 Because it is often a long text string, it is not included in the log line or
50546 <emphasis>Received:</emphasis> header by default. You can arrange for it to be logged, keyed by
50547 <quote>DN=</quote>, by setting the <option>tls_peerdn</option> log selector, and you can use
50548 <option>received_header_text</option> to change the <emphasis>Received:</emphasis> header. When no
50549 certificate is supplied, <varname>$tls_in_peerdn</varname> is empty.
50550 </para>
50551 </section>
50552 <section id="SECID184">
50553 <title>Revoked certificates</title>
50554 <para>
50555 <indexterm role="concept">
50556 <primary>TLS</primary>
50557 <secondary>revoked certificates</secondary>
50558 </indexterm>
50559 <indexterm role="concept">
50560 <primary>revocation list</primary>
50561 </indexterm>
50562 <indexterm role="concept">
50563 <primary>certificate</primary>
50564 <secondary>revocation list</secondary>
50565 </indexterm>
50566 <indexterm role="concept">
50567 <primary>OCSP</primary>
50568 <secondary>stapling</secondary>
50569 </indexterm>
50570 Certificate issuing authorities issue Certificate Revocation Lists (CRLs) when
50571 certificates are revoked. If you have such a list, you can pass it to an Exim
50572 server using the global option called <option>tls_crl</option> and to an Exim client using
50573 an identically named option for the <command>smtp</command> transport. In each case, the value
50574 of the option is expanded and must then be the name of a file that contains a
50575 CRL in PEM format.
50576 The downside is that clients have to periodically re-download a potentially huge
50577 file from every certificate authority the know of.
50578 </para>
50579 <para>
50580 The way with most moving parts at query time is Online Certificate
50581 Status Protocol (OCSP), where the client verifies the certificate
50582 against an OCSP server run by the CA.  This lets the CA track all
50583 usage of the certs.  It requires running software with access to the
50584 private key of the CA, to sign the responses to the OCSP queries.  OCSP
50585 is based on HTTP and can be proxied accordingly.
50586 </para>
50587 <para>
50588 The only widespread OCSP server implementation (known to this writer)
50589 comes as part of OpenSSL and aborts on an invalid request, such as
50590 connecting to the port and then disconnecting.  This requires
50591 re-entering the passphrase each time some random client does this.
50592 </para>
50593 <para>
50594 The third way is OCSP Stapling; in this, the server using a certificate
50595 issued by the CA periodically requests an OCSP proof of validity from
50596 the OCSP server, then serves it up inline as part of the TLS
50597 negotiation.   This approach adds no extra round trips, does not let the
50598 CA track users, scales well with number of certs issued by the CA and is
50599 resilient to temporary OCSP server failures, as long as the server
50600 starts retrying to fetch an OCSP proof some time before its current
50601 proof expires.  The downside is that it requires server support.
50602 </para>
50603 <para>
50604 Unless Exim is built with the support disabled,
50605 or with GnuTLS earlier than version 3.1.3,
50606 support for OCSP stapling is included.
50607 </para>
50608 <para>
50609 There is a global option called <option>tls_ocsp_file</option>.
50610 The file specified therein is expected to be in DER format, and contain
50611 an OCSP proof.  Exim will serve it as part of the TLS handshake.  This
50612 option will be re-expanded for SNI, if the <option>tls_certificate</option> option
50613 contains <literal>tls_in_sni</literal>, as per other TLS options.
50614 </para>
50615 <para>
50616 Exim does not at this time implement any support for fetching a new OCSP
50617 proof.  The burden is on the administrator to handle this, outside of
50618 Exim.  The file specified should be replaced atomically, so that the
50619 contents are always valid.  Exim will expand the <option>tls_ocsp_file</option> option
50620 on each connection, so a new file will be handled transparently on the
50621 next connection.
50622 </para>
50623 <para>
50624 When built with OpenSSL Exim will check for a valid next update timestamp
50625 in the OCSP proof; if not present, or if the proof has expired, it will be
50626 ignored.
50627 </para>
50628 <para>
50629 For the client to be able to verify the stapled OCSP the server must
50630 also supply, in its stapled information, any intermediate
50631 certificates for the chain leading to the OCSP proof from the signer
50632 of the server certificate.  There may be zero or one such. These
50633 intermediate certificates should be added to the server OCSP stapling
50634 file named by <option>tls_ocsp_file</option>.
50635 </para>
50636 <para>
50637 Note that the proof only covers the terminal server certificate,
50638 not any of the chain from CA to it.
50639 </para>
50640 <para revisionflag="changed">
50641 There is no current way to staple a proof for a client certificate.
50642 </para>
50643 <literallayout class="monospaced">
50644   A helper script "ocsp_fetch.pl" for fetching a proof from a CA
50645   OCSP server is supplied.  The server URL may be included in the
50646   server certificate, if the CA is helpful.
50647
50648   One failure mode seen was the OCSP Signer cert expiring before the end
50649   of validity of the OCSP proof. The checking done by Exim/OpenSSL
50650   noted this as invalid overall, but the re-fetch script did not.
50651 </literallayout>
50652 </section>
50653 <section id="SECID185">
50654 <title>Configuring an Exim client to use TLS</title>
50655 <para>
50656 <indexterm role="concept">
50657 <primary>cipher</primary>
50658 <secondary>logging</secondary>
50659 </indexterm>
50660 <indexterm role="concept">
50661 <primary>log</primary>
50662 <secondary>TLS cipher</secondary>
50663 </indexterm>
50664 <indexterm role="concept">
50665 <primary>log</primary>
50666 <secondary>distinguished name</secondary>
50667 </indexterm>
50668 <indexterm role="concept">
50669 <primary>TLS</primary>
50670 <secondary>configuring an Exim client</secondary>
50671 </indexterm>
50672 The <option>tls_cipher</option> and <option>tls_peerdn</option> log selectors apply to outgoing SMTP
50673 deliveries as well as to incoming, the latter one causing logging of the
50674 server certificate&#x2019;s DN. The remaining client configuration for TLS is all
50675 within the <command>smtp</command> transport.
50676 </para>
50677 <para>
50678 It is not necessary to set any options to have TLS work in the <command>smtp</command>
50679 transport. If Exim is built with TLS support, and TLS is advertised by a
50680 server, the <command>smtp</command> transport always tries to start a TLS session. However,
50681 this can be prevented by setting <option>hosts_avoid_tls</option> (an option of the
50682 transport) to a list of server hosts for which TLS should not be used.
50683 </para>
50684 <para>
50685 If you do not want Exim to attempt to send messages unencrypted when an attempt
50686 to set up an encrypted connection fails in any way, you can set
50687 <option>hosts_require_tls</option> to a list of hosts for which encryption is mandatory. For
50688 those hosts, delivery is always deferred if an encrypted connection cannot be
50689 set up. If there are any other hosts for the address, they are tried in the
50690 usual way.
50691 </para>
50692 <para>
50693 When the server host is not in <option>hosts_require_tls</option>, Exim may try to deliver
50694 the message unencrypted. It always does this if the response to STARTTLS is
50695 a 5<emphasis>xx</emphasis> code. For a temporary error code, or for a failure to negotiate a TLS
50696 session after a success response code, what happens is controlled by the
50697 <option>tls_tempfail_tryclear</option> option of the <command>smtp</command> transport. If it is false,
50698 delivery to this host is deferred, and other hosts (if available) are tried. If
50699 it is true, Exim attempts to deliver unencrypted after a 4<emphasis>xx</emphasis> response to
50700 STARTTLS, and if STARTTLS is accepted, but the subsequent TLS
50701 negotiation fails, Exim closes the current connection (because it is in an
50702 unknown state), opens a new one to the same host, and then tries the delivery
50703 unencrypted.
50704 </para>
50705 <para>
50706 The <option>tls_certificate</option> and <option>tls_privatekey</option> options of the <command>smtp</command>
50707 transport provide the client with a certificate, which is passed to the server
50708 if it requests it. If the server is Exim, it will request a certificate only if
50709 <option>tls_verify_hosts</option> or <option>tls_try_verify_hosts</option> matches the client.
50710 </para>
50711 <para>
50712 If the <option>tls_verify_certificates</option> option is set on the <command>smtp</command> transport, it
50713 must name a file or,
50714 for OpenSSL only (not GnuTLS), a directory, that contains a collection of
50715 expected server certificates. The client verifies the server&#x2019;s certificate
50716 against this collection, taking into account any revoked certificates that are
50717 in the list defined by <option>tls_crl</option>.
50718 Failure to verify fails the TLS connection unless either of the
50719 <option>tls_verify_hosts</option> or <option>tls_try_verify_hosts</option> options are set.
50720 </para>
50721 <para>
50722 The <option>tls_verify_hosts</option> and <option>tls_try_verify_hosts</option> options restrict
50723 certificate verification to the listed servers.  Verification either must
50724 or need not succeed respectively.
50725 </para>
50726 <para>
50727 The <command>smtp</command> transport has two OCSP-related options:
50728 <option>hosts_require_ocsp</option>; a host-list for which a Certificate Status
50729 is requested and required for the connection to proceed.  The default
50730 value is empty.
50731 <option>hosts_request_ocsp</option>; a host-list for which (additionally)
50732 a Certificate Status is requested (but not necessarily verified).  The default
50733 value is "*" meaning that requests are made unless configured
50734 otherwise.
50735 </para>
50736 <para>
50737 The host(s) should also be in <option>hosts_require_tls</option>, and
50738 <option>tls_verify_certificates</option> configured for the transport,
50739 for OCSP to be relevant.
50740 </para>
50741 <para>
50742 If
50743 <option>tls_require_ciphers</option> is set on the <command>smtp</command> transport, it must contain a
50744 list of permitted cipher suites. If either of these checks fails, delivery to
50745 the current host is abandoned, and the <command>smtp</command> transport tries to deliver to
50746 alternative hosts, if any.
50747 </para>
50748 <para>
50749  <emphasis role="bold">Note</emphasis>:
50750 These options must be set in the <command>smtp</command> transport for Exim to use TLS when it
50751 is operating as a client. Exim does not assume that a server certificate (set
50752 by the global options of the same name) should also be used when operating as a
50753 client.
50754 </para>
50755 <para>
50756 <indexterm role="variable">
50757 <primary><varname>$host</varname></primary>
50758 </indexterm>
50759 <indexterm role="variable">
50760 <primary><varname>$host_address</varname></primary>
50761 </indexterm>
50762 All the TLS options in the <command>smtp</command> transport are expanded before use, with
50763 <varname>$host</varname> and <varname>$host_address</varname> containing the name and address of the server to
50764 which the client is connected. Forced failure of an expansion causes Exim to
50765 behave as if the relevant option were unset.
50766 </para>
50767 <para>
50768 <indexterm role="variable">
50769 <primary><varname>$tls_out_bits</varname></primary>
50770 </indexterm>
50771 <indexterm role="variable">
50772 <primary><varname>$tls_out_cipher</varname></primary>
50773 </indexterm>
50774 <indexterm role="variable">
50775 <primary><varname>$tls_out_peerdn</varname></primary>
50776 </indexterm>
50777 <indexterm role="variable">
50778 <primary><varname>$tls_out_sni</varname></primary>
50779 </indexterm>
50780 Before an SMTP connection is established, the
50781 <varname>$tls_out_bits</varname>, <varname>$tls_out_cipher</varname>, <varname>$tls_out_peerdn</varname> and <varname>$tls_out_sni</varname>
50782 variables are emptied. (Until the first connection, they contain the values
50783 that were set when the message was received.) If STARTTLS is subsequently
50784 successfully obeyed, these variables are set to the relevant values for the
50785 outgoing connection.
50786 </para>
50787 </section>
50788 <section id="SECTtlssni">
50789 <title>Use of TLS Server Name Indication</title>
50790 <para>
50791 <indexterm role="concept">
50792 <primary>TLS</primary>
50793 <secondary>Server Name Indication</secondary>
50794 </indexterm>
50795 <indexterm role="variable">
50796 <primary><varname>$tls_in_sni</varname></primary>
50797 </indexterm>
50798 <indexterm role="option">
50799 <primary><option>tls_in_sni</option></primary>
50800 </indexterm>
50801 With TLS1.0 or above, there is an extension mechanism by which extra
50802 information can be included at various points in the protocol.  One of these
50803 extensions, documented in RFC 6066 (and before that RFC 4366) is
50804 <quote>Server Name Indication</quote>, commonly <quote>SNI</quote>.  This extension is sent by the
50805 client in the initial handshake, so that the server can examine the servername
50806 within and possibly choose to use different certificates and keys (and more)
50807 for this session.
50808 </para>
50809 <para>
50810 This is analagous to HTTP&#x2019;s <quote>Host:</quote> header, and is the main mechanism by
50811 which HTTPS-enabled web-sites can be virtual-hosted, many sites to one IP
50812 address.
50813 </para>
50814 <para>
50815 With SMTP to MX, there are the same problems here as in choosing the identity
50816 against which to validate a certificate: you can&#x2019;t rely on insecure DNS to
50817 provide the identity which you then cryptographically verify.  So this will
50818 be of limited use in that environment.
50819 </para>
50820 <para>
50821 With SMTP to Submission, there is a well-defined hostname which clients are
50822 connecting to and can validate certificates against.  Thus clients <emphasis role="bold">can</emphasis>
50823 choose to include this information in the TLS negotiation.  If this becomes
50824 wide-spread, then hosters can choose to present different certificates to
50825 different clients.  Or even negotiate different cipher suites.
50826 </para>
50827 <para>
50828 The <option>tls_sni</option> option on an SMTP transport is an expanded string; the result,
50829 if not empty, will be sent on a TLS session as part of the handshake.  There&#x2019;s
50830 nothing more to it.  Choosing a sensible value not derived insecurely is the
50831 only point of caution.  The <varname>$tls_out_sni</varname> variable will be set to this string
50832 for the lifetime of the client connection (including during authentication).
50833 </para>
50834 <para>
50835 Except during SMTP client sessions, if <varname>$tls_in_sni</varname> is set then it is a string
50836 received from a client.
50837 It can be logged with the <option>log_selector</option> item <literal>+tls_sni</literal>.
50838 </para>
50839 <para>
50840 If the string <literal>tls_in_sni</literal> appears in the main section&#x2019;s <option>tls_certificate</option>
50841 option (prior to expansion) then the following options will be re-expanded
50842 during TLS session handshake, to permit alternative values to be chosen:
50843 </para>
50844 <itemizedlist>
50845 <listitem>
50846 <para>
50847 <indexterm role="variable">
50848 <primary><option>tls_certificate</option></primary>
50849 </indexterm>
50850 <option>tls_certificate</option>
50851 </para>
50852 </listitem>
50853 <listitem>
50854 <para>
50855 <indexterm role="variable">
50856 <primary><option>tls_crl</option></primary>
50857 </indexterm>
50858 <option>tls_crl</option>
50859 </para>
50860 </listitem>
50861 <listitem>
50862 <para>
50863 <indexterm role="variable">
50864 <primary><option>tls_privatekey</option></primary>
50865 </indexterm>
50866 <option>tls_privatekey</option>
50867 </para>
50868 </listitem>
50869 <listitem>
50870 <para>
50871 <indexterm role="variable">
50872 <primary><option>tls_verify_certificates</option></primary>
50873 </indexterm>
50874 <option>tls_verify_certificates</option>
50875 </para>
50876 </listitem>
50877 <listitem>
50878 <para>
50879 <indexterm role="variable">
50880 <primary><option>tls_ocsp_file</option></primary>
50881 </indexterm>
50882 <option>tls_verify_certificates</option>
50883 </para>
50884 </listitem>
50885 </itemizedlist>
50886 <para>
50887 Great care should be taken to deal with matters of case, various injection
50888 attacks in the string (<literal>../</literal> or SQL), and ensuring that a valid filename
50889 can always be referenced; it is important to remember that <varname>$tls_sni</varname> is
50890 arbitrary unverified data provided prior to authentication.
50891 </para>
50892 <para>
50893 The Exim developers are proceeding cautiously and so far no other TLS options
50894 are re-expanded.
50895 </para>
50896 <para>
50897 When Exim is built againt OpenSSL, OpenSSL must have been built with support
50898 for TLS Extensions.  This holds true for OpenSSL 1.0.0+ and 0.9.8+ with
50899 enable-tlsext in EXTRACONFIGURE.  If you invoke <command>openssl s_client -h</command> and
50900 see <literal>-servername</literal> in the output, then OpenSSL has support.
50901 </para>
50902 <para>
50903 When Exim is built against GnuTLS, SNI support is available as of GnuTLS
50904 0.5.10.  (Its presence predates the current API which Exim uses, so if Exim
50905 built, then you have SNI support).
50906 </para>
50907 </section>
50908 <section id="SECTmulmessam">
50909 <title>Multiple messages on the same encrypted TCP/IP connection</title>
50910 <para>
50911 <indexterm role="concept">
50912 <primary>multiple SMTP deliveries with TLS</primary>
50913 </indexterm>
50914 <indexterm role="concept">
50915 <primary>TLS</primary>
50916 <secondary>multiple message deliveries</secondary>
50917 </indexterm>
50918 Exim sends multiple messages down the same TCP/IP connection by starting up
50919 an entirely new delivery process for each message, passing the socket from
50920 one process to the next. This implementation does not fit well with the use
50921 of TLS, because there is quite a lot of state information associated with a TLS
50922 connection, not just a socket identification. Passing all the state information
50923 to a new process is not feasible. Consequently, Exim shuts down an existing TLS
50924 session before passing the socket to a new process. The new process may then
50925 try to start a new TLS session, and if successful, may try to re-authenticate
50926 if AUTH is in use, before sending the next message.
50927 </para>
50928 <para>
50929 The RFC is not clear as to whether or not an SMTP session continues in clear
50930 after TLS has been shut down, or whether TLS may be restarted again later, as
50931 just described. However, if the server is Exim, this shutdown and
50932 reinitialization works. It is not known which (if any) other servers operate
50933 successfully if the client closes a TLS session and continues with unencrypted
50934 SMTP, but there are certainly some that do not work. For such servers, Exim
50935 should not pass the socket to another process, because the failure of the
50936 subsequent attempt to use it would cause Exim to record a temporary host error,
50937 and delay other deliveries to that host.
50938 </para>
50939 <para>
50940 To test for this case, Exim sends an EHLO command to the server after
50941 closing down the TLS session. If this fails in any way, the connection is
50942 closed instead of being passed to a new delivery process, but no retry
50943 information is recorded.
50944 </para>
50945 <para>
50946 There is also a manual override; you can set <option>hosts_nopass_tls</option> on the
50947 <command>smtp</command> transport to match those hosts for which Exim should not pass
50948 connections to new processes if TLS has been used.
50949 </para>
50950 </section>
50951 <section id="SECTcerandall">
50952 <title>Certificates and all that</title>
50953 <para>
50954 <indexterm role="concept">
50955 <primary>certificate</primary>
50956 <secondary>references to discussion</secondary>
50957 </indexterm>
50958 In order to understand fully how TLS works, you need to know about
50959 certificates, certificate signing, and certificate authorities. This is not the
50960 place to give a tutorial, especially as I do not know very much about it
50961 myself. Some helpful introduction can be found in the FAQ for the SSL addition
50962 to Apache, currently at
50963 </para>
50964 <literallayout>
50965 <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>
50966 </literallayout>
50967 <para>
50968 Other parts of the <emphasis>modssl</emphasis> documentation are also helpful, and have
50969 links to further files.
50970 Eric Rescorla&#x2019;s book, <emphasis>SSL and TLS</emphasis>, published by Addison-Wesley (ISBN
50971 0-201-61598-3), contains both introductory and more in-depth descriptions.
50972 Some sample programs taken from the book are available from
50973 </para>
50974 <literallayout>
50975 <emphasis role="bold"><ulink url="http://www.rtfm.com/openssl-examples/">http://www.rtfm.com/openssl-examples/</ulink></emphasis>
50976 </literallayout>
50977 </section>
50978 <section id="SECID186">
50979 <title>Certificate chains</title>
50980 <para>
50981 The file named by <option>tls_certificate</option> may contain more than one
50982 certificate. This is useful in the case where the certificate that is being
50983 sent is validated by an intermediate certificate which the other end does
50984 not have. Multiple certificates must be in the correct order in the file.
50985 First the host&#x2019;s certificate itself, then the first intermediate
50986 certificate to validate the issuer of the host certificate, then the next
50987 intermediate certificate to validate the issuer of the first intermediate
50988 certificate, and so on, until finally (optionally) the root certificate.
50989 The root certificate must already be trusted by the recipient for
50990 validation to succeed, of course, but if it&#x2019;s not preinstalled, sending the
50991 root certificate along with the rest makes it available for the user to
50992 install if the receiving end is a client MUA that can interact with a user.
50993 </para>
50994 <para>
50995 Note that certificates using MD5 are unlikely to work on today&#x2019;s Internet;
50996 even if your libraries allow loading them for use in Exim when acting as a
50997 server, increasingly clients will not accept such certificates.  The error
50998 diagnostics in such a case can be frustratingly vague.
50999 </para>
51000 </section>
51001 <section id="SECID187">
51002 <title>Self-signed certificates</title>
51003 <para>
51004 <indexterm role="concept">
51005 <primary>certificate</primary>
51006 <secondary>self-signed</secondary>
51007 </indexterm>
51008 You can create a self-signed certificate using the <emphasis>req</emphasis> command provided
51009 with OpenSSL, like this:
51010 </para>
51011 <literallayout class="monospaced">
51012 openssl req -x509 -newkey rsa:1024 -keyout file1 -out file2 \
51013             -days 9999 -nodes
51014 </literallayout>
51015 <para>
51016 <filename>file1</filename> and <filename>file2</filename> can be the same file; the key and the certificate are
51017 delimited and so can be identified independently. The <option>-days</option> option
51018 specifies a period for which the certificate is valid. The <option>-nodes</option> option is
51019 important: if you do not set it, the key is encrypted with a passphrase
51020 that you are prompted for, and any use that is made of the key causes more
51021 prompting for the passphrase. This is not helpful if you are going to use
51022 this certificate and key in an MTA, where prompting is not possible.
51023 </para>
51024 <para>
51025 NB: we are now past the point where 9999 days takes us past the 32-bit Unix
51026 epoch.  If your system uses unsigned time_t (most do) and is 32-bit, then
51027 the above command might produce a date in the past.  Think carefully about
51028 the lifetime of the systems you&#x2019;re deploying, and either reduce the duration
51029 of the certificate or reconsider your platform deployment.  (At time of
51030 writing, reducing the duration is the most likely choice, but the inexorable
51031 progression of time takes us steadily towards an era where this will not
51032 be a sensible resolution).
51033 </para>
51034 <para>
51035 A self-signed certificate made in this way is sufficient for testing, and
51036 may be adequate for all your requirements if you are mainly interested in
51037 encrypting transfers, and not in secure identification.
51038 </para>
51039 <para>
51040 However, many clients require that the certificate presented by the server be a
51041 user (also called <quote>leaf</quote> or <quote>site</quote>) certificate, and not a self-signed
51042 certificate. In this situation, the self-signed certificate described above
51043 must be installed on the client host as a trusted root <emphasis>certification
51044 authority</emphasis> (CA), and the certificate used by Exim must be a user certificate
51045 signed with that self-signed certificate.
51046 </para>
51047 <para>
51048 For information on creating self-signed CA certificates and using them to sign
51049 user certificates, see the <emphasis>General implementation overview</emphasis> chapter of the
51050 Open-source PKI book, available online at
51051 <emphasis role="bold"><ulink url="http://ospkibook.sourceforge.net/">http://ospkibook.sourceforge.net/</ulink></emphasis>.
51052 <indexterm role="concept" startref="IIDencsmtp1" class="endofrange"/>
51053 <indexterm role="concept" startref="IIDencsmtp2" class="endofrange"/>
51054 </para>
51055 </section>
51056 </chapter>
51057
51058 <chapter id="CHAPACL">
51059 <title>Access control lists</title>
51060 <para>
51061 <indexterm role="concept" id="IIDacl" class="startofrange">
51062 <primary>access control lists (ACLs)</primary>
51063 <secondary>description</secondary>
51064 </indexterm>
51065 <indexterm role="concept">
51066 <primary>control of incoming mail</primary>
51067 </indexterm>
51068 <indexterm role="concept">
51069 <primary>message</primary>
51070 <secondary>controlling incoming</secondary>
51071 </indexterm>
51072 <indexterm role="concept">
51073 <primary>policy control</primary>
51074 <secondary>access control lists</secondary>
51075 </indexterm>
51076 Access Control Lists (ACLs) are defined in a separate section of the run time
51077 configuration file, headed by <quote>begin acl</quote>. Each ACL definition starts with a
51078 name, terminated by a colon. Here is a complete ACL section that contains just
51079 one very small ACL:
51080 </para>
51081 <literallayout class="monospaced">
51082 begin acl
51083 small_acl:
51084   accept   hosts = one.host.only
51085 </literallayout>
51086 <para>
51087 You can have as many lists as you like in the ACL section, and the order in
51088 which they appear does not matter. The lists are self-terminating.
51089 </para>
51090 <para>
51091 The majority of ACLs are used to control Exim&#x2019;s behaviour when it receives
51092 certain SMTP commands. This applies both to incoming TCP/IP connections, and
51093 when a local process submits a message using SMTP by specifying the <option>-bs</option>
51094 option. The most common use is for controlling which recipients are accepted
51095 in incoming messages. In addition, you can define an ACL that is used to check
51096 local non-SMTP messages. The default configuration file contains an example of
51097 a realistic ACL for checking RCPT commands. This is discussed in chapter
51098 <xref linkend="CHAPdefconfil"/>.
51099 </para>
51100 <section id="SECID188">
51101 <title>Testing ACLs</title>
51102 <para>
51103 The <option>-bh</option> command line option provides a way of testing your ACL
51104 configuration locally by running a fake SMTP session with which you interact.
51105 The host <emphasis>relay-test.mail-abuse.org</emphasis> provides a service for checking your
51106 relaying configuration (see section <xref linkend="SECTcheralcon"/> for more details).
51107 </para>
51108 </section>
51109 <section id="SECID189">
51110 <title>Specifying when ACLs are used</title>
51111 <para>
51112 <indexterm role="concept">
51113 <primary>access control lists (ACLs)</primary>
51114 <secondary>options for specifying</secondary>
51115 </indexterm>
51116 In order to cause an ACL to be used, you have to name it in one of the relevant
51117 options in the main part of the configuration. These options are:
51118 <indexterm role="concept">
51119 <primary>AUTH</primary>
51120 <secondary>ACL for</secondary>
51121 </indexterm>
51122 <indexterm role="concept">
51123 <primary>DATA</primary>
51124 <secondary>ACLs for</secondary>
51125 </indexterm>
51126 <indexterm role="concept">
51127 <primary>ETRN</primary>
51128 <secondary>ACL for</secondary>
51129 </indexterm>
51130 <indexterm role="concept">
51131 <primary>EXPN</primary>
51132 <secondary>ACL for</secondary>
51133 </indexterm>
51134 <indexterm role="concept">
51135 <primary>HELO</primary>
51136 <secondary>ACL for</secondary>
51137 </indexterm>
51138 <indexterm role="concept">
51139 <primary>EHLO</primary>
51140 <secondary>ACL for</secondary>
51141 </indexterm>
51142 <indexterm role="concept">
51143 <primary>MAIL</primary>
51144 <secondary>ACL for</secondary>
51145 </indexterm>
51146 <indexterm role="concept">
51147 <primary>QUIT, ACL for</primary>
51148 </indexterm>
51149 <indexterm role="concept">
51150 <primary>RCPT</primary>
51151 <secondary>ACL for</secondary>
51152 </indexterm>
51153 <indexterm role="concept">
51154 <primary>STARTTLS, ACL for</primary>
51155 </indexterm>
51156 <indexterm role="concept">
51157 <primary>VRFY</primary>
51158 <secondary>ACL for</secondary>
51159 </indexterm>
51160 <indexterm role="concept">
51161 <primary>SMTP</primary>
51162 <secondary>connection, ACL for</secondary>
51163 </indexterm>
51164 <indexterm role="concept">
51165 <primary>non-SMTP messages</primary>
51166 <secondary>ACLs for</secondary>
51167 </indexterm>
51168 <indexterm role="concept">
51169 <primary>MIME content scanning</primary>
51170 <secondary>ACL for</secondary>
51171 </indexterm>
51172 <indexterm role="concept">
51173 <primary>PRDR</primary>
51174 <secondary>ACL for</secondary>
51175 </indexterm>
51176 </para>
51177 <informaltable frame="none">
51178 <tgroup cols="2" colsep="0" rowsep="0">
51179 <colspec colwidth="140pt" align="left"/>
51180 <colspec colwidth="254pt" align="left"/>
51181 <tbody>
51182 <row>
51183 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<option>acl_not_smtp</option></entry>
51184 <entry>ACL for non-SMTP messages</entry>
51185 </row>
51186 <row>
51187 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<option>acl_not_smtp_mime</option></entry>
51188 <entry>ACL for non-SMTP MIME parts</entry>
51189 </row>
51190 <row>
51191 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<option>acl_not_smtp_start</option></entry>
51192 <entry>ACL at start of non-SMTP message</entry>
51193 </row>
51194 <row>
51195 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<option>acl_smtp_auth</option></entry>
51196 <entry>ACL for AUTH</entry>
51197 </row>
51198 <row>
51199 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<option>acl_smtp_connect</option></entry>
51200 <entry>ACL for start of SMTP connection</entry>
51201 </row>
51202 <row>
51203 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<option>acl_smtp_data</option></entry>
51204 <entry>ACL after DATA is complete</entry>
51205 </row>
51206 <row>
51207 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<option>acl_smtp_data_prdr</option></entry>
51208 <entry>ACL for each recipient, after DATA is complete</entry>
51209 </row>
51210 <row>
51211 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<option>acl_smtp_etrn</option></entry>
51212 <entry>ACL for ETRN</entry>
51213 </row>
51214 <row>
51215 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<option>acl_smtp_expn</option></entry>
51216 <entry>ACL for EXPN</entry>
51217 </row>
51218 <row>
51219 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<option>acl_smtp_helo</option></entry>
51220 <entry>ACL for HELO or EHLO</entry>
51221 </row>
51222 <row>
51223 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<option>acl_smtp_mail</option></entry>
51224 <entry>ACL for MAIL</entry>
51225 </row>
51226 <row>
51227 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<option>acl_smtp_mailauth</option></entry>
51228 <entry>ACL for the AUTH parameter of MAIL</entry>
51229 </row>
51230 <row>
51231 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<option>acl_smtp_mime</option></entry>
51232 <entry>ACL for content-scanning MIME parts</entry>
51233 </row>
51234 <row>
51235 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<option>acl_smtp_notquit</option></entry>
51236 <entry>ACL for non-QUIT terminations</entry>
51237 </row>
51238 <row>
51239 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<option>acl_smtp_predata</option></entry>
51240 <entry>ACL at start of DATA command</entry>
51241 </row>
51242 <row>
51243 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<option>acl_smtp_quit</option></entry>
51244 <entry>ACL for QUIT</entry>
51245 </row>
51246 <row>
51247 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<option>acl_smtp_rcpt</option></entry>
51248 <entry>ACL for RCPT</entry>
51249 </row>
51250 <row>
51251 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<option>acl_smtp_starttls</option></entry>
51252 <entry>ACL for STARTTLS</entry>
51253 </row>
51254 <row>
51255 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<option>acl_smtp_vrfy</option></entry>
51256 <entry>ACL for VRFY</entry>
51257 </row>
51258 </tbody>
51259 </tgroup>
51260 </informaltable>
51261 <para>
51262 For example, if you set
51263 </para>
51264 <literallayout class="monospaced">
51265 acl_smtp_rcpt = small_acl
51266 </literallayout>
51267 <para>
51268 the little ACL defined above is used whenever Exim receives a RCPT command
51269 in an SMTP dialogue. The majority of policy tests on incoming messages can be
51270 done when RCPT commands arrive. A rejection of RCPT should cause the
51271 sending MTA to give up on the recipient address contained in the RCPT
51272 command, whereas rejection at other times may cause the client MTA to keep on
51273 trying to deliver the message. It is therefore recommended that you do as much
51274 testing as possible at RCPT time.
51275 </para>
51276 </section>
51277 <section id="SECID190">
51278 <title>The non-SMTP ACLs</title>
51279 <para>
51280 <indexterm role="concept">
51281 <primary>non-SMTP messages</primary>
51282 <secondary>ACLs for</secondary>
51283 </indexterm>
51284 The non-SMTP ACLs apply to all non-interactive incoming messages, that is, they
51285 apply to batched SMTP as well as to non-SMTP messages. (Batched SMTP is not
51286 really SMTP.) Many of the ACL conditions (for example, host tests, and tests on
51287 the state of the SMTP connection such as encryption and authentication) are not
51288 relevant and are forbidden in these ACLs. However, the sender and recipients
51289 are known, so the <option>senders</option> and <option>sender_domains</option> conditions and the
51290 <varname>$sender_address</varname> and <varname>$recipients</varname> variables can be used. Variables such as
51291 <varname>$authenticated_sender</varname> are also available. You can specify added header lines
51292 in any of these ACLs.
51293 </para>
51294 <para>
51295 The <option>acl_not_smtp_start</option> ACL is run right at the start of receiving a
51296 non-SMTP message, before any of the message has been read. (This is the
51297 analogue of the <option>acl_smtp_predata</option> ACL for SMTP input.) In the case of
51298 batched SMTP input, it runs after the DATA command has been reached. The
51299 result of this ACL is ignored; it cannot be used to reject a message. If you
51300 really need to, you could set a value in an ACL variable here and reject based
51301 on that in the <option>acl_not_smtp</option> ACL. However, this ACL can be used to set
51302 controls, and in particular, it can be used to set
51303 </para>
51304 <literallayout class="monospaced">
51305 control = suppress_local_fixups
51306 </literallayout>
51307 <para>
51308 This cannot be used in the other non-SMTP ACLs because by the time they are
51309 run, it is too late.
51310 </para>
51311 <para>
51312 The <option>acl_not_smtp_mime</option> ACL is available only when Exim is compiled with the
51313 content-scanning extension. For details, see chapter <xref linkend="CHAPexiscan"/>.
51314 </para>
51315 <para>
51316 The <option>acl_not_smtp</option> ACL is run just before the <function>local_scan()</function> function. Any
51317 kind of rejection is treated as permanent, because there is no way of sending a
51318 temporary error for these kinds of message.
51319 </para>
51320 </section>
51321 <section id="SECID191">
51322 <title>The SMTP connect ACL</title>
51323 <para>
51324 <indexterm role="concept">
51325 <primary>SMTP</primary>
51326 <secondary>connection, ACL for</secondary>
51327 </indexterm>
51328 <indexterm role="option">
51329 <primary><option>smtp_banner</option></primary>
51330 </indexterm>
51331 The ACL test specified by <option>acl_smtp_connect</option> happens at the start of an SMTP
51332 session, after the test specified by <option>host_reject_connection</option> (which is now
51333 an anomaly) and any TCP Wrappers testing (if configured). If the connection is
51334 accepted by an <option>accept</option> verb that has a <option>message</option> modifier, the contents of
51335 the message override the banner message that is otherwise specified by the
51336 <option>smtp_banner</option> option.
51337 </para>
51338 </section>
51339 <section id="SECID192">
51340 <title>The EHLO/HELO ACL</title>
51341 <para>
51342 <indexterm role="concept">
51343 <primary>EHLO</primary>
51344 <secondary>ACL for</secondary>
51345 </indexterm>
51346 <indexterm role="concept">
51347 <primary>HELO</primary>
51348 <secondary>ACL for</secondary>
51349 </indexterm>
51350 The ACL test specified by <option>acl_smtp_helo</option> happens when the client issues an
51351 EHLO or HELO command, after the tests specified by <option>helo_accept_junk_hosts</option>,
51352 <option>helo_allow_chars</option>, <option>helo_verify_hosts</option>, and <option>helo_try_verify_hosts</option>.
51353 Note that a client may issue more than one EHLO or HELO command in an SMTP
51354 session, and indeed is required to issue a new EHLO or HELO after successfully
51355 setting up encryption following a STARTTLS command.
51356 </para>
51357 <para>
51358 If the command is accepted by an <option>accept</option> verb that has a <option>message</option>
51359 modifier, the message may not contain more than one line (it will be truncated
51360 at the first newline and a panic logged if it does). Such a message cannot
51361 affect the EHLO options that are listed on the second and subsequent lines of
51362 an EHLO response.
51363 </para>
51364 </section>
51365 <section id="SECID193">
51366 <title>The DATA ACLs</title>
51367 <para>
51368 <indexterm role="concept">
51369 <primary>DATA</primary>
51370 <secondary>ACLs for</secondary>
51371 </indexterm>
51372 Two ACLs are associated with the DATA command, because it is two-stage
51373 command, with two responses being sent to the client.
51374 When the DATA command is received, the ACL defined by <option>acl_smtp_predata</option>
51375 is obeyed. This gives you control after all the RCPT commands, but before
51376 the message itself is received. It offers the opportunity to give a negative
51377 response to the DATA command before the data is transmitted. Header lines
51378 added by MAIL or RCPT ACLs are not visible at this time, but any that
51379 are defined here are visible when the <option>acl_smtp_data</option> ACL is run.
51380 </para>
51381 <para>
51382 You cannot test the contents of the message, for example, to verify addresses
51383 in the headers, at RCPT time or when the DATA command is received. Such
51384 tests have to appear in the ACL that is run after the message itself has been
51385 received, before the final response to the DATA command is sent. This is
51386 the ACL specified by <option>acl_smtp_data</option>, which is the second ACL that is
51387 associated with the DATA command.
51388 </para>
51389 <para>
51390 For both of these ACLs, it is not possible to reject individual recipients. An
51391 error response rejects the entire message. Unfortunately, it is known that some
51392 MTAs do not treat hard (5<emphasis>xx</emphasis>) responses to the DATA command (either
51393 before or after the data) correctly &ndash; they keep the message on their queues
51394 and try again later, but that is their problem, though it does waste some of
51395 your resources.
51396 </para>
51397 <para>
51398 The <option>acl_smtp_data</option> ACL is run after
51399 the <option>acl_smtp_data_prdr</option>,
51400 the <option>acl_smtp_dkim</option>
51401 and the <option>acl_smtp_mime</option> ACLs.
51402 </para>
51403 </section>
51404 <section id="SECTDKIMACL">
51405 <title>The SMTP DKIM ACL</title>
51406 <para>
51407 The <option>acl_smtp_dkim</option> ACL is available only when Exim is compiled with DKIM support
51408 enabled (which is the default).
51409 </para>
51410 <para>
51411 The ACL test specified by <option>acl_smtp_dkim</option> happens after a message has been
51412 received, and is executed for each DKIM signature found in a message.  If not
51413 otherwise specified, the default action is to accept.
51414 </para>
51415 <para>
51416 This ACL is evaluated before <option>acl_smtp_mime</option> and <option>acl_smtp_data</option>.
51417 </para>
51418 <para>
51419 For details on the operation of DKIM, see chapter <xref linkend="CHAPdkim"/>.
51420 </para>
51421 </section>
51422 <section id="SECID194">
51423 <title>The SMTP MIME ACL</title>
51424 <para>
51425 The <option>acl_smtp_mime</option> option is available only when Exim is compiled with the
51426 content-scanning extension. For details, see chapter <xref linkend="CHAPexiscan"/>.
51427 </para>
51428 <para>
51429 This ACL is evaluated after <option>acl_smtp_dkim</option> but before <option>acl_smtp_data</option>.
51430 </para>
51431 </section>
51432 <section id="SECTPRDRACL">
51433 <title>The SMTP PRDR ACL</title>
51434 <para>
51435 <indexterm role="option">
51436 <primary><option>prdr_enable</option></primary>
51437 </indexterm>
51438 The <option>acl_smtp_data_prdr</option> ACL is available only when Exim is compiled
51439 with PRDR support enabled (which is the default).
51440 It becomes active only when the PRDR feature is negotiated between
51441 client and server for a message, and more than one recipient
51442 has been accepted.
51443 </para>
51444 <para>
51445 The ACL test specfied by <option>acl_smtp_data_prdr</option> happens after a message
51446 has been recieved, and is executed for each recipient of the message.
51447 The test may accept or deny for inividual recipients.
51448 The <option>acl_smtp_data</option> will still be called after this ACL and
51449 can reject the message overall, even if this ACL has accepted it
51450 for some or all recipients.
51451 </para>
51452 <para>
51453 PRDR may be used to support per-user content filtering.  Without it
51454 one must defer any recipient after the first that has a different
51455 content-filter configuration.  With PRDR, the RCPT-time check
51456 for this can be disabled when the MAIL-time $smtp_command included
51457 "PRDR".  Any required difference in behaviour of the main DATA-time
51458 ACL should however depend on the PRDR-time ACL having run, as Exim
51459 will avoid doing so in some situations (eg.  single-recipient mails).
51460 </para>
51461 <para>
51462 See also the <option>prdr_enable</option> global option
51463 and the <option>hosts_try_prdr</option> smtp transport option.
51464 </para>
51465 <para>
51466 This ACL is evaluated after <option>acl_smtp_dkim</option> but before <option>acl_smtp_data</option>.
51467 If the ACL is not defined, processing completes as if
51468 the feature was not requested by the client.
51469 </para>
51470 </section>
51471 <section id="SECTQUITACL">
51472 <title>The QUIT ACL</title>
51473 <para>
51474 <indexterm role="concept">
51475 <primary>QUIT, ACL for</primary>
51476 </indexterm>
51477 The ACL for the SMTP QUIT command is anomalous, in that the outcome of the ACL
51478 does not affect the response code to QUIT, which is always 221. Thus, the ACL
51479 does not in fact control any access. For this reason, the only verbs that are
51480 permitted are <option>accept</option> and <option>warn</option>.
51481 </para>
51482 <para>
51483 This ACL can be used for tasks such as custom logging at the end of an SMTP
51484 session. For example, you can use ACL variables in other ACLs to count
51485 messages, recipients, etc., and log the totals at QUIT time using one or
51486 more <option>logwrite</option> modifiers on a <option>warn</option> verb.
51487 </para>
51488 <para>
51489 <emphasis role="bold">Warning</emphasis>: Only the <varname>$acl_c</varname><emphasis>x</emphasis> variables can be used for this, because
51490 the <varname>$acl_m</varname><emphasis>x</emphasis> variables are reset at the end of each incoming message.
51491 </para>
51492 <para>
51493 You do not need to have a final <option>accept</option>, but if you do, you can use a
51494 <option>message</option> modifier to specify custom text that is sent as part of the 221
51495 response to QUIT.
51496 </para>
51497 <para>
51498 This ACL is run only for a <quote>normal</quote> QUIT. For certain kinds of disastrous
51499 failure (for example, failure to open a log file, or when Exim is bombing out
51500 because it has detected an unrecoverable error), all SMTP commands from the
51501 client are given temporary error responses until QUIT is received or the
51502 connection is closed. In these special cases, the QUIT ACL does not run.
51503 </para>
51504 </section>
51505 <section id="SECTNOTQUITACL">
51506 <title>The not-QUIT ACL</title>
51507 <para>
51508 <indexterm role="variable">
51509 <primary><varname>$acl_smtp_notquit</varname></primary>
51510 </indexterm>
51511 The not-QUIT ACL, specified by <option>acl_smtp_notquit</option>, is run in most cases when
51512 an SMTP session ends without sending QUIT. However, when Exim itself is in bad
51513 trouble, such as being unable to write to its log files, this ACL is not run,
51514 because it might try to do things (such as write to log files) that make the
51515 situation even worse.
51516 </para>
51517 <para>
51518 Like the QUIT ACL, this ACL is provided to make it possible to do customized
51519 logging or to gather statistics, and its outcome is ignored. The <option>delay</option>
51520 modifier is forbidden in this ACL, and the only permitted verbs are <option>accept</option>
51521 and <option>warn</option>.
51522 </para>
51523 <para>
51524 <indexterm role="variable">
51525 <primary><varname>$smtp_notquit_reason</varname></primary>
51526 </indexterm>
51527 When the not-QUIT ACL is running, the variable <varname>$smtp_notquit_reason</varname> is set
51528 to a string that indicates the reason for the termination of the SMTP
51529 connection. The possible values are:
51530 </para>
51531 <informaltable frame="none">
51532 <tgroup cols="2" colsep="0" rowsep="0">
51533 <colspec colwidth="196pt" align="left"/>
51534 <colspec colwidth="254pt" align="left"/>
51535 <tbody>
51536 <row>
51537 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<literal>acl-drop</literal></entry>
51538 <entry>Another ACL issued a <option>drop</option> command</entry>
51539 </row>
51540 <row>
51541 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<literal>bad-commands</literal></entry>
51542 <entry>Too many unknown or non-mail commands</entry>
51543 </row>
51544 <row>
51545 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<literal>command-timeout</literal></entry>
51546 <entry>Timeout while reading SMTP commands</entry>
51547 </row>
51548 <row>
51549 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<literal>connection-lost</literal></entry>
51550 <entry>The SMTP connection has been lost</entry>
51551 </row>
51552 <row>
51553 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<literal>data-timeout</literal></entry>
51554 <entry>Timeout while reading message data</entry>
51555 </row>
51556 <row>
51557 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<literal>local-scan-error</literal></entry>
51558 <entry>The <function>local_scan()</function> function crashed</entry>
51559 </row>
51560 <row>
51561 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<literal>local-scan-timeout</literal></entry>
51562 <entry>The <function>local_scan()</function> function timed out</entry>
51563 </row>
51564 <row>
51565 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<literal>signal-exit</literal></entry>
51566 <entry>SIGTERM or SIGINT</entry>
51567 </row>
51568 <row>
51569 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<literal>synchronization-error</literal></entry>
51570 <entry>SMTP synchronization error</entry>
51571 </row>
51572 <row>
51573 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<literal>tls-failed</literal></entry>
51574 <entry>TLS failed to start</entry>
51575 </row>
51576 </tbody>
51577 </tgroup>
51578 </informaltable>
51579 <para>
51580 In most cases when an SMTP connection is closed without having received QUIT,
51581 Exim sends an SMTP response message before actually closing the connection.
51582 With the exception of the <literal>acl-drop</literal> case, the default message can be
51583 overridden by the <option>message</option> modifier in the not-QUIT ACL. In the case of a
51584 <option>drop</option> verb in another ACL, it is the message from the other ACL that is
51585 used.
51586 </para>
51587 </section>
51588 <section id="SECID195">
51589 <title>Finding an ACL to use</title>
51590 <para>
51591 <indexterm role="concept">
51592 <primary>access control lists (ACLs)</primary>
51593 <secondary>finding which to use</secondary>
51594 </indexterm>
51595 The value of an <option>acl_smtp_</option><emphasis>xxx</emphasis> option is expanded before use, so
51596 you can use different ACLs in different circumstances. For example,
51597 </para>
51598 <literallayout class="monospaced">
51599 acl_smtp_rcpt = ${if ={25}{$interface_port} \
51600                      {acl_check_rcpt} {acl_check_rcpt_submit} }
51601 </literallayout>
51602 <para>
51603 In the default configuration file there are some example settings for
51604 providing an RFC 4409 message submission service on port 587 and a
51605 non-standard <quote>smtps</quote> service on port 465. You can use a string
51606 expansion like this to choose an ACL for MUAs on these ports which is
51607 more appropriate for this purpose than the default ACL on port 25.
51608 </para>
51609 <para>
51610 The expanded string does not have to be the name of an ACL in the
51611 configuration file; there are other possibilities. Having expanded the
51612 string, Exim searches for an ACL as follows:
51613 </para>
51614 <itemizedlist>
51615 <listitem>
51616 <para>
51617 If the string begins with a slash, Exim uses it as a file name, and reads its
51618 contents as an ACL. The lines are processed in the same way as lines in the
51619 Exim configuration file. In particular, continuation lines are supported, blank
51620 lines are ignored, as are lines whose first non-whitespace character is <quote>#</quote>.
51621 If the file does not exist or cannot be read, an error occurs (typically
51622 causing a temporary failure of whatever caused the ACL to be run). For example:
51623 </para>
51624 <literallayout class="monospaced">
51625 acl_smtp_data = /etc/acls/\
51626   ${lookup{$sender_host_address}lsearch\
51627   {/etc/acllist}{$value}{default}}
51628 </literallayout>
51629 <para>
51630 This looks up an ACL file to use on the basis of the host&#x2019;s IP address, falling
51631 back to a default if the lookup fails. If an ACL is successfully read from a
51632 file, it is retained in memory for the duration of the Exim process, so that it
51633 can be re-used without having to re-read the file.
51634 </para>
51635 </listitem>
51636 <listitem>
51637 <para>
51638 If the string does not start with a slash, and does not contain any spaces,
51639 Exim searches the ACL section of the configuration for an ACL whose name
51640 matches the string.
51641 </para>
51642 </listitem>
51643 <listitem>
51644 <para>
51645 If no named ACL is found, or if the string contains spaces, Exim parses
51646 the string as an inline ACL. This can save typing in cases where you just
51647 want to have something like
51648 </para>
51649 <literallayout class="monospaced">
51650 acl_smtp_vrfy = accept
51651 </literallayout>
51652 <para>
51653 in order to allow free use of the VRFY command. Such a string may contain
51654 newlines; it is processed in the same way as an ACL that is read from a file.
51655 </para>
51656 </listitem>
51657 </itemizedlist>
51658 </section>
51659 <section id="SECID196">
51660 <title>ACL return codes</title>
51661 <para>
51662 <indexterm role="concept">
51663 <primary>access control lists (ACLs)</primary>
51664 <secondary>return codes</secondary>
51665 </indexterm>
51666 Except for the QUIT ACL, which does not affect the SMTP return code (see
51667 section <xref linkend="SECTQUITACL"/> above), the result of running an ACL is either
51668 <quote>accept</quote> or <quote>deny</quote>, or, if some test cannot be completed (for example, if a
51669 database is down), <quote>defer</quote>. These results cause 2<emphasis>xx</emphasis>, 5<emphasis>xx</emphasis>, and 4<emphasis>xx</emphasis>
51670 return codes, respectively, to be used in the SMTP dialogue. A fourth return,
51671 <quote>error</quote>, occurs when there is an error such as invalid syntax in the ACL.
51672 This also causes a 4<emphasis>xx</emphasis> return code.
51673 </para>
51674 <para>
51675 For the non-SMTP ACL, <quote>defer</quote> and <quote>error</quote> are treated in the same way as
51676 <quote>deny</quote>, because there is no mechanism for passing temporary errors to the
51677 submitters of non-SMTP messages.
51678 </para>
51679 <para>
51680 ACLs that are relevant to message reception may also return <quote>discard</quote>. This
51681 has the effect of <quote>accept</quote>, but causes either the entire message or an
51682 individual recipient address to be discarded. In other words, it is a
51683 blackholing facility. Use it with care.
51684 </para>
51685 <para>
51686 If the ACL for MAIL returns <quote>discard</quote>, all recipients are discarded, and no
51687 ACL is run for subsequent RCPT commands. The effect of <quote>discard</quote> in a
51688 RCPT ACL is to discard just the one recipient address. If there are no
51689 recipients left when the message&#x2019;s data is received, the DATA ACL is not
51690 run. A <quote>discard</quote> return from the DATA or the non-SMTP ACL discards all the
51691 remaining recipients. The <quote>discard</quote> return is not permitted for the
51692 <option>acl_smtp_predata</option> ACL.
51693 </para>
51694 <para>
51695 <indexterm role="concept">
51696 <primary><function>local_scan()</function> function</primary>
51697 <secondary>when all recipients discarded</secondary>
51698 </indexterm>
51699 The <function>local_scan()</function> function is always run, even if there are no remaining
51700 recipients; it may create new recipients.
51701 </para>
51702 </section>
51703 <section id="SECID197">
51704 <title>Unset ACL options</title>
51705 <para>
51706 <indexterm role="concept">
51707 <primary>access control lists (ACLs)</primary>
51708 <secondary>unset options</secondary>
51709 </indexterm>
51710 The default actions when any of the <option>acl_</option><emphasis>xxx</emphasis> options are unset are not
51711 all the same. <emphasis role="bold">Note</emphasis>: These defaults apply only when the relevant ACL is
51712 not defined at all. For any defined ACL, the default action when control
51713 reaches the end of the ACL statements is <quote>deny</quote>.
51714 </para>
51715 <para>
51716 For <option>acl_smtp_quit</option> and <option>acl_not_smtp_start</option> there is no default because
51717 these two are ACLs that are used only for their side effects. They cannot be
51718 used to accept or reject anything.
51719 </para>
51720 <para>
51721 For <option>acl_not_smtp</option>, <option>acl_smtp_auth</option>, <option>acl_smtp_connect</option>,
51722 <option>acl_smtp_data</option>, <option>acl_smtp_helo</option>, <option>acl_smtp_mail</option>, <option>acl_smtp_mailauth</option>,
51723 <option>acl_smtp_mime</option>, <option>acl_smtp_predata</option>, and <option>acl_smtp_starttls</option>, the action
51724 when the ACL is not defined is <quote>accept</quote>.
51725 </para>
51726 <para>
51727 For the others (<option>acl_smtp_etrn</option>, <option>acl_smtp_expn</option>, <option>acl_smtp_rcpt</option>, and
51728 <option>acl_smtp_vrfy</option>), the action when the ACL is not defined is <quote>deny</quote>.
51729 This means that <option>acl_smtp_rcpt</option> must be defined in order to receive any
51730 messages over an SMTP connection. For an example, see the ACL in the default
51731 configuration file.
51732 </para>
51733 </section>
51734 <section id="SECID198">
51735 <title>Data for message ACLs</title>
51736 <para>
51737 <indexterm role="concept">
51738 <primary>access control lists (ACLs)</primary>
51739 <secondary>data for message ACL</secondary>
51740 </indexterm>
51741 <indexterm role="variable">
51742 <primary><varname>$domain</varname></primary>
51743 </indexterm>
51744 <indexterm role="variable">
51745 <primary><varname>$local_part</varname></primary>
51746 </indexterm>
51747 <indexterm role="variable">
51748 <primary><varname>$sender_address</varname></primary>
51749 </indexterm>
51750 <indexterm role="variable">
51751 <primary><varname>$sender_host_address</varname></primary>
51752 </indexterm>
51753 <indexterm role="variable">
51754 <primary><varname>$smtp_command</varname></primary>
51755 </indexterm>
51756 When a MAIL or RCPT ACL, or either of the DATA ACLs, is running, the variables
51757 that contain information about the host and the message&#x2019;s sender (for example,
51758 <varname>$sender_host_address</varname> and <varname>$sender_address</varname>) are set, and can be used in ACL
51759 statements. In the case of RCPT (but not MAIL or DATA), <varname>$domain</varname> and
51760 <varname>$local_part</varname> are set from the argument address. The entire SMTP command
51761 is available in <varname>$smtp_command</varname>.
51762 </para>
51763 <para>
51764 When an ACL for the AUTH parameter of MAIL is running, the variables that
51765 contain information about the host are set, but <varname>$sender_address</varname> is not yet
51766 set. Section <xref linkend="SECTauthparamail"/> contains a discussion of this parameter and
51767 how it is used.
51768 </para>
51769 <para>
51770 <indexterm role="variable">
51771 <primary><varname>$message_size</varname></primary>
51772 </indexterm>
51773 The <varname>$message_size</varname> variable is set to the value of the SIZE parameter on
51774 the MAIL command at MAIL, RCPT and pre-data time, or to -1 if
51775 that parameter is not given. The value is updated to the true message size by
51776 the time the final DATA ACL is run (after the message data has been
51777 received).
51778 </para>
51779 <para>
51780 <indexterm role="variable">
51781 <primary><varname>$rcpt_count</varname></primary>
51782 </indexterm>
51783 <indexterm role="variable">
51784 <primary><varname>$recipients_count</varname></primary>
51785 </indexterm>
51786 The <varname>$rcpt_count</varname> variable increases by one for each RCPT command received.
51787 The <varname>$recipients_count</varname> variable increases by one each time a RCPT command is
51788 accepted, so while an ACL for RCPT is being processed, it contains the number
51789 of previously accepted recipients. At DATA time (for both the DATA ACLs),
51790 <varname>$rcpt_count</varname> contains the total number of RCPT commands, and
51791 <varname>$recipients_count</varname> contains the total number of accepted recipients.
51792 </para>
51793 </section>
51794 <section id="SECTdatfornon">
51795 <title>Data for non-message ACLs</title>
51796 <para>
51797 <indexterm role="concept">
51798 <primary>access control lists (ACLs)</primary>
51799 <secondary>data for non-message ACL</secondary>
51800 </indexterm>
51801 <indexterm role="variable">
51802 <primary><varname>$smtp_command_argument</varname></primary>
51803 </indexterm>
51804 <indexterm role="variable">
51805 <primary><varname>$smtp_command</varname></primary>
51806 </indexterm>
51807 When an ACL is being run for AUTH, EHLO, ETRN, EXPN, HELO, STARTTLS, or VRFY,
51808 the remainder of the SMTP command line is placed in <varname>$smtp_command_argument</varname>,
51809 and the entire SMTP command is available in <varname>$smtp_command</varname>.
51810 These variables can be tested using a <option>condition</option> condition. For example,
51811 here is an ACL for use with AUTH, which insists that either the session is
51812 encrypted, or the CRAM-MD5 authentication method is used. In other words, it
51813 does not permit authentication methods that use cleartext passwords on
51814 unencrypted connections.
51815 </para>
51816 <literallayout class="monospaced">
51817 acl_check_auth:
51818   accept encrypted = *
51819   accept condition = ${if eq{${uc:$smtp_command_argument}}\
51820                      {CRAM-MD5}}
51821   deny   message   = TLS encryption or CRAM-MD5 required
51822 </literallayout>
51823 <para>
51824 (Another way of applying this restriction is to arrange for the authenticators
51825 that use cleartext passwords not to be advertised when the connection is not
51826 encrypted. You can use the generic <option>server_advertise_condition</option> authenticator
51827 option to do this.)
51828 </para>
51829 </section>
51830 <section id="SECID199">
51831 <title>Format of an ACL</title>
51832 <para>
51833 <indexterm role="concept">
51834 <primary>access control lists (ACLs)</primary>
51835 <secondary>format of</secondary>
51836 </indexterm>
51837 <indexterm role="concept">
51838 <primary>access control lists (ACLs)</primary>
51839 <secondary>verbs, definition of</secondary>
51840 </indexterm>
51841 An individual ACL consists of a number of statements. Each statement starts
51842 with a verb, optionally followed by a number of conditions and <quote>modifiers</quote>.
51843 Modifiers can change the way the verb operates, define error and log messages,
51844 set variables, insert delays, and vary the processing of accepted messages.
51845 </para>
51846 <para>
51847 If all the conditions are met, the verb is obeyed. The same condition may be
51848 used (with different arguments) more than once in the same statement. This
51849 provides a means of specifying an <quote>and</quote> conjunction between conditions. For
51850 example:
51851 </para>
51852 <literallayout class="monospaced">
51853 deny  dnslists = list1.example
51854 dnslists = list2.example
51855 </literallayout>
51856 <para>
51857 If there are no conditions, the verb is always obeyed. Exim stops evaluating
51858 the conditions and modifiers when it reaches a condition that fails. What
51859 happens then depends on the verb (and in one case, on a special modifier). Not
51860 all the conditions make sense at every testing point. For example, you cannot
51861 test a sender address in the ACL that is run for a VRFY command.
51862 </para>
51863 </section>
51864 <section id="SECID200">
51865 <title>ACL verbs</title>
51866 <para>
51867 The ACL verbs are as follows:
51868 </para>
51869 <itemizedlist>
51870 <listitem>
51871 <para>
51872 <indexterm role="concept">
51873 <primary><option>accept</option> ACL verb</primary>
51874 </indexterm>
51875 <option>accept</option>: If all the conditions are met, the ACL returns <quote>accept</quote>. If any
51876 of the conditions are not met, what happens depends on whether <option>endpass</option>
51877 appears among the conditions (for syntax see below). If the failing condition
51878 is before <option>endpass</option>, control is passed to the next ACL statement; if it is
51879 after <option>endpass</option>, the ACL returns <quote>deny</quote>. Consider this statement, used to
51880 check a RCPT command:
51881 </para>
51882 <literallayout class="monospaced">
51883 accept domains = +local_domains
51884 endpass
51885 verify = recipient
51886 </literallayout>
51887 <para>
51888 If the recipient domain does not match the <option>domains</option> condition, control
51889 passes to the next statement. If it does match, the recipient is verified, and
51890 the command is accepted if verification succeeds. However, if verification
51891 fails, the ACL yields <quote>deny</quote>, because the failing condition is after
51892 <option>endpass</option>.
51893 </para>
51894 <para>
51895 The <option>endpass</option> feature has turned out to be confusing to many people, so its
51896 use is not recommended nowadays. It is always possible to rewrite an ACL so
51897 that <option>endpass</option> is not needed, and it is no longer used in the default
51898 configuration.
51899 </para>
51900 <para>
51901 <indexterm role="concept">
51902 <primary><option>message</option> ACL modifier</primary>
51903 <secondary>with <option>accept</option></secondary>
51904 </indexterm>
51905 If a <option>message</option> modifier appears on an <option>accept</option> statement, its action
51906 depends on whether or not <option>endpass</option> is present. In the absence of <option>endpass</option>
51907 (when an <option>accept</option> verb either accepts or passes control to the next
51908 statement), <option>message</option> can be used to vary the message that is sent when an
51909 SMTP command is accepted. For example, in a RCPT ACL you could have:
51910 </para>
51911 <literallayout>
51912 <literal>accept  </literal>&lt;<emphasis>some conditions</emphasis>&gt;
51913 <literal>        message = OK, I will allow you through today</literal>
51914 </literallayout>
51915 <para>
51916 You can specify an SMTP response code, optionally followed by an <quote>extended
51917 response code</quote> at the start of the message, but the first digit must be the
51918 same as would be sent by default, which is 2 for an <option>accept</option> verb.
51919 </para>
51920 <para>
51921 If <option>endpass</option> is present in an <option>accept</option> statement, <option>message</option> specifies
51922 an error message that is used when access is denied. This behaviour is retained
51923 for backward compatibility, but current <quote>best practice</quote> is to avoid the use
51924 of <option>endpass</option>.
51925 </para>
51926 </listitem>
51927 <listitem>
51928 <para>
51929 <indexterm role="concept">
51930 <primary><option>defer</option> ACL verb</primary>
51931 </indexterm>
51932 <option>defer</option>: If all the conditions are true, the ACL returns <quote>defer</quote> which, in
51933 an SMTP session, causes a 4<emphasis>xx</emphasis> response to be given. For a non-SMTP ACL,
51934 <option>defer</option> is the same as <option>deny</option>, because there is no way of sending a
51935 temporary error. For a RCPT command, <option>defer</option> is much the same as using a
51936 <command>redirect</command> router and <literal>:defer:</literal> while verifying, but the <option>defer</option> verb can
51937 be used in any ACL, and even for a recipient it might be a simpler approach.
51938 </para>
51939 </listitem>
51940 <listitem>
51941 <para>
51942 <indexterm role="concept">
51943 <primary><option>deny</option> ACL verb</primary>
51944 </indexterm>
51945 <option>deny</option>: If all the conditions are met, the ACL returns <quote>deny</quote>. If any of
51946 the conditions are not met, control is passed to the next ACL statement. For
51947 example,
51948 </para>
51949 <literallayout class="monospaced">
51950 deny dnslists = blackholes.mail-abuse.org
51951 </literallayout>
51952 <para>
51953 rejects commands from hosts that are on a DNS black list.
51954 </para>
51955 </listitem>
51956 <listitem>
51957 <para>
51958 <indexterm role="concept">
51959 <primary><option>discard</option> ACL verb</primary>
51960 </indexterm>
51961 <option>discard</option>: This verb behaves like <option>accept</option>, except that it returns
51962 <quote>discard</quote> from the ACL instead of <quote>accept</quote>. It is permitted only on ACLs
51963 that are concerned with receiving messages. When all the conditions are true,
51964 the sending entity receives a <quote>success</quote> response. However, <option>discard</option> causes
51965 recipients to be discarded. If it is used in an ACL for RCPT, just the one
51966 recipient is discarded; if used for MAIL, DATA or in the non-SMTP ACL, all the
51967 message&#x2019;s recipients are discarded. Recipients that are discarded before DATA
51968 do not appear in the log line when the <option>received_recipients</option> log selector is set.
51969 </para>
51970 <para>
51971 If the <option>log_message</option> modifier is set when <option>discard</option> operates,
51972 its contents are added to the line that is automatically written to the log.
51973 The <option>message</option> modifier operates exactly as it does for <option>accept</option>.
51974 </para>
51975 </listitem>
51976 <listitem>
51977 <para>
51978 <indexterm role="concept">
51979 <primary><option>drop</option> ACL verb</primary>
51980 </indexterm>
51981 <option>drop</option>: This verb behaves like <option>deny</option>, except that an SMTP connection is
51982 forcibly closed after the 5<emphasis>xx</emphasis> error message has been sent. For example:
51983 </para>
51984 <literallayout class="monospaced">
51985 drop   message   = I don't take more than 20 RCPTs
51986        condition = ${if &gt; {$rcpt_count}{20}}
51987 </literallayout>
51988 <para>
51989 There is no difference between <option>deny</option> and <option>drop</option> for the connect-time ACL.
51990 The connection is always dropped after sending a 550 response.
51991 </para>
51992 </listitem>
51993 <listitem>
51994 <para>
51995 <indexterm role="concept">
51996 <primary><option>require</option> ACL verb</primary>
51997 </indexterm>
51998 <option>require</option>: If all the conditions are met, control is passed to the next ACL
51999 statement. If any of the conditions are not met, the ACL returns <quote>deny</quote>. For
52000 example, when checking a RCPT command,
52001 </para>
52002 <literallayout class="monospaced">
52003 require message = Sender did not verify
52004         verify  = sender
52005 </literallayout>
52006 <para>
52007 passes control to subsequent statements only if the message&#x2019;s sender can be
52008 verified. Otherwise, it rejects the command. Note the positioning of the
52009 <option>message</option> modifier, before the <option>verify</option> condition. The reason for this is
52010 discussed in section <xref linkend="SECTcondmodproc"/>.
52011 </para>
52012 </listitem>
52013 <listitem>
52014 <para>
52015 <indexterm role="concept">
52016 <primary><option>warn</option> ACL verb</primary>
52017 </indexterm>
52018 <option>warn</option>: If all the conditions are true, a line specified by the
52019 <option>log_message</option> modifier is written to Exim&#x2019;s main log. Control always passes
52020 to the next ACL statement. If any condition is false, the log line is not
52021 written. If an identical log line is requested several times in the same
52022 message, only one copy is actually written to the log. If you want to force
52023 duplicates to be written, use the <option>logwrite</option> modifier instead.
52024 </para>
52025 <para>
52026 If <option>log_message</option> is not present, a <option>warn</option> verb just checks its conditions
52027 and obeys any <quote>immediate</quote> modifiers (such as <option>control</option>, <option>set</option>,
52028 <option>logwrite</option>, <option>add_header</option>, and <option>remove_header</option>) that appear before the
52029 first failing condition. There is more about adding header lines in section
52030 <xref linkend="SECTaddheadacl"/>.
52031 </para>
52032 <para>
52033 If any condition on a <option>warn</option> statement cannot be completed (that is, there is
52034 some sort of defer), the log line specified by <option>log_message</option> is not written.
52035 This does not include the case of a forced failure from a lookup, which
52036 is considered to be a successful completion. After a defer, no further
52037 conditions or modifiers in the <option>warn</option> statement are processed. The incident
52038 is logged, and the ACL continues to be processed, from the next statement
52039 onwards.
52040 </para>
52041 <para>
52042 <indexterm role="variable">
52043 <primary><varname>$acl_verify_message</varname></primary>
52044 </indexterm>
52045 When one of the <option>warn</option> conditions is an address verification that fails, the
52046 text of the verification failure message is in <varname>$acl_verify_message</varname>. If you
52047 want this logged, you must set it up explicitly. For example:
52048 </para>
52049 <literallayout class="monospaced">
52050 warn   !verify = sender
52051        log_message = sender verify failed: $acl_verify_message
52052 </literallayout>
52053 </listitem>
52054 </itemizedlist>
52055 <para>
52056 At the end of each ACL there is an implicit unconditional <option>deny</option>.
52057 </para>
52058 <para>
52059 As you can see from the examples above, the conditions and modifiers are
52060 written one to a line, with the first one on the same line as the verb, and
52061 subsequent ones on following lines. If you have a very long condition, you can
52062 continue it onto several physical lines by the usual backslash continuation
52063 mechanism. It is conventional to align the conditions vertically.
52064 </para>
52065 </section>
52066 <section id="SECTaclvariables">
52067 <title>ACL variables</title>
52068 <para>
52069 <indexterm role="concept">
52070 <primary>access control lists (ACLs)</primary>
52071 <secondary>variables</secondary>
52072 </indexterm>
52073 There are some special variables that can be set during ACL processing. They
52074 can be used to pass information between different ACLs, different invocations
52075 of the same ACL in the same SMTP connection, and between ACLs and the routers,
52076 transports, and filters that are used to deliver a message. The names of these
52077 variables must begin with <varname>$acl_c</varname> or <varname>$acl_m</varname>, followed either by a digit or
52078 an underscore, but the remainder of the name can be any sequence of
52079 alphanumeric characters and underscores that you choose. There is no limit on
52080 the number of ACL variables. The two sets act as follows:
52081 </para>
52082 <itemizedlist>
52083 <listitem>
52084 <para>
52085 The values of those variables whose names begin with <varname>$acl_c</varname> persist
52086 throughout an SMTP connection. They are never reset. Thus, a value that is set
52087 while receiving one message is still available when receiving the next message
52088 on the same SMTP connection.
52089 </para>
52090 </listitem>
52091 <listitem>
52092 <para>
52093 The values of those variables whose names begin with <varname>$acl_m</varname> persist only
52094 while a message is being received. They are reset afterwards. They are also
52095 reset by MAIL, RSET, EHLO, HELO, and after starting up a TLS session.
52096 </para>
52097 </listitem>
52098 </itemizedlist>
52099 <para>
52100 When a message is accepted, the current values of all the ACL variables are
52101 preserved with the message and are subsequently made available at delivery
52102 time. The ACL variables are set by a modifier called <option>set</option>. For example:
52103 </para>
52104 <literallayout class="monospaced">
52105 accept hosts = whatever
52106        set acl_m4 = some value
52107 accept authenticated = *
52108        set acl_c_auth = yes
52109 </literallayout>
52110 <para>
52111 <emphasis role="bold">Note</emphasis>: A leading dollar sign is not used when naming a variable that is to
52112 be set. If you want to set a variable without taking any action, you can use a
52113 <option>warn</option> verb without any other modifiers or conditions.
52114 </para>
52115 <para>
52116 <indexterm role="option">
52117 <primary><option>strict_acl_vars</option></primary>
52118 </indexterm>
52119 What happens if a syntactically valid but undefined ACL variable is
52120 referenced depends on the setting of the <option>strict_acl_vars</option> option. If it is
52121 false (the default), an empty string is substituted; if it is true, an
52122 error is generated.
52123 </para>
52124 <para>
52125 Versions of Exim before 4.64 have a limited set of numbered variables, but
52126 their names are compatible, so there is no problem with upgrading.
52127 </para>
52128 </section>
52129 <section id="SECTcondmodproc">
52130 <title>Condition and modifier processing</title>
52131 <para>
52132 <indexterm role="concept">
52133 <primary>access control lists (ACLs)</primary>
52134 <secondary>conditions; processing</secondary>
52135 </indexterm>
52136 <indexterm role="concept">
52137 <primary>access control lists (ACLs)</primary>
52138 <secondary>modifiers; processing</secondary>
52139 </indexterm>
52140 An exclamation mark preceding a condition negates its result. For example:
52141 </para>
52142 <literallayout class="monospaced">
52143 deny   domains = *.dom.example
52144       !verify  = recipient
52145 </literallayout>
52146 <para>
52147 causes the ACL to return <quote>deny</quote> if the recipient domain ends in
52148 <emphasis>dom.example</emphasis> and the recipient address cannot be verified. Sometimes
52149 negation can be used on the right-hand side of a condition. For example, these
52150 two statements are equivalent:
52151 </para>
52152 <literallayout class="monospaced">
52153 deny  hosts = !192.168.3.4
52154 deny !hosts =  192.168.3.4
52155 </literallayout>
52156 <para>
52157 However, for many conditions (<option>verify</option> being a good example), only left-hand
52158 side negation of the whole condition is possible.
52159 </para>
52160 <para>
52161 The arguments of conditions and modifiers are expanded. A forced failure
52162 of an expansion causes a condition to be ignored, that is, it behaves as if the
52163 condition is true. Consider these two statements:
52164 </para>
52165 <literallayout class="monospaced">
52166 accept  senders = ${lookup{$host_name}lsearch\
52167                   {/some/file}{$value}fail}
52168 accept  senders = ${lookup{$host_name}lsearch\
52169                   {/some/file}{$value}{}}
52170 </literallayout>
52171 <para>
52172 Each attempts to look up a list of acceptable senders. If the lookup succeeds,
52173 the returned list is searched, but if the lookup fails the behaviour is
52174 different in the two cases. The <option>fail</option> in the first statement causes the
52175 condition to be ignored, leaving no further conditions. The <option>accept</option> verb
52176 therefore succeeds. The second statement, however, generates an empty list when
52177 the lookup fails. No sender can match an empty list, so the condition fails,
52178 and therefore the <option>accept</option> also fails.
52179 </para>
52180 <para>
52181 ACL modifiers appear mixed in with conditions in ACL statements. Some of them
52182 specify actions that are taken as the conditions for a statement are checked;
52183 others specify text for messages that are used when access is denied or a
52184 warning is generated. The <option>control</option> modifier affects the way an incoming
52185 message is handled.
52186 </para>
52187 <para>
52188 The positioning of the modifiers in an ACL statement is important, because the
52189 processing of a verb ceases as soon as its outcome is known. Only those
52190 modifiers that have already been encountered will take effect. For example,
52191 consider this use of the <option>message</option> modifier:
52192 </para>
52193 <literallayout class="monospaced">
52194 require message = Can't verify sender
52195         verify  = sender
52196         message = Can't verify recipient
52197         verify  = recipient
52198         message = This message cannot be used
52199 </literallayout>
52200 <para>
52201 If sender verification fails, Exim knows that the result of the statement is
52202 <quote>deny</quote>, so it goes no further. The first <option>message</option> modifier has been seen,
52203 so its text is used as the error message. If sender verification succeeds, but
52204 recipient verification fails, the second message is used. If recipient
52205 verification succeeds, the third message becomes <quote>current</quote>, but is never used
52206 because there are no more conditions to cause failure.
52207 </para>
52208 <para>
52209 For the <option>deny</option> verb, on the other hand, it is always the last <option>message</option>
52210 modifier that is used, because all the conditions must be true for rejection to
52211 happen. Specifying more than one <option>message</option> modifier does not make sense, and
52212 the message can even be specified after all the conditions. For example:
52213 </para>
52214 <literallayout class="monospaced">
52215 deny   hosts = ...
52216       !senders = *@my.domain.example
52217        message = Invalid sender from client host
52218 </literallayout>
52219 <para>
52220 The <quote>deny</quote> result does not happen until the end of the statement is reached,
52221 by which time Exim has set up the message.
52222 </para>
52223 </section>
52224 <section id="SECTACLmodi">
52225 <title>ACL modifiers</title>
52226 <para>
52227 <indexterm role="concept">
52228 <primary>access control lists (ACLs)</primary>
52229 <secondary>modifiers; list of</secondary>
52230 </indexterm>
52231 The ACL modifiers are as follows:
52232 </para>
52233 <variablelist>
52234 <varlistentry>
52235 <term><emphasis role="bold">add_header</emphasis>&nbsp;=&nbsp;&lt;<emphasis>text</emphasis>&gt;</term>
52236 <listitem>
52237 <para>
52238 This modifier specifies one or more header lines that are to be added to an
52239 incoming message, assuming, of course, that the message is ultimately
52240 accepted. For details, see section <xref linkend="SECTaddheadacl"/>.
52241 </para>
52242 </listitem></varlistentry>
52243 <varlistentry>
52244 <term><emphasis role="bold">continue</emphasis>&nbsp;=&nbsp;&lt;<emphasis>text</emphasis>&gt;</term>
52245 <listitem>
52246 <para>
52247 <indexterm role="concept">
52248 <primary><option>continue</option> ACL modifier</primary>
52249 </indexterm>
52250 <indexterm role="concept">
52251 <primary>database</primary>
52252 <secondary>updating in ACL</secondary>
52253 </indexterm>
52254 This modifier does nothing of itself, and processing of the ACL always
52255 continues with the next condition or modifier. The value of <option>continue</option> is in
52256 the side effects of expanding its argument. Typically this could be used to
52257 update a database. It is really just a syntactic tidiness, to avoid having to
52258 write rather ugly lines like this:
52259 </para>
52260 <literallayout>
52261 <literal>condition = ${if eq{0}{</literal>&lt;<emphasis>some expansion</emphasis>&gt;<literal>}{true}{true}}</literal>
52262 </literallayout>
52263 <para>
52264 Instead, all you need is
52265 </para>
52266 <literallayout>
52267 <literal>continue = </literal>&lt;<emphasis>some expansion</emphasis>&gt;
52268 </literallayout>
52269 </listitem></varlistentry>
52270 <varlistentry>
52271 <term><emphasis role="bold">control</emphasis>&nbsp;=&nbsp;&lt;<emphasis>text</emphasis>&gt;</term>
52272 <listitem>
52273 <para>
52274 <indexterm role="concept">
52275 <primary><option>control</option> ACL modifier</primary>
52276 </indexterm>
52277 This modifier affects the subsequent processing of the SMTP connection or of an
52278 incoming message that is accepted. The effect of the first type of control
52279 lasts for the duration of the connection, whereas the effect of the second type
52280 lasts only until the current message has been received. The message-specific
52281 controls always apply to the whole message, not to individual recipients,
52282 even if the <option>control</option> modifier appears in a RCPT ACL.
52283 </para>
52284 <para>
52285 As there are now quite a few controls that can be applied, they are described
52286 separately in section <xref linkend="SECTcontrols"/>. The <option>control</option> modifier can be used
52287 in several different ways. For example:
52288 </para>
52289 <itemizedlist>
52290 <listitem>
52291 <para>
52292 It can be at the end of an <option>accept</option> statement:
52293 </para>
52294 <literallayout class="monospaced">
52295     accept  ...some conditions
52296             control = queue_only
52297 </literallayout>
52298 <para>
52299 In this case, the control is applied when this statement yields <quote>accept</quote>, in
52300 other words, when the conditions are all true.
52301 </para>
52302 </listitem>
52303 <listitem>
52304 <para>
52305 It can be in the middle of an <option>accept</option> statement:
52306 </para>
52307 <literallayout class="monospaced">
52308     accept  ...some conditions...
52309             control = queue_only
52310             ...some more conditions...
52311 </literallayout>
52312 <para>
52313 If the first set of conditions are true, the control is applied, even if the
52314 statement does not accept because one of the second set of conditions is false.
52315 In this case, some subsequent statement must yield <quote>accept</quote> for the control
52316 to be relevant.
52317 </para>
52318 </listitem>
52319 <listitem>
52320 <para>
52321 It can be used with <option>warn</option> to apply the control, leaving the
52322 decision about accepting or denying to a subsequent verb. For
52323 example:
52324 </para>
52325 <literallayout class="monospaced">
52326     warn    ...some conditions...
52327             control = freeze
52328     accept  ...
52329 </literallayout>
52330 <para>
52331 This example of <option>warn</option> does not contain <option>message</option>, <option>log_message</option>, or
52332 <option>logwrite</option>, so it does not add anything to the message and does not write a
52333 log entry.
52334 </para>
52335 </listitem>
52336 <listitem>
52337 <para>
52338 If you want to apply a control unconditionally, you can use it with a
52339 <option>require</option> verb. For example:
52340 </para>
52341 <literallayout class="monospaced">
52342     require  control = no_multiline_responses
52343 </literallayout>
52344 </listitem>
52345 </itemizedlist>
52346 </listitem></varlistentry>
52347 <varlistentry>
52348 <term><emphasis role="bold">delay</emphasis>&nbsp;=&nbsp;&lt;<emphasis>time</emphasis>&gt;</term>
52349 <listitem>
52350 <para>
52351 <indexterm role="concept">
52352 <primary><option>delay</option> ACL modifier</primary>
52353 </indexterm>
52354 <indexterm role="option">
52355 <primary><option>-bh</option></primary>
52356 </indexterm>
52357 This modifier may appear in any ACL except notquit. It causes Exim to wait for
52358 the time interval before proceeding. However, when testing Exim using the
52359 <option>-bh</option> option, the delay is not actually imposed (an appropriate message is
52360 output instead). The time is given in the usual Exim notation, and the delay
52361 happens as soon as the modifier is processed. In an SMTP session, pending
52362 output is flushed before the delay is imposed.
52363 </para>
52364 <para>
52365 Like <option>control</option>, <option>delay</option> can be used with <option>accept</option> or <option>deny</option>, for
52366 example:
52367 </para>
52368 <literallayout class="monospaced">
52369 deny    ...some conditions...
52370         delay = 30s
52371 </literallayout>
52372 <para>
52373 The delay happens if all the conditions are true, before the statement returns
52374 <quote>deny</quote>. Compare this with:
52375 </para>
52376 <literallayout class="monospaced">
52377 deny    delay = 30s
52378         ...some conditions...
52379 </literallayout>
52380 <para>
52381 which waits for 30s before processing the conditions. The <option>delay</option> modifier
52382 can also be used with <option>warn</option> and together with <option>control</option>:
52383 </para>
52384 <literallayout class="monospaced">
52385 warn    ...some conditions...
52386         delay = 2m
52387         control = freeze
52388 accept  ...
52389 </literallayout>
52390 <para>
52391 If <option>delay</option> is encountered when the SMTP PIPELINING extension is in use,
52392 responses to several commands are no longer buffered and sent in one packet (as
52393 they would normally be) because all output is flushed before imposing the
52394 delay. This optimization is disabled so that a number of small delays do not
52395 appear to the client as one large aggregated delay that might provoke an
52396 unwanted timeout. You can, however, disable output flushing for <option>delay</option> by
52397 using a <option>control</option> modifier to set <option>no_delay_flush</option>.
52398 </para>
52399 </listitem></varlistentry>
52400 <varlistentry>
52401 <term><emphasis role="bold">endpass</emphasis></term>
52402 <listitem>
52403 <para>
52404 <indexterm role="concept">
52405 <primary><option>endpass</option> ACL modifier</primary>
52406 </indexterm>
52407 This modifier, which has no argument, is recognized only in <option>accept</option> and
52408 <option>discard</option> statements. It marks the boundary between the conditions whose
52409 failure causes control to pass to the next statement, and the conditions whose
52410 failure causes the ACL to return <quote>deny</quote>. This concept has proved to be
52411 confusing to some people, so the use of <option>endpass</option> is no longer recommended as
52412 <quote>best practice</quote>. See the description of <option>accept</option> above for more details.
52413 </para>
52414 </listitem></varlistentry>
52415 <varlistentry>
52416 <term><emphasis role="bold">log_message</emphasis>&nbsp;=&nbsp;&lt;<emphasis>text</emphasis>&gt;</term>
52417 <listitem>
52418 <para>
52419 <indexterm role="concept">
52420 <primary><option>log_message</option> ACL modifier</primary>
52421 </indexterm>
52422 This modifier sets up a message that is used as part of the log message if the
52423 ACL denies access or a <option>warn</option> statement&#x2019;s conditions are true. For example:
52424 </para>
52425 <literallayout class="monospaced">
52426 require log_message = wrong cipher suite $tls_in_cipher
52427         encrypted   = DES-CBC3-SHA
52428 </literallayout>
52429 <para>
52430 <option>log_message</option> is also used when recipients are discarded by <option>discard</option>. For
52431 example:
52432 </para>
52433 <literallayout>
52434 <literal>discard </literal>&lt;<emphasis>some conditions</emphasis>&gt;
52435 <literal>        log_message = Discarded $local_part@$domain because...</literal>
52436 </literallayout>
52437 <para>
52438 When access is denied, <option>log_message</option> adds to any underlying error message
52439 that may exist because of a condition failure. For example, while verifying a
52440 recipient address, a <emphasis>:fail:</emphasis> redirection might have already set up a
52441 message.
52442 </para>
52443 <para>
52444 The message may be defined before the conditions to which it applies, because
52445 the string expansion does not happen until Exim decides that access is to be
52446 denied. This means that any variables that are set by the condition are
52447 available for inclusion in the message. For example, the <varname>$dnslist_</varname>&lt;<emphasis>xxx</emphasis>&gt;
52448 variables are set after a DNS black list lookup succeeds. If the expansion of
52449 <option>log_message</option> fails, or if the result is an empty string, the modifier is
52450 ignored.
52451 </para>
52452 <para>
52453 <indexterm role="variable">
52454 <primary><varname>$acl_verify_message</varname></primary>
52455 </indexterm>
52456 If you want to use a <option>warn</option> statement to log the result of an address
52457 verification, you can use <varname>$acl_verify_message</varname> to include the verification
52458 error message.
52459 </para>
52460 <para>
52461 If <option>log_message</option> is used with a <option>warn</option> statement, <quote>Warning:</quote> is added to
52462 the start of the logged message. If the same warning log message is requested
52463 more than once while receiving  a single email message, only one copy is
52464 actually logged. If you want to log multiple copies, use <option>logwrite</option> instead
52465 of <option>log_message</option>. In the absence of <option>log_message</option> and <option>logwrite</option>, nothing
52466 is logged for a successful <option>warn</option> statement.
52467 </para>
52468 <para>
52469 If <option>log_message</option> is not present and there is no underlying error message (for
52470 example, from the failure of address verification), but <option>message</option> is present,
52471 the <option>message</option> text is used for logging rejections. However, if any text for
52472 logging contains newlines, only the first line is logged. In the absence of
52473 both <option>log_message</option> and <option>message</option>, a default built-in message is used for
52474 logging rejections.
52475 </para>
52476 </listitem></varlistentry>
52477 <varlistentry>
52478 <term><emphasis role="bold">log_reject_target</emphasis>&nbsp;=&nbsp;&lt;<emphasis>log name list</emphasis>&gt;</term>
52479 <listitem>
52480 <para>
52481 <indexterm role="concept">
52482 <primary><option>log_reject_target</option> ACL modifier</primary>
52483 </indexterm>
52484 <indexterm role="concept">
52485 <primary>logging in ACL</primary>
52486 <secondary>specifying which log</secondary>
52487 </indexterm>
52488 This modifier makes it possible to specify which logs are used for messages
52489 about ACL rejections. Its argument is a colon-separated list of words that can
52490 be <quote>main</quote>, <quote>reject</quote>, or <quote>panic</quote>. The default is <literal>main:reject</literal>. The list
52491 may be empty, in which case a rejection is not logged at all. For example, this
52492 ACL fragment writes no logging information when access is denied:
52493 </para>
52494 <literallayout>
52495 <literal>deny </literal>&lt;<emphasis>some conditions</emphasis>&gt;
52496 <literal>     log_reject_target =</literal>
52497 </literallayout>
52498 <para>
52499 This modifier can be used in SMTP and non-SMTP ACLs. It applies to both
52500 permanent and temporary rejections. Its effect lasts for the rest of the
52501 current ACL.
52502 </para>
52503 </listitem></varlistentry>
52504 <varlistentry>
52505 <term><emphasis role="bold">logwrite</emphasis>&nbsp;=&nbsp;&lt;<emphasis>text</emphasis>&gt;</term>
52506 <listitem>
52507 <para>
52508 <indexterm role="concept">
52509 <primary><option>logwrite</option> ACL modifier</primary>
52510 </indexterm>
52511 <indexterm role="concept">
52512 <primary>logging in ACL</primary>
52513 <secondary>immediate</secondary>
52514 </indexterm>
52515 This modifier writes a message to a log file as soon as it is encountered when
52516 processing an ACL. (Compare <option>log_message</option>, which, except in the case of
52517 <option>warn</option> and <option>discard</option>, is used only if the ACL statement denies
52518 access.) The <option>logwrite</option> modifier can be used to log special incidents in
52519 ACLs. For example:
52520 </para>
52521 <literallayout>
52522 <literal>accept </literal>&lt;<emphasis>some special conditions</emphasis>&gt;
52523 <literal>       control  = freeze</literal>
52524 <literal>       logwrite = froze message because ...</literal>
52525 </literallayout>
52526 <para>
52527 By default, the message is written to the main log. However, it may begin
52528 with a colon, followed by a comma-separated list of log names, and then
52529 another colon, to specify exactly which logs are to be written. For
52530 example:
52531 </para>
52532 <literallayout class="monospaced">
52533 logwrite = :main,reject: text for main and reject logs
52534 logwrite = :panic: text for panic log only
52535 </literallayout>
52536 </listitem></varlistentry>
52537 <varlistentry>
52538 <term><emphasis role="bold">message</emphasis>&nbsp;=&nbsp;&lt;<emphasis>text</emphasis>&gt;</term>
52539 <listitem>
52540 <para>
52541 <indexterm role="concept">
52542 <primary><option>message</option> ACL modifier</primary>
52543 </indexterm>
52544 This modifier sets up a text string that is expanded and used as a response
52545 message when an ACL statement terminates the ACL with an <quote>accept</quote>, <quote>deny</quote>,
52546 or <quote>defer</quote> response. (In the case of the <option>accept</option> and <option>discard</option> verbs,
52547 there is some complication if <option>endpass</option> is involved; see the description of
52548 <option>accept</option> for details.)
52549 </para>
52550 <para>
52551 The expansion of the message happens at the time Exim decides that the ACL is
52552 to end, not at the time it processes <option>message</option>. If the expansion fails, or
52553 generates an empty string, the modifier is ignored. Here is an example where
52554 <option>message</option> must be specified first, because the ACL ends with a rejection if
52555 the <option>hosts</option> condition fails:
52556 </para>
52557 <literallayout class="monospaced">
52558 require  message = Host not recognized
52559          hosts = 10.0.0.0/8
52560 </literallayout>
52561 <para>
52562 (Once a condition has failed, no further conditions or modifiers are
52563 processed.)
52564 </para>
52565 <para>
52566 <indexterm role="concept">
52567 <primary>SMTP</primary>
52568 <secondary>error codes</secondary>
52569 </indexterm>
52570 <indexterm role="option">
52571 <primary><option>smtp_banner</option></primary>
52572 </indexterm>
52573 For ACLs that are triggered by SMTP commands, the message is returned as part
52574 of the SMTP response. The use of <option>message</option> with <option>accept</option> (or <option>discard</option>)
52575 is meaningful only for SMTP, as no message is returned when a non-SMTP message
52576 is accepted. In the case of the connect ACL, accepting with a message modifier
52577 overrides the value of <option>smtp_banner</option>. For the EHLO/HELO ACL, a customized
52578 accept message may not contain more than one line (otherwise it will be
52579 truncated at the first newline and a panic logged), and it cannot affect the
52580 EHLO options.
52581 </para>
52582 <para>
52583 When SMTP is involved, the message may begin with an overriding response code,
52584 consisting of three digits optionally followed by an <quote>extended response code</quote>
52585 of the form <emphasis>n.n.n</emphasis>, each code being followed by a space. For example:
52586 </para>
52587 <literallayout class="monospaced">
52588 deny  message = 599 1.2.3 Host not welcome
52589       hosts = 192.168.34.0/24
52590 </literallayout>
52591 <para>
52592 The first digit of the supplied response code must be the same as would be sent
52593 by default. A panic occurs if it is not. Exim uses a 550 code when it denies
52594 access, but for the predata ACL, note that the default success code is 354, not
52595 2<emphasis>xx</emphasis>.
52596 </para>
52597 <para>
52598 Notwithstanding the previous paragraph, for the QUIT ACL, unlike the others,
52599 the message modifier cannot override the 221 response code.
52600 </para>
52601 <para>
52602 The text in a <option>message</option> modifier is literal; any quotes are taken as
52603 literals, but because the string is expanded, backslash escapes are processed
52604 anyway. If the message contains newlines, this gives rise to a multi-line SMTP
52605 response.
52606 </para>
52607 <para>
52608 <indexterm role="variable">
52609 <primary><varname>$acl_verify_message</varname></primary>
52610 </indexterm>
52611 If <option>message</option> is used on a statement that verifies an address, the message
52612 specified overrides any message that is generated by the verification process.
52613 However, the original message is available in the variable
52614 <varname>$acl_verify_message</varname>, so you can incorporate it into your message if you
52615 wish. In particular, if you want the text from <option>:fail:</option> items in <command>redirect</command>
52616 routers to be passed back as part of the SMTP response, you should either not
52617 use a <option>message</option> modifier, or make use of <varname>$acl_verify_message</varname>.
52618 </para>
52619 <para>
52620 For compatibility with previous releases of Exim, a <option>message</option> modifier that
52621 is used with a <option>warn</option> verb behaves in a similar way to the <option>add_header</option>
52622 modifier, but this usage is now deprecated. However, <option>message</option> acts only when
52623 all the conditions are true, wherever it appears in an ACL command, whereas
52624 <option>add_header</option> acts as soon as it is encountered. If <option>message</option> is used with
52625 <option>warn</option> in an ACL that is not concerned with receiving a message, it has no
52626 effect.
52627 </para>
52628 </listitem></varlistentry>
52629 <varlistentry>
52630 <term><emphasis role="bold">remove_header</emphasis>&nbsp;=&nbsp;&lt;<emphasis>text</emphasis>&gt;</term>
52631 <listitem>
52632 <para>
52633 This modifier specifies one or more header names in a colon-separated list
52634  that are to be removed from an incoming message, assuming, of course, that
52635 the message is ultimately accepted. For details, see section <xref linkend="SECTremoveheadacl"/>.
52636 </para>
52637 </listitem></varlistentry>
52638 <varlistentry>
52639 <term><emphasis role="bold">set</emphasis>&nbsp;&lt;<emphasis>acl_name</emphasis>&gt;&nbsp;=&nbsp;&lt;<emphasis>value</emphasis>&gt;</term>
52640 <listitem>
52641 <para>
52642 <indexterm role="concept">
52643 <primary><option>set</option> ACL modifier</primary>
52644 </indexterm>
52645 This modifier puts a value into one of the ACL variables (see section
52646 <xref linkend="SECTaclvariables"/>).
52647 </para>
52648 </listitem></varlistentry>
52649 <varlistentry>
52650 <term><emphasis role="bold">udpsend</emphasis>&nbsp;=&nbsp;&lt;<emphasis>parameters</emphasis>&gt;</term>
52651 <listitem>
52652 <para>
52653 This modifier sends a UDP packet, for purposes such as statistics
52654 collection or behaviour monitoring. The parameters are expanded, and
52655 the result of the expansion must be a colon-separated list consisting
52656 of a destination server, port number, and the packet contents. The
52657 server can be specified as a host name or IPv4 or IPv6 address. The
52658 separator can be changed with the usual angle bracket syntax. For
52659 example, you might want to collect information on which hosts connect
52660 when:
52661 </para>
52662 <literallayout class="monospaced">
52663 udpsend = &lt;; 2001:dB8::dead:beef ; 1234 ;\
52664              $tod_zulu $sender_host_address
52665 </literallayout>
52666 </listitem></varlistentry>
52667 </variablelist>
52668 </section>
52669 <section id="SECTcontrols">
52670 <title>Use of the control modifier</title>
52671 <para>
52672 <indexterm role="concept">
52673 <primary><option>control</option> ACL modifier</primary>
52674 </indexterm>
52675 The <option>control</option> modifier supports the following settings:
52676 </para>
52677 <variablelist>
52678 <varlistentry>
52679 <term><emphasis role="bold">control&nbsp;=&nbsp;allow_auth_unadvertised</emphasis></term>
52680 <listitem>
52681 <para>
52682 This modifier allows a client host to use the SMTP AUTH command even when it
52683 has not been advertised in response to EHLO. Furthermore, because there are
52684 apparently some really broken clients that do this, Exim will accept AUTH after
52685 HELO (rather than EHLO) when this control is set. It should be used only if you
52686 really need it, and you should limit its use to those broken clients that do
52687 not work without it. For example:
52688 </para>
52689 <literallayout class="monospaced">
52690 warn hosts   = 192.168.34.25
52691      control = allow_auth_unadvertised
52692 </literallayout>
52693 <para>
52694 Normally, when an Exim server receives an AUTH command, it checks the name of
52695 the authentication mechanism that is given in the command to ensure that it
52696 matches an advertised mechanism. When this control is set, the check that a
52697 mechanism has been advertised is bypassed. Any configured mechanism can be used
52698 by the client. This control is permitted only in the connection and HELO ACLs.
52699 </para>
52700 </listitem></varlistentry>
52701 <varlistentry>
52702 <term><emphasis role="bold">control&nbsp;=&nbsp;caseful_local_part</emphasis></term>
52703 <term><emphasis role="bold">control&nbsp;=&nbsp;caselower_local_part</emphasis></term>
52704 <listitem>
52705 <para>
52706 <indexterm role="concept">
52707 <primary>access control lists (ACLs)</primary>
52708 <secondary>case of local part in</secondary>
52709 </indexterm>
52710 <indexterm role="concept">
52711 <primary>case of local parts</primary>
52712 </indexterm>
52713 <indexterm role="variable">
52714 <primary><varname>$local_part</varname></primary>
52715 </indexterm>
52716 These two controls are permitted only in the ACL specified by <option>acl_smtp_rcpt</option>
52717 (that is, during RCPT processing). By default, the contents of <varname>$local_part</varname>
52718 are lower cased before ACL processing. If <quote>caseful_local_part</quote> is specified,
52719 any uppercase letters in the original local part are restored in <varname>$local_part</varname>
52720 for the rest of the ACL, or until a control that sets <quote>caselower_local_part</quote>
52721 is encountered.
52722 </para>
52723 <para>
52724 These controls affect only the current recipient. Moreover, they apply only to
52725 local part handling that takes place directly in the ACL (for example, as a key
52726 in lookups). If a test to verify the recipient is obeyed, the case-related
52727 handling of the local part during the verification is controlled by the router
52728 configuration (see the <option>caseful_local_part</option> generic router option).
52729 </para>
52730 <para>
52731 This facility could be used, for example, to add a spam score to local parts
52732 containing upper case letters. For example, using <varname>$acl_m4</varname> to accumulate the
52733 spam score:
52734 </para>
52735 <literallayout class="monospaced">
52736 warn  control = caseful_local_part
52737       set acl_m4 = ${eval:\
52738                      $acl_m4 + \
52739                      ${if match{$local_part}{[A-Z]}{1}{0}}\
52740                     }
52741       control = caselower_local_part
52742 </literallayout>
52743 <para>
52744 Notice that we put back the lower cased version afterwards, assuming that
52745 is what is wanted for subsequent tests.
52746 </para>
52747 </listitem></varlistentry>
52748 <varlistentry>
52749 <term><emphasis role="bold">control&nbsp;=&nbsp;cutthrough_delivery</emphasis></term>
52750 <listitem>
52751 <para>
52752 <indexterm role="concept">
52753 <primary>access control lists (ACLs)</primary>
52754 <secondary>cutthrough routing</secondary>
52755 </indexterm>
52756 <indexterm role="concept">
52757 <primary>cutthrough</primary>
52758 <secondary>requesting</secondary>
52759 </indexterm>
52760 This option requests delivery be attempted while the item is being received.
52761 It is usable in the RCPT ACL and valid only for single-recipient mails forwarded
52762 from one SMTP connection to another.  If a recipient-verify callout connection is
52763 requested in the same ACL it is held open and used for the data, otherwise one is made
52764 after the ACL completes.
52765 </para>
52766 <para>
52767 Note that routers are used in verify mode,
52768 and cannot depend on content of received headers.
52769 Note also that headers cannot be
52770 modified by any of the post-data ACLs (DATA, MIME and DKIM).
52771 Headers may be modified by routers (subject to the above) and transports.
52772 </para>
52773 <para>
52774 Cutthrough delivery is not supported via transport-filters or when DKIM signing
52775 of outgoing messages is done, because it sends data to the ultimate destination
52776 before the entire message has been received from the source.
52777 </para>
52778 <para>
52779 Should the ultimate destination system positively accept or reject the mail,
52780 a corresponding indication is given to the source system and nothing is queued.
52781 If there is a temporary error the item is queued for later delivery in the
52782 usual fashion. If the item is successfully delivered in cutthrough mode the log line
52783 is tagged with "&gt;&gt;" rather than "=&gt;" and appears before the acceptance "&lt;="
52784 line.
52785 </para>
52786 <para>
52787 Delivery in this mode avoids the generation of a bounce mail to a (possibly faked)
52788 sender when the destination system is doing content-scan based rejection.
52789 </para>
52790 </listitem></varlistentry>
52791 <varlistentry>
52792 <term><emphasis role="bold">control&nbsp;=&nbsp;debug/</emphasis>&lt;<emphasis>options</emphasis>&gt;</term>
52793 <listitem>
52794 <para>
52795 <indexterm role="concept">
52796 <primary>access control lists (ACLs)</primary>
52797 <secondary>enabling debug logging</secondary>
52798 </indexterm>
52799 <indexterm role="concept">
52800 <primary>debugging</primary>
52801 <secondary>enabling from an ACL</secondary>
52802 </indexterm>
52803 This control turns on debug logging, almost as though Exim had been invoked
52804 with <literal>-d</literal>, with the output going to a new logfile, by default called
52805 <emphasis>debuglog</emphasis>.  The filename can be adjusted with the <emphasis>tag</emphasis> option, which
52806 may access any variables already defined.  The logging may be adjusted with
52807 the <emphasis>opts</emphasis> option, which takes the same values as the <literal>-d</literal> command-line
52808 option.  Some examples (which depend on variables that don&#x2019;t exist in all
52809 contexts):
52810 </para>
52811 <literallayout class="monospaced">
52812       control = debug
52813       control = debug/tag=.$sender_host_address
52814       control = debug/opts=+expand+acl
52815       control = debug/tag=.$message_exim_id/opts=+expand
52816 </literallayout>
52817 </listitem></varlistentry>
52818 <varlistentry>
52819 <term><emphasis role="bold">control&nbsp;=&nbsp;dkim_disable_verify</emphasis></term>
52820 <listitem>
52821 <para>
52822 <indexterm role="concept">
52823 <primary>disable DKIM verify</primary>
52824 </indexterm>
52825 <indexterm role="concept">
52826 <primary>DKIM</primary>
52827 <secondary>disable verify</secondary>
52828 </indexterm>
52829 This control turns off DKIM verification processing entirely.  For details on
52830 the operation and configuration of DKIM, see chapter <xref linkend="CHAPdkim"/>.
52831 </para>
52832 </listitem></varlistentry>
52833 <varlistentry>
52834 <term><emphasis role="bold">control&nbsp;=&nbsp;dscp/</emphasis>&lt;<emphasis>value</emphasis>&gt;</term>
52835 <listitem>
52836 <para>
52837 <indexterm role="concept">
52838 <primary>access control lists (ACLs)</primary>
52839 <secondary>setting DSCP value</secondary>
52840 </indexterm>
52841 <indexterm role="concept">
52842 <primary>DSCP</primary>
52843 <secondary>inbound</secondary>
52844 </indexterm>
52845 This option causes the DSCP value associated with the socket for the inbound
52846 connection to be adjusted to a given value, given as one of a number of fixed
52847 strings or to numeric value.
52848 The <option>-bI:dscp</option> option may be used to ask Exim which names it knows of.
52849 Common values include <literal>throughput</literal>, <literal>mincost</literal>, and on newer systems
52850 <literal>ef</literal>, <literal>af41</literal>, etc.  Numeric values may be in the range 0 to 0x3F.
52851 </para>
52852 <para>
52853 The outbound packets from Exim will be marked with this value in the header
52854 (for IPv4, the TOS field; for IPv6, the TCLASS field); there is no guarantee
52855 that these values will have any effect, not be stripped by networking
52856 equipment, or do much of anything without cooperation with your Network
52857 Engineer and those of all network operators between the source and destination.
52858 </para>
52859 </listitem></varlistentry>
52860 <varlistentry>
52861 <term><emphasis role="bold">control&nbsp;=&nbsp;enforce_sync</emphasis></term>
52862 <term><emphasis role="bold">control&nbsp;=&nbsp;no_enforce_sync</emphasis></term>
52863 <listitem>
52864 <para>
52865 <indexterm role="concept">
52866 <primary>SMTP</primary>
52867 <secondary>synchronization checking</secondary>
52868 </indexterm>
52869 <indexterm role="concept">
52870 <primary>synchronization checking in SMTP</primary>
52871 </indexterm>
52872 These controls make it possible to be selective about when SMTP synchronization
52873 is enforced. The global option <option>smtp_enforce_sync</option> specifies the initial
52874 state of the switch (it is true by default). See the description of this option
52875 in chapter <xref linkend="CHAPmainconfig"/> for details of SMTP synchronization checking.
52876 </para>
52877 <para>
52878 The effect of these two controls lasts for the remainder of the SMTP
52879 connection. They can appear in any ACL except the one for the non-SMTP
52880 messages. The most straightforward place to put them is in the ACL defined by
52881 <option>acl_smtp_connect</option>, which is run at the start of an incoming SMTP connection,
52882 before the first synchronization check. The expected use is to turn off the
52883 synchronization checks for badly-behaved hosts that you nevertheless need to
52884 work with.
52885 </para>
52886 </listitem></varlistentry>
52887 <varlistentry>
52888 <term><emphasis role="bold">control&nbsp;=&nbsp;fakedefer/</emphasis>&lt;<emphasis>message</emphasis>&gt;</term>
52889 <listitem>
52890 <para>
52891 <indexterm role="concept">
52892 <primary>fake defer</primary>
52893 </indexterm>
52894 <indexterm role="concept">
52895 <primary>defer, fake</primary>
52896 </indexterm>
52897 This control works in exactly the same way as <option>fakereject</option> (described below)
52898 except that it causes an SMTP 450 response after the message data instead of a
52899 550 response. You must take care when using <option>fakedefer</option> because it causes the
52900 messages to be duplicated when the sender retries. Therefore, you should not
52901 use <option>fakedefer</option> if the message is to be delivered normally.
52902 </para>
52903 </listitem></varlistentry>
52904 <varlistentry>
52905 <term><emphasis role="bold">control&nbsp;=&nbsp;fakereject/</emphasis>&lt;<emphasis>message</emphasis>&gt;</term>
52906 <listitem>
52907 <para>
52908 <indexterm role="concept">
52909 <primary>fake rejection</primary>
52910 </indexterm>
52911 <indexterm role="concept">
52912 <primary>rejection, fake</primary>
52913 </indexterm>
52914 This control is permitted only for the MAIL, RCPT, and DATA ACLs, in other
52915 words, only when an SMTP message is being received. If Exim accepts the
52916 message, instead the final 250 response, a 550 rejection message is sent.
52917 However, Exim proceeds to deliver the message as normal. The control applies
52918 only to the current message, not to any subsequent ones that may be received in
52919 the same SMTP connection.
52920 </para>
52921 <para>
52922 The text for the 550 response is taken from the <option>control</option> modifier. If no
52923 message is supplied, the following is used:
52924 </para>
52925 <literallayout class="monospaced">
52926 550-Your message has been rejected but is being
52927 550-kept for evaluation.
52928 550-If it was a legitimate message, it may still be
52929 550 delivered to the target recipient(s).
52930 </literallayout>
52931 <para>
52932 This facility should be used with extreme caution.
52933 </para>
52934 </listitem></varlistentry>
52935 <varlistentry>
52936 <term><emphasis role="bold">control&nbsp;=&nbsp;freeze</emphasis></term>
52937 <listitem>
52938 <para>
52939 <indexterm role="concept">
52940 <primary>frozen messages</primary>
52941 <secondary>forcing in ACL</secondary>
52942 </indexterm>
52943 This control is permitted only for the MAIL, RCPT, DATA, and non-SMTP ACLs, in
52944 other words, only when a message is being received. If the message is accepted,
52945 it is placed on Exim&#x2019;s queue and frozen. The control applies only to the
52946 current message, not to any subsequent ones that may be received in the same
52947 SMTP connection.
52948 </para>
52949 <para>
52950 This modifier can optionally be followed by <literal>/no_tell</literal>. If the global option
52951 <option>freeze_tell</option> is set, it is ignored for the current message (that is, nobody
52952 is told about the freezing), provided all the <emphasis role="bold">control=freeze</emphasis> modifiers that
52953 are obeyed for the current message have the <literal>/no_tell</literal> option.
52954 </para>
52955 </listitem></varlistentry>
52956 <varlistentry>
52957 <term><emphasis role="bold">control&nbsp;=&nbsp;no_delay_flush</emphasis></term>
52958 <listitem>
52959 <para>
52960 <indexterm role="concept">
52961 <primary>SMTP</primary>
52962 <secondary>output flushing, disabling for delay</secondary>
52963 </indexterm>
52964 Exim normally flushes SMTP output before implementing a delay in an ACL, to
52965 avoid unexpected timeouts in clients when the SMTP PIPELINING extension is in
52966 use. This control, as long as it is encountered before the <option>delay</option> modifier,
52967 disables such output flushing.
52968 </para>
52969 </listitem></varlistentry>
52970 <varlistentry>
52971 <term><emphasis role="bold">control&nbsp;=&nbsp;no_callout_flush</emphasis></term>
52972 <listitem>
52973 <para>
52974 <indexterm role="concept">
52975 <primary>SMTP</primary>
52976 <secondary>output flushing, disabling for callout</secondary>
52977 </indexterm>
52978 Exim normally flushes SMTP output before performing a callout in an ACL, to
52979 avoid unexpected timeouts in clients when the SMTP PIPELINING extension is in
52980 use. This control, as long as it is encountered before the <option>verify</option> condition
52981 that causes the callout, disables such output flushing.
52982 </para>
52983 </listitem></varlistentry>
52984 <varlistentry>
52985 <term><emphasis role="bold">control&nbsp;=&nbsp;no_mbox_unspool</emphasis></term>
52986 <listitem>
52987 <para>
52988 This control is available when Exim is compiled with the content scanning
52989 extension. Content scanning may require a copy of the current message, or parts
52990 of it, to be written in <quote>mbox format</quote> to a spool file, for passing to a virus
52991 or spam scanner. Normally, such copies are deleted when they are no longer
52992 needed. If this control is set, the copies are not deleted. The control applies
52993 only to the current message, not to any subsequent ones that may be received in
52994 the same SMTP connection. It is provided for debugging purposes and is unlikely
52995 to be useful in production.
52996 </para>
52997 </listitem></varlistentry>
52998 <varlistentry>
52999 <term><emphasis role="bold">control&nbsp;=&nbsp;no_multiline_responses</emphasis></term>
53000 <listitem>
53001 <para>
53002 <indexterm role="concept">
53003 <primary>multiline responses, suppressing</primary>
53004 </indexterm>
53005 This control is permitted for any ACL except the one for non-SMTP messages.
53006 It seems that there are broken clients in use that cannot handle multiline
53007 SMTP responses, despite the fact that RFC 821 defined them over 20 years ago.
53008 </para>
53009 <para>
53010 If this control is set, multiline SMTP responses from ACL rejections are
53011 suppressed. One way of doing this would have been to put out these responses as
53012 one long line. However, RFC 2821 specifies a maximum of 512 bytes per response
53013 (<quote>use multiline responses for more</quote> it says &ndash; ha!), and some of the
53014 responses might get close to that. So this facility, which is after all only a
53015 sop to broken clients, is implemented by doing two very easy things:
53016 </para>
53017 <itemizedlist>
53018 <listitem>
53019 <para>
53020 Extra information that is normally output as part of a rejection caused by
53021 sender verification failure is omitted. Only the final line (typically <quote>sender
53022 verification failed</quote>) is sent.
53023 </para>
53024 </listitem>
53025 <listitem>
53026 <para>
53027 If a <option>message</option> modifier supplies a multiline response, only the first
53028 line is output.
53029 </para>
53030 </listitem>
53031 </itemizedlist>
53032 <para>
53033 The setting of the switch can, of course, be made conditional on the
53034 calling host. Its effect lasts until the end of the SMTP connection.
53035 </para>
53036 </listitem></varlistentry>
53037 <varlistentry>
53038 <term><emphasis role="bold">control&nbsp;=&nbsp;no_pipelining</emphasis></term>
53039 <listitem>
53040 <para>
53041 <indexterm role="concept">
53042 <primary>PIPELINING</primary>
53043 <secondary>suppressing advertising</secondary>
53044 </indexterm>
53045 This control turns off the advertising of the PIPELINING extension to SMTP in
53046 the current session. To be useful, it must be obeyed before Exim sends its
53047 response to an EHLO command. Therefore, it should normally appear in an ACL
53048 controlled by <option>acl_smtp_connect</option> or <option>acl_smtp_helo</option>. See also
53049 <option>pipelining_advertise_hosts</option>.
53050 </para>
53051 </listitem></varlistentry>
53052 <varlistentry>
53053 <term><emphasis role="bold">control&nbsp;=&nbsp;queue_only</emphasis></term>
53054 <listitem>
53055 <para>
53056 <indexterm role="option">
53057 <primary><option>queue_only</option></primary>
53058 </indexterm>
53059 <indexterm role="concept">
53060 <primary>queueing incoming messages</primary>
53061 </indexterm>
53062 This control is permitted only for the MAIL, RCPT, DATA, and non-SMTP ACLs, in
53063 other words, only when a message is being received. If the message is accepted,
53064 it is placed on Exim&#x2019;s queue and left there for delivery by a subsequent queue
53065 runner. No immediate delivery process is started. In other words, it has the
53066 effect as the <option>queue_only</option> global option. However, the control applies only
53067 to the current message, not to any subsequent ones that may be received in the
53068 same SMTP connection.
53069 </para>
53070 </listitem></varlistentry>
53071 <varlistentry>
53072 <term><emphasis role="bold">control&nbsp;=&nbsp;submission/</emphasis>&lt;<emphasis>options</emphasis>&gt;</term>
53073 <listitem>
53074 <para>
53075 <indexterm role="concept">
53076 <primary>message</primary>
53077 <secondary>submission</secondary>
53078 </indexterm>
53079 <indexterm role="concept">
53080 <primary>submission mode</primary>
53081 </indexterm>
53082 This control is permitted only for the MAIL, RCPT, and start of data ACLs (the
53083 latter is the one defined by <option>acl_smtp_predata</option>). Setting it tells Exim that
53084 the current message is a submission from a local MUA. In this case, Exim
53085 operates in <quote>submission mode</quote>, and applies certain fixups to the message if
53086 necessary. For example, it adds a <emphasis>Date:</emphasis> header line if one is not present.
53087 This control is not permitted in the <option>acl_smtp_data</option> ACL, because that is too
53088 late (the message has already been created).
53089 </para>
53090 <para>
53091 Chapter <xref linkend="CHAPmsgproc"/> describes the processing that Exim applies to
53092 messages. Section <xref linkend="SECTsubmodnon"/> covers the processing that happens in
53093 submission mode; the available options for this control are described there.
53094 The control applies only to the current message, not to any subsequent ones
53095 that may be received in the same SMTP connection.
53096 </para>
53097 </listitem></varlistentry>
53098 <varlistentry>
53099 <term><emphasis role="bold">control&nbsp;=&nbsp;suppress_local_fixups</emphasis></term>
53100 <listitem>
53101 <para>
53102 <indexterm role="concept">
53103 <primary>submission fixups, suppressing</primary>
53104 </indexterm>
53105 This control applies to locally submitted (non TCP/IP) messages, and is the
53106 complement of <literal>control = submission</literal>. It disables the fixups that are
53107 normally applied to locally-submitted messages. Specifically:
53108 </para>
53109 <itemizedlist>
53110 <listitem>
53111 <para>
53112 Any <emphasis>Sender:</emphasis> header line is left alone (in this respect, it is a
53113 dynamic version of <option>local_sender_retain</option>).
53114 </para>
53115 </listitem>
53116 <listitem>
53117 <para>
53118 No <emphasis>Message-ID:</emphasis>, <emphasis>From:</emphasis>, or <emphasis>Date:</emphasis> header lines are added.
53119 </para>
53120 </listitem>
53121 <listitem>
53122 <para>
53123 There is no check that <emphasis>From:</emphasis> corresponds to the actual sender.
53124 </para>
53125 </listitem>
53126 </itemizedlist>
53127 <para>
53128 This control may be useful when a remotely-originated message is accepted,
53129 passed to some scanning program, and then re-submitted for delivery. It can be
53130 used only in the <option>acl_smtp_mail</option>, <option>acl_smtp_rcpt</option>, <option>acl_smtp_predata</option>,
53131 and <option>acl_not_smtp_start</option> ACLs, because it has to be set before the message&#x2019;s
53132 data is read.
53133 </para>
53134 <para>
53135 <emphasis role="bold">Note:</emphasis> This control applies only to the current message, not to any others
53136 that are being submitted at the same time using <option>-bs</option> or <option>-bS</option>.
53137 </para>
53138 </listitem></varlistentry>
53139 </variablelist>
53140 </section>
53141 <section id="SECTsummesfix">
53142 <title>Summary of message fixup control</title>
53143 <para>
53144 All four possibilities for message fixups can be specified:
53145 </para>
53146 <itemizedlist>
53147 <listitem>
53148 <para>
53149 Locally submitted, fixups applied: the default.
53150 </para>
53151 </listitem>
53152 <listitem>
53153 <para>
53154 Locally submitted, no fixups applied: use
53155 <literal>control = suppress_local_fixups</literal>.
53156 </para>
53157 </listitem>
53158 <listitem>
53159 <para>
53160 Remotely submitted, no fixups applied: the default.
53161 </para>
53162 </listitem>
53163 <listitem>
53164 <para>
53165 Remotely submitted, fixups applied: use <literal>control = submission</literal>.
53166 </para>
53167 </listitem>
53168 </itemizedlist>
53169 </section>
53170 <section id="SECTaddheadacl">
53171 <title>Adding header lines in ACLs</title>
53172 <para>
53173 <indexterm role="concept">
53174 <primary>header lines</primary>
53175 <secondary>adding in an ACL</secondary>
53176 </indexterm>
53177 <indexterm role="concept">
53178 <primary>header lines</primary>
53179 <secondary>position of added lines</secondary>
53180 </indexterm>
53181 <indexterm role="concept">
53182 <primary><option>add_header</option> ACL modifier</primary>
53183 </indexterm>
53184 The <option>add_header</option> modifier can be used to add one or more extra header lines
53185 to an incoming message, as in this example:
53186 </para>
53187 <literallayout class="monospaced">
53188 warn dnslists = sbl.spamhaus.org : \
53189                 dialup.mail-abuse.org
53190      add_header = X-blacklisted-at: $dnslist_domain
53191 </literallayout>
53192 <para>
53193 The <option>add_header</option> modifier is permitted in the MAIL, RCPT, PREDATA, DATA,
53194 MIME, DKIM, and non-SMTP ACLs (in other words, those that are concerned with
53195 receiving a message). The message must ultimately be accepted for
53196 <option>add_header</option> to have any significant effect. You can use <option>add_header</option> with
53197 any ACL verb, including <option>deny</option> (though this is potentially useful only in a
53198 RCPT ACL).
53199 </para>
53200 <para>
53201 Headers will not be added to the message if the modifier is used in
53202 DATA, MIME or DKIM ACLs for messages delivered by cutthrough routing.
53203 </para>
53204 <para>
53205 Leading and trailing newlines are removed from
53206 the data for the <option>add_header</option> modifier; if it then
53207 contains one or more newlines that
53208 are not followed by a space or a tab, it is assumed to contain multiple header
53209 lines. Each one is checked for valid syntax; <literal>X-ACL-Warn:</literal> is added to the
53210 front of any line that is not a valid header line.
53211 </para>
53212 <para>
53213 Added header lines are accumulated during the MAIL, RCPT, and predata ACLs.
53214 They are added to the message before processing the DATA and MIME ACLs.
53215 However, if an identical header line is requested more than once, only one copy
53216 is actually added to the message. Further header lines may be accumulated
53217 during the DATA and MIME ACLs, after which they are added to the message, again
53218 with duplicates suppressed. Thus, it is possible to add two identical header
53219 lines to an SMTP message, but only if one is added before DATA and one after.
53220 In the case of non-SMTP messages, new headers are accumulated during the
53221 non-SMTP ACLs, and are added to the message after all the ACLs have run. If a
53222 message is rejected after DATA or by the non-SMTP ACL, all added header lines
53223 are included in the entry that is written to the reject log.
53224 </para>
53225 <para>
53226 <indexterm role="concept">
53227 <primary>header lines</primary>
53228 <secondary>added; visibility of</secondary>
53229 </indexterm>
53230 Header lines are not visible in string expansions
53231 of message headers
53232 until they are added to the
53233 message. It follows that header lines defined in the MAIL, RCPT, and predata
53234 ACLs are not visible until the DATA ACL and MIME ACLs are run. Similarly,
53235 header lines that are added by the DATA or MIME ACLs are not visible in those
53236 ACLs. Because of this restriction, you cannot use header lines as a way of
53237 passing data between (for example) the MAIL and RCPT ACLs. If you want to do
53238 this, you can use ACL variables, as described in section
53239 <xref linkend="SECTaclvariables"/>.
53240 </para>
53241 <para>
53242 The list of headers yet to be added is given by the <option>$headers_added</option> variable.
53243 </para>
53244 <para>
53245 The <option>add_header</option> modifier acts immediately as it is encountered during the
53246 processing of an ACL. Notice the difference between these two cases:
53247 </para>
53248 <literallayout>
53249 <literal>accept add_header = ADDED: some text</literal>
53250 <literal>       </literal>&lt;<emphasis>some condition</emphasis>&gt;
53251
53252 <literal>accept </literal>&lt;<emphasis>some condition</emphasis>&gt;
53253 <literal>       add_header = ADDED: some text</literal>
53254 </literallayout>
53255 <para>
53256 In the first case, the header line is always added, whether or not the
53257 condition is true. In the second case, the header line is added only if the
53258 condition is true. Multiple occurrences of <option>add_header</option> may occur in the same
53259 ACL statement. All those that are encountered before a condition fails are
53260 honoured.
53261 </para>
53262 <para>
53263 <indexterm role="concept">
53264 <primary><option>warn</option> ACL verb</primary>
53265 </indexterm>
53266 For compatibility with previous versions of Exim, a <option>message</option> modifier for a
53267 <option>warn</option> verb acts in the same way as <option>add_header</option>, except that it takes
53268 effect only if all the conditions are true, even if it appears before some of
53269 them. Furthermore, only the last occurrence of <option>message</option> is honoured. This
53270 usage of <option>message</option> is now deprecated. If both <option>add_header</option> and <option>message</option>
53271 are present on a <option>warn</option> verb, both are processed according to their
53272 specifications.
53273 </para>
53274 <para>
53275 By default, new header lines are added to a message at the end of the existing
53276 header lines. However, you can specify that any particular header line should
53277 be added right at the start (before all the <emphasis>Received:</emphasis> lines), immediately
53278 after the first block of <emphasis>Received:</emphasis> lines, or immediately before any line
53279 that is not a <emphasis>Received:</emphasis> or <emphasis>Resent-something:</emphasis> header.
53280 </para>
53281 <para>
53282 This is done by specifying <quote>:at_start:</quote>, <quote>:after_received:</quote>, or
53283 <quote>:at_start_rfc:</quote> (or, for completeness, <quote>:at_end:</quote>) before the text of the
53284 header line, respectively. (Header text cannot start with a colon, as there has
53285 to be a header name first.) For example:
53286 </para>
53287 <literallayout class="monospaced">
53288 warn add_header = \
53289        :after_received:X-My-Header: something or other...
53290 </literallayout>
53291 <para>
53292 If more than one header line is supplied in a single <option>add_header</option> modifier,
53293 each one is treated independently and can therefore be placed differently. If
53294 you add more than one line at the start, or after the Received: block, they end
53295 up in reverse order.
53296 </para>
53297 <para>
53298 <emphasis role="bold">Warning</emphasis>: This facility currently applies only to header lines that are
53299 added in an ACL. It does NOT work for header lines that are added in a
53300 system filter or in a router or transport.
53301 </para>
53302 </section>
53303 <section id="SECTremoveheadacl">
53304 <title>Removing header lines in ACLs</title>
53305 <para>
53306 <indexterm role="concept">
53307 <primary>header lines</primary>
53308 <secondary>removing in an ACL</secondary>
53309 </indexterm>
53310 <indexterm role="concept">
53311 <primary>header lines</primary>
53312 <secondary>position of removed lines</secondary>
53313 </indexterm>
53314 <indexterm role="concept">
53315 <primary><option>remove_header</option> ACL modifier</primary>
53316 </indexterm>
53317 The <option>remove_header</option> modifier can be used to remove one or more header lines
53318 from an incoming message, as in this example:
53319 </para>
53320 <literallayout class="monospaced">
53321 warn   message        = Remove internal headers
53322        remove_header  = x-route-mail1 : x-route-mail2
53323 </literallayout>
53324 <para>
53325 The <option>remove_header</option> modifier is permitted in the MAIL, RCPT, PREDATA, DATA,
53326 MIME, DKIM, and non-SMTP ACLs (in other words, those that are concerned with
53327 receiving a message). The message must ultimately be accepted for
53328 <option>remove_header</option> to have any significant effect. You can use <option>remove_header</option>
53329 with any ACL verb, including <option>deny</option>, though this is really not useful for
53330 any verb that doesn&#x2019;t result in a delivered message.
53331 </para>
53332 <para>
53333 Headers will not be removed to the message if the modifier is used in
53334 DATA, MIME or DKIM ACLs for messages delivered by cutthrough routing.
53335 </para>
53336 <para>
53337 More than one header can be removed at the same time by using a colon separated
53338 list of header names. The header matching is case insensitive. Wildcards are
53339 not permitted, nor is list expansion performed, so you cannot use hostlists to
53340 create a list of headers, however both connection and message variable expansion
53341 are performed (<option>$acl_c_*</option> and <option>$acl_m_*</option>), illustrated in this example:
53342 </para>
53343 <literallayout class="monospaced">
53344 warn   hosts           = +internal_hosts
53345        set acl_c_ihdrs = x-route-mail1 : x-route-mail2
53346 warn   message         = Remove internal headers
53347        remove_header   = $acl_c_ihdrs
53348 </literallayout>
53349 <para>
53350 Removed header lines are accumulated during the MAIL, RCPT, and predata ACLs.
53351 They are removed from the message before processing the DATA and MIME ACLs.
53352 There is no harm in attempting to remove the same header twice nor is removing
53353 a non-existent header. Further header lines to be removed may be accumulated
53354 during the DATA and MIME ACLs, after which they are removed from the message,
53355 if present. In the case of non-SMTP messages, headers to be removed are
53356 accumulated during the non-SMTP ACLs, and are removed from the message after
53357 all the ACLs have run. If a message is rejected after DATA or by the non-SMTP
53358 ACL, there really is no effect because there is no logging of what headers
53359 would have been removed.
53360 </para>
53361 <para>
53362 <indexterm role="concept">
53363 <primary>header lines</primary>
53364 <secondary>removed; visibility of</secondary>
53365 </indexterm>
53366 Header lines are not visible in string expansions until the DATA phase when it
53367 is received. Any header lines removed in the MAIL, RCPT, and predata ACLs are
53368 not visible in the DATA ACL and MIME ACLs. Similarly, header lines that are
53369 removed by the DATA or MIME ACLs are still visible in those ACLs. Because of
53370 this restriction, you cannot use header lines as a way of controlling data
53371 passed between (for example) the MAIL and RCPT ACLs. If you want to do this,
53372 you should instead use ACL variables, as described in section
53373 <xref linkend="SECTaclvariables"/>.
53374 </para>
53375 <para>
53376 The <option>remove_header</option> modifier acts immediately as it is encountered during the
53377 processing of an ACL. Notice the difference between these two cases:
53378 </para>
53379 <literallayout>
53380 <literal>accept remove_header = X-Internal</literal>
53381 <literal>       </literal>&lt;<emphasis>some condition</emphasis>&gt;
53382
53383 <literal>accept </literal>&lt;<emphasis>some condition</emphasis>&gt;
53384 <literal>       remove_header = X-Internal</literal>
53385 </literallayout>
53386 <para>
53387 In the first case, the header line is always removed, whether or not the
53388 condition is true. In the second case, the header line is removed only if the
53389 condition is true. Multiple occurrences of <option>remove_header</option> may occur in the
53390 same ACL statement. All those that are encountered before a condition fails
53391 are honoured.
53392 </para>
53393 <para>
53394 <emphasis role="bold">Warning</emphasis>: This facility currently applies only to header lines that are
53395 present during ACL processing. It does NOT remove header lines that are added
53396 in a system filter or in a router or transport.
53397 </para>
53398 </section>
53399 <section id="SECTaclconditions">
53400 <title>ACL conditions</title>
53401 <para>
53402 <indexterm role="concept">
53403 <primary>access control lists (ACLs)</primary>
53404 <secondary>conditions; list of</secondary>
53405 </indexterm>
53406 Some of the conditions listed in this section are available only when Exim is
53407 compiled with the content-scanning extension. They are included here briefly
53408 for completeness. More detailed descriptions can be found in the discussion on
53409 content scanning in chapter <xref linkend="CHAPexiscan"/>.
53410 </para>
53411 <para>
53412 Not all conditions are relevant in all circumstances. For example, testing
53413 senders and recipients does not make sense in an ACL that is being run as the
53414 result of the arrival of an ETRN command, and checks on message headers can be
53415 done only in the ACLs specified by <option>acl_smtp_data</option> and <option>acl_not_smtp</option>. You
53416 can use the same condition (with different parameters) more than once in the
53417 same ACL statement. This provides a way of specifying an <quote>and</quote> conjunction.
53418 The conditions are as follows:
53419 </para>
53420 <variablelist>
53421 <varlistentry>
53422 <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>
53423 <listitem>
53424 <para>
53425 <indexterm role="concept">
53426 <primary>access control lists (ACLs)</primary>
53427 <secondary>nested</secondary>
53428 </indexterm>
53429 <indexterm role="concept">
53430 <primary>access control lists (ACLs)</primary>
53431 <secondary>indirect</secondary>
53432 </indexterm>
53433 <indexterm role="concept">
53434 <primary>access control lists (ACLs)</primary>
53435 <secondary>arguments</secondary>
53436 </indexterm>
53437 <indexterm role="concept">
53438 <primary><option>acl</option> ACL condition</primary>
53439 </indexterm>
53440 The possible values of the argument are the same as for the
53441 <option>acl_smtp_</option><emphasis>xxx</emphasis> options. The named or inline ACL is run. If it returns
53442 <quote>accept</quote> the condition is true; if it returns <quote>deny</quote> the condition is
53443 false. If it returns <quote>defer</quote>, the current ACL returns <quote>defer</quote> unless the
53444 condition is on a <option>warn</option> verb. In that case, a <quote>defer</quote> return makes the
53445 condition false. This means that further processing of the <option>warn</option> verb
53446 ceases, but processing of the ACL continues.
53447 </para>
53448 <para>
53449 If the argument is a named ACL, up to nine space-separated optional values
53450 can be appended; they appear within the called ACL in $acl_arg1 to $acl_arg9,
53451 and $acl_narg is set to the count of values.
53452 Previous values of these variables are restored after the call returns.
53453 The name and values are expanded separately.
53454 </para>
53455 <para>
53456 If the nested <option>acl</option> returns <quote>drop</quote> and the outer condition denies access,
53457 the connection is dropped. If it returns <quote>discard</quote>, the verb must be
53458 <option>accept</option> or <option>discard</option>, and the action is taken immediately &ndash; no further
53459 conditions are tested.
53460 </para>
53461 <para>
53462 ACLs may be nested up to 20 deep; the limit exists purely to catch runaway
53463 loops. This condition allows you to use different ACLs in different
53464 circumstances. For example, different ACLs can be used to handle RCPT commands
53465 for different local users or different local domains.
53466 </para>
53467 </listitem></varlistentry>
53468 <varlistentry>
53469 <term><emphasis role="bold">authenticated&nbsp;=&nbsp;</emphasis>&lt;<emphasis>string&nbsp;list</emphasis>&gt;</term>
53470 <listitem>
53471 <para>
53472 <indexterm role="concept">
53473 <primary><option>authenticated</option> ACL condition</primary>
53474 </indexterm>
53475 <indexterm role="concept">
53476 <primary>authentication</primary>
53477 <secondary>ACL checking</secondary>
53478 </indexterm>
53479 <indexterm role="concept">
53480 <primary>access control lists (ACLs)</primary>
53481 <secondary>testing for authentication</secondary>
53482 </indexterm>
53483 If the SMTP connection is not authenticated, the condition is false. Otherwise,
53484 the name of the authenticator is tested against the list. To test for
53485 authentication by any authenticator, you can set
53486 </para>
53487 <literallayout class="monospaced">
53488 authenticated = *
53489 </literallayout>
53490 </listitem></varlistentry>
53491 <varlistentry>
53492 <term><emphasis role="bold">condition&nbsp;=&nbsp;</emphasis>&lt;<emphasis>string</emphasis>&gt;</term>
53493 <listitem>
53494 <para>
53495 <indexterm role="concept">
53496 <primary><option>condition</option> ACL condition</primary>
53497 </indexterm>
53498 <indexterm role="concept">
53499 <primary>customizing</primary>
53500 <secondary>ACL condition</secondary>
53501 </indexterm>
53502 <indexterm role="concept">
53503 <primary>access control lists (ACLs)</primary>
53504 <secondary>customized test</secondary>
53505 </indexterm>
53506 <indexterm role="concept">
53507 <primary>access control lists (ACLs)</primary>
53508 <secondary>testing, customized</secondary>
53509 </indexterm>
53510 This feature allows you to make up custom conditions. If the result of
53511 expanding the string is an empty string, the number zero, or one of the strings
53512 <quote>no</quote> or <quote>false</quote>, the condition is false. If the result is any non-zero
53513 number, or one of the strings <quote>yes</quote> or <quote>true</quote>, the condition is true. For
53514 any other value, some error is assumed to have occurred, and the ACL returns
53515 <quote>defer</quote>. However, if the expansion is forced to fail, the condition is
53516 ignored. The effect is to treat it as true, whether it is positive or
53517 negative.
53518 </para>
53519 </listitem></varlistentry>
53520 <varlistentry>
53521 <term><emphasis role="bold">decode&nbsp;=&nbsp;</emphasis>&lt;<emphasis>location</emphasis>&gt;</term>
53522 <listitem>
53523 <para>
53524 <indexterm role="concept">
53525 <primary><option>decode</option> ACL condition</primary>
53526 </indexterm>
53527 This condition is available only when Exim is compiled with the
53528 content-scanning extension, and it is allowed only in the ACL defined by
53529 <option>acl_smtp_mime</option>. It causes the current MIME part to be decoded into a file.
53530 If all goes well, the condition is true. It is false only if there are
53531 problems such as a syntax error or a memory shortage. For more details, see
53532 chapter <xref linkend="CHAPexiscan"/>.
53533 </para>
53534 </listitem></varlistentry>
53535 <varlistentry>
53536 <term><emphasis role="bold">demime&nbsp;=&nbsp;</emphasis>&lt;<emphasis>extension&nbsp;list</emphasis>&gt;</term>
53537 <listitem>
53538 <para>
53539 <indexterm role="concept">
53540 <primary><option>demime</option> ACL condition</primary>
53541 </indexterm>
53542 This condition is available only when Exim is compiled with the
53543 content-scanning extension. Its use is described in section
53544 <xref linkend="SECTdemimecond"/>.
53545 </para>
53546 </listitem></varlistentry>
53547 <varlistentry>
53548 <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>
53549 <listitem>
53550 <para>
53551 <indexterm role="concept">
53552 <primary><option>dnslists</option> ACL condition</primary>
53553 </indexterm>
53554 <indexterm role="concept">
53555 <primary>DNS list</primary>
53556 <secondary>in ACL</secondary>
53557 </indexterm>
53558 <indexterm role="concept">
53559 <primary>black list (DNS)</primary>
53560 </indexterm>
53561 <indexterm role="concept">
53562 <primary>access control lists (ACLs)</primary>
53563 <secondary>testing a DNS list</secondary>
53564 </indexterm>
53565 This condition checks for entries in DNS black lists. These are also known as
53566 <quote>RBL lists</quote>, after the original Realtime Blackhole List, but note that the
53567 use of the lists at <emphasis>mail-abuse.org</emphasis> now carries a charge. There are too many
53568 different variants of this condition to describe briefly here. See sections
53569 <xref linkend="SECTmorednslists"/>&ndash;<xref linkend="SECTmorednslistslast"/> for details.
53570 </para>
53571 </listitem></varlistentry>
53572 <varlistentry>
53573 <term><emphasis role="bold">domains&nbsp;=&nbsp;</emphasis>&lt;<emphasis>domain&nbsp;list</emphasis>&gt;</term>
53574 <listitem>
53575 <para>
53576 <indexterm role="concept">
53577 <primary><option>domains</option> ACL condition</primary>
53578 </indexterm>
53579 <indexterm role="concept">
53580 <primary>domain</primary>
53581 <secondary>ACL checking</secondary>
53582 </indexterm>
53583 <indexterm role="concept">
53584 <primary>access control lists (ACLs)</primary>
53585 <secondary>testing a recipient domain</secondary>
53586 </indexterm>
53587 <indexterm role="variable">
53588 <primary><varname>$domain_data</varname></primary>
53589 </indexterm>
53590 This condition is relevant only after a RCPT command. It checks that the domain
53591 of the recipient address is in the domain list. If percent-hack processing is
53592 enabled, it is done before this test is done. If the check succeeds with a
53593 lookup, the result of the lookup is placed in <varname>$domain_data</varname> until the next
53594 <option>domains</option> test.
53595 </para>
53596 <para>
53597 <emphasis role="bold">Note carefully</emphasis> (because many people seem to fall foul of this): you cannot
53598 use <option>domains</option> in a DATA ACL.
53599 </para>
53600 </listitem></varlistentry>
53601 <varlistentry>
53602 <term><emphasis role="bold">encrypted&nbsp;=&nbsp;</emphasis>&lt;<emphasis>string&nbsp;list</emphasis>&gt;</term>
53603 <listitem>
53604 <para>
53605 <indexterm role="concept">
53606 <primary><option>encrypted</option> ACL condition</primary>
53607 </indexterm>
53608 <indexterm role="concept">
53609 <primary>encryption</primary>
53610 <secondary>checking in an ACL</secondary>
53611 </indexterm>
53612 <indexterm role="concept">
53613 <primary>access control lists (ACLs)</primary>
53614 <secondary>testing for encryption</secondary>
53615 </indexterm>
53616 If the SMTP connection is not encrypted, the condition is false. Otherwise, the
53617 name of the cipher suite in use is tested against the list. To test for
53618 encryption without testing for any specific cipher suite(s), set
53619 </para>
53620 <literallayout class="monospaced">
53621 encrypted = *
53622 </literallayout>
53623 </listitem></varlistentry>
53624 <varlistentry>
53625 <term><emphasis role="bold">hosts&nbsp;=&nbsp;</emphasis>&lt;<emphasis>host&nbsp;list</emphasis>&gt;</term>
53626 <listitem>
53627 <para>
53628 <indexterm role="concept">
53629 <primary><option>hosts</option> ACL condition</primary>
53630 </indexterm>
53631 <indexterm role="concept">
53632 <primary>host</primary>
53633 <secondary>ACL checking</secondary>
53634 </indexterm>
53635 <indexterm role="concept">
53636 <primary>access control lists (ACLs)</primary>
53637 <secondary>testing the client host</secondary>
53638 </indexterm>
53639 This condition tests that the calling host matches the host list. If you have
53640 name lookups or wildcarded host names and IP addresses in the same host list,
53641 you should normally put the IP addresses first. For example, you could have:
53642 </para>
53643 <literallayout class="monospaced">
53644 accept hosts = 10.9.8.7 : dbm;/etc/friendly/hosts
53645 </literallayout>
53646 <para>
53647 The lookup in this example uses the host name for its key. This is implied by
53648 the lookup type <quote>dbm</quote>. (For a host address lookup you would use <quote>net-dbm</quote>
53649 and it wouldn&#x2019;t matter which way round you had these two items.)
53650 </para>
53651 <para>
53652 The reason for the problem with host names lies in the left-to-right way that
53653 Exim processes lists. It can test IP addresses without doing any DNS lookups,
53654 but when it reaches an item that requires a host name, it fails if it cannot
53655 find a host name to compare with the pattern. If the above list is given in the
53656 opposite order, the <option>accept</option> statement fails for a host whose name cannot be
53657 found, even if its IP address is 10.9.8.7.
53658 </para>
53659 <para>
53660 If you really do want to do the name check first, and still recognize the IP
53661 address even if the name lookup fails, you can rewrite the ACL like this:
53662 </para>
53663 <literallayout class="monospaced">
53664 accept hosts = dbm;/etc/friendly/hosts
53665 accept hosts = 10.9.8.7
53666 </literallayout>
53667 <para>
53668 The default action on failing to find the host name is to assume that the host
53669 is not in the list, so the first <option>accept</option> statement fails. The second
53670 statement can then check the IP address.
53671 </para>
53672 <para>
53673 <indexterm role="variable">
53674 <primary><varname>$host_data</varname></primary>
53675 </indexterm>
53676 If a <option>hosts</option> condition is satisfied by means of a lookup, the result
53677 of the lookup is made available in the <varname>$host_data</varname> variable. This
53678 allows you, for example, to set up a statement like this:
53679 </para>
53680 <literallayout class="monospaced">
53681 deny  hosts = net-lsearch;/some/file
53682 message = $host_data
53683 </literallayout>
53684 <para>
53685 which gives a custom error message for each denied host.
53686 </para>
53687 </listitem></varlistentry>
53688 <varlistentry>
53689 <term><emphasis role="bold">local_parts&nbsp;=&nbsp;</emphasis>&lt;<emphasis>local&nbsp;part&nbsp;list</emphasis>&gt;</term>
53690 <listitem>
53691 <para>
53692 <indexterm role="concept">
53693 <primary><option>local_parts</option> ACL condition</primary>
53694 </indexterm>
53695 <indexterm role="concept">
53696 <primary>local part</primary>
53697 <secondary>ACL checking</secondary>
53698 </indexterm>
53699 <indexterm role="concept">
53700 <primary>access control lists (ACLs)</primary>
53701 <secondary>testing a local part</secondary>
53702 </indexterm>
53703 <indexterm role="variable">
53704 <primary><varname>$local_part_data</varname></primary>
53705 </indexterm>
53706 This condition is relevant only after a RCPT command. It checks that the local
53707 part of the recipient address is in the list. If percent-hack processing is
53708 enabled, it is done before this test. If the check succeeds with a lookup, the
53709 result of the lookup is placed in <varname>$local_part_data</varname>, which remains set until
53710 the next <option>local_parts</option> test.
53711 </para>
53712 </listitem></varlistentry>
53713 <varlistentry>
53714 <term><emphasis role="bold">malware&nbsp;=&nbsp;</emphasis>&lt;<emphasis>option</emphasis>&gt;</term>
53715 <listitem>
53716 <para>
53717 <indexterm role="concept">
53718 <primary><option>malware</option> ACL condition</primary>
53719 </indexterm>
53720 <indexterm role="concept">
53721 <primary>access control lists (ACLs)</primary>
53722 <secondary>virus scanning</secondary>
53723 </indexterm>
53724 <indexterm role="concept">
53725 <primary>access control lists (ACLs)</primary>
53726 <secondary>scanning for viruses</secondary>
53727 </indexterm>
53728 This condition is available only when Exim is compiled with the
53729 content-scanning extension. It causes the incoming message to be scanned for
53730 viruses. For details, see chapter <xref linkend="CHAPexiscan"/>.
53731 </para>
53732 </listitem></varlistentry>
53733 <varlistentry>
53734 <term><emphasis role="bold">mime_regex&nbsp;=&nbsp;</emphasis>&lt;<emphasis>list&nbsp;of&nbsp;regular&nbsp;expressions</emphasis>&gt;</term>
53735 <listitem>
53736 <para>
53737 <indexterm role="concept">
53738 <primary><option>mime_regex</option> ACL condition</primary>
53739 </indexterm>
53740 <indexterm role="concept">
53741 <primary>access control lists (ACLs)</primary>
53742 <secondary>testing by regex matching</secondary>
53743 </indexterm>
53744 This condition is available only when Exim is compiled with the
53745 content-scanning extension, and it is allowed only in the ACL defined by
53746 <option>acl_smtp_mime</option>. It causes the current MIME part to be scanned for a match
53747 with any of the regular expressions. For details, see chapter
53748 <xref linkend="CHAPexiscan"/>.
53749 </para>
53750 </listitem></varlistentry>
53751 <varlistentry>
53752 <term><emphasis role="bold">ratelimit&nbsp;=&nbsp;</emphasis>&lt;<emphasis>parameters</emphasis>&gt;</term>
53753 <listitem>
53754 <para>
53755 <indexterm role="concept">
53756 <primary>rate limiting</primary>
53757 </indexterm>
53758 This condition can be used to limit the rate at which a user or host submits
53759 messages. Details are given in section <xref linkend="SECTratelimiting"/>.
53760 </para>
53761 </listitem></varlistentry>
53762 <varlistentry>
53763 <term><emphasis role="bold">recipients&nbsp;=&nbsp;</emphasis>&lt;<emphasis>address&nbsp;list</emphasis>&gt;</term>
53764 <listitem>
53765 <para>
53766 <indexterm role="concept">
53767 <primary><option>recipients</option> ACL condition</primary>
53768 </indexterm>
53769 <indexterm role="concept">
53770 <primary>recipient</primary>
53771 <secondary>ACL checking</secondary>
53772 </indexterm>
53773 <indexterm role="concept">
53774 <primary>access control lists (ACLs)</primary>
53775 <secondary>testing a recipient</secondary>
53776 </indexterm>
53777 This condition is relevant only after a RCPT command. It checks the entire
53778 recipient address against a list of recipients.
53779 </para>
53780 </listitem></varlistentry>
53781 <varlistentry>
53782 <term><emphasis role="bold">regex&nbsp;=&nbsp;</emphasis>&lt;<emphasis>list&nbsp;of&nbsp;regular&nbsp;expressions</emphasis>&gt;</term>
53783 <listitem>
53784 <para>
53785 <indexterm role="concept">
53786 <primary><option>regex</option> ACL condition</primary>
53787 </indexterm>
53788 <indexterm role="concept">
53789 <primary>access control lists (ACLs)</primary>
53790 <secondary>testing by regex matching</secondary>
53791 </indexterm>
53792 This condition is available only when Exim is compiled with the
53793 content-scanning extension, and is available only in the DATA, MIME, and
53794 non-SMTP ACLs. It causes the incoming message to be scanned for a match with
53795 any of the regular expressions. For details, see chapter <xref linkend="CHAPexiscan"/>.
53796 </para>
53797 </listitem></varlistentry>
53798 <varlistentry>
53799 <term><emphasis role="bold">sender_domains&nbsp;=&nbsp;</emphasis>&lt;<emphasis>domain&nbsp;list</emphasis>&gt;</term>
53800 <listitem>
53801 <para>
53802 <indexterm role="concept">
53803 <primary><option>sender_domains</option> ACL condition</primary>
53804 </indexterm>
53805 <indexterm role="concept">
53806 <primary>sender</primary>
53807 <secondary>ACL checking</secondary>
53808 </indexterm>
53809 <indexterm role="concept">
53810 <primary>access control lists (ACLs)</primary>
53811 <secondary>testing a sender domain</secondary>
53812 </indexterm>
53813 <indexterm role="variable">
53814 <primary><varname>$domain</varname></primary>
53815 </indexterm>
53816 <indexterm role="variable">
53817 <primary><varname>$sender_address_domain</varname></primary>
53818 </indexterm>
53819 This condition tests the domain of the sender of the message against the given
53820 domain list. <emphasis role="bold">Note</emphasis>: The domain of the sender address is in
53821 <varname>$sender_address_domain</varname>. It is <emphasis>not</emphasis> put in <varname>$domain</varname> during the testing
53822 of this condition. This is an exception to the general rule for testing domain
53823 lists. It is done this way so that, if this condition is used in an ACL for a
53824 RCPT command, the recipient&#x2019;s domain (which is in <varname>$domain</varname>) can be used to
53825 influence the sender checking.
53826 </para>
53827 <para>
53828 <emphasis role="bold">Warning</emphasis>: It is a bad idea to use this condition on its own as a control on
53829 relaying, because sender addresses are easily, and commonly, forged.
53830 </para>
53831 </listitem></varlistentry>
53832 <varlistentry>
53833 <term><emphasis role="bold">senders&nbsp;=&nbsp;</emphasis>&lt;<emphasis>address&nbsp;list</emphasis>&gt;</term>
53834 <listitem>
53835 <para>
53836 <indexterm role="concept">
53837 <primary><option>senders</option> ACL condition</primary>
53838 </indexterm>
53839 <indexterm role="concept">
53840 <primary>sender</primary>
53841 <secondary>ACL checking</secondary>
53842 </indexterm>
53843 <indexterm role="concept">
53844 <primary>access control lists (ACLs)</primary>
53845 <secondary>testing a sender</secondary>
53846 </indexterm>
53847 This condition tests the sender of the message against the given list. To test
53848 for a bounce message, which has an empty sender, set
53849 </para>
53850 <literallayout class="monospaced">
53851 senders = :
53852 </literallayout>
53853 <para>
53854 <emphasis role="bold">Warning</emphasis>: It is a bad idea to use this condition on its own as a control on
53855 relaying, because sender addresses are easily, and commonly, forged.
53856 </para>
53857 </listitem></varlistentry>
53858 <varlistentry>
53859 <term><emphasis role="bold">spam&nbsp;=&nbsp;</emphasis>&lt;<emphasis>username</emphasis>&gt;</term>
53860 <listitem>
53861 <para>
53862 <indexterm role="concept">
53863 <primary><option>spam</option> ACL condition</primary>
53864 </indexterm>
53865 <indexterm role="concept">
53866 <primary>access control lists (ACLs)</primary>
53867 <secondary>scanning for spam</secondary>
53868 </indexterm>
53869 This condition is available only when Exim is compiled with the
53870 content-scanning extension. It causes the incoming message to be scanned by
53871 SpamAssassin. For details, see chapter <xref linkend="CHAPexiscan"/>.
53872 </para>
53873 </listitem></varlistentry>
53874 <varlistentry>
53875 <term><emphasis role="bold">verify&nbsp;=&nbsp;certificate</emphasis></term>
53876 <listitem>
53877 <para>
53878 <indexterm role="concept">
53879 <primary><option>verify</option> ACL condition</primary>
53880 </indexterm>
53881 <indexterm role="concept">
53882 <primary>TLS</primary>
53883 <secondary>client certificate verification</secondary>
53884 </indexterm>
53885 <indexterm role="concept">
53886 <primary>certificate</primary>
53887 <secondary>verification of client</secondary>
53888 </indexterm>
53889 <indexterm role="concept">
53890 <primary>access control lists (ACLs)</primary>
53891 <secondary>certificate verification</secondary>
53892 </indexterm>
53893 <indexterm role="concept">
53894 <primary>access control lists (ACLs)</primary>
53895 <secondary>testing a TLS certificate</secondary>
53896 </indexterm>
53897 This condition is true in an SMTP session if the session is encrypted, and a
53898 certificate was received from the client, and the certificate was verified. The
53899 server requests a certificate only if the client matches <option>tls_verify_hosts</option>
53900 or <option>tls_try_verify_hosts</option> (see chapter <xref linkend="CHAPTLS"/>).
53901 </para>
53902 </listitem></varlistentry>
53903 <varlistentry>
53904 <term><emphasis role="bold">verify&nbsp;=&nbsp;csa</emphasis></term>
53905 <listitem>
53906 <para>
53907 <indexterm role="concept">
53908 <primary>CSA verification</primary>
53909 </indexterm>
53910 This condition checks whether the sending host (the client) is authorized to
53911 send email. Details of how this works are given in section
53912 <xref linkend="SECTverifyCSA"/>.
53913 </para>
53914 </listitem></varlistentry>
53915 <varlistentry>
53916 <term><emphasis role="bold">verify&nbsp;=&nbsp;header_names_ascii</emphasis></term>
53917 <listitem>
53918 <para>
53919 <indexterm role="concept">
53920 <primary><option>verify</option> ACL condition</primary>
53921 </indexterm>
53922 <indexterm role="concept">
53923 <primary>access control lists (ACLs)</primary>
53924 <secondary>verifying header names only ASCII</secondary>
53925 </indexterm>
53926 <indexterm role="concept">
53927 <primary>header lines</primary>
53928 <secondary>verifying header names only ASCII</secondary>
53929 </indexterm>
53930 <indexterm role="concept">
53931 <primary>verifying</primary>
53932 <secondary>header names only ASCII</secondary>
53933 </indexterm>
53934 This condition is relevant only in an ACL that is run after a message has been
53935 received, that is, in an ACL specified by <option>acl_smtp_data</option> or
53936 <option>acl_not_smtp</option>.  It checks all header names (not the content) to make sure
53937 there are no non-ASCII characters, also excluding control characters.  The
53938 allowable characters are decimal ASCII values 33 through 126.
53939 </para>
53940 <para>
53941 Exim itself will handle headers with non-ASCII characters, but it can cause
53942 problems for downstream applications, so this option will allow their
53943 detection and rejection in the DATA ACL&#x2019;s.
53944 </para>
53945 </listitem></varlistentry>
53946 <varlistentry>
53947 <term><emphasis role="bold">verify&nbsp;=&nbsp;header_sender/</emphasis>&lt;<emphasis>options</emphasis>&gt;</term>
53948 <listitem>
53949 <para>
53950 <indexterm role="concept">
53951 <primary><option>verify</option> ACL condition</primary>
53952 </indexterm>
53953 <indexterm role="concept">
53954 <primary>access control lists (ACLs)</primary>
53955 <secondary>verifying sender in the header</secondary>
53956 </indexterm>
53957 <indexterm role="concept">
53958 <primary>header lines</primary>
53959 <secondary>verifying the sender in</secondary>
53960 </indexterm>
53961 <indexterm role="concept">
53962 <primary>sender</primary>
53963 <secondary>verifying in header</secondary>
53964 </indexterm>
53965 <indexterm role="concept">
53966 <primary>verifying</primary>
53967 <secondary>sender in header</secondary>
53968 </indexterm>
53969 This condition is relevant only in an ACL that is run after a message has been
53970 received, that is, in an ACL specified by <option>acl_smtp_data</option> or
53971 <option>acl_not_smtp</option>. It checks that there is a verifiable address in at least one
53972 of the <emphasis>Sender:</emphasis>, <emphasis>Reply-To:</emphasis>, or <emphasis>From:</emphasis> header lines. Such an address
53973 is loosely thought of as a <quote>sender</quote> address (hence the name of the test).
53974 However, an address that appears in one of these headers need not be an address
53975 that accepts bounce messages; only sender addresses in envelopes are required
53976 to accept bounces. Therefore, if you use the callout option on this check, you
53977 might want to arrange for a non-empty address in the MAIL command.
53978 </para>
53979 <para>
53980 Details of address verification and the options are given later, starting at
53981 section <xref linkend="SECTaddressverification"/> (callouts are described in section
53982 <xref linkend="SECTcallver"/>). You can combine this condition with the <option>senders</option>
53983 condition to restrict it to bounce messages only:
53984 </para>
53985 <literallayout class="monospaced">
53986 deny    senders = :
53987         message = A valid sender header is required for bounces
53988        !verify  = header_sender
53989 </literallayout>
53990 </listitem></varlistentry>
53991 <varlistentry>
53992 <term><emphasis role="bold">verify&nbsp;=&nbsp;header_syntax</emphasis></term>
53993 <listitem>
53994 <para>
53995 <indexterm role="concept">
53996 <primary><option>verify</option> ACL condition</primary>
53997 </indexterm>
53998 <indexterm role="concept">
53999 <primary>access control lists (ACLs)</primary>
54000 <secondary>verifying header syntax</secondary>
54001 </indexterm>
54002 <indexterm role="concept">
54003 <primary>header lines</primary>
54004 <secondary>verifying syntax</secondary>
54005 </indexterm>
54006 <indexterm role="concept">
54007 <primary>verifying</primary>
54008 <secondary>header syntax</secondary>
54009 </indexterm>
54010 This condition is relevant only in an ACL that is run after a message has been
54011 received, that is, in an ACL specified by <option>acl_smtp_data</option> or
54012 <option>acl_not_smtp</option>. It checks the syntax of all header lines that can contain
54013 lists of addresses (<emphasis>Sender:</emphasis>, <emphasis>From:</emphasis>, <emphasis>Reply-To:</emphasis>, <emphasis>To:</emphasis>, <emphasis>Cc:</emphasis>,
54014 and <emphasis>Bcc:</emphasis>). Unqualified addresses (local parts without domains) are
54015 permitted only in locally generated messages and from hosts that match
54016 <option>sender_unqualified_hosts</option> or <option>recipient_unqualified_hosts</option>, as
54017 appropriate.
54018 </para>
54019 <para>
54020 Note that this condition is a syntax check only. However, a common spamming
54021 ploy used to be to send syntactically invalid headers such as
54022 </para>
54023 <literallayout class="monospaced">
54024 To: @
54025 </literallayout>
54026 <para>
54027 and this condition can be used to reject such messages, though they are not as
54028 common as they used to be.
54029 </para>
54030 </listitem></varlistentry>
54031 <varlistentry>
54032 <term><emphasis role="bold">verify&nbsp;=&nbsp;helo</emphasis></term>
54033 <listitem>
54034 <para>
54035 <indexterm role="concept">
54036 <primary><option>verify</option> ACL condition</primary>
54037 </indexterm>
54038 <indexterm role="concept">
54039 <primary>access control lists (ACLs)</primary>
54040 <secondary>verifying HELO/EHLO</secondary>
54041 </indexterm>
54042 <indexterm role="concept">
54043 <primary>HELO</primary>
54044 <secondary>verifying</secondary>
54045 </indexterm>
54046 <indexterm role="concept">
54047 <primary>EHLO</primary>
54048 <secondary>verifying</secondary>
54049 </indexterm>
54050 <indexterm role="concept">
54051 <primary>verifying</primary>
54052 <secondary>EHLO</secondary>
54053 </indexterm>
54054 <indexterm role="concept">
54055 <primary>verifying</primary>
54056 <secondary>HELO</secondary>
54057 </indexterm>
54058 This condition is true if a HELO or EHLO command has been received from the
54059 client host, and its contents have been verified. If there has been no previous
54060 attempt to verify the HELO/EHLO contents, it is carried out when this
54061 condition is encountered. See the description of the <option>helo_verify_hosts</option> and
54062 <option>helo_try_verify_hosts</option> options for details of how to request verification
54063 independently of this condition.
54064 </para>
54065 <para>
54066 For SMTP input that does not come over TCP/IP (the <option>-bs</option> command line
54067 option), this condition is always true.
54068 </para>
54069 </listitem></varlistentry>
54070 <varlistentry>
54071 <term><emphasis role="bold">verify&nbsp;=&nbsp;not_blind</emphasis></term>
54072 <listitem>
54073 <para>
54074 <indexterm role="concept">
54075 <primary>verifying</primary>
54076 <secondary>not blind</secondary>
54077 </indexterm>
54078 <indexterm role="concept">
54079 <primary>bcc recipients, verifying none</primary>
54080 </indexterm>
54081 This condition checks that there are no blind (bcc) recipients in the message.
54082 Every envelope recipient must appear either in a <emphasis>To:</emphasis> header line or in a
54083 <emphasis>Cc:</emphasis> header line for this condition to be true. Local parts are checked
54084 case-sensitively; domains are checked case-insensitively. If <emphasis>Resent-To:</emphasis> or
54085 <emphasis>Resent-Cc:</emphasis> header lines exist, they are also checked. This condition can be
54086 used only in a DATA or non-SMTP ACL.
54087 </para>
54088 <para>
54089 There are, of course, many legitimate messages that make use of blind (bcc)
54090 recipients. This check should not be used on its own for blocking messages.
54091 </para>
54092 </listitem></varlistentry>
54093 <varlistentry>
54094 <term><emphasis role="bold">verify&nbsp;=&nbsp;recipient/</emphasis>&lt;<emphasis>options</emphasis>&gt;</term>
54095 <listitem>
54096 <para>
54097 <indexterm role="concept">
54098 <primary><option>verify</option> ACL condition</primary>
54099 </indexterm>
54100 <indexterm role="concept">
54101 <primary>access control lists (ACLs)</primary>
54102 <secondary>verifying recipient</secondary>
54103 </indexterm>
54104 <indexterm role="concept">
54105 <primary>recipient</primary>
54106 <secondary>verifying</secondary>
54107 </indexterm>
54108 <indexterm role="concept">
54109 <primary>verifying</primary>
54110 <secondary>recipient</secondary>
54111 </indexterm>
54112 <indexterm role="variable">
54113 <primary><varname>$address_data</varname></primary>
54114 </indexterm>
54115 This condition is relevant only after a RCPT command. It verifies the current
54116 recipient. Details of address verification are given later, starting at section
54117 <xref linkend="SECTaddressverification"/>. After a recipient has been verified, the value
54118 of <varname>$address_data</varname> is the last value that was set while routing the address.
54119 This applies even if the verification fails. When an address that is being
54120 verified is redirected to a single address, verification continues with the new
54121 address, and in that case, the subsequent value of <varname>$address_data</varname> is the
54122 value for the child address.
54123 </para>
54124 </listitem></varlistentry>
54125 <varlistentry>
54126 <term><emphasis role="bold">verify&nbsp;=&nbsp;reverse_host_lookup</emphasis></term>
54127 <listitem>
54128 <para>
54129 <indexterm role="concept">
54130 <primary><option>verify</option> ACL condition</primary>
54131 </indexterm>
54132 <indexterm role="concept">
54133 <primary>access control lists (ACLs)</primary>
54134 <secondary>verifying host reverse lookup</secondary>
54135 </indexterm>
54136 <indexterm role="concept">
54137 <primary>host</primary>
54138 <secondary>verifying reverse lookup</secondary>
54139 </indexterm>
54140 This condition ensures that a verified host name has been looked up from the IP
54141 address of the client host. (This may have happened already if the host name
54142 was needed for checking a host list, or if the host matched <option>host_lookup</option>.)
54143 Verification ensures that the host name obtained from a reverse DNS lookup, or
54144 one of its aliases, does, when it is itself looked up in the DNS, yield the
54145 original IP address.
54146 </para>
54147 <para>
54148 If this condition is used for a locally generated message (that is, when there
54149 is no client host involved), it always succeeds.
54150 </para>
54151 </listitem></varlistentry>
54152 <varlistentry>
54153 <term><emphasis role="bold">verify&nbsp;=&nbsp;sender/</emphasis>&lt;<emphasis>options</emphasis>&gt;</term>
54154 <listitem>
54155 <para>
54156 <indexterm role="concept">
54157 <primary><option>verify</option> ACL condition</primary>
54158 </indexterm>
54159 <indexterm role="concept">
54160 <primary>access control lists (ACLs)</primary>
54161 <secondary>verifying sender</secondary>
54162 </indexterm>
54163 <indexterm role="concept">
54164 <primary>sender</primary>
54165 <secondary>verifying</secondary>
54166 </indexterm>
54167 <indexterm role="concept">
54168 <primary>verifying</primary>
54169 <secondary>sender</secondary>
54170 </indexterm>
54171 This condition is relevant only after a MAIL or RCPT command, or after a
54172 message has been received (the <option>acl_smtp_data</option> or <option>acl_not_smtp</option> ACLs). If
54173 the message&#x2019;s sender is empty (that is, this is a bounce message), the
54174 condition is true. Otherwise, the sender address is verified.
54175 </para>
54176 <para>
54177 <indexterm role="variable">
54178 <primary><varname>$address_data</varname></primary>
54179 </indexterm>
54180 <indexterm role="variable">
54181 <primary><varname>$sender_address_data</varname></primary>
54182 </indexterm>
54183 If there is data in the <varname>$address_data</varname> variable at the end of routing, its
54184 value is placed in <varname>$sender_address_data</varname> at the end of verification. This
54185 value can be used in subsequent conditions and modifiers in the same ACL
54186 statement. It does not persist after the end of the current statement. If you
54187 want to preserve the value for longer, you can save it in an ACL variable.
54188 </para>
54189 <para>
54190 Details of verification are given later, starting at section
54191 <xref linkend="SECTaddressverification"/>. Exim caches the result of sender verification,
54192 to avoid doing it more than once per message.
54193 </para>
54194 </listitem></varlistentry>
54195 <varlistentry>
54196 <term><emphasis role="bold">verify&nbsp;=&nbsp;sender=</emphasis>&lt;<emphasis>address</emphasis>&gt;<emphasis role="bold">/</emphasis>&lt;<emphasis>options</emphasis>&gt;</term>
54197 <listitem>
54198 <para>
54199 <indexterm role="concept">
54200 <primary><option>verify</option> ACL condition</primary>
54201 </indexterm>
54202 This is a variation of the previous option, in which a modified address is
54203 verified as a sender.
54204 </para>
54205 </listitem></varlistentry>
54206 </variablelist>
54207 </section>
54208 <section id="SECTmorednslists">
54209 <title>Using DNS lists</title>
54210 <para>
54211 <indexterm role="concept">
54212 <primary>DNS list</primary>
54213 <secondary>in ACL</secondary>
54214 </indexterm>
54215 <indexterm role="concept">
54216 <primary>black list (DNS)</primary>
54217 </indexterm>
54218 <indexterm role="concept">
54219 <primary>access control lists (ACLs)</primary>
54220 <secondary>testing a DNS list</secondary>
54221 </indexterm>
54222 In its simplest form, the <option>dnslists</option> condition tests whether the calling host
54223 is on at least one of a number of DNS lists by looking up the inverted IP
54224 address in one or more DNS domains. (Note that DNS list domains are not mail
54225 domains, so the <literal>+</literal> syntax for named lists doesn&#x2019;t work - it is used for
54226 special options instead.) For example, if the calling host&#x2019;s IP
54227 address is 192.168.62.43, and the ACL statement is
54228 </para>
54229 <literallayout class="monospaced">
54230 deny dnslists = blackholes.mail-abuse.org : \
54231                 dialups.mail-abuse.org
54232 </literallayout>
54233 <para>
54234 the following records are looked up:
54235 </para>
54236 <literallayout class="monospaced">
54237 43.62.168.192.blackholes.mail-abuse.org
54238 43.62.168.192.dialups.mail-abuse.org
54239 </literallayout>
54240 <para>
54241 As soon as Exim finds an existing DNS record, processing of the list stops.
54242 Thus, multiple entries on the list provide an <quote>or</quote> conjunction. If you want
54243 to test that a host is on more than one list (an <quote>and</quote> conjunction), you can
54244 use two separate conditions:
54245 </para>
54246 <literallayout class="monospaced">
54247 deny dnslists = blackholes.mail-abuse.org
54248      dnslists = dialups.mail-abuse.org
54249 </literallayout>
54250 <para>
54251 If a DNS lookup times out or otherwise fails to give a decisive answer, Exim
54252 behaves as if the host does not match the list item, that is, as if the DNS
54253 record does not exist. If there are further items in the DNS list, they are
54254 processed.
54255 </para>
54256 <para>
54257 This is usually the required action when <option>dnslists</option> is used with <option>deny</option>
54258 (which is the most common usage), because it prevents a DNS failure from
54259 blocking mail. However, you can change this behaviour by putting one of the
54260 following special items in the list:
54261 </para>
54262 <literallayout>
54263 <literal>+include_unknown </literal>   behave as if the item is on the list
54264 <literal>+exclude_unknown </literal>   behave as if the item is not on the list (default)
54265 <literal>+defer_unknown   </literal>   give a temporary error
54266 </literallayout>
54267 <para>
54268 <indexterm role="concept">
54269 <primary><literal>+include_unknown</literal></primary>
54270 </indexterm>
54271 <indexterm role="concept">
54272 <primary><literal>+exclude_unknown</literal></primary>
54273 </indexterm>
54274 <indexterm role="concept">
54275 <primary><literal>+defer_unknown</literal></primary>
54276 </indexterm>
54277 Each of these applies to any subsequent items on the list. For example:
54278 </para>
54279 <literallayout class="monospaced">
54280 deny dnslists = +defer_unknown : foo.bar.example
54281 </literallayout>
54282 <para>
54283 Testing the list of domains stops as soon as a match is found. If you want to
54284 warn for one list and block for another, you can use two different statements:
54285 </para>
54286 <literallayout class="monospaced">
54287 deny  dnslists = blackholes.mail-abuse.org
54288 warn  message  = X-Warn: sending host is on dialups list
54289       dnslists = dialups.mail-abuse.org
54290 </literallayout>
54291 <para>
54292 DNS list lookups are cached by Exim for the duration of the SMTP session,
54293 so a lookup based on the IP address is done at most once for any incoming
54294 connection. Exim does not share information between multiple incoming
54295 connections (but your local name server cache should be active).
54296 </para>
54297 </section>
54298 <section id="SECID201">
54299 <title>Specifying the IP address for a DNS list lookup</title>
54300 <para>
54301 <indexterm role="concept">
54302 <primary>DNS list</primary>
54303 <secondary>keyed by explicit IP address</secondary>
54304 </indexterm>
54305 By default, the IP address that is used in a DNS list lookup is the IP address
54306 of the calling host. However, you can specify another IP address by listing it
54307 after the domain name, introduced by a slash. For example:
54308 </para>
54309 <literallayout class="monospaced">
54310 deny dnslists = black.list.tld/192.168.1.2
54311 </literallayout>
54312 <para>
54313 This feature is not very helpful with explicit IP addresses; it is intended for
54314 use with IP addresses that are looked up, for example, the IP addresses of the
54315 MX hosts or nameservers of an email sender address. For an example, see section
54316 <xref linkend="SECTmulkeyfor"/> below.
54317 </para>
54318 </section>
54319 <section id="SECID202">
54320 <title>DNS lists keyed on domain names</title>
54321 <para>
54322 <indexterm role="concept">
54323 <primary>DNS list</primary>
54324 <secondary>keyed by domain name</secondary>
54325 </indexterm>
54326 There are some lists that are keyed on domain names rather than inverted IP
54327 addresses (see for example the <emphasis>domain based zones</emphasis> link at
54328 <emphasis role="bold"><ulink url="http://www.rfc-ignorant.org/">http://www.rfc-ignorant.org/</ulink></emphasis>). No reversing of components is used
54329 with these lists. You can change the name that is looked up in a DNS list by
54330 listing it after the domain name, introduced by a slash. For example,
54331 </para>
54332 <literallayout class="monospaced">
54333 deny  message  = Sender's domain is listed at $dnslist_domain
54334       dnslists = dsn.rfc-ignorant.org/$sender_address_domain
54335 </literallayout>
54336 <para>
54337 This particular example is useful only in ACLs that are obeyed after the
54338 RCPT or DATA commands, when a sender address is available. If (for
54339 example) the message&#x2019;s sender is <emphasis>user@tld.example</emphasis> the name that is looked
54340 up by this example is
54341 </para>
54342 <literallayout class="monospaced">
54343 tld.example.dsn.rfc-ignorant.org
54344 </literallayout>
54345 <para>
54346 A single <option>dnslists</option> condition can contain entries for both names and IP
54347 addresses. For example:
54348 </para>
54349 <literallayout class="monospaced">
54350 deny dnslists = sbl.spamhaus.org : \
54351                 dsn.rfc-ignorant.org/$sender_address_domain
54352 </literallayout>
54353 <para>
54354 The first item checks the sending host&#x2019;s IP address; the second checks a domain
54355 name. The whole condition is true if either of the DNS lookups succeeds.
54356 </para>
54357 </section>
54358 <section id="SECTmulkeyfor">
54359 <title>Multiple explicit keys for a DNS list</title>
54360 <para>
54361 <indexterm role="concept">
54362 <primary>DNS list</primary>
54363 <secondary>multiple keys for</secondary>
54364 </indexterm>
54365 The syntax described above for looking up explicitly-defined values (either
54366 names or IP addresses) in a DNS blacklist is a simplification. After the domain
54367 name for the DNS list, what follows the slash can in fact be a list of items.
54368 As with all lists in Exim, the default separator is a colon. However, because
54369 this is a sublist within the list of DNS blacklist domains, it is necessary
54370 either to double the separators like this:
54371 </para>
54372 <literallayout class="monospaced">
54373 dnslists = black.list.tld/name.1::name.2
54374 </literallayout>
54375 <para>
54376 or to change the separator character, like this:
54377 </para>
54378 <literallayout class="monospaced">
54379 dnslists = black.list.tld/&lt;;name.1;name.2
54380 </literallayout>
54381 <para>
54382 If an item in the list is an IP address, it is inverted before the DNS
54383 blacklist domain is appended. If it is not an IP address, no inversion
54384 occurs. Consider this condition:
54385 </para>
54386 <literallayout class="monospaced">
54387 dnslists = black.list.tld/&lt;;192.168.1.2;a.domain
54388 </literallayout>
54389 <para>
54390 The DNS lookups that occur are:
54391 </para>
54392 <literallayout class="monospaced">
54393 2.1.168.192.black.list.tld
54394 a.domain.black.list.tld
54395 </literallayout>
54396 <para>
54397 Once a DNS record has been found (that matches a specific IP return
54398 address, if specified &ndash; see section <xref linkend="SECTaddmatcon"/>), no further lookups
54399 are done. If there is a temporary DNS error, the rest of the sublist of domains
54400 or IP addresses is tried. A temporary error for the whole dnslists item occurs
54401 only if no other DNS lookup in this sublist succeeds. In other words, a
54402 successful lookup for any of the items in the sublist overrides a temporary
54403 error for a previous item.
54404 </para>
54405 <para>
54406 The ability to supply a list of items after the slash is in some sense just a
54407 syntactic convenience. These two examples have the same effect:
54408 </para>
54409 <literallayout class="monospaced">
54410 dnslists = black.list.tld/a.domain : black.list.tld/b.domain
54411 dnslists = black.list.tld/a.domain::b.domain
54412 </literallayout>
54413 <para>
54414 However, when the data for the list is obtained from a lookup, the second form
54415 is usually much more convenient. Consider this example:
54416 </para>
54417 <literallayout class="monospaced">
54418 deny message  = The mail servers for the domain \
54419                 $sender_address_domain \
54420                 are listed at $dnslist_domain ($dnslist_value); \
54421                 see $dnslist_text.
54422      dnslists = sbl.spamhaus.org/&lt;|${lookup dnsdb {&gt;|a=&lt;|\
54423                                    ${lookup dnsdb {&gt;|mxh=\
54424                                    $sender_address_domain} }} }
54425 </literallayout>
54426 <para>
54427 Note the use of <literal>&gt;|</literal> in the dnsdb lookup to specify the separator for
54428 multiple DNS records. The inner dnsdb lookup produces a list of MX hosts
54429 and the outer dnsdb lookup finds the IP addresses for these hosts. The result
54430 of expanding the condition might be something like this:
54431 </para>
54432 <literallayout class="monospaced">
54433 dnslists = sbl.spahmaus.org/&lt;|192.168.2.3|192.168.5.6|...
54434 </literallayout>
54435 <para>
54436 Thus, this example checks whether or not the IP addresses of the sender
54437 domain&#x2019;s mail servers are on the Spamhaus black list.
54438 </para>
54439 <para>
54440 The key that was used for a successful DNS list lookup is put into the variable
54441 <varname>$dnslist_matched</varname> (see section <xref linkend="SECID204"/>).
54442 </para>
54443 </section>
54444 <section id="SECID203">
54445 <title>Data returned by DNS lists</title>
54446 <para>
54447 <indexterm role="concept">
54448 <primary>DNS list</primary>
54449 <secondary>data returned from</secondary>
54450 </indexterm>
54451 DNS lists are constructed using address records in the DNS. The original RBL
54452 just used the address 127.0.0.1 on the right hand side of each record, but the
54453 RBL+ list and some other lists use a number of values with different meanings.
54454 The values used on the RBL+ list are:
54455 </para>
54456 <literallayout>
54457 127.1.0.1  RBL
54458 127.1.0.2  DUL
54459 127.1.0.3  DUL and RBL
54460 127.1.0.4  RSS
54461 127.1.0.5  RSS and RBL
54462 127.1.0.6  RSS and DUL
54463 127.1.0.7  RSS and DUL and RBL
54464 </literallayout>
54465 <para>
54466 Section <xref linkend="SECTaddmatcon"/> below describes how you can distinguish between
54467 different values. Some DNS lists may return more than one address record;
54468 see section <xref linkend="SECThanmuldnsrec"/> for details of how they are checked.
54469 </para>
54470 </section>
54471 <section id="SECID204">
54472 <title>Variables set from DNS lists</title>
54473 <para>
54474 <indexterm role="concept">
54475 <primary>expansion</primary>
54476 <secondary>variables, set from DNS list</secondary>
54477 </indexterm>
54478 <indexterm role="concept">
54479 <primary>DNS list</primary>
54480 <secondary>variables set from</secondary>
54481 </indexterm>
54482 <indexterm role="variable">
54483 <primary><varname>$dnslist_domain</varname></primary>
54484 </indexterm>
54485 <indexterm role="variable">
54486 <primary><varname>$dnslist_matched</varname></primary>
54487 </indexterm>
54488 <indexterm role="variable">
54489 <primary><varname>$dnslist_text</varname></primary>
54490 </indexterm>
54491 <indexterm role="variable">
54492 <primary><varname>$dnslist_value</varname></primary>
54493 </indexterm>
54494 When an entry is found in a DNS list, the variable <varname>$dnslist_domain</varname> contains
54495 the name of the overall domain that matched (for example,
54496 <literal>spamhaus.example</literal>), <varname>$dnslist_matched</varname> contains the key within that domain
54497 (for example, <literal>192.168.5.3</literal>), and <varname>$dnslist_value</varname> contains the data from
54498 the DNS record. When the key is an IP address, it is not reversed in
54499 <varname>$dnslist_matched</varname> (though it is, of course, in the actual lookup). In simple
54500 cases, for example:
54501 </para>
54502 <literallayout class="monospaced">
54503 deny dnslists = spamhaus.example
54504 </literallayout>
54505 <para>
54506 the key is also available in another variable (in this case,
54507 <varname>$sender_host_address</varname>). In more complicated cases, however, this is not true.
54508 For example, using a data lookup (as described in section <xref linkend="SECTmulkeyfor"/>)
54509 might generate a dnslists lookup like this:
54510 </para>
54511 <literallayout class="monospaced">
54512 deny dnslists = spamhaus.example/&lt;|192.168.1.2|192.168.6.7|...
54513 </literallayout>
54514 <para>
54515 If this condition succeeds, the value in <varname>$dnslist_matched</varname> might be
54516 <literal>192.168.6.7</literal> (for example).
54517 </para>
54518 <para>
54519 If more than one address record is returned by the DNS lookup, all the IP
54520 addresses are included in <varname>$dnslist_value</varname>, separated by commas and spaces.
54521 The variable <varname>$dnslist_text</varname> contains the contents of any associated TXT
54522 record. For lists such as RBL+ the TXT record for a merged entry is often not
54523 very meaningful. See section <xref linkend="SECTmordetinf"/> for a way of obtaining more
54524 information.
54525 </para>
54526 <para>
54527 You can use the DNS list variables in <option>message</option> or <option>log_message</option> modifiers
54528 &ndash; although these appear before the condition in the ACL, they are not
54529 expanded until after it has failed. For example:
54530 </para>
54531 <literallayout class="monospaced">
54532 deny    hosts = !+local_networks
54533         message = $sender_host_address is listed \
54534                   at $dnslist_domain
54535         dnslists = rbl-plus.mail-abuse.example
54536 </literallayout>
54537 </section>
54538 <section id="SECTaddmatcon">
54539 <title>Additional matching conditions for DNS lists</title>
54540 <para>
54541 <indexterm role="concept">
54542 <primary>DNS list</primary>
54543 <secondary>matching specific returned data</secondary>
54544 </indexterm>
54545 You can add an equals sign and an IP address after a <option>dnslists</option> domain name
54546 in order to restrict its action to DNS records with a matching right hand side.
54547 For example,
54548 </para>
54549 <literallayout class="monospaced">
54550 deny dnslists = rblplus.mail-abuse.org=127.0.0.2
54551 </literallayout>
54552 <para>
54553 rejects only those hosts that yield 127.0.0.2. Without this additional data,
54554 any address record is considered to be a match. For the moment, we assume
54555 that the DNS lookup returns just one record. Section <xref linkend="SECThanmuldnsrec"/>
54556 describes how multiple records are handled.
54557 </para>
54558 <para>
54559 More than one IP address may be given for checking, using a comma as a
54560 separator. These are alternatives &ndash; if any one of them matches, the
54561 <option>dnslists</option> condition is true. For example:
54562 </para>
54563 <literallayout class="monospaced">
54564 deny  dnslists = a.b.c=127.0.0.2,127.0.0.3
54565 </literallayout>
54566 <para>
54567 If you want to specify a constraining address list and also specify names or IP
54568 addresses to be looked up, the constraining address list must be specified
54569 first. For example:
54570 </para>
54571 <literallayout class="monospaced">
54572 deny dnslists = dsn.rfc-ignorant.org\
54573                 =127.0.0.2/$sender_address_domain
54574 </literallayout>
54575 <para>
54576 If the character <literal>&amp;</literal> is used instead of <literal>=</literal>, the comparison for each
54577 listed IP address is done by a bitwise <quote>and</quote> instead of by an equality test.
54578 In other words, the listed addresses are used as bit masks. The comparison is
54579 true if all the bits in the mask are present in the address that is being
54580 tested. For example:
54581 </para>
54582 <literallayout class="monospaced">
54583 dnslists = a.b.c&amp;0.0.0.3
54584 </literallayout>
54585 <para>
54586 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
54587 want to test whether one bit or another bit is present (as opposed to both
54588 being present), you must use multiple values. For example:
54589 </para>
54590 <literallayout class="monospaced">
54591 dnslists = a.b.c&amp;0.0.0.1,0.0.0.2
54592 </literallayout>
54593 <para>
54594 matches if the final component of the address is an odd number or two times
54595 an odd number.
54596 </para>
54597 </section>
54598 <section id="SECID205">
54599 <title>Negated DNS matching conditions</title>
54600 <para>
54601 You can supply a negative list of IP addresses as part of a <option>dnslists</option>
54602 condition. Whereas
54603 </para>
54604 <literallayout class="monospaced">
54605 deny  dnslists = a.b.c=127.0.0.2,127.0.0.3
54606 </literallayout>
54607 <para>
54608 means <quote>deny if the host is in the black list at the domain <emphasis>a.b.c</emphasis> and the
54609 IP address yielded by the list is either 127.0.0.2 or 127.0.0.3</quote>,
54610 </para>
54611 <literallayout class="monospaced">
54612 deny  dnslists = a.b.c!=127.0.0.2,127.0.0.3
54613 </literallayout>
54614 <para>
54615 means <quote>deny if the host is in the black list at the domain <emphasis>a.b.c</emphasis> and the
54616 IP address yielded by the list is not 127.0.0.2 and not 127.0.0.3</quote>. In other
54617 words, the result of the test is inverted if an exclamation mark appears before
54618 the <literal>=</literal> (or the <literal>&amp;</literal>) sign.
54619 </para>
54620 <para>
54621 <emphasis role="bold">Note</emphasis>: This kind of negation is not the same as negation in a domain,
54622 host, or address list (which is why the syntax is different).
54623 </para>
54624 <para>
54625 If you are using just one list, the negation syntax does not gain you much. The
54626 previous example is precisely equivalent to
54627 </para>
54628 <literallayout class="monospaced">
54629 deny  dnslists = a.b.c
54630      !dnslists = a.b.c=127.0.0.2,127.0.0.3
54631 </literallayout>
54632 <para>
54633 However, if you are using multiple lists, the negation syntax is clearer.
54634 Consider this example:
54635 </para>
54636 <literallayout class="monospaced">
54637 deny  dnslists = sbl.spamhaus.org : \
54638                  list.dsbl.org : \
54639                  dnsbl.njabl.org!=127.0.0.3 : \
54640                  relays.ordb.org
54641 </literallayout>
54642 <para>
54643 Using only positive lists, this would have to be:
54644 </para>
54645 <literallayout class="monospaced">
54646 deny  dnslists = sbl.spamhaus.org : \
54647                  list.dsbl.org
54648 deny  dnslists = dnsbl.njabl.org
54649      !dnslists = dnsbl.njabl.org=127.0.0.3
54650 deny  dnslists = relays.ordb.org
54651 </literallayout>
54652 <para>
54653 which is less clear, and harder to maintain.
54654 </para>
54655 </section>
54656 <section id="SECThanmuldnsrec">
54657 <title>Handling multiple DNS records from a DNS list</title>
54658 <para>
54659 A DNS lookup for a <option>dnslists</option> condition may return more than one DNS record,
54660 thereby providing more than one IP address. When an item in a <option>dnslists</option> list
54661 is followed by <literal>=</literal> or <literal>&amp;</literal> and a list of IP addresses, in order to restrict
54662 the match to specific results from the DNS lookup, there are two ways in which
54663 the checking can be handled. For example, consider the condition:
54664 </para>
54665 <literallayout class="monospaced">
54666 dnslists = a.b.c=127.0.0.1
54667 </literallayout>
54668 <para>
54669 What happens if the DNS lookup for the incoming IP address yields both
54670 127.0.0.1 and 127.0.0.2 by means of two separate DNS records? Is the
54671 condition true because at least one given value was found, or is it false
54672 because at least one of the found values was not listed? And how does this
54673 affect negated conditions? Both possibilities are provided for with the help of
54674 additional separators <literal>==</literal> and <literal>=&amp;</literal>.
54675 </para>
54676 <itemizedlist>
54677 <listitem>
54678 <para>
54679 If <literal>=</literal> or <literal>&amp;</literal> is used, the condition is true if any one of the looked up
54680 IP addresses matches one of the listed addresses. For the example above, the
54681 condition is true because 127.0.0.1 matches.
54682 </para>
54683 </listitem>
54684 <listitem>
54685 <para>
54686 If <literal>==</literal> or <literal>=&amp;</literal> is used, the condition is true only if every one of the
54687 looked up IP addresses matches one of the listed addresses. If the condition is
54688 changed to:
54689 </para>
54690 <literallayout class="monospaced">
54691 dnslists = a.b.c==127.0.0.1
54692 </literallayout>
54693 <para>
54694 and the DNS lookup yields both 127.0.0.1 and 127.0.0.2, the condition is
54695 false because 127.0.0.2 is not listed. You would need to have:
54696 </para>
54697 <literallayout class="monospaced">
54698 dnslists = a.b.c==127.0.0.1,127.0.0.2
54699 </literallayout>
54700 <para>
54701 for the condition to be true.
54702 </para>
54703 </listitem>
54704 </itemizedlist>
54705 <para>
54706 When <literal>!</literal> is used to negate IP address matching, it inverts the result, giving
54707 the precise opposite of the behaviour above. Thus:
54708 </para>
54709 <itemizedlist>
54710 <listitem>
54711 <para>
54712 If <literal>!=</literal> or <literal>!&amp;</literal> is used, the condition is true if none of the looked up IP
54713 addresses matches one of the listed addresses. Consider:
54714 </para>
54715 <literallayout class="monospaced">
54716 dnslists = a.b.c!&amp;0.0.0.1
54717 </literallayout>
54718 <para>
54719 If the DNS lookup yields both 127.0.0.1 and 127.0.0.2, the condition is
54720 false because 127.0.0.1 matches.
54721 </para>
54722 </listitem>
54723 <listitem>
54724 <para>
54725 If <literal>!==</literal> or <literal>!=&amp;</literal> is used, the condition is true if there is at least one
54726 looked up IP address that does not match. Consider:
54727 </para>
54728 <literallayout class="monospaced">
54729 dnslists = a.b.c!=&amp;0.0.0.1
54730 </literallayout>
54731 <para>
54732 If the DNS lookup yields both 127.0.0.1 and 127.0.0.2, the condition is
54733 true, because 127.0.0.2 does not match. You would need to have:
54734 </para>
54735 <literallayout class="monospaced">
54736 dnslists = a.b.c!=&amp;0.0.0.1,0.0.0.2
54737 </literallayout>
54738 <para>
54739 for the condition to be false.
54740 </para>
54741 </listitem>
54742 </itemizedlist>
54743 <para>
54744 When the DNS lookup yields only a single IP address, there is no difference
54745 between <literal>=</literal> and <literal>==</literal> and between <literal>&amp;</literal> and <literal>=&amp;</literal>.
54746 </para>
54747 </section>
54748 <section id="SECTmordetinf">
54749 <title>Detailed information from merged DNS lists</title>
54750 <para>
54751 <indexterm role="concept">
54752 <primary>DNS list</primary>
54753 <secondary>information from merged</secondary>
54754 </indexterm>
54755 When the facility for restricting the matching IP values in a DNS list is used,
54756 the text from the TXT record that is set in <varname>$dnslist_text</varname> may not reflect
54757 the true reason for rejection. This happens when lists are merged and the IP
54758 address in the A record is used to distinguish them; unfortunately there is
54759 only one TXT record. One way round this is not to use merged lists, but that
54760 can be inefficient because it requires multiple DNS lookups where one would do
54761 in the vast majority of cases when the host of interest is not on any of the
54762 lists.
54763 </para>
54764 <para>
54765 A less inefficient way of solving this problem is available. If
54766 two domain names, comma-separated, are given, the second is used first to
54767 do an initial check, making use of any IP value restrictions that are set.
54768 If there is a match, the first domain is used, without any IP value
54769 restrictions, to get the TXT record. As a byproduct of this, there is also
54770 a check that the IP being tested is indeed on the first list. The first
54771 domain is the one that is put in <varname>$dnslist_domain</varname>. For example:
54772 </para>
54773 <literallayout class="monospaced">
54774 reject message  = \
54775          rejected because $sender_host_address is blacklisted \
54776          at $dnslist_domain\n$dnslist_text
54777        dnslists = \
54778          sbl.spamhaus.org,sbl-xbl.spamhaus.org=127.0.0.2 : \
54779          dul.dnsbl.sorbs.net,dnsbl.sorbs.net=127.0.0.10
54780 </literallayout>
54781 <para>
54782 For the first blacklist item, this starts by doing a lookup in
54783 <emphasis>sbl-xbl.spamhaus.org</emphasis> and testing for a 127.0.0.2 return. If there is a
54784 match, it then looks in <emphasis>sbl.spamhaus.org</emphasis>, without checking the return
54785 value, and as long as something is found, it looks for the corresponding TXT
54786 record. If there is no match in <emphasis>sbl-xbl.spamhaus.org</emphasis>, nothing more is done.
54787 The second blacklist item is processed similarly.
54788 </para>
54789 <para>
54790 If you are interested in more than one merged list, the same list must be
54791 given several times, but because the results of the DNS lookups are cached,
54792 the DNS calls themselves are not repeated. For example:
54793 </para>
54794 <literallayout class="monospaced">
54795 reject dnslists = \
54796          http.dnsbl.sorbs.net,dnsbl.sorbs.net=127.0.0.2 : \
54797          socks.dnsbl.sorbs.net,dnsbl.sorbs.net=127.0.0.3 : \
54798          misc.dnsbl.sorbs.net,dnsbl.sorbs.net=127.0.0.4 : \
54799          dul.dnsbl.sorbs.net,dnsbl.sorbs.net=127.0.0.10
54800 </literallayout>
54801 <para>
54802 In this case there is one lookup in <emphasis>dnsbl.sorbs.net</emphasis>, and if none of the IP
54803 values matches (or if no record is found), this is the only lookup that is
54804 done. Only if there is a match is one of the more specific lists consulted.
54805 </para>
54806 </section>
54807 <section id="SECTmorednslistslast">
54808 <title>DNS lists and IPv6</title>
54809 <para>
54810 <indexterm role="concept">
54811 <primary>IPv6</primary>
54812 <secondary>DNS black lists</secondary>
54813 </indexterm>
54814 <indexterm role="concept">
54815 <primary>DNS list</primary>
54816 <secondary>IPv6 usage</secondary>
54817 </indexterm>
54818 If Exim is asked to do a dnslist lookup for an IPv6 address, it inverts it
54819 nibble by nibble. For example, if the calling host&#x2019;s IP address is
54820 3ffe:ffff:836f:0a00:000a:0800:200a:c031, Exim might look up
54821 </para>
54822 <literallayout class="monospaced">
54823 1.3.0.c.a.0.0.2.0.0.8.0.a.0.0.0.0.0.a.0.f.6.3.8.
54824   f.f.f.f.e.f.f.3.blackholes.mail-abuse.org
54825 </literallayout>
54826 <para>
54827 (split over two lines here to fit on the page). Unfortunately, some of the DNS
54828 lists contain wildcard records, intended for IPv4, that interact badly with
54829 IPv6. For example, the DNS entry
54830 </para>
54831 <literallayout class="monospaced">
54832 *.3.some.list.example.    A    127.0.0.1
54833 </literallayout>
54834 <para>
54835 is probably intended to put the entire 3.0.0.0/8 IPv4 network on the list.
54836 Unfortunately, it also matches the entire 3::/4 IPv6 network.
54837 </para>
54838 <para>
54839 You can exclude IPv6 addresses from DNS lookups by making use of a suitable
54840 <option>condition</option> condition, as in this example:
54841 </para>
54842 <literallayout class="monospaced">
54843 deny   condition = ${if isip4{$sender_host_address}}
54844        dnslists  = some.list.example
54845 </literallayout>
54846 <para>
54847 If an explicit key is being used for a DNS lookup and it may be an IPv6
54848 address you should specify alternate list separators for both the outer
54849 (DNS list name) list and inner (lookup keys) list:
54850 </para>
54851 <literallayout class="monospaced">
54852        dnslists = &lt;; dnsbl.example.com/&lt;|$acl_m_addrslist
54853 </literallayout>
54854 </section>
54855 <section id="SECTratelimiting">
54856 <title>Rate limiting incoming messages</title>
54857 <para>
54858 <indexterm role="concept">
54859 <primary>rate limiting</primary>
54860 <secondary>client sending</secondary>
54861 </indexterm>
54862 <indexterm role="concept">
54863 <primary>limiting client sending rates</primary>
54864 </indexterm>
54865 <indexterm role="option">
54866 <primary><option>smtp_ratelimit_*</option></primary>
54867 </indexterm>
54868 The <option>ratelimit</option> ACL condition can be used to measure and control the rate at
54869 which clients can send email. This is more powerful than the
54870 <option>smtp_ratelimit_*</option> options, because those options control the rate of
54871 commands in a single SMTP session only, whereas the <option>ratelimit</option> condition
54872 works across all connections (concurrent and sequential) from the same client
54873 host. The syntax of the <option>ratelimit</option> condition is:
54874 </para>
54875 <literallayout>
54876 <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;
54877 </literallayout>
54878 <para>
54879 If the average client sending rate is less than <emphasis>m</emphasis> messages per time
54880 period <emphasis>p</emphasis> then the condition is false; otherwise it is true.
54881 </para>
54882 <para>
54883 As a side-effect, the <option>ratelimit</option> condition sets the expansion variable
54884 <varname>$sender_rate</varname> to the client&#x2019;s computed rate, <varname>$sender_rate_limit</varname> to the
54885 configured value of <emphasis>m</emphasis>, and <varname>$sender_rate_period</varname> to the configured value
54886 of <emphasis>p</emphasis>.
54887 </para>
54888 <para>
54889 The parameter <emphasis>p</emphasis> is the smoothing time constant, in the form of an Exim
54890 time interval, for example, <literal>8h</literal> for eight hours. A larger time constant
54891 means that it takes Exim longer to forget a client&#x2019;s past behaviour. The
54892 parameter <emphasis>m</emphasis> is the maximum number of messages that a client is permitted to
54893 send in each time interval. It also specifies the number of messages permitted
54894 in a fast burst. By increasing both <emphasis>m</emphasis> and <emphasis>p</emphasis> but keeping <emphasis>m/p</emphasis>
54895 constant, you can allow a client to send more messages in a burst without
54896 changing its long-term sending rate limit. Conversely, if <emphasis>m</emphasis> and <emphasis>p</emphasis> are
54897 both small, messages must be sent at an even rate.
54898 </para>
54899 <para>
54900 There is a script in <filename>util/ratelimit.pl</filename> which extracts sending rates from
54901 log files, to assist with choosing appropriate settings for <emphasis>m</emphasis> and <emphasis>p</emphasis>
54902 when deploying the <option>ratelimit</option> ACL condition. The script prints usage
54903 instructions when it is run with no arguments.
54904 </para>
54905 <para>
54906 The key is used to look up the data for calculating the client&#x2019;s average
54907 sending rate. This data is stored in Exim&#x2019;s spool directory, alongside the
54908 retry and other hints databases. The default key is <varname>$sender_host_address</varname>,
54909 which means Exim computes the sending rate of each client host IP address.
54910 By changing the key you can change how Exim identifies clients for the purpose
54911 of ratelimiting. For example, to limit the sending rate of each authenticated
54912 user, independent of the computer they are sending from, set the key to
54913 <varname>$authenticated_id</varname>. You must ensure that the lookup key is meaningful; for
54914 example, <varname>$authenticated_id</varname> is only meaningful if the client has
54915 authenticated (which you can check with the <option>authenticated</option> ACL condition).
54916 </para>
54917 <para>
54918 The lookup key does not have to identify clients: If you want to limit the
54919 rate at which a recipient receives messages, you can use the key
54920 <literal>$local_part@$domain</literal> with the <option>per_rcpt</option> option (see below) in a RCPT
54921 ACL.
54922 </para>
54923 <para>
54924 Each <option>ratelimit</option> condition can have up to four options. A <option>per_*</option> option
54925 specifies what Exim measures the rate of, for example messages or recipients
54926 or bytes. You can adjust the measurement using the <option>unique=</option> and/or
54927 <option>count=</option> options. You can also control when Exim updates the recorded rate
54928 using a <option>strict</option>, <option>leaky</option>, or <option>readonly</option> option. The options are
54929 separated by a slash, like the other parameters. They may appear in any order.
54930 </para>
54931 <para>
54932 Internally, Exim appends the smoothing constant <emphasis>p</emphasis> onto the lookup key with
54933 any options that alter the meaning of the stored data. The limit <emphasis>m</emphasis> is not
54934 stored, so you can alter the configured maximum rate and Exim will still
54935 remember clients&#x2019; past behaviour. If you change the <option>per_*</option> mode or add or
54936 remove the <option>unique=</option> option, the lookup key changes so Exim will forget past
54937 behaviour. The lookup key is not affected by changes to the update mode and
54938 the <option>count=</option> option.
54939 </para>
54940 </section>
54941 <section id="ratoptmea">
54942 <title>Ratelimit options for what is being measured</title>
54943 <para>
54944 <indexterm role="concept">
54945 <primary>rate limiting</primary>
54946 <secondary>per_* options</secondary>
54947 </indexterm>
54948 The <option>per_conn</option> option limits the client&#x2019;s connection rate. It is not
54949 normally used in the <option>acl_not_smtp</option>, <option>acl_not_smtp_mime</option>, or
54950 <option>acl_not_smtp_start</option> ACLs.
54951 </para>
54952 <para>
54953 The <option>per_mail</option> option limits the client&#x2019;s rate of sending messages. This is
54954 the default if none of the <option>per_*</option> options is specified. It can be used in
54955 <option>acl_smtp_mail</option>, <option>acl_smtp_rcpt</option>, <option>acl_smtp_predata</option>, <option>acl_smtp_mime</option>,
54956 <option>acl_smtp_data</option>, or <option>acl_not_smtp</option>.
54957 </para>
54958 <para>
54959 The <option>per_byte</option> option limits the sender&#x2019;s email bandwidth. It can be used in
54960 the same ACLs as the <option>per_mail</option> option, though it is best to use this option
54961 in the <option>acl_smtp_mime</option>, <option>acl_smtp_data</option> or <option>acl_not_smtp</option> ACLs; if it is
54962 used in an earlier ACL, Exim relies on the SIZE parameter given by the client
54963 in its MAIL command, which may be inaccurate or completely missing. You can
54964 follow the limit <emphasis>m</emphasis> in the configuration with K, M, or G to specify limits
54965 in kilobytes, megabytes, or gigabytes, respectively.
54966 </para>
54967 <para>
54968 The <option>per_rcpt</option> option causes Exim to limit the rate at which recipients are
54969 accepted. It can be used in the <option>acl_smtp_rcpt</option>, <option>acl_smtp_predata</option>,
54970 <option>acl_smtp_mime</option>, <option>acl_smtp_data</option>, or <option>acl_smtp_rcpt</option> ACLs. In
54971 <option>acl_smtp_rcpt</option> the rate is updated one recipient at a time; in the other
54972 ACLs the rate is updated with the total recipient count in one go. Note that
54973 in either case the rate limiting engine will see a message with many
54974 recipients as a large high-speed burst.
54975 </para>
54976 <para>
54977 The <option>per_addr</option> option is like the <option>per_rcpt</option> option, except it counts the
54978 number of different recipients that the client has sent messages to in the
54979 last time period. That is, if the client repeatedly sends messages to the same
54980 recipient, its measured rate is not increased. This option can only be used in
54981 <option>acl_smtp_rcpt</option>.
54982 </para>
54983 <para>
54984 The <option>per_cmd</option> option causes Exim to recompute the rate every time the
54985 condition is processed. This can be used to limit the rate of any SMTP
54986 command. If it is used in multiple ACLs it can limit the aggregate rate of
54987 multiple different commands.
54988 </para>
54989 <para>
54990 The <option>count=</option> option can be used to alter how much Exim adds to the client&#x2019;s
54991 measured rate. For example, the <option>per_byte</option> option is equivalent to
54992 <literal>per_mail/count=$message_size</literal>. If there is no <option>count=</option> option, Exim
54993 increases the measured rate by one (except for the <option>per_rcpt</option> option in ACLs
54994 other than <option>acl_smtp_rcpt</option>). The count does not have to be an integer.
54995 </para>
54996 <para>
54997 The <option>unique=</option> option is described in section <xref linkend="ratoptuniq"/> below.
54998 </para>
54999 </section>
55000 <section id="ratoptupd">
55001 <title>Ratelimit update modes</title>
55002 <para>
55003 <indexterm role="concept">
55004 <primary>rate limiting</primary>
55005 <secondary>reading data without updating</secondary>
55006 </indexterm>
55007 You can specify one of three options with the <option>ratelimit</option> condition to
55008 control when its database is updated. This section describes the <option>readonly</option>
55009 mode, and the next section describes the <option>strict</option> and <option>leaky</option> modes.
55010 </para>
55011 <para>
55012 If the <option>ratelimit</option> condition is used in <option>readonly</option> mode, Exim looks up a
55013 previously-computed rate to check against the limit.
55014 </para>
55015 <para>
55016 For example, you can test the client&#x2019;s sending rate and deny it access (when
55017 it is too fast) in the connect ACL. If the client passes this check then it
55018 can go on to send a message, in which case its recorded rate will be updated
55019 in the MAIL ACL. Subsequent connections from the same client will check this
55020 new rate.
55021 </para>
55022 <literallayout class="monospaced">
55023 acl_check_connect:
55024  deny ratelimit = 100 / 5m / readonly
55025     log_message = RATE CHECK: $sender_rate/$sender_rate_period \
55026                   (max $sender_rate_limit)
55027 # ...
55028 acl_check_mail:
55029  warn ratelimit = 100 / 5m / strict
55030     log_message = RATE UPDATE: $sender_rate/$sender_rate_period \
55031                   (max $sender_rate_limit)
55032 </literallayout>
55033 <para>
55034 If Exim encounters multiple <option>ratelimit</option> conditions with the same key when
55035 processing a message then it may increase the client&#x2019;s measured rate more than
55036 it should. For example, this will happen if you check the <option>per_rcpt</option> option
55037 in both <option>acl_smtp_rcpt</option> and <option>acl_smtp_data</option>. However it&#x2019;s OK to check the
55038 same <option>ratelimit</option> condition multiple times in the same ACL. You can avoid any
55039 multiple update problems by using the <option>readonly</option> option on later ratelimit
55040 checks.
55041 </para>
55042 <para>
55043 The <option>per_*</option> options described above do not make sense in some ACLs. If you
55044 use a <option>per_*</option> option in an ACL where it is not normally permitted then the
55045 update mode defaults to <option>readonly</option> and you cannot specify the <option>strict</option> or
55046 <option>leaky</option> modes. In other ACLs the default update mode is <option>leaky</option> (see the
55047 next section) so you must specify the <option>readonly</option> option explicitly.
55048 </para>
55049 </section>
55050 <section id="ratoptfast">
55051 <title>Ratelimit options for handling fast clients</title>
55052 <para>
55053 <indexterm role="concept">
55054 <primary>rate limiting</primary>
55055 <secondary>strict and leaky modes</secondary>
55056 </indexterm>
55057 If a client&#x2019;s average rate is greater than the maximum, the rate limiting
55058 engine can react in two possible ways, depending on the presence of the
55059 <option>strict</option> or <option>leaky</option> update modes. This is independent of the other
55060 counter-measures (such as rejecting the message) that may be specified by the
55061 rest of the ACL.
55062 </para>
55063 <para>
55064 The <option>leaky</option> (default) option means that the client&#x2019;s recorded rate is not
55065 updated if it is above the limit. The effect of this is that Exim measures the
55066 client&#x2019;s average rate of successfully sent email, which cannot be greater than
55067 the maximum allowed. If the client is over the limit it may suffer some
55068 counter-measures (as specified in the ACL), but it will still be able to send
55069 email at the configured maximum rate, whatever the rate of its attempts. This
55070 is generally the better choice if you have clients that retry automatically.
55071 For example, it does not prevent a sender with an over-aggressive retry rate
55072 from getting any email through.
55073 </para>
55074 <para>
55075 The <option>strict</option> option means that the client&#x2019;s recorded rate is always
55076 updated. The effect of this is that Exim measures the client&#x2019;s average rate
55077 of attempts to send email, which can be much higher than the maximum it is
55078 actually allowed. If the client is over the limit it may be subjected to
55079 counter-measures by the ACL. It must slow down and allow sufficient time to
55080 pass that its computed rate falls below the maximum before it can send email
55081 again. The time (the number of smoothing periods) it must wait and not
55082 attempt to send mail can be calculated with this formula:
55083 </para>
55084 <literallayout class="monospaced">
55085         ln(peakrate/maxrate)
55086 </literallayout>
55087 </section>
55088 <section id="ratoptuniq">
55089 <title>Limiting the rate of different events</title>
55090 <para>
55091 <indexterm role="concept">
55092 <primary>rate limiting</primary>
55093 <secondary>counting unique events</secondary>
55094 </indexterm>
55095 The <option>ratelimit</option> <option>unique=</option> option controls a mechanism for counting the
55096 rate of different events. For example, the <option>per_addr</option> option uses this
55097 mechanism to count the number of different recipients that the client has
55098 sent messages to in the last time period; it is equivalent to
55099 <literal>per_rcpt/unique=$local_part@$domain</literal>. You could use this feature to
55100 measure the rate that a client uses different sender addresses with the
55101 options <literal>per_mail/unique=$sender_address</literal>.
55102 </para>
55103 <para>
55104 For each <option>ratelimit</option> key Exim stores the set of <option>unique=</option> values that it
55105 has seen for that key. The whole set is thrown away when it is older than the
55106 rate smoothing period <emphasis>p</emphasis>, so each different event is counted at most once
55107 per period. In the <option>leaky</option> update mode, an event that causes the client to
55108 go over the limit is not added to the set, in the same way that the client&#x2019;s
55109 recorded rate is not updated in the same situation.
55110 </para>
55111 <para>
55112 When you combine the <option>unique=</option> and <option>readonly</option> options, the specific
55113 <option>unique=</option> value is ignored, and Exim just retrieves the client&#x2019;s stored
55114 rate.
55115 </para>
55116 <para>
55117 The <option>unique=</option> mechanism needs more space in the ratelimit database than the
55118 other <option>ratelimit</option> options in order to store the event set. The number of
55119 unique values is potentially as large as the rate limit, so the extra space
55120 required increases with larger limits.
55121 </para>
55122 <para>
55123 The uniqueification is not perfect: there is a small probability that Exim
55124 will think a new event has happened before. If the sender&#x2019;s rate is less than
55125 the limit, Exim should be more than 99.9% correct. However in <option>strict</option> mode
55126 the measured rate can go above the limit, in which case Exim may under-count
55127 events by a significant margin. Fortunately, if the rate is high enough (2.7
55128 times the limit) that the false positive rate goes above 9%, then Exim will
55129 throw away the over-full event set before the measured rate falls below the
55130 limit. Therefore the only harm should be that exceptionally high sending rates
55131 are logged incorrectly; any countermeasures you configure will be as effective
55132 as intended.
55133 </para>
55134 </section>
55135 <section id="useratlim">
55136 <title>Using rate limiting</title>
55137 <para>
55138 Exim&#x2019;s other ACL facilities are used to define what counter-measures are taken
55139 when the rate limit is exceeded. This might be anything from logging a warning
55140 (for example, while measuring existing sending rates in order to define
55141 policy), through time delays to slow down fast senders, up to rejecting the
55142 message. For example:
55143 </para>
55144 <literallayout class="monospaced">
55145 # Log all senders' rates
55146 warn ratelimit = 0 / 1h / strict
55147      log_message = Sender rate $sender_rate / $sender_rate_period
55148
55149 # Slow down fast senders; note the need to truncate $sender_rate
55150 # at the decimal point.
55151 warn ratelimit = 100 / 1h / per_rcpt / strict
55152      delay     = ${eval: ${sg{$sender_rate}{[.].*}{}} - \
55153                    $sender_rate_limit }s
55154
55155 # Keep authenticated users under control
55156 deny authenticated = *
55157      ratelimit = 100 / 1d / strict / $authenticated_id
55158
55159 # System-wide rate limit
55160 defer message = Sorry, too busy. Try again later.
55161      ratelimit = 10 / 1s / $primary_hostname
55162
55163 # Restrict incoming rate from each host, with a default
55164 # set using a macro and special cases looked up in a table.
55165 defer message = Sender rate exceeds $sender_rate_limit \
55166                messages per $sender_rate_period
55167      ratelimit = ${lookup {$sender_host_address} \
55168                    cdb {DB/ratelimits.cdb} \
55169                    {$value} {RATELIMIT} }
55170 </literallayout>
55171 <para>
55172 <emphasis role="bold">Warning</emphasis>: If you have a busy server with a lot of <option>ratelimit</option> tests,
55173 especially with the <option>per_rcpt</option> option, you may suffer from a performance
55174 bottleneck caused by locking on the ratelimit hints database. Apart from
55175 making your ACLs less complicated, you can reduce the problem by using a
55176 RAM disk for Exim&#x2019;s hints directory (usually <filename>/var/spool/exim/db/</filename>). However
55177 this means that Exim will lose its hints data after a reboot (including retry
55178 hints, the callout cache, and ratelimit data).
55179 </para>
55180 </section>
55181 <section id="SECTaddressverification">
55182 <title>Address verification</title>
55183 <para>
55184 <indexterm role="concept">
55185 <primary>verifying address</primary>
55186 <secondary>options for</secondary>
55187 </indexterm>
55188 <indexterm role="concept">
55189 <primary>policy control</primary>
55190 <secondary>address verification</secondary>
55191 </indexterm>
55192 Several of the <option>verify</option> conditions described in section
55193 <xref linkend="SECTaclconditions"/> cause addresses to be verified. Section
55194 <xref linkend="SECTsenaddver"/> discusses the reporting of sender verification failures.
55195 The verification conditions can be followed by options that modify the
55196 verification process. The options are separated from the keyword and from each
55197 other by slashes, and some of them contain parameters. For example:
55198 </para>
55199 <literallayout class="monospaced">
55200 verify = sender/callout
55201 verify = recipient/defer_ok/callout=10s,defer_ok
55202 </literallayout>
55203 <para>
55204 The first stage of address verification, which always happens, is to run the
55205 address through the routers, in <quote>verify mode</quote>. Routers can detect the
55206 difference between verification and routing for delivery, and their actions can
55207 be varied by a number of generic options such as <option>verify</option> and <option>verify_only</option>
55208 (see chapter <xref linkend="CHAProutergeneric"/>). If routing fails, verification fails.
55209 The available options are as follows:
55210 </para>
55211 <itemizedlist>
55212 <listitem>
55213 <para>
55214 If the <option>callout</option> option is specified, successful routing to one or more
55215 remote hosts is followed by a <quote>callout</quote> to those hosts as an additional
55216 check. Callouts and their sub-options are discussed in the next section.
55217 </para>
55218 </listitem>
55219 <listitem>
55220 <para>
55221 If there is a defer error while doing verification routing, the ACL
55222 normally returns <quote>defer</quote>. However, if you include <option>defer_ok</option> in the
55223 options, the condition is forced to be true instead. Note that this is a main
55224 verification option as well as a suboption for callouts.
55225 </para>
55226 </listitem>
55227 <listitem>
55228 <para>
55229 The <option>no_details</option> option is covered in section <xref linkend="SECTsenaddver"/>, which
55230 discusses the reporting of sender address verification failures.
55231 </para>
55232 </listitem>
55233 <listitem>
55234 <para>
55235 The <option>success_on_redirect</option> option causes verification always to succeed
55236 immediately after a successful redirection. By default, if a redirection
55237 generates just one address, that address is also verified. See further
55238 discussion in section <xref linkend="SECTredirwhilveri"/>.
55239 </para>
55240 </listitem>
55241 </itemizedlist>
55242 <para>
55243 <indexterm role="concept">
55244 <primary>verifying address</primary>
55245 <secondary>differentiating failures</secondary>
55246 </indexterm>
55247 <indexterm role="variable">
55248 <primary><varname>$recipient_verify_failure</varname></primary>
55249 </indexterm>
55250 <indexterm role="variable">
55251 <primary><varname>$sender_verify_failure</varname></primary>
55252 </indexterm>
55253 <indexterm role="variable">
55254 <primary><varname>$acl_verify_message</varname></primary>
55255 </indexterm>
55256 After an address verification failure, <varname>$acl_verify_message</varname> contains the
55257 error message that is associated with the failure. It can be preserved by
55258 coding like this:
55259 </para>
55260 <literallayout class="monospaced">
55261 warn  !verify = sender
55262        set acl_m0 = $acl_verify_message
55263 </literallayout>
55264 <para>
55265 If you are writing your own custom rejection message or log message when
55266 denying access, you can use this variable to include information about the
55267 verification failure.
55268 </para>
55269 <para>
55270 In addition, <varname>$sender_verify_failure</varname> or <varname>$recipient_verify_failure</varname> (as
55271 appropriate) contains one of the following words:
55272 </para>
55273 <itemizedlist>
55274 <listitem>
55275 <para>
55276 <option>qualify</option>: The address was unqualified (no domain), and the message
55277 was neither local nor came from an exempted host.
55278 </para>
55279 </listitem>
55280 <listitem>
55281 <para>
55282 <option>route</option>: Routing failed.
55283 </para>
55284 </listitem>
55285 <listitem>
55286 <para>
55287 <option>mail</option>: Routing succeeded, and a callout was attempted; rejection
55288 occurred at or before the MAIL command (that is, on initial
55289 connection, HELO, or MAIL).
55290 </para>
55291 </listitem>
55292 <listitem>
55293 <para>
55294 <option>recipient</option>: The RCPT command in a callout was rejected.
55295 </para>
55296 </listitem>
55297 <listitem>
55298 <para>
55299 <option>postmaster</option>: The postmaster check in a callout was rejected.
55300 </para>
55301 </listitem>
55302 </itemizedlist>
55303 <para>
55304 The main use of these variables is expected to be to distinguish between
55305 rejections of MAIL and rejections of RCPT in callouts.
55306 </para>
55307 </section>
55308 <section id="SECTcallver">
55309 <title>Callout verification</title>
55310 <para>
55311 <indexterm role="concept">
55312 <primary>verifying address</primary>
55313 <secondary>by callout</secondary>
55314 </indexterm>
55315 <indexterm role="concept">
55316 <primary>callout</primary>
55317 <secondary>verification</secondary>
55318 </indexterm>
55319 <indexterm role="concept">
55320 <primary>SMTP</primary>
55321 <secondary>callout verification</secondary>
55322 </indexterm>
55323 For non-local addresses, routing verifies the domain, but is unable to do any
55324 checking of the local part. There are situations where some means of verifying
55325 the local part is desirable. One way this can be done is to make an SMTP
55326 <emphasis>callback</emphasis> to a delivery host for the sender address or a <emphasis>callforward</emphasis> to
55327 a subsequent host for a recipient address, to see if the host accepts the
55328 address. We use the term <emphasis>callout</emphasis> to cover both cases. Note that for a
55329 sender address, the callback is not to the client host that is trying to
55330 deliver the message, but to one of the hosts that accepts incoming mail for the
55331 sender&#x2019;s domain.
55332 </para>
55333 <para>
55334 Exim does not do callouts by default. If you want them to happen, you must
55335 request them by setting appropriate options on the <option>verify</option> condition, as
55336 described below. This facility should be used with care, because it can add a
55337 lot of resource usage to the cost of verifying an address. However, Exim does
55338 cache the results of callouts, which helps to reduce the cost. Details of
55339 caching are in section <xref linkend="SECTcallvercache"/>.
55340 </para>
55341 <para>
55342 Recipient callouts are usually used only between hosts that are controlled by
55343 the same administration. For example, a corporate gateway host could use
55344 callouts to check for valid recipients on an internal mailserver. A successful
55345 callout does not guarantee that a real delivery to the address would succeed;
55346 on the other hand, a failing callout does guarantee that a delivery would fail.
55347 </para>
55348 <para>
55349 If the <option>callout</option> option is present on a condition that verifies an address, a
55350 second stage of verification occurs if the address is successfully routed to
55351 one or more remote hosts. The usual case is routing by a <command>dnslookup</command> or a
55352 <command>manualroute</command> router, where the router specifies the hosts. However, if a
55353 router that does not set up hosts routes to an <command>smtp</command> transport with a
55354 <option>hosts</option> setting, the transport&#x2019;s hosts are used. If an <command>smtp</command> transport has
55355 <option>hosts_override</option> set, its hosts are always used, whether or not the router
55356 supplies a host list.
55357 Callouts are only supported on <command>smtp</command> transports.
55358 </para>
55359 <para>
55360 The port that is used is taken from the transport, if it is specified and is a
55361 remote transport. (For routers that do verification only, no transport need be
55362 specified.) Otherwise, the default SMTP port is used. If a remote transport
55363 specifies an outgoing interface, this is used; otherwise the interface is not
55364 specified. Likewise, the text that is used for the HELO command is taken from
55365 the transport&#x2019;s <option>helo_data</option> option; if there is no transport, the value of
55366 <varname>$smtp_active_hostname</varname> is used.
55367 </para>
55368 <para>
55369 For a sender callout check, Exim makes SMTP connections to the remote hosts, to
55370 test whether a bounce message could be delivered to the sender address. The
55371 following SMTP commands are sent:
55372 </para>
55373 <literallayout>
55374 <literal>HELO </literal>&lt;<emphasis>local host name</emphasis>&gt;
55375 <literal>MAIL FROM:&lt;&gt;</literal>
55376 <literal>RCPT TO:</literal>&lt;<emphasis>the address to be tested</emphasis>&gt;
55377 <literal>QUIT</literal>
55378 </literallayout>
55379 <para>
55380 LHLO is used instead of HELO if the transport&#x2019;s <option>protocol</option> option is
55381 set to <quote>lmtp</quote>.
55382 </para>
55383 <para>
55384 The callout may use EHLO, AUTH and/or STARTTLS given appropriate option
55385 settings.
55386 </para>
55387 <para>
55388 A recipient callout check is similar. By default, it also uses an empty address
55389 for the sender. This default is chosen because most hosts do not make use of
55390 the sender address when verifying a recipient. Using the same address means
55391 that a single cache entry can be used for each recipient. Some sites, however,
55392 do make use of the sender address when verifying. These are catered for by the
55393 <option>use_sender</option> and <option>use_postmaster</option> options, described in the next section.
55394 </para>
55395 <para>
55396 If the response to the RCPT command is a 2<emphasis>xx</emphasis> code, the verification
55397 succeeds. If it is 5<emphasis>xx</emphasis>, the verification fails. For any other condition,
55398 Exim tries the next host, if any. If there is a problem with all the remote
55399 hosts, the ACL yields <quote>defer</quote>, unless the <option>defer_ok</option> parameter of the
55400 <option>callout</option> option is given, in which case the condition is forced to succeed.
55401 </para>
55402 <para>
55403 <indexterm role="concept">
55404 <primary>SMTP</primary>
55405 <secondary>output flushing, disabling for callout</secondary>
55406 </indexterm>
55407 A callout may take a little time. For this reason, Exim normally flushes SMTP
55408 output before performing a callout in an ACL, to avoid unexpected timeouts in
55409 clients when the SMTP PIPELINING extension is in use. The flushing can be
55410 disabled by using a <option>control</option> modifier to set <option>no_callout_flush</option>.
55411 </para>
55412 </section>
55413 <section id="CALLaddparcall">
55414 <title>Additional parameters for callouts</title>
55415 <para>
55416 <indexterm role="concept">
55417 <primary>callout</primary>
55418 <secondary>additional parameters for</secondary>
55419 </indexterm>
55420 The <option>callout</option> option can be followed by an equals sign and a number of
55421 optional parameters, separated by commas. For example:
55422 </para>
55423 <literallayout class="monospaced">
55424 verify = recipient/callout=10s,defer_ok
55425 </literallayout>
55426 <para>
55427 The old syntax, which had <option>callout_defer_ok</option> and <option>check_postmaster</option> as
55428 separate verify options, is retained for backwards compatibility, but is now
55429 deprecated. The additional parameters for <option>callout</option> are as follows:
55430 </para>
55431 <variablelist>
55432 <varlistentry>
55433 <term>&lt;<emphasis>a&nbsp;time&nbsp;interval</emphasis>&gt;</term>
55434 <listitem>
55435 <para>
55436 <indexterm role="concept">
55437 <primary>callout</primary>
55438 <secondary>timeout, specifying</secondary>
55439 </indexterm>
55440 This specifies the timeout that applies for the callout attempt to each host.
55441 For example:
55442 </para>
55443 <literallayout class="monospaced">
55444 verify = sender/callout=5s
55445 </literallayout>
55446 <para>
55447 The default is 30 seconds. The timeout is used for each response from the
55448 remote host. It is also used for the initial connection, unless overridden by
55449 the <option>connect</option> parameter.
55450 </para>
55451 </listitem></varlistentry>
55452 <varlistentry>
55453 <term><emphasis role="bold">connect&nbsp;=&nbsp;</emphasis>&lt;<emphasis>time&nbsp;interval</emphasis>&gt;</term>
55454 <listitem>
55455 <para>
55456 <indexterm role="concept">
55457 <primary>callout</primary>
55458 <secondary>connection timeout, specifying</secondary>
55459 </indexterm>
55460 This parameter makes it possible to set a different (usually smaller) timeout
55461 for making the SMTP connection. For example:
55462 </para>
55463 <literallayout class="monospaced">
55464 verify = sender/callout=5s,connect=1s
55465 </literallayout>
55466 <para>
55467 If not specified, this timeout defaults to the general timeout value.
55468 </para>
55469 </listitem></varlistentry>
55470 <varlistentry>
55471 <term><emphasis role="bold">defer_ok</emphasis></term>
55472 <listitem>
55473 <para>
55474 <indexterm role="concept">
55475 <primary>callout</primary>
55476 <secondary>defer, action on</secondary>
55477 </indexterm>
55478 When this parameter is present, failure to contact any host, or any other kind
55479 of temporary error, is treated as success by the ACL. However, the cache is not
55480 updated in this circumstance.
55481 </para>
55482 </listitem></varlistentry>
55483 <varlistentry>
55484 <term><emphasis role="bold">fullpostmaster</emphasis></term>
55485 <listitem>
55486 <para>
55487 <indexterm role="concept">
55488 <primary>callout</primary>
55489 <secondary>full postmaster check</secondary>
55490 </indexterm>
55491 This operates like the <option>postmaster</option> option (see below), but if the check for
55492 <emphasis>postmaster@domain</emphasis> fails, it tries just <emphasis>postmaster</emphasis>, without a domain, in
55493 accordance with the specification in RFC 2821. The RFC states that the
55494 unqualified address <emphasis>postmaster</emphasis> should be accepted.
55495 </para>
55496 </listitem></varlistentry>
55497 <varlistentry>
55498 <term><emphasis role="bold">mailfrom&nbsp;=&nbsp;</emphasis>&lt;<emphasis>email&nbsp;address</emphasis>&gt;</term>
55499 <listitem>
55500 <para>
55501 <indexterm role="concept">
55502 <primary>callout</primary>
55503 <secondary>sender when verifying header</secondary>
55504 </indexterm>
55505 When verifying addresses in header lines using the <option>header_sender</option>
55506 verification option, Exim behaves by default as if the addresses are envelope
55507 sender addresses from a message. Callout verification therefore tests to see
55508 whether a bounce message could be delivered, by using an empty address in the
55509 MAIL command. However, it is arguable that these addresses might never be used
55510 as envelope senders, and could therefore justifiably reject bounce messages
55511 (empty senders). The <option>mailfrom</option> callout parameter allows you to specify what
55512 address to use in the MAIL command. For example:
55513 </para>
55514 <literallayout class="monospaced">
55515 require  verify = header_sender/callout=mailfrom=abcd@x.y.z
55516 </literallayout>
55517 <para>
55518 This parameter is available only for the <option>header_sender</option> verification option.
55519 </para>
55520 </listitem></varlistentry>
55521 <varlistentry>
55522 <term><emphasis role="bold">maxwait&nbsp;=&nbsp;</emphasis>&lt;<emphasis>time&nbsp;interval</emphasis>&gt;</term>
55523 <listitem>
55524 <para>
55525 <indexterm role="concept">
55526 <primary>callout</primary>
55527 <secondary>overall timeout, specifying</secondary>
55528 </indexterm>
55529 This parameter sets an overall timeout for performing a callout verification.
55530 For example:
55531 </para>
55532 <literallayout class="monospaced">
55533 verify = sender/callout=5s,maxwait=30s
55534 </literallayout>
55535 <para>
55536 This timeout defaults to four times the callout timeout for individual SMTP
55537 commands. The overall timeout applies when there is more than one host that can
55538 be tried. The timeout is checked before trying the next host. This prevents
55539 very long delays if there are a large number of hosts and all are timing out
55540 (for example, when network connections are timing out).
55541 </para>
55542 </listitem></varlistentry>
55543 <varlistentry>
55544 <term><emphasis role="bold">no_cache</emphasis></term>
55545 <listitem>
55546 <para>
55547 <indexterm role="concept">
55548 <primary>callout</primary>
55549 <secondary>cache, suppressing</secondary>
55550 </indexterm>
55551 <indexterm role="concept">
55552 <primary>caching callout, suppressing</primary>
55553 </indexterm>
55554 When this parameter is given, the callout cache is neither read nor updated.
55555 </para>
55556 </listitem></varlistentry>
55557 <varlistentry>
55558 <term><emphasis role="bold">postmaster</emphasis></term>
55559 <listitem>
55560 <para>
55561 <indexterm role="concept">
55562 <primary>callout</primary>
55563 <secondary>postmaster; checking</secondary>
55564 </indexterm>
55565 When this parameter is set, a successful callout check is followed by a similar
55566 check for the local part <emphasis>postmaster</emphasis> at the same domain. If this address is
55567 rejected, the callout fails (but see <option>fullpostmaster</option> above). The result of
55568 the postmaster check is recorded in a cache record; if it is a failure, this is
55569 used to fail subsequent callouts for the domain without a connection being
55570 made, until the cache record expires.
55571 </para>
55572 </listitem></varlistentry>
55573 <varlistentry>
55574 <term><emphasis role="bold">postmaster_mailfrom&nbsp;=&nbsp;</emphasis>&lt;<emphasis>email&nbsp;address</emphasis>&gt;</term>
55575 <listitem>
55576 <para>
55577 The postmaster check uses an empty sender in the MAIL command by default.
55578 You can use this parameter to do a postmaster check using a different address.
55579 For example:
55580 </para>
55581 <literallayout class="monospaced">
55582 require  verify = sender/callout=postmaster_mailfrom=abc@x.y.z
55583 </literallayout>
55584 <para>
55585 If both <option>postmaster</option> and <option>postmaster_mailfrom</option> are present, the rightmost
55586 one overrides. The <option>postmaster</option> parameter is equivalent to this example:
55587 </para>
55588 <literallayout class="monospaced">
55589 require  verify = sender/callout=postmaster_mailfrom=
55590 </literallayout>
55591 <para>
55592 <emphasis role="bold">Warning</emphasis>: The caching arrangements for postmaster checking do not take
55593 account of the sender address. It is assumed that either the empty address or
55594 a fixed non-empty address will be used. All that Exim remembers is that the
55595 postmaster check for the domain succeeded or failed.
55596 </para>
55597 </listitem></varlistentry>
55598 <varlistentry>
55599 <term><emphasis role="bold">random</emphasis></term>
55600 <listitem>
55601 <para>
55602 <indexterm role="concept">
55603 <primary>callout</primary>
55604 <secondary><quote>random</quote> check</secondary>
55605 </indexterm>
55606 When this parameter is set, before doing the normal callout check, Exim does a
55607 check for a <quote>random</quote> local part at the same domain. The local part is not
55608 really random &ndash; it is defined by the expansion of the option
55609 <option>callout_random_local_part</option>, which defaults to
55610 </para>
55611 <literallayout class="monospaced">
55612 $primary_hostname-$tod_epoch-testing
55613 </literallayout>
55614 <para>
55615 The idea here is to try to determine whether the remote host accepts all local
55616 parts without checking. If it does, there is no point in doing callouts for
55617 specific local parts. If the <quote>random</quote> check succeeds, the result is saved in
55618 a cache record, and used to force the current and subsequent callout checks to
55619 succeed without a connection being made, until the cache record expires.
55620 </para>
55621 </listitem></varlistentry>
55622 <varlistentry>
55623 <term><emphasis role="bold">use_postmaster</emphasis></term>
55624 <listitem>
55625 <para>
55626 <indexterm role="concept">
55627 <primary>callout</primary>
55628 <secondary>sender for recipient check</secondary>
55629 </indexterm>
55630 This parameter applies to recipient callouts only. For example:
55631 </para>
55632 <literallayout class="monospaced">
55633 deny  !verify = recipient/callout=use_postmaster
55634 </literallayout>
55635 <para>
55636 <indexterm role="variable">
55637 <primary><varname>$qualify_domain</varname></primary>
55638 </indexterm>
55639 It causes a non-empty postmaster address to be used in the MAIL command when
55640 performing the callout for the recipient, and also for a <quote>random</quote> check if
55641 that is configured. The local part of the address is <literal>postmaster</literal> and the
55642 domain is the contents of <varname>$qualify_domain</varname>.
55643 </para>
55644 </listitem></varlistentry>
55645 <varlistentry>
55646 <term><emphasis role="bold">use_sender</emphasis></term>
55647 <listitem>
55648 <para>
55649 This option applies to recipient callouts only. For example:
55650 </para>
55651 <literallayout class="monospaced">
55652 require  verify = recipient/callout=use_sender
55653 </literallayout>
55654 <para>
55655 It causes the message&#x2019;s actual sender address to be used in the MAIL
55656 command when performing the callout, instead of an empty address. There is no
55657 need to use this option unless you know that the called hosts make use of the
55658 sender when checking recipients. If used indiscriminately, it reduces the
55659 usefulness of callout caching.
55660 </para>
55661 </listitem></varlistentry>
55662 </variablelist>
55663 <para>
55664 If you use any of the parameters that set a non-empty sender for the MAIL
55665 command (<option>mailfrom</option>, <option>postmaster_mailfrom</option>, <option>use_postmaster</option>, or
55666 <option>use_sender</option>), you should think about possible loops. Recipient checking is
55667 usually done between two hosts that are under the same management, and the host
55668 that receives the callouts is not normally configured to do callouts itself.
55669 Therefore, it is normally safe to use <option>use_postmaster</option> or <option>use_sender</option> in
55670 these circumstances.
55671 </para>
55672 <para>
55673 However, if you use a non-empty sender address for a callout to an arbitrary
55674 host, there is the likelihood that the remote host will itself initiate a
55675 callout check back to your host. As it is checking what appears to be a message
55676 sender, it is likely to use an empty address in MAIL, thus avoiding a
55677 callout loop. However, to be on the safe side it would be best to set up your
55678 own ACLs so that they do not do sender verification checks when the recipient
55679 is the address you use for header sender or postmaster callout checking.
55680 </para>
55681 <para>
55682 Another issue to think about when using non-empty senders for callouts is
55683 caching. When you set <option>mailfrom</option> or <option>use_sender</option>, the cache record is keyed
55684 by the sender/recipient combination; thus, for any given recipient, many more
55685 actual callouts are performed than when an empty sender or postmaster is used.
55686 </para>
55687 </section>
55688 <section id="SECTcallvercache">
55689 <title>Callout caching</title>
55690 <para>
55691 <indexterm role="concept">
55692 <primary>hints database</primary>
55693 <secondary>callout cache</secondary>
55694 </indexterm>
55695 <indexterm role="concept">
55696 <primary>callout</primary>
55697 <secondary>cache, description of</secondary>
55698 </indexterm>
55699 <indexterm role="concept">
55700 <primary>caching</primary>
55701 <secondary>callout</secondary>
55702 </indexterm>
55703 Exim caches the results of callouts in order to reduce the amount of resources
55704 used, unless you specify the <option>no_cache</option> parameter with the <option>callout</option>
55705 option. A hints database called <quote>callout</quote> is used for the cache. Two
55706 different record types are used: one records the result of a callout check for
55707 a specific address, and the other records information that applies to the
55708 entire domain (for example, that it accepts the local part <emphasis>postmaster</emphasis>).
55709 </para>
55710 <para>
55711 When an original callout fails, a detailed SMTP error message is given about
55712 the failure. However, for subsequent failures use the cache data, this message
55713 is not available.
55714 </para>
55715 <para>
55716 The expiry times for negative and positive address cache records are
55717 independent, and can be set by the global options <option>callout_negative_expire</option>
55718 (default 2h) and <option>callout_positive_expire</option> (default 24h), respectively.
55719 </para>
55720 <para>
55721 If a host gives a negative response to an SMTP connection, or rejects any
55722 commands up to and including
55723 </para>
55724 <literallayout class="monospaced">
55725 MAIL FROM:&lt;&gt;
55726 </literallayout>
55727 <para>
55728 (but not including the MAIL command with a non-empty address),
55729 any callout attempt is bound to fail. Exim remembers such failures in a
55730 domain cache record, which it uses to fail callouts for the domain without
55731 making new connections, until the domain record times out. There are two
55732 separate expiry times for domain cache records:
55733 <option>callout_domain_negative_expire</option> (default 3h) and
55734 <option>callout_domain_positive_expire</option> (default 7d).
55735 </para>
55736 <para>
55737 Domain records expire when the negative expiry time is reached if callouts
55738 cannot be made for the domain, or if the postmaster check failed.
55739 Otherwise, they expire when the positive expiry time is reached. This
55740 ensures that, for example, a host that stops accepting <quote>random</quote> local parts
55741 will eventually be noticed.
55742 </para>
55743 <para>
55744 The callout caching mechanism is based on the domain of the address that is
55745 being tested. If the domain routes to several hosts, it is assumed that their
55746 behaviour will be the same.
55747 </para>
55748 </section>
55749 <section id="SECTsenaddver">
55750 <title>Sender address verification reporting</title>
55751 <para>
55752 <indexterm role="concept">
55753 <primary>verifying</primary>
55754 <secondary>suppressing error details</secondary>
55755 </indexterm>
55756 See section <xref linkend="SECTaddressverification"/> for a general discussion of
55757 verification. When sender verification fails in an ACL, the details of the
55758 failure are given as additional output lines before the 550 response to the
55759 relevant SMTP command (RCPT or DATA). For example, if sender callout is in use,
55760 you might see:
55761 </para>
55762 <literallayout class="monospaced">
55763 MAIL FROM:&lt;xyz@abc.example&gt;
55764 250 OK
55765 RCPT TO:&lt;pqr@def.example&gt;
55766 550-Verification failed for &lt;xyz@abc.example&gt;
55767 550-Called:   192.168.34.43
55768 550-Sent:     RCPT TO:&lt;xyz@abc.example&gt;
55769 550-Response: 550 Unknown local part xyz in &lt;xyz@abc.example&gt;
55770 550 Sender verification failed
55771 </literallayout>
55772 <para>
55773 If more than one RCPT command fails in the same way, the details are given
55774 only for the first of them. However, some administrators do not want to send
55775 out this much information. You can suppress the details by adding
55776 <literal>/no_details</literal> to the ACL statement that requests sender verification. For
55777 example:
55778 </para>
55779 <literallayout class="monospaced">
55780 verify = sender/no_details
55781 </literallayout>
55782 </section>
55783 <section id="SECTredirwhilveri">
55784 <title>Redirection while verifying</title>
55785 <para>
55786 <indexterm role="concept">
55787 <primary>verifying</primary>
55788 <secondary>redirection while</secondary>
55789 </indexterm>
55790 <indexterm role="concept">
55791 <primary>address redirection</primary>
55792 <secondary>while verifying</secondary>
55793 </indexterm>
55794 A dilemma arises when a local address is redirected by aliasing or forwarding
55795 during verification: should the generated addresses themselves be verified,
55796 or should the successful expansion of the original address be enough to verify
55797 it? By default, Exim takes the following pragmatic approach:
55798 </para>
55799 <itemizedlist>
55800 <listitem>
55801 <para>
55802 When an incoming address is redirected to just one child address, verification
55803 continues with the child address, and if that fails to verify, the original
55804 verification also fails.
55805 </para>
55806 </listitem>
55807 <listitem>
55808 <para>
55809 When an incoming address is redirected to more than one child address,
55810 verification does not continue. A success result is returned.
55811 </para>
55812 </listitem>
55813 </itemizedlist>
55814 <para>
55815 This seems the most reasonable behaviour for the common use of aliasing as a
55816 way of redirecting different local parts to the same mailbox. It means, for
55817 example, that a pair of alias entries of the form
55818 </para>
55819 <literallayout class="monospaced">
55820 A.Wol:   aw123
55821 aw123:   :fail: Gone away, no forwarding address
55822 </literallayout>
55823 <para>
55824 work as expected, with both local parts causing verification failure. When a
55825 redirection generates more than one address, the behaviour is more like a
55826 mailing list, where the existence of the alias itself is sufficient for
55827 verification to succeed.
55828 </para>
55829 <para>
55830 It is possible, however, to change the default behaviour so that all successful
55831 redirections count as successful verifications, however many new addresses are
55832 generated. This is specified by the <option>success_on_redirect</option> verification
55833 option. For example:
55834 </para>
55835 <literallayout class="monospaced">
55836 require verify = recipient/success_on_redirect/callout=10s
55837 </literallayout>
55838 <para>
55839 In this example, verification succeeds if a router generates a new address, and
55840 the callout does not occur, because no address was routed to a remote host.
55841 </para>
55842 <para>
55843 When verification is being tested via the <option>-bv</option> option, the treatment of
55844 redirections is as just described, unless the <option>-v</option> or any debugging option is
55845 also specified. In that case, full verification is done for every generated
55846 address and a report is output for each of them.
55847 </para>
55848 </section>
55849 <section id="SECTverifyCSA">
55850 <title>Client SMTP authorization (CSA)</title>
55851 <para>
55852 <indexterm role="concept">
55853 <primary>CSA</primary>
55854 <secondary>verifying</secondary>
55855 </indexterm>
55856 Client SMTP Authorization is a system that allows a site to advertise
55857 which machines are and are not permitted to send email. This is done by placing
55858 special SRV records in the DNS; these are looked up using the client&#x2019;s HELO
55859 domain. At the time of writing, CSA is still an Internet Draft. Client SMTP
55860 Authorization checks in Exim are performed by the ACL condition:
55861 </para>
55862 <literallayout class="monospaced">
55863 verify = csa
55864 </literallayout>
55865 <para>
55866 This fails if the client is not authorized. If there is a DNS problem, or if no
55867 valid CSA SRV record is found, or if the client is authorized, the condition
55868 succeeds. These three cases can be distinguished using the expansion variable
55869 <varname>$csa_status</varname>, which can take one of the values <quote>fail</quote>, <quote>defer</quote>,
55870 <quote>unknown</quote>, or <quote>ok</quote>. The condition does not itself defer because that would
55871 be likely to cause problems for legitimate email.
55872 </para>
55873 <para>
55874 The error messages produced by the CSA code include slightly more
55875 detail. If <varname>$csa_status</varname> is <quote>defer</quote>, this may be because of problems
55876 looking up the CSA SRV record, or problems looking up the CSA target
55877 address record. There are four reasons for <varname>$csa_status</varname> being <quote>fail</quote>:
55878 </para>
55879 <itemizedlist>
55880 <listitem>
55881 <para>
55882 The client&#x2019;s host name is explicitly not authorized.
55883 </para>
55884 </listitem>
55885 <listitem>
55886 <para>
55887 The client&#x2019;s IP address does not match any of the CSA target IP addresses.
55888 </para>
55889 </listitem>
55890 <listitem>
55891 <para>
55892 The client&#x2019;s host name is authorized but it has no valid target IP addresses
55893 (for example, the target&#x2019;s addresses are IPv6 and the client is using IPv4).
55894 </para>
55895 </listitem>
55896 <listitem>
55897 <para>
55898 The client&#x2019;s host name has no CSA SRV record but a parent domain has asserted
55899 that all subdomains must be explicitly authorized.
55900 </para>
55901 </listitem>
55902 </itemizedlist>
55903 <para>
55904 The <option>csa</option> verification condition can take an argument which is the domain to
55905 use for the DNS query. The default is:
55906 </para>
55907 <literallayout class="monospaced">
55908 verify = csa/$sender_helo_name
55909 </literallayout>
55910 <para>
55911 This implementation includes an extension to CSA. If the query domain
55912 is an address literal such as [192.0.2.95], or if it is a bare IP
55913 address, Exim searches for CSA SRV records in the reverse DNS as if
55914 the HELO domain was (for example) <emphasis>95.2.0.192.in-addr.arpa</emphasis>. Therefore it is
55915 meaningful to say:
55916 </para>
55917 <literallayout class="monospaced">
55918 verify = csa/$sender_host_address
55919 </literallayout>
55920 <para>
55921 In fact, this is the check that Exim performs if the client does not say HELO.
55922 This extension can be turned off by setting the main configuration option
55923 <option>dns_csa_use_reverse</option> to be false.
55924 </para>
55925 <para>
55926 If a CSA SRV record is not found for the domain itself, a search
55927 is performed through its parent domains for a record which might be
55928 making assertions about subdomains. The maximum depth of this search is limited
55929 using the main configuration option <option>dns_csa_search_limit</option>, which is 5 by
55930 default. Exim does not look for CSA SRV records in a top level domain, so the
55931 default settings handle HELO domains as long as seven
55932 (<emphasis>hostname.five.four.three.two.one.com</emphasis>). This encompasses the vast majority
55933 of legitimate HELO domains.
55934 </para>
55935 <para>
55936 The <emphasis>dnsdb</emphasis> lookup also has support for CSA. Although <emphasis>dnsdb</emphasis> also supports
55937 direct SRV lookups, this is not sufficient because of the extra parent domain
55938 search behaviour of CSA, and (as with PTR lookups) <emphasis>dnsdb</emphasis> also turns IP
55939 addresses into lookups in the reverse DNS space. The result of a successful
55940 lookup such as:
55941 </para>
55942 <literallayout class="monospaced">
55943 ${lookup dnsdb {csa=$sender_helo_name}}
55944 </literallayout>
55945 <para>
55946 has two space-separated fields: an authorization code and a target host name.
55947 The authorization code can be <quote>Y</quote> for yes, <quote>N</quote> for no, <quote>X</quote> for explicit
55948 authorization required but absent, or <quote>?</quote> for unknown.
55949 </para>
55950 </section>
55951 <section id="SECTverifyPRVS">
55952 <title>Bounce address tag validation</title>
55953 <para>
55954 <indexterm role="concept">
55955 <primary>BATV, verifying</primary>
55956 </indexterm>
55957 Bounce address tag validation (BATV) is a scheme whereby the envelope senders
55958 of outgoing messages have a cryptographic, timestamped <quote>tag</quote> added to them.
55959 Genuine incoming bounce messages should therefore always be addressed to
55960 recipients that have a valid tag. This scheme is a way of detecting unwanted
55961 bounce messages caused by sender address forgeries (often called <quote>collateral
55962 spam</quote>), because the recipients of such messages do not include valid tags.
55963 </para>
55964 <para>
55965 There are two expansion items to help with the implementation of the BATV
55966 <quote>prvs</quote> (private signature) scheme in an Exim configuration. This scheme signs
55967 the original envelope sender address by using a simple key to add a hash of the
55968 address and some time-based randomizing information. The <option>prvs</option> expansion
55969 item creates a signed address, and the <option>prvscheck</option> expansion item checks one.
55970 The syntax of these expansion items is described in section
55971 <xref linkend="SECTexpansionitems"/>.
55972 </para>
55973 <para>
55974 As an example, suppose the secret per-address keys are stored in an MySQL
55975 database. A query to look up the key for an address could be defined as a macro
55976 like this:
55977 </para>
55978 <literallayout class="monospaced">
55979 PRVSCHECK_SQL = ${lookup mysql{SELECT secret FROM batv_prvs \
55980                 WHERE sender='${quote_mysql:$prvscheck_address}'\
55981                 }{$value}}
55982 </literallayout>
55983 <para>
55984 Suppose also that the senders who make use of BATV are defined by an address
55985 list called <option>batv_senders</option>. Then, in the ACL for RCPT commands, you could
55986 use this:
55987 </para>
55988 <literallayout class="monospaced">
55989 # Bounces: drop unsigned addresses for BATV senders
55990 deny message = This address does not send an unsigned reverse path
55991      senders = :
55992      recipients = +batv_senders
55993
55994 # Bounces: In case of prvs-signed address, check signature.
55995 deny message = Invalid reverse path signature.
55996      senders = :
55997      condition  = ${prvscheck {$local_part@$domain}\
55998                   {PRVSCHECK_SQL}{1}}
55999      !condition = $prvscheck_result
56000 </literallayout>
56001 <para>
56002 The first statement rejects recipients for bounce messages that are addressed
56003 to plain BATV sender addresses, because it is known that BATV senders do not
56004 send out messages with plain sender addresses. The second statement rejects
56005 recipients that are prvs-signed, but with invalid signatures (either because
56006 the key is wrong, or the signature has timed out).
56007 </para>
56008 <para>
56009 A non-prvs-signed address is not rejected by the second statement, because the
56010 <option>prvscheck</option> expansion yields an empty string if its first argument is not a
56011 prvs-signed address, thus causing the <option>condition</option> condition to be false. If
56012 the first argument is a syntactically valid prvs-signed address, the yield is
56013 the third string (in this case <quote>1</quote>), whether or not the cryptographic and
56014 timeout checks succeed. The <varname>$prvscheck_result</varname> variable contains the result
56015 of the checks (empty for failure, <quote>1</quote> for success).
56016 </para>
56017 <para>
56018 There is one more issue you must consider when implementing prvs-signing:
56019 you have to ensure that the routers accept prvs-signed addresses and
56020 deliver them correctly. The easiest way to handle this is to use a <command>redirect</command>
56021 router to remove the signature with a configuration along these lines:
56022 </para>
56023 <literallayout class="monospaced">
56024 batv_redirect:
56025   driver = redirect
56026   data = ${prvscheck {$local_part@$domain}{PRVSCHECK_SQL}}
56027 </literallayout>
56028 <para>
56029 This works because, if the third argument of <option>prvscheck</option> is empty, the result
56030 of the expansion of a prvs-signed address is the decoded value of the original
56031 address. This router should probably be the first of your routers that handles
56032 local addresses.
56033 </para>
56034 <para>
56035 To create BATV-signed addresses in the first place, a transport of this form
56036 can be used:
56037 </para>
56038 <literallayout class="monospaced">
56039 external_smtp_batv:
56040   driver = smtp
56041   return_path = ${prvs {$return_path} \
56042                        {${lookup mysql{SELECT \
56043                        secret FROM batv_prvs WHERE \
56044                        sender='${quote_mysql:$sender_address}'} \
56045                        {$value}fail}}}
56046 </literallayout>
56047 <para>
56048 If no key can be found for the existing return path, no signing takes place.
56049 </para>
56050 </section>
56051 <section id="SECTrelaycontrol">
56052 <title>Using an ACL to control relaying</title>
56053 <para>
56054 <indexterm role="concept">
56055 <primary>access control lists (ACLs)</primary>
56056 <secondary>relay control</secondary>
56057 </indexterm>
56058 <indexterm role="concept">
56059 <primary>relaying</primary>
56060 <secondary>control by ACL</secondary>
56061 </indexterm>
56062 <indexterm role="concept">
56063 <primary>policy control</primary>
56064 <secondary>relay control</secondary>
56065 </indexterm>
56066 An MTA is said to <emphasis>relay</emphasis> a message if it receives it from some host and
56067 delivers it directly to another host as a result of a remote address contained
56068 within it. Redirecting a local address via an alias or forward file and then
56069 passing the message on to another host is not relaying,
56070 <indexterm role="concept">
56071 <primary><quote>percent hack</quote></primary>
56072 </indexterm>
56073 but a redirection as a result of the <quote>percent hack</quote> is.
56074 </para>
56075 <para>
56076 Two kinds of relaying exist, which are termed <quote>incoming</quote> and <quote>outgoing</quote>.
56077 A host which is acting as a gateway or an MX backup is concerned with incoming
56078 relaying from arbitrary hosts to a specific set of domains. On the other hand,
56079 a host which is acting as a smart host for a number of clients is concerned
56080 with outgoing relaying from those clients to the Internet at large. Often the
56081 same host is fulfilling both functions,
56082 but in principle these two kinds of relaying are entirely independent. What is
56083 not wanted is the transmission of mail from arbitrary remote hosts through your
56084 system to arbitrary domains.
56085 </para>
56086 <para>
56087 You can implement relay control by means of suitable statements in the ACL that
56088 runs for each RCPT command. For convenience, it is often easiest to use
56089 Exim&#x2019;s named list facility to define the domains and hosts involved. For
56090 example, suppose you want to do the following:
56091 </para>
56092 <itemizedlist>
56093 <listitem>
56094 <para>
56095 Deliver a number of domains to mailboxes on the local host (or process them
56096 locally in some other way). Let&#x2019;s say these are <emphasis>my.dom1.example</emphasis> and
56097 <emphasis>my.dom2.example</emphasis>.
56098 </para>
56099 </listitem>
56100 <listitem>
56101 <para>
56102 Relay mail for a number of other domains for which you are the secondary MX.
56103 These might be <emphasis>friend1.example</emphasis> and <emphasis>friend2.example</emphasis>.
56104 </para>
56105 </listitem>
56106 <listitem>
56107 <para>
56108 Relay mail from the hosts on your local LAN, to whatever domains are involved.
56109 Suppose your LAN is 192.168.45.0/24.
56110 </para>
56111 </listitem>
56112 </itemizedlist>
56113 <para>
56114 In the main part of the configuration, you put the following definitions:
56115 </para>
56116 <literallayout class="monospaced">
56117 domainlist local_domains    = my.dom1.example : my.dom2.example
56118 domainlist relay_to_domains = friend1.example : friend2.example
56119 hostlist   relay_from_hosts = 192.168.45.0/24
56120 </literallayout>
56121 <para>
56122 Now you can use these definitions in the ACL that is run for every RCPT
56123 command:
56124 </para>
56125 <literallayout class="monospaced">
56126 acl_check_rcpt:
56127   accept domains = +local_domains : +relay_to_domains
56128   accept hosts   = +relay_from_hosts
56129 </literallayout>
56130 <para>
56131 The first statement accepts any RCPT command that contains an address in
56132 the local or relay domains. For any other domain, control passes to the second
56133 statement, which accepts the command only if it comes from one of the relay
56134 hosts. In practice, you will probably want to make your ACL more sophisticated
56135 than this, for example, by including sender and recipient verification. The
56136 default configuration includes a more comprehensive example, which is described
56137 in chapter <xref linkend="CHAPdefconfil"/>.
56138 </para>
56139 </section>
56140 <section id="SECTcheralcon">
56141 <title>Checking a relay configuration</title>
56142 <para>
56143 <indexterm role="concept">
56144 <primary>relaying</primary>
56145 <secondary>checking control of</secondary>
56146 </indexterm>
56147 You can check the relay characteristics of your configuration in the same way
56148 that you can test any ACL behaviour for an incoming SMTP connection, by using
56149 the <option>-bh</option> option to run a fake SMTP session with which you interact.
56150 </para>
56151 <para>
56152 For specifically testing for unwanted relaying, the host
56153 <emphasis>relay-test.mail-abuse.org</emphasis> provides a useful service. If you telnet to this
56154 host from the host on which Exim is running, using the normal telnet port, you
56155 will see a normal telnet connection message and then quite a long delay. Be
56156 patient. The remote host is making an SMTP connection back to your host, and
56157 trying a number of common probes to test for open relay vulnerability. The
56158 results of the tests will eventually appear on your terminal.
56159 <indexterm role="concept" startref="IIDacl" class="endofrange"/>
56160 </para>
56161 </section>
56162 </chapter>
56163
56164 <chapter id="CHAPexiscan">
56165 <title>Content scanning at ACL time</title>
56166 <para>
56167 <indexterm role="concept" id="IIDcosca" class="startofrange">
56168 <primary>content scanning</primary>
56169 <secondary>at ACL time</secondary>
56170 </indexterm>
56171 The extension of Exim to include content scanning at ACL time, formerly known
56172 as <quote>exiscan</quote>, was originally implemented as a patch by Tom Kistner. The code
56173 was integrated into the main source for Exim release 4.50, and Tom continues to
56174 maintain it. Most of the wording of this chapter is taken from Tom&#x2019;s
56175 specification.
56176 </para>
56177 <para>
56178 It is also possible to scan the content of messages at other times. The
56179 <function>local_scan()</function> function (see chapter <xref linkend="CHAPlocalscan"/>) allows for content
56180 scanning after all the ACLs have run. A transport filter can be used to scan
56181 messages at delivery time (see the <option>transport_filter</option> option, described in
56182 chapter <xref linkend="CHAPtransportgeneric"/>).
56183 </para>
56184 <para>
56185 If you want to include the ACL-time content-scanning features when you compile
56186 Exim, you need to arrange for WITH_CONTENT_SCAN to be defined in your
56187 <filename>Local/Makefile</filename>. When you do that, the Exim binary is built with:
56188 </para>
56189 <itemizedlist>
56190 <listitem>
56191 <para>
56192 Two additional ACLs (<option>acl_smtp_mime</option> and <option>acl_not_smtp_mime</option>) that are run
56193 for all MIME parts for SMTP and non-SMTP messages, respectively.
56194 </para>
56195 </listitem>
56196 <listitem>
56197 <para>
56198 Additional ACL conditions and modifiers: <option>decode</option>, <option>malware</option>,
56199 <option>mime_regex</option>, <option>regex</option>, and <option>spam</option>. These can be used in the ACL that is
56200 run at the end of message reception (the <option>acl_smtp_data</option> ACL).
56201 </para>
56202 </listitem>
56203 <listitem>
56204 <para>
56205 An additional control feature (<quote>no_mbox_unspool</quote>) that saves spooled copies
56206 of messages, or parts of messages, for debugging purposes.
56207 </para>
56208 </listitem>
56209 <listitem>
56210 <para>
56211 Additional expansion variables that are set in the new ACL and by the new
56212 conditions.
56213 </para>
56214 </listitem>
56215 <listitem>
56216 <para>
56217 Two new main configuration options: <option>av_scanner</option> and <option>spamd_address</option>.
56218 </para>
56219 </listitem>
56220 </itemizedlist>
56221 <para>
56222 There is another content-scanning configuration option for <filename>Local/Makefile</filename>,
56223 called WITH_OLD_DEMIME. If this is set, the old, deprecated <option>demime</option> ACL
56224 condition is compiled, in addition to all the other content-scanning features.
56225 </para>
56226 <para>
56227 Content-scanning is continually evolving, and new features are still being
56228 added. While such features are still unstable and liable to incompatible
56229 changes, they are made available in Exim by setting options whose names begin
56230 EXPERIMENTAL_ in <filename>Local/Makefile</filename>. Such features are not documented in
56231 this manual. You can find out about them by reading the file called
56232 <filename>doc/experimental.txt</filename>.
56233 </para>
56234 <para>
56235 All the content-scanning facilities work on a MBOX copy of the message that is
56236 temporarily created in a file called:
56237 </para>
56238 <literallayout>
56239 &lt;<emphasis>spool_directory</emphasis>&gt;<literal>/scan/</literal>&lt;<emphasis>message_id</emphasis>&gt;/&lt;<emphasis>message_id</emphasis>&gt;<literal>.eml</literal>
56240 </literallayout>
56241 <para>
56242 The <filename>.eml</filename> extension is a friendly hint to virus scanners that they can
56243 expect an MBOX-like structure inside that file. The file is created when the
56244 first content scanning facility is called. Subsequent calls to content
56245 scanning conditions open the same file again. The directory is recursively
56246 removed when the <option>acl_smtp_data</option> ACL has finished running, unless
56247 </para>
56248 <literallayout class="monospaced">
56249 control = no_mbox_unspool
56250 </literallayout>
56251 <para>
56252 has been encountered. When the MIME ACL decodes files, they are put into the
56253 same directory by default.
56254 </para>
56255 <section id="SECTscanvirus">
56256 <title>Scanning for viruses</title>
56257 <para>
56258 <indexterm role="concept">
56259 <primary>virus scanning</primary>
56260 </indexterm>
56261 <indexterm role="concept">
56262 <primary>content scanning</primary>
56263 <secondary>for viruses</secondary>
56264 </indexterm>
56265 <indexterm role="concept">
56266 <primary>content scanning</primary>
56267 <secondary>the <option>malware</option> condition</secondary>
56268 </indexterm>
56269 The <option>malware</option> ACL condition lets you connect virus scanner software to Exim.
56270 It supports a <quote>generic</quote> interface to scanners called via the shell, and
56271 specialized interfaces for <quote>daemon</quote> type virus scanners, which are resident
56272 in memory and thus are much faster.
56273 </para>
56274 <para>
56275 <indexterm role="option">
56276 <primary><option>av_scanner</option></primary>
56277 </indexterm>
56278 You can set the <option>av_scanner</option> option in first part of the Exim configuration
56279 file to specify which scanner to use, together with any additional options that
56280 are needed. The basic syntax is as follows:
56281 </para>
56282 <literallayout>
56283 <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>
56284 </literallayout>
56285 <para>
56286 If you do not set <option>av_scanner</option>, it defaults to
56287 </para>
56288 <literallayout class="monospaced">
56289 av_scanner = sophie:/var/run/sophie
56290 </literallayout>
56291 <para>
56292 If the value of <option>av_scanner</option> starts with a dollar character, it is expanded
56293 before use.
56294 The usual list-parsing of the content (see <xref linkend="SECTlistconstruct"/>) applies.
56295 The following scanner types are supported in this release:
56296 </para>
56297 <variablelist>
56298 <varlistentry>
56299 <term><option>aveserver</option></term>
56300 <listitem>
56301 <para>
56302 <indexterm role="concept">
56303 <primary>virus scanners</primary>
56304 <secondary>Kaspersky</secondary>
56305 </indexterm>
56306 This is the scanner daemon of Kaspersky Version 5. You can get a trial version
56307 at <emphasis role="bold"><ulink url="http://www.kaspersky.com">http://www.kaspersky.com</ulink></emphasis>. This scanner type takes one option,
56308 which is the path to the daemon&#x2019;s UNIX socket. The default is shown in this
56309 example:
56310 </para>
56311 <literallayout class="monospaced">
56312 av_scanner = aveserver:/var/run/aveserver
56313 </literallayout>
56314 </listitem></varlistentry>
56315 <varlistentry>
56316 <term><option>clamd</option></term>
56317 <listitem>
56318 <para>
56319 <indexterm role="concept">
56320 <primary>virus scanners</primary>
56321 <secondary>clamd</secondary>
56322 </indexterm>
56323 This daemon-type scanner is GPL and free. You can get it at
56324 <emphasis role="bold"><ulink url="http://www.clamav.net/">http://www.clamav.net/</ulink></emphasis>. Some older versions of clamd do not seem to
56325 unpack MIME containers, so it used to be recommended to unpack MIME attachments
56326 in the MIME ACL. This no longer believed to be necessary. One option is
56327 required: either the path and name of a UNIX socket file, or a hostname or IP
56328 number, and a port, separated by space, as in the second of these examples:
56329 </para>
56330 <literallayout class="monospaced">
56331 av_scanner = clamd:/opt/clamd/socket
56332 av_scanner = clamd:192.0.2.3 1234
56333 av_scanner = clamd:192.0.2.3 1234:local
56334 av_scanner = clamd:192.0.2.3 1234 : 192.0.2.4 1234
56335 </literallayout>
56336 <para>
56337 If the value of av_scanner points to a UNIX socket file or contains the local
56338 keyword, then the ClamAV interface will pass a filename containing the data
56339 to be scanned, which will should normally result in less I/O happening and be
56340 more efficient.  Normally in the TCP case, the data is streamed to ClamAV as
56341 Exim does not assume that there is a common filesystem with the remote host.
56342 There is an option WITH_OLD_CLAMAV_STREAM in <filename>src/EDITME</filename> available, should
56343 you be running a version of ClamAV prior to 0.95.
56344 </para>
56345 <para>
56346 The final example shows that multiple TCP targets can be specified.  Exim will
56347 randomly use one for each incoming email (i.e. it load balances them).  Note
56348 that only TCP targets may be used if specifying a list of scanners; a UNIX
56349 socket cannot be mixed in with TCP targets.  If one of the servers becomes
56350 unavailable, Exim will try the remaining one(s) until it finds one that works.
56351 When a clamd server becomes unreachable, Exim will log a message.  Exim does
56352 not keep track of scanner state between multiple messages, and the scanner
56353 selection is random, so the message will get logged in the mainlog for each
56354 email that the down scanner gets chosen first (message wrapped to be readable):
56355 </para>
56356 <literallayout class="monospaced">
56357 2013-10-09 14:30:39 1VTumd-0000Y8-BQ malware acl condition:
56358    clamd: connection to localhost, port 3310 failed
56359    (Connection refused)
56360 </literallayout>
56361 <para>
56362 If the option is unset, the default is <filename>/tmp/clamd</filename>. Thanks to David Saez for
56363 contributing the code for this scanner.
56364 </para>
56365 </listitem></varlistentry>
56366 <varlistentry>
56367 <term><option>cmdline</option></term>
56368 <listitem>
56369 <para>
56370 <indexterm role="concept">
56371 <primary>virus scanners</primary>
56372 <secondary>command line interface</secondary>
56373 </indexterm>
56374 This is the keyword for the generic command line scanner interface. It can be
56375 used to attach virus scanners that are invoked from the shell. This scanner
56376 type takes 3 mandatory options:
56377 </para>
56378 <orderedlist numeration="arabic">
56379 <listitem>
56380 <para>
56381 The full path and name of the scanner binary, with all command line options,
56382 and a placeholder (<literal>%s</literal>) for the directory to scan.
56383 </para>
56384 </listitem>
56385 <listitem>
56386 <para>
56387 A regular expression to match against the STDOUT and STDERR output of the
56388 virus scanner. If the expression matches, a virus was found. You must make
56389 absolutely sure that this expression matches on <quote>virus found</quote>. This is called
56390 the <quote>trigger</quote> expression.
56391 </para>
56392 </listitem>
56393 <listitem>
56394 <para>
56395 Another regular expression, containing exactly one pair of parentheses, to
56396 match the name of the virus found in the scanners output. This is called the
56397 <quote>name</quote> expression.
56398 </para>
56399 </listitem>
56400 </orderedlist>
56401 <para>
56402 For example, Sophos Sweep reports a virus on a line like this:
56403 </para>
56404 <literallayout class="monospaced">
56405 Virus 'W32/Magistr-B' found in file ./those.bat
56406 </literallayout>
56407 <para>
56408 For the trigger expression, we can match the phrase <quote>found in file</quote>. For the
56409 name expression, we want to extract the W32/Magistr-B string, so we can match
56410 for the single quotes left and right of it. Altogether, this makes the
56411 configuration setting:
56412 </para>
56413 <literallayout class="monospaced">
56414 av_scanner = cmdline:\
56415              /path/to/sweep -ss -all -rec -archive %s:\
56416              found in file:'(.+)'
56417 </literallayout>
56418 </listitem></varlistentry>
56419 <varlistentry>
56420 <term><option>drweb</option></term>
56421 <listitem>
56422 <para>
56423 <indexterm role="concept">
56424 <primary>virus scanners</primary>
56425 <secondary>DrWeb</secondary>
56426 </indexterm>
56427 The DrWeb daemon scanner (<emphasis role="bold"><ulink url="http://www.sald.com/">http://www.sald.com/</ulink></emphasis>) interface takes one
56428 argument, either a full path to a UNIX socket, or an IP address and port
56429 separated by white space, as in these examples:
56430 </para>
56431 <literallayout class="monospaced">
56432 av_scanner = drweb:/var/run/drwebd.sock
56433 av_scanner = drweb:192.168.2.20 31337
56434 </literallayout>
56435 <para>
56436 If you omit the argument, the default path <filename>/usr/local/drweb/run/drwebd.sock</filename>
56437 is used. Thanks to Alex Miller for contributing the code for this scanner.
56438 </para>
56439 </listitem></varlistentry>
56440 <varlistentry>
56441 <term><option>fsecure</option></term>
56442 <listitem>
56443 <para>
56444 <indexterm role="concept">
56445 <primary>virus scanners</primary>
56446 <secondary>F-Secure</secondary>
56447 </indexterm>
56448 The F-Secure daemon scanner (<emphasis role="bold"><ulink url="http://www.f-secure.com">http://www.f-secure.com</ulink></emphasis>) takes one
56449 argument which is the path to a UNIX socket. For example:
56450 </para>
56451 <literallayout class="monospaced">
56452 av_scanner = fsecure:/path/to/.fsav
56453 </literallayout>
56454 <para>
56455 If no argument is given, the default is <filename>/var/run/.fsav</filename>. Thanks to Johan
56456 Thelmen for contributing the code for this scanner.
56457 </para>
56458 </listitem></varlistentry>
56459 <varlistentry>
56460 <term><option>kavdaemon</option></term>
56461 <listitem>
56462 <para>
56463 <indexterm role="concept">
56464 <primary>virus scanners</primary>
56465 <secondary>Kaspersky</secondary>
56466 </indexterm>
56467 This is the scanner daemon of Kaspersky Version 4. This version of the
56468 Kaspersky scanner is outdated. Please upgrade (see <option>aveserver</option> above). This
56469 scanner type takes one option, which is the path to the daemon&#x2019;s UNIX socket.
56470 For example:
56471 </para>
56472 <literallayout class="monospaced">
56473 av_scanner = kavdaemon:/opt/AVP/AvpCtl
56474 </literallayout>
56475 <para>
56476 The default path is <filename>/var/run/AvpCtl</filename>.
56477 </para>
56478 </listitem></varlistentry>
56479 <varlistentry>
56480 <term><option>mksd</option></term>
56481 <listitem>
56482 <para>
56483 <indexterm role="concept">
56484 <primary>virus scanners</primary>
56485 <secondary>mksd</secondary>
56486 </indexterm>
56487 This is a daemon type scanner that is aimed mainly at Polish users, though some
56488 parts of documentation are now available in English. You can get it at
56489 <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
56490 the maximum number of processes used simultaneously to scan the attachments,
56491 provided that the demime facility is employed and also provided that mksd has
56492 been run with at least the same number of child processes. For example:
56493 </para>
56494 <literallayout class="monospaced">
56495 av_scanner = mksd:2
56496 </literallayout>
56497 <para>
56498 You can safely omit this option (the default value is 1).
56499 </para>
56500 </listitem></varlistentry>
56501 <varlistentry>
56502 <term><option>sock</option></term>
56503 <listitem>
56504 <para>
56505 <indexterm role="concept">
56506 <primary>virus scanners</primary>
56507 <secondary>simple socket-connected</secondary>
56508 </indexterm>
56509 This is a general-purpose way of talking to simple scanner daemons
56510 running on the local machine.
56511 There are four options:
56512 an address (which may be an IP addres and port, or the path of a Unix socket),
56513 a commandline to send (may include a single %s which will be replaced with
56514 the path to the mail file to be scanned),
56515 an RE to trigger on from the returned data,
56516 an RE to extract malware_name from the returned data.
56517 For example:
56518 </para>
56519 <literallayout class="monospaced">
56520 av_scanner = sock:127.0.0.1 6001:%s:(SPAM|VIRUS):(.*)\$
56521 </literallayout>
56522 <para>
56523 Default for the socket specifier is <filename>/tmp/malware.sock</filename>.
56524 Default for the commandline is <filename>%s\n</filename>.
56525 Both regular-expressions are required.
56526 </para>
56527 </listitem></varlistentry>
56528 <varlistentry>
56529 <term><option>sophie</option></term>
56530 <listitem>
56531 <para>
56532 <indexterm role="concept">
56533 <primary>virus scanners</primary>
56534 <secondary>Sophos and Sophie</secondary>
56535 </indexterm>
56536 Sophie is a daemon that uses Sophos&#x2019; <option>libsavi</option> library to scan for viruses.
56537 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
56538 for this scanner type is the path to the UNIX socket that Sophie uses for
56539 client communication. For example:
56540 </para>
56541 <literallayout class="monospaced">
56542 av_scanner = sophie:/tmp/sophie
56543 </literallayout>
56544 <para>
56545 The default path is <filename>/var/run/sophie</filename>, so if you are using this, you can omit
56546 the option.
56547 </para>
56548 </listitem></varlistentry>
56549 </variablelist>
56550 <para>
56551 When <option>av_scanner</option> is correctly set, you can use the <option>malware</option> condition in
56552 the DATA ACL. <emphasis role="bold">Note</emphasis>: You cannot use the <option>malware</option> condition in the MIME
56553 ACL.
56554 </para>
56555 <para>
56556 The <option>av_scanner</option> option is expanded each time <option>malware</option> is called. This
56557 makes it possible to use different scanners. See further below for an example.
56558 The <option>malware</option> condition caches its results, so when you use it multiple times
56559 for the same message, the actual scanning process is only carried out once.
56560 However, using expandable items in <option>av_scanner</option> disables this caching, in
56561 which case each use of the <option>malware</option> condition causes a new scan of the
56562 message.
56563 </para>
56564 <para>
56565 The <option>malware</option> condition takes a right-hand argument that is expanded before
56566 use. It can then be one of
56567 </para>
56568 <itemizedlist>
56569 <listitem>
56570 <para>
56571 <quote>true</quote>, <quote>*</quote>, or <quote>1</quote>, in which case the message is scanned for viruses.
56572 The condition succeeds if a virus was found, and fail otherwise. This is the
56573 recommended usage.
56574 </para>
56575 </listitem>
56576 <listitem>
56577 <para>
56578 <quote>false</quote> or <quote>0</quote> or an empty string, in which case no scanning is done and
56579 the condition fails immediately.
56580 </para>
56581 </listitem>
56582 <listitem>
56583 <para>
56584 A regular expression, in which case the message is scanned for viruses. The
56585 condition succeeds if a virus is found and its name matches the regular
56586 expression. This allows you to take special actions on certain types of virus.
56587 </para>
56588 </listitem>
56589 </itemizedlist>
56590 <para>
56591 You can append <literal>/defer_ok</literal> to the <option>malware</option> condition to accept messages
56592 even if there is a problem with the virus scanner. Otherwise, such a problem
56593 causes the ACL to defer.
56594 </para>
56595 <para>
56596 <indexterm role="variable">
56597 <primary><varname>$malware_name</varname></primary>
56598 </indexterm>
56599 When a virus is found, the condition sets up an expansion variable called
56600 <varname>$malware_name</varname> that contains the name of the virus. You can use it in a
56601 <option>message</option> modifier that specifies the error returned to the sender, and/or in
56602 logging data.
56603 </para>
56604 <para>
56605 If your virus scanner cannot unpack MIME and TNEF containers itself, you should
56606 use the <option>demime</option> condition (see section <xref linkend="SECTdemimecond"/>) before the
56607 <option>malware</option> condition.
56608 </para>
56609 <para>
56610 Beware the interaction of Exim&#x2019;s <option>message_size_limit</option> with any size limits
56611 imposed by your anti-virus scanner.
56612 </para>
56613 <para>
56614 Here is a very simple scanning example:
56615 </para>
56616 <literallayout class="monospaced">
56617 deny message = This message contains malware ($malware_name)
56618      demime = *
56619      malware = *
56620 </literallayout>
56621 <para>
56622 The next example accepts messages when there is a problem with the scanner:
56623 </para>
56624 <literallayout class="monospaced">
56625 deny message = This message contains malware ($malware_name)
56626      demime = *
56627      malware = */defer_ok
56628 </literallayout>
56629 <para>
56630 The next example shows how to use an ACL variable to scan with both sophie and
56631 aveserver. It assumes you have set:
56632 </para>
56633 <literallayout class="monospaced">
56634 av_scanner = $acl_m0
56635 </literallayout>
56636 <para>
56637 in the main Exim configuration.
56638 </para>
56639 <literallayout class="monospaced">
56640 deny message = This message contains malware ($malware_name)
56641      set acl_m0 = sophie
56642      malware = *
56643
56644 deny message = This message contains malware ($malware_name)
56645      set acl_m0 = aveserver
56646      malware = *
56647 </literallayout>
56648 </section>
56649 <section id="SECTscanspamass">
56650 <title>Scanning with SpamAssassin</title>
56651 <para>
56652 <indexterm role="concept">
56653 <primary>content scanning</primary>
56654 <secondary>for spam</secondary>
56655 </indexterm>
56656 <indexterm role="concept">
56657 <primary>spam scanning</primary>
56658 </indexterm>
56659 <indexterm role="concept">
56660 <primary>SpamAssassin</primary>
56661 </indexterm>
56662 The <option>spam</option> ACL condition calls SpamAssassin&#x2019;s <option>spamd</option> daemon to get a spam
56663 score and a report for the message. You can get SpamAssassin at
56664 <emphasis role="bold"><ulink url="http://www.spamassassin.org">http://www.spamassassin.org</ulink></emphasis>, or, if you have a working Perl
56665 installation, you can use CPAN by running:
56666 </para>
56667 <literallayout class="monospaced">
56668 perl -MCPAN -e 'install Mail::SpamAssassin'
56669 </literallayout>
56670 <para>
56671 SpamAssassin has its own set of configuration files. Please review its
56672 documentation to see how you can tweak it. The default installation should work
56673 nicely, however.
56674 </para>
56675 <para>
56676 <indexterm role="option">
56677 <primary><option>spamd_address</option></primary>
56678 </indexterm>
56679 After having installed and configured SpamAssassin, start the <option>spamd</option> daemon.
56680 By default, it listens on 127.0.0.1, TCP port 783. If you use another host or
56681 port for <option>spamd</option>, you must set the <option>spamd_address</option> option in the global
56682 part of the Exim configuration as follows (example):
56683 </para>
56684 <literallayout class="monospaced">
56685 spamd_address = 192.168.99.45 387
56686 </literallayout>
56687 <para>
56688 You do not need to set this option if you use the default. As of version 2.60,
56689 <option>spamd</option> also supports communication over UNIX sockets. If you want to use
56690 these, supply <option>spamd_address</option> with an absolute file name instead of a
56691 address/port pair:
56692 </para>
56693 <literallayout class="monospaced">
56694 spamd_address = /var/run/spamd_socket
56695 </literallayout>
56696 <para>
56697 You can have multiple <option>spamd</option> servers to improve scalability. These can
56698 reside on other hardware reachable over the network. To specify multiple
56699 <option>spamd</option> servers, put multiple address/port pairs in the <option>spamd_address</option>
56700 option, separated with colons:
56701 </para>
56702 <literallayout class="monospaced">
56703 spamd_address = 192.168.2.10 783 : \
56704                 192.168.2.11 783 : \
56705                 192.168.2.12 783
56706 </literallayout>
56707 <para>
56708 Up to 32 <option>spamd</option> servers are supported. The servers are queried in a random
56709 fashion. When a server fails to respond to the connection attempt, all other
56710 servers are tried until one succeeds. If no server responds, the <option>spam</option>
56711 condition defers.
56712 </para>
56713 <para>
56714 <emphasis role="bold">Warning</emphasis>: It is not possible to use the UNIX socket connection method with
56715 multiple <option>spamd</option> servers.
56716 </para>
56717 <para>
56718 The <option>spamd_address</option> variable is expanded before use if it starts with
56719 a dollar sign. In this case, the expansion may return a string that is
56720 used as the list so that multiple spamd servers can be the result of an
56721 expansion.
56722 </para>
56723 </section>
56724 <section id="SECID206">
56725 <title>Calling SpamAssassin from an Exim ACL</title>
56726 <para>
56727 Here is a simple example of the use of the <option>spam</option> condition in a DATA ACL:
56728 </para>
56729 <literallayout class="monospaced">
56730 deny message = This message was classified as SPAM
56731      spam = joe
56732 </literallayout>
56733 <para>
56734 The right-hand side of the <option>spam</option> condition specifies a name. This is
56735 relevant if you have set up multiple SpamAssassin profiles. If you do not want
56736 to scan using a specific profile, but rather use the SpamAssassin system-wide
56737 default profile, you can scan for an unknown name, or simply use <quote>nobody</quote>.
56738 However, you must put something on the right-hand side.
56739 </para>
56740 <para>
56741 The name allows you to use per-domain or per-user antispam profiles in
56742 principle, but this is not straightforward in practice, because a message may
56743 have multiple recipients, not necessarily all in the same domain. Because the
56744 <option>spam</option> condition has to be called from a DATA ACL in order to be able to
56745 read the contents of the message, the variables <varname>$local_part</varname> and <varname>$domain</varname>
56746 are not set.
56747 </para>
56748 <para>
56749 The right-hand side of the <option>spam</option> condition is expanded before being used, so
56750 you can put lookups or conditions there. When the right-hand side evaluates to
56751 <quote>0</quote> or <quote>false</quote>, no scanning is done and the condition fails immediately.
56752 </para>
56753 <para>
56754 Scanning with SpamAssassin uses a lot of resources. If you scan every message,
56755 large ones may cause significant performance degradation. As most spam messages
56756 are quite small, it is recommended that you do not scan the big ones. For
56757 example:
56758 </para>
56759 <literallayout class="monospaced">
56760 deny message = This message was classified as SPAM
56761      condition = ${if &lt; {$message_size}{10K}}
56762      spam = nobody
56763 </literallayout>
56764 <para>
56765 The <option>spam</option> condition returns true if the threshold specified in the user&#x2019;s
56766 SpamAssassin profile has been matched or exceeded. If you want to use the
56767 <option>spam</option> condition for its side effects (see the variables below), you can make
56768 it always return <quote>true</quote> by appending <literal>:true</literal> to the username.
56769 </para>
56770 <para>
56771 <indexterm role="concept">
56772 <primary>spam scanning</primary>
56773 <secondary>returned variables</secondary>
56774 </indexterm>
56775 When the <option>spam</option> condition is run, it sets up a number of expansion
56776 variables. These variables are saved with the received message, thus they are
56777 available for use at delivery time.
56778 </para>
56779 <variablelist>
56780 <varlistentry>
56781 <term><varname>$spam_score</varname></term>
56782 <listitem>
56783 <para>
56784 The spam score of the message, for example <quote>3.4</quote> or <quote>30.5</quote>. This is useful
56785 for inclusion in log or reject messages.
56786 </para>
56787 </listitem></varlistentry>
56788 <varlistentry>
56789 <term><varname>$spam_score_int</varname></term>
56790 <listitem>
56791 <para>
56792 The spam score of the message, multiplied by ten, as an integer value. For
56793 example <quote>34</quote> or <quote>305</quote>. It may appear to disagree with <varname>$spam_score</varname>
56794 because <varname>$spam_score</varname> is rounded and <varname>$spam_score_int</varname> is truncated.
56795 The integer value is useful for numeric comparisons in conditions.
56796 </para>
56797 </listitem></varlistentry>
56798 <varlistentry>
56799 <term><varname>$spam_bar</varname></term>
56800 <listitem>
56801 <para>
56802 A string consisting of a number of <quote>+</quote> or <quote>-</quote> characters, representing the
56803 integer part of the spam score value. A spam score of 4.4 would have a
56804 <varname>$spam_bar</varname> value of <quote>++++</quote>. This is useful for inclusion in warning
56805 headers, since MUAs can match on such strings.
56806 </para>
56807 </listitem></varlistentry>
56808 <varlistentry>
56809 <term><varname>$spam_report</varname></term>
56810 <listitem>
56811 <para>
56812 A multiline text table, containing the full SpamAssassin report for the
56813 message. Useful for inclusion in headers or reject messages.
56814 </para>
56815 </listitem></varlistentry>
56816 </variablelist>
56817 <para>
56818 The <option>spam</option> condition caches its results unless expansion in
56819 spamd_address was used. If you call it again with the same user name, it
56820 does not scan again, but rather returns the same values as before.
56821 </para>
56822 <para>
56823 The <option>spam</option> condition returns DEFER if there is any error while running
56824 the message through SpamAssassin or if the expansion of spamd_address
56825 failed. If you want to treat DEFER as FAIL (to pass on to the next ACL
56826 statement block), append <literal>/defer_ok</literal> to the right-hand side of the
56827 spam condition, like this:
56828 </para>
56829 <literallayout class="monospaced">
56830 deny message = This message was classified as SPAM
56831      spam    = joe/defer_ok
56832 </literallayout>
56833 <para>
56834 This causes messages to be accepted even if there is a problem with <option>spamd</option>.
56835 </para>
56836 <para>
56837 Here is a longer, commented example of the use of the <option>spam</option>
56838 condition:
56839 </para>
56840 <literallayout class="monospaced">
56841 # put headers in all messages (no matter if spam or not)
56842 warn  spam = nobody:true
56843       add_header = X-Spam-Score: $spam_score ($spam_bar)
56844       add_header = X-Spam-Report: $spam_report
56845
56846 # add second subject line with *SPAM* marker when message
56847 # is over threshold
56848 warn  spam = nobody
56849       add_header = Subject: *SPAM* $h_Subject:
56850
56851 # reject spam at high scores (&gt; 12)
56852 deny  message = This message scored $spam_score spam points.
56853       spam = nobody:true
56854       condition = ${if &gt;{$spam_score_int}{120}{1}{0}}
56855 </literallayout>
56856 </section>
56857 <section id="SECTscanmimepart">
56858 <title>Scanning MIME parts</title>
56859 <para>
56860 <indexterm role="concept">
56861 <primary>content scanning</primary>
56862 <secondary>MIME parts</secondary>
56863 </indexterm>
56864 <indexterm role="concept">
56865 <primary>MIME content scanning</primary>
56866 </indexterm>
56867 <indexterm role="option">
56868 <primary><option>acl_smtp_mime</option></primary>
56869 </indexterm>
56870 <indexterm role="option">
56871 <primary><option>acl_not_smtp_mime</option></primary>
56872 </indexterm>
56873 The <option>acl_smtp_mime</option> global option specifies an ACL that is called once for
56874 each MIME part of an SMTP message, including multipart types, in the sequence
56875 of their position in the message. Similarly, the <option>acl_not_smtp_mime</option> option
56876 specifies an ACL that is used for the MIME parts of non-SMTP messages. These
56877 options may both refer to the same ACL if you want the same processing in both
56878 cases.
56879 </para>
56880 <para>
56881 These ACLs are called (possibly many times) just before the <option>acl_smtp_data</option>
56882 ACL in the case of an SMTP message, or just before the <option>acl_not_smtp</option> ACL in
56883 the case of a non-SMTP message. However, a MIME ACL is called only if the
56884 message contains a <emphasis>Content-Type:</emphasis> header line. When a call to a MIME
56885 ACL does not yield <quote>accept</quote>, ACL processing is aborted and the appropriate
56886 result code is sent to the client. In the case of an SMTP message, the
56887 <option>acl_smtp_data</option> ACL is not called when this happens.
56888 </para>
56889 <para>
56890 You cannot use the <option>malware</option> or <option>spam</option> conditions in a MIME ACL; these can
56891 only be used in the DATA or non-SMTP ACLs. However, you can use the <option>regex</option>
56892 condition to match against the raw MIME part. You can also use the
56893 <option>mime_regex</option> condition to match against the decoded MIME part (see section
56894 <xref linkend="SECTscanregex"/>).
56895 </para>
56896 <para>
56897 At the start of a MIME ACL, a number of variables are set from the header
56898 information for the relevant MIME part. These are described below. The contents
56899 of the MIME part are not by default decoded into a disk file except for MIME
56900 parts whose content-type is <quote>message/rfc822</quote>. If you want to decode a MIME
56901 part into a disk file, you can use the <option>decode</option> condition. The general
56902 syntax is:
56903 </para>
56904 <literallayout>
56905 <literal>decode = [/</literal>&lt;<emphasis>path</emphasis>&gt;<literal>/]</literal>&lt;<emphasis>filename</emphasis>&gt;
56906 </literallayout>
56907 <para>
56908 The right hand side is expanded before use. After expansion,
56909 the value can be:
56910 </para>
56911 <orderedlist numeration="arabic">
56912 <listitem>
56913 <para>
56914 <quote>0</quote> or <quote>false</quote>, in which case no decoding is done.
56915 </para>
56916 </listitem>
56917 <listitem>
56918 <para>
56919 The string <quote>default</quote>. In that case, the file is put in the temporary
56920 <quote>default</quote> directory &lt;<emphasis>spool_directory</emphasis>&gt;<filename>/scan/</filename>&lt;<emphasis>message_id</emphasis>&gt;<filename>/</filename> with
56921 a sequential file name consisting of the message id and a sequence number. The
56922 full path and name is available in <varname>$mime_decoded_filename</varname> after decoding.
56923 </para>
56924 </listitem>
56925 <listitem>
56926 <para>
56927 A full path name starting with a slash. If the full name is an existing
56928 directory, it is used as a replacement for the default directory. The filename
56929 is then sequentially assigned. If the path does not exist, it is used as
56930 the full path and file name.
56931 </para>
56932 </listitem>
56933 <listitem>
56934 <para>
56935 If the string does not start with a slash, it is used as the
56936 filename, and the default path is then used.
56937 </para>
56938 </listitem>
56939 </orderedlist>
56940 <para>
56941 The <option>decode</option> condition normally succeeds. It is only false for syntax
56942 errors or unusual circumstances such as memory shortages. You can easily decode
56943 a file with its original, proposed filename using
56944 </para>
56945 <literallayout class="monospaced">
56946 decode = $mime_filename
56947 </literallayout>
56948 <para>
56949 However, you should keep in mind that <varname>$mime_filename</varname> might contain
56950 anything. If you place files outside of the default path, they are not
56951 automatically unlinked.
56952 </para>
56953 <para>
56954 For RFC822 attachments (these are messages attached to messages, with a
56955 content-type of <quote>message/rfc822</quote>), the ACL is called again in the same manner
56956 as for the primary message, only that the <varname>$mime_is_rfc822</varname> expansion
56957 variable is set (see below). Attached messages are always decoded to disk
56958 before being checked, and the files are unlinked once the check is done.
56959 </para>
56960 <para>
56961 The MIME ACL supports the <option>regex</option> and <option>mime_regex</option> conditions. These can be
56962 used to match regular expressions against raw and decoded MIME parts,
56963 respectively. They are described in section <xref linkend="SECTscanregex"/>.
56964 </para>
56965 <para>
56966 <indexterm role="concept">
56967 <primary>MIME content scanning</primary>
56968 <secondary>returned variables</secondary>
56969 </indexterm>
56970 The following list describes all expansion variables that are
56971 available in the MIME ACL:
56972 </para>
56973 <variablelist>
56974 <varlistentry>
56975 <term><varname>$mime_boundary</varname></term>
56976 <listitem>
56977 <para>
56978 If the current part is a multipart (see <varname>$mime_is_multipart</varname>) below, it should
56979 have a boundary string, which is stored in this variable. If the current part
56980 has no boundary parameter in the <emphasis>Content-Type:</emphasis> header, this variable
56981 contains the empty string.
56982 </para>
56983 </listitem></varlistentry>
56984 <varlistentry>
56985 <term><varname>$mime_charset</varname></term>
56986 <listitem>
56987 <para>
56988 This variable contains the character set identifier, if one was found in the
56989 <emphasis>Content-Type:</emphasis> header. Examples for charset identifiers are:
56990 </para>
56991 <literallayout class="monospaced">
56992 us-ascii
56993 gb2312 (Chinese)
56994 iso-8859-1
56995 </literallayout>
56996 <para>
56997 Please note that this value is not normalized, so you should do matches
56998 case-insensitively.
56999 </para>
57000 </listitem></varlistentry>
57001 <varlistentry>
57002 <term><varname>$mime_content_description</varname></term>
57003 <listitem>
57004 <para>
57005 This variable contains the normalized content of the <emphasis>Content-Description:</emphasis>
57006 header. It can contain a human-readable description of the parts content. Some
57007 implementations repeat the filename for attachments here, but they are usually
57008 only used for display purposes.
57009 </para>
57010 </listitem></varlistentry>
57011 <varlistentry>
57012 <term><varname>$mime_content_disposition</varname></term>
57013 <listitem>
57014 <para>
57015 This variable contains the normalized content of the <emphasis>Content-Disposition:</emphasis>
57016 header. You can expect strings like <quote>attachment</quote> or <quote>inline</quote> here.
57017 </para>
57018 </listitem></varlistentry>
57019 <varlistentry>
57020 <term><varname>$mime_content_id</varname></term>
57021 <listitem>
57022 <para>
57023 This variable contains the normalized content of the <emphasis>Content-ID:</emphasis> header.
57024 This is a unique ID that can be used to reference a part from another part.
57025 </para>
57026 </listitem></varlistentry>
57027 <varlistentry>
57028 <term><varname>$mime_content_size</varname></term>
57029 <listitem>
57030 <para>
57031 This variable is set only after the <option>decode</option> modifier (see above) has been
57032 successfully run. It contains the size of the decoded part in kilobytes. The
57033 size is always rounded up to full kilobytes, so only a completely empty part
57034 has a <varname>$mime_content_size</varname> of zero.
57035 </para>
57036 </listitem></varlistentry>
57037 <varlistentry>
57038 <term><varname>$mime_content_transfer_encoding</varname></term>
57039 <listitem>
57040 <para>
57041 This variable contains the normalized content of the
57042 <emphasis>Content-transfer-encoding:</emphasis> header. This is a symbolic name for an encoding
57043 type. Typical values are <quote>base64</quote> and <quote>quoted-printable</quote>.
57044 </para>
57045 </listitem></varlistentry>
57046 <varlistentry>
57047 <term><varname>$mime_content_type</varname></term>
57048 <listitem>
57049 <para>
57050 If the MIME part has a <emphasis>Content-Type:</emphasis> header, this variable contains its
57051 value, lowercased, and without any options (like <quote>name</quote> or <quote>charset</quote>). Here
57052 are some examples of popular MIME types, as they may appear in this variable:
57053 </para>
57054 <literallayout class="monospaced">
57055 text/plain
57056 text/html
57057 application/octet-stream
57058 image/jpeg
57059 audio/midi
57060 </literallayout>
57061 <para>
57062 If the MIME part has no <emphasis>Content-Type:</emphasis> header, this variable contains the
57063 empty string.
57064 </para>
57065 </listitem></varlistentry>
57066 <varlistentry>
57067 <term><varname>$mime_decoded_filename</varname></term>
57068 <listitem>
57069 <para>
57070 This variable is set only after the <option>decode</option> modifier (see above) has been
57071 successfully run. It contains the full path and file name of the file
57072 containing the decoded data.
57073 </para>
57074 </listitem></varlistentry>
57075 </variablelist>
57076 <para>
57077 <indexterm role="concept">
57078 <primary>RFC 2047</primary>
57079 </indexterm>
57080 </para>
57081 <variablelist>
57082 <varlistentry>
57083 <term><varname>$mime_filename</varname></term>
57084 <listitem>
57085 <para>
57086 This is perhaps the most important of the MIME variables. It contains a
57087 proposed filename for an attachment, if one was found in either the
57088 <emphasis>Content-Type:</emphasis> or <emphasis>Content-Disposition:</emphasis> headers. The filename will be
57089 RFC2047 decoded, but no additional sanity checks are done. If no filename was
57090 found, this variable contains the empty string.
57091 </para>
57092 </listitem></varlistentry>
57093 <varlistentry>
57094 <term><varname>$mime_is_coverletter</varname></term>
57095 <listitem>
57096 <para>
57097 This variable attempts to differentiate the <quote>cover letter</quote> of an e-mail from
57098 attached data. It can be used to clamp down on flashy or unnecessarily encoded
57099 content in the cover letter, while not restricting attachments at all.
57100 </para>
57101 <para>
57102 The variable contains 1 (true) for a MIME part believed to be part of the
57103 cover letter, and 0 (false) for an attachment. At present, the algorithm is as
57104 follows:
57105 </para>
57106 <orderedlist numeration="arabic">
57107 <listitem>
57108 <para>
57109 The outermost MIME part of a message is always a cover letter.
57110 </para>
57111 </listitem>
57112 <listitem>
57113 <para>
57114 If a multipart/alternative or multipart/related MIME part is a cover letter,
57115 so are all MIME subparts within that multipart.
57116 </para>
57117 </listitem>
57118 <listitem>
57119 <para>
57120 If any other multipart is a cover letter, the first subpart is a cover letter,
57121 and the rest are attachments.
57122 </para>
57123 </listitem>
57124 <listitem>
57125 <para>
57126 All parts contained within an attachment multipart are attachments.
57127 </para>
57128 </listitem>
57129 </orderedlist>
57130 <para>
57131 As an example, the following will ban <quote>HTML mail</quote> (including that sent with
57132 alternative plain text), while allowing HTML files to be attached. HTML
57133 coverletter mail attached to non-HMTL coverletter mail will also be allowed:
57134 </para>
57135 <literallayout class="monospaced">
57136 deny message = HTML mail is not accepted here
57137 !condition = $mime_is_rfc822
57138 condition = $mime_is_coverletter
57139 condition = ${if eq{$mime_content_type}{text/html}{1}{0}}
57140 </literallayout>
57141 </listitem></varlistentry>
57142 <varlistentry>
57143 <term><varname>$mime_is_multipart</varname></term>
57144 <listitem>
57145 <para>
57146 This variable has the value 1 (true) when the current part has the main type
57147 <quote>multipart</quote>, for example <quote>multipart/alternative</quote> or <quote>multipart/mixed</quote>.
57148 Since multipart entities only serve as containers for other parts, you may not
57149 want to carry out specific actions on them.
57150 </para>
57151 </listitem></varlistentry>
57152 <varlistentry>
57153 <term><varname>$mime_is_rfc822</varname></term>
57154 <listitem>
57155 <para>
57156 This variable has the value 1 (true) if the current part is not a part of the
57157 checked message itself, but part of an attached message. Attached message
57158 decoding is fully recursive.
57159 </para>
57160 </listitem></varlistentry>
57161 <varlistentry>
57162 <term><varname>$mime_part_count</varname></term>
57163 <listitem>
57164 <para>
57165 This variable is a counter that is raised for each processed MIME part. It
57166 starts at zero for the very first part (which is usually a multipart). The
57167 counter is per-message, so it is reset when processing RFC822 attachments (see
57168 <varname>$mime_is_rfc822</varname>). The counter stays set after <option>acl_smtp_mime</option> is
57169 complete, so you can use it in the DATA ACL to determine the number of MIME
57170 parts of a message. For non-MIME messages, this variable contains the value -1.
57171 </para>
57172 </listitem></varlistentry>
57173 </variablelist>
57174 </section>
57175 <section id="SECTscanregex">
57176 <title>Scanning with regular expressions</title>
57177 <para>
57178 <indexterm role="concept">
57179 <primary>content scanning</primary>
57180 <secondary>with regular expressions</secondary>
57181 </indexterm>
57182 <indexterm role="concept">
57183 <primary>regular expressions</primary>
57184 <secondary>content scanning with</secondary>
57185 </indexterm>
57186 You can specify your own custom regular expression matches on the full body of
57187 the message, or on individual MIME parts.
57188 </para>
57189 <para>
57190 The <option>regex</option> condition takes one or more regular expressions as arguments and
57191 matches them against the full message (when called in the DATA ACL) or a raw
57192 MIME part (when called in the MIME ACL). The <option>regex</option> condition matches
57193 linewise, with a maximum line length of 32K characters. That means you cannot
57194 have multiline matches with the <option>regex</option> condition.
57195 </para>
57196 <para>
57197 The <option>mime_regex</option> condition can be called only in the MIME ACL. It matches up
57198 to 32K of decoded content (the whole content at once, not linewise). If the
57199 part has not been decoded with the <option>decode</option> modifier earlier in the ACL, it
57200 is decoded automatically when <option>mime_regex</option> is executed (using default path
57201 and filename values). If the decoded data is larger than  32K, only the first
57202 32K characters are checked.
57203 </para>
57204 <para>
57205 The regular expressions are passed as a colon-separated list. To include a
57206 literal colon, you must double it. Since the whole right-hand side string is
57207 expanded before being used, you must also escape dollar signs and backslashes
57208 with more backslashes, or use the <literal>\N</literal> facility to disable expansion.
57209 Here is a simple example that contains two regular expressions:
57210 </para>
57211 <literallayout class="monospaced">
57212 deny message = contains blacklisted regex ($regex_match_string)
57213      regex = [Mm]ortgage : URGENT BUSINESS PROPOSAL
57214 </literallayout>
57215 <para>
57216 The conditions returns true if any one of the regular expressions matches. The
57217 <varname>$regex_match_string</varname> expansion variable is then set up and contains the
57218 matching regular expression.
57219 </para>
57220 <para>
57221 <emphasis role="bold">Warning</emphasis>: With large messages, these conditions can be fairly
57222 CPU-intensive.
57223 </para>
57224 </section>
57225 <section id="SECTdemimecond">
57226 <title>The demime condition</title>
57227 <para>
57228 <indexterm role="concept">
57229 <primary>content scanning</primary>
57230 <secondary>MIME checking</secondary>
57231 </indexterm>
57232 <indexterm role="concept">
57233 <primary>MIME content scanning</primary>
57234 </indexterm>
57235 The <option>demime</option> ACL condition provides MIME unpacking, sanity checking and file
57236 extension blocking. It is usable only in the DATA and non-SMTP ACLs. The
57237 <option>demime</option> condition uses a simpler interface to MIME decoding than the MIME
57238 ACL functionality, but provides no additional facilities. Please note that this
57239 condition is deprecated and kept only for backward compatibility. You must set
57240 the WITH_OLD_DEMIME option in <filename>Local/Makefile</filename> at build time to be able to
57241 use the <option>demime</option> condition.
57242 </para>
57243 <para>
57244 The <option>demime</option> condition unpacks MIME containers in the message. It detects
57245 errors in MIME containers and can match file extensions found in the message
57246 against a list. Using this facility produces files containing the unpacked MIME
57247 parts of the message in the temporary scan directory. If you do antivirus
57248 scanning, it is recommended that you use the <option>demime</option> condition before the
57249 antivirus (<option>malware</option>) condition.
57250 </para>
57251 <para>
57252 On the right-hand side of the <option>demime</option> condition you can pass a
57253 colon-separated list of file extensions that it should match against. For
57254 example:
57255 </para>
57256 <literallayout class="monospaced">
57257 deny message = Found blacklisted file attachment
57258      demime  = vbs:com:bat:pif:prf:lnk
57259 </literallayout>
57260 <para>
57261 If one of the file extensions is found, the condition is true, otherwise it is
57262 false. If there is a temporary error while demimeing (for example, <quote>disk
57263 full</quote>), the condition defers, and the message is temporarily rejected (unless
57264 the condition is on a <option>warn</option> verb).
57265 </para>
57266 <para>
57267 The right-hand side is expanded before being treated as a list, so you can have
57268 conditions and lookups there. If it expands to an empty string, <quote>false</quote>, or
57269 zero (<quote>0</quote>), no demimeing is done and the condition is false.
57270 </para>
57271 <para>
57272 The <option>demime</option> condition set the following variables:
57273 </para>
57274 <variablelist>
57275 <varlistentry>
57276 <term><varname>$demime_errorlevel</varname></term>
57277 <listitem>
57278 <para>
57279 <indexterm role="variable">
57280 <primary><varname>$demime_errorlevel</varname></primary>
57281 </indexterm>
57282 When an error is detected in a MIME container, this variable contains the
57283 severity of the error, as an integer number. The higher the value, the more
57284 severe the error (the current maximum value is 3). If this variable is unset or
57285 zero, no error occurred.
57286 </para>
57287 </listitem></varlistentry>
57288 <varlistentry>
57289 <term><varname>$demime_reason</varname></term>
57290 <listitem>
57291 <para>
57292 <indexterm role="variable">
57293 <primary><varname>$demime_reason</varname></primary>
57294 </indexterm>
57295 When <varname>$demime_errorlevel</varname> is greater than zero, this variable contains a
57296 human-readable text string describing the MIME error that occurred.
57297 </para>
57298 </listitem></varlistentry>
57299 </variablelist>
57300 <variablelist>
57301 <varlistentry>
57302 <term><varname>$found_extension</varname></term>
57303 <listitem>
57304 <para>
57305 <indexterm role="variable">
57306 <primary><varname>$found_extension</varname></primary>
57307 </indexterm>
57308 When the <option>demime</option> condition is true, this variable contains the file
57309 extension it found.
57310 </para>
57311 </listitem></varlistentry>
57312 </variablelist>
57313 <para>
57314 Both <varname>$demime_errorlevel</varname> and <varname>$demime_reason</varname> are set by the first call of
57315 the <option>demime</option> condition, and are not changed on subsequent calls.
57316 </para>
57317 <para>
57318 If you do not want to check for file extensions, but rather use the <option>demime</option>
57319 condition for unpacking or error checking purposes, pass <quote>*</quote> as the
57320 right-hand side value. Here is a more elaborate example of how to use this
57321 facility:
57322 </para>
57323 <literallayout class="monospaced">
57324 # Reject messages with serious MIME container errors
57325 deny  message = Found MIME error ($demime_reason).
57326       demime = *
57327       condition = ${if &gt;{$demime_errorlevel}{2}{1}{0}}
57328
57329 # Reject known virus spreading file extensions.
57330 # Accepting these is pretty much braindead.
57331 deny  message = contains $found_extension file (blacklisted).
57332       demime  = com:vbs:bat:pif:scr
57333
57334 # Freeze .exe and .doc files. Postmaster can
57335 # examine them and eventually thaw them.
57336 deny  log_message = Another $found_extension file.
57337       demime = exe:doc
57338       control = freeze
57339 </literallayout>
57340 <para>
57341 <indexterm role="concept" startref="IIDcosca" class="endofrange"/>
57342 </para>
57343 </section>
57344 </chapter>
57345
57346 <chapter id="CHAPlocalscan">
57347 <title>Adding a local scan function to Exim</title>
57348 <titleabbrev>Local scan function</titleabbrev>
57349 <para>
57350 <indexterm role="concept" id="IIDlosca" class="startofrange">
57351 <primary><function>local_scan()</function> function</primary>
57352 <secondary>description of</secondary>
57353 </indexterm>
57354 <indexterm role="concept">
57355 <primary>customizing</primary>
57356 <secondary>input scan using C function</secondary>
57357 </indexterm>
57358 <indexterm role="concept">
57359 <primary>policy control</primary>
57360 <secondary>by local scan function</secondary>
57361 </indexterm>
57362 In these days of email worms, viruses, and ever-increasing spam, some sites
57363 want to apply a lot of checking to messages before accepting them.
57364 </para>
57365 <para>
57366 The content scanning extension (chapter <xref linkend="CHAPexiscan"/>) has facilities for
57367 passing messages to external virus and spam scanning software. You can also do
57368 a certain amount in Exim itself through string expansions and the <option>condition</option>
57369 condition in the ACL that runs after the SMTP DATA command or the ACL for
57370 non-SMTP messages (see chapter <xref linkend="CHAPACL"/>), but this has its limitations.
57371 </para>
57372 <para>
57373 To allow for further customization to a site&#x2019;s own requirements, there is the
57374 possibility of linking Exim with a private message scanning function, written
57375 in C. If you want to run code that is written in something other than C, you
57376 can of course use a little C stub to call it.
57377 </para>
57378 <para>
57379 The local scan function is run once for every incoming message, at the point
57380 when Exim is just about to accept the message.
57381 It can therefore be used to control non-SMTP messages from local processes as
57382 well as messages arriving via SMTP.
57383 </para>
57384 <para>
57385 Exim applies a timeout to calls of the local scan function, and there is an
57386 option called <option>local_scan_timeout</option> for setting it. The default is 5 minutes.
57387 Zero means <quote>no timeout</quote>.
57388 Exim also sets up signal handlers for SIGSEGV, SIGILL, SIGFPE, and SIGBUS
57389 before calling the local scan function, so that the most common types of crash
57390 are caught. If the timeout is exceeded or one of those signals is caught, the
57391 incoming message is rejected with a temporary error if it is an SMTP message.
57392 For a non-SMTP message, the message is dropped and Exim ends with a non-zero
57393 code. The incident is logged on the main and reject logs.
57394 </para>
57395 <section id="SECID207">
57396 <title>Building Exim to use a local scan function</title>
57397 <para>
57398 <indexterm role="concept">
57399 <primary><function>local_scan()</function> function</primary>
57400 <secondary>building Exim to use</secondary>
57401 </indexterm>
57402 To make use of the local scan function feature, you must tell Exim where your
57403 function is before building Exim, by setting LOCAL_SCAN_SOURCE in your
57404 <filename>Local/Makefile</filename>. A recommended place to put it is in the <filename>Local</filename>
57405 directory, so you might set
57406 </para>
57407 <literallayout class="monospaced">
57408 LOCAL_SCAN_SOURCE=Local/local_scan.c
57409 </literallayout>
57410 <para>
57411 for example. The function must be called <function>local_scan()</function>. It is called by
57412 Exim after it has received a message, when the success return code is about to
57413 be sent. This is after all the ACLs have been run. The return code from your
57414 function controls whether the message is actually accepted or not. There is a
57415 commented template function (that just accepts the message) in the file
57416 _src/local_scan.c_.
57417 </para>
57418 <para>
57419 If you want to make use of Exim&#x2019;s run time configuration file to set options
57420 for your <function>local_scan()</function> function, you must also set
57421 </para>
57422 <literallayout class="monospaced">
57423 LOCAL_SCAN_HAS_OPTIONS=yes
57424 </literallayout>
57425 <para>
57426 in <filename>Local/Makefile</filename> (see section <xref linkend="SECTconoptloc"/> below).
57427 </para>
57428 </section>
57429 <section id="SECTapiforloc">
57430 <title>API for local_scan()</title>
57431 <para>
57432 <indexterm role="concept">
57433 <primary><function>local_scan()</function> function</primary>
57434 <secondary>API description</secondary>
57435 </indexterm>
57436 You must include this line near the start of your code:
57437 </para>
57438 <literallayout class="monospaced">
57439 #include "local_scan.h"
57440 </literallayout>
57441 <para>
57442 This header file defines a number of variables and other values, and the
57443 prototype for the function itself. Exim is coded to use unsigned char values
57444 almost exclusively, and one of the things this header defines is a shorthand
57445 for <literal>unsigned char</literal> called <literal>uschar</literal>.
57446 It also contains the following macro definitions, to simplify casting character
57447 strings and pointers to character strings:
57448 </para>
57449 <literallayout class="monospaced">
57450 #define CS   (char *)
57451 #define CCS  (const char *)
57452 #define CSS  (char **)
57453 #define US   (unsigned char *)
57454 #define CUS  (const unsigned char *)
57455 #define USS  (unsigned char **)
57456 </literallayout>
57457 <para>
57458 The function prototype for <function>local_scan()</function> is:
57459 </para>
57460 <literallayout class="monospaced">
57461 extern int local_scan(int fd, uschar **return_text);
57462 </literallayout>
57463 <para>
57464 The arguments are as follows:
57465 </para>
57466 <itemizedlist>
57467 <listitem>
57468 <para>
57469 <option>fd</option> is a file descriptor for the file that contains the body of the message
57470 (the -D file). The file is open for reading and writing, but updating it is not
57471 recommended. <emphasis role="bold">Warning</emphasis>: You must <emphasis>not</emphasis> close this file descriptor.
57472 </para>
57473 <para>
57474 The descriptor is positioned at character 19 of the file, which is the first
57475 character of the body itself, because the first 19 characters are the message
57476 id followed by <literal>-D</literal> and a newline. If you rewind the file, you should use the
57477 macro SPOOL_DATA_START_OFFSET to reset to the start of the data, just in
57478 case this changes in some future version.
57479 </para>
57480 </listitem>
57481 <listitem>
57482 <para>
57483 <option>return_text</option> is an address which you can use to return a pointer to a text
57484 string at the end of the function. The value it points to on entry is NULL.
57485 </para>
57486 </listitem>
57487 </itemizedlist>
57488 <para>
57489 The function must return an <option>int</option> value which is one of the following macros:
57490 </para>
57491 <variablelist>
57492 <varlistentry>
57493 <term><literal>LOCAL_SCAN_ACCEPT</literal></term>
57494 <listitem>
57495 <para>
57496 <indexterm role="variable">
57497 <primary><varname>$local_scan_data</varname></primary>
57498 </indexterm>
57499 The message is accepted. If you pass back a string of text, it is saved with
57500 the message, and made available in the variable <varname>$local_scan_data</varname>. No
57501 newlines are permitted (if there are any, they are turned into spaces) and the
57502 maximum length of text is 1000 characters.
57503 </para>
57504 </listitem></varlistentry>
57505 <varlistentry>
57506 <term><literal>LOCAL_SCAN_ACCEPT_FREEZE</literal></term>
57507 <listitem>
57508 <para>
57509 This behaves as LOCAL_SCAN_ACCEPT, except that the accepted message is
57510 queued without immediate delivery, and is frozen.
57511 </para>
57512 </listitem></varlistentry>
57513 <varlistentry>
57514 <term><literal>LOCAL_SCAN_ACCEPT_QUEUE</literal></term>
57515 <listitem>
57516 <para>
57517 This behaves as LOCAL_SCAN_ACCEPT, except that the accepted message is
57518 queued without immediate delivery.
57519 </para>
57520 </listitem></varlistentry>
57521 <varlistentry>
57522 <term><literal>LOCAL_SCAN_REJECT</literal></term>
57523 <listitem>
57524 <para>
57525 The message is rejected; the returned text is used as an error message which is
57526 passed back to the sender and which is also logged. Newlines are permitted &ndash;
57527 they cause a multiline response for SMTP rejections, but are converted to
57528 <literal>\n</literal> in log lines. If no message is given, <quote>Administrative prohibition</quote> is
57529 used.
57530 </para>
57531 </listitem></varlistentry>
57532 <varlistentry>
57533 <term><literal>LOCAL_SCAN_TEMPREJECT</literal></term>
57534 <listitem>
57535 <para>
57536 The message is temporarily rejected; the returned text is used as an error
57537 message as for LOCAL_SCAN_REJECT. If no message is given, <quote>Temporary local
57538 problem</quote> is used.
57539 </para>
57540 </listitem></varlistentry>
57541 <varlistentry>
57542 <term><literal>LOCAL_SCAN_REJECT_NOLOGHDR</literal></term>
57543 <listitem>
57544 <para>
57545 This behaves as LOCAL_SCAN_REJECT, except that the header of the rejected
57546 message is not written to the reject log. It has the effect of unsetting the
57547 <option>rejected_header</option> log selector for just this rejection. If
57548 <option>rejected_header</option> is already unset (see the discussion of the
57549 <option>log_selection</option> option in section <xref linkend="SECTlogselector"/>), this code is the
57550 same as LOCAL_SCAN_REJECT.
57551 </para>
57552 </listitem></varlistentry>
57553 <varlistentry>
57554 <term><literal>LOCAL_SCAN_TEMPREJECT_NOLOGHDR</literal></term>
57555 <listitem>
57556 <para>
57557 This code is a variation of LOCAL_SCAN_TEMPREJECT in the same way that
57558 LOCAL_SCAN_REJECT_NOLOGHDR is a variation of LOCAL_SCAN_REJECT.
57559 </para>
57560 </listitem></varlistentry>
57561 </variablelist>
57562 <para>
57563 If the message is not being received by interactive SMTP, rejections are
57564 reported by writing to <option>stderr</option> or by sending an email, as configured by the
57565 <option>-oe</option> command line options.
57566 </para>
57567 </section>
57568 <section id="SECTconoptloc">
57569 <title>Configuration options for local_scan()</title>
57570 <para>
57571 <indexterm role="concept">
57572 <primary><function>local_scan()</function> function</primary>
57573 <secondary>configuration options</secondary>
57574 </indexterm>
57575 It is possible to have option settings in the main configuration file
57576 that set values in static variables in the <function>local_scan()</function> module. If you
57577 want to do this, you must have the line
57578 </para>
57579 <literallayout class="monospaced">
57580 LOCAL_SCAN_HAS_OPTIONS=yes
57581 </literallayout>
57582 <para>
57583 in your <filename>Local/Makefile</filename> when you build Exim. (This line is in
57584 <filename>OS/Makefile-Default</filename>, commented out). Then, in the <function>local_scan()</function> source
57585 file, you must define static variables to hold the option values, and a table
57586 to define them.
57587 </para>
57588 <para>
57589 The table must be a vector called <option>local_scan_options</option>, of type
57590 <literal>optionlist</literal>. Each entry is a triplet, consisting of a name, an option type,
57591 and a pointer to the variable that holds the value. The entries must appear in
57592 alphabetical order. Following <option>local_scan_options</option> you must also define a
57593 variable called <option>local_scan_options_count</option> that contains the number of
57594 entries in the table. Here is a short example, showing two kinds of option:
57595 </para>
57596 <literallayout class="monospaced">
57597 static int my_integer_option = 42;
57598 static uschar *my_string_option = US"a default string";
57599
57600 optionlist local_scan_options[] = {
57601   { "my_integer", opt_int,       &amp;my_integer_option },
57602   { "my_string",  opt_stringptr, &amp;my_string_option }
57603 };
57604
57605 int local_scan_options_count =
57606   sizeof(local_scan_options)/sizeof(optionlist);
57607 </literallayout>
57608 <para>
57609 The values of the variables can now be changed from Exim&#x2019;s runtime
57610 configuration file by including a local scan section as in this example:
57611 </para>
57612 <literallayout class="monospaced">
57613 begin local_scan
57614 my_integer = 99
57615 my_string = some string of text...
57616 </literallayout>
57617 <para>
57618 The available types of option data are as follows:
57619 </para>
57620 <variablelist>
57621 <varlistentry>
57622 <term><emphasis role="bold">opt_bool</emphasis></term>
57623 <listitem>
57624 <para>
57625 This specifies a boolean (true/false) option. The address should point to a
57626 variable of type <literal>BOOL</literal>, which will be set to TRUE or FALSE, which are macros
57627 that are defined as <quote>1</quote> and <quote>0</quote>, respectively. If you want to detect
57628 whether such a variable has been set at all, you can initialize it to
57629 TRUE_UNSET. (BOOL variables are integers underneath, so can hold more than two
57630 values.)
57631 </para>
57632 </listitem></varlistentry>
57633 <varlistentry>
57634 <term><emphasis role="bold">opt_fixed</emphasis></term>
57635 <listitem>
57636 <para>
57637 This specifies a fixed point number, such as is used for load averages.
57638 The address should point to a variable of type <literal>int</literal>. The value is stored
57639 multiplied by 1000, so, for example, 1.4142 is truncated and stored as 1414.
57640 </para>
57641 </listitem></varlistentry>
57642 <varlistentry>
57643 <term><emphasis role="bold">opt_int</emphasis></term>
57644 <listitem>
57645 <para>
57646 This specifies an integer; the address should point to a variable of type
57647 <literal>int</literal>. The value may be specified in any of the integer formats accepted by
57648 Exim.
57649 </para>
57650 </listitem></varlistentry>
57651 <varlistentry>
57652 <term><emphasis role="bold">opt_mkint</emphasis></term>
57653 <listitem>
57654 <para>
57655 This is the same as <option>opt_int</option>, except that when such a value is output in a
57656 <option>-bP</option> listing, if it is an exact number of kilobytes or megabytes, it is
57657 printed with the suffix K or M.
57658 </para>
57659 </listitem></varlistentry>
57660 <varlistentry>
57661 <term><emphasis role="bold">opt_octint</emphasis></term>
57662 <listitem>
57663 <para>
57664 This also specifies an integer, but the value is always interpreted as an
57665 octal integer, whether or not it starts with the digit zero, and it is
57666 always output in octal.
57667 </para>
57668 </listitem></varlistentry>
57669 <varlistentry>
57670 <term><emphasis role="bold">opt_stringptr</emphasis></term>
57671 <listitem>
57672 <para>
57673 This specifies a string value; the address must be a pointer to a
57674 variable that points to a string (for example, of type <literal>uschar *</literal>).
57675 </para>
57676 </listitem></varlistentry>
57677 <varlistentry>
57678 <term><emphasis role="bold">opt_time</emphasis></term>
57679 <listitem>
57680 <para>
57681 This specifies a time interval value. The address must point to a variable of
57682 type <literal>int</literal>. The value that is placed there is a number of seconds.
57683 </para>
57684 </listitem></varlistentry>
57685 </variablelist>
57686 <para>
57687 If the <option>-bP</option> command line option is followed by <literal>local_scan</literal>, Exim prints
57688 out the values of all the <function>local_scan()</function> options.
57689 </para>
57690 </section>
57691 <section id="SECID208">
57692 <title>Available Exim variables</title>
57693 <para>
57694 <indexterm role="concept">
57695 <primary><function>local_scan()</function> function</primary>
57696 <secondary>available Exim variables</secondary>
57697 </indexterm>
57698 The header <filename>local_scan.h</filename> gives you access to a number of C variables. These
57699 are the only ones that are guaranteed to be maintained from release to release.
57700 Note, however, that you can obtain the value of any Exim expansion variable,
57701 including <varname>$recipients</varname>, by calling <emphasis>expand_string()</emphasis>. The exported
57702 C variables are as follows:
57703 </para>
57704 <variablelist>
57705 <varlistentry>
57706 <term><emphasis role="bold">int&nbsp;body_linecount</emphasis></term>
57707 <listitem>
57708 <para>
57709 This variable contains the number of lines in the message&#x2019;s body.
57710 </para>
57711 </listitem></varlistentry>
57712 <varlistentry>
57713 <term><emphasis role="bold">int&nbsp;body_zerocount</emphasis></term>
57714 <listitem>
57715 <para>
57716 This variable contains the number of binary zero bytes in the message&#x2019;s body.
57717 </para>
57718 </listitem></varlistentry>
57719 <varlistentry>
57720 <term><emphasis role="bold">unsigned&nbsp;int&nbsp;debug_selector</emphasis></term>
57721 <listitem>
57722 <para>
57723 This variable is set to zero when no debugging is taking place. Otherwise, it
57724 is a bitmap of debugging selectors. Two bits are identified for use in
57725 <function>local_scan()</function>; they are defined as macros:
57726 </para>
57727 <itemizedlist>
57728 <listitem>
57729 <para>
57730 The <literal>D_v</literal> bit is set when <option>-v</option> was present on the command line. This is a
57731 testing option that is not privileged &ndash; any caller may set it. All the
57732 other selector bits can be set only by admin users.
57733 </para>
57734 </listitem>
57735 <listitem>
57736 <para>
57737 The <literal>D_local_scan</literal> bit is provided for use by <function>local_scan()</function>; it is set
57738 by the <literal>+local_scan</literal> debug selector. It is not included in the default set
57739 of debugging bits.
57740 </para>
57741 </listitem>
57742 </itemizedlist>
57743 <para>
57744 Thus, to write to the debugging output only when <literal>+local_scan</literal> has been
57745 selected, you should use code like this:
57746 </para>
57747 <literallayout class="monospaced">
57748 if ((debug_selector &amp; D_local_scan) != 0)
57749   debug_printf("xxx", ...);
57750 </literallayout>
57751 </listitem></varlistentry>
57752 <varlistentry>
57753 <term><emphasis role="bold">uschar&nbsp;*expand_string_message</emphasis></term>
57754 <listitem>
57755 <para>
57756 After a failing call to <emphasis>expand_string()</emphasis> (returned value NULL), the
57757 variable <option>expand_string_message</option> contains the error message, zero-terminated.
57758 </para>
57759 </listitem></varlistentry>
57760 <varlistentry>
57761 <term><emphasis role="bold">header_line&nbsp;*header_list</emphasis></term>
57762 <listitem>
57763 <para>
57764 A pointer to a chain of header lines. The <option>header_line</option> structure is
57765 discussed below.
57766 </para>
57767 </listitem></varlistentry>
57768 <varlistentry>
57769 <term><emphasis role="bold">header_line&nbsp;*header_last</emphasis></term>
57770 <listitem>
57771 <para>
57772 A pointer to the last of the header lines.
57773 </para>
57774 </listitem></varlistentry>
57775 <varlistentry>
57776 <term><emphasis role="bold">uschar&nbsp;*headers_charset</emphasis></term>
57777 <listitem>
57778 <para>
57779 The value of the <option>headers_charset</option> configuration option.
57780 </para>
57781 </listitem></varlistentry>
57782 <varlistentry>
57783 <term><emphasis role="bold">BOOL&nbsp;host_checking</emphasis></term>
57784 <listitem>
57785 <para>
57786 This variable is TRUE during a host checking session that is initiated by the
57787 <option>-bh</option> command line option.
57788 </para>
57789 </listitem></varlistentry>
57790 <varlistentry>
57791 <term><emphasis role="bold">uschar&nbsp;*interface_address</emphasis></term>
57792 <listitem>
57793 <para>
57794 The IP address of the interface that received the message, as a string. This
57795 is NULL for locally submitted messages.
57796 </para>
57797 </listitem></varlistentry>
57798 <varlistentry>
57799 <term><emphasis role="bold">int&nbsp;interface_port</emphasis></term>
57800 <listitem>
57801 <para>
57802 The port on which this message was received. When testing with the <option>-bh</option>
57803 command line option, the value of this variable is -1 unless a port has been
57804 specified via the <option>-oMi</option> option.
57805 </para>
57806 </listitem></varlistentry>
57807 <varlistentry>
57808 <term><emphasis role="bold">uschar&nbsp;*message_id</emphasis></term>
57809 <listitem>
57810 <para>
57811 This variable contains Exim&#x2019;s message id for the incoming message (the value of
57812 <varname>$message_exim_id</varname>) as a zero-terminated string.
57813 </para>
57814 </listitem></varlistentry>
57815 <varlistentry>
57816 <term><emphasis role="bold">uschar&nbsp;*received_protocol</emphasis></term>
57817 <listitem>
57818 <para>
57819 The name of the protocol by which the message was received.
57820 </para>
57821 </listitem></varlistentry>
57822 <varlistentry>
57823 <term><emphasis role="bold">int&nbsp;recipients_count</emphasis></term>
57824 <listitem>
57825 <para>
57826 The number of accepted recipients.
57827 </para>
57828 </listitem></varlistentry>
57829 <varlistentry>
57830 <term><emphasis role="bold">recipient_item&nbsp;*recipients_list</emphasis></term>
57831 <listitem>
57832 <para>
57833 <indexterm role="concept">
57834 <primary>recipient</primary>
57835 <secondary>adding in local scan</secondary>
57836 </indexterm>
57837 <indexterm role="concept">
57838 <primary>recipient</primary>
57839 <secondary>removing in local scan</secondary>
57840 </indexterm>
57841 The list of accepted recipients, held in a vector of length
57842 <option>recipients_count</option>. The <option>recipient_item</option> structure is discussed below. You
57843 can add additional recipients by calling <emphasis>receive_add_recipient()</emphasis> (see
57844 below). You can delete recipients by removing them from the vector and
57845 adjusting the value in <option>recipients_count</option>. In particular, by setting
57846 <option>recipients_count</option> to zero you remove all recipients. If you then return the
57847 value <literal>LOCAL_SCAN_ACCEPT</literal>, the message is accepted, but immediately
57848 blackholed. To replace the recipients, you can set <option>recipients_count</option> to zero
57849 and then call <emphasis>receive_add_recipient()</emphasis> as often as needed.
57850 </para>
57851 </listitem></varlistentry>
57852 <varlistentry>
57853 <term><emphasis role="bold">uschar&nbsp;*sender_address</emphasis></term>
57854 <listitem>
57855 <para>
57856 The envelope sender address. For bounce messages this is the empty string.
57857 </para>
57858 </listitem></varlistentry>
57859 <varlistentry>
57860 <term><emphasis role="bold">uschar&nbsp;*sender_host_address</emphasis></term>
57861 <listitem>
57862 <para>
57863 The IP address of the sending host, as a string. This is NULL for
57864 locally-submitted messages.
57865 </para>
57866 </listitem></varlistentry>
57867 <varlistentry>
57868 <term><emphasis role="bold">uschar&nbsp;*sender_host_authenticated</emphasis></term>
57869 <listitem>
57870 <para>
57871 The name of the authentication mechanism that was used, or NULL if the message
57872 was not received over an authenticated SMTP connection.
57873 </para>
57874 </listitem></varlistentry>
57875 <varlistentry>
57876 <term><emphasis role="bold">uschar&nbsp;*sender_host_name</emphasis></term>
57877 <listitem>
57878 <para>
57879 The name of the sending host, if known.
57880 </para>
57881 </listitem></varlistentry>
57882 <varlistentry>
57883 <term><emphasis role="bold">int&nbsp;sender_host_port</emphasis></term>
57884 <listitem>
57885 <para>
57886 The port on the sending host.
57887 </para>
57888 </listitem></varlistentry>
57889 <varlistentry>
57890 <term><emphasis role="bold">BOOL&nbsp;smtp_input</emphasis></term>
57891 <listitem>
57892 <para>
57893 This variable is TRUE for all SMTP input, including BSMTP.
57894 </para>
57895 </listitem></varlistentry>
57896 <varlistentry>
57897 <term><emphasis role="bold">BOOL&nbsp;smtp_batched_input</emphasis></term>
57898 <listitem>
57899 <para>
57900 This variable is TRUE for BSMTP input.
57901 </para>
57902 </listitem></varlistentry>
57903 <varlistentry>
57904 <term><emphasis role="bold">int&nbsp;store_pool</emphasis></term>
57905 <listitem>
57906 <para>
57907 The contents of this variable control which pool of memory is used for new
57908 requests. See section <xref linkend="SECTmemhanloc"/> for details.
57909 </para>
57910 </listitem></varlistentry>
57911 </variablelist>
57912 </section>
57913 <section id="SECID209">
57914 <title>Structure of header lines</title>
57915 <para>
57916 The <option>header_line</option> structure contains the members listed below.
57917 You can add additional header lines by calling the <emphasis>header_add()</emphasis> function
57918 (see below). You can cause header lines to be ignored (deleted) by setting
57919 their type to *.
57920 </para>
57921 <variablelist>
57922 <varlistentry>
57923 <term><emphasis role="bold">struct&nbsp;header_line&nbsp;*next</emphasis></term>
57924 <listitem>
57925 <para>
57926 A pointer to the next header line, or NULL for the last line.
57927 </para>
57928 </listitem></varlistentry>
57929 <varlistentry>
57930 <term><emphasis role="bold">int&nbsp;type</emphasis></term>
57931 <listitem>
57932 <para>
57933 A code identifying certain headers that Exim recognizes. The codes are printing
57934 characters, and are documented in chapter <xref linkend="CHAPspool"/> of this manual.
57935 Notice in particular that any header line whose type is * is not transmitted
57936 with the message. This flagging is used for header lines that have been
57937 rewritten, or are to be removed (for example, <emphasis>Envelope-sender:</emphasis> header
57938 lines.) Effectively, * means <quote>deleted</quote>.
57939 </para>
57940 </listitem></varlistentry>
57941 <varlistentry>
57942 <term><emphasis role="bold">int&nbsp;slen</emphasis></term>
57943 <listitem>
57944 <para>
57945 The number of characters in the header line, including the terminating and any
57946 internal newlines.
57947 </para>
57948 </listitem></varlistentry>
57949 <varlistentry>
57950 <term><emphasis role="bold">uschar&nbsp;*text</emphasis></term>
57951 <listitem>
57952 <para>
57953 A pointer to the text of the header. It always ends with a newline, followed by
57954 a zero byte. Internal newlines are preserved.
57955 </para>
57956 </listitem></varlistentry>
57957 </variablelist>
57958 </section>
57959 <section id="SECID210">
57960 <title>Structure of recipient items</title>
57961 <para>
57962 The <option>recipient_item</option> structure contains these members:
57963 </para>
57964 <variablelist>
57965 <varlistentry>
57966 <term><emphasis role="bold">uschar&nbsp;*address</emphasis></term>
57967 <listitem>
57968 <para>
57969 This is a pointer to the recipient address as it was received.
57970 </para>
57971 </listitem></varlistentry>
57972 <varlistentry>
57973 <term><emphasis role="bold">int&nbsp;pno</emphasis></term>
57974 <listitem>
57975 <para>
57976 This is used in later Exim processing when top level addresses are created by
57977 the <option>one_time</option> option. It is not relevant at the time <function>local_scan()</function> is run
57978 and must always contain -1 at this stage.
57979 </para>
57980 </listitem></varlistentry>
57981 <varlistentry>
57982 <term><emphasis role="bold">uschar&nbsp;*errors_to</emphasis></term>
57983 <listitem>
57984 <para>
57985 If this value is not NULL, bounce messages caused by failing to deliver to the
57986 recipient are sent to the address it contains. In other words, it overrides the
57987 envelope sender for this one recipient. (Compare the <option>errors_to</option> generic
57988 router option.) If a <function>local_scan()</function> function sets an <option>errors_to</option> field to
57989 an unqualified address, Exim qualifies it using the domain from
57990 <option>qualify_recipient</option>. When <function>local_scan()</function> is called, the <option>errors_to</option> field
57991 is NULL for all recipients.
57992 </para>
57993 </listitem></varlistentry>
57994 </variablelist>
57995 </section>
57996 <section id="SECID211">
57997 <title>Available Exim functions</title>
57998 <para>
57999 <indexterm role="concept">
58000 <primary><function>local_scan()</function> function</primary>
58001 <secondary>available Exim functions</secondary>
58002 </indexterm>
58003 The header <filename>local_scan.h</filename> gives you access to a number of Exim functions.
58004 These are the only ones that are guaranteed to be maintained from release to
58005 release:
58006 </para>
58007 <variablelist>
58008 <varlistentry>
58009 <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>
58010 <listitem>
58011 <para>
58012 This function creates a child process that runs the command specified by
58013 <option>argv</option>. The environment for the process is specified by <option>envp</option>, which can
58014 be NULL if no environment variables are to be passed. A new umask is supplied
58015 for the process in <option>newumask</option>.
58016 </para>
58017 <para>
58018 Pipes to the standard input and output of the new process are set up
58019 and returned to the caller via the <option>infdptr</option> and <option>outfdptr</option> arguments. The
58020 standard error is cloned to the standard output. If there are any file
58021 descriptors <quote>in the way</quote> in the new process, they are closed. If the final
58022 argument is TRUE, the new process is made into a process group leader.
58023 </para>
58024 <para>
58025 The function returns the pid of the new process, or -1 if things go wrong.
58026 </para>
58027 </listitem></varlistentry>
58028 <varlistentry>
58029 <term><emphasis role="bold">int&nbsp;child_close(pid_t&nbsp;pid,&nbsp;int&nbsp;timeout)</emphasis></term>
58030 <listitem>
58031 <para>
58032 This function waits for a child process to terminate, or for a timeout (in
58033 seconds) to expire. A timeout value of zero means wait as long as it takes. The
58034 return value is as follows:
58035 </para>
58036 <itemizedlist>
58037 <listitem>
58038 <para>
58039 &gt;= 0
58040 </para>
58041 <para>
58042 The process terminated by a normal exit and the value is the process
58043 ending status.
58044 </para>
58045 </listitem>
58046 <listitem>
58047 <para>
58048 &lt; 0 and &gt; &ndash;256
58049 </para>
58050 <para>
58051 The process was terminated by a signal and the value is the negation of the
58052 signal number.
58053 </para>
58054 </listitem>
58055 <listitem>
58056 <para>
58057 &ndash;256
58058 </para>
58059 <para>
58060 The process timed out.
58061 </para>
58062 </listitem>
58063 <listitem>
58064 <para>
58065 &ndash;257
58066 </para>
58067 <para>
58068 The was some other error in wait(); <option>errno</option> is still set.
58069 </para>
58070 </listitem>
58071 </itemizedlist>
58072 </listitem></varlistentry>
58073 <varlistentry>
58074 <term><emphasis role="bold">pid_t&nbsp;child_open_exim(int&nbsp;*fd)</emphasis></term>
58075 <listitem>
58076 <para>
58077 This function provide you with a means of submitting a new message to
58078 Exim. (Of course, you can also call <filename>/usr/sbin/sendmail</filename> yourself if you
58079 want, but this packages it all up for you.) The function creates a pipe,
58080 forks a subprocess that is running
58081 </para>
58082 <literallayout class="monospaced">
58083 exim -t -oem -oi -f &lt;&gt;
58084 </literallayout>
58085 <para>
58086 and returns to you (via the <literal>int *</literal> argument) a file descriptor for the pipe
58087 that is connected to the standard input. The yield of the function is the PID
58088 of the subprocess. You can then write a message to the file descriptor, with
58089 recipients in <emphasis>To:</emphasis>, <emphasis>Cc:</emphasis>, and/or <emphasis>Bcc:</emphasis> header lines.
58090 </para>
58091 <para>
58092 When you have finished, call <emphasis>child_close()</emphasis> to wait for the process to
58093 finish and to collect its ending status. A timeout value of zero is usually
58094 fine in this circumstance. Unless you have made a mistake with the recipient
58095 addresses, you should get a return code of zero.
58096 </para>
58097 </listitem></varlistentry>
58098 <varlistentry>
58099 <term><emphasis role="bold">pid_t&nbsp;child_open_exim2(int&nbsp;*fd,&nbsp;uschar&nbsp;*sender,&nbsp;uschar&nbsp;*sender_authentication)</emphasis></term>
58100 <listitem>
58101 <para>
58102 This function is a more sophisticated version of <emphasis>child_open()</emphasis>. The command
58103 that it runs is:
58104 </para>
58105 <literallayout>
58106 <literal>exim -t -oem -oi -f </literal><emphasis>sender</emphasis><literal> -oMas </literal><emphasis>sender_authentication</emphasis>
58107 </literallayout>
58108 <para>
58109 The third argument may be NULL, in which case the <option>-oMas</option> option is omitted.
58110 </para>
58111 </listitem></varlistentry>
58112 <varlistentry>
58113 <term><emphasis role="bold">void&nbsp;debug_printf(char&nbsp;*,&nbsp;...)</emphasis></term>
58114 <listitem>
58115 <para>
58116 This is Exim&#x2019;s debugging function, with arguments as for <emphasis>(printf()</emphasis>. The
58117 output is written to the standard error stream. If no debugging is selected,
58118 calls to <emphasis>debug_printf()</emphasis> have no effect. Normally, you should make calls
58119 conditional on the <literal>local_scan</literal> debug selector by coding like this:
58120 </para>
58121 <literallayout class="monospaced">
58122 if ((debug_selector &amp; D_local_scan) != 0)
58123   debug_printf("xxx", ...);
58124 </literallayout>
58125 </listitem></varlistentry>
58126 <varlistentry>
58127 <term><emphasis role="bold">uschar&nbsp;*expand_string(uschar&nbsp;*string)</emphasis></term>
58128 <listitem>
58129 <para>
58130 This is an interface to Exim&#x2019;s string expansion code. The return value is the
58131 expanded string, or NULL if there was an expansion failure.
58132 The C variable <option>expand_string_message</option> contains an error message after an
58133 expansion failure. If expansion does not change the string, the return value is
58134 the pointer to the input string. Otherwise, the return value points to a new
58135 block of memory that was obtained by a call to <emphasis>store_get()</emphasis>. See section
58136 <xref linkend="SECTmemhanloc"/> below for a discussion of memory handling.
58137 </para>
58138 </listitem></varlistentry>
58139 <varlistentry>
58140 <term><emphasis role="bold">void&nbsp;header_add(int&nbsp;type,&nbsp;char&nbsp;*format,&nbsp;...)</emphasis></term>
58141 <listitem>
58142 <para>
58143 This function allows you to an add additional header line at the end of the
58144 existing ones. The first argument is the type, and should normally be a space
58145 character. The second argument is a format string and any number of
58146 substitution arguments as for <function>sprintf()</function>. You may include internal newlines
58147 if you want, and you must ensure that the string ends with a newline.
58148 </para>
58149 </listitem></varlistentry>
58150 <varlistentry>
58151 <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>
58152 <listitem>
58153 <para>
58154 This function adds a new header line at a specified point in the header
58155 chain. The header itself is specified as for <emphasis>header_add()</emphasis>.
58156 </para>
58157 <para>
58158 If <option>name</option> is NULL, the new header is added at the end of the chain if
58159 <option>after</option> is true, or at the start if <option>after</option> is false. If <option>name</option> is not
58160 NULL, the header lines are searched for the first non-deleted header that
58161 matches the name. If one is found, the new header is added before it if
58162 <option>after</option> is false. If <option>after</option> is true, the new header is added after the
58163 found header and any adjacent subsequent ones with the same name (even if
58164 marked <quote>deleted</quote>). If no matching non-deleted header is found, the <option>topnot</option>
58165 option controls where the header is added. If it is true, addition is at the
58166 top; otherwise at the bottom. Thus, to add a header after all the <emphasis>Received:</emphasis>
58167 headers, or at the top if there are no <emphasis>Received:</emphasis> headers, you could use
58168 </para>
58169 <literallayout class="monospaced">
58170 header_add_at_position(TRUE, US"Received", TRUE,
58171   ' ', "X-xxx: ...");
58172 </literallayout>
58173 <para>
58174 Normally, there is always at least one non-deleted <emphasis>Received:</emphasis> header, but
58175 there may not be if <option>received_header_text</option> expands to an empty string.
58176 </para>
58177 </listitem></varlistentry>
58178 <varlistentry>
58179 <term><emphasis role="bold">void&nbsp;header_remove(int&nbsp;occurrence,&nbsp;uschar&nbsp;*name)</emphasis></term>
58180 <listitem>
58181 <para>
58182 This function removes header lines. If <option>occurrence</option> is zero or negative, all
58183 occurrences of the header are removed. If occurrence is greater than zero, that
58184 particular instance of the header is removed. If no header(s) can be found that
58185 match the specification, the function does nothing.
58186 </para>
58187 </listitem></varlistentry>
58188 <varlistentry>
58189 <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>
58190 <listitem>
58191 <para>
58192 This function tests whether the given header has the given name. It is not just
58193 a string comparison, because white space is permitted between the name and the
58194 colon. If the <option>notdel</option> argument is true, a false return is forced for all
58195 <quote>deleted</quote> headers; otherwise they are not treated specially. For example:
58196 </para>
58197 <literallayout class="monospaced">
58198 if (header_testname(h, US"X-Spam", 6, TRUE)) ...
58199 </literallayout>
58200 </listitem></varlistentry>
58201 <varlistentry>
58202 <term><emphasis role="bold">uschar&nbsp;*lss_b64encode(uschar&nbsp;*cleartext,&nbsp;int&nbsp;length)</emphasis></term>
58203 <listitem>
58204 <para>
58205 <indexterm role="concept">
58206 <primary>base64 encoding</primary>
58207 <secondary>functions for <function>local_scan()</function> use</secondary>
58208 </indexterm>
58209 This function base64-encodes a string, which is passed by address and length.
58210 The text may contain bytes of any value, including zero. The result is passed
58211 back in dynamic memory that is obtained by calling <emphasis>store_get()</emphasis>. It is
58212 zero-terminated.
58213 </para>
58214 </listitem></varlistentry>
58215 <varlistentry>
58216 <term><emphasis role="bold">int&nbsp;lss_b64decode(uschar&nbsp;*codetext,&nbsp;uschar&nbsp;**cleartext)</emphasis></term>
58217 <listitem>
58218 <para>
58219 This function decodes a base64-encoded string. Its arguments are a
58220 zero-terminated base64-encoded string and the address of a variable that is set
58221 to point to the result, which is in dynamic memory. The length of the decoded
58222 string is the yield of the function. If the input is invalid base64 data, the
58223 yield is -1. A zero byte is added to the end of the output string to make it
58224 easy to interpret as a C string (assuming it contains no zeros of its own). The
58225 added zero byte is not included in the returned count.
58226 </para>
58227 </listitem></varlistentry>
58228 <varlistentry>
58229 <term><emphasis role="bold">int&nbsp;lss_match_domain(uschar&nbsp;*domain,&nbsp;uschar&nbsp;*list)</emphasis></term>
58230 <listitem>
58231 <para>
58232 This function checks for a match in a domain list. Domains are always
58233 matched caselessly. The return value is one of the following:
58234 </para>
58235 <literallayout>
58236 <literal>OK     </literal> match succeeded
58237 <literal>FAIL   </literal> match failed
58238 <literal>DEFER  </literal> match deferred
58239 </literallayout>
58240 <para>
58241 DEFER is usually caused by some kind of lookup defer, such as the
58242 inability to contact a database.
58243 </para>
58244 </listitem></varlistentry>
58245 <varlistentry>
58246 <term><emphasis role="bold">int&nbsp;lss_match_local_part(uschar&nbsp;*localpart,&nbsp;uschar&nbsp;*list,&nbsp;BOOL&nbsp;caseless)</emphasis></term>
58247 <listitem>
58248 <para>
58249 This function checks for a match in a local part list. The third argument
58250 controls case-sensitivity. The return values are as for
58251 <emphasis>lss_match_domain()</emphasis>.
58252 </para>
58253 </listitem></varlistentry>
58254 <varlistentry>
58255 <term><emphasis role="bold">int&nbsp;lss_match_address(uschar&nbsp;*address,&nbsp;uschar&nbsp;*list,&nbsp;BOOL&nbsp;caseless)</emphasis></term>
58256 <listitem>
58257 <para>
58258 This function checks for a match in an address list. The third argument
58259 controls the case-sensitivity of the local part match. The domain is always
58260 matched caselessly. The return values are as for <emphasis>lss_match_domain()</emphasis>.
58261 </para>
58262 </listitem></varlistentry>
58263 <varlistentry>
58264 <term><emphasis role="bold">int&nbsp;lss_match_host(uschar&nbsp;*host_name,&nbsp;uschar&nbsp;*host_address,&nbsp;uschar&nbsp;*list)</emphasis></term>
58265 <listitem>
58266 <para>
58267 This function checks for a match in a host list. The most common usage is
58268 expected to be
58269 </para>
58270 <literallayout class="monospaced">
58271 lss_match_host(sender_host_name, sender_host_address, ...)
58272 </literallayout>
58273 <para>
58274 <indexterm role="variable">
58275 <primary><varname>$sender_host_address</varname></primary>
58276 </indexterm>
58277 An empty address field matches an empty item in the host list. If the host name
58278 is NULL, the name corresponding to <varname>$sender_host_address</varname> is automatically
58279 looked up if a host name is required to match an item in the list. The return
58280 values are as for <emphasis>lss_match_domain()</emphasis>, but in addition, <emphasis>lss_match_host()</emphasis>
58281 returns ERROR in the case when it had to look up a host name, but the lookup
58282 failed.
58283 </para>
58284 </listitem></varlistentry>
58285 <varlistentry>
58286 <term><emphasis role="bold">void&nbsp;log_write(unsigned&nbsp;int&nbsp;selector,&nbsp;int&nbsp;which,&nbsp;char&nbsp;*format,&nbsp;...)</emphasis></term>
58287 <listitem>
58288 <para>
58289 This function writes to Exim&#x2019;s log files. The first argument should be zero (it
58290 is concerned with <option>log_selector</option>). The second argument can be <literal>LOG_MAIN</literal> or
58291 <literal>LOG_REJECT</literal> or <literal>LOG_PANIC</literal> or the inclusive <quote>or</quote> of any combination of
58292 them. It specifies to which log or logs the message is written. The remaining
58293 arguments are a format and relevant insertion arguments. The string should not
58294 contain any newlines, not even at the end.
58295 </para>
58296 </listitem></varlistentry>
58297 <varlistentry>
58298 <term><emphasis role="bold">void&nbsp;receive_add_recipient(uschar&nbsp;*address,&nbsp;int&nbsp;pno)</emphasis></term>
58299 <listitem>
58300 <para>
58301 This function adds an additional recipient to the message. The first argument
58302 is the recipient address. If it is unqualified (has no domain), it is qualified
58303 with the <option>qualify_recipient</option> domain. The second argument must always be -1.
58304 </para>
58305 <para>
58306 This function does not allow you to specify a private <option>errors_to</option> address (as
58307 described with the structure of <option>recipient_item</option> above), because it pre-dates
58308 the addition of that field to the structure. However, it is easy to add such a
58309 value afterwards. For example:
58310 </para>
58311 <literallayout class="monospaced">
58312  receive_add_recipient(US"monitor@mydom.example", -1);
58313  recipients_list[recipients_count-1].errors_to =
58314    US"postmaster@mydom.example";
58315 </literallayout>
58316 </listitem></varlistentry>
58317 <varlistentry>
58318 <term><emphasis role="bold">BOOL&nbsp;receive_remove_recipient(uschar&nbsp;*recipient)</emphasis></term>
58319 <listitem>
58320 <para>
58321 This is a convenience function to remove a named recipient from the list of
58322 recipients. It returns true if a recipient was removed, and false if no
58323 matching recipient could be found. The argument must be a complete email
58324 address.
58325 </para>
58326 </listitem></varlistentry>
58327 </variablelist>
58328 <para>
58329 <indexterm role="concept">
58330 <primary>RFC 2047</primary>
58331 </indexterm>
58332 </para>
58333 <variablelist>
58334 <varlistentry>
58335 <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>
58336 <listitem>
58337 <para>
58338 This function decodes strings that are encoded according to RFC 2047. Typically
58339 these are the contents of header lines. First, each <quote>encoded word</quote> is decoded
58340 from the Q or B encoding into a byte-string. Then, if provided with the name of
58341 a charset encoding, and if the <function>iconv()</function> function is available, an attempt is
58342 made  to translate the result to the named character set. If this fails, the
58343 binary string is returned with an error message.
58344 </para>
58345 <para>
58346 The first argument is the string to be decoded. If <option>lencheck</option> is TRUE, the
58347 maximum MIME word length is enforced. The third argument is the target
58348 encoding, or NULL if no translation is wanted.
58349 </para>
58350 <para>
58351 <indexterm role="concept">
58352 <primary>binary zero</primary>
58353 <secondary>in RFC 2047 decoding</secondary>
58354 </indexterm>
58355 <indexterm role="concept">
58356 <primary>RFC 2047</primary>
58357 <secondary>binary zero in</secondary>
58358 </indexterm>
58359 If a binary zero is encountered in the decoded string, it is replaced by the
58360 contents of the <option>zeroval</option> argument. For use with Exim headers, the value must
58361 not be 0 because header lines are handled as zero-terminated strings.
58362 </para>
58363 <para>
58364 The function returns the result of processing the string, zero-terminated; if
58365 <option>lenptr</option> is not NULL, the length of the result is set in the variable to
58366 which it points. When <option>zeroval</option> is 0, <option>lenptr</option> should not be NULL.
58367 </para>
58368 <para>
58369 If an error is encountered, the function returns NULL and uses the <option>error</option>
58370 argument to return an error message. The variable pointed to by <option>error</option> is
58371 set to NULL if there is no error; it may be set non-NULL even when the function
58372 returns a non-NULL value if decoding was successful, but there was a problem
58373 with translation.
58374 </para>
58375 </listitem></varlistentry>
58376 <varlistentry>
58377 <term><emphasis role="bold">int&nbsp;smtp_fflush(void)</emphasis></term>
58378 <listitem>
58379 <para>
58380 This function is used in conjunction with <emphasis>smtp_printf()</emphasis>, as described
58381 below.
58382 </para>
58383 </listitem></varlistentry>
58384 <varlistentry>
58385 <term><emphasis role="bold">void&nbsp;smtp_printf(char&nbsp;*,&nbsp;...)</emphasis></term>
58386 <listitem>
58387 <para>
58388 The arguments of this function are like <function>printf()</function>; it writes to the SMTP
58389 output stream. You should use this function only when there is an SMTP output
58390 stream, that is, when the incoming message is being received via interactive
58391 SMTP. This is the case when <option>smtp_input</option> is TRUE and <option>smtp_batched_input</option>
58392 is FALSE. If you want to test for an incoming message from another host (as
58393 opposed to a local process that used the <option>-bs</option> command line option), you can
58394 test the value of <option>sender_host_address</option>, which is non-NULL when a remote host
58395 is involved.
58396 </para>
58397 <para>
58398 If an SMTP TLS connection is established, <emphasis>smtp_printf()</emphasis> uses the TLS
58399 output function, so it can be used for all forms of SMTP connection.
58400 </para>
58401 <para>
58402 Strings that are written by <emphasis>smtp_printf()</emphasis> from within <function>local_scan()</function>
58403 must start with an appropriate response code: 550 if you are going to return
58404 LOCAL_SCAN_REJECT, 451 if you are going to return
58405 LOCAL_SCAN_TEMPREJECT, and 250 otherwise. Because you are writing the
58406 initial lines of a multi-line response, the code must be followed by a hyphen
58407 to indicate that the line is not the final response line. You must also ensure
58408 that the lines you write terminate with CRLF. For example:
58409 </para>
58410 <literallayout class="monospaced">
58411 smtp_printf("550-this is some extra info\r\n");
58412 return LOCAL_SCAN_REJECT;
58413 </literallayout>
58414 <para>
58415 Note that you can also create multi-line responses by including newlines in
58416 the data returned via the <option>return_text</option> argument. The added value of using
58417 <emphasis>smtp_printf()</emphasis> is that, for instance, you could introduce delays between
58418 multiple output lines.
58419 </para>
58420 <para>
58421 The <emphasis>smtp_printf()</emphasis> function does not return any error indication, because it
58422 does not automatically flush pending output, and therefore does not test
58423 the state of the stream. (In the main code of Exim, flushing and error
58424 detection is done when Exim is ready for the next SMTP input command.) If
58425 you want to flush the output and check for an error (for example, the
58426 dropping of a TCP/IP connection), you can call <emphasis>smtp_fflush()</emphasis>, which has no
58427 arguments. It flushes the output stream, and returns a non-zero value if there
58428 is an error.
58429 </para>
58430 </listitem></varlistentry>
58431 <varlistentry>
58432 <term><emphasis role="bold">void&nbsp;*store_get(int)</emphasis></term>
58433 <listitem>
58434 <para>
58435 This function accesses Exim&#x2019;s internal store (memory) manager. It gets a new
58436 chunk of memory whose size is given by the argument. Exim bombs out if it ever
58437 runs out of memory. See the next section for a discussion of memory handling.
58438 </para>
58439 </listitem></varlistentry>
58440 <varlistentry>
58441 <term><emphasis role="bold">void&nbsp;*store_get_perm(int)</emphasis></term>
58442 <listitem>
58443 <para>
58444 This function is like <emphasis>store_get()</emphasis>, but it always gets memory from the
58445 permanent pool. See the next section for a discussion of memory handling.
58446 </para>
58447 </listitem></varlistentry>
58448 <varlistentry>
58449 <term><emphasis role="bold">uschar&nbsp;*string_copy(uschar&nbsp;*string)</emphasis></term>
58450 <listitem>
58451 <para>
58452 See below.
58453 </para>
58454 </listitem></varlistentry>
58455 <varlistentry>
58456 <term><emphasis role="bold">uschar&nbsp;*string_copyn(uschar&nbsp;*string,&nbsp;int&nbsp;length)</emphasis></term>
58457 <listitem>
58458 <para>
58459 See below.
58460 </para>
58461 </listitem></varlistentry>
58462 <varlistentry>
58463 <term><emphasis role="bold">uschar&nbsp;*string_sprintf(char&nbsp;*format,&nbsp;...)</emphasis></term>
58464 <listitem>
58465 <para>
58466 These three functions create strings using Exim&#x2019;s dynamic memory facilities.
58467 The first makes a copy of an entire string. The second copies up to a maximum
58468 number of characters, indicated by the second argument. The third uses a format
58469 and insertion arguments to create a new string. In each case, the result is a
58470 pointer to a new string in the current memory pool. See the next section for
58471 more discussion.
58472 </para>
58473 </listitem></varlistentry>
58474 </variablelist>
58475 </section>
58476 <section id="SECTmemhanloc">
58477 <title>More about Exim&#x2019;s memory handling</title>
58478 <para>
58479 <indexterm role="concept">
58480 <primary><function>local_scan()</function> function</primary>
58481 <secondary>memory handling</secondary>
58482 </indexterm>
58483 No function is provided for freeing memory, because that is never needed.
58484 The dynamic memory that Exim uses when receiving a message is automatically
58485 recycled if another message is received by the same process (this applies only
58486 to incoming SMTP connections &ndash; other input methods can supply only one
58487 message at a time). After receiving the last message, a reception process
58488 terminates.
58489 </para>
58490 <para>
58491 Because it is recycled, the normal dynamic memory cannot be used for holding
58492 data that must be preserved over a number of incoming messages on the same SMTP
58493 connection. However, Exim in fact uses two pools of dynamic memory; the second
58494 one is not recycled, and can be used for this purpose.
58495 </para>
58496 <para>
58497 If you want to allocate memory that remains available for subsequent messages
58498 in the same SMTP connection, you should set
58499 </para>
58500 <literallayout class="monospaced">
58501 store_pool = POOL_PERM
58502 </literallayout>
58503 <para>
58504 before calling the function that does the allocation. There is no need to
58505 restore the value if you do not need to; however, if you do want to revert to
58506 the normal pool, you can either restore the previous value of <option>store_pool</option> or
58507 set it explicitly to POOL_MAIN.
58508 </para>
58509 <para>
58510 The pool setting applies to all functions that get dynamic memory, including
58511 <emphasis>expand_string()</emphasis>, <emphasis>store_get()</emphasis>, and the <emphasis>string_xxx()</emphasis> functions.
58512 There is also a convenience function called <emphasis>store_get_perm()</emphasis> that gets a
58513 block of memory from the permanent pool while preserving the value of
58514 <option>store_pool</option>.
58515 <indexterm role="concept" startref="IIDlosca" class="endofrange"/>
58516 </para>
58517 </section>
58518 </chapter>
58519
58520 <chapter id="CHAPsystemfilter">
58521 <title>System-wide message filtering</title>
58522 <para>
58523 <indexterm role="concept" id="IIDsysfil1" class="startofrange">
58524 <primary>filter</primary>
58525 <secondary>system filter</secondary>
58526 </indexterm>
58527 <indexterm role="concept" id="IIDsysfil2" class="startofrange">
58528 <primary>filtering all mail</primary>
58529 </indexterm>
58530 <indexterm role="concept" id="IIDsysfil3" class="startofrange">
58531 <primary>system filter</primary>
58532 </indexterm>
58533 The previous chapters (on ACLs and the local scan function) describe checks
58534 that can be applied to messages before they are accepted by a host. There is
58535 also a mechanism for checking messages once they have been received, but before
58536 they are delivered. This is called the <emphasis>system filter</emphasis>.
58537 </para>
58538 <para>
58539 The system filter operates in a similar manner to users&#x2019; filter files, but it
58540 is run just once per message (however many recipients the message has).
58541 It should not normally be used as a substitute for routing, because <option>deliver</option>
58542 commands in a system router provide new envelope recipient addresses.
58543 The system filter must be an Exim filter. It cannot be a Sieve filter.
58544 </para>
58545 <para>
58546 The system filter is run at the start of a delivery attempt, before any routing
58547 is done. If a message fails to be completely delivered at the first attempt,
58548 the system filter is run again at the start of every retry.
58549 If you want your filter to do something only once per message, you can make use
58550 of the <option>first_delivery</option> condition in an <option>if</option> command in the filter to
58551 prevent it happening on retries.
58552 </para>
58553 <para>
58554 <indexterm role="variable">
58555 <primary><varname>$domain</varname></primary>
58556 </indexterm>
58557 <indexterm role="variable">
58558 <primary><varname>$local_part</varname></primary>
58559 </indexterm>
58560 <emphasis role="bold">Warning</emphasis>: Because the system filter runs just once, variables that are
58561 specific to individual recipient addresses, such as <varname>$local_part</varname> and
58562 <varname>$domain</varname>, are not set, and the <quote>personal</quote> condition is not meaningful. If
58563 you want to run a centrally-specified filter for each recipient address
58564 independently, you can do so by setting up a suitable <command>redirect</command> router, as
58565 described in section <xref linkend="SECTperaddfil"/> below.
58566 </para>
58567 <section id="SECID212">
58568 <title>Specifying a system filter</title>
58569 <para>
58570 <indexterm role="concept">
58571 <primary>uid (user id)</primary>
58572 <secondary>system filter</secondary>
58573 </indexterm>
58574 <indexterm role="concept">
58575 <primary>gid (group id)</primary>
58576 <secondary>system filter</secondary>
58577 </indexterm>
58578 The name of the file that contains the system filter must be specified by
58579 setting <option>system_filter</option>. If you want the filter to run under a uid and gid
58580 other than root, you must also set <option>system_filter_user</option> and
58581 <option>system_filter_group</option> as appropriate. For example:
58582 </para>
58583 <literallayout class="monospaced">
58584 system_filter = /etc/mail/exim.filter
58585 system_filter_user = exim
58586 </literallayout>
58587 <para>
58588 If a system filter generates any deliveries directly to files or pipes (via the
58589 <option>save</option> or <option>pipe</option> commands), transports to handle these deliveries must be
58590 specified by setting <option>system_filter_file_transport</option> and
58591 <option>system_filter_pipe_transport</option>, respectively. Similarly,
58592 <option>system_filter_reply_transport</option> must be set to handle any messages generated
58593 by the <option>reply</option> command.
58594 </para>
58595 </section>
58596 <section id="SECID213">
58597 <title>Testing a system filter</title>
58598 <para>
58599 You can run simple tests of a system filter in the same way as for a user
58600 filter, but you should use <option>-bF</option> rather than <option>-bf</option>, so that features that
58601 are permitted only in system filters are recognized.
58602 </para>
58603 <para>
58604 If you want to test the combined effect of a system filter and a user filter,
58605 you can use both <option>-bF</option> and <option>-bf</option> on the same command line.
58606 </para>
58607 </section>
58608 <section id="SECID214">
58609 <title>Contents of a system filter</title>
58610 <para>
58611 The language used to specify system filters is the same as for users&#x2019; filter
58612 files. It is described in the separate end-user document <emphasis>Exim&#x2019;s interface to
58613 mail filtering</emphasis>. However, there are some additional features that are
58614 available only in system filters; these are described in subsequent sections.
58615 If they are encountered in a user&#x2019;s filter file or when testing with <option>-bf</option>,
58616 they cause errors.
58617 </para>
58618 <para>
58619 <indexterm role="concept">
58620 <primary>frozen messages</primary>
58621 <secondary>manual thaw; testing in filter</secondary>
58622 </indexterm>
58623 There are two special conditions which, though available in users&#x2019; filter
58624 files, are designed for use in system filters. The condition <option>first_delivery</option>
58625 is true only for the first attempt at delivering a message, and
58626 <option>manually_thawed</option> is true only if the message has been frozen, and
58627 subsequently thawed by an admin user. An explicit forced delivery counts as a
58628 manual thaw, but thawing as a result of the <option>auto_thaw</option> setting does not.
58629 </para>
58630 <para>
58631 <emphasis role="bold">Warning</emphasis>: If a system filter uses the <option>first_delivery</option> condition to
58632 specify an <quote>unseen</quote> (non-significant) delivery, and that delivery does not
58633 succeed, it will not be tried again.
58634 If you want Exim to retry an unseen delivery until it succeeds, you should
58635 arrange to set it up every time the filter runs.
58636 </para>
58637 <para>
58638 When a system filter finishes running, the values of the variables <varname>$n0</varname> &ndash;
58639 <varname>$n9</varname> are copied into <varname>$sn0</varname> &ndash; <varname>$sn9</varname> and are thereby made available to
58640 users&#x2019; filter files. Thus a system filter can, for example, set up <quote>scores</quote>
58641 to which users&#x2019; filter files can refer.
58642 </para>
58643 </section>
58644 <section id="SECID215">
58645 <title>Additional variable for system filters</title>
58646 <para>
58647 <indexterm role="variable">
58648 <primary><varname>$recipients</varname></primary>
58649 </indexterm>
58650 The expansion variable <varname>$recipients</varname>, containing a list of all the recipients
58651 of the message (separated by commas and white space), is available in system
58652 filters. It is not available in users&#x2019; filters for privacy reasons.
58653 </para>
58654 </section>
58655 <section id="SECID216">
58656 <title>Defer, freeze, and fail commands for system filters</title>
58657 <para>
58658 <indexterm role="concept">
58659 <primary>freezing messages</primary>
58660 </indexterm>
58661 <indexterm role="concept">
58662 <primary>message</primary>
58663 <secondary>freezing</secondary>
58664 </indexterm>
58665 <indexterm role="concept">
58666 <primary>message</primary>
58667 <secondary>forced failure</secondary>
58668 </indexterm>
58669 <indexterm role="concept">
58670 <primary><option>fail</option></primary>
58671 <secondary>in system filter</secondary>
58672 </indexterm>
58673 <indexterm role="concept">
58674 <primary><option>freeze</option> in system filter</primary>
58675 </indexterm>
58676 <indexterm role="concept">
58677 <primary><option>defer</option> in system filter</primary>
58678 </indexterm>
58679 There are three extra commands (<option>defer</option>, <option>freeze</option> and <option>fail</option>) which are
58680 always available in system filters, but are not normally enabled in users&#x2019;
58681 filters. (See the <option>allow_defer</option>, <option>allow_freeze</option> and <option>allow_fail</option> options
58682 for the <command>redirect</command> router.) These commands can optionally be followed by the
58683 word <option>text</option> and a string containing an error message, for example:
58684 </para>
58685 <literallayout class="monospaced">
58686 fail text "this message looks like spam to me"
58687 </literallayout>
58688 <para>
58689 The keyword <option>text</option> is optional if the next character is a double quote.
58690 </para>
58691 <para>
58692 The <option>defer</option> command defers delivery of the original recipients of the
58693 message. The <option>fail</option> command causes all the original recipients to be failed,
58694 and a bounce message to be created. The <option>freeze</option> command suspends all
58695 delivery attempts for the original recipients. In all cases, any new deliveries
58696 that are specified by the filter are attempted as normal after the filter has
58697 run.
58698 </para>
58699 <para>
58700 The <option>freeze</option> command is ignored if the message has been manually unfrozen and
58701 not manually frozen since. This means that automatic freezing by a system
58702 filter can be used as a way of checking out suspicious messages. If a message
58703 is found to be all right, manually unfreezing it allows it to be delivered.
58704 </para>
58705 <para>
58706 <indexterm role="concept">
58707 <primary>log</primary>
58708 <secondary><option>fail</option> command log line</secondary>
58709 </indexterm>
58710 <indexterm role="concept">
58711 <primary><option>fail</option></primary>
58712 <secondary>log line; reducing</secondary>
58713 </indexterm>
58714 The text given with a fail command is used as part of the bounce message as
58715 well as being written to the log. If the message is quite long, this can fill
58716 up a lot of log space when such failures are common. To reduce the size of the
58717 log message, Exim interprets the text in a special way if it starts with the
58718 two characters <literal>&lt;&lt;</literal> and contains <literal>&gt;&gt;</literal> later. The text between these two
58719 strings is written to the log, and the rest of the text is used in the bounce
58720 message. For example:
58721 </para>
58722 <literallayout class="monospaced">
58723 fail "&lt;&lt;filter test 1&gt;&gt;Your message is rejected \
58724      because it contains attachments that we are \
58725      not prepared to receive."
58726 </literallayout>
58727 <para>
58728 <indexterm role="concept">
58729 <primary>loop</primary>
58730 <secondary>caused by <option>fail</option></secondary>
58731 </indexterm>
58732 Take great care with the <option>fail</option> command when basing the decision to fail on
58733 the contents of the message, because the bounce message will of course include
58734 the contents of the original message and will therefore trigger the <option>fail</option>
58735 command again (causing a mail loop) unless steps are taken to prevent this.
58736 Testing the <option>error_message</option> condition is one way to prevent this. You could
58737 use, for example
58738 </para>
58739 <literallayout class="monospaced">
58740 if $message_body contains "this is spam" and not error_message
58741 then fail text "spam is not wanted here" endif
58742 </literallayout>
58743 <para>
58744 though of course that might let through unwanted bounce messages. The
58745 alternative is clever checking of the body and/or headers to detect bounces
58746 generated by the filter.
58747 </para>
58748 <para>
58749 The interpretation of a system filter file ceases after a
58750 <option>defer</option>,
58751 <option>freeze</option>, or <option>fail</option> command is obeyed. However, any deliveries that were
58752 set up earlier in the filter file are honoured, so you can use a sequence such
58753 as
58754 </para>
58755 <literallayout class="monospaced">
58756 mail ...
58757 freeze
58758 </literallayout>
58759 <para>
58760 to send a specified message when the system filter is freezing (or deferring or
58761 failing) a message. The normal deliveries for the message do not, of course,
58762 take place.
58763 </para>
58764 </section>
58765 <section id="SECTaddremheasys">
58766 <title>Adding and removing headers in a system filter</title>
58767 <para>
58768 <indexterm role="concept">
58769 <primary>header lines</primary>
58770 <secondary>adding; in system filter</secondary>
58771 </indexterm>
58772 <indexterm role="concept">
58773 <primary>header lines</primary>
58774 <secondary>removing; in system filter</secondary>
58775 </indexterm>
58776 <indexterm role="concept">
58777 <primary>filter</primary>
58778 <secondary>header lines; adding/removing</secondary>
58779 </indexterm>
58780 Two filter commands that are available only in system filters are:
58781 </para>
58782 <literallayout class="monospaced">
58783 headers add &lt;string&gt;
58784 headers remove &lt;string&gt;
58785 </literallayout>
58786 <para>
58787 The argument for the <option>headers add</option> is a string that is expanded and then
58788 added to the end of the message&#x2019;s headers. It is the responsibility of the
58789 filter maintainer to make sure it conforms to RFC 2822 syntax. Leading white
58790 space is ignored, and if the string is otherwise empty, or if the expansion is
58791 forced to fail, the command has no effect.
58792 </para>
58793 <para>
58794 You can use <quote>\n</quote> within the string, followed by white space, to specify
58795 continued header lines. More than one header may be added in one command by
58796 including <quote>\n</quote> within the string without any following white space. For
58797 example:
58798 </para>
58799 <literallayout class="monospaced">
58800 headers add "X-header-1: ....\n  \
58801              continuation of X-header-1 ...\n\
58802              X-header-2: ...."
58803 </literallayout>
58804 <para>
58805 Note that the header line continuation white space after the first newline must
58806 be placed before the backslash that continues the input string, because white
58807 space after input continuations is ignored.
58808 </para>
58809 <para>
58810 The argument for <option>headers remove</option> is a colon-separated list of header names.
58811 This command applies only to those headers that are stored with the message;
58812 those that are added at delivery time (such as <emphasis>Envelope-To:</emphasis> and
58813 <emphasis>Return-Path:</emphasis>) cannot be removed by this means. If there is more than one
58814 header with the same name, they are all removed.
58815 </para>
58816 <para>
58817 The <option>headers</option> command in a system filter makes an immediate change to the set
58818 of header lines that was received with the message (with possible additions
58819 from ACL processing). Subsequent commands in the system filter operate on the
58820 modified set, which also forms the basis for subsequent message delivery.
58821 Unless further modified during routing or transporting, this set of headers is
58822 used for all recipients of the message.
58823 </para>
58824 <para>
58825 During routing and transporting, the variables that refer to the contents of
58826 header lines refer only to those lines that are in this set. Thus, header lines
58827 that are added by a system filter are visible to users&#x2019; filter files and to all
58828 routers and transports. This contrasts with the manipulation of header lines by
58829 routers and transports, which is not immediate, but which instead is saved up
58830 until the message is actually being written (see section
58831 <xref linkend="SECTheadersaddrem"/>).
58832 </para>
58833 <para>
58834 If the message is not delivered at the first attempt, header lines that were
58835 added by the system filter are stored with the message, and so are still
58836 present at the next delivery attempt. Header lines that were removed are still
58837 present, but marked <quote>deleted</quote> so that they are not transported with the
58838 message. For this reason, it is usual to make the <option>headers</option> command
58839 conditional on <option>first_delivery</option> so that the set of header lines is not
58840 modified more than once.
58841 </para>
58842 <para>
58843 Because header modification in a system filter acts immediately, you have to
58844 use an indirect approach if you want to modify the contents of a header line.
58845 For example:
58846 </para>
58847 <literallayout class="monospaced">
58848 headers add "Old-Subject: $h_subject:"
58849 headers remove "Subject"
58850 headers add "Subject: new subject (was: $h_old-subject:)"
58851 headers remove "Old-Subject"
58852 </literallayout>
58853 </section>
58854 <section id="SECID217">
58855 <title>Setting an errors address in a system filter</title>
58856 <para>
58857 <indexterm role="concept">
58858 <primary>envelope sender</primary>
58859 </indexterm>
58860 In a system filter, if a <option>deliver</option> command is followed by
58861 </para>
58862 <literallayout class="monospaced">
58863 errors_to &lt;some address&gt;
58864 </literallayout>
58865 <para>
58866 in order to change the envelope sender (and hence the error reporting) for that
58867 delivery, any address may be specified. (In a user filter, only the current
58868 user&#x2019;s address can be set.) For example, if some mail is being monitored, you
58869 might use
58870 </para>
58871 <literallayout class="monospaced">
58872 unseen deliver monitor@spying.example errors_to root@local.example
58873 </literallayout>
58874 <para>
58875 to take a copy which would not be sent back to the normal error reporting
58876 address if its delivery failed.
58877 </para>
58878 </section>
58879 <section id="SECTperaddfil">
58880 <title>Per-address filtering</title>
58881 <para>
58882 <indexterm role="variable">
58883 <primary><varname>$domain</varname></primary>
58884 </indexterm>
58885 <indexterm role="variable">
58886 <primary><varname>$local_part</varname></primary>
58887 </indexterm>
58888 In contrast to the system filter, which is run just once per message for each
58889 delivery attempt, it is also possible to set up a system-wide filtering
58890 operation that runs once for each recipient address. In this case, variables
58891 such as <varname>$local_part</varname> and <varname>$domain</varname> can be used, and indeed, the choice of
58892 filter file could be made dependent on them. This is an example of a router
58893 which implements such a filter:
58894 </para>
58895 <literallayout class="monospaced">
58896 central_filter:
58897   check_local_user
58898   driver = redirect
58899   domains = +local_domains
58900   file = /central/filters/$local_part
58901   no_verify
58902   allow_filter
58903   allow_freeze
58904 </literallayout>
58905 <para>
58906 The filter is run in a separate process under its own uid. Therefore, either
58907 <option>check_local_user</option> must be set (as above), in which case the filter is run as
58908 the local user, or the <option>user</option> option must be used to specify which user to
58909 use. If both are set, <option>user</option> overrides.
58910 </para>
58911 <para>
58912 Care should be taken to ensure that none of the commands in the filter file
58913 specify a significant delivery if the message is to go on to be delivered to
58914 its intended recipient. The router will not then claim to have dealt with the
58915 address, so it will be passed on to subsequent routers to be delivered in the
58916 normal way.
58917 <indexterm role="concept" startref="IIDsysfil1" class="endofrange"/>
58918 <indexterm role="concept" startref="IIDsysfil2" class="endofrange"/>
58919 <indexterm role="concept" startref="IIDsysfil3" class="endofrange"/>
58920 </para>
58921 </section>
58922 </chapter>
58923
58924 <chapter id="CHAPmsgproc">
58925 <title>Message processing</title>
58926 <para>
58927 <indexterm role="concept" id="IIDmesproc" class="startofrange">
58928 <primary>message</primary>
58929 <secondary>general processing</secondary>
58930 </indexterm>
58931 Exim performs various transformations on the sender and recipient addresses of
58932 all messages that it handles, and also on the messages&#x2019; header lines. Some of
58933 these are optional and configurable, while others always take place. All of
58934 this processing, except rewriting as a result of routing, and the addition or
58935 removal of header lines while delivering, happens when a message is received,
58936 before it is placed on Exim&#x2019;s queue.
58937 </para>
58938 <para>
58939 Some of the automatic processing takes place by default only for
58940 <quote>locally-originated</quote> messages. This adjective is used to describe messages
58941 that are not received over TCP/IP, but instead are passed to an Exim process on
58942 its standard input. This includes the interactive <quote>local SMTP</quote> case that is
58943 set up by the <option>-bs</option> command line option.
58944 </para>
58945 <para>
58946 <emphasis role="bold">Note</emphasis>: Messages received over TCP/IP on the loopback interface (127.0.0.1
58947 or ::1) are not considered to be locally-originated. Exim does not treat the
58948 loopback interface specially in any way.
58949 </para>
58950 <para>
58951 If you want the loopback interface to be treated specially, you must ensure
58952 that there are appropriate entries in your ACLs.
58953 </para>
58954 <section id="SECTsubmodnon">
58955 <title>Submission mode for non-local messages</title>
58956 <para>
58957 <indexterm role="concept">
58958 <primary>message</primary>
58959 <secondary>submission</secondary>
58960 </indexterm>
58961 <indexterm role="concept">
58962 <primary>submission mode</primary>
58963 </indexterm>
58964 Processing that happens automatically for locally-originated messages (unless
58965 <option>suppress_local_fixups</option> is set) can also be requested for messages that are
58966 received over TCP/IP. The term <quote>submission mode</quote> is used to describe this
58967 state. Submission mode is set by the modifier
58968 </para>
58969 <literallayout class="monospaced">
58970 control = submission
58971 </literallayout>
58972 <para>
58973 in a MAIL, RCPT, or pre-data ACL for an incoming message (see sections
58974 <xref linkend="SECTACLmodi"/> and <xref linkend="SECTcontrols"/>). This makes Exim treat the message as
58975 a local submission, and is normally used when the source of the message is
58976 known to be an MUA running on a client host (as opposed to an MTA). For
58977 example, to set submission mode for messages originating on the IPv4 loopback
58978 interface, you could include the following in the MAIL ACL:
58979 </para>
58980 <literallayout class="monospaced">
58981 warn  hosts = 127.0.0.1
58982       control = submission
58983 </literallayout>
58984 <para>
58985 <indexterm role="concept">
58986 <primary><option>sender_retain</option> submission option</primary>
58987 </indexterm>
58988 There are some options that can be used when setting submission mode. A slash
58989 is used to separate options. For example:
58990 </para>
58991 <literallayout class="monospaced">
58992 control = submission/sender_retain
58993 </literallayout>
58994 <para>
58995 Specifying <option>sender_retain</option> has the effect of setting <option>local_sender_retain</option>
58996 true and <option>local_from_check</option> false for the current incoming message. The first
58997 of these allows an existing <emphasis>Sender:</emphasis> header in the message to remain, and
58998 the second suppresses the check to ensure that <emphasis>From:</emphasis> matches the
58999 authenticated sender. With this setting, Exim still fixes up messages by adding
59000 <emphasis>Date:</emphasis> and <emphasis>Message-ID:</emphasis> header lines if they are missing, but makes no
59001 attempt to check sender authenticity in header lines.
59002 </para>
59003 <para>
59004 When <option>sender_retain</option> is not set, a submission mode setting may specify a
59005 domain to be used when generating a <emphasis>From:</emphasis> or <emphasis>Sender:</emphasis> header line. For
59006 example:
59007 </para>
59008 <literallayout class="monospaced">
59009 control = submission/domain=some.domain
59010 </literallayout>
59011 <para>
59012 The domain may be empty. How this value is used is described in sections
59013 <xref linkend="SECTthefrohea"/> and <xref linkend="SECTthesenhea"/>. There is also a <option>name</option> option
59014 that allows you to specify the user&#x2019;s full name for inclusion in a created
59015 <emphasis>Sender:</emphasis> or <emphasis>From:</emphasis> header line. For example:
59016 </para>
59017 <literallayout class="monospaced">
59018 accept authenticated = *
59019        control = submission/domain=wonderland.example/\
59020                             name=${lookup {$authenticated_id} \
59021                                    lsearch {/etc/exim/namelist}}
59022 </literallayout>
59023 <para>
59024 Because the name may contain any characters, including slashes, the <option>name</option>
59025 option must be given last. The remainder of the string is used as the name. For
59026 the example above, if <filename>/etc/exim/namelist</filename> contains:
59027 </para>
59028 <literallayout class="monospaced">
59029 bigegg:  Humpty Dumpty
59030 </literallayout>
59031 <para>
59032 then when the sender has authenticated as <emphasis>bigegg</emphasis>, the generated <emphasis>Sender:</emphasis>
59033 line would be:
59034 </para>
59035 <literallayout class="monospaced">
59036 Sender: Humpty Dumpty &lt;bigegg@wonderland.example&gt;
59037 </literallayout>
59038 <para>
59039 <indexterm role="concept">
59040 <primary>return path</primary>
59041 <secondary>in submission mode</secondary>
59042 </indexterm>
59043 By default, submission mode forces the return path to the same address as is
59044 used to create the <emphasis>Sender:</emphasis> header. However, if <option>sender_retain</option> is
59045 specified, the return path is also left unchanged.
59046 </para>
59047 <para>
59048 <emphasis role="bold">Note</emphasis>: The changes caused by submission mode take effect after the predata
59049 ACL. This means that any sender checks performed before the fix-ups use the
59050 untrusted sender address specified by the user, not the trusted sender address
59051 specified by submission mode. Although this might be slightly unexpected, it
59052 does mean that you can configure ACL checks to spot that a user is trying to
59053 spoof another&#x2019;s address.
59054 </para>
59055 </section>
59056 <section id="SECTlineendings">
59057 <title>Line endings</title>
59058 <para>
59059 <indexterm role="concept">
59060 <primary>line endings</primary>
59061 </indexterm>
59062 <indexterm role="concept">
59063 <primary>carriage return</primary>
59064 </indexterm>
59065 <indexterm role="concept">
59066 <primary>linefeed</primary>
59067 </indexterm>
59068 RFC 2821 specifies that CRLF (two characters: carriage-return, followed by
59069 linefeed) is the line ending for messages transmitted over the Internet using
59070 SMTP over TCP/IP. However, within individual operating systems, different
59071 conventions are used. For example, Unix-like systems use just LF, but others
59072 use CRLF or just CR.
59073 </para>
59074 <para>
59075 Exim was designed for Unix-like systems, and internally, it stores messages
59076 using the system&#x2019;s convention of a single LF as a line terminator. When
59077 receiving a message, all line endings are translated to this standard format.
59078 Originally, it was thought that programs that passed messages directly to an
59079 MTA within an operating system would use that system&#x2019;s convention. Experience
59080 has shown that this is not the case; for example, there are Unix applications
59081 that use CRLF in this circumstance. For this reason, and for compatibility with
59082 other MTAs, the way Exim handles line endings for all messages is now as
59083 follows:
59084 </para>
59085 <itemizedlist>
59086 <listitem>
59087 <para>
59088 LF not preceded by CR is treated as a line ending.
59089 </para>
59090 </listitem>
59091 <listitem>
59092 <para>
59093 CR is treated as a line ending; if it is immediately followed by LF, the LF
59094 is ignored.
59095 </para>
59096 </listitem>
59097 <listitem>
59098 <para>
59099 The sequence <quote>CR, dot, CR</quote> does not terminate an incoming SMTP message,
59100 nor a local message in the state where a line containing only a dot is a
59101 terminator.
59102 </para>
59103 </listitem>
59104 <listitem>
59105 <para>
59106 If a bare CR is encountered within a header line, an extra space is added after
59107 the line terminator so as not to end the header line. The reasoning behind this
59108 is that bare CRs in header lines are most likely either to be mistakes, or
59109 people trying to play silly games.
59110 </para>
59111 </listitem>
59112 <listitem>
59113 <para>
59114 If the first header line received in a message ends with CRLF, a subsequent
59115 bare LF in a header line is treated in the same way as a bare CR in a header
59116 line.
59117 </para>
59118 </listitem>
59119 </itemizedlist>
59120 </section>
59121 <section id="SECID218">
59122 <title>Unqualified addresses</title>
59123 <para>
59124 <indexterm role="concept">
59125 <primary>unqualified addresses</primary>
59126 </indexterm>
59127 <indexterm role="concept">
59128 <primary>address</primary>
59129 <secondary>qualification</secondary>
59130 </indexterm>
59131 By default, Exim expects every envelope address it receives from an external
59132 host to be fully qualified. Unqualified addresses cause negative responses to
59133 SMTP commands. However, because SMTP is used as a means of transporting
59134 messages from MUAs running on personal workstations, there is sometimes a
59135 requirement to accept unqualified addresses from specific hosts or IP networks.
59136 </para>
59137 <para>
59138 Exim has two options that separately control which hosts may send unqualified
59139 sender or recipient addresses in SMTP commands, namely
59140 <option>sender_unqualified_hosts</option> and <option>recipient_unqualified_hosts</option>. In both
59141 cases, if an unqualified address is accepted, it is qualified by adding the
59142 value of <option>qualify_domain</option> or <option>qualify_recipient</option>, as appropriate.
59143 </para>
59144 <para>
59145 <indexterm role="option">
59146 <primary><option>qualify_domain</option></primary>
59147 </indexterm>
59148 <indexterm role="option">
59149 <primary><option>qualify_recipient</option></primary>
59150 </indexterm>
59151 Unqualified addresses in header lines are automatically qualified for messages
59152 that are locally originated, unless the <option>-bnq</option> option is given on the command
59153 line. For messages received over SMTP, unqualified addresses in header lines
59154 are qualified only if unqualified addresses are permitted in SMTP commands. In
59155 other words, such qualification is also controlled by
59156 <option>sender_unqualified_hosts</option> and <option>recipient_unqualified_hosts</option>,
59157 </para>
59158 </section>
59159 <section id="SECID219">
59160 <title>The UUCP From line</title>
59161 <para>
59162 <indexterm role="concept">
59163 <primary><quote>From</quote> line</primary>
59164 </indexterm>
59165 <indexterm role="concept">
59166 <primary>UUCP</primary>
59167 <secondary><quote>From</quote> line</secondary>
59168 </indexterm>
59169 <indexterm role="concept">
59170 <primary>sender</primary>
59171 <secondary>address</secondary>
59172 </indexterm>
59173 <indexterm role="option">
59174 <primary><option>uucp_from_pattern</option></primary>
59175 </indexterm>
59176 <indexterm role="option">
59177 <primary><option>uucp_from_sender</option></primary>
59178 </indexterm>
59179 <indexterm role="concept">
59180 <primary>envelope sender</primary>
59181 </indexterm>
59182 <indexterm role="concept">
59183 <primary>Sendmail compatibility</primary>
59184 <secondary><quote>From</quote> line</secondary>
59185 </indexterm>
59186 Messages that have come from UUCP (and some other applications) often begin
59187 with a line containing the envelope sender and a timestamp, following the word
59188 <quote>From</quote>. Examples of two common formats are:
59189 </para>
59190 <literallayout class="monospaced">
59191 From a.oakley@berlin.mus Fri Jan  5 12:35 GMT 1996
59192 From f.butler@berlin.mus Fri, 7 Jan 97 14:00:00 GMT
59193 </literallayout>
59194 <para>
59195 This line precedes the RFC 2822 header lines. For compatibility with Sendmail,
59196 Exim recognizes such lines at the start of messages that are submitted to it
59197 via the command line (that is, on the standard input). It does not recognize
59198 such lines in incoming SMTP messages, unless the sending host matches
59199 <option>ignore_fromline_hosts</option> or the <option>-bs</option> option was used for a local message
59200 and <option>ignore_fromline_local</option> is set. The recognition is controlled by a
59201 regular expression that is defined by the <option>uucp_from_pattern</option> option, whose
59202 default value matches the two common cases shown above and puts the address
59203 that follows <quote>From</quote> into <varname>$1</varname>.
59204 </para>
59205 <para>
59206 <indexterm role="concept">
59207 <primary>numerical variables (<varname>$1</varname> <varname>$2</varname> etc)</primary>
59208 <secondary>in <quote>From </quote> line handling</secondary>
59209 </indexterm>
59210 When the caller of Exim for a non-SMTP message that contains a <quote>From</quote> line is
59211 a trusted user, the message&#x2019;s sender address is constructed by expanding the
59212 contents of <option>uucp_sender_address</option>, whose default value is <quote>$1</quote>. This is
59213 then parsed as an RFC 2822 address. If there is no domain, the local part is
59214 qualified with <option>qualify_domain</option> unless it is the empty string. However, if
59215 the command line <option>-f</option> option is used, it overrides the <quote>From</quote> line.
59216 </para>
59217 <para>
59218 If the caller of Exim is not trusted, the <quote>From</quote> line is recognized, but the
59219 sender address is not changed. This is also the case for incoming SMTP messages
59220 that are permitted to contain <quote>From</quote> lines.
59221 </para>
59222 <para>
59223 Only one <quote>From</quote> line is recognized. If there is more than one, the second is
59224 treated as a data line that starts the body of the message, as it is not valid
59225 as a header line. This also happens if a <quote>From</quote> line is present in an
59226 incoming SMTP message from a source that is not permitted to send them.
59227 </para>
59228 </section>
59229 <section id="SECID220">
59230 <title>Resent- header lines</title>
59231 <para>
59232 <indexterm role="concept">
59233 <primary><option>Resent-</option> header lines</primary>
59234 </indexterm>
59235 RFC 2822 makes provision for sets of header lines starting with the string
59236 <literal>Resent-</literal> to be added to a message when it is resent by the original
59237 recipient to somebody else. These headers are <emphasis>Resent-Date:</emphasis>,
59238 <emphasis>Resent-From:</emphasis>, <emphasis>Resent-Sender:</emphasis>, <emphasis>Resent-To:</emphasis>, <emphasis>Resent-Cc:</emphasis>,
59239 <emphasis>Resent-Bcc:</emphasis> and <emphasis>Resent-Message-ID:</emphasis>. The RFC says:
59240 </para>
59241 <blockquote>
59242 <para>
59243 <emphasis>Resent fields are strictly informational. They MUST NOT be used in the normal
59244 processing of replies or other such automatic actions on messages.</emphasis>
59245 </para>
59246 </blockquote>
59247 <para>
59248 This leaves things a bit vague as far as other processing actions such as
59249 address rewriting are concerned. Exim treats <option>Resent-</option> header lines as
59250 follows:
59251 </para>
59252 <itemizedlist>
59253 <listitem>
59254 <para>
59255 A <emphasis>Resent-From:</emphasis> line that just contains the login id of the submitting user
59256 is automatically rewritten in the same way as <emphasis>From:</emphasis> (see below).
59257 </para>
59258 </listitem>
59259 <listitem>
59260 <para>
59261 If there&#x2019;s a rewriting rule for a particular header line, it is also applied to
59262 <option>Resent-</option> header lines of the same type. For example, a rule that rewrites
59263 <emphasis>From:</emphasis> also rewrites <emphasis>Resent-From:</emphasis>.
59264 </para>
59265 </listitem>
59266 <listitem>
59267 <para>
59268 For local messages, if <emphasis>Sender:</emphasis> is removed on input, <emphasis>Resent-Sender:</emphasis> is
59269 also removed.
59270 </para>
59271 </listitem>
59272 <listitem>
59273 <para>
59274 For a locally-submitted message,
59275 if there are any <option>Resent-</option> header lines but no <emphasis>Resent-Date:</emphasis>,
59276 <emphasis>Resent-From:</emphasis>, or <emphasis>Resent-Message-Id:</emphasis>, they are added as necessary. It is
59277 the contents of <emphasis>Resent-Message-Id:</emphasis> (rather than <emphasis>Message-Id:</emphasis>) which are
59278 included in log lines in this case.
59279 </para>
59280 </listitem>
59281 <listitem>
59282 <para>
59283 The logic for adding <emphasis>Sender:</emphasis> is duplicated for <emphasis>Resent-Sender:</emphasis> when any
59284 <option>Resent-</option> header lines are present.
59285 </para>
59286 </listitem>
59287 </itemizedlist>
59288 </section>
59289 <section id="SECID221">
59290 <title>The Auto-Submitted: header line</title>
59291 <para>
59292 Whenever Exim generates an autoreply, a bounce, or a delay warning message, it
59293 includes the header line:
59294 </para>
59295 <literallayout class="monospaced">
59296 Auto-Submitted: auto-replied
59297 </literallayout>
59298 </section>
59299 <section id="SECID222">
59300 <title>The Bcc: header line</title>
59301 <para>
59302 <indexterm role="concept">
59303 <primary><emphasis>Bcc:</emphasis> header line</primary>
59304 </indexterm>
59305 If Exim is called with the <option>-t</option> option, to take recipient addresses from a
59306 message&#x2019;s header, it removes any <emphasis>Bcc:</emphasis> header line that may exist (after
59307 extracting its addresses). If <option>-t</option> is not present on the command line, any
59308 existing <emphasis>Bcc:</emphasis> is not removed.
59309 </para>
59310 </section>
59311 <section id="SECID223">
59312 <title>The Date: header line</title>
59313 <para>
59314 <indexterm role="concept">
59315 <primary><emphasis>Date:</emphasis> header line</primary>
59316 </indexterm>
59317 If a locally-generated or submission-mode message has no <emphasis>Date:</emphasis> header line,
59318 Exim adds one, using the current date and time, unless the
59319 <option>suppress_local_fixups</option> control has been specified.
59320 </para>
59321 </section>
59322 <section id="SECID224">
59323 <title>The Delivery-date: header line</title>
59324 <para>
59325 <indexterm role="concept">
59326 <primary><emphasis>Delivery-date:</emphasis> header line</primary>
59327 </indexterm>
59328 <indexterm role="option">
59329 <primary><option>delivery_date_remove</option></primary>
59330 </indexterm>
59331 <emphasis>Delivery-date:</emphasis> header lines are not part of the standard RFC 2822 header
59332 set. Exim can be configured to add them to the final delivery of messages. (See
59333 the generic <option>delivery_date_add</option> transport option.) They should not be present
59334 in messages in transit. If the <option>delivery_date_remove</option> configuration option is
59335 set (the default), Exim removes <emphasis>Delivery-date:</emphasis> header lines from incoming
59336 messages.
59337 </para>
59338 </section>
59339 <section id="SECID225">
59340 <title>The Envelope-to: header line</title>
59341 <para>
59342 <indexterm role="concept">
59343 <primary><emphasis>Envelope-to:</emphasis> header line</primary>
59344 </indexterm>
59345 <indexterm role="option">
59346 <primary><option>envelope_to_remove</option></primary>
59347 </indexterm>
59348 <emphasis>Envelope-to:</emphasis> header lines are not part of the standard RFC 2822 header set.
59349 Exim can be configured to add them to the final delivery of messages. (See the
59350 generic <option>envelope_to_add</option> transport option.) They should not be present in
59351 messages in transit. If the <option>envelope_to_remove</option> configuration option is set
59352 (the default), Exim removes <emphasis>Envelope-to:</emphasis> header lines from incoming
59353 messages.
59354 </para>
59355 </section>
59356 <section id="SECTthefrohea">
59357 <title>The From: header line</title>
59358 <para>
59359 <indexterm role="concept">
59360 <primary><emphasis>From:</emphasis> header line</primary>
59361 </indexterm>
59362 <indexterm role="concept">
59363 <primary>Sendmail compatibility</primary>
59364 <secondary><quote>From</quote> line</secondary>
59365 </indexterm>
59366 <indexterm role="concept">
59367 <primary>message</primary>
59368 <secondary>submission</secondary>
59369 </indexterm>
59370 <indexterm role="concept">
59371 <primary>submission mode</primary>
59372 </indexterm>
59373 If a submission-mode message does not contain a <emphasis>From:</emphasis> header line, Exim
59374 adds one if either of the following conditions is true:
59375 </para>
59376 <itemizedlist>
59377 <listitem>
59378 <para>
59379 The envelope sender address is not empty (that is, this is not a bounce
59380 message). The added header line copies the envelope sender address.
59381 </para>
59382 </listitem>
59383 <listitem>
59384 <para>
59385 <indexterm role="variable">
59386 <primary><varname>$authenticated_id</varname></primary>
59387 </indexterm>
59388 The SMTP session is authenticated and <varname>$authenticated_id</varname> is not empty.
59389 </para>
59390 <orderedlist numeration="arabic">
59391 <listitem>
59392 <para>
59393 <indexterm role="variable">
59394 <primary><varname>$qualify_domain</varname></primary>
59395 </indexterm>
59396 If no domain is specified by the submission control, the local part is
59397 <varname>$authenticated_id</varname> and the domain is <varname>$qualify_domain</varname>.
59398 </para>
59399 </listitem>
59400 <listitem>
59401 <para>
59402 If a non-empty domain is specified by the submission control, the local
59403 part is <varname>$authenticated_id</varname>, and the domain is the specified domain.
59404 </para>
59405 </listitem>
59406 <listitem>
59407 <para>
59408 If an empty domain is specified by the submission control,
59409 <varname>$authenticated_id</varname> is assumed to be the complete address.
59410 </para>
59411 </listitem>
59412 </orderedlist>
59413 </listitem>
59414 </itemizedlist>
59415 <para>
59416 A non-empty envelope sender takes precedence.
59417 </para>
59418 <para>
59419 If a locally-generated incoming message does not contain a <emphasis>From:</emphasis> header
59420 line, and the <option>suppress_local_fixups</option> control is not set, Exim adds one
59421 containing the sender&#x2019;s address. The calling user&#x2019;s login name and full name
59422 are used to construct the address, as described in section <xref linkend="SECTconstr"/>.
59423 They are obtained from the password data by calling <function>getpwuid()</function> (but see the
59424 <option>unknown_login</option> configuration option). The address is qualified with
59425 <option>qualify_domain</option>.
59426 </para>
59427 <para>
59428 For compatibility with Sendmail, if an incoming, non-SMTP message has a
59429 <emphasis>From:</emphasis> header line containing just the unqualified login name of the calling
59430 user, this is replaced by an address containing the user&#x2019;s login name and full
59431 name as described in section <xref linkend="SECTconstr"/>.
59432 </para>
59433 </section>
59434 <section id="SECID226">
59435 <title>The Message-ID: header line</title>
59436 <para>
59437 <indexterm role="concept">
59438 <primary><emphasis>Message-ID:</emphasis> header line</primary>
59439 </indexterm>
59440 <indexterm role="concept">
59441 <primary>message</primary>
59442 <secondary>submission</secondary>
59443 </indexterm>
59444 <indexterm role="option">
59445 <primary><option>message_id_header_text</option></primary>
59446 </indexterm>
59447 If a locally-generated or submission-mode incoming message does not contain a
59448 <emphasis>Message-ID:</emphasis> or <emphasis>Resent-Message-ID:</emphasis> header line, and the
59449 <option>suppress_local_fixups</option> control is not set, Exim adds a suitable header line
59450 to the message. If there are any <emphasis>Resent-:</emphasis> headers in the message, it
59451 creates <emphasis>Resent-Message-ID:</emphasis>. The id is constructed from Exim&#x2019;s internal
59452 message id, preceded by the letter E to ensure it starts with a letter, and
59453 followed by @ and the primary host name. Additional information can be included
59454 in this header line by setting the <option>message_id_header_text</option> and/or
59455 <option>message_id_header_domain</option> options.
59456 </para>
59457 </section>
59458 <section id="SECID227">
59459 <title>The Received: header line</title>
59460 <para>
59461 <indexterm role="concept">
59462 <primary><emphasis>Received:</emphasis> header line</primary>
59463 </indexterm>
59464 A <emphasis>Received:</emphasis> header line is added at the start of every message. The
59465 contents are defined by the <option>received_header_text</option> configuration option, and
59466 Exim automatically adds a semicolon and a timestamp to the configured string.
59467 </para>
59468 <para>
59469 The <emphasis>Received:</emphasis> header is generated as soon as the message&#x2019;s header lines
59470 have been received. At this stage, the timestamp in the <emphasis>Received:</emphasis> header
59471 line is the time that the message started to be received. This is the value
59472 that is seen by the DATA ACL and by the <function>local_scan()</function> function.
59473 </para>
59474 <para>
59475 Once a message is accepted, the timestamp in the <emphasis>Received:</emphasis> header line is
59476 changed to the time of acceptance, which is (apart from a small delay while the
59477 -H spool file is written) the earliest time at which delivery could start.
59478 </para>
59479 </section>
59480 <section id="SECID228">
59481 <title>The References: header line</title>
59482 <para>
59483 <indexterm role="concept">
59484 <primary><emphasis>References:</emphasis> header line</primary>
59485 </indexterm>
59486 Messages created by the <command>autoreply</command> transport include a <emphasis>References:</emphasis>
59487 header line. This is constructed according to the rules that are described in
59488 section 3.64 of RFC 2822 (which states that replies should contain such a
59489 header line), and section 3.14 of RFC 3834 (which states that automatic
59490 responses are not different in this respect). However, because some mail
59491 processing software does not cope well with very long header lines, no more
59492 than 12 message IDs are copied from the <emphasis>References:</emphasis> header line in the
59493 incoming message. If there are more than 12, the first one and then the final
59494 11 are copied, before adding the message ID of the incoming message.
59495 </para>
59496 </section>
59497 <section id="SECID229">
59498 <title>The Return-path: header line</title>
59499 <para>
59500 <indexterm role="concept">
59501 <primary><emphasis>Return-path:</emphasis> header line</primary>
59502 </indexterm>
59503 <indexterm role="option">
59504 <primary><option>return_path_remove</option></primary>
59505 </indexterm>
59506 <emphasis>Return-path:</emphasis> header lines are defined as something an MTA may insert when
59507 it does the final delivery of messages. (See the generic <option>return_path_add</option>
59508 transport option.) Therefore, they should not be present in messages in
59509 transit. If the <option>return_path_remove</option> configuration option is set (the
59510 default), Exim removes <emphasis>Return-path:</emphasis> header lines from incoming messages.
59511 </para>
59512 </section>
59513 <section id="SECTthesenhea">
59514 <title>The Sender: header line</title>
59515 <para>
59516 <indexterm role="concept">
59517 <primary><emphasis>Sender:</emphasis> header line</primary>
59518 </indexterm>
59519 <indexterm role="concept">
59520 <primary>message</primary>
59521 <secondary>submission</secondary>
59522 </indexterm>
59523 For a locally-originated message from an untrusted user, Exim may remove an
59524 existing <emphasis>Sender:</emphasis> header line, and it may add a new one. You can modify
59525 these actions by setting the <option>local_sender_retain</option> option true, the
59526 <option>local_from_check</option> option false, or by using the <option>suppress_local_fixups</option>
59527 control setting.
59528 </para>
59529 <para>
59530 When a local message is received from an untrusted user and
59531 <option>local_from_check</option> is true (the default), and the <option>suppress_local_fixups</option>
59532 control has not been set, a check is made to see if the address given in the
59533 <emphasis>From:</emphasis> header line is the correct (local) sender of the message. The address
59534 that is expected has the login name as the local part and the value of
59535 <option>qualify_domain</option> as the domain. Prefixes and suffixes for the local part can
59536 be permitted by setting <option>local_from_prefix</option> and <option>local_from_suffix</option>
59537 appropriately. If <emphasis>From:</emphasis> does not contain the correct sender, a <emphasis>Sender:</emphasis>
59538 line is added to the message.
59539 </para>
59540 <para>
59541 If you set <option>local_from_check</option> false, this checking does not occur. However,
59542 the removal of an existing <emphasis>Sender:</emphasis> line still happens, unless you also set
59543 <option>local_sender_retain</option> to be true. It is not possible to set both of these
59544 options true at the same time.
59545 </para>
59546 <para>
59547 <indexterm role="concept">
59548 <primary>submission mode</primary>
59549 </indexterm>
59550 By default, no processing of <emphasis>Sender:</emphasis> header lines is done for messages
59551 received over TCP/IP or for messages submitted by trusted users. However, when
59552 a message is received over TCP/IP in submission mode, and <option>sender_retain</option> is
59553 not specified on the submission control, the following processing takes place:
59554 </para>
59555 <para>
59556 <indexterm role="variable">
59557 <primary><varname>$authenticated_id</varname></primary>
59558 </indexterm>
59559 First, any existing <emphasis>Sender:</emphasis> lines are removed. Then, if the SMTP session is
59560 authenticated, and <varname>$authenticated_id</varname> is not empty, a sender address is
59561 created as follows:
59562 </para>
59563 <itemizedlist>
59564 <listitem>
59565 <para>
59566 <indexterm role="variable">
59567 <primary><varname>$qualify_domain</varname></primary>
59568 </indexterm>
59569 If no domain is specified by the submission control, the local part is
59570 <varname>$authenticated_id</varname> and the domain is <varname>$qualify_domain</varname>.
59571 </para>
59572 </listitem>
59573 <listitem>
59574 <para>
59575 If a non-empty domain is specified by the submission control, the local part
59576 is <varname>$authenticated_id</varname>, and the domain is the specified domain.
59577 </para>
59578 </listitem>
59579 <listitem>
59580 <para>
59581 If an empty domain is specified by the submission control,
59582 <varname>$authenticated_id</varname> is assumed to be the complete address.
59583 </para>
59584 </listitem>
59585 </itemizedlist>
59586 <para>
59587 This address is compared with the address in the <emphasis>From:</emphasis> header line. If they
59588 are different, a <emphasis>Sender:</emphasis> header line containing the created address is
59589 added. Prefixes and suffixes for the local part in <emphasis>From:</emphasis> can be permitted
59590 by setting <option>local_from_prefix</option> and <option>local_from_suffix</option> appropriately.
59591 </para>
59592 <para>
59593 <indexterm role="concept">
59594 <primary>return path</primary>
59595 <secondary>created from <emphasis>Sender:</emphasis></secondary>
59596 </indexterm>
59597 <emphasis role="bold">Note</emphasis>: Whenever a <emphasis>Sender:</emphasis> header line is created, the return path for
59598 the message (the envelope sender address) is changed to be the same address,
59599 except in the case of submission mode when <option>sender_retain</option> is specified.
59600 </para>
59601 </section>
59602 <section id="SECTheadersaddrem">
59603 <title>Adding and removing header lines in routers and transports</title>
59604 <para>
59605 <indexterm role="concept">
59606 <primary>header lines</primary>
59607 <secondary>adding; in router or transport</secondary>
59608 </indexterm>
59609 <indexterm role="concept">
59610 <primary>header lines</primary>
59611 <secondary>removing; in router or transport</secondary>
59612 </indexterm>
59613 When a message is delivered, the addition and removal of header lines can be
59614 specified in a system filter, or on any of the routers and transports that
59615 process the message. Section <xref linkend="SECTaddremheasys"/> contains details about
59616 modifying headers in a system filter. Header lines can also be added in an ACL
59617 as a message is received (see section <xref linkend="SECTaddheadacl"/>).
59618 </para>
59619 <para>
59620 In contrast to what happens in a system filter, header modifications that are
59621 specified on routers and transports apply only to the particular recipient
59622 addresses that are being processed by those routers and transports. These
59623 changes do not actually take place until a copy of the message is being
59624 transported. Therefore, they do not affect the basic set of header lines, and
59625 they do not affect the values of the variables that refer to header lines.
59626 </para>
59627 <para>
59628 <emphasis role="bold">Note</emphasis>: In particular, this means that any expansions in the configuration of
59629 the transport cannot refer to the modified header lines, because such
59630 expansions all occur before the message is actually transported.
59631 </para>
59632 <para>
59633 For both routers and transports, the argument of a <option>headers_add</option>
59634 option must be in the form of one or more RFC 2822 header lines, separated by
59635 newlines (coded as <quote>\n</quote>). For example:
59636 </para>
59637 <literallayout class="monospaced">
59638 headers_add = X-added-header: added by $primary_hostname\n\
59639               X-added-second: another added header line
59640 </literallayout>
59641 <para>
59642 Exim does not check the syntax of these added header lines.
59643 </para>
59644 <para>
59645 Multiple <option>headers_add</option> options for a single router or transport can be
59646 specified; the values will append to a single list of header lines.
59647 Each header-line is separately expanded.
59648 </para>
59649 <para>
59650 The argument of a <option>headers_remove</option> option must consist of a colon-separated
59651 list of header names. This is confusing, because header names themselves are
59652 often terminated by colons. In this case, the colons are the list separators,
59653 not part of the names. For example:
59654 </para>
59655 <literallayout class="monospaced">
59656 headers_remove = return-receipt-to:acknowledge-to
59657 </literallayout>
59658 <para>
59659 Multiple <option>headers_remove</option> options for a single router or transport can be
59660 specified; the arguments will append to a single header-names list.
59661 Each item is separately expanded.
59662 </para>
59663 <para>
59664 When <option>headers_add</option> or <option>headers_remove</option> is specified on a router,
59665 items are expanded at routing time,
59666 and then associated with all addresses that are
59667 accepted by that router, and also with any new addresses that it generates. If
59668 an address passes through several routers as a result of aliasing or
59669 forwarding, the changes are cumulative.
59670 </para>
59671 <para>
59672 <indexterm role="option">
59673 <primary><option>unseen</option></primary>
59674 </indexterm>
59675 However, this does not apply to multiple routers that result from the use of
59676 the <option>unseen</option> option. Any header modifications that were specified by the
59677 <quote>unseen</quote> router or its predecessors apply only to the <quote>unseen</quote> delivery.
59678 </para>
59679 <para>
59680 Addresses that end up with different <option>headers_add</option> or <option>headers_remove</option>
59681 settings cannot be delivered together in a batch, so a transport is always
59682 dealing with a set of addresses that have the same header-processing
59683 requirements.
59684 </para>
59685 <para>
59686 The transport starts by writing the original set of header lines that arrived
59687 with the message, possibly modified by the system filter. As it writes out
59688 these lines, it consults the list of header names that were attached to the
59689 recipient address(es) by <option>headers_remove</option> options in routers, and it also
59690 consults the transport&#x2019;s own <option>headers_remove</option> option. Header lines whose
59691 names are on either of these lists are not written out. If there are multiple
59692 instances of any listed header, they are all skipped.
59693 </para>
59694 <para>
59695 After the remaining original header lines have been written, new header
59696 lines that were specified by routers&#x2019; <option>headers_add</option> options are written, in
59697 the order in which they were attached to the address. These are followed by any
59698 header lines specified by the transport&#x2019;s <option>headers_add</option> option.
59699 </para>
59700 <para>
59701 This way of handling header line modifications in routers and transports has
59702 the following consequences:
59703 </para>
59704 <itemizedlist>
59705 <listitem>
59706 <para>
59707 The original set of header lines, possibly modified by the system filter,
59708 remains <quote>visible</quote>, in the sense that the <varname>$header_</varname><emphasis>xxx</emphasis> variables refer
59709 to it, at all times.
59710 </para>
59711 </listitem>
59712 <listitem>
59713 <para>
59714 Header lines that are added by a router&#x2019;s
59715 <option>headers_add</option> option are not accessible by means of the <varname>$header_</varname><emphasis>xxx</emphasis>
59716 expansion syntax in subsequent routers or the transport.
59717 </para>
59718 </listitem>
59719 <listitem>
59720 <para>
59721 Conversely, header lines that are specified for removal by <option>headers_remove</option>
59722 in a router remain visible to subsequent routers and the transport.
59723 </para>
59724 </listitem>
59725 <listitem>
59726 <para>
59727 Headers added to an address by <option>headers_add</option> in a router cannot be removed by
59728 a later router or by a transport.
59729 </para>
59730 </listitem>
59731 <listitem>
59732 <para>
59733 An added header can refer to the contents of an original header that is to be
59734 removed, even it has the same name as the added header. For example:
59735 </para>
59736 <literallayout class="monospaced">
59737 headers_remove = subject
59738 headers_add = Subject: new subject (was: $h_subject:)
59739 </literallayout>
59740 </listitem>
59741 </itemizedlist>
59742 <para>
59743 <emphasis role="bold">Warning</emphasis>: The <option>headers_add</option> and <option>headers_remove</option> options cannot be used
59744 for a <command>redirect</command> router that has the <option>one_time</option> option set.
59745 </para>
59746 </section>
59747 <section id="SECTconstr">
59748 <title>Constructed addresses</title>
59749 <para>
59750 <indexterm role="concept">
59751 <primary>address</primary>
59752 <secondary>constructed</secondary>
59753 </indexterm>
59754 <indexterm role="concept">
59755 <primary>constructed address</primary>
59756 </indexterm>
59757 When Exim constructs a sender address for a locally-generated message, it uses
59758 the form
59759 </para>
59760 <literallayout>
59761 &lt;<emphasis>user name</emphasis>&gt;&nbsp;&nbsp;&lt;<emphasis>login</emphasis><literal>@</literal><emphasis>qualify_domain</emphasis>&gt;
59762 </literallayout>
59763 <para>
59764 For example:
59765 </para>
59766 <literallayout class="monospaced">
59767 Zaphod Beeblebrox &lt;zaphod@end.univ.example&gt;
59768 </literallayout>
59769 <para>
59770 The user name is obtained from the <option>-F</option> command line option if set, or
59771 otherwise by looking up the calling user by <function>getpwuid()</function> and extracting the
59772 <quote>gecos</quote> field from the password entry. If the <quote>gecos</quote> field contains an
59773 ampersand character, this is replaced by the login name with the first letter
59774 upper cased, as is conventional in a number of operating systems. See the
59775 <option>gecos_name</option> option for a way to tailor the handling of the <quote>gecos</quote> field.
59776 The <option>unknown_username</option> option can be used to specify user names in cases when
59777 there is no password file entry.
59778 </para>
59779 <para>
59780 <indexterm role="concept">
59781 <primary>RFC 2047</primary>
59782 </indexterm>
59783 In all cases, the user name is made to conform to RFC 2822 by quoting all or
59784 parts of it if necessary. In addition, if it contains any non-printing
59785 characters, it is encoded as described in RFC 2047, which defines a way of
59786 including non-ASCII characters in header lines. The value of the
59787 <option>headers_charset</option> option specifies the name of the encoding that is used (the
59788 characters are assumed to be in this encoding). The setting of
59789 <option>print_topbitchars</option> controls whether characters with the top bit set (that
59790 is, with codes greater than 127) count as printing characters or not.
59791 </para>
59792 </section>
59793 <section id="SECID230">
59794 <title>Case of local parts</title>
59795 <para>
59796 <indexterm role="concept">
59797 <primary>case of local parts</primary>
59798 </indexterm>
59799 <indexterm role="concept">
59800 <primary>local part</primary>
59801 <secondary>case of</secondary>
59802 </indexterm>
59803 RFC 2822 states that the case of letters in the local parts of addresses cannot
59804 be assumed to be non-significant. Exim preserves the case of local parts of
59805 addresses, but by default it uses a lower-cased form when it is routing,
59806 because on most Unix systems, usernames are in lower case and case-insensitive
59807 routing is required. However, any particular router can be made to use the
59808 original case for local parts by setting the <option>caseful_local_part</option> generic
59809 router option.
59810 </para>
59811 <para>
59812 <indexterm role="concept">
59813 <primary>mixed-case login names</primary>
59814 </indexterm>
59815 If you must have mixed-case user names on your system, the best way to proceed,
59816 assuming you want case-independent handling of incoming email, is to set up
59817 your first router to convert incoming local parts in your domains to the
59818 correct case by means of a file lookup. For example:
59819 </para>
59820 <literallayout class="monospaced">
59821 correct_case:
59822   driver = redirect
59823   domains = +local_domains
59824   data = ${lookup{$local_part}cdb\
59825               {/etc/usercased.cdb}{$value}fail}\
59826               @$domain
59827 </literallayout>
59828 <para>
59829 For this router, the local part is forced to lower case by the default action
59830 (<option>caseful_local_part</option> is not set). The lower-cased local part is used to look
59831 up a new local part in the correct case. If you then set <option>caseful_local_part</option>
59832 on any subsequent routers which process your domains, they will operate on
59833 local parts with the correct case in a case-sensitive manner.
59834 </para>
59835 </section>
59836 <section id="SECID231">
59837 <title>Dots in local parts</title>
59838 <para>
59839 <indexterm role="concept">
59840 <primary>dot</primary>
59841 <secondary>in local part</secondary>
59842 </indexterm>
59843 <indexterm role="concept">
59844 <primary>local part</primary>
59845 <secondary>dots in</secondary>
59846 </indexterm>
59847 RFC 2822 forbids empty components in local parts. That is, an unquoted local
59848 part may not begin or end with a dot, nor have two consecutive dots in the
59849 middle. However, it seems that many MTAs do not enforce this, so Exim permits
59850 empty components for compatibility.
59851 </para>
59852 </section>
59853 <section id="SECID232">
59854 <title>Rewriting addresses</title>
59855 <para>
59856 <indexterm role="concept">
59857 <primary>rewriting</primary>
59858 <secondary>addresses</secondary>
59859 </indexterm>
59860 Rewriting of sender and recipient addresses, and addresses in headers, can
59861 happen automatically, or as the result of configuration options, as described
59862 in chapter <xref linkend="CHAPrewrite"/>. The headers that may be affected by this are
59863 <emphasis>Bcc:</emphasis>, <emphasis>Cc:</emphasis>, <emphasis>From:</emphasis>, <emphasis>Reply-To:</emphasis>, <emphasis>Sender:</emphasis>, and <emphasis>To:</emphasis>.
59864 </para>
59865 <para>
59866 Automatic rewriting includes qualification, as mentioned above. The other case
59867 in which it can happen is when an incomplete non-local domain is given. The
59868 routing process may cause this to be expanded into the full domain name. For
59869 example, a header such as
59870 </para>
59871 <literallayout class="monospaced">
59872 To: hare@teaparty
59873 </literallayout>
59874 <para>
59875 might get rewritten as
59876 </para>
59877 <literallayout class="monospaced">
59878 To: hare@teaparty.wonderland.fict.example
59879 </literallayout>
59880 <para>
59881 Rewriting as a result of routing is the one kind of message processing that
59882 does not happen at input time, as it cannot be done until the address has
59883 been routed.
59884 </para>
59885 <para>
59886 Strictly, one should not do <emphasis>any</emphasis> deliveries of a message until all its
59887 addresses have been routed, in case any of the headers get changed as a
59888 result of routing. However, doing this in practice would hold up many
59889 deliveries for unreasonable amounts of time, just because one address could not
59890 immediately be routed. Exim therefore does not delay other deliveries when
59891 routing of one or more addresses is deferred.
59892 <indexterm role="concept" startref="IIDmesproc" class="endofrange"/>
59893 </para>
59894 </section>
59895 </chapter>
59896
59897 <chapter id="CHAPSMTP">
59898 <title>SMTP processing</title>
59899 <para>
59900 <indexterm role="concept" id="IIDsmtpproc1" class="startofrange">
59901 <primary>SMTP</primary>
59902 <secondary>processing details</secondary>
59903 </indexterm>
59904 <indexterm role="concept" id="IIDsmtpproc2" class="startofrange">
59905 <primary>LMTP</primary>
59906 <secondary>processing details</secondary>
59907 </indexterm>
59908 Exim supports a number of different ways of using the SMTP protocol, and its
59909 LMTP variant, which is an interactive protocol for transferring messages into a
59910 closed mail store application. This chapter contains details of how SMTP is
59911 processed. For incoming mail, the following are available:
59912 </para>
59913 <itemizedlist>
59914 <listitem>
59915 <para>
59916 SMTP over TCP/IP (Exim daemon or <emphasis>inetd</emphasis>);
59917 </para>
59918 </listitem>
59919 <listitem>
59920 <para>
59921 SMTP over the standard input and output (the <option>-bs</option> option);
59922 </para>
59923 </listitem>
59924 <listitem>
59925 <para>
59926 Batched SMTP on the standard input (the <option>-bS</option> option).
59927 </para>
59928 </listitem>
59929 </itemizedlist>
59930 <para>
59931 For mail delivery, the following are available:
59932 </para>
59933 <itemizedlist>
59934 <listitem>
59935 <para>
59936 SMTP over TCP/IP (the <command>smtp</command> transport);
59937 </para>
59938 </listitem>
59939 <listitem>
59940 <para>
59941 LMTP over TCP/IP (the <command>smtp</command> transport with the <option>protocol</option> option set to
59942 <quote>lmtp</quote>);
59943 </para>
59944 </listitem>
59945 <listitem>
59946 <para>
59947 LMTP over a pipe to a process running in the local host (the <command>lmtp</command>
59948 transport);
59949 </para>
59950 </listitem>
59951 <listitem>
59952 <para>
59953 Batched SMTP to a file or pipe (the <command>appendfile</command> and <command>pipe</command> transports with
59954 the <option>use_bsmtp</option> option set).
59955 </para>
59956 </listitem>
59957 </itemizedlist>
59958 <para>
59959 <emphasis>Batched SMTP</emphasis> is the name for a process in which batches of messages are
59960 stored in or read from files (or pipes), in a format in which SMTP commands are
59961 used to contain the envelope information.
59962 </para>
59963 <section id="SECToutSMTPTCP">
59964 <title>Outgoing SMTP and LMTP over TCP/IP</title>
59965 <para>
59966 <indexterm role="concept">
59967 <primary>SMTP</primary>
59968 <secondary>outgoing over TCP/IP</secondary>
59969 </indexterm>
59970 <indexterm role="concept">
59971 <primary>outgoing SMTP over TCP/IP</primary>
59972 </indexterm>
59973 <indexterm role="concept">
59974 <primary>LMTP</primary>
59975 <secondary>over TCP/IP</secondary>
59976 </indexterm>
59977 <indexterm role="concept">
59978 <primary>outgoing LMTP over TCP/IP</primary>
59979 </indexterm>
59980 <indexterm role="concept">
59981 <primary>EHLO</primary>
59982 </indexterm>
59983 <indexterm role="concept">
59984 <primary>HELO</primary>
59985 </indexterm>
59986 <indexterm role="concept">
59987 <primary>SIZE option on MAIL command</primary>
59988 </indexterm>
59989 Outgoing SMTP and LMTP over TCP/IP is implemented by the <command>smtp</command> transport.
59990 The <option>protocol</option> option selects which protocol is to be used, but the actual
59991 processing is the same in both cases.
59992 </para>
59993 <para>
59994 If, in response to its EHLO command, Exim is told that the SIZE
59995 parameter is supported, it adds SIZE=&lt;<emphasis>n</emphasis>&gt; to each subsequent MAIL
59996 command. The value of &lt;<emphasis>n</emphasis>&gt; is the message size plus the value of the
59997 <option>size_addition</option> option (default 1024) to allow for additions to the message
59998 such as per-transport header lines, or changes made in a
59999 <indexterm role="concept">
60000 <primary>transport</primary>
60001 <secondary>filter</secondary>
60002 </indexterm>
60003 <indexterm role="concept">
60004 <primary>filter</primary>
60005 <secondary>transport filter</secondary>
60006 </indexterm>
60007 transport filter. If <option>size_addition</option> is set negative, the use of SIZE is
60008 suppressed.
60009 </para>
60010 <para>
60011 If the remote server advertises support for PIPELINING, Exim uses the
60012 pipelining extension to SMTP (RFC 2197) to reduce the number of TCP/IP packets
60013 required for the transaction.
60014 </para>
60015 <para>
60016 If the remote server advertises support for the STARTTLS command, and Exim
60017 was built to support TLS encryption, it tries to start a TLS session unless the
60018 server matches <option>hosts_avoid_tls</option>. See chapter <xref linkend="CHAPTLS"/> for more details.
60019 Either a match in that or <option>hosts_verify_avoid_tls</option> apply when the transport
60020 is called for verification.
60021 </para>
60022 <para>
60023 If the remote server advertises support for the AUTH command, Exim scans
60024 the authenticators configuration for any suitable client settings, as described
60025 in chapter <xref linkend="CHAPSMTPAUTH"/>.
60026 </para>
60027 <para>
60028 <indexterm role="concept">
60029 <primary>carriage return</primary>
60030 </indexterm>
60031 <indexterm role="concept">
60032 <primary>linefeed</primary>
60033 </indexterm>
60034 Responses from the remote host are supposed to be terminated by CR followed by
60035 LF. However, there are known to be hosts that do not send CR characters, so in
60036 order to be able to interwork with such hosts, Exim treats LF on its own as a
60037 line terminator.
60038 </para>
60039 <para>
60040 If a message contains a number of different addresses, all those with the same
60041 characteristics (for example, the same envelope sender) that resolve to the
60042 same set of hosts, in the same order, are sent in a single SMTP transaction,
60043 even if they are for different domains, unless there are more than the setting
60044 of the <option>max_rcpt</option>s option in the <command>smtp</command> transport allows, in which case
60045 they are split into groups containing no more than <option>max_rcpt</option>s addresses
60046 each. If <option>remote_max_parallel</option> is greater than one, such groups may be sent
60047 in parallel sessions. The order of hosts with identical MX values is not
60048 significant when checking whether addresses can be batched in this way.
60049 </para>
60050 <para>
60051 When the <command>smtp</command> transport suffers a temporary failure that is not
60052 message-related, Exim updates its transport-specific database, which contains
60053 records indexed by host name that remember which messages are waiting for each
60054 particular host. It also updates the retry database with new retry times.
60055 </para>
60056 <para>
60057 <indexterm role="concept">
60058 <primary>hints database</primary>
60059 <secondary>retry keys</secondary>
60060 </indexterm>
60061 Exim&#x2019;s retry hints are based on host name plus IP address, so if one address of
60062 a multi-homed host is broken, it will soon be skipped most of the time.
60063 See the next section for more detail about error handling.
60064 </para>
60065 <para>
60066 <indexterm role="concept">
60067 <primary>SMTP</primary>
60068 <secondary>passed connection</secondary>
60069 </indexterm>
60070 <indexterm role="concept">
60071 <primary>SMTP</primary>
60072 <secondary>batching over TCP/IP</secondary>
60073 </indexterm>
60074 When a message is successfully delivered over a TCP/IP SMTP connection, Exim
60075 looks in the hints database for the transport to see if there are any queued
60076 messages waiting for the host to which it is connected. If it finds one, it
60077 creates a new Exim process using the <option>-MC</option> option (which can only be used by
60078 a process running as root or the Exim user) and passes the TCP/IP socket to it
60079 so that it can deliver another message using the same socket. The new process
60080 does only those deliveries that are routed to the connected host, and may in
60081 turn pass the socket on to a third process, and so on.
60082 </para>
60083 <para>
60084 The <option>connection_max_messages</option> option of the <command>smtp</command> transport can be used to
60085 limit the number of messages sent down a single TCP/IP connection.
60086 </para>
60087 <para>
60088 <indexterm role="concept">
60089 <primary>asterisk</primary>
60090 <secondary>after IP address</secondary>
60091 </indexterm>
60092 The second and subsequent messages delivered down an existing connection are
60093 identified in the main log by the addition of an asterisk after the closing
60094 square bracket of the IP address.
60095 </para>
60096 </section>
60097 <section id="SECToutSMTPerr">
60098 <title>Errors in outgoing SMTP</title>
60099 <para>
60100 <indexterm role="concept">
60101 <primary>error</primary>
60102 <secondary>in outgoing SMTP</secondary>
60103 </indexterm>
60104 <indexterm role="concept">
60105 <primary>SMTP</primary>
60106 <secondary>errors in outgoing</secondary>
60107 </indexterm>
60108 <indexterm role="concept">
60109 <primary>host</primary>
60110 <secondary>error</secondary>
60111 </indexterm>
60112 Three different kinds of error are recognized for outgoing SMTP: host errors,
60113 message errors, and recipient errors.
60114 </para>
60115 <variablelist>
60116 <varlistentry>
60117 <term><emphasis role="bold">Host errors</emphasis></term>
60118 <listitem>
60119 <para>
60120 A host error is not associated with a particular message or with a
60121 particular recipient of a message. The host errors are:
60122 </para>
60123 <itemizedlist>
60124 <listitem>
60125 <para>
60126 Connection refused or timed out,
60127 </para>
60128 </listitem>
60129 <listitem>
60130 <para>
60131 Any error response code on connection,
60132 </para>
60133 </listitem>
60134 <listitem>
60135 <para>
60136 Any error response code to EHLO or HELO,
60137 </para>
60138 </listitem>
60139 <listitem>
60140 <para>
60141 Loss of connection at any time, except after <quote>.</quote>,
60142 </para>
60143 </listitem>
60144 <listitem>
60145 <para>
60146 I/O errors at any time,
60147 </para>
60148 </listitem>
60149 <listitem>
60150 <para>
60151 Timeouts during the session, other than in response to MAIL, RCPT or
60152 the <quote>.</quote> at the end of the data.
60153 </para>
60154 </listitem>
60155 </itemizedlist>
60156 <para>
60157 For a host error, a permanent error response on connection, or in response to
60158 EHLO, causes all addresses routed to the host to be failed. Any other host
60159 error causes all addresses to be deferred, and retry data to be created for the
60160 host. It is not tried again, for any message, until its retry time arrives. If
60161 the current set of addresses are not all delivered in this run (to some
60162 alternative host), the message is added to the list of those waiting for this
60163 host, so if it is still undelivered when a subsequent successful delivery is
60164 made to the host, it will be sent down the same SMTP connection.
60165 </para>
60166 </listitem></varlistentry>
60167 <varlistentry>
60168 <term><emphasis role="bold">Message errors</emphasis></term>
60169 <listitem>
60170 <para>
60171 <indexterm role="concept">
60172 <primary>message</primary>
60173 <secondary>error</secondary>
60174 </indexterm>
60175 A message error is associated with a particular message when sent to a
60176 particular host, but not with a particular recipient of the message. The
60177 message errors are:
60178 </para>
60179 <itemizedlist>
60180 <listitem>
60181 <para>
60182 Any error response code to MAIL, DATA, or the <quote>.</quote> that terminates
60183 the data,
60184 </para>
60185 </listitem>
60186 <listitem>
60187 <para>
60188 Timeout after MAIL,
60189 </para>
60190 </listitem>
60191 <listitem>
60192 <para>
60193 Timeout or loss of connection after the <quote>.</quote> that terminates the data. A
60194 timeout after the DATA command itself is treated as a host error, as is loss of
60195 connection at any other time.
60196 </para>
60197 </listitem>
60198 </itemizedlist>
60199 <para>
60200 For a message error, a permanent error response (5<emphasis>xx</emphasis>) causes all addresses
60201 to be failed, and a delivery error report to be returned to the sender. A
60202 temporary error response (4<emphasis>xx</emphasis>), or one of the timeouts, causes all
60203 addresses to be deferred. Retry data is not created for the host, but instead,
60204 a retry record for the combination of host plus message id is created. The
60205 message is not added to the list of those waiting for this host. This ensures
60206 that the failing message will not be sent to this host again until the retry
60207 time arrives. However, other messages that are routed to the host are not
60208 affected, so if it is some property of the message that is causing the error,
60209 it will not stop the delivery of other mail.
60210 </para>
60211 <para>
60212 If the remote host specified support for the SIZE parameter in its response
60213 to EHLO, Exim adds SIZE=<emphasis>nnn</emphasis> to the MAIL command, so an
60214 over-large message will cause a message error because the error arrives as a
60215 response to MAIL.
60216 </para>
60217 </listitem></varlistentry>
60218 <varlistentry>
60219 <term><emphasis role="bold">Recipient errors</emphasis></term>
60220 <listitem>
60221 <para>
60222 <indexterm role="concept">
60223 <primary>recipient</primary>
60224 <secondary>error</secondary>
60225 </indexterm>
60226 A recipient error is associated with a particular recipient of a message. The
60227 recipient errors are:
60228 </para>
60229 <itemizedlist>
60230 <listitem>
60231 <para>
60232 Any error response to RCPT,
60233 </para>
60234 </listitem>
60235 <listitem>
60236 <para>
60237 Timeout after RCPT.
60238 </para>
60239 </listitem>
60240 </itemizedlist>
60241 <para>
60242 For a recipient error, a permanent error response (5<emphasis>xx</emphasis>) causes the
60243 recipient address to be failed, and a bounce message to be returned to the
60244 sender. A temporary error response (4<emphasis>xx</emphasis>) or a timeout causes the failing
60245 address to be deferred, and routing retry data to be created for it. This is
60246 used to delay processing of the address in subsequent queue runs, until its
60247 routing retry time arrives. This applies to all messages, but because it
60248 operates only in queue runs, one attempt will be made to deliver a new message
60249 to the failing address before the delay starts to operate. This ensures that,
60250 if the failure is really related to the message rather than the recipient
60251 (<quote>message too big for this recipient</quote> is a possible example), other messages
60252 have a chance of getting delivered. If a delivery to the address does succeed,
60253 the retry information gets cleared, so all stuck messages get tried again, and
60254 the retry clock is reset.
60255 </para>
60256 <para>
60257 The message is not added to the list of those waiting for this host. Use of the
60258 host for other messages is unaffected, and except in the case of a timeout,
60259 other recipients are processed independently, and may be successfully delivered
60260 in the current SMTP session. After a timeout it is of course impossible to
60261 proceed with the session, so all addresses get deferred. However, those other
60262 than the one that failed do not suffer any subsequent retry delays. Therefore,
60263 if one recipient is causing trouble, the others have a chance of getting
60264 through when a subsequent delivery attempt occurs before the failing
60265 recipient&#x2019;s retry time.
60266 </para>
60267 </listitem></varlistentry>
60268 </variablelist>
60269 <para>
60270 In all cases, if there are other hosts (or IP addresses) available for the
60271 current set of addresses (for example, from multiple MX records), they are
60272 tried in this run for any undelivered addresses, subject of course to their
60273 own retry data. In other words, recipient error retry data does not take effect
60274 until the next delivery attempt.
60275 </para>
60276 <para>
60277 Some hosts have been observed to give temporary error responses to every
60278 MAIL command at certain times (<quote>insufficient space</quote> has been seen). It
60279 would be nice if such circumstances could be recognized, and defer data for the
60280 host itself created, but this is not possible within the current Exim design.
60281 What actually happens is that retry data for every (host, message) combination
60282 is created.
60283 </para>
60284 <para>
60285 The reason that timeouts after MAIL and RCPT are treated specially is that
60286 these can sometimes arise as a result of the remote host&#x2019;s verification
60287 procedures. Exim makes this assumption, and treats them as if a temporary error
60288 response had been received. A timeout after <quote>.</quote> is treated specially because
60289 it is known that some broken implementations fail to recognize the end of the
60290 message if the last character of the last line is a binary zero. Thus, it is
60291 helpful to treat this case as a message error.
60292 </para>
60293 <para>
60294 Timeouts at other times are treated as host errors, assuming a problem with the
60295 host, or the connection to it. If a timeout after MAIL, RCPT,
60296 or <quote>.</quote> is really a connection problem, the assumption is that at the next try
60297 the timeout is likely to occur at some other point in the dialogue, causing it
60298 then to be treated as a host error.
60299 </para>
60300 <para>
60301 There is experimental evidence that some MTAs drop the connection after the
60302 terminating <quote>.</quote> if they do not like the contents of the message for some
60303 reason, in contravention of the RFC, which indicates that a 5<emphasis>xx</emphasis> response
60304 should be given. That is why Exim treats this case as a message rather than a
60305 host error, in order not to delay other messages to the same host.
60306 </para>
60307 </section>
60308 <section id="SECID233">
60309 <title>Incoming SMTP messages over TCP/IP</title>
60310 <para>
60311 <indexterm role="concept">
60312 <primary>SMTP</primary>
60313 <secondary>incoming over TCP/IP</secondary>
60314 </indexterm>
60315 <indexterm role="concept">
60316 <primary>incoming SMTP over TCP/IP</primary>
60317 </indexterm>
60318 <indexterm role="concept">
60319 <primary>inetd</primary>
60320 </indexterm>
60321 <indexterm role="concept">
60322 <primary>daemon</primary>
60323 </indexterm>
60324 Incoming SMTP messages can be accepted in one of two ways: by running a
60325 listening daemon, or by using <emphasis>inetd</emphasis>. In the latter case, the entry in
60326 <filename>/etc/inetd.conf</filename> should be like this:
60327 </para>
60328 <literallayout class="monospaced">
60329 smtp stream tcp nowait exim /opt/exim/bin/exim in.exim -bs
60330 </literallayout>
60331 <para>
60332 Exim distinguishes between this case and the case of a locally running user
60333 agent using the <option>-bs</option> option by checking whether or not the standard input is
60334 a socket. When it is, either the port must be privileged (less than 1024), or
60335 the caller must be root or the Exim user. If any other user passes a socket
60336 with an unprivileged port number, Exim prints a message on the standard error
60337 stream and exits with an error code.
60338 </para>
60339 <para>
60340 By default, Exim does not make a log entry when a remote host connects or
60341 disconnects (either via the daemon or <emphasis>inetd</emphasis>), unless the disconnection is
60342 unexpected. It can be made to write such log entries by setting the
60343 <option>smtp_connection</option> log selector.
60344 </para>
60345 <para>
60346 <indexterm role="concept">
60347 <primary>carriage return</primary>
60348 </indexterm>
60349 <indexterm role="concept">
60350 <primary>linefeed</primary>
60351 </indexterm>
60352 Commands from the remote host are supposed to be terminated by CR followed by
60353 LF. However, there are known to be hosts that do not send CR characters. In
60354 order to be able to interwork with such hosts, Exim treats LF on its own as a
60355 line terminator.
60356 Furthermore, because common code is used for receiving messages from all
60357 sources, a CR on its own is also interpreted as a line terminator. However, the
60358 sequence <quote>CR, dot, CR</quote> does not terminate incoming SMTP data.
60359 </para>
60360 <para>
60361 <indexterm role="concept">
60362 <primary>EHLO</primary>
60363 <secondary>invalid data</secondary>
60364 </indexterm>
60365 <indexterm role="concept">
60366 <primary>HELO</primary>
60367 <secondary>invalid data</secondary>
60368 </indexterm>
60369 One area that sometimes gives rise to problems concerns the EHLO or
60370 HELO commands. Some clients send syntactically invalid versions of these
60371 commands, which Exim rejects by default. (This is nothing to do with verifying
60372 the data that is sent, so <option>helo_verify_hosts</option> is not relevant.) You can tell
60373 Exim not to apply a syntax check by setting <option>helo_accept_junk_hosts</option> to
60374 match the broken hosts that send invalid commands.
60375 </para>
60376 <para>
60377 <indexterm role="concept">
60378 <primary>SIZE option on MAIL command</primary>
60379 </indexterm>
60380 <indexterm role="concept">
60381 <primary>MAIL</primary>
60382 <secondary>SIZE option</secondary>
60383 </indexterm>
60384 The amount of disk space available is checked whenever SIZE is received on
60385 a MAIL command, independently of whether <option>message_size_limit</option> or
60386 <option>check_spool_space</option> is configured, unless <option>smtp_check_spool_space</option> is set
60387 false. A temporary error is given if there is not enough space. If
60388 <option>check_spool_space</option> is set, the check is for that amount of space plus the
60389 value given with SIZE, that is, it checks that the addition of the incoming
60390 message will not reduce the space below the threshold.
60391 </para>
60392 <para>
60393 When a message is successfully received, Exim includes the local message id in
60394 its response to the final <quote>.</quote> that terminates the data. If the remote host
60395 logs this text it can help with tracing what has happened to a message.
60396 </para>
60397 <para>
60398 The Exim daemon can limit the number of simultaneous incoming connections it is
60399 prepared to handle (see the <option>smtp_accept_max</option> option). It can also limit the
60400 number of simultaneous incoming connections from a single remote host (see the
60401 <option>smtp_accept_max_per_host</option> option). Additional connection attempts are
60402 rejected using the SMTP temporary error code 421.
60403 </para>
60404 <para>
60405 The Exim daemon does not rely on the SIGCHLD signal to detect when a
60406 subprocess has finished, as this can get lost at busy times. Instead, it looks
60407 for completed subprocesses every time it wakes up. Provided there are other
60408 things happening (new incoming calls, starts of queue runs), completed
60409 processes will be noticed and tidied away. On very quiet systems you may
60410 sometimes see a <quote>defunct</quote> Exim process hanging about. This is not a problem;
60411 it will be noticed when the daemon next wakes up.
60412 </para>
60413 <para>
60414 When running as a daemon, Exim can reserve some SMTP slots for specific hosts,
60415 and can also be set up to reject SMTP calls from non-reserved hosts at times of
60416 high system load &ndash; for details see the <option>smtp_accept_reserve</option>,
60417 <option>smtp_load_reserve</option>, and <option>smtp_reserve_hosts</option> options. The load check
60418 applies in both the daemon and <emphasis>inetd</emphasis> cases.
60419 </para>
60420 <para>
60421 Exim normally starts a delivery process for each message received, though this
60422 can be varied by means of the <option>-odq</option> command line option and the
60423 <option>queue_only</option>, <option>queue_only_file</option>, and <option>queue_only_load</option> options. The
60424 number of simultaneously running delivery processes started in this way from
60425 SMTP input can be limited by the <option>smtp_accept_queue</option> and
60426 <option>smtp_accept_queue_per_connection</option> options. When either limit is reached,
60427 subsequently received messages are just put on the input queue without starting
60428 a delivery process.
60429 </para>
60430 <para>
60431 The controls that involve counts of incoming SMTP calls (<option>smtp_accept_max</option>,
60432 <option>smtp_accept_queue</option>, <option>smtp_accept_reserve</option>) are not available when Exim is
60433 started up from the <emphasis>inetd</emphasis> daemon, because in that case each connection is
60434 handled by an entirely independent Exim process. Control by load average is,
60435 however, available with <emphasis>inetd</emphasis>.
60436 </para>
60437 <para>
60438 Exim can be configured to verify addresses in incoming SMTP commands as they
60439 are received. See chapter <xref linkend="CHAPACL"/> for details. It can also be configured
60440 to rewrite addresses at this time &ndash; before any syntax checking is done. See
60441 section <xref linkend="SECTrewriteS"/>.
60442 </para>
60443 <para>
60444 Exim can also be configured to limit the rate at which a client host submits
60445 MAIL and RCPT commands in a single SMTP session. See the
60446 <option>smtp_ratelimit_hosts</option> option.
60447 </para>
60448 </section>
60449 <section id="SECID234">
60450 <title>Unrecognized SMTP commands</title>
60451 <para>
60452 <indexterm role="concept">
60453 <primary>SMTP</primary>
60454 <secondary>unrecognized commands</secondary>
60455 </indexterm>
60456 If Exim receives more than <option>smtp_max_unknown_commands</option> unrecognized SMTP
60457 commands during a single SMTP connection, it drops the connection after sending
60458 the error response to the last command. The default value for
60459 <option>smtp_max_unknown_commands</option> is 3. This is a defence against some kinds of
60460 abuse that subvert web servers into making connections to SMTP ports; in these
60461 circumstances, a number of non-SMTP lines are sent first.
60462 </para>
60463 </section>
60464 <section id="SECID235">
60465 <title>Syntax and protocol errors in SMTP commands</title>
60466 <para>
60467 <indexterm role="concept">
60468 <primary>SMTP</primary>
60469 <secondary>syntax errors</secondary>
60470 </indexterm>
60471 <indexterm role="concept">
60472 <primary>SMTP</primary>
60473 <secondary>protocol errors</secondary>
60474 </indexterm>
60475 A syntax error is detected if an SMTP command is recognized, but there is
60476 something syntactically wrong with its data, for example, a malformed email
60477 address in a RCPT command. Protocol errors include invalid command
60478 sequencing such as RCPT before MAIL. If Exim receives more than
60479 <option>smtp_max_synprot_errors</option> such commands during a single SMTP connection, it
60480 drops the connection after sending the error response to the last command. The
60481 default value for <option>smtp_max_synprot_errors</option> is 3. This is a defence against
60482 broken clients that loop sending bad commands (yes, it has been seen).
60483 </para>
60484 </section>
60485 <section id="SECID236">
60486 <title>Use of non-mail SMTP commands</title>
60487 <para>
60488 <indexterm role="concept">
60489 <primary>SMTP</primary>
60490 <secondary>non-mail commands</secondary>
60491 </indexterm>
60492 The <quote>non-mail</quote> SMTP commands are those other than MAIL, RCPT, and
60493 DATA. Exim counts such commands, and drops the connection if there are too
60494 many of them in a single SMTP session. This action catches some
60495 denial-of-service attempts and things like repeated failing AUTHs, or a mad
60496 client looping sending EHLO. The global option <option>smtp_accept_max_nonmail</option>
60497 defines what <quote>too many</quote> means. Its default value is 10.
60498 </para>
60499 <para>
60500 When a new message is expected, one occurrence of RSET is not counted. This
60501 allows a client to send one RSET between messages (this is not necessary,
60502 but some clients do it). Exim also allows one uncounted occurrence of HELO
60503 or EHLO, and one occurrence of STARTTLS between messages. After
60504 starting up a TLS session, another EHLO is expected, and so it too is not
60505 counted.
60506 </para>
60507 <para>
60508 The first occurrence of AUTH in a connection, or immediately following
60509 STARTTLS is also not counted. Otherwise, all commands other than MAIL,
60510 RCPT, DATA, and QUIT are counted.
60511 </para>
60512 <para>
60513 You can control which hosts are subject to the limit set by
60514 <option>smtp_accept_max_nonmail</option> by setting
60515 <option>smtp_accept_max_nonmail_hosts</option>. The default value is <literal>*</literal>, which makes
60516 the limit apply to all hosts. This option means that you can exclude any
60517 specific badly-behaved hosts that you have to live with.
60518 </para>
60519 </section>
60520 <section id="SECID237">
60521 <title>The VRFY and EXPN commands</title>
60522 <para>
60523 When Exim receives a VRFY or EXPN command on a TCP/IP connection, it
60524 runs the ACL specified by <option>acl_smtp_vrfy</option> or <option>acl_smtp_expn</option> (as
60525 appropriate) in order to decide whether the command should be accepted or not.
60526 If no ACL is defined, the command is rejected.
60527 </para>
60528 <para>
60529 <indexterm role="concept">
60530 <primary>VRFY</primary>
60531 <secondary>processing</secondary>
60532 </indexterm>
60533 When VRFY is accepted, it runs exactly the same code as when Exim is
60534 called with the <option>-bv</option> option.
60535 </para>
60536 <para>
60537 <indexterm role="concept">
60538 <primary>EXPN</primary>
60539 <secondary>processing</secondary>
60540 </indexterm>
60541 When EXPN is accepted, a single-level expansion of the address is done.
60542 EXPN is treated as an <quote>address test</quote> (similar to the <option>-bt</option> option) rather
60543 than a verification (the <option>-bv</option> option). If an unqualified local part is given
60544 as the argument to EXPN, it is qualified with <option>qualify_domain</option>. Rejections
60545 of VRFY and EXPN commands are logged on the main and reject logs, and
60546 VRFY verification failures are logged on the main log for consistency with
60547 RCPT failures.
60548 </para>
60549 </section>
60550 <section id="SECTETRN">
60551 <title>The ETRN command</title>
60552 <para>
60553 <indexterm role="concept">
60554 <primary>ETRN</primary>
60555 <secondary>processing</secondary>
60556 </indexterm>
60557 RFC 1985 describes an SMTP command called ETRN that is designed to
60558 overcome the security problems of the TURN command (which has fallen into
60559 disuse). When Exim receives an ETRN command on a TCP/IP connection, it runs
60560 the ACL specified by <option>acl_smtp_etrn</option> in order to decide whether the command
60561 should be accepted or not. If no ACL is defined, the command is rejected.
60562 </para>
60563 <para>
60564 The ETRN command is concerned with <quote>releasing</quote> messages that are awaiting
60565 delivery to certain hosts. As Exim does not organize its message queue by host,
60566 the only form of ETRN that is supported by default is the one where the
60567 text starts with the <quote>#</quote> prefix, in which case the remainder of the text is
60568 specific to the SMTP server. A valid ETRN command causes a run of Exim with
60569 the <option>-R</option> option to happen, with the remainder of the ETRN text as its
60570 argument. For example,
60571 </para>
60572 <literallayout class="monospaced">
60573 ETRN #brigadoon
60574 </literallayout>
60575 <para>
60576 runs the command
60577 </para>
60578 <literallayout class="monospaced">
60579 exim -R brigadoon
60580 </literallayout>
60581 <para>
60582 which causes a delivery attempt on all messages with undelivered addresses
60583 containing the text <quote>brigadoon</quote>. When <option>smtp_etrn_serialize</option> is set (the
60584 default), Exim prevents the simultaneous execution of more than one queue run
60585 for the same argument string as a result of an ETRN command. This stops
60586 a misbehaving client from starting more than one queue runner at once.
60587 </para>
60588 <para>
60589 <indexterm role="concept">
60590 <primary>hints database</primary>
60591 <secondary>ETRN serialization</secondary>
60592 </indexterm>
60593 Exim implements the serialization by means of a hints database in which a
60594 record is written whenever a process is started by ETRN, and deleted when
60595 the process completes. However, Exim does not keep the SMTP session waiting for
60596 the ETRN process to complete. Once ETRN is accepted, the client is sent
60597 a <quote>success</quote> return code. Obviously there is scope for hints records to get
60598 left lying around if there is a system or program crash. To guard against this,
60599 Exim ignores any records that are more than six hours old.
60600 </para>
60601 <para>
60602 <indexterm role="option">
60603 <primary><option>smtp_etrn_command</option></primary>
60604 </indexterm>
60605 For more control over what ETRN does, the <option>smtp_etrn_command</option> option can
60606 used. This specifies a command that is run whenever ETRN is received,
60607 whatever the form of its argument. For
60608 example:
60609 </para>
60610 <literallayout class="monospaced">
60611 smtp_etrn_command = /etc/etrn_command $domain \
60612                     $sender_host_address
60613 </literallayout>
60614 <para>
60615 <indexterm role="variable">
60616 <primary><varname>$domain</varname></primary>
60617 </indexterm>
60618 The string is split up into arguments which are independently expanded. The
60619 expansion variable <varname>$domain</varname> is set to the argument of the ETRN command,
60620 and no syntax checking is done on the contents of this argument. Exim does not
60621 wait for the command to complete, so its status code is not checked. Exim runs
60622 under its own uid and gid when receiving incoming SMTP, so it is not possible
60623 for it to change them before running the command.
60624 </para>
60625 </section>
60626 <section id="SECID238">
60627 <title>Incoming local SMTP</title>
60628 <para>
60629 <indexterm role="concept">
60630 <primary>SMTP</primary>
60631 <secondary>local incoming</secondary>
60632 </indexterm>
60633 Some user agents use SMTP to pass messages to their local MTA using the
60634 standard input and output, as opposed to passing the envelope on the command
60635 line and writing the message to the standard input. This is supported by the
60636 <option>-bs</option> option. This form of SMTP is handled in the same way as incoming
60637 messages over TCP/IP (including the use of ACLs), except that the envelope
60638 sender given in a MAIL command is ignored unless the caller is trusted. In
60639 an ACL you can detect this form of SMTP input by testing for an empty host
60640 identification. It is common to have this as the first line in the ACL that
60641 runs for RCPT commands:
60642 </para>
60643 <literallayout class="monospaced">
60644 accept hosts = :
60645 </literallayout>
60646 <para>
60647 This accepts SMTP messages from local processes without doing any other tests.
60648 </para>
60649 </section>
60650 <section id="SECTbatchSMTP">
60651 <title>Outgoing batched SMTP</title>
60652 <para>
60653 <indexterm role="concept">
60654 <primary>SMTP</primary>
60655 <secondary>batched outgoing</secondary>
60656 </indexterm>
60657 <indexterm role="concept">
60658 <primary>batched SMTP output</primary>
60659 </indexterm>
60660 Both the <command>appendfile</command> and <command>pipe</command> transports can be used for handling
60661 batched SMTP. Each has an option called <option>use_bsmtp</option> which causes messages to
60662 be output in BSMTP format. No SMTP responses are possible for this form of
60663 delivery. All it is doing is using SMTP commands as a way of transmitting the
60664 envelope along with the message.
60665 </para>
60666 <para>
60667 The message is written to the file or pipe preceded by the SMTP commands
60668 MAIL and RCPT, and followed by a line containing a single dot. Lines in
60669 the message that start with a dot have an extra dot added. The SMTP command
60670 HELO is not normally used. If it is required, the <option>message_prefix</option> option
60671 can be used to specify it.
60672 </para>
60673 <para>
60674 Because <command>appendfile</command> and <command>pipe</command> are both local transports, they accept only
60675 one recipient address at a time by default. However, you can arrange for them
60676 to handle several addresses at once by setting the <option>batch_max</option> option. When
60677 this is done for BSMTP, messages may contain multiple RCPT commands. See
60678 chapter <xref linkend="CHAPbatching"/> for more details.
60679 </para>
60680 <para>
60681 <indexterm role="variable">
60682 <primary><varname>$host</varname></primary>
60683 </indexterm>
60684 When one or more addresses are routed to a BSMTP transport by a router that
60685 sets up a host list, the name of the first host on the list is available to the
60686 transport in the variable <varname>$host</varname>. Here is an example of such a transport and
60687 router:
60688 </para>
60689 <literallayout class="monospaced">
60690 begin routers
60691 route_append:
60692   driver = manualroute
60693   transport = smtp_appendfile
60694   route_list = domain.example  batch.host.example
60695
60696 begin transports
60697 smtp_appendfile:
60698   driver = appendfile
60699   directory = /var/bsmtp/$host
60700   batch_max = 1000
60701   use_bsmtp
60702   user = exim
60703 </literallayout>
60704 <para>
60705 This causes messages addressed to <emphasis>domain.example</emphasis> to be written in BSMTP
60706 format to <filename>/var/bsmtp/batch.host.example</filename>, with only a single copy of each
60707 message (unless there are more than 1000 recipients).
60708 </para>
60709 </section>
60710 <section id="SECTincomingbatchedSMTP">
60711 <title>Incoming batched SMTP</title>
60712 <para>
60713 <indexterm role="concept">
60714 <primary>SMTP</primary>
60715 <secondary>batched incoming</secondary>
60716 </indexterm>
60717 <indexterm role="concept">
60718 <primary>batched SMTP input</primary>
60719 </indexterm>
60720 The <option>-bS</option> command line option causes Exim to accept one or more messages by
60721 reading SMTP on the standard input, but to generate no responses. If the caller
60722 is trusted, the senders in the MAIL commands are believed; otherwise the
60723 sender is always the caller of Exim. Unqualified senders and receivers are not
60724 rejected (there seems little point) but instead just get qualified. HELO
60725 and EHLO act as RSET; VRFY, EXPN, ETRN and  HELP, act
60726 as NOOP; QUIT quits.
60727 </para>
60728 <para>
60729 Minimal policy checking is done for BSMTP input. Only the non-SMTP
60730 ACL is run in the same way as for non-SMTP local input.
60731 </para>
60732 <para>
60733 If an error is detected while reading a message, including a missing <quote>.</quote> at
60734 the end, Exim gives up immediately. It writes details of the error to the
60735 standard output in a stylized way that the calling program should be able to
60736 make some use of automatically, for example:
60737 </para>
60738 <literallayout class="monospaced">
60739 554 Unexpected end of file
60740 Transaction started in line 10
60741 Error detected in line 14
60742 </literallayout>
60743 <para>
60744 It writes a more verbose version, for human consumption, to the standard error
60745 file, for example:
60746 </para>
60747 <literallayout class="monospaced">
60748 An error was detected while processing a file of BSMTP input.
60749 The error message was:
60750
60751 501 '&gt;' missing at end of address
60752
60753 The SMTP transaction started in line 10.
60754 The error was detected in line 12.
60755 The SMTP command at fault was:
60756
60757 rcpt to:&lt;malformed@in.com.plete
60758
60759 1 previous message was successfully processed.
60760 The rest of the batch was abandoned.
60761 </literallayout>
60762 <para>
60763 The return code from Exim is zero only if there were no errors. It is 1 if some
60764 messages were accepted before an error was detected, and 2 if no messages were
60765 accepted.
60766 <indexterm role="concept" startref="IIDsmtpproc1" class="endofrange"/>
60767 <indexterm role="concept" startref="IIDsmtpproc2" class="endofrange"/>
60768 </para>
60769 </section>
60770 </chapter>
60771
60772 <chapter id="CHAPemsgcust">
60773 <title>Customizing bounce and warning messages</title>
60774 <titleabbrev>Customizing messages</titleabbrev>
60775 <para>
60776 When a message fails to be delivered, or remains on the queue for more than a
60777 configured amount of time, Exim sends a message to the original sender, or
60778 to an alternative configured address. The text of these messages is built into
60779 the code of Exim, but it is possible to change it, either by adding a single
60780 string, or by replacing each of the paragraphs by text supplied in a file.
60781 </para>
60782 <para>
60783 The <emphasis>From:</emphasis> and <emphasis>To:</emphasis> header lines are automatically generated; you can
60784 cause a <emphasis>Reply-To:</emphasis> line to be added by setting the <option>errors_reply_to</option>
60785 option. Exim also adds the line
60786 </para>
60787 <literallayout class="monospaced">
60788 Auto-Submitted: auto-generated
60789 </literallayout>
60790 <para>
60791 to all warning and bounce messages,
60792 </para>
60793 <section id="SECID239">
60794 <title>Customizing bounce messages</title>
60795 <para>
60796 <indexterm role="concept">
60797 <primary>customizing</primary>
60798 <secondary>bounce message</secondary>
60799 </indexterm>
60800 <indexterm role="concept">
60801 <primary>bounce message</primary>
60802 <secondary>customizing</secondary>
60803 </indexterm>
60804 If <option>bounce_message_text</option> is set, its contents are included in the default
60805 message immediately after <quote>This message was created automatically by mail
60806 delivery software.</quote> The string is not expanded. It is not used if
60807 <option>bounce_message_file</option> is set.
60808 </para>
60809 <para>
60810 When <option>bounce_message_file</option> is set, it must point to a template file for
60811 constructing error messages. The file consists of a series of text items,
60812 separated by lines consisting of exactly four asterisks. If the file cannot be
60813 opened, default text is used and a message is written to the main and panic
60814 logs. If any text item in the file is empty, default text is used for that
60815 item.
60816 </para>
60817 <para>
60818 <indexterm role="variable">
60819 <primary><varname>$bounce_recipient</varname></primary>
60820 </indexterm>
60821 <indexterm role="variable">
60822 <primary><varname>$bounce_return_size_limit</varname></primary>
60823 </indexterm>
60824 Each item of text that is read from the file is expanded, and there are two
60825 expansion variables which can be of use here: <varname>$bounce_recipient</varname> is set to
60826 the recipient of an error message while it is being created, and
60827 <varname>$bounce_return_size_limit</varname> contains the value of the <option>return_size_limit</option>
60828 option, rounded to a whole number.
60829 </para>
60830 <para>
60831 The items must appear in the file in the following order:
60832 </para>
60833 <itemizedlist>
60834 <listitem>
60835 <para>
60836 The first item is included in the headers, and should include at least a
60837 <emphasis>Subject:</emphasis> header. Exim does not check the syntax of these headers.
60838 </para>
60839 </listitem>
60840 <listitem>
60841 <para>
60842 The second item forms the start of the error message. After it, Exim lists the
60843 failing addresses with their error messages.
60844 </para>
60845 </listitem>
60846 <listitem>
60847 <para>
60848 The third item is used to introduce any text from pipe transports that is to be
60849 returned to the sender. It is omitted if there is no such text.
60850 </para>
60851 </listitem>
60852 <listitem>
60853 <para>
60854 The fourth item is used to introduce the copy of the message that is returned
60855 as part of the error report.
60856 </para>
60857 </listitem>
60858 <listitem>
60859 <para>
60860 The fifth item is added after the fourth one if the returned message is
60861 truncated because it is bigger than <option>return_size_limit</option>.
60862 </para>
60863 </listitem>
60864 <listitem>
60865 <para>
60866 The sixth item is added after the copy of the original message.
60867 </para>
60868 </listitem>
60869 </itemizedlist>
60870 <para>
60871 The default state (<option>bounce_message_file</option> unset) is equivalent to the
60872 following file, in which the sixth item is empty. The <emphasis>Subject:</emphasis> and some
60873 other lines have been split in order to fit them on the page:
60874 </para>
60875 <literallayout class="monospaced">
60876 Subject: Mail delivery failed
60877   ${if eq{$sender_address}{$bounce_recipient}
60878   {: returning message to sender}}
60879 ****
60880 This message was created automatically by mail delivery software.
60881
60882 A message ${if eq{$sender_address}{$bounce_recipient}
60883   {that you sent }{sent by
60884
60885 &lt;$sender_address&gt;
60886
60887 }}could not be delivered to all of its recipients.
60888 This is a permanent error. The following address(es) failed:
60889 ****
60890 The following text was generated during the delivery attempt(s):
60891 ****
60892 ------ This is a copy of the message, including all the headers.
60893   ------
60894 ****
60895 ------ The body of the message is $message_size characters long;
60896   only the first
60897 ------ $bounce_return_size_limit or so are included here.
60898 ****
60899 </literallayout>
60900 </section>
60901 <section id="SECTcustwarn">
60902 <title>Customizing warning messages</title>
60903 <para>
60904 <indexterm role="concept">
60905 <primary>customizing</primary>
60906 <secondary>warning message</secondary>
60907 </indexterm>
60908 <indexterm role="concept">
60909 <primary>warning of delay</primary>
60910 <secondary>customizing the message</secondary>
60911 </indexterm>
60912 The option <option>warn_message_file</option> can be pointed at a template file for use when
60913 warnings about message delays are created. In this case there are only three
60914 text sections:
60915 </para>
60916 <itemizedlist>
60917 <listitem>
60918 <para>
60919 The first item is included in the headers, and should include at least a
60920 <emphasis>Subject:</emphasis> header. Exim does not check the syntax of these headers.
60921 </para>
60922 </listitem>
60923 <listitem>
60924 <para>
60925 The second item forms the start of the warning message. After it, Exim lists
60926 the delayed addresses.
60927 </para>
60928 </listitem>
60929 <listitem>
60930 <para>
60931 The third item then ends the message.
60932 </para>
60933 </listitem>
60934 </itemizedlist>
60935 <para>
60936 The default state is equivalent to the following file, except that some lines
60937 have been split here, in order to fit them on the page:
60938 </para>
60939 <literallayout class="monospaced">
60940 Subject: Warning: message $message_exim_id delayed
60941   $warn_message_delay
60942 ****
60943 This message was created automatically by mail delivery software.
60944
60945 A message ${if eq{$sender_address}{$warn_message_recipients}
60946 {that you sent }{sent by
60947
60948 &lt;$sender_address&gt;
60949
60950 }}has not been delivered to all of its recipients after
60951 more than $warn_message_delay on the queue on $primary_hostname.
60952
60953 The message identifier is:     $message_exim_id
60954 The subject of the message is: $h_subject
60955 The date of the message is:    $h_date
60956
60957 The following address(es) have not yet been delivered:
60958 ****
60959 No action is required on your part. Delivery attempts will
60960 continue for some time, and this warning may be repeated at
60961 intervals if the message remains undelivered. Eventually the
60962 mail delivery software will give up, and when that happens,
60963 the message will be returned to you.
60964 </literallayout>
60965 <para>
60966 <indexterm role="variable">
60967 <primary><varname>$warn_message_delay</varname></primary>
60968 </indexterm>
60969 <indexterm role="variable">
60970 <primary><varname>$warn_message_recipients</varname></primary>
60971 </indexterm>
60972 However, in the default state the subject and date lines are omitted if no
60973 appropriate headers exist. During the expansion of this file,
60974 <varname>$warn_message_delay</varname> is set to the delay time in one of the forms <quote>&lt;<emphasis>n</emphasis>&gt;
60975 minutes</quote> or <quote>&lt;<emphasis>n</emphasis>&gt; hours</quote>, and <varname>$warn_message_recipients</varname> contains a list
60976 of recipients for the warning message. There may be more than one if there are
60977 multiple addresses with different <option>errors_to</option> settings on the routers that
60978 handled them.
60979 </para>
60980 </section>
60981 </chapter>
60982
60983 <chapter id="CHAPcomconreq">
60984 <title>Some common configuration settings</title>
60985 <para>
60986 This chapter discusses some configuration settings that seem to be fairly
60987 common. More examples and discussion can be found in the Exim book.
60988 </para>
60989 <section id="SECID240">
60990 <title>Sending mail to a smart host</title>
60991 <para>
60992 <indexterm role="concept">
60993 <primary>smart host</primary>
60994 <secondary>example router</secondary>
60995 </indexterm>
60996 If you want to send all mail for non-local domains to a <quote>smart host</quote>, you
60997 should replace the default <command>dnslookup</command> router with a router which does the
60998 routing explicitly:
60999 </para>
61000 <literallayout class="monospaced">
61001 send_to_smart_host:
61002   driver = manualroute
61003   route_list = !+local_domains smart.host.name
61004   transport = remote_smtp
61005 </literallayout>
61006 <para>
61007 You can use the smart host&#x2019;s IP address instead of the name if you wish.
61008 If you are using Exim only to submit messages to a smart host, and not for
61009 receiving incoming messages, you can arrange for it to do the submission
61010 synchronously by setting the <option>mua_wrapper</option> option (see chapter
61011 <xref linkend="CHAPnonqueueing"/>).
61012 </para>
61013 </section>
61014 <section id="SECTmailinglists">
61015 <title>Using Exim to handle mailing lists</title>
61016 <para>
61017 <indexterm role="concept">
61018 <primary>mailing lists</primary>
61019 </indexterm>
61020 Exim can be used to run simple mailing lists, but for large and/or complicated
61021 requirements, the use of additional specialized mailing list software such as
61022 Majordomo or Mailman is recommended.
61023 </para>
61024 <para>
61025 The <command>redirect</command> router can be used to handle mailing lists where each list
61026 is maintained in a separate file, which can therefore be managed by an
61027 independent manager. The <option>domains</option> router option can be used to run these
61028 lists in a separate domain from normal mail. For example:
61029 </para>
61030 <literallayout class="monospaced">
61031 lists:
61032   driver = redirect
61033   domains = lists.example
61034   file = /usr/lists/$local_part
61035   forbid_pipe
61036   forbid_file
61037   errors_to = $local_part-request@lists.example
61038   no_more
61039 </literallayout>
61040 <para>
61041 This router is skipped for domains other than <emphasis>lists.example</emphasis>. For addresses
61042 in that domain, it looks for a file that matches the local part. If there is no
61043 such file, the router declines, but because <option>no_more</option> is set, no subsequent
61044 routers are tried, and so the whole delivery fails.
61045 </para>
61046 <para>
61047 The <option>forbid_pipe</option> and <option>forbid_file</option> options prevent a local part from being
61048 expanded into a file name or a pipe delivery, which is usually inappropriate in
61049 a mailing list.
61050 </para>
61051 <para>
61052 <indexterm role="option">
61053 <primary><option>errors_to</option></primary>
61054 </indexterm>
61055 The <option>errors_to</option> option specifies that any delivery errors caused by addresses
61056 taken from a mailing list are to be sent to the given address rather than the
61057 original sender of the message. However, before acting on this, Exim verifies
61058 the error address, and ignores it if verification fails.
61059 </para>
61060 <para>
61061 For example, using the configuration above, mail sent to
61062 <emphasis>dicts@lists.example</emphasis> is passed on to those addresses contained in
61063 <filename>/usr/lists/dicts</filename>, with error reports directed to
61064 <emphasis>dicts-request@lists.example</emphasis>, provided that this address can be verified.
61065 There could be a file called <filename>/usr/lists/dicts-request</filename> containing
61066 the address(es) of this particular list&#x2019;s manager(s), but other approaches,
61067 such as setting up an earlier router (possibly using the <option>local_part_prefix</option>
61068 or <option>local_part_suffix</option> options) to handle addresses of the form
61069 <option>owner-</option><emphasis>xxx</emphasis> or <option>xxx-</option><emphasis>request</emphasis>, are also possible.
61070 </para>
61071 </section>
61072 <section id="SECID241">
61073 <title>Syntax errors in mailing lists</title>
61074 <para>
61075 <indexterm role="concept">
61076 <primary>mailing lists</primary>
61077 <secondary>syntax errors in</secondary>
61078 </indexterm>
61079 If an entry in redirection data contains a syntax error, Exim normally defers
61080 delivery of the original address. That means that a syntax error in a mailing
61081 list holds up all deliveries to the list. This may not be appropriate when a
61082 list is being maintained automatically from data supplied by users, and the
61083 addresses are not rigorously checked.
61084 </para>
61085 <para>
61086 If the <option>skip_syntax_errors</option> option is set, the <command>redirect</command> router just skips
61087 entries that fail to parse, noting the incident in the log. If in addition
61088 <option>syntax_errors_to</option> is set to a verifiable address, a message is sent to it
61089 whenever a broken address is skipped. It is usually appropriate to set
61090 <option>syntax_errors_to</option> to the same address as <option>errors_to</option>.
61091 </para>
61092 </section>
61093 <section id="SECID242">
61094 <title>Re-expansion of mailing lists</title>
61095 <para>
61096 <indexterm role="concept">
61097 <primary>mailing lists</primary>
61098 <secondary>re-expansion of</secondary>
61099 </indexterm>
61100 Exim remembers every individual address to which a message has been delivered,
61101 in order to avoid duplication, but it normally stores only the original
61102 recipient addresses with a message. If all the deliveries to a mailing list
61103 cannot be done at the first attempt, the mailing list is re-expanded when the
61104 delivery is next tried. This means that alterations to the list are taken into
61105 account at each delivery attempt, so addresses that have been added to
61106 the list since the message arrived will therefore receive a copy of the
61107 message, even though it pre-dates their subscription.
61108 </para>
61109 <para>
61110 If this behaviour is felt to be undesirable, the <option>one_time</option> option can be set
61111 on the <command>redirect</command> router. If this is done, any addresses generated by the
61112 router that fail to deliver at the first attempt are added to the message as
61113 <quote>top level</quote> addresses, and the parent address that generated them is marked
61114 <quote>delivered</quote>. Thus, expansion of the mailing list does not happen again at the
61115 subsequent delivery attempts. The disadvantage of this is that if any of the
61116 failing addresses are incorrect, correcting them in the file has no effect on
61117 pre-existing messages.
61118 </para>
61119 <para>
61120 The original top-level address is remembered with each of the generated
61121 addresses, and is output in any log messages. However, any intermediate parent
61122 addresses are not recorded. This makes a difference to the log only if the
61123 <option>all_parents</option> selector is set, but for mailing lists there is normally only
61124 one level of expansion anyway.
61125 </para>
61126 </section>
61127 <section id="SECID243">
61128 <title>Closed mailing lists</title>
61129 <para>
61130 <indexterm role="concept">
61131 <primary>mailing lists</primary>
61132 <secondary>closed</secondary>
61133 </indexterm>
61134 The examples so far have assumed open mailing lists, to which anybody may
61135 send mail. It is also possible to set up closed lists, where mail is accepted
61136 from specified senders only. This is done by making use of the generic
61137 <option>senders</option> option to restrict the router that handles the list.
61138 </para>
61139 <para>
61140 The following example uses the same file as a list of recipients and as a list
61141 of permitted senders. It requires three routers:
61142 </para>
61143 <literallayout class="monospaced">
61144 lists_request:
61145   driver = redirect
61146   domains = lists.example
61147   local_part_suffix = -request
61148   file = /usr/lists/$local_part$local_part_suffix
61149   no_more
61150
61151 lists_post:
61152   driver = redirect
61153   domains = lists.example
61154   senders = ${if exists {/usr/lists/$local_part}\
61155              {lsearch;/usr/lists/$local_part}{*}}
61156   file = /usr/lists/$local_part
61157   forbid_pipe
61158   forbid_file
61159   errors_to = $local_part-request@lists.example
61160   no_more
61161
61162 lists_closed:
61163   driver = redirect
61164   domains = lists.example
61165   allow_fail
61166   data = :fail: $local_part@lists.example is a closed mailing list
61167 </literallayout>
61168 <para>
61169 All three routers have the same <option>domains</option> setting, so for any other domains,
61170 they are all skipped. The first router runs only if the local part ends in
61171 <option>-request</option>. It handles messages to the list manager(s) by means of an open
61172 mailing list.
61173 </para>
61174 <para>
61175 The second router runs only if the <option>senders</option> precondition is satisfied. It
61176 checks for the existence of a list that corresponds to the local part, and then
61177 checks that the sender is on the list by means of a linear search. It is
61178 necessary to check for the existence of the file before trying to search it,
61179 because otherwise Exim thinks there is a configuration error. If the file does
61180 not exist, the expansion of <option>senders</option> is *, which matches all senders. This
61181 means that the router runs, but because there is no list, declines, and
61182 <option>no_more</option> ensures that no further routers are run. The address fails with an
61183 <quote>unrouteable address</quote> error.
61184 </para>
61185 <para>
61186 The third router runs only if the second router is skipped, which happens when
61187 a mailing list exists, but the sender is not on it. This router forcibly fails
61188 the address, giving a suitable error message.
61189 </para>
61190 </section>
61191 <section id="SECTverp">
61192 <title>Variable Envelope Return Paths (VERP)</title>
61193 <para>
61194 <indexterm role="concept">
61195 <primary>VERP</primary>
61196 </indexterm>
61197 <indexterm role="concept">
61198 <primary>Variable Envelope Return Paths</primary>
61199 </indexterm>
61200 <indexterm role="concept">
61201 <primary>envelope sender</primary>
61202 </indexterm>
61203 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;
61204 are a way of helping mailing list administrators discover which subscription
61205 address is the cause of a particular delivery failure. The idea is to encode
61206 the original recipient address in the outgoing envelope sender address, so that
61207 if the message is forwarded by another host and then subsequently bounces, the
61208 original recipient can be extracted from the recipient address of the bounce.
61209 </para>
61210 <para>
61211 <indexterm role="option">
61212 <primary><option>errors_to</option></primary>
61213 </indexterm>
61214 <indexterm role="option">
61215 <primary><option>return_path</option></primary>
61216 </indexterm>
61217 Envelope sender addresses can be modified by Exim using two different
61218 facilities: the <option>errors_to</option> option on a router (as shown in previous mailing
61219 list examples), or the <option>return_path</option> option on a transport. The second of
61220 these is effective only if the message is successfully delivered to another
61221 host; it is not used for errors detected on the local host (see the description
61222 of <option>return_path</option> in chapter <xref linkend="CHAPtransportgeneric"/>). Here is an example
61223 of the use of <option>return_path</option> to implement VERP on an <command>smtp</command> transport:
61224 </para>
61225 <literallayout class="monospaced">
61226 verp_smtp:
61227   driver = smtp
61228   max_rcpt = 1
61229   return_path = \
61230     ${if match {$return_path}{^(.+?)-request@your.dom.example\$}\
61231       {$1-request+$local_part=$domain@your.dom.example}fail}
61232 </literallayout>
61233 <para>
61234 This has the effect of rewriting the return path (envelope sender) on outgoing
61235 SMTP messages, if the local part of the original return path ends in
61236 <quote>-request</quote>, and the domain is <emphasis>your.dom.example</emphasis>. The rewriting inserts the
61237 local part and domain of the recipient into the return path. Suppose, for
61238 example, that a message whose return path has been set to
61239 <emphasis>somelist-request@your.dom.example</emphasis> is sent to
61240 <emphasis>subscriber@other.dom.example</emphasis>. In the transport, the return path is
61241 rewritten as
61242 </para>
61243 <literallayout class="monospaced">
61244 somelist-request+subscriber=other.dom.example@your.dom.example
61245 </literallayout>
61246 <para>
61247 <indexterm role="variable">
61248 <primary><varname>$local_part</varname></primary>
61249 </indexterm>
61250 For this to work, you must tell Exim to send multiple copies of messages that
61251 have more than one recipient, so that each copy has just one recipient. This is
61252 achieved by setting <option>max_rcpt</option> to 1. Without this, a single copy of a message
61253 might be sent to several different recipients in the same domain, in which case
61254 <varname>$local_part</varname> is not available in the transport, because it is not unique.
61255 </para>
61256 <para>
61257 Unless your host is doing nothing but mailing list deliveries, you should
61258 probably use a separate transport for the VERP deliveries, so as not to use
61259 extra resources in making one-per-recipient copies for other deliveries. This
61260 can easily be done by expanding the <option>transport</option> option in the router:
61261 </para>
61262 <literallayout class="monospaced">
61263 dnslookup:
61264   driver = dnslookup
61265   domains = ! +local_domains
61266   transport = \
61267     ${if match {$return_path}{^(.+?)-request@your.dom.example\$}\
61268       {verp_smtp}{remote_smtp}}
61269   no_more
61270 </literallayout>
61271 <para>
61272 If you want to change the return path using <option>errors_to</option> in a router instead
61273 of using <option>return_path</option> in the transport, you need to set <option>errors_to</option> on all
61274 routers that handle mailing list addresses. This will ensure that all delivery
61275 errors, including those detected on the local host, are sent to the VERP
61276 address.
61277 </para>
61278 <para>
61279 On a host that does no local deliveries and has no manual routing, only the
61280 <command>dnslookup</command> router needs to be changed. A special transport is not needed for
61281 SMTP deliveries. Every mailing list recipient has its own return path value,
61282 and so Exim must hand them to the transport one at a time. Here is an example
61283 of a <command>dnslookup</command> router that implements VERP:
61284 </para>
61285 <literallayout class="monospaced">
61286 verp_dnslookup:
61287   driver = dnslookup
61288   domains = ! +local_domains
61289   transport = remote_smtp
61290   errors_to = \
61291     ${if match {$return_path}{^(.+?)-request@your.dom.example\$}}
61292      {$1-request+$local_part=$domain@your.dom.example}fail}
61293   no_more
61294 </literallayout>
61295 <para>
61296 Before you start sending out messages with VERPed return paths, you must also
61297 configure Exim to accept the bounce messages that come back to those paths.
61298 Typically this is done by setting a <option>local_part_suffix</option> option for a
61299 router, and using this to route the messages to wherever you want to handle
61300 them.
61301 </para>
61302 <para>
61303 The overhead incurred in using VERP depends very much on the size of the
61304 message, the number of recipient addresses that resolve to the same remote
61305 host, and the speed of the connection over which the message is being sent. If
61306 a lot of addresses resolve to the same host and the connection is slow, sending
61307 a separate copy of the message for each address may take substantially longer
61308 than sending a single copy with many recipients (for which VERP cannot be
61309 used).
61310 </para>
61311 </section>
61312 <section id="SECTvirtualdomains">
61313 <title>Virtual domains</title>
61314 <para>
61315 <indexterm role="concept">
61316 <primary>virtual domains</primary>
61317 </indexterm>
61318 <indexterm role="concept">
61319 <primary>domain</primary>
61320 <secondary>virtual</secondary>
61321 </indexterm>
61322 The phrase <emphasis>virtual domain</emphasis> is unfortunately used with two rather different
61323 meanings:
61324 </para>
61325 <itemizedlist>
61326 <listitem>
61327 <para>
61328 A domain for which there are no real mailboxes; all valid local parts are
61329 aliases for other email addresses. Common examples are organizational
61330 top-level domains and <quote>vanity</quote> domains.
61331 </para>
61332 </listitem>
61333 <listitem>
61334 <para>
61335 One of a number of independent domains that are all handled by the same host,
61336 with mailboxes on that host, but where the mailbox owners do not necessarily
61337 have login accounts on that host.
61338 </para>
61339 </listitem>
61340 </itemizedlist>
61341 <para>
61342 The first usage is probably more common, and does seem more <quote>virtual</quote> than
61343 the second. This kind of domain can be handled in Exim with a straightforward
61344 aliasing router. One approach is to create a separate alias file for each
61345 virtual domain. Exim can test for the existence of the alias file to determine
61346 whether the domain exists. The <command>dsearch</command> lookup type is useful here, leading
61347 to a router of this form:
61348 </para>
61349 <literallayout class="monospaced">
61350 virtual:
61351   driver = redirect
61352   domains = dsearch;/etc/mail/virtual
61353   data = ${lookup{$local_part}lsearch{/etc/mail/virtual/$domain}}
61354   no_more
61355 </literallayout>
61356 <para>
61357 The <option>domains</option> option specifies that the router is to be skipped, unless there
61358 is a file in the <filename>/etc/mail/virtual</filename> directory whose name is the same as the
61359 domain that is being processed. When the router runs, it looks up the local
61360 part in the file to find a new address (or list of addresses). The <option>no_more</option>
61361 setting ensures that if the lookup fails (leading to <option>data</option> being an empty
61362 string), Exim gives up on the address without trying any subsequent routers.
61363 </para>
61364 <para>
61365 This one router can handle all the virtual domains because the alias file names
61366 follow a fixed pattern. Permissions can be arranged so that appropriate people
61367 can edit the different alias files. A successful aliasing operation results in
61368 a new envelope recipient address, which is then routed from scratch.
61369 </para>
61370 <para>
61371 The other kind of <quote>virtual</quote> domain can also be handled in a straightforward
61372 way. One approach is to create a file for each domain containing a list of
61373 valid local parts, and use it in a router like this:
61374 </para>
61375 <literallayout class="monospaced">
61376 my_domains:
61377   driver = accept
61378   domains = dsearch;/etc/mail/domains
61379   local_parts = lsearch;/etc/mail/domains/$domain
61380   transport = my_mailboxes
61381 </literallayout>
61382 <para>
61383 The address is accepted if there is a file for the domain, and the local part
61384 can be found in the file. The <option>domains</option> option is used to check for the
61385 file&#x2019;s existence because <option>domains</option> is tested before the <option>local_parts</option>
61386 option (see section <xref linkend="SECTrouprecon"/>). You cannot use <option>require_files</option>,
61387 because that option is tested after <option>local_parts</option>. The transport is as
61388 follows:
61389 </para>
61390 <literallayout class="monospaced">
61391 my_mailboxes:
61392   driver = appendfile
61393   file = /var/mail/$domain/$local_part
61394   user = mail
61395 </literallayout>
61396 <para>
61397 This uses a directory of mailboxes for each domain. The <option>user</option> setting is
61398 required, to specify which uid is to be used for writing to the mailboxes.
61399 </para>
61400 <para>
61401 The configuration shown here is just one example of how you might support this
61402 requirement. There are many other ways this kind of configuration can be set
61403 up, for example, by using a database instead of separate files to hold all the
61404 information about the domains.
61405 </para>
61406 </section>
61407 <section id="SECTmulbox">
61408 <title>Multiple user mailboxes</title>
61409 <para>
61410 <indexterm role="concept">
61411 <primary>multiple mailboxes</primary>
61412 </indexterm>
61413 <indexterm role="concept">
61414 <primary>mailbox</primary>
61415 <secondary>multiple</secondary>
61416 </indexterm>
61417 <indexterm role="concept">
61418 <primary>local part</primary>
61419 <secondary>prefix</secondary>
61420 </indexterm>
61421 <indexterm role="concept">
61422 <primary>local part</primary>
61423 <secondary>suffix</secondary>
61424 </indexterm>
61425 Heavy email users often want to operate with multiple mailboxes, into which
61426 incoming mail is automatically sorted. A popular way of handling this is to
61427 allow users to use multiple sender addresses, so that replies can easily be
61428 identified. Users are permitted to add prefixes or suffixes to their local
61429 parts for this purpose. The wildcard facility of the generic router options
61430 <option>local_part_prefix</option> and <option>local_part_suffix</option> can be used for this. For
61431 example, consider this router:
61432 </para>
61433 <literallayout class="monospaced">
61434 userforward:
61435   driver = redirect
61436   check_local_user
61437   file = $home/.forward
61438   local_part_suffix = -*
61439   local_part_suffix_optional
61440   allow_filter
61441 </literallayout>
61442 <para>
61443 <indexterm role="variable">
61444 <primary><varname>$local_part_suffix</varname></primary>
61445 </indexterm>
61446 It runs a user&#x2019;s <filename>.forward</filename> file for all local parts of the form
61447 <emphasis>username-*</emphasis>. Within the filter file the user can distinguish different
61448 cases by testing the variable <varname>$local_part_suffix</varname>. For example:
61449 </para>
61450 <literallayout class="monospaced">
61451 if $local_part_suffix contains -special then
61452 save /home/$local_part/Mail/special
61453 endif
61454 </literallayout>
61455 <para>
61456 If the filter file does not exist, or does not deal with such addresses, they
61457 fall through to subsequent routers, and, assuming no subsequent use of the
61458 <option>local_part_suffix</option> option is made, they presumably fail. Thus, users have
61459 control over which suffixes are valid.
61460 </para>
61461 <para>
61462 Alternatively, a suffix can be used to trigger the use of a different
61463 <filename>.forward</filename> file &ndash; which is the way a similar facility is implemented in
61464 another MTA:
61465 </para>
61466 <literallayout class="monospaced">
61467 userforward:
61468   driver = redirect
61469   check_local_user
61470   file = $home/.forward$local_part_suffix
61471   local_part_suffix = -*
61472   local_part_suffix_optional
61473   allow_filter
61474 </literallayout>
61475 <para>
61476 If there is no suffix, <filename>.forward</filename> is used; if the suffix is <emphasis>-special</emphasis>, for
61477 example, <filename>.forward-special</filename> is used. Once again, if the appropriate file
61478 does not exist, or does not deal with the address, it is passed on to
61479 subsequent routers, which could, if required, look for an unqualified
61480 <filename>.forward</filename> file to use as a default.
61481 </para>
61482 </section>
61483 <section id="SECID244">
61484 <title>Simplified vacation processing</title>
61485 <para>
61486 <indexterm role="concept">
61487 <primary>vacation processing</primary>
61488 </indexterm>
61489 The traditional way of running the <emphasis>vacation</emphasis> program is for a user to set up
61490 a pipe command in a <filename>.forward</filename> file
61491 (see section <xref linkend="SECTspecitredli"/> for syntax details).
61492 This is prone to error by inexperienced users. There are two features of Exim
61493 that can be used to make this process simpler for users:
61494 </para>
61495 <itemizedlist>
61496 <listitem>
61497 <para>
61498 A local part prefix such as <quote>vacation-</quote> can be specified on a router which
61499 can cause the message to be delivered directly to the <emphasis>vacation</emphasis> program, or
61500 alternatively can use Exim&#x2019;s <command>autoreply</command> transport. The contents of a user&#x2019;s
61501 <filename>.forward</filename> file are then much simpler. For example:
61502 </para>
61503 <literallayout class="monospaced">
61504 spqr, vacation-spqr
61505 </literallayout>
61506 </listitem>
61507 <listitem>
61508 <para>
61509 The <option>require_files</option> generic router option can be used to trigger a
61510 vacation delivery by checking for the existence of a certain file in the
61511 user&#x2019;s home directory. The <option>unseen</option> generic option should also be used, to
61512 ensure that the original delivery also proceeds. In this case, all the user has
61513 to do is to create a file called, say, <filename>.vacation</filename>, containing a vacation
61514 message.
61515 </para>
61516 </listitem>
61517 </itemizedlist>
61518 <para>
61519 Another advantage of both these methods is that they both work even when the
61520 use of arbitrary pipes by users is locked out.
61521 </para>
61522 </section>
61523 <section id="SECID245">
61524 <title>Taking copies of mail</title>
61525 <para>
61526 <indexterm role="concept">
61527 <primary>message</primary>
61528 <secondary>copying every</secondary>
61529 </indexterm>
61530 Some installations have policies that require archive copies of all messages to
61531 be made. A single copy of each message can easily be taken by an appropriate
61532 command in a system filter, which could, for example, use a different file for
61533 each day&#x2019;s messages.
61534 </para>
61535 <para>
61536 There is also a shadow transport mechanism that can be used to take copies of
61537 messages that are successfully delivered by local transports, one copy per
61538 delivery. This could be used, <emphasis>inter alia</emphasis>, to implement automatic
61539 notification of delivery by sites that insist on doing such things.
61540 </para>
61541 </section>
61542 <section id="SECID246">
61543 <title>Intermittently connected hosts</title>
61544 <para>
61545 <indexterm role="concept">
61546 <primary>intermittently connected hosts</primary>
61547 </indexterm>
61548 It has become quite common (because it is cheaper) for hosts to connect to the
61549 Internet periodically rather than remain connected all the time. The normal
61550 arrangement is that mail for such hosts accumulates on a system that is
61551 permanently connected.
61552 </para>
61553 <para>
61554 Exim was designed for use on permanently connected hosts, and so it is not
61555 particularly well-suited to use in an intermittently connected environment.
61556 Nevertheless there are some features that can be used.
61557 </para>
61558 </section>
61559 <section id="SECID247">
61560 <title>Exim on the upstream server host</title>
61561 <para>
61562 It is tempting to arrange for incoming mail for the intermittently connected
61563 host to remain on Exim&#x2019;s queue until the client connects. However, this
61564 approach does not scale very well. Two different kinds of waiting message are
61565 being mixed up in the same queue &ndash; those that cannot be delivered because of
61566 some temporary problem, and those that are waiting for their destination host
61567 to connect. This makes it hard to manage the queue, as well as wasting
61568 resources, because each queue runner scans the entire queue.
61569 </para>
61570 <para>
61571 A better approach is to separate off those messages that are waiting for an
61572 intermittently connected host. This can be done by delivering these messages
61573 into local files in batch SMTP, <quote>mailstore</quote>, or other envelope-preserving
61574 format, from where they are transmitted by other software when their
61575 destination connects. This makes it easy to collect all the mail for one host
61576 in a single directory, and to apply local timeout rules on a per-message basis
61577 if required.
61578 </para>
61579 <para>
61580 On a very small scale, leaving the mail on Exim&#x2019;s queue can be made to work. If
61581 you are doing this, you should configure Exim with a long retry period for the
61582 intermittent host. For example:
61583 </para>
61584 <literallayout class="monospaced">
61585 cheshire.wonderland.fict.example    *   F,5d,24h
61586 </literallayout>
61587 <para>
61588 This stops a lot of failed delivery attempts from occurring, but Exim remembers
61589 which messages it has queued up for that host. Once the intermittent host comes
61590 online, forcing delivery of one message (either by using the <option>-M</option> or <option>-R</option>
61591 options, or by using the ETRN SMTP command (see section <xref linkend="SECTETRN"/>)
61592 causes all the queued up messages to be delivered, often down a single SMTP
61593 connection. While the host remains connected, any new messages get delivered
61594 immediately.
61595 </para>
61596 <para>
61597 If the connecting hosts do not have fixed IP addresses, that is, if a host is
61598 issued with a different IP address each time it connects, Exim&#x2019;s retry
61599 mechanisms on the holding host get confused, because the IP address is normally
61600 used as part of the key string for holding retry information. This can be
61601 avoided by unsetting <option>retry_include_ip_address</option> on the <command>smtp</command> transport.
61602 Since this has disadvantages for permanently connected hosts, it is best to
61603 arrange a separate transport for the intermittently connected ones.
61604 </para>
61605 </section>
61606 <section id="SECID248">
61607 <title>Exim on the intermittently connected client host</title>
61608 <para>
61609 The value of <option>smtp_accept_queue_per_connection</option> should probably be
61610 increased, or even set to zero (that is, disabled) on the intermittently
61611 connected host, so that all incoming messages down a single connection get
61612 delivered immediately.
61613 </para>
61614 <para>
61615 <indexterm role="concept">
61616 <primary>SMTP</primary>
61617 <secondary>passed connection</secondary>
61618 </indexterm>
61619 <indexterm role="concept">
61620 <primary>SMTP</primary>
61621 <secondary>multiple deliveries</secondary>
61622 </indexterm>
61623 <indexterm role="concept">
61624 <primary>multiple SMTP deliveries</primary>
61625 </indexterm>
61626 Mail waiting to be sent from an intermittently connected host will probably
61627 not have been routed, because without a connection DNS lookups are not
61628 possible. This means that if a normal queue run is done at connection time,
61629 each message is likely to be sent in a separate SMTP session. This can be
61630 avoided by starting the queue run with a command line option beginning with
61631 <option>-qq</option> instead of <option>-q</option>. In this case, the queue is scanned twice. In the
61632 first pass, routing is done but no deliveries take place. The second pass is a
61633 normal queue run; since all the messages have been previously routed, those
61634 destined for the same host are likely to get sent as multiple deliveries in a
61635 single SMTP connection.
61636 </para>
61637 </section>
61638 </chapter>
61639
61640 <chapter id="CHAPnonqueueing">
61641 <title>Using Exim as a non-queueing client</title>
61642 <titleabbrev>Exim as a non-queueing client</titleabbrev>
61643 <para>
61644 <indexterm role="concept">
61645 <primary>client, non-queueing</primary>
61646 </indexterm>
61647 <indexterm role="concept">
61648 <primary>smart host</primary>
61649 <secondary>suppressing queueing</secondary>
61650 </indexterm>
61651 On a personal computer, it is a common requirement for all
61652 email to be sent to a <quote>smart host</quote>. There are plenty of MUAs that can be
61653 configured to operate that way, for all the popular operating systems.
61654 However, there are some MUAs for Unix-like systems that cannot be so
61655 configured: they submit messages using the command line interface of
61656 <filename>/usr/sbin/sendmail</filename>. Furthermore, utility programs such as <emphasis>cron</emphasis> submit
61657 messages this way.
61658 </para>
61659 <para>
61660 If the personal computer runs continuously, there is no problem, because it can
61661 run a conventional MTA that handles delivery to the smart host, and deal with
61662 any delays via its queueing mechanism. However, if the computer does not run
61663 continuously or runs different operating systems at different times, queueing
61664 email is not desirable.
61665 </para>
61666 <para>
61667 There is therefore a requirement for something that can provide the
61668 <filename>/usr/sbin/sendmail</filename> interface but deliver messages to a smart host without
61669 any queueing or retrying facilities. Furthermore, the delivery to the smart
61670 host should be synchronous, so that if it fails, the sending MUA is immediately
61671 informed. In other words, we want something that extends an MUA that submits
61672 to a local MTA via the command line so that it behaves like one that submits
61673 to a remote smart host using TCP/SMTP.
61674 </para>
61675 <para>
61676 There are a number of applications (for example, there is one called <emphasis>ssmtp</emphasis>)
61677 that do this job. However, people have found them to be lacking in various
61678 ways. For instance, you might want to allow aliasing and forwarding to be done
61679 before sending a message to the smart host.
61680 </para>
61681 <para>
61682 Exim already had the necessary infrastructure for doing this job. Just a few
61683 tweaks were needed to make it behave as required, though it is somewhat of an
61684 overkill to use a fully-featured MTA for this purpose.
61685 </para>
61686 <para>
61687 <indexterm role="option">
61688 <primary><option>mua_wrapper</option></primary>
61689 </indexterm>
61690 There is a Boolean global option called <option>mua_wrapper</option>, defaulting false.
61691 Setting <option>mua_wrapper</option> true causes Exim to run in a special mode where it
61692 assumes that it is being used to <quote>wrap</quote> a command-line MUA in the manner
61693 just described. As well as setting <option>mua_wrapper</option>, you also need to provide a
61694 compatible router and transport configuration. Typically there will be just one
61695 router and one transport, sending everything to a smart host.
61696 </para>
61697 <para>
61698 When run in MUA wrapping mode, the behaviour of Exim changes in the
61699 following ways:
61700 </para>
61701 <itemizedlist>
61702 <listitem>
61703 <para>
61704 A daemon cannot be run, nor will Exim accept incoming messages from <emphasis>inetd</emphasis>.
61705 In other words, the only way to submit messages is via the command line.
61706 </para>
61707 </listitem>
61708 <listitem>
61709 <para>
61710 Each message is synchronously delivered as soon as it is received (<option>-odi</option> is
61711 assumed). All queueing options (<option>queue_only</option>, <option>queue_smtp_domains</option>,
61712 <option>control</option> in an ACL, etc.) are quietly ignored. The Exim reception process
61713 does not finish until the delivery attempt is complete. If the delivery is
61714 successful, a zero return code is given.
61715 </para>
61716 </listitem>
61717 <listitem>
61718 <para>
61719 Address redirection is permitted, but the final routing for all addresses must
61720 be to the same remote transport, and to the same list of hosts. Furthermore,
61721 the return address (envelope sender) must be the same for all recipients, as
61722 must any added or deleted header lines. In other words, it must be possible to
61723 deliver the message in a single SMTP transaction, however many recipients there
61724 are.
61725 </para>
61726 </listitem>
61727 <listitem>
61728 <para>
61729 If these conditions are not met, or if routing any address results in a
61730 failure or defer status, or if Exim is unable to deliver all the recipients
61731 successfully to one of the smart hosts, delivery of the entire message fails.
61732 </para>
61733 </listitem>
61734 <listitem>
61735 <para>
61736 Because no queueing is allowed, all failures are treated as permanent; there
61737 is no distinction between 4<emphasis>xx</emphasis> and 5<emphasis>xx</emphasis> SMTP response codes from the
61738 smart host. Furthermore, because only a single yes/no response can be given to
61739 the caller, it is not possible to deliver to some recipients and not others. If
61740 there is an error (temporary or permanent) for any recipient, all are failed.
61741 </para>
61742 </listitem>
61743 <listitem>
61744 <para>
61745 If more than one smart host is listed, Exim will try another host after a
61746 connection failure or a timeout, in the normal way. However, if this kind of
61747 failure happens for all the hosts, the delivery fails.
61748 </para>
61749 </listitem>
61750 <listitem>
61751 <para>
61752 When delivery fails, an error message is written to the standard error stream
61753 (as well as to Exim&#x2019;s log), and Exim exits to the caller with a return code
61754 value 1. The message is expunged from Exim&#x2019;s spool files. No bounce messages
61755 are ever generated.
61756 </para>
61757 </listitem>
61758 <listitem>
61759 <para>
61760 No retry data is maintained, and any retry rules are ignored.
61761 </para>
61762 </listitem>
61763 <listitem>
61764 <para>
61765 A number of Exim options are overridden: <option>deliver_drop_privilege</option> is forced
61766 true, <option>max_rcpt</option> in the <command>smtp</command> transport is forced to <quote>unlimited</quote>,
61767 <option>remote_max_parallel</option> is forced to one, and fallback hosts are ignored.
61768 </para>
61769 </listitem>
61770 </itemizedlist>
61771 <para>
61772 The overall effect is that Exim makes a single synchronous attempt to deliver
61773 the message, failing if there is any kind of problem. Because no local
61774 deliveries are done and no daemon can be run, Exim does not need root
61775 privilege. It should be possible to run it setuid to <emphasis>exim</emphasis> instead of setuid
61776 to <emphasis>root</emphasis>. See section <xref linkend="SECTrunexiwitpri"/> for a general discussion about
61777 the advantages and disadvantages of running without root privilege.
61778 </para>
61779 </chapter>
61780
61781 <chapter id="CHAPlog">
61782 <title>Log files</title>
61783 <para>
61784 <indexterm role="concept" id="IIDloggen" class="startofrange">
61785 <primary>log</primary>
61786 <secondary>general description</secondary>
61787 </indexterm>
61788 <indexterm role="concept">
61789 <primary>log</primary>
61790 <secondary>types of</secondary>
61791 </indexterm>
61792 Exim writes three different logs, referred to as the main log, the reject log,
61793 and the panic log:
61794 </para>
61795 <itemizedlist>
61796 <listitem>
61797 <para>
61798 <indexterm role="concept">
61799 <primary>main log</primary>
61800 </indexterm>
61801 The main log records the arrival of each message and each delivery in a single
61802 line in each case. The format is as compact as possible, in an attempt to keep
61803 down the size of log files. Two-character flag sequences make it easy to pick
61804 out these lines. A number of other events are recorded in the main log. Some of
61805 them are optional, in which case the <option>log_selector</option> option controls whether
61806 they are included or not. A Perl script called <emphasis>eximstats</emphasis>, which does simple
61807 analysis of main log files, is provided in the Exim distribution (see section
61808 <xref linkend="SECTmailstat"/>).
61809 </para>
61810 </listitem>
61811 <listitem>
61812 <para>
61813 <indexterm role="concept">
61814 <primary>reject log</primary>
61815 </indexterm>
61816 The reject log records information from messages that are rejected as a result
61817 of a configuration option (that is, for policy reasons).
61818 The first line of each rejection is a copy of the line that is also written to
61819 the main log. Then, if the message&#x2019;s header has been read at the time the log
61820 is written, its contents are written to this log. Only the original header
61821 lines are available; header lines added by ACLs are not logged. You can use the
61822 reject log to check that your policy controls are working correctly; on a busy
61823 host this may be easier than scanning the main log for rejection messages. You
61824 can suppress the writing of the reject log by setting <option>write_rejectlog</option>
61825 false.
61826 </para>
61827 </listitem>
61828 <listitem>
61829 <para>
61830 <indexterm role="concept">
61831 <primary>panic log</primary>
61832 </indexterm>
61833 <indexterm role="concept">
61834 <primary>system log</primary>
61835 </indexterm>
61836 When certain serious errors occur, Exim writes entries to its panic log. If the
61837 error is sufficiently disastrous, Exim bombs out afterwards. Panic log entries
61838 are usually written to the main log as well, but can get lost amid the mass of
61839 other entries. The panic log should be empty under normal circumstances. It is
61840 therefore a good idea to check it (or to have a <emphasis>cron</emphasis> script check it)
61841 regularly, in order to become aware of any problems. When Exim cannot open its
61842 panic log, it tries as a last resort to write to the system log (syslog). This
61843 is opened with LOG_PID+LOG_CONS and the facility code of LOG_MAIL. The
61844 message itself is written at priority LOG_CRIT.
61845 </para>
61846 </listitem>
61847 </itemizedlist>
61848 <para>
61849 Every log line starts with a timestamp, in the format shown in the following
61850 example. Note that many of the examples shown in this chapter are line-wrapped.
61851 In the log file, this would be all on one line:
61852 </para>
61853 <literallayout class="monospaced">
61854 2001-09-16 16:09:47 SMTP connection from [127.0.0.1] closed
61855   by QUIT
61856 </literallayout>
61857 <para>
61858 By default, the timestamps are in the local timezone. There are two
61859 ways of changing this:
61860 </para>
61861 <itemizedlist>
61862 <listitem>
61863 <para>
61864 You can set the <option>timezone</option> option to a different time zone; in particular, if
61865 you set
61866 </para>
61867 <literallayout class="monospaced">
61868 timezone = UTC
61869 </literallayout>
61870 <para>
61871 the timestamps will be in UTC (aka GMT).
61872 </para>
61873 </listitem>
61874 <listitem>
61875 <para>
61876 If you set <option>log_timezone</option> true, the time zone is added to the timestamp, for
61877 example:
61878 </para>
61879 <literallayout class="monospaced">
61880 2003-04-25 11:17:07 +0100 Start queue run: pid=12762
61881 </literallayout>
61882 </listitem>
61883 </itemizedlist>
61884 <para>
61885 <indexterm role="concept">
61886 <primary>log</primary>
61887 <secondary>process ids in</secondary>
61888 </indexterm>
61889 <indexterm role="concept">
61890 <primary>pid (process id)</primary>
61891 <secondary>in log lines</secondary>
61892 </indexterm>
61893 Exim does not include its process id in log lines by default, but you can
61894 request that it does so by specifying the <literal>pid</literal> log selector (see section
61895 <xref linkend="SECTlogselector"/>). When this is set, the process id is output, in square
61896 brackets, immediately after the time and date.
61897 </para>
61898 <section id="SECTwhelogwri">
61899 <title>Where the logs are written</title>
61900 <para>
61901 <indexterm role="concept">
61902 <primary>log</primary>
61903 <secondary>destination</secondary>
61904 </indexterm>
61905 <indexterm role="concept">
61906 <primary>log</primary>
61907 <secondary>to file</secondary>
61908 </indexterm>
61909 <indexterm role="concept">
61910 <primary>log</primary>
61911 <secondary>to syslog</secondary>
61912 </indexterm>
61913 <indexterm role="concept">
61914 <primary>syslog</primary>
61915 </indexterm>
61916 The logs may be written to local files, or to syslog, or both. However, it
61917 should be noted that many syslog implementations use UDP as a transport, and
61918 are therefore unreliable in the sense that messages are not guaranteed to
61919 arrive at the loghost, nor is the ordering of messages necessarily maintained.
61920 It has also been reported that on large log files (tens of megabytes) you may
61921 need to tweak syslog to prevent it syncing the file with each write &ndash; on
61922 Linux this has been seen to make syslog take 90% plus of CPU time.
61923 </para>
61924 <para>
61925 The destination for Exim&#x2019;s logs is configured by setting LOG_FILE_PATH in
61926 <filename>Local/Makefile</filename> or by setting <option>log_file_path</option> in the run time
61927 configuration. This latter string is expanded, so it can contain, for example,
61928 references to the host name:
61929 </para>
61930 <literallayout class="monospaced">
61931 log_file_path = /var/log/$primary_hostname/exim_%slog
61932 </literallayout>
61933 <para>
61934 It is generally advisable, however, to set the string in <filename>Local/Makefile</filename>
61935 rather than at run time, because then the setting is available right from the
61936 start of Exim&#x2019;s execution. Otherwise, if there&#x2019;s something it wants to log
61937 before it has read the configuration file (for example, an error in the
61938 configuration file) it will not use the path you want, and may not be able to
61939 log at all.
61940 </para>
61941 <para>
61942 The value of LOG_FILE_PATH or <option>log_file_path</option> is a colon-separated
61943 list, currently limited to at most two items. This is one option where the
61944 facility for changing a list separator may not be used. The list must always be
61945 colon-separated. If an item in the list is <quote>syslog</quote> then syslog is used;
61946 otherwise the item must either be an absolute path, containing <literal>%s</literal> at the
61947 point where <quote>main</quote>, <quote>reject</quote>, or <quote>panic</quote> is to be inserted, or be empty,
61948 implying the use of a default path.
61949 </para>
61950 <para>
61951 When Exim encounters an empty item in the list, it searches the list defined by
61952 LOG_FILE_PATH, and uses the first item it finds that is neither empty nor
61953 <quote>syslog</quote>. This means that an empty item in <option>log_file_path</option> can be used to
61954 mean <quote>use the path specified at build time</quote>. It no such item exists, log
61955 files are written in the <filename>log</filename> subdirectory of the spool directory. This is
61956 equivalent to the setting:
61957 </para>
61958 <literallayout class="monospaced">
61959 log_file_path = $spool_directory/log/%slog
61960 </literallayout>
61961 <para>
61962 If you do not specify anything at build time or run time, that is where the
61963 logs are written.
61964 </para>
61965 <para>
61966 A log file path may also contain <literal>%D</literal> or <literal>%M</literal> if datestamped log file names
61967 are in use &ndash; see section <xref linkend="SECTdatlogfil"/> below.
61968 </para>
61969 <para>
61970 Here are some examples of possible settings:
61971 </para>
61972 <literallayout>
61973 <literal>LOG_FILE_PATH=syslog                    </literal> syslog only
61974 <literal>LOG_FILE_PATH=:syslog                   </literal> syslog and default path
61975 <literal>LOG_FILE_PATH=syslog : /usr/log/exim_%s </literal> syslog and specified path
61976 <literal>LOG_FILE_PATH=/usr/log/exim_%s          </literal> specified path only
61977 </literallayout>
61978 <para>
61979 If there are more than two paths in the list, the first is used and a panic
61980 error is logged.
61981 </para>
61982 </section>
61983 <section id="SECID285">
61984 <title>Logging to local files that are periodically <quote>cycled</quote></title>
61985 <para>
61986 <indexterm role="concept">
61987 <primary>log</primary>
61988 <secondary>cycling local files</secondary>
61989 </indexterm>
61990 <indexterm role="concept">
61991 <primary>cycling logs</primary>
61992 </indexterm>
61993 <indexterm role="concept">
61994 <primary><emphasis>exicyclog</emphasis></primary>
61995 </indexterm>
61996 <indexterm role="concept">
61997 <primary>log</primary>
61998 <secondary>local files; writing to</secondary>
61999 </indexterm>
62000 Some operating systems provide centralized and standardized methods for cycling
62001 log files. For those that do not, a utility script called <emphasis>exicyclog</emphasis> is
62002 provided (see section <xref linkend="SECTcyclogfil"/>). This renames and compresses the
62003 main and reject logs each time it is called. The maximum number of old logs to
62004 keep can be set. It is suggested this script is run as a daily <emphasis>cron</emphasis> job.
62005 </para>
62006 <para>
62007 An Exim delivery process opens the main log when it first needs to write to it,
62008 and it keeps the file open in case subsequent entries are required &ndash; for
62009 example, if a number of different deliveries are being done for the same
62010 message. However, remote SMTP deliveries can take a long time, and this means
62011 that the file may be kept open long after it is renamed if <emphasis>exicyclog</emphasis> or
62012 something similar is being used to rename log files on a regular basis. To
62013 ensure that a switch of log files is noticed as soon as possible, Exim calls
62014 <function>stat()</function> on the main log&#x2019;s name before reusing an open file, and if the file
62015 does not exist, or its inode has changed, the old file is closed and Exim
62016 tries to open the main log from scratch. Thus, an old log file may remain open
62017 for quite some time, but no Exim processes should write to it once it has been
62018 renamed.
62019 </para>
62020 </section>
62021 <section id="SECTdatlogfil">
62022 <title>Datestamped log files</title>
62023 <para>
62024 <indexterm role="concept">
62025 <primary>log</primary>
62026 <secondary>datestamped files</secondary>
62027 </indexterm>
62028 Instead of cycling the main and reject log files by renaming them
62029 periodically, some sites like to use files whose names contain a datestamp,
62030 for example, <filename>mainlog-20031225</filename>. The datestamp is in the form <filename>yyyymmdd</filename> or
62031 <filename>yyyymm</filename>. Exim has support for this way of working. It is enabled by setting
62032 the <option>log_file_path</option> option to a path that includes <literal>%D</literal> or <literal>%M</literal> at the
62033 point where the datestamp is required. For example:
62034 </para>
62035 <literallayout class="monospaced">
62036 log_file_path = /var/spool/exim/log/%slog-%D
62037 log_file_path = /var/log/exim-%s-%D.log
62038 log_file_path = /var/spool/exim/log/%D-%slog
62039 log_file_path = /var/log/exim/%s.%M
62040 </literallayout>
62041 <para>
62042 As before, <literal>%s</literal> is replaced by <quote>main</quote> or <quote>reject</quote>; the following are
62043 examples of names generated by the above examples:
62044 </para>
62045 <literallayout class="monospaced">
62046 /var/spool/exim/log/mainlog-20021225
62047 /var/log/exim-reject-20021225.log
62048 /var/spool/exim/log/20021225-mainlog
62049 /var/log/exim/main.200212
62050 </literallayout>
62051 <para>
62052 When this form of log file is specified, Exim automatically switches to new
62053 files at midnight. It does not make any attempt to compress old logs; you
62054 will need to write your own script if you require this. You should not
62055 run <emphasis>exicyclog</emphasis> with this form of logging.
62056 </para>
62057 <para>
62058 The location of the panic log is also determined by <option>log_file_path</option>, but it
62059 is not datestamped, because rotation of the panic log does not make sense.
62060 When generating the name of the panic log, <literal>%D</literal> or <literal>%M</literal> are removed from
62061 the string. In addition, if it immediately follows a slash, a following
62062 non-alphanumeric character is removed; otherwise a preceding non-alphanumeric
62063 character is removed. Thus, the four examples above would give these panic
62064 log names:
62065 </para>
62066 <literallayout class="monospaced">
62067 /var/spool/exim/log/paniclog
62068 /var/log/exim-panic.log
62069 /var/spool/exim/log/paniclog
62070 /var/log/exim/panic
62071 </literallayout>
62072 </section>
62073 <section id="SECID249">
62074 <title>Logging to syslog</title>
62075 <para>
62076 <indexterm role="concept">
62077 <primary>log</primary>
62078 <secondary>syslog; writing to</secondary>
62079 </indexterm>
62080 The use of syslog does not change what Exim logs or the format of its messages,
62081 except in one respect. If <option>syslog_timestamp</option> is set false, the timestamps on
62082 Exim&#x2019;s log lines are omitted when these lines are sent to syslog. Apart from
62083 that, the same strings are written to syslog as to log files. The syslog
62084 <quote>facility</quote> is set to LOG_MAIL, and the program name to <quote>exim</quote>
62085 by default, but you can change these by setting the <option>syslog_facility</option> and
62086 <option>syslog_processname</option> options, respectively. If Exim was compiled with
62087 SYSLOG_LOG_PID set in <filename>Local/Makefile</filename> (this is the default in
62088 <filename>src/EDITME</filename>), then, on systems that permit it (all except ULTRIX), the
62089 LOG_PID flag is set so that the <function>syslog()</function> call adds the pid as well as
62090 the time and host name to each line.
62091 The three log streams are mapped onto syslog priorities as follows:
62092 </para>
62093 <itemizedlist>
62094 <listitem>
62095 <para>
62096 <emphasis>mainlog</emphasis> is mapped to LOG_INFO
62097 </para>
62098 </listitem>
62099 <listitem>
62100 <para>
62101 <emphasis>rejectlog</emphasis> is mapped to LOG_NOTICE
62102 </para>
62103 </listitem>
62104 <listitem>
62105 <para>
62106 <emphasis>paniclog</emphasis> is mapped to LOG_ALERT
62107 </para>
62108 </listitem>
62109 </itemizedlist>
62110 <para>
62111 Many log lines are written to both <emphasis>mainlog</emphasis> and <emphasis>rejectlog</emphasis>, and some are
62112 written to both <emphasis>mainlog</emphasis> and <emphasis>paniclog</emphasis>, so there will be duplicates if
62113 these are routed by syslog to the same place. You can suppress this duplication
62114 by setting <option>syslog_duplication</option> false.
62115 </para>
62116 <para>
62117 Exim&#x2019;s log lines can sometimes be very long, and some of its <emphasis>rejectlog</emphasis>
62118 entries contain multiple lines when headers are included. To cope with both
62119 these cases, entries written to syslog are split into separate <function>syslog()</function>
62120 calls at each internal newline, and also after a maximum of
62121 870 data characters. (This allows for a total syslog line length of 1024, when
62122 additions such as timestamps are added.) If you are running a syslog
62123 replacement that can handle lines longer than the 1024 characters allowed by
62124 RFC 3164, you should set
62125 </para>
62126 <literallayout class="monospaced">
62127 SYSLOG_LONG_LINES=yes
62128 </literallayout>
62129 <para>
62130 in <filename>Local/Makefile</filename> before building Exim. That stops Exim from splitting long
62131 lines, but it still splits at internal newlines in <emphasis>reject</emphasis> log entries.
62132 </para>
62133 <para>
62134 To make it easy to re-assemble split lines later, each component of a split
62135 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;]
62136 where &lt;<emphasis>n</emphasis>&gt; is the component number and &lt;<emphasis>m</emphasis>&gt; is the total number of
62137 components in the entry. The / delimiter is used when the line was split
62138 because it was too long; if it was split because of an internal newline, the \
62139 delimiter is used. For example, supposing the length limit to be 50 instead of
62140 870, the following would be the result of a typical rejection message to
62141 <emphasis>mainlog</emphasis> (LOG_INFO), each line in addition being preceded by the time, host
62142 name, and pid as added by syslog:
62143 </para>
62144 <literallayout class="monospaced">
62145 [1/5] 2002-09-16 16:09:43 16RdAL-0006pc-00 rejected from
62146 [2/5]  [127.0.0.1] (ph10): syntax error in 'From' header
62147 [3/5]  when scanning for sender: missing or malformed lo
62148 [4/5] cal part in "&lt;&gt;" (envelope sender is &lt;ph10@cam.exa
62149 [5/5] mple&gt;)
62150 </literallayout>
62151 <para>
62152 The same error might cause the following lines to be written to <quote>rejectlog</quote>
62153 (LOG_NOTICE):
62154 </para>
62155 <literallayout class="monospaced">
62156 [1/18] 2002-09-16 16:09:43 16RdAL-0006pc-00 rejected fro
62157 [2/18] m [127.0.0.1] (ph10): syntax error in 'From' head
62158 [3/18] er when scanning for sender: missing or malformed
62159 [4/18]  local part in "&lt;&gt;" (envelope sender is &lt;ph10@cam
62160 [5\18] .example&gt;)
62161 [6\18] Recipients: ph10@some.domain.cam.example
62162 [7\18] P Received: from [127.0.0.1] (ident=ph10)
62163 [8\18]        by xxxxx.cam.example with smtp (Exim 4.00)
62164 [9\18]        id 16RdAL-0006pc-00
62165 [10/18]        for ph10@cam.example; Mon, 16 Sep 2002 16:
62166 [11\18] 09:43 +0100
62167 [12\18] F From: &lt;&gt;
62168 [13\18]   Subject: this is a test header
62169 [18\18]   X-something: this is another header
62170 [15/18] I Message-Id: &lt;E16RdAL-0006pc-00@xxxxx.cam.examp
62171 [16\18] le&gt;
62172 [17\18] B Bcc:
62173 [18/18]   Date: Mon, 16 Sep 2002 16:09:43 +0100
62174 </literallayout>
62175 <para>
62176 Log lines that are neither too long nor contain newlines are written to syslog
62177 without modification.
62178 </para>
62179 <para>
62180 If only syslog is being used, the Exim monitor is unable to provide a log tail
62181 display, unless syslog is routing <emphasis>mainlog</emphasis> to a file on the local host and
62182 the environment variable EXIMON_LOG_FILE_PATH is set to tell the monitor
62183 where it is.
62184 </para>
62185 </section>
62186 <section id="SECID250">
62187 <title>Log line flags</title>
62188 <para>
62189 One line is written to the main log for each message received, and for each
62190 successful, unsuccessful, and delayed delivery. These lines can readily be
62191 picked out by the distinctive two-character flags that immediately follow the
62192 timestamp. The flags are:
62193 </para>
62194 <literallayout>
62195 <literal>&lt;=</literal>     message arrival
62196 <literal>=&gt;</literal>     normal message delivery
62197 <literal>-&gt;</literal>     additional address in same delivery
62198 <literal>&gt;&gt;</literal>     cutthrough message delivery
62199 <literal>*&gt;</literal>     delivery suppressed by <option>-N</option>
62200 <literal>**</literal>     delivery failed; address bounced
62201 <literal>==</literal>     delivery deferred; temporary problem
62202 </literallayout>
62203 </section>
62204 <section id="SECID251">
62205 <title>Logging message reception</title>
62206 <para>
62207 <indexterm role="concept">
62208 <primary>log</primary>
62209 <secondary>reception line</secondary>
62210 </indexterm>
62211 The format of the single-line entry in the main log that is written for every
62212 message received is shown in the basic example below, which is split over
62213 several lines in order to fit it on the page:
62214 </para>
62215 <literallayout class="monospaced">
62216 2002-10-31 08:57:53 16ZCW1-0005MB-00 &lt;= kryten@dwarf.fict.example
62217   H=mailer.fict.example [192.168.123.123] U=exim
62218   P=smtp S=5678 id=&lt;incoming message id&gt;
62219 </literallayout>
62220 <para>
62221 The address immediately following <quote>&lt;=</quote> is the envelope sender address. A
62222 bounce message is shown with the sender address <quote>&lt;&gt;</quote>, and if it is locally
62223 generated, this is followed by an item of the form
62224 </para>
62225 <literallayout class="monospaced">
62226 R=&lt;message id&gt;
62227 </literallayout>
62228 <para>
62229 which is a reference to the message that caused the bounce to be sent.
62230 </para>
62231 <para>
62232 <indexterm role="concept">
62233 <primary>HELO</primary>
62234 </indexterm>
62235 <indexterm role="concept">
62236 <primary>EHLO</primary>
62237 </indexterm>
62238 For messages from other hosts, the H and U fields identify the remote host and
62239 record the RFC 1413 identity of the user that sent the message, if one was
62240 received. The number given in square brackets is the IP address of the sending
62241 host. If there is a single, unparenthesized  host name in the H field, as
62242 above, it has been verified to correspond to the IP address (see the
62243 <option>host_lookup</option> option). If the name is in parentheses, it was the name quoted
62244 by the remote host in the SMTP HELO or EHLO command, and has not been
62245 verified. If verification yields a different name to that given for HELO or
62246 EHLO, the verified name appears first, followed by the HELO or EHLO
62247 name in parentheses.
62248 </para>
62249 <para>
62250 Misconfigured hosts (and mail forgers) sometimes put an IP address, with or
62251 without brackets, in the HELO or EHLO command, leading to entries in
62252 the log containing text like these examples:
62253 </para>
62254 <literallayout class="monospaced">
62255 H=(10.21.32.43) [192.168.8.34]
62256 H=([10.21.32.43]) [192.168.8.34]
62257 </literallayout>
62258 <para>
62259 This can be confusing. Only the final address in square brackets can be relied
62260 on.
62261 </para>
62262 <para>
62263 For locally generated messages (that is, messages not received over TCP/IP),
62264 the H field is omitted, and the U field contains the login name of the caller
62265 of Exim.
62266 </para>
62267 <para>
62268 <indexterm role="concept">
62269 <primary>authentication</primary>
62270 <secondary>logging</secondary>
62271 </indexterm>
62272 <indexterm role="concept">
62273 <primary>AUTH</primary>
62274 <secondary>logging</secondary>
62275 </indexterm>
62276 For all messages, the P field specifies the protocol used to receive the
62277 message. This is the value that is stored in <varname>$received_protocol</varname>. In the case
62278 of incoming SMTP messages, the value indicates whether or not any SMTP
62279 extensions (ESMTP), encryption, or authentication were used. If the SMTP
62280 session was encrypted, there is an additional X field that records the cipher
62281 suite that was used.
62282 </para>
62283 <para>
62284 The protocol is set to <quote>esmtpsa</quote> or <quote>esmtpa</quote> for messages received from
62285 hosts that have authenticated themselves using the SMTP AUTH command. The first
62286 value is used when the SMTP connection was encrypted (<quote>secure</quote>). In this case
62287 there is an additional item A= followed by the name of the authenticator that
62288 was used. If an authenticated identification was set up by the authenticator&#x2019;s
62289 <option>server_set_id</option> option, this is logged too, separated by a colon from the
62290 authenticator name.
62291 </para>
62292 <para>
62293 <indexterm role="concept">
62294 <primary>size</primary>
62295 <secondary>of message</secondary>
62296 </indexterm>
62297 The id field records the existing message id, if present. The size of the
62298 received message is given by the S field. When the message is delivered,
62299 headers may be removed or added, so that the size of delivered copies of the
62300 message may not correspond with this value (and indeed may be different to each
62301 other).
62302 </para>
62303 <para>
62304 The <option>log_selector</option> option can be used to request the logging of additional
62305 data when a message is received. See section <xref linkend="SECTlogselector"/> below.
62306 </para>
62307 </section>
62308 <section id="SECID252">
62309 <title>Logging deliveries</title>
62310 <para>
62311 <indexterm role="concept">
62312 <primary>log</primary>
62313 <secondary>delivery line</secondary>
62314 </indexterm>
62315 The format of the single-line entry in the main log that is written for every
62316 delivery is shown in one of the examples below, for local and remote
62317 deliveries, respectively. Each example has been split into two lines in order
62318 to fit it on the page:
62319 </para>
62320 <literallayout class="monospaced">
62321 2002-10-31 08:59:13 16ZCW1-0005MB-00 =&gt; marv
62322   &lt;marv@hitch.fict.example&gt; R=localuser T=local_delivery
62323 2002-10-31 09:00:10 16ZCW1-0005MB-00 =&gt;
62324   monk@holistic.fict.example R=dnslookup T=remote_smtp
62325   H=holistic.fict.example [192.168.234.234]
62326 </literallayout>
62327 <para>
62328 For ordinary local deliveries, the original address is given in angle brackets
62329 after the final delivery address, which might be a pipe or a file. If
62330 intermediate address(es) exist between the original and the final address, the
62331 last of these is given in parentheses after the final address. The R and T
62332 fields record the router and transport that were used to process the address.
62333 </para>
62334 <para>
62335 If SMTP AUTH was used for the delivery there is an additional item A=
62336 followed by the name of the authenticator that was used.
62337 If an authenticated identification was set up by the authenticator&#x2019;s <option>client_set_id</option>
62338 option, this is logged too, separated by a colon from the authenticator name.
62339 </para>
62340 <para>
62341 If a shadow transport was run after a successful local delivery, the log line
62342 for the successful delivery has an item added on the end, of the form
62343 </para>
62344 <literallayout>
62345 <literal>ST=&lt;</literal><emphasis>shadow transport name</emphasis><literal>&gt;</literal>
62346 </literallayout>
62347 <para>
62348 If the shadow transport did not succeed, the error message is put in
62349 parentheses afterwards.
62350 </para>
62351 <para>
62352 <indexterm role="concept">
62353 <primary>asterisk</primary>
62354 <secondary>after IP address</secondary>
62355 </indexterm>
62356 When more than one address is included in a single delivery (for example, two
62357 SMTP RCPT commands in one transaction) the second and subsequent addresses are
62358 flagged with <literal>-&gt;</literal> instead of <literal>=&gt;</literal>. When two or more messages are delivered
62359 down a single SMTP connection, an asterisk follows the IP address in the log
62360 lines for the second and subsequent messages.
62361 </para>
62362 <para>
62363 <indexterm role="concept">
62364 <primary>delivery</primary>
62365 <secondary>cutthrough; logging</secondary>
62366 </indexterm>
62367 <indexterm role="concept">
62368 <primary>cutthrough</primary>
62369 <secondary>logging</secondary>
62370 </indexterm>
62371 When delivery is done in cutthrough mode it is flagged with <literal>&gt;&gt;</literal> and the log
62372 line precedes the reception line, since cutthrough waits for a possible
62373 rejection from the destination in case it can reject the sourced item.
62374 </para>
62375 <para>
62376 The generation of a reply message by a filter file gets logged as a
62377 <quote>delivery</quote> to the addressee, preceded by <quote>&gt;</quote>.
62378 </para>
62379 <para>
62380 The <option>log_selector</option> option can be used to request the logging of additional
62381 data when a message is delivered. See section <xref linkend="SECTlogselector"/> below.
62382 </para>
62383 </section>
62384 <section id="SECID253">
62385 <title>Discarded deliveries</title>
62386 <para>
62387 <indexterm role="concept">
62388 <primary>discarded messages</primary>
62389 </indexterm>
62390 <indexterm role="concept">
62391 <primary>message</primary>
62392 <secondary>discarded</secondary>
62393 </indexterm>
62394 <indexterm role="concept">
62395 <primary>delivery</primary>
62396 <secondary>discarded; logging</secondary>
62397 </indexterm>
62398 When a message is discarded as a result of the command <quote>seen finish</quote> being
62399 obeyed in a filter file which generates no deliveries, a log entry of the form
62400 </para>
62401 <literallayout class="monospaced">
62402 2002-12-10 00:50:49 16auJc-0001UB-00 =&gt; discarded
62403   &lt;low.club@bridge.example&gt; R=userforward
62404 </literallayout>
62405 <para>
62406 is written, to record why no deliveries are logged. When a message is discarded
62407 because it is aliased to <quote>:blackhole:</quote> the log line is like this:
62408 </para>
62409 <literallayout class="monospaced">
62410 1999-03-02 09:44:33 10HmaX-0005vi-00 =&gt; :blackhole:
62411   &lt;hole@nowhere.example&gt; R=blackhole_router
62412 </literallayout>
62413 </section>
62414 <section id="SECID254">
62415 <title>Deferred deliveries</title>
62416 <para>
62417 When a delivery is deferred, a line of the following form is logged:
62418 </para>
62419 <literallayout class="monospaced">
62420 2002-12-19 16:20:23 16aiQz-0002Q5-00 == marvin@endrest.example
62421   R=dnslookup T=smtp defer (146): Connection refused
62422 </literallayout>
62423 <para>
62424 In the case of remote deliveries, the error is the one that was given for the
62425 last IP address that was tried. Details of individual SMTP failures are also
62426 written to the log, so the above line would be preceded by something like
62427 </para>
62428 <literallayout class="monospaced">
62429 2002-12-19 16:20:23 16aiQz-0002Q5-00 Failed to connect to
62430   mail1.endrest.example [192.168.239.239]: Connection refused
62431 </literallayout>
62432 <para>
62433 When a deferred address is skipped because its retry time has not been reached,
62434 a message is written to the log, but this can be suppressed by setting an
62435 appropriate value in <option>log_selector</option>.
62436 </para>
62437 </section>
62438 <section id="SECID255">
62439 <title>Delivery failures</title>
62440 <para>
62441 <indexterm role="concept">
62442 <primary>delivery</primary>
62443 <secondary>failure; logging</secondary>
62444 </indexterm>
62445 If a delivery fails because an address cannot be routed, a line of the
62446 following form is logged:
62447 </para>
62448 <literallayout class="monospaced">
62449 1995-12-19 16:20:23 0tRiQz-0002Q5-00 ** jim@trek99.example
62450   &lt;jim@trek99.example&gt;: unknown mail domain
62451 </literallayout>
62452 <para>
62453 If a delivery fails at transport time, the router and transport are shown, and
62454 the response from the remote host is included, as in this example:
62455 </para>
62456 <literallayout class="monospaced">
62457 2002-07-11 07:14:17 17SXDU-000189-00 ** ace400@pb.example
62458   R=dnslookup T=remote_smtp: SMTP error from remote mailer
62459   after pipelined RCPT TO:&lt;ace400@pb.example&gt;: host
62460   pbmail3.py.example [192.168.63.111]: 553 5.3.0
62461   &lt;ace400@pb.example&gt;...Addressee unknown
62462 </literallayout>
62463 <para>
62464 The word <quote>pipelined</quote> indicates that the SMTP PIPELINING extension was being
62465 used. See <option>hosts_avoid_esmtp</option> in the <command>smtp</command> transport for a way of
62466 disabling PIPELINING. The log lines for all forms of delivery failure are
62467 flagged with <literal>**</literal>.
62468 </para>
62469 </section>
62470 <section id="SECID256">
62471 <title>Fake deliveries</title>
62472 <para>
62473 <indexterm role="concept">
62474 <primary>delivery</primary>
62475 <secondary>fake; logging</secondary>
62476 </indexterm>
62477 If a delivery does not actually take place because the <option>-N</option> option has been
62478 used to suppress it, a normal delivery line is written to the log, except that
62479 <quote>=&gt;</quote> is replaced by <quote>*&gt;</quote>.
62480 </para>
62481 </section>
62482 <section id="SECID257">
62483 <title>Completion</title>
62484 <para>
62485 A line of the form
62486 </para>
62487 <literallayout class="monospaced">
62488 2002-10-31 09:00:11 16ZCW1-0005MB-00 Completed
62489 </literallayout>
62490 <para>
62491 is written to the main log when a message is about to be removed from the spool
62492 at the end of its processing.
62493 </para>
62494 </section>
62495 <section id="SECID258">
62496 <title>Summary of Fields in Log Lines</title>
62497 <para>
62498 <indexterm role="concept">
62499 <primary>log</primary>
62500 <secondary>summary of fields</secondary>
62501 </indexterm>
62502 A summary of the field identifiers that are used in log lines is shown in
62503 the following table:
62504 </para>
62505 <literallayout>
62506 <literal>A   </literal>        authenticator name (and optional id and sender)
62507 <literal>C   </literal>        SMTP confirmation on delivery
62508 <literal>    </literal>        command list for <quote>no mail in SMTP session</quote>
62509 <literal>CV  </literal>        certificate verification status
62510 <literal>D   </literal>        duration of <quote>no mail in SMTP session</quote>
62511 <literal>DN  </literal>        distinguished name from peer certificate
62512 <literal>DT  </literal>        on <literal>=&gt;</literal> lines: time taken for a delivery
62513 <literal>F   </literal>        sender address (on delivery lines)
62514 <literal>H   </literal>        host name and IP address
62515 <literal>I   </literal>        local interface used
62516 <literal>id  </literal>        message id for incoming message
62517 <literal>P   </literal>        on <literal>&lt;=</literal> lines: protocol used
62518 <literal>    </literal>        on <literal>=&gt;</literal> and <literal>**</literal> lines: return path
62519 <literal>QT  </literal>        on <literal>=&gt;</literal> lines: time spent on queue so far
62520 <literal>    </literal>        on <quote>Completed</quote> lines: time spent on queue
62521 <literal>R   </literal>        on <literal>&lt;=</literal> lines: reference for local bounce
62522 <literal>    </literal>        on <literal>=&gt;</literal>  <literal>**</literal> and <literal>==</literal> lines: router name
62523 <literal>S   </literal>        size of message
62524 <literal>SNI </literal>        server name indication from TLS client hello
62525 <literal>ST  </literal>        shadow transport name
62526 <literal>T   </literal>        on <literal>&lt;=</literal> lines: message subject (topic)
62527 <literal>    </literal>        on <literal>=&gt;</literal> <literal>**</literal> and <literal>==</literal> lines: transport name
62528 <literal>U   </literal>        local user or RFC 1413 identity
62529 <literal>X   </literal>        TLS cipher suite
62530 </literallayout>
62531 </section>
62532 <section id="SECID259">
62533 <title>Other log entries</title>
62534 <para>
62535 Various other types of log entry are written from time to time. Most should be
62536 self-explanatory. Among the more common are:
62537 </para>
62538 <itemizedlist>
62539 <listitem>
62540 <para>
62541 <indexterm role="concept">
62542 <primary>retry</primary>
62543 <secondary>time not reached</secondary>
62544 </indexterm>
62545 <emphasis>retry time not reached</emphasis>&nbsp;&nbsp;An address previously suffered a temporary error
62546 during routing or local delivery, and the time to retry has not yet arrived.
62547 This message is not written to an individual message log file unless it happens
62548 during the first delivery attempt.
62549 </para>
62550 </listitem>
62551 <listitem>
62552 <para>
62553 <emphasis>retry time not reached for any host</emphasis>&nbsp;&nbsp;An address previously suffered
62554 temporary errors during remote delivery, and the retry time has not yet arrived
62555 for any of the hosts to which it is routed.
62556 </para>
62557 </listitem>
62558 <listitem>
62559 <para>
62560 <indexterm role="concept">
62561 <primary>spool directory</primary>
62562 <secondary>file locked</secondary>
62563 </indexterm>
62564 <emphasis>spool file locked</emphasis>&nbsp;&nbsp;An attempt to deliver a message cannot proceed because
62565 some other Exim process is already working on the message. This can be quite
62566 common if queue running processes are started at frequent intervals. The
62567 <emphasis>exiwhat</emphasis> utility script can be used to find out what Exim processes are
62568 doing.
62569 </para>
62570 </listitem>
62571 <listitem>
62572 <para>
62573 <indexterm role="concept">
62574 <primary>error</primary>
62575 <secondary>ignored</secondary>
62576 </indexterm>
62577 <emphasis>error ignored</emphasis>&nbsp;&nbsp;There are several circumstances that give rise to this
62578 message:
62579 </para>
62580 <orderedlist numeration="arabic">
62581 <listitem>
62582 <para>
62583 Exim failed to deliver a bounce message whose age was greater than
62584 <option>ignore_bounce_errors_after</option>. The bounce was discarded.
62585 </para>
62586 </listitem>
62587 <listitem>
62588 <para>
62589 A filter file set up a delivery using the <quote>noerror</quote> option, and the delivery
62590 failed. The delivery was discarded.
62591 </para>
62592 </listitem>
62593 <listitem>
62594 <para>
62595 A delivery set up by a router configured with
62596 </para>
62597 <literallayout class="monospaced">
62598     errors_to = &lt;&gt;
62599 </literallayout>
62600 <para>
62601 failed. The delivery was discarded.
62602 </para>
62603 </listitem>
62604 </orderedlist>
62605 </listitem>
62606 </itemizedlist>
62607 </section>
62608 <section id="SECTlogselector">
62609 <title>Reducing or increasing what is logged</title>
62610 <para>
62611 <indexterm role="concept">
62612 <primary>log</primary>
62613 <secondary>selectors</secondary>
62614 </indexterm>
62615 By setting the <option>log_selector</option> global option, you can disable some of Exim&#x2019;s
62616 default logging, or you can request additional logging. The value of
62617 <option>log_selector</option> is made up of names preceded by plus or minus characters. For
62618 example:
62619 </para>
62620 <literallayout class="monospaced">
62621 log_selector = +arguments -retry_defer
62622 </literallayout>
62623 <para>
62624 The list of optional log items is in the following table, with the default
62625 selection marked by asterisks:
62626 </para>
62627 <literallayout>
62628 <literal> 8bitmime                   </literal>  received 8BITMIME status
62629 <literal>*acl_warn_skipped           </literal>  skipped <option>warn</option> statement in ACL
62630 <literal> address_rewrite            </literal>  address rewriting
62631 <literal> all_parents                </literal>  all parents in =&gt; lines
62632 <literal> arguments                  </literal>  command line arguments
62633 <literal>*connection_reject          </literal>  connection rejections
62634 <literal>*delay_delivery             </literal>  immediate delivery delayed
62635 <literal> deliver_time               </literal>  time taken to perform delivery
62636 <literal> delivery_size              </literal>  add <literal>S=</literal><emphasis>nnn</emphasis> to =&gt; lines
62637 <literal>*dnslist_defer              </literal>  defers of DNS list (aka RBL) lookups
62638 <literal>*etrn                       </literal>  ETRN commands
62639 <literal>*host_lookup_failed         </literal>  as it says
62640 <literal> ident_timeout              </literal>  timeout for ident connection
62641 <literal> incoming_interface         </literal>  incoming interface on &lt;= lines
62642 <literal> incoming_port              </literal>  incoming port on &lt;= lines
62643 <literal>*lost_incoming_connection   </literal>  as it says (includes timeouts)
62644 <literal> outgoing_port              </literal>  add remote port to =&gt; lines
62645 <literal>*queue_run                  </literal>  start and end queue runs
62646 <literal> queue_time                 </literal>  time on queue for one recipient
62647 <literal> queue_time_overall         </literal>  time on queue for whole message
62648 <literal> pid                        </literal>  Exim process id
62649 <literal> received_recipients        </literal>  recipients on &lt;= lines
62650 <literal> received_sender            </literal>  sender on &lt;= lines
62651 <literal>*rejected_header            </literal>  header contents on reject log
62652 <literal>*retry_defer                </literal>  <quote>retry time not reached</quote>
62653 <literal> return_path_on_delivery    </literal>  put return path on =&gt; and ** lines
62654 <literal> sender_on_delivery         </literal>  add sender to =&gt; lines
62655 <literal>*sender_verify_fail         </literal>  sender verification failures
62656 <literal>*size_reject                </literal>  rejection because too big
62657 <literal>*skip_delivery              </literal>  delivery skipped in a queue run
62658 <literal>*smtp_confirmation          </literal>  SMTP confirmation on =&gt; lines
62659 <literal> smtp_connection            </literal>  SMTP connections
62660 <literal> smtp_incomplete_transaction</literal>  incomplete SMTP transactions
62661 <literal> smtp_mailauth              </literal>  AUTH argument to MAIL commands
62662 <literal> smtp_no_mail               </literal>  session with no MAIL commands
62663 <literal> smtp_protocol_error        </literal>  SMTP protocol errors
62664 <literal> smtp_syntax_error          </literal>  SMTP syntax errors
62665 <literal> subject                    </literal>  contents of <emphasis>Subject:</emphasis> on &lt;= lines
62666 <literal> tls_certificate_verified   </literal>  certificate verification status
62667 <literal>*tls_cipher                 </literal>  TLS cipher suite on &lt;= and =&gt; lines
62668 <literal> tls_peerdn                 </literal>  TLS peer DN on &lt;= and =&gt; lines
62669 <literal> tls_sni                    </literal>  TLS SNI on &lt;= lines
62670 <literal> unknown_in_list            </literal>  DNS lookup failed in list match
62671
62672 <literal> all                        </literal>  all of the above
62673 </literallayout>
62674 <para>
62675 More details on each of these items follows:
62676 </para>
62677 <itemizedlist>
62678 <listitem>
62679 <para>
62680 <indexterm role="concept">
62681 <primary>8BITMIME</primary>
62682 </indexterm>
62683 <indexterm role="concept">
62684 <primary>log</primary>
62685 <secondary>8BITMIME</secondary>
62686 </indexterm>
62687 <option>8bitmime</option>: This causes Exim to log any 8BITMIME status of received messages,
62688 which may help in tracking down interoperability issues with ancient MTAs
62689 that are not 8bit clean.  This is added to the <quote>&lt;=</quote> line, tagged with
62690 <literal>M8S=</literal> and a value of <literal>0</literal>, <literal>7</literal> or <literal>8</literal>, corresponding to "not given",
62691 <literal>7BIT</literal> and <literal>8BITMIME</literal> respectively.
62692 </para>
62693 </listitem>
62694 <listitem>
62695 <para>
62696 <indexterm role="concept">
62697 <primary><option>warn</option> ACL verb</primary>
62698 <secondary>log when skipping</secondary>
62699 </indexterm>
62700 <option>acl_warn_skipped</option>: When an ACL <option>warn</option> statement is skipped because one of
62701 its conditions cannot be evaluated, a log line to this effect is written if
62702 this log selector is set.
62703 </para>
62704 </listitem>
62705 <listitem>
62706 <para>
62707 <indexterm role="concept">
62708 <primary>log</primary>
62709 <secondary>rewriting</secondary>
62710 </indexterm>
62711 <indexterm role="concept">
62712 <primary>rewriting</primary>
62713 <secondary>logging</secondary>
62714 </indexterm>
62715 <option>address_rewrite</option>: This applies both to global rewrites and per-transport
62716 rewrites, but not to rewrites in filters run as an unprivileged user (because
62717 such users cannot access the log).
62718 </para>
62719 </listitem>
62720 <listitem>
62721 <para>
62722 <indexterm role="concept">
62723 <primary>log</primary>
62724 <secondary>full parentage</secondary>
62725 </indexterm>
62726 <option>all_parents</option>: Normally only the original and final addresses are logged on
62727 delivery lines; with this selector, intermediate parents are given in
62728 parentheses between them.
62729 </para>
62730 </listitem>
62731 <listitem>
62732 <para>
62733 <indexterm role="concept">
62734 <primary>log</primary>
62735 <secondary>Exim arguments</secondary>
62736 </indexterm>
62737 <indexterm role="concept">
62738 <primary>Exim arguments, logging</primary>
62739 </indexterm>
62740 <option>arguments</option>: This causes Exim to write the arguments with which it was called
62741 to the main log, preceded by the current working directory. This is a debugging
62742 feature, added to make it easier to find out how certain MUAs call
62743 <filename>/usr/sbin/sendmail</filename>. The logging does not happen if Exim has given up root
62744 privilege because it was called with the <option>-C</option> or <option>-D</option> options. Arguments
62745 that are empty or that contain white space are quoted. Non-printing characters
62746 are shown as escape sequences. This facility cannot log unrecognized arguments,
62747 because the arguments are checked before the configuration file is read. The
62748 only way to log such cases is to interpose a script such as <filename>util/logargs.sh</filename>
62749 between the caller and Exim.
62750 </para>
62751 </listitem>
62752 <listitem>
62753 <para>
62754 <indexterm role="concept">
62755 <primary>log</primary>
62756 <secondary>connection rejections</secondary>
62757 </indexterm>
62758 <option>connection_reject</option>: A log entry is written whenever an incoming SMTP
62759 connection is rejected, for whatever reason.
62760 </para>
62761 </listitem>
62762 <listitem>
62763 <para>
62764 <indexterm role="concept">
62765 <primary>log</primary>
62766 <secondary>delayed delivery</secondary>
62767 </indexterm>
62768 <indexterm role="concept">
62769 <primary>delayed delivery, logging</primary>
62770 </indexterm>
62771 <option>delay_delivery</option>: A log entry is written whenever a delivery process is not
62772 started for an incoming message because the load is too high or too many
62773 messages were received on one connection. Logging does not occur if no delivery
62774 process is started because <option>queue_only</option> is set or <option>-odq</option> was used.
62775 </para>
62776 </listitem>
62777 <listitem>
62778 <para>
62779 <indexterm role="concept">
62780 <primary>log</primary>
62781 <secondary>delivery duration</secondary>
62782 </indexterm>
62783 <option>deliver_time</option>: For each delivery, the amount of real time it has taken to
62784 perform the actual delivery is logged as DT=&lt;<emphasis>time</emphasis>&gt;, for example, <literal>DT=1s</literal>.
62785 </para>
62786 </listitem>
62787 <listitem>
62788 <para>
62789 <indexterm role="concept">
62790 <primary>log</primary>
62791 <secondary>message size on delivery</secondary>
62792 </indexterm>
62793 <indexterm role="concept">
62794 <primary>size</primary>
62795 <secondary>of message</secondary>
62796 </indexterm>
62797 <option>delivery_size</option>: For each delivery, the size of message delivered is added to
62798 the <quote>=&gt;</quote> line, tagged with S=.
62799 </para>
62800 </listitem>
62801 <listitem>
62802 <para>
62803 <indexterm role="concept">
62804 <primary>log</primary>
62805 <secondary>dnslist defer</secondary>
62806 </indexterm>
62807 <indexterm role="concept">
62808 <primary>DNS list</primary>
62809 <secondary>logging defer</secondary>
62810 </indexterm>
62811 <indexterm role="concept">
62812 <primary>black list (DNS)</primary>
62813 </indexterm>
62814 <option>dnslist_defer</option>: A log entry is written if an attempt to look up a host in a
62815 DNS black list suffers a temporary error.
62816 </para>
62817 </listitem>
62818 <listitem>
62819 <para>
62820 <indexterm role="concept">
62821 <primary>log</primary>
62822 <secondary>ETRN commands</secondary>
62823 </indexterm>
62824 <indexterm role="concept">
62825 <primary>ETRN</primary>
62826 <secondary>logging</secondary>
62827 </indexterm>
62828 <option>etrn</option>: Every valid ETRN command that is received is logged, before the ACL
62829 is run to determine whether or not it is actually accepted. An invalid ETRN
62830 command, or one received within a message transaction is not logged by this
62831 selector (see <option>smtp_syntax_error</option> and <option>smtp_protocol_error</option>).
62832 </para>
62833 </listitem>
62834 <listitem>
62835 <para>
62836 <indexterm role="concept">
62837 <primary>log</primary>
62838 <secondary>host lookup failure</secondary>
62839 </indexterm>
62840 <option>host_lookup_failed</option>: When a lookup of a host&#x2019;s IP addresses fails to find
62841 any addresses, or when a lookup of an IP address fails to find a host name, a
62842 log line is written. This logging does not apply to direct DNS lookups when
62843 routing email addresses, but it does apply to <quote>byname</quote> lookups.
62844 </para>
62845 </listitem>
62846 <listitem>
62847 <para>
62848 <indexterm role="concept">
62849 <primary>log</primary>
62850 <secondary>ident timeout</secondary>
62851 </indexterm>
62852 <indexterm role="concept">
62853 <primary>RFC 1413</primary>
62854 <secondary>logging timeout</secondary>
62855 </indexterm>
62856 <option>ident_timeout</option>: A log line is written whenever an attempt to connect to a
62857 client&#x2019;s ident port times out.
62858 </para>
62859 </listitem>
62860 <listitem>
62861 <para>
62862 <indexterm role="concept">
62863 <primary>log</primary>
62864 <secondary>incoming interface</secondary>
62865 </indexterm>
62866 <indexterm role="concept">
62867 <primary>interface</primary>
62868 <secondary>logging</secondary>
62869 </indexterm>
62870 <option>incoming_interface</option>: The interface on which a message was received is added
62871 to the <quote>&lt;=</quote> line as an IP address in square brackets, tagged by I= and
62872 followed by a colon and the port number. The local interface and port are also
62873 added to other SMTP log lines, for example <quote>SMTP connection from</quote>, and to
62874 rejection lines.
62875 </para>
62876 </listitem>
62877 <listitem>
62878 <para>
62879 <indexterm role="concept">
62880 <primary>log</primary>
62881 <secondary>incoming remote port</secondary>
62882 </indexterm>
62883 <indexterm role="concept">
62884 <primary>port</primary>
62885 <secondary>logging remote</secondary>
62886 </indexterm>
62887 <indexterm role="concept">
62888 <primary>TCP/IP</primary>
62889 <secondary>logging incoming remote port</secondary>
62890 </indexterm>
62891 <indexterm role="variable">
62892 <primary><varname>$sender_fullhost</varname></primary>
62893 </indexterm>
62894 <indexterm role="variable">
62895 <primary><varname>$sender_rcvhost</varname></primary>
62896 </indexterm>
62897 <option>incoming_port</option>: The remote port number from which a message was received is
62898 added to log entries and <emphasis>Received:</emphasis> header lines, following the IP address
62899 in square brackets, and separated from it by a colon. This is implemented by
62900 changing the value that is put in the <varname>$sender_fullhost</varname> and
62901 <varname>$sender_rcvhost</varname> variables. Recording the remote port number has become more
62902 important with the widening use of NAT (see RFC 2505).
62903 </para>
62904 </listitem>
62905 <listitem>
62906 <para>
62907 <indexterm role="concept">
62908 <primary>log</primary>
62909 <secondary>dropped connection</secondary>
62910 </indexterm>
62911 <option>lost_incoming_connection</option>: A log line is written when an incoming SMTP
62912 connection is unexpectedly dropped.
62913 </para>
62914 </listitem>
62915 <listitem>
62916 <para>
62917 <indexterm role="concept">
62918 <primary>log</primary>
62919 <secondary>outgoing remote port</secondary>
62920 </indexterm>
62921 <indexterm role="concept">
62922 <primary>port</primary>
62923 <secondary>logging outgoint remote</secondary>
62924 </indexterm>
62925 <indexterm role="concept">
62926 <primary>TCP/IP</primary>
62927 <secondary>logging ougtoing remote port</secondary>
62928 </indexterm>
62929 <option>outgoing_port</option>: The remote port number is added to delivery log lines (those
62930 containing =&gt; tags) following the IP address. This option is not included in
62931 the default setting, because for most ordinary configurations, the remote port
62932 number is always 25 (the SMTP port).
62933 </para>
62934 </listitem>
62935 <listitem>
62936 <para>
62937 <indexterm role="concept">
62938 <primary>log</primary>
62939 <secondary>process ids in</secondary>
62940 </indexterm>
62941 <indexterm role="concept">
62942 <primary>pid (process id)</primary>
62943 <secondary>in log lines</secondary>
62944 </indexterm>
62945 <option>pid</option>: The current process id is added to every log line, in square brackets,
62946 immediately after the time and date.
62947 </para>
62948 </listitem>
62949 <listitem>
62950 <para>
62951 <indexterm role="concept">
62952 <primary>log</primary>
62953 <secondary>queue run</secondary>
62954 </indexterm>
62955 <indexterm role="concept">
62956 <primary>queue runner</primary>
62957 <secondary>logging</secondary>
62958 </indexterm>
62959 <option>queue_run</option>: The start and end of every queue run are logged.
62960 </para>
62961 </listitem>
62962 <listitem>
62963 <para>
62964 <indexterm role="concept">
62965 <primary>log</primary>
62966 <secondary>queue time</secondary>
62967 </indexterm>
62968 <option>queue_time</option>: The amount of time the message has been in the queue on the
62969 local host is logged as QT=&lt;<emphasis>time</emphasis>&gt; on delivery (<literal>=&gt;</literal>) lines, for example,
62970 <literal>QT=3m45s</literal>. The clock starts when Exim starts to receive the message, so it
62971 includes reception time as well as the delivery time for the current address.
62972 This means that it may be longer than the difference between the arrival and
62973 delivery log line times, because the arrival log line is not written until the
62974 message has been successfully received.
62975 </para>
62976 </listitem>
62977 <listitem>
62978 <para>
62979 <option>queue_time_overall</option>: The amount of time the message has been in the queue on
62980 the local host is logged as QT=&lt;<emphasis>time</emphasis>&gt; on <quote>Completed</quote> lines, for
62981 example, <literal>QT=3m45s</literal>. The clock starts when Exim starts to receive the
62982 message, so it includes reception time as well as the total delivery time.
62983 </para>
62984 </listitem>
62985 <listitem>
62986 <para>
62987 <indexterm role="concept">
62988 <primary>log</primary>
62989 <secondary>recipients</secondary>
62990 </indexterm>
62991 <option>received_recipients</option>: The recipients of a message are listed in the main log
62992 as soon as the message is received. The list appears at the end of the log line
62993 that is written when a message is received, preceded by the word <quote>for</quote>. The
62994 addresses are listed after they have been qualified, but before any rewriting
62995 has taken place.
62996 Recipients that were discarded by an ACL for MAIL or RCPT do not appear
62997 in the list.
62998 </para>
62999 </listitem>
63000 <listitem>
63001 <para>
63002 <indexterm role="concept">
63003 <primary>log</primary>
63004 <secondary>sender reception</secondary>
63005 </indexterm>
63006 <option>received_sender</option>: The unrewritten original sender of a message is added to
63007 the end of the log line that records the message&#x2019;s arrival, after the word
63008 <quote>from</quote> (before the recipients if <option>received_recipients</option> is also set).
63009 </para>
63010 </listitem>
63011 <listitem>
63012 <para>
63013 <indexterm role="concept">
63014 <primary>log</primary>
63015 <secondary>header lines for rejection</secondary>
63016 </indexterm>
63017 <option>rejected_header</option>: If a message&#x2019;s header has been received at the time a
63018 rejection is written to the reject log, the complete header is added to the
63019 log. Header logging can be turned off individually for messages that are
63020 rejected by the <function>local_scan()</function> function (see section <xref linkend="SECTapiforloc"/>).
63021 </para>
63022 </listitem>
63023 <listitem>
63024 <para>
63025 <indexterm role="concept">
63026 <primary>log</primary>
63027 <secondary>retry defer</secondary>
63028 </indexterm>
63029 <option>retry_defer</option>: A log line is written if a delivery is deferred because a
63030 retry time has not yet been reached. However, this <quote>retry time not reached</quote>
63031 message is always omitted from individual message logs after the first delivery
63032 attempt.
63033 </para>
63034 </listitem>
63035 <listitem>
63036 <para>
63037 <indexterm role="concept">
63038 <primary>log</primary>
63039 <secondary>return path</secondary>
63040 </indexterm>
63041 <option>return_path_on_delivery</option>: The return path that is being transmitted with
63042 the message is included in delivery and bounce lines, using the tag P=.
63043 This is omitted if no delivery actually happens, for example, if routing fails,
63044 or if delivery is to <filename>/dev/null</filename> or to <literal>:blackhole:</literal>.
63045 </para>
63046 </listitem>
63047 <listitem>
63048 <para>
63049 <indexterm role="concept">
63050 <primary>log</primary>
63051 <secondary>sender on delivery</secondary>
63052 </indexterm>
63053 <option>sender_on_delivery</option>: The message&#x2019;s sender address is added to every delivery
63054 and bounce line, tagged by F= (for <quote>from</quote>).
63055 This is the original sender that was received with the message; it is not
63056 necessarily the same as the outgoing return path.
63057 </para>
63058 </listitem>
63059 <listitem>
63060 <para>
63061 <indexterm role="concept">
63062 <primary>log</primary>
63063 <secondary>sender verify failure</secondary>
63064 </indexterm>
63065 <option>sender_verify_fail</option>: If this selector is unset, the separate log line that
63066 gives details of a sender verification failure is not written. Log lines for
63067 the rejection of SMTP commands contain just <quote>sender verify failed</quote>, so some
63068 detail is lost.
63069 </para>
63070 </listitem>
63071 <listitem>
63072 <para>
63073 <indexterm role="concept">
63074 <primary>log</primary>
63075 <secondary>size rejection</secondary>
63076 </indexterm>
63077 <option>size_reject</option>: A log line is written whenever a message is rejected because
63078 it is too big.
63079 </para>
63080 </listitem>
63081 <listitem>
63082 <para>
63083 <indexterm role="concept">
63084 <primary>log</primary>
63085 <secondary>frozen messages; skipped</secondary>
63086 </indexterm>
63087 <indexterm role="concept">
63088 <primary>frozen messages</primary>
63089 <secondary>logging skipping</secondary>
63090 </indexterm>
63091 <option>skip_delivery</option>: A log line is written whenever a message is skipped during a
63092 queue run because it is frozen or because another process is already delivering
63093 it.
63094 <indexterm role="concept">
63095 <primary><quote>spool file is locked</quote></primary>
63096 </indexterm>
63097 The message that is written is <quote>spool file is locked</quote>.
63098 </para>
63099 </listitem>
63100 <listitem>
63101 <para>
63102 <indexterm role="concept">
63103 <primary>log</primary>
63104 <secondary>smtp confirmation</secondary>
63105 </indexterm>
63106 <indexterm role="concept">
63107 <primary>SMTP</primary>
63108 <secondary>logging confirmation</secondary>
63109 </indexterm>
63110 <indexterm role="concept">
63111 <primary>LMTP</primary>
63112 <secondary>logging confirmation</secondary>
63113 </indexterm>
63114 <option>smtp_confirmation</option>: The response to the final <quote>.</quote> in the SMTP or LMTP dialogue for
63115 outgoing messages is added to delivery log lines in the form <literal>C=</literal>&lt;<emphasis>text</emphasis>&gt;.
63116 A number of MTAs (including Exim) return an identifying string in this
63117 response.
63118 </para>
63119 </listitem>
63120 <listitem>
63121 <para>
63122 <indexterm role="concept">
63123 <primary>log</primary>
63124 <secondary>SMTP connections</secondary>
63125 </indexterm>
63126 <indexterm role="concept">
63127 <primary>SMTP</primary>
63128 <secondary>logging connections</secondary>
63129 </indexterm>
63130 <option>smtp_connection</option>: A log line is written whenever an SMTP connection is
63131 established or closed, unless the connection is from a host that matches
63132 <option>hosts_connection_nolog</option>. (In contrast, <option>lost_incoming_connection</option> applies
63133 only when the closure is unexpected.) This applies to connections from local
63134 processes that use <option>-bs</option> as well as to TCP/IP connections. If a connection is
63135 dropped in the middle of a message, a log line is always written, whether or
63136 not this selector is set, but otherwise nothing is written at the start and end
63137 of connections unless this selector is enabled.
63138 </para>
63139 <para>
63140 For TCP/IP connections to an Exim daemon, the current number of connections is
63141 included in the log message for each new connection, but note that the count is
63142 reset if the daemon is restarted.
63143 Also, because connections are closed (and the closure is logged) in
63144 subprocesses, the count may not include connections that have been closed but
63145 whose termination the daemon has not yet noticed. Thus, while it is possible to
63146 match up the opening and closing of connections in the log, the value of the
63147 logged counts may not be entirely accurate.
63148 </para>
63149 </listitem>
63150 <listitem>
63151 <para>
63152 <indexterm role="concept">
63153 <primary>log</primary>
63154 <secondary>SMTP transaction; incomplete</secondary>
63155 </indexterm>
63156 <indexterm role="concept">
63157 <primary>SMTP</primary>
63158 <secondary>logging incomplete transactions</secondary>
63159 </indexterm>
63160 <option>smtp_incomplete_transaction</option>: When a mail transaction is aborted by
63161 RSET, QUIT, loss of connection, or otherwise, the incident is logged,
63162 and the message sender plus any accepted recipients are included in the log
63163 line. This can provide evidence of dictionary attacks.
63164 </para>
63165 </listitem>
63166 <listitem>
63167 <para>
63168 <indexterm role="concept">
63169 <primary>log</primary>
63170 <secondary>non-MAIL SMTP sessions</secondary>
63171 </indexterm>
63172 <indexterm role="concept">
63173 <primary>MAIL</primary>
63174 <secondary>logging session without</secondary>
63175 </indexterm>
63176 <option>smtp_no_mail</option>: A line is written to the main log whenever an accepted SMTP
63177 connection terminates without having issued a MAIL command. This includes both
63178 the case when the connection is dropped, and the case when QUIT is used. It
63179 does not include cases where the connection is rejected right at the start (by
63180 an ACL, or because there are too many connections, or whatever). These cases
63181 already have their own log lines.
63182 </para>
63183 <para>
63184 The log line that is written contains the identity of the client in the usual
63185 way, followed by D= and a time, which records the duration of the connection.
63186 If the connection was authenticated, this fact is logged exactly as it is for
63187 an incoming message, with an A= item. If the connection was encrypted, CV=,
63188 DN=, and X= items may appear as they do for an incoming message, controlled by
63189 the same logging options.
63190 </para>
63191 <para>
63192 Finally, if any SMTP commands were issued during the connection, a C= item
63193 is added to the line, listing the commands that were used. For example,
63194 </para>
63195 <literallayout class="monospaced">
63196 C=EHLO,QUIT
63197 </literallayout>
63198 <para>
63199 shows that the client issued QUIT straight after EHLO. If there were fewer
63200 than 20 commands, they are all listed. If there were more than 20 commands,
63201 the last 20 are listed, preceded by <quote>...</quote>. However, with the default
63202 setting of 10 for <option>smtp_accep_max_nonmail</option>, the connection will in any case
63203 have been aborted before 20 non-mail commands are processed.
63204 </para>
63205 </listitem>
63206 <listitem>
63207 <para>
63208 <option>smtp_mailauth</option>: A third subfield with the authenticated sender,
63209 colon-separated, is appended to the A= item for a message arrival or delivery
63210 log line, if an AUTH argument to the SMTP MAIL command (see <xref linkend="SECTauthparamail"/>)
63211 was accepted or used.
63212 </para>
63213 </listitem>
63214 <listitem>
63215 <para>
63216 <indexterm role="concept">
63217 <primary>log</primary>
63218 <secondary>SMTP protocol error</secondary>
63219 </indexterm>
63220 <indexterm role="concept">
63221 <primary>SMTP</primary>
63222 <secondary>logging protocol error</secondary>
63223 </indexterm>
63224 <option>smtp_protocol_error</option>: A log line is written for every SMTP protocol error
63225 encountered. Exim does not have perfect detection of all protocol errors
63226 because of transmission delays and the use of pipelining. If PIPELINING has
63227 been advertised to a client, an Exim server assumes that the client will use
63228 it, and therefore it does not count <quote>expected</quote> errors (for example, RCPT
63229 received after rejecting MAIL) as protocol errors.
63230 </para>
63231 </listitem>
63232 <listitem>
63233 <para>
63234 <indexterm role="concept">
63235 <primary>SMTP</primary>
63236 <secondary>logging syntax errors</secondary>
63237 </indexterm>
63238 <indexterm role="concept">
63239 <primary>SMTP</primary>
63240 <secondary>syntax errors; logging</secondary>
63241 </indexterm>
63242 <indexterm role="concept">
63243 <primary>SMTP</primary>
63244 <secondary>unknown command; logging</secondary>
63245 </indexterm>
63246 <indexterm role="concept">
63247 <primary>log</primary>
63248 <secondary>unknown SMTP command</secondary>
63249 </indexterm>
63250 <indexterm role="concept">
63251 <primary>log</primary>
63252 <secondary>SMTP syntax error</secondary>
63253 </indexterm>
63254 <option>smtp_syntax_error</option>: A log line is written for every SMTP syntax error
63255 encountered. An unrecognized command is treated as a syntax error. For an
63256 external connection, the host identity is given; for an internal connection
63257 using <option>-bs</option> the sender identification (normally the calling user) is given.
63258 </para>
63259 </listitem>
63260 <listitem>
63261 <para>
63262 <indexterm role="concept">
63263 <primary>log</primary>
63264 <secondary>subject</secondary>
63265 </indexterm>
63266 <indexterm role="concept">
63267 <primary>subject, logging</primary>
63268 </indexterm>
63269 <option>subject</option>: The subject of the message is added to the arrival log line,
63270 preceded by <quote>T=</quote> (T for <quote>topic</quote>, since S is already used for <quote>size</quote>).
63271 Any MIME <quote>words</quote> in the subject are decoded. The <option>print_topbitchars</option> option
63272 specifies whether characters with values greater than 127 should be logged
63273 unchanged, or whether they should be rendered as escape sequences.
63274 </para>
63275 </listitem>
63276 <listitem>
63277 <para>
63278 <indexterm role="concept">
63279 <primary>log</primary>
63280 <secondary>certificate verification</secondary>
63281 </indexterm>
63282 <option>tls_certificate_verified</option>: An extra item is added to &lt;= and =&gt; log lines
63283 when TLS is in use. The item is <literal>CV=yes</literal> if the peer&#x2019;s certificate was
63284 verified, and <literal>CV=no</literal> if not.
63285 </para>
63286 </listitem>
63287 <listitem>
63288 <para>
63289 <indexterm role="concept">
63290 <primary>log</primary>
63291 <secondary>TLS cipher</secondary>
63292 </indexterm>
63293 <indexterm role="concept">
63294 <primary>TLS</primary>
63295 <secondary>logging cipher</secondary>
63296 </indexterm>
63297 <option>tls_cipher</option>: When a message is sent or received over an encrypted
63298 connection, the cipher suite used is added to the log line, preceded by X=.
63299 </para>
63300 </listitem>
63301 <listitem>
63302 <para>
63303 <indexterm role="concept">
63304 <primary>log</primary>
63305 <secondary>TLS peer DN</secondary>
63306 </indexterm>
63307 <indexterm role="concept">
63308 <primary>TLS</primary>
63309 <secondary>logging peer DN</secondary>
63310 </indexterm>
63311 <option>tls_peerdn</option>: When a message is sent or received over an encrypted
63312 connection, and a certificate is supplied by the remote host, the peer DN is
63313 added to the log line, preceded by DN=.
63314 </para>
63315 </listitem>
63316 <listitem>
63317 <para>
63318 <indexterm role="concept">
63319 <primary>log</primary>
63320 <secondary>TLS SNI</secondary>
63321 </indexterm>
63322 <indexterm role="concept">
63323 <primary>TLS</primary>
63324 <secondary>logging SNI</secondary>
63325 </indexterm>
63326 <option>tls_sni</option>: When a message is received over an encrypted connection, and
63327 the remote host provided the Server Name Indication extension, the SNI is
63328 added to the log line, preceded by SNI=.
63329 </para>
63330 </listitem>
63331 <listitem>
63332 <para>
63333 <indexterm role="concept">
63334 <primary>log</primary>
63335 <secondary>DNS failure in list</secondary>
63336 </indexterm>
63337 <option>unknown_in_list</option>: This setting causes a log entry to be written when the
63338 result of a list match is failure because a DNS lookup failed.
63339 </para>
63340 </listitem>
63341 </itemizedlist>
63342 </section>
63343 <section id="SECID260">
63344 <title>Message log</title>
63345 <para>
63346 <indexterm role="concept">
63347 <primary>message</primary>
63348 <secondary>log file for</secondary>
63349 </indexterm>
63350 <indexterm role="concept">
63351 <primary>log</primary>
63352 <secondary>message log; description of</secondary>
63353 </indexterm>
63354 <indexterm role="concept">
63355 <primary><filename>msglog</filename> directory</primary>
63356 </indexterm>
63357 <indexterm role="option">
63358 <primary><option>preserve_message_logs</option></primary>
63359 </indexterm>
63360 In addition to the general log files, Exim writes a log file for each message
63361 that it handles. The names of these per-message logs are the message ids, and
63362 they are kept in the <filename>msglog</filename> sub-directory of the spool directory. Each
63363 message log contains copies of the log lines that apply to the message. This
63364 makes it easier to inspect the status of an individual message without having
63365 to search the main log. A message log is deleted when processing of the message
63366 is complete, unless <option>preserve_message_logs</option> is set, but this should be used
63367 only with great care because they can fill up your disk very quickly.
63368 </para>
63369 <para>
63370 On a heavily loaded system, it may be desirable to disable the use of
63371 per-message logs, in order to reduce disk I/O. This can be done by setting the
63372 <option>message_logs</option> option false.
63373 <indexterm role="concept" startref="IIDloggen" class="endofrange"/>
63374 </para>
63375 </section>
63376 </chapter>
63377
63378 <chapter id="CHAPutils">
63379 <title>Exim utilities</title>
63380 <para>
63381 <indexterm role="concept" id="IIDutils" class="startofrange">
63382 <primary>utilities</primary>
63383 </indexterm>
63384 A number of utility scripts and programs are supplied with Exim and are
63385 described in this chapter. There is also the Exim Monitor, which is covered in
63386 the next chapter. The utilities described here are:
63387 </para>
63388 <informaltable frame="none">
63389 <tgroup cols="3" colsep="0" rowsep="0">
63390 <colspec colwidth="7*" align="left"/>
63391 <colspec colwidth="15*" align="left"/>
63392 <colspec colwidth="40*" align="left"/>
63393 <tbody>
63394 <row>
63395 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<xref linkend="SECTfinoutwha"/></entry>
63396 <entry><emphasis>exiwhat</emphasis></entry>
63397 <entry>list what Exim processes are doing</entry>
63398 </row>
63399 <row>
63400 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<xref linkend="SECTgreptheque"/></entry>
63401 <entry><emphasis>exiqgrep</emphasis></entry>
63402 <entry>grep the queue</entry>
63403 </row>
63404 <row>
63405 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<xref linkend="SECTsumtheque"/></entry>
63406 <entry><emphasis>exiqsumm</emphasis></entry>
63407 <entry>summarize the queue</entry>
63408 </row>
63409 <row>
63410 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<xref linkend="SECTextspeinf"/></entry>
63411 <entry><emphasis>exigrep</emphasis></entry>
63412 <entry>search the main log</entry>
63413 </row>
63414 <row>
63415 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<xref linkend="SECTexipick"/></entry>
63416 <entry><emphasis>exipick</emphasis></entry>
63417 <entry>select messages on various criteria</entry>
63418 </row>
63419 <row>
63420 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<xref linkend="SECTcyclogfil"/></entry>
63421 <entry><emphasis>exicyclog</emphasis></entry>
63422 <entry>cycle (rotate) log files</entry>
63423 </row>
63424 <row>
63425 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<xref linkend="SECTmailstat"/></entry>
63426 <entry><emphasis>eximstats</emphasis></entry>
63427 <entry>extract statistics from the log</entry>
63428 </row>
63429 <row>
63430 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<xref linkend="SECTcheckaccess"/></entry>
63431 <entry><emphasis>exim_checkaccess</emphasis></entry>
63432 <entry>check address acceptance from given IP</entry>
63433 </row>
63434 <row>
63435 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<xref linkend="SECTdbmbuild"/></entry>
63436 <entry><emphasis>exim_dbmbuild</emphasis></entry>
63437 <entry>build a DBM file</entry>
63438 </row>
63439 <row>
63440 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<xref linkend="SECTfinindret"/></entry>
63441 <entry><emphasis>exinext</emphasis></entry>
63442 <entry>extract retry information</entry>
63443 </row>
63444 <row>
63445 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<xref linkend="SECThindatmai"/></entry>
63446 <entry><emphasis>exim_dumpdb</emphasis></entry>
63447 <entry>dump a hints database</entry>
63448 </row>
63449 <row>
63450 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<xref linkend="SECThindatmai"/></entry>
63451 <entry><emphasis>exim_tidydb</emphasis></entry>
63452 <entry>clean up a hints database</entry>
63453 </row>
63454 <row>
63455 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<xref linkend="SECThindatmai"/></entry>
63456 <entry><emphasis>exim_fixdb</emphasis></entry>
63457 <entry>patch a hints database</entry>
63458 </row>
63459 <row>
63460 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<xref linkend="SECTmailboxmaint"/></entry>
63461 <entry><emphasis>exim_lock</emphasis></entry>
63462 <entry>lock a mailbox file</entry>
63463 </row>
63464 </tbody>
63465 </tgroup>
63466 </informaltable>
63467 <para>
63468 Another utility that might be of use to sites with many MTAs is Tom Kistner&#x2019;s
63469 <emphasis>exilog</emphasis>. It provides log visualizations across multiple Exim servers. See
63470 <emphasis role="bold"><ulink url="http://duncanthrax.net/exilog/">http://duncanthrax.net/exilog/</ulink></emphasis> for details.
63471 </para>
63472 <section id="SECTfinoutwha">
63473 <title>Finding out what Exim processes are doing (exiwhat)</title>
63474 <para>
63475 <indexterm role="concept">
63476 <primary><emphasis>exiwhat</emphasis></primary>
63477 </indexterm>
63478 <indexterm role="concept">
63479 <primary>process, querying</primary>
63480 </indexterm>
63481 <indexterm role="concept">
63482 <primary>SIGUSR1</primary>
63483 </indexterm>
63484 On operating systems that can restart a system call after receiving a signal
63485 (most modern OS), an Exim process responds to the SIGUSR1 signal by writing
63486 a line describing what it is doing to the file <filename>exim-process.info</filename> in the
63487 Exim spool directory. The <emphasis>exiwhat</emphasis> script sends the signal to all Exim
63488 processes it can find, having first emptied the file. It then waits for one
63489 second to allow the Exim processes to react before displaying the results. In
63490 order to run <emphasis>exiwhat</emphasis> successfully you have to have sufficient privilege to
63491 send the signal to the Exim processes, so it is normally run as root.
63492 </para>
63493 <para>
63494 <emphasis role="bold">Warning</emphasis>: This is not an efficient process. It is intended for occasional
63495 use by system administrators. It is not sensible, for example, to set up a
63496 script that sends SIGUSR1 signals to Exim processes at short intervals.
63497 </para>
63498 <para>
63499 Unfortunately, the <emphasis>ps</emphasis> command that <emphasis>exiwhat</emphasis> uses to find Exim processes
63500 varies in different operating systems. Not only are different options used,
63501 but the format of the output is different. For this reason, there are some
63502 system configuration options that configure exactly how <emphasis>exiwhat</emphasis> works. If
63503 it doesn&#x2019;t seem to be working for you, check the following compile-time
63504 options:
63505 </para>
63506 <literallayout>
63507 <literal>EXIWHAT_PS_CMD    </literal> the command for running <emphasis>ps</emphasis>
63508 <literal>EXIWHAT_PS_ARG    </literal> the argument for <emphasis>ps</emphasis>
63509 <literal>EXIWHAT_EGREP_ARG </literal> the argument for <emphasis>egrep</emphasis> to select from <emphasis>ps</emphasis> output
63510 <literal>EXIWHAT_KILL_ARG  </literal> the argument for the <emphasis>kill</emphasis> command
63511 </literallayout>
63512 <para>
63513 An example of typical output from <emphasis>exiwhat</emphasis> is
63514 </para>
63515 <literallayout class="monospaced">
63516 164 daemon: -q1h, listening on port 25
63517 10483 running queue: waiting for 0tAycK-0002ij-00 (10492)
63518 10492 delivering 0tAycK-0002ij-00 to mail.ref.example
63519   [10.19.42.42] (editor@ref.example)
63520 10592 handling incoming call from [192.168.243.242]
63521 10628 accepting a local non-SMTP message
63522 </literallayout>
63523 <para>
63524 The first number in the output line is the process number. The third line has
63525 been split here, in order to fit it on the page.
63526 </para>
63527 </section>
63528 <section id="SECTgreptheque">
63529 <title>Selective queue listing (exiqgrep)</title>
63530 <para>
63531 <indexterm role="concept">
63532 <primary><emphasis>exiqgrep</emphasis></primary>
63533 </indexterm>
63534 <indexterm role="concept">
63535 <primary>queue</primary>
63536 <secondary>grepping</secondary>
63537 </indexterm>
63538 This utility is a Perl script contributed by Matt Hubbard. It runs
63539 </para>
63540 <literallayout class="monospaced">
63541 exim -bpu
63542 </literallayout>
63543 <para>
63544 or (in case <emphasis role="bold">-a</emphasis> switch is specified)
63545 </para>
63546 <literallayout class="monospaced">
63547 exim -bp
63548 </literallayout>
63549 <para>
63550 The <emphasis role="bold">-C</emphasis> option is used to specify an alternate <filename>exim.conf</filename> which might
63551 contain alternate exim configuration the queue management might be using.
63552 </para>
63553 <para>
63554 to obtain a queue listing, and then greps the output to select messages 
63555 that match given criteria. The following selection options are available:
63556 </para>
63557 <variablelist>
63558 <varlistentry>
63559 <term><emphasis role="bold">-f</emphasis>&nbsp;&lt;<emphasis>regex</emphasis>&gt;</term>
63560 <listitem>
63561 <para>
63562 Match the sender address using a case-insensitive search. The field that is
63563 tested is enclosed in angle brackets, so you can test for bounce messages with
63564 </para>
63565 <literallayout class="monospaced">
63566 exiqgrep -f '^&lt;&gt;$'
63567 </literallayout>
63568 </listitem></varlistentry>
63569 <varlistentry>
63570 <term><emphasis role="bold">-r</emphasis>&nbsp;&lt;<emphasis>regex</emphasis>&gt;</term>
63571 <listitem>
63572 <para>
63573 Match a recipient address using a case-insensitve search. The field that is
63574 tested is not enclosed in angle brackets.
63575 </para>
63576 </listitem></varlistentry>
63577 <varlistentry>
63578 <term><emphasis role="bold">-s</emphasis>&nbsp;&lt;<emphasis>regex</emphasis>&gt;</term>
63579 <listitem>
63580 <para>
63581 Match against the size field.
63582 </para>
63583 </listitem></varlistentry>
63584 <varlistentry>
63585 <term><emphasis role="bold">-y</emphasis>&nbsp;&lt;<emphasis>seconds</emphasis>&gt;</term>
63586 <listitem>
63587 <para>
63588 Match messages that are younger than the given time.
63589 </para>
63590 </listitem></varlistentry>
63591 <varlistentry>
63592 <term><emphasis role="bold">-o</emphasis>&nbsp;&lt;<emphasis>seconds</emphasis>&gt;</term>
63593 <listitem>
63594 <para>
63595 Match messages that are older than the given time.
63596 </para>
63597 </listitem></varlistentry>
63598 <varlistentry>
63599 <term><emphasis role="bold">-z</emphasis></term>
63600 <listitem>
63601 <para>
63602 Match only frozen messages.
63603 </para>
63604 </listitem></varlistentry>
63605 <varlistentry>
63606 <term><emphasis role="bold">-x</emphasis></term>
63607 <listitem>
63608 <para>
63609 Match only non-frozen messages.
63610 </para>
63611 </listitem></varlistentry>
63612 </variablelist>
63613 <para>
63614 The following options control the format of the output:
63615 </para>
63616 <variablelist>
63617 <varlistentry>
63618 <term><emphasis role="bold">-c</emphasis></term>
63619 <listitem>
63620 <para>
63621 Display only the count of matching messages.
63622 </para>
63623 </listitem></varlistentry>
63624 <varlistentry>
63625 <term><emphasis role="bold">-l</emphasis></term>
63626 <listitem>
63627 <para>
63628 Long format &ndash; display the full message information as output by Exim. This is
63629 the default.
63630 </para>
63631 </listitem></varlistentry>
63632 <varlistentry>
63633 <term><emphasis role="bold">-i</emphasis></term>
63634 <listitem>
63635 <para>
63636 Display message ids only.
63637 </para>
63638 </listitem></varlistentry>
63639 <varlistentry>
63640 <term><emphasis role="bold">-b</emphasis></term>
63641 <listitem>
63642 <para>
63643 Brief format &ndash; one line per message.
63644 </para>
63645 </listitem></varlistentry>
63646 <varlistentry>
63647 <term><emphasis role="bold">-R</emphasis></term>
63648 <listitem>
63649 <para>
63650 Display messages in reverse order.
63651 </para>
63652 </listitem></varlistentry>
63653 <varlistentry>
63654 <term><emphasis role="bold">-a</emphasis></term>
63655 <listitem>
63656 <para>
63657 Include delivered recipients in queue listing.
63658 </para>
63659 </listitem></varlistentry>
63660 </variablelist>
63661 <para>
63662 There is one more option, <option>-h</option>, which outputs a list of options.
63663 </para>
63664 </section>
63665 <section id="SECTsumtheque">
63666 <title>Summarizing the queue (exiqsumm)</title>
63667 <para>
63668 <indexterm role="concept">
63669 <primary><emphasis>exiqsumm</emphasis></primary>
63670 </indexterm>
63671 <indexterm role="concept">
63672 <primary>queue</primary>
63673 <secondary>summary</secondary>
63674 </indexterm>
63675 The <emphasis>exiqsumm</emphasis> utility is a Perl script which reads the output of <literal>exim
63676 -bp</literal> and produces a summary of the messages on the queue. Thus, you use it by
63677 running a command such as
63678 </para>
63679 <literallayout class="monospaced">
63680 exim -bp | exiqsumm
63681 </literallayout>
63682 <para>
63683 The output consists of one line for each domain that has messages waiting for
63684 it, as in the following example:
63685 </para>
63686 <literallayout class="monospaced">
63687 3   2322   74m   66m  msn.com.example
63688 </literallayout>
63689 <para>
63690 Each line lists the number of pending deliveries for a domain, their total
63691 volume, and the length of time that the oldest and the newest messages have
63692 been waiting. Note that the number of pending deliveries is greater than the
63693 number of messages when messages have more than one recipient.
63694 </para>
63695 <para>
63696 A summary line is output at the end. By default the output is sorted on the
63697 domain name, but <emphasis>exiqsumm</emphasis> has the options <option>-a</option> and <option>-c</option>, which cause
63698 the output to be sorted by oldest message and by count of messages,
63699 respectively. There are also three options that split the messages for each
63700 domain into two or more subcounts: <option>-b</option> separates bounce messages, <option>-f</option>
63701 separates frozen messages, and <option>-s</option> separates messages according to their
63702 sender.
63703 </para>
63704 <para>
63705 The output of <emphasis>exim -bp</emphasis> contains the original addresses in the message, so
63706 this also applies to the output from <emphasis>exiqsumm</emphasis>. No domains from addresses
63707 generated by aliasing or forwarding are included (unless the <option>one_time</option>
63708 option of the <command>redirect</command> router has been used to convert them into <quote>top
63709 level</quote> addresses).
63710 </para>
63711 </section>
63712 <section id="SECTextspeinf">
63713 <title>Extracting specific information from the log (exigrep)</title>
63714 <para>
63715 <indexterm role="concept">
63716 <primary><emphasis>exigrep</emphasis></primary>
63717 </indexterm>
63718 <indexterm role="concept">
63719 <primary>log</primary>
63720 <secondary>extracts; grepping for</secondary>
63721 </indexterm>
63722 The <emphasis>exigrep</emphasis> utility is a Perl script that searches one or more main log
63723 files for entries that match a given pattern. When it finds a match, it
63724 extracts all the log entries for the relevant message, not just those that
63725 match the pattern. Thus, <emphasis>exigrep</emphasis> can extract complete log entries for a
63726 given message, or all mail for a given user, or for a given host, for example.
63727 The input files can be in Exim log format or syslog format.
63728 If a matching log line is not associated with a specific message, it is
63729 included in <emphasis>exigrep</emphasis>&#x2019;s output without any additional lines. The usage is:
63730 </para>
63731 <literallayout>
63732 <literal>exigrep [-t&lt;</literal><emphasis>n</emphasis><literal>&gt;] [-I] [-l] [-v] &lt;</literal><emphasis>pattern</emphasis><literal>&gt; [&lt;</literal><emphasis>log file</emphasis><literal>&gt;] ...</literal>
63733 </literallayout>
63734 <para>
63735 If no log file names are given on the command line, the standard input is read.
63736 </para>
63737 <para>
63738 The <option>-t</option> argument specifies a number of seconds. It adds an additional
63739 condition for message selection. Messages that are complete are shown only if
63740 they spent more than &lt;<emphasis>n</emphasis>&gt; seconds on the queue.
63741 </para>
63742 <para>
63743 By default, <emphasis>exigrep</emphasis> does case-insensitive matching. The <option>-I</option> option
63744 makes it case-sensitive. This may give a performance improvement when searching
63745 large log files. Without <option>-I</option>, the Perl pattern matches use Perl&#x2019;s <literal>/i</literal>
63746 option; with <option>-I</option> they do not. In both cases it is possible to change the
63747 case sensitivity within the pattern by using <literal>(?i)</literal> or <literal>(?-i)</literal>.
63748 </para>
63749 <para>
63750 The <option>-l</option> option means <quote>literal</quote>, that is, treat all characters in the
63751 pattern as standing for themselves. Otherwise the pattern must be a Perl
63752 regular expression.
63753 </para>
63754 <para>
63755 The <option>-v</option> option inverts the matching condition. That is, a line is selected
63756 if it does <emphasis>not</emphasis> match the pattern.
63757 </para>
63758 <para>
63759 If the location of a <emphasis>zcat</emphasis> command is known from the definition of
63760 ZCAT_COMMAND in <filename>Local/Makefile</filename>, <emphasis>exigrep</emphasis> automatically passes any file
63761 whose name ends in COMPRESS_SUFFIX through <emphasis>zcat</emphasis> as it searches it.
63762 </para>
63763 </section>
63764 <section id="SECTexipick">
63765 <title>Selecting messages by various criteria (exipick)</title>
63766 <para>
63767 <indexterm role="concept">
63768 <primary><emphasis>exipick</emphasis></primary>
63769 </indexterm>
63770 John Jetmore&#x2019;s <emphasis>exipick</emphasis> utility is included in the Exim distribution. It
63771 lists messages from the queue according to a variety of criteria. For details
63772 of <emphasis>exipick</emphasis>&#x2019;s facilities, visit the web page at
63773 <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
63774 the <option>--help</option> option.
63775 </para>
63776 </section>
63777 <section id="SECTcyclogfil">
63778 <title>Cycling log files (exicyclog)</title>
63779 <para>
63780 <indexterm role="concept">
63781 <primary>log</primary>
63782 <secondary>cycling local files</secondary>
63783 </indexterm>
63784 <indexterm role="concept">
63785 <primary>cycling logs</primary>
63786 </indexterm>
63787 <indexterm role="concept">
63788 <primary><emphasis>exicyclog</emphasis></primary>
63789 </indexterm>
63790 The <emphasis>exicyclog</emphasis> script can be used to cycle (rotate) <emphasis>mainlog</emphasis> and
63791 <emphasis>rejectlog</emphasis> files. This is not necessary if only syslog is being used, or if
63792 you are using log files with datestamps in their names (see section
63793 <xref linkend="SECTdatlogfil"/>). Some operating systems have their own standard mechanisms
63794 for log cycling, and these can be used instead of <emphasis>exicyclog</emphasis> if preferred.
63795 There are two command line options for <emphasis>exicyclog</emphasis>:
63796 </para>
63797 <itemizedlist>
63798 <listitem>
63799 <para>
63800 <option>-k</option> &lt;<emphasis>count</emphasis>&gt; specifies the number of log files to keep, overriding the
63801 default that is set when Exim is built. The default default is 10.
63802 </para>
63803 </listitem>
63804 <listitem>
63805 <para>
63806 <option>-l</option> &lt;<emphasis>path</emphasis>&gt; specifies the log file path, in the same format as Exim&#x2019;s
63807 <option>log_file_path</option> option (for example, <literal>/var/log/exim_%slog</literal>), again
63808 overriding the script&#x2019;s default, which is to find the setting from Exim&#x2019;s
63809 configuration.
63810 </para>
63811 </listitem>
63812 </itemizedlist>
63813 <para>
63814 Each time <emphasis>exicyclog</emphasis> is run the file names get <quote>shuffled down</quote> by one. If
63815 the main log file name is <filename>mainlog</filename> (the default) then when <emphasis>exicyclog</emphasis> is
63816 run <filename>mainlog</filename> becomes <filename>mainlog.01</filename>, the previous <filename>mainlog.01</filename> becomes
63817 <filename>mainlog.02</filename> and so on, up to the limit that is set in the script or by the
63818 <option>-k</option> option. Log files whose numbers exceed the limit are discarded. Reject
63819 logs are handled similarly.
63820 </para>
63821 <para>
63822 If the limit is greater than 99, the script uses 3-digit numbers such as
63823 <filename>mainlog.001</filename>, <filename>mainlog.002</filename>, etc. If you change from a number less than 99
63824 to one that is greater, or <emphasis>vice versa</emphasis>, you will have to fix the names of
63825 any existing log files.
63826 </para>
63827 <para>
63828 If no <filename>mainlog</filename> file exists, the script does nothing. Files that <quote>drop off</quote>
63829 the end are deleted. All files with numbers greater than 01 are compressed,
63830 using a compression command which is configured by the COMPRESS_COMMAND
63831 setting in <filename>Local/Makefile</filename>. It is usual to run <emphasis>exicyclog</emphasis> daily from a
63832 root <option>crontab</option> entry of the form
63833 </para>
63834 <literallayout class="monospaced">
63835 1 0 * * * su exim -c /usr/exim/bin/exicyclog
63836 </literallayout>
63837 <para>
63838 assuming you have used the name <quote>exim</quote> for the Exim user. You can run
63839 <emphasis>exicyclog</emphasis> as root if you wish, but there is no need.
63840 </para>
63841 </section>
63842 <section id="SECTmailstat">
63843 <title>Mail statistics (eximstats)</title>
63844 <para>
63845 <indexterm role="concept">
63846 <primary>statistics</primary>
63847 </indexterm>
63848 <indexterm role="concept">
63849 <primary><emphasis>eximstats</emphasis></primary>
63850 </indexterm>
63851 A Perl script called <emphasis>eximstats</emphasis> is provided for extracting statistical
63852 information from log files. The output is either plain text, or HTML.
63853 Exim log files are also supported by the <emphasis>Lire</emphasis> system produced by the
63854 LogReport Foundation <emphasis role="bold"><ulink url="http://www.logreport.org">http://www.logreport.org</ulink></emphasis>.
63855 </para>
63856 <para>
63857 The <emphasis>eximstats</emphasis> script has been hacked about quite a bit over time. The
63858 latest version is the result of some extensive revision by Steve Campbell. A
63859 lot of information is given by default, but there are options for suppressing
63860 various parts of it. Following any options, the arguments to the script are a
63861 list of files, which should be main log files. For example:
63862 </para>
63863 <literallayout class="monospaced">
63864 eximstats -nr /var/spool/exim/log/mainlog.01
63865 </literallayout>
63866 <para>
63867 By default, <emphasis>eximstats</emphasis> extracts information about the number and volume of
63868 messages received from or delivered to various hosts. The information is sorted
63869 both by message count and by volume, and the top fifty hosts in each category
63870 are listed on the standard output. Similar information, based on email
63871 addresses or domains instead of hosts can be requested by means of various
63872 options. For messages delivered and received locally, similar statistics are
63873 also produced per user.
63874 </para>
63875 <para>
63876 The output also includes total counts and statistics about delivery errors, and
63877 histograms showing the number of messages received and deliveries made in each
63878 hour of the day. A delivery with more than one address in its envelope (for
63879 example, an SMTP transaction with more than one RCPT command) is counted
63880 as a single delivery by <emphasis>eximstats</emphasis>.
63881 </para>
63882 <para>
63883 Though normally more deliveries than receipts are reported (as messages may
63884 have multiple recipients), it is possible for <emphasis>eximstats</emphasis> to report more
63885 messages received than delivered, even though the queue is empty at the start
63886 and end of the period in question. If an incoming message contains no valid
63887 recipients, no deliveries are recorded for it. A bounce message is handled as
63888 an entirely separate message.
63889 </para>
63890 <para>
63891 <emphasis>eximstats</emphasis> always outputs a grand total summary giving the volume and number
63892 of messages received and deliveries made, and the number of hosts involved in
63893 each case. It also outputs the number of messages that were delayed (that is,
63894 not completely delivered at the first attempt), and the number that had at
63895 least one address that failed.
63896 </para>
63897 <para>
63898 The remainder of the output is in sections that can be independently disabled
63899 or modified by various options. It consists of a summary of deliveries by
63900 transport, histograms of messages received and delivered per time interval
63901 (default per hour), information about the time messages spent on the queue,
63902 a list of relayed messages, lists of the top fifty sending hosts, local
63903 senders, destination hosts, and destination local users by count and by volume,
63904 and a list of delivery errors that occurred.
63905 </para>
63906 <para>
63907 The relay information lists messages that were actually relayed, that is, they
63908 came from a remote host and were directly delivered to some other remote host,
63909 without being processed (for example, for aliasing or forwarding) locally.
63910 </para>
63911 <para>
63912 There are quite a few options for <emphasis>eximstats</emphasis> to control exactly what it
63913 outputs. These are documented in the Perl script itself, and can be extracted
63914 by running the command <command>perldoc</command> on the script. For example:
63915 </para>
63916 <literallayout class="monospaced">
63917 perldoc /usr/exim/bin/eximstats
63918 </literallayout>
63919 </section>
63920 <section id="SECTcheckaccess">
63921 <title>Checking access policy (exim_checkaccess)</title>
63922 <para>
63923 <indexterm role="concept">
63924 <primary><emphasis>exim_checkaccess</emphasis></primary>
63925 </indexterm>
63926 <indexterm role="concept">
63927 <primary>policy control</primary>
63928 <secondary>checking access</secondary>
63929 </indexterm>
63930 <indexterm role="concept">
63931 <primary>checking access</primary>
63932 </indexterm>
63933 The <option>-bh</option> command line argument allows you to run a fake SMTP session with
63934 debugging output, in order to check what Exim is doing when it is applying
63935 policy controls to incoming SMTP mail. However, not everybody is sufficiently
63936 familiar with the SMTP protocol to be able to make full use of <option>-bh</option>, and
63937 sometimes you just want to answer the question <quote>Does this address have
63938 access?</quote> without bothering with any further details.
63939 </para>
63940 <para>
63941 The <emphasis>exim_checkaccess</emphasis> utility is a <quote>packaged</quote> version of <option>-bh</option>. It takes
63942 two arguments, an IP address and an email address:
63943 </para>
63944 <literallayout class="monospaced">
63945 exim_checkaccess 10.9.8.7 A.User@a.domain.example
63946 </literallayout>
63947 <para>
63948 The utility runs a call to Exim with the <option>-bh</option> option, to test whether the
63949 given email address would be accepted in a RCPT command in a TCP/IP
63950 connection from the host with the given IP address. The output of the utility
63951 is either the word <quote>accepted</quote>, or the SMTP error response, for example:
63952 </para>
63953 <literallayout class="monospaced">
63954 Rejected:
63955 550 Relay not permitted
63956 </literallayout>
63957 <para>
63958 When running this test, the utility uses <literal>&lt;&gt;</literal> as the envelope sender address
63959 for the MAIL command, but you can change this by providing additional
63960 options. These are passed directly to the Exim command. For example, to specify
63961 that the test is to be run with the sender address <emphasis>himself@there.example</emphasis>
63962 you can use:
63963 </para>
63964 <literallayout class="monospaced">
63965 exim_checkaccess 10.9.8.7 A.User@a.domain.example \
63966                  -f himself@there.example
63967 </literallayout>
63968 <para>
63969 Note that these additional Exim command line items must be given after the two
63970 mandatory arguments.
63971 </para>
63972 <para>
63973 Because the <option>exim_checkaccess</option> uses <option>-bh</option>, it does not perform callouts
63974 while running its checks. You can run checks that include callouts by using
63975 <option>-bhc</option>, but this is not yet available in a <quote>packaged</quote> form.
63976 </para>
63977 </section>
63978 <section id="SECTdbmbuild">
63979 <title>Making DBM files (exim_dbmbuild)</title>
63980 <para>
63981 <indexterm role="concept">
63982 <primary>DBM</primary>
63983 <secondary>building dbm files</secondary>
63984 </indexterm>
63985 <indexterm role="concept">
63986 <primary>building DBM files</primary>
63987 </indexterm>
63988 <indexterm role="concept">
63989 <primary><emphasis>exim_dbmbuild</emphasis></primary>
63990 </indexterm>
63991 <indexterm role="concept">
63992 <primary>lower casing</primary>
63993 </indexterm>
63994 <indexterm role="concept">
63995 <primary>binary zero</primary>
63996 <secondary>in lookup key</secondary>
63997 </indexterm>
63998 The <emphasis>exim_dbmbuild</emphasis> program reads an input file containing keys and data in
63999 the format used by the <command>lsearch</command> lookup (see section
64000 <xref linkend="SECTsinglekeylookups"/>). It writes a DBM file using the lower-cased alias
64001 names as keys and the remainder of the information as data. The lower-casing
64002 can be prevented by calling the program with the <option>-nolc</option> option.
64003 </para>
64004 <para>
64005 A terminating zero is included as part of the key string. This is expected by
64006 the <command>dbm</command> lookup type. However, if the option <option>-nozero</option> is given,
64007 <emphasis>exim_dbmbuild</emphasis> creates files without terminating zeroes in either the key
64008 strings or the data strings. The <command>dbmnz</command> lookup type can be used with such
64009 files.
64010 </para>
64011 <para>
64012 The program requires two arguments: the name of the input file (which can be a
64013 single hyphen to indicate the standard input), and the name of the output file.
64014 It creates the output under a temporary name, and then renames it if all went
64015 well.
64016 </para>
64017 <para>
64018 <indexterm role="concept">
64019 <primary>USE_DB</primary>
64020 </indexterm>
64021 If the native DB interface is in use (USE_DB is set in a compile-time
64022 configuration file &ndash; this is common in free versions of Unix) the two file
64023 names must be different, because in this mode the Berkeley DB functions create
64024 a single output file using exactly the name given. For example,
64025 </para>
64026 <literallayout class="monospaced">
64027 exim_dbmbuild /etc/aliases /etc/aliases.db
64028 </literallayout>
64029 <para>
64030 reads the system alias file and creates a DBM version of it in
64031 <filename>/etc/aliases.db</filename>.
64032 </para>
64033 <para>
64034 In systems that use the <emphasis>ndbm</emphasis> routines (mostly proprietary versions of
64035 Unix), two files are used, with the suffixes <filename>.dir</filename> and <filename>.pag</filename>. In this
64036 environment, the suffixes are added to the second argument of
64037 <emphasis>exim_dbmbuild</emphasis>, so it can be the same as the first. This is also the case
64038 when the Berkeley functions are used in compatibility mode (though this is not
64039 recommended), because in that case it adds a <filename>.db</filename> suffix to the file name.
64040 </para>
64041 <para>
64042 If a duplicate key is encountered, the program outputs a warning, and when it
64043 finishes, its return code is 1 rather than zero, unless the <option>-noduperr</option>
64044 option is used. By default, only the first of a set of duplicates is used &ndash;
64045 this makes it compatible with <command>lsearch</command> lookups. There is an option
64046 <option>-lastdup</option> which causes it to use the data for the last duplicate instead.
64047 There is also an option <option>-nowarn</option>, which stops it listing duplicate keys to
64048 <option>stderr</option>. For other errors, where it doesn&#x2019;t actually make a new file, the
64049 return code is 2.
64050 </para>
64051 </section>
64052 <section id="SECTfinindret">
64053 <title>Finding individual retry times (exinext)</title>
64054 <para>
64055 <indexterm role="concept">
64056 <primary>retry</primary>
64057 <secondary>times</secondary>
64058 </indexterm>
64059 <indexterm role="concept">
64060 <primary><emphasis>exinext</emphasis></primary>
64061 </indexterm>
64062 A utility called <emphasis>exinext</emphasis> (mostly a Perl script) provides the ability to
64063 fish specific information out of the retry database. Given a mail domain (or a
64064 complete address), it looks up the hosts for that domain, and outputs any retry
64065 information for the hosts or for the domain. At present, the retry information
64066 is obtained by running <emphasis>exim_dumpdb</emphasis> (see below) and post-processing the
64067 output. For example:
64068 </para>
64069 <literallayout class="monospaced">
64070 $ exinext piglet@milne.fict.example
64071 kanga.milne.example:192.168.8.1 error 146: Connection refused
64072   first failed: 21-Feb-1996 14:57:34
64073   last tried:   21-Feb-1996 14:57:34
64074   next try at:  21-Feb-1996 15:02:34
64075 roo.milne.example:192.168.8.3 error 146: Connection refused
64076   first failed: 20-Jan-1996 13:12:08
64077   last tried:   21-Feb-1996 11:42:03
64078   next try at:  21-Feb-1996 19:42:03
64079   past final cutoff time
64080 </literallayout>
64081 <para>
64082 You can also give <emphasis>exinext</emphasis> a local part, without a domain, and it
64083 will give any retry information for that local part in your default domain.
64084 A message id can be used to obtain retry information pertaining to a specific
64085 message. This exists only when an attempt to deliver a message to a remote host
64086 suffers a message-specific error (see section <xref linkend="SECToutSMTPerr"/>).
64087 <emphasis>exinext</emphasis> is not particularly efficient, but then it is not expected to be
64088 run very often.
64089 </para>
64090 <para>
64091 The <emphasis>exinext</emphasis> utility calls Exim to find out information such as the location
64092 of the spool directory. The utility has <option>-C</option> and <option>-D</option> options, which are
64093 passed on to the <emphasis>exim</emphasis> commands. The first specifies an alternate Exim
64094 configuration file, and the second sets macros for use within the configuration
64095 file. These features are mainly to help in testing, but might also be useful in
64096 environments where more than one configuration file is in use.
64097 </para>
64098 </section>
64099 <section id="SECThindatmai">
64100 <title>Hints database maintenance</title>
64101 <para>
64102 <indexterm role="concept">
64103 <primary>hints database</primary>
64104 <secondary>maintenance</secondary>
64105 </indexterm>
64106 <indexterm role="concept">
64107 <primary>maintaining Exim&#x2019;s hints database</primary>
64108 </indexterm>
64109 Three utility programs are provided for maintaining the DBM files that Exim
64110 uses to contain its delivery hint information. Each program requires two
64111 arguments. The first specifies the name of Exim&#x2019;s spool directory, and the
64112 second is the name of the database it is to operate on. These are as follows:
64113 </para>
64114 <itemizedlist>
64115 <listitem>
64116 <para>
64117 <emphasis>retry</emphasis>: the database of retry information
64118 </para>
64119 </listitem>
64120 <listitem>
64121 <para>
64122 <emphasis>wait-</emphasis>&lt;<emphasis>transport name</emphasis>&gt;: databases of information about messages waiting
64123 for remote hosts
64124 </para>
64125 </listitem>
64126 <listitem>
64127 <para>
64128 <emphasis>callout</emphasis>: the callout cache
64129 </para>
64130 </listitem>
64131 <listitem>
64132 <para>
64133 <emphasis>ratelimit</emphasis>: the data for implementing the ratelimit ACL condition
64134 </para>
64135 </listitem>
64136 <listitem>
64137 <para>
64138 <emphasis>misc</emphasis>: other hints data
64139 </para>
64140 </listitem>
64141 </itemizedlist>
64142 <para>
64143 The <emphasis>misc</emphasis> database is used for
64144 </para>
64145 <itemizedlist>
64146 <listitem>
64147 <para>
64148 Serializing ETRN runs (when <option>smtp_etrn_serialize</option> is set)
64149 </para>
64150 </listitem>
64151 <listitem>
64152 <para>
64153 Serializing delivery to a specific host (when <option>serialize_hosts</option> is set in an
64154 <command>smtp</command> transport)
64155 </para>
64156 </listitem>
64157 </itemizedlist>
64158 </section>
64159 <section id="SECID261">
64160 <title>exim_dumpdb</title>
64161 <para>
64162 <indexterm role="concept">
64163 <primary><emphasis>exim_dumpdb</emphasis></primary>
64164 </indexterm>
64165 The entire contents of a database are written to the standard output by the
64166 <emphasis>exim_dumpdb</emphasis> program, which has no options or arguments other than the
64167 spool and database names. For example, to dump the retry database:
64168 </para>
64169 <literallayout class="monospaced">
64170 exim_dumpdb /var/spool/exim retry
64171 </literallayout>
64172 <para>
64173 Two lines of output are produced for each entry:
64174 </para>
64175 <literallayout class="monospaced">
64176 T:mail.ref.example:192.168.242.242 146 77 Connection refused
64177 31-Oct-1995 12:00:12 02-Nov-1995 12:21:39 02-Nov-1995 20:21:39 *
64178 </literallayout>
64179 <para>
64180 The first item on the first line is the key of the record. It starts with one
64181 of the letters R, or T, depending on whether it refers to a routing or
64182 transport retry. For a local delivery, the next part is the local address; for
64183 a remote delivery it is the name of the remote host, followed by its failing IP
64184 address (unless <option>retry_include_ip_address</option> is set false on the <command>smtp</command>
64185 transport). If the remote port is not the standard one (port 25), it is added
64186 to the IP address. Then there follows an error code, an additional error code,
64187 and a textual description of the error.
64188 </para>
64189 <para>
64190 The three times on the second line are the time of first failure, the time of
64191 the last delivery attempt, and the computed time for the next attempt. The line
64192 ends with an asterisk if the cutoff time for the last retry rule has been
64193 exceeded.
64194 </para>
64195 <para>
64196 Each output line from <emphasis>exim_dumpdb</emphasis> for the <emphasis>wait-xxx</emphasis> databases
64197 consists of a host name followed by a list of ids for messages that are or were
64198 waiting to be delivered to that host. If there are a very large number for any
64199 one host, continuation records, with a sequence number added to the host name,
64200 may be seen. The data in these records is often out of date, because a message
64201 may be routed to several alternative hosts, and Exim makes no effort to keep
64202 cross-references.
64203 </para>
64204 </section>
64205 <section id="SECID262">
64206 <title>exim_tidydb</title>
64207 <para>
64208 <indexterm role="concept">
64209 <primary><emphasis>exim_tidydb</emphasis></primary>
64210 </indexterm>
64211 The <emphasis>exim_tidydb</emphasis> utility program is used to tidy up the contents of a hints
64212 database. If run with no options, it removes all records that are more than 30
64213 days old. The age is calculated from the date and time that the record was last
64214 updated. Note that, in the case of the retry database, it is <emphasis>not</emphasis> the time
64215 since the first delivery failure. Information about a host that has been down
64216 for more than 30 days will remain in the database, provided that the record is
64217 updated sufficiently often.
64218 </para>
64219 <para>
64220 The cutoff date can be altered by means of the <option>-t</option> option, which must be
64221 followed by a time. For example, to remove all records older than a week from
64222 the retry database:
64223 </para>
64224 <literallayout class="monospaced">
64225 exim_tidydb -t 7d /var/spool/exim retry
64226 </literallayout>
64227 <para>
64228 Both the <emphasis>wait-xxx</emphasis> and <emphasis>retry</emphasis> databases contain items that involve
64229 message ids. In the former these appear as data in records keyed by host &ndash;
64230 they were messages that were waiting for that host &ndash; and in the latter they
64231 are the keys for retry information for messages that have suffered certain
64232 types of error. When <emphasis>exim_tidydb</emphasis> is run, a check is made to ensure that
64233 message ids in database records are those of messages that are still on the
64234 queue. Message ids for messages that no longer exist are removed from
64235 <emphasis>wait-xxx</emphasis> records, and if this leaves any records empty, they are deleted.
64236 For the <emphasis>retry</emphasis> database, records whose keys are non-existent message ids are
64237 removed. The <emphasis>exim_tidydb</emphasis> utility outputs comments on the standard output
64238 whenever it removes information from the database.
64239 </para>
64240 <para>
64241 Certain records are automatically removed by Exim when they are no longer
64242 needed, but others are not. For example, if all the MX hosts for a domain are
64243 down, a retry record is created for each one. If the primary MX host comes back
64244 first, its record is removed when Exim successfully delivers to it, but the
64245 records for the others remain because Exim has not tried to use those hosts.
64246 </para>
64247 <para>
64248 It is important, therefore, to run <emphasis>exim_tidydb</emphasis> periodically on all the
64249 hints databases. You should do this at a quiet time of day, because it requires
64250 a database to be locked (and therefore inaccessible to Exim) while it does its
64251 work. Removing records from a DBM file does not normally make the file smaller,
64252 but all the common DBM libraries are able to re-use the space that is released.
64253 After an initial phase of increasing in size, the databases normally reach a
64254 point at which they no longer get any bigger, as long as they are regularly
64255 tidied.
64256 </para>
64257 <para>
64258 <emphasis role="bold">Warning</emphasis>: If you never run <emphasis>exim_tidydb</emphasis>, the space used by the hints
64259 databases is likely to keep on increasing.
64260 </para>
64261 </section>
64262 <section id="SECID263">
64263 <title>exim_fixdb</title>
64264 <para>
64265 <indexterm role="concept">
64266 <primary><emphasis>exim_fixdb</emphasis></primary>
64267 </indexterm>
64268 The <emphasis>exim_fixdb</emphasis> program is a utility for interactively modifying databases.
64269 Its main use is for testing Exim, but it might also be occasionally useful for
64270 getting round problems in a live system. It has no options, and its interface
64271 is somewhat crude. On entry, it prompts for input with a right angle-bracket. A
64272 key of a database record can then be entered, and the data for that record is
64273 displayed.
64274 </para>
64275 <para>
64276 If <quote>d</quote> is typed at the next prompt, the entire record is deleted. For all
64277 except the <emphasis>retry</emphasis> database, that is the only operation that can be carried
64278 out. For the <emphasis>retry</emphasis> database, each field is output preceded by a number, and
64279 data for individual fields can be changed by typing the field number followed
64280 by new data, for example:
64281 </para>
64282 <literallayout class="monospaced">
64283 &gt; 4 951102:1000
64284 </literallayout>
64285 <para>
64286 resets the time of the next delivery attempt. Time values are given as a
64287 sequence of digit pairs for year, month, day, hour, and minute. Colons can be
64288 used as optional separators.
64289 </para>
64290 </section>
64291 <section id="SECTmailboxmaint">
64292 <title>Mailbox maintenance (exim_lock)</title>
64293 <para>
64294 <indexterm role="concept">
64295 <primary>mailbox</primary>
64296 <secondary>maintenance</secondary>
64297 </indexterm>
64298 <indexterm role="concept">
64299 <primary><emphasis>exim_lock</emphasis></primary>
64300 </indexterm>
64301 <indexterm role="concept">
64302 <primary>locking mailboxes</primary>
64303 </indexterm>
64304 The <emphasis>exim_lock</emphasis> utility locks a mailbox file using the same algorithm as
64305 Exim. For a discussion of locking issues, see section <xref linkend="SECTopappend"/>.
64306 <emphasis>Exim_lock</emphasis> can be used to prevent any modification of a mailbox by Exim or
64307 a user agent while investigating a problem. The utility requires the name of
64308 the file as its first argument. If the locking is successful, the second
64309 argument is run as a command (using C&#x2019;s <function>system()</function> function); if there is no
64310 second argument, the value of the SHELL environment variable is used; if this
64311 is unset or empty, <filename>/bin/sh</filename> is run. When the command finishes, the mailbox
64312 is unlocked and the utility ends. The following options are available:
64313 </para>
64314 <variablelist>
64315 <varlistentry>
64316 <term><option>-fcntl</option></term>
64317 <listitem>
64318 <para>
64319 Use <function>fcntl()</function> locking on the open mailbox.
64320 </para>
64321 </listitem></varlistentry>
64322 <varlistentry>
64323 <term><option>-flock</option></term>
64324 <listitem>
64325 <para>
64326 Use <function>flock()</function> locking on the open mailbox, provided the operating system
64327 supports it.
64328 </para>
64329 </listitem></varlistentry>
64330 <varlistentry>
64331 <term><option>-interval</option></term>
64332 <listitem>
64333 <para>
64334 This must be followed by a number, which is a number of seconds; it sets the
64335 interval to sleep between retries (default 3).
64336 </para>
64337 </listitem></varlistentry>
64338 <varlistentry>
64339 <term><option>-lockfile</option></term>
64340 <listitem>
64341 <para>
64342 Create a lock file before opening the mailbox.
64343 </para>
64344 </listitem></varlistentry>
64345 <varlistentry>
64346 <term><option>-mbx</option></term>
64347 <listitem>
64348 <para>
64349 Lock the mailbox using MBX rules.
64350 </para>
64351 </listitem></varlistentry>
64352 <varlistentry>
64353 <term><option>-q</option></term>
64354 <listitem>
64355 <para>
64356 Suppress verification output.
64357 </para>
64358 </listitem></varlistentry>
64359 <varlistentry>
64360 <term><option>-retries</option></term>
64361 <listitem>
64362 <para>
64363 This must be followed by a number; it sets the number of times to try to get
64364 the lock (default 10).
64365 </para>
64366 </listitem></varlistentry>
64367 <varlistentry>
64368 <term><option>-restore_time</option></term>
64369 <listitem>
64370 <para>
64371 This option causes <option>exim_lock</option> to restore the modified and read times to the
64372 locked file before exiting. This allows you to access a locked mailbox (for
64373 example, to take a backup copy) without disturbing the times that the user
64374 subsequently sees.
64375 </para>
64376 </listitem></varlistentry>
64377 <varlistentry>
64378 <term><option>-timeout</option></term>
64379 <listitem>
64380 <para>
64381 This must be followed by a number, which is a number of seconds; it sets a
64382 timeout to be used with a blocking <function>fcntl()</function> lock. If it is not set (the
64383 default), a non-blocking call is used.
64384 </para>
64385 </listitem></varlistentry>
64386 <varlistentry>
64387 <term><option>-v</option></term>
64388 <listitem>
64389 <para>
64390 Generate verbose output.
64391 </para>
64392 </listitem></varlistentry>
64393 </variablelist>
64394 <para>
64395 If none of <option>-fcntl</option>, <option>-flock</option>, <option>-lockfile</option> or <option>-mbx</option> are given, the
64396 default is to create a lock file and also to use <function>fcntl()</function> locking on the
64397 mailbox, which is the same as Exim&#x2019;s default. The use of <option>-flock</option> or
64398 <option>-fcntl</option> requires that the file be writeable; the use of <option>-lockfile</option>
64399 requires that the directory containing the file be writeable. Locking by lock
64400 file does not last for ever; Exim assumes that a lock file is expired if it is
64401 more than 30 minutes old.
64402 </para>
64403 <para>
64404 The <option>-mbx</option> option can be used with either or both of <option>-fcntl</option> or
64405 <option>-flock</option>. It assumes <option>-fcntl</option> by default. MBX locking causes a shared lock
64406 to be taken out on the open mailbox, and an exclusive lock on the file
64407 <filename>/tmp/.n.m</filename> where <emphasis>n</emphasis> and <emphasis>m</emphasis> are the device number and inode
64408 number of the mailbox file. When the locking is released, if an exclusive lock
64409 can be obtained for the mailbox, the file in <filename>/tmp</filename> is deleted.
64410 </para>
64411 <para>
64412 The default output contains verification of the locking that takes place. The
64413 <option>-v</option> option causes some additional information to be given. The <option>-q</option> option
64414 suppresses all output except error messages.
64415 </para>
64416 <para>
64417 A command such as
64418 </para>
64419 <literallayout class="monospaced">
64420 exim_lock /var/spool/mail/spqr
64421 </literallayout>
64422 <para>
64423 runs an interactive shell while the file is locked, whereas
64424 </para>
64425 <literallayout>
64426 <literal>exim_lock -q /var/spool/mail/spqr &lt;&lt;End</literal>
64427 &lt;<emphasis>some commands</emphasis>&gt;
64428 <literal>End</literal>
64429 </literallayout>
64430 <para>
64431 runs a specific non-interactive sequence of commands while the file is locked,
64432 suppressing all verification output. A single command can be run by a command
64433 such as
64434 </para>
64435 <literallayout class="monospaced">
64436 exim_lock -q /var/spool/mail/spqr \
64437   "cp /var/spool/mail/spqr /some/where"
64438 </literallayout>
64439 <para>
64440 Note that if a command is supplied, it must be entirely contained within the
64441 second argument &ndash; hence the quotes.
64442 <indexterm role="concept" startref="IIDutils" class="endofrange"/>
64443 </para>
64444 </section>
64445 </chapter>
64446
64447 <chapter id="CHAPeximon">
64448 <title>The Exim monitor</title>
64449 <para>
64450 <indexterm role="concept" id="IIDeximon" class="startofrange">
64451 <primary>Exim monitor</primary>
64452 <secondary>description</secondary>
64453 </indexterm>
64454 <indexterm role="concept">
64455 <primary>X-windows</primary>
64456 </indexterm>
64457 <indexterm role="concept">
64458 <primary><emphasis>eximon</emphasis></primary>
64459 </indexterm>
64460 <indexterm role="concept">
64461 <primary>Local/eximon.conf</primary>
64462 </indexterm>
64463 <indexterm role="concept">
64464 <primary><filename>exim_monitor/EDITME</filename></primary>
64465 </indexterm>
64466 The Exim monitor is an application which displays in an X window information
64467 about the state of Exim&#x2019;s queue and what Exim is doing. An admin user can
64468 perform certain operations on messages from this GUI interface; however all
64469 such facilities are also available from the command line, and indeed, the
64470 monitor itself makes use of the command line to perform any actions requested.
64471 </para>
64472 <section id="SECID264">
64473 <title>Running the monitor</title>
64474 <para>
64475 The monitor is started by running the script called <emphasis>eximon</emphasis>. This is a shell
64476 script that sets up a number of environment variables, and then runs the
64477 binary called <filename>eximon.bin</filename>. The default appearance of the monitor window can
64478 be changed by editing the <filename>Local/eximon.conf</filename> file created by editing
64479 <filename>exim_monitor/EDITME</filename>. Comments in that file describe what the various
64480 parameters are for.
64481 </para>
64482 <para>
64483 The parameters that get built into the <emphasis>eximon</emphasis> script can be overridden for
64484 a particular invocation by setting up environment variables of the same names,
64485 preceded by <literal>EXIMON_</literal>. For example, a shell command such as
64486 </para>
64487 <literallayout class="monospaced">
64488 EXIMON_LOG_DEPTH=400 eximon
64489 </literallayout>
64490 <para>
64491 (in a Bourne-compatible shell) runs <emphasis>eximon</emphasis> with an overriding setting of
64492 the LOG_DEPTH parameter. If EXIMON_LOG_FILE_PATH is set in the environment, it
64493 overrides the Exim log file configuration. This makes it possible to have
64494 <emphasis>eximon</emphasis> tailing log data that is written to syslog, provided that MAIL.INFO
64495 syslog messages are routed to a file on the local host.
64496 </para>
64497 <para>
64498 X resources can be used to change the appearance of the window in the normal
64499 way. For example, a resource setting of the form
64500 </para>
64501 <literallayout class="monospaced">
64502 Eximon*background: gray94
64503 </literallayout>
64504 <para>
64505 changes the colour of the background to light grey rather than white. The
64506 stripcharts are drawn with both the data lines and the reference lines in
64507 black. This means that the reference lines are not visible when on top of the
64508 data. However, their colour can be changed by setting a resource called
64509 <quote>highlight</quote> (an odd name, but that&#x2019;s what the Athena stripchart widget uses).
64510 For example, if your X server is running Unix, you could set up lighter
64511 reference lines in the stripcharts by obeying
64512 </para>
64513 <literallayout class="monospaced">
64514 xrdb -merge &lt;&lt;End
64515 Eximon*highlight: gray
64516 End
64517 </literallayout>
64518 <para>
64519 <indexterm role="concept">
64520 <primary>admin user</primary>
64521 </indexterm>
64522 In order to see the contents of messages on the queue, and to operate on them,
64523 <emphasis>eximon</emphasis> must either be run as root or by an admin user.
64524 </para>
64525 <para>
64526 The command-line parameters of <emphasis>eximon</emphasis> are passed to <filename>eximon.bin</filename> and may
64527 contain X11 resource parameters interpreted by the X11 library.  In addition,
64528 if the first parameter starts with the string "gdb" then it is removed and the
64529 binary is invoked under gdb (the parameter is used as the gdb command-name, so
64530 versioned variants of gdb can be invoked).
64531 </para>
64532 <para>
64533 The monitor&#x2019;s window is divided into three parts. The first contains one or
64534 more stripcharts and two action buttons, the second contains a <quote>tail</quote> of the
64535 main log file, and the third is a display of the queue of messages awaiting
64536 delivery, with two more action buttons. The following sections describe these
64537 different parts of the display.
64538 </para>
64539 </section>
64540 <section id="SECID265">
64541 <title>The stripcharts</title>
64542 <para>
64543 <indexterm role="concept">
64544 <primary>stripchart</primary>
64545 </indexterm>
64546 The first stripchart is always a count of messages on the queue. Its name can
64547 be configured by setting QUEUE_STRIPCHART_NAME in the
64548 <filename>Local/eximon.conf</filename> file. The remaining stripcharts are defined in the
64549 configuration script by regular expression matches on log file entries, making
64550 it possible to display, for example, counts of messages delivered to certain
64551 hosts or using certain transports. The supplied defaults display counts of
64552 received and delivered messages, and of local and SMTP deliveries. The default
64553 period between stripchart updates is one minute; this can be adjusted by a
64554 parameter in the <filename>Local/eximon.conf</filename> file.
64555 </para>
64556 <para>
64557 The stripchart displays rescale themselves automatically as the value they are
64558 displaying changes. There are always 10 horizontal lines in each chart; the
64559 title string indicates the value of each division when it is greater than one.
64560 For example, <quote>x2</quote> means that each division represents a value of 2.
64561 </para>
64562 <para>
64563 It is also possible to have a stripchart which shows the percentage fullness of
64564 a particular disk partition, which is useful when local deliveries are confined
64565 to a single partition.
64566 </para>
64567 <para>
64568 <indexterm role="concept">
64569 <primary><option>statvfs</option> function</primary>
64570 </indexterm>
64571 This relies on the availability of the <function>statvfs()</function> function or equivalent in
64572 the operating system. Most, but not all versions of Unix that support Exim have
64573 this. For this particular stripchart, the top of the chart always represents
64574 100%, and the scale is given as <quote>x10%</quote>. This chart is configured by setting
64575 SIZE_STRIPCHART and (optionally) SIZE_STRIPCHART_NAME in the
64576 <filename>Local/eximon.conf</filename> file.
64577 </para>
64578 </section>
64579 <section id="SECID266">
64580 <title>Main action buttons</title>
64581 <para>
64582 <indexterm role="concept">
64583 <primary>size</primary>
64584 <secondary>of monitor window</secondary>
64585 </indexterm>
64586 <indexterm role="concept">
64587 <primary>Exim monitor</primary>
64588 <secondary>window size</secondary>
64589 </indexterm>
64590 <indexterm role="concept">
64591 <primary>window size</primary>
64592 </indexterm>
64593 Below the stripcharts there is an action button for quitting the monitor. Next
64594 to this is another button marked <quote>Size</quote>. They are placed here so that
64595 shrinking the window to its default minimum size leaves just the queue count
64596 stripchart and these two buttons visible. Pressing the <quote>Size</quote> button causes
64597 the window to expand to its maximum size, unless it is already at the maximum,
64598 in which case it is reduced to its minimum.
64599 </para>
64600 <para>
64601 When expanding to the maximum, if the window cannot be fully seen where it
64602 currently is, it is moved back to where it was the last time it was at full
64603 size. When it is expanding from its minimum size, the old position is
64604 remembered, and next time it is reduced to the minimum it is moved back there.
64605 </para>
64606 <para>
64607 The idea is that you can keep a reduced window just showing one or two
64608 stripcharts at a convenient place on your screen, easily expand it to show
64609 the full window when required, and just as easily put it back to what it was.
64610 The idea is copied from what the <emphasis>twm</emphasis> window manager does for its
64611 <emphasis>f.fullzoom</emphasis> action. The minimum size of the window can be changed by setting
64612 the MIN_HEIGHT and MIN_WIDTH values in <filename>Local/eximon.conf</filename>.
64613 </para>
64614 <para>
64615 Normally, the monitor starts up with the window at its full size, but it can be
64616 built so that it starts up with the window at its smallest size, by setting
64617 START_SMALL=yes in <filename>Local/eximon.conf</filename>.
64618 </para>
64619 </section>
64620 <section id="SECID267">
64621 <title>The log display</title>
64622 <para>
64623 <indexterm role="concept">
64624 <primary>log</primary>
64625 <secondary>tail of; in monitor</secondary>
64626 </indexterm>
64627 The second section of the window is an area in which a display of the tail of
64628 the main log is maintained.
64629 To save space on the screen, the timestamp on each log line is shortened by
64630 removing the date and, if <option>log_timezone</option> is set, the timezone.
64631 The log tail is not available when the only destination for logging data is
64632 syslog, unless the syslog lines are routed to a local file whose name is passed
64633 to <emphasis>eximon</emphasis> via the EXIMON_LOG_FILE_PATH environment variable.
64634 </para>
64635 <para>
64636 The log sub-window has a scroll bar at its lefthand side which can be used to
64637 move back to look at earlier text, and the up and down arrow keys also have a
64638 scrolling effect. The amount of log that is kept depends on the setting of
64639 LOG_BUFFER in <filename>Local/eximon.conf</filename>, which specifies the amount of memory
64640 to use. When this is full, the earlier 50% of data is discarded &ndash; this is
64641 much more efficient than throwing it away line by line. The sub-window also has
64642 a horizontal scroll bar for accessing the ends of long log lines. This is the
64643 only means of horizontal scrolling; the right and left arrow keys are not
64644 available. Text can be cut from this part of the window using the mouse in the
64645 normal way. The size of this subwindow is controlled by parameters in the
64646 configuration file <filename>Local/eximon.conf</filename>.
64647 </para>
64648 <para>
64649 Searches of the text in the log window can be carried out by means of the ^R
64650 and ^S keystrokes, which default to a reverse and a forward search,
64651 respectively. The search covers only the text that is displayed in the window.
64652 It cannot go further back up the log.
64653 </para>
64654 <para>
64655 The point from which the search starts is indicated by a caret marker. This is
64656 normally at the end of the text in the window, but can be positioned explicitly
64657 by pointing and clicking with the left mouse button, and is moved automatically
64658 by a successful search. If new text arrives in the window when it is scrolled
64659 back, the caret remains where it is, but if the window is not scrolled back,
64660 the caret is moved to the end of the new text.
64661 </para>
64662 <para>
64663 Pressing ^R or ^S pops up a window into which the search text can be typed.
64664 There are buttons for selecting forward or reverse searching, for carrying out
64665 the search, and for cancelling. If the <quote>Search</quote> button is pressed, the search
64666 happens and the window remains so that further searches can be done. If the
64667 <quote>Return</quote> key is pressed, a single search is done and the window is closed. If
64668 ^C is typed the search is cancelled.
64669 </para>
64670 <para>
64671 The searching facility is implemented using the facilities of the Athena text
64672 widget. By default this pops up a window containing both <quote>search</quote> and
64673 <quote>replace</quote> options. In order to suppress the unwanted <quote>replace</quote> portion for
64674 eximon, a modified version of the <option>TextPop</option> widget is distributed with Exim.
64675 However, the linkers in BSDI and HP-UX seem unable to handle an externally
64676 provided version of <option>TextPop</option> when the remaining parts of the text widget
64677 come from the standard libraries. The compile-time option EXIMON_TEXTPOP can be
64678 unset to cut out the modified <option>TextPop</option>, making it possible to build Eximon
64679 on these systems, at the expense of having unwanted items in the search popup
64680 window.
64681 </para>
64682 </section>
64683 <section id="SECID268">
64684 <title>The queue display</title>
64685 <para>
64686 <indexterm role="concept">
64687 <primary>queue</primary>
64688 <secondary>display in monitor</secondary>
64689 </indexterm>
64690 The bottom section of the monitor window contains a list of all messages that
64691 are on the queue, which includes those currently being received or delivered,
64692 as well as those awaiting delivery. The size of this subwindow is controlled by
64693 parameters in the configuration file <filename>Local/eximon.conf</filename>, and the frequency
64694 at which it is updated is controlled by another parameter in the same file &ndash;
64695 the default is 5 minutes, since queue scans can be quite expensive. However,
64696 there is an <quote>Update</quote> action button just above the display which can be used
64697 to force an update of the queue display at any time.
64698 </para>
64699 <para>
64700 When a host is down for some time, a lot of pending mail can build up for it,
64701 and this can make it hard to deal with other messages on the queue. To help
64702 with this situation there is a button next to <quote>Update</quote> called <quote>Hide</quote>. If
64703 pressed, a dialogue box called <quote>Hide addresses ending with</quote> is put up. If you
64704 type anything in here and press <quote>Return</quote>, the text is added to a chain of
64705 such texts, and if every undelivered address in a message matches at least one
64706 of the texts, the message is not displayed.
64707 </para>
64708 <para>
64709 If there is an address that does not match any of the texts, all the addresses
64710 are displayed as normal. The matching happens on the ends of addresses so, for
64711 example, <emphasis>cam.ac.uk</emphasis> specifies all addresses in Cambridge, while
64712 <emphasis>xxx@foo.com.example</emphasis> specifies just one specific address. When any hiding
64713 has been set up, a button called <quote>Unhide</quote> is displayed. If pressed, it
64714 cancels all hiding. Also, to ensure that hidden messages do not get forgotten,
64715 a hide request is automatically cancelled after one hour.
64716 </para>
64717 <para>
64718 While the dialogue box is displayed, you can&#x2019;t press any buttons or do anything
64719 else to the monitor window. For this reason, if you want to cut text from the
64720 queue display to use in the dialogue box, you have to do the cutting before
64721 pressing the <quote>Hide</quote> button.
64722 </para>
64723 <para>
64724 The queue display contains, for each unhidden queued message, the length of
64725 time it has been on the queue, the size of the message, the message id, the
64726 message sender, and the first undelivered recipient, all on one line. If it is
64727 a bounce message, the sender is shown as <quote>&lt;&gt;</quote>. If there is more than one
64728 recipient to which the message has not yet been delivered, subsequent ones are
64729 listed on additional lines, up to a maximum configured number, following which
64730 an ellipsis is displayed. Recipients that have already received the message are
64731 not shown.
64732 </para>
64733 <para>
64734 <indexterm role="concept">
64735 <primary>frozen messages</primary>
64736 <secondary>display</secondary>
64737 </indexterm>
64738 If a message is frozen, an asterisk is displayed at the left-hand side.
64739 </para>
64740 <para>
64741 The queue display has a vertical scroll bar, and can also be scrolled by means
64742 of the arrow keys. Text can be cut from it using the mouse in the normal way.
64743 The text searching facilities, as described above for the log window, are also
64744 available, but the caret is always moved to the end of the text when the queue
64745 display is updated.
64746 </para>
64747 </section>
64748 <section id="SECID269">
64749 <title>The queue menu</title>
64750 <para>
64751 <indexterm role="concept">
64752 <primary>queue</primary>
64753 <secondary>menu in monitor</secondary>
64754 </indexterm>
64755 If the <option>shift</option> key is held down and the left button is clicked when the mouse
64756 pointer is over the text for any message, an action menu pops up, and the first
64757 line of the queue display for the message is highlighted. This does not affect
64758 any selected text.
64759 </para>
64760 <para>
64761 If you want to use some other event for popping up the menu, you can set the
64762 MENU_EVENT parameter in <filename>Local/eximon.conf</filename> to change the default, or
64763 set EXIMON_MENU_EVENT in the environment before starting the monitor. The
64764 value set in this parameter is a standard X event description. For example, to
64765 run eximon using <option>ctrl</option> rather than <option>shift</option> you could use
64766 </para>
64767 <literallayout class="monospaced">
64768 EXIMON_MENU_EVENT='Ctrl&lt;Btn1Down&gt;' eximon
64769 </literallayout>
64770 <para>
64771 The title of the menu is the message id, and it contains entries which act as
64772 follows:
64773 </para>
64774 <itemizedlist>
64775 <listitem>
64776 <para>
64777 <emphasis>message log</emphasis>: The contents of the message log for the message are displayed
64778 in a new text window.
64779 </para>
64780 </listitem>
64781 <listitem>
64782 <para>
64783 <emphasis>headers</emphasis>: Information from the spool file that contains the envelope
64784 information and headers is displayed in a new text window. See chapter
64785 <xref linkend="CHAPspool"/> for a description of the format of spool files.
64786 </para>
64787 </listitem>
64788 <listitem>
64789 <para>
64790 <emphasis>body</emphasis>: The contents of the spool file containing the body of the message are
64791 displayed in a new text window. There is a default limit of 20,000 bytes to the
64792 amount of data displayed. This can be changed by setting the BODY_MAX
64793 option at compile time, or the EXIMON_BODY_MAX option at run time.
64794 </para>
64795 </listitem>
64796 <listitem>
64797 <para>
64798 <emphasis>deliver message</emphasis>: A call to Exim is made using the <option>-M</option> option to request
64799 delivery of the message. This causes an automatic thaw if the message is
64800 frozen. The <option>-v</option> option is also set, and the output from Exim is displayed in
64801 a new text window. The delivery is run in a separate process, to avoid holding
64802 up the monitor while the delivery proceeds.
64803 </para>
64804 </listitem>
64805 <listitem>
64806 <para>
64807 <emphasis>freeze message</emphasis>: A call to Exim is made using the <option>-Mf</option> option to request
64808 that the message be frozen.
64809 </para>
64810 </listitem>
64811 <listitem>
64812 <para>
64813 <indexterm role="concept">
64814 <primary>thawing messages</primary>
64815 </indexterm>
64816 <indexterm role="concept">
64817 <primary>unfreezing messages</primary>
64818 </indexterm>
64819 <indexterm role="concept">
64820 <primary>frozen messages</primary>
64821 <secondary>thawing</secondary>
64822 </indexterm>
64823 <emphasis>thaw message</emphasis>: A call to Exim is made using the <option>-Mt</option> option to request
64824 that the message be thawed.
64825 </para>
64826 </listitem>
64827 <listitem>
64828 <para>
64829 <indexterm role="concept">
64830 <primary>delivery</primary>
64831 <secondary>forcing failure</secondary>
64832 </indexterm>
64833 <emphasis>give up on msg</emphasis>: A call to Exim is made using the <option>-Mg</option> option to request
64834 that Exim gives up trying to deliver the message. A bounce message is generated
64835 for any remaining undelivered addresses.
64836 </para>
64837 </listitem>
64838 <listitem>
64839 <para>
64840 <emphasis>remove message</emphasis>: A call to Exim is made using the <option>-Mrm</option> option to request
64841 that the message be deleted from the system without generating a bounce
64842 message.
64843 </para>
64844 </listitem>
64845 <listitem>
64846 <para>
64847 <emphasis>add recipient</emphasis>: A dialog box is displayed into which a recipient address can
64848 be typed. If the address is not qualified and the QUALIFY_DOMAIN parameter
64849 is set in <filename>Local/eximon.conf</filename>, the address is qualified with that domain.
64850 Otherwise it must be entered as a fully qualified address. Pressing RETURN
64851 causes a call to Exim to be made using the <option>-Mar</option> option to request that an
64852 additional recipient be added to the message, unless the entry box is empty, in
64853 which case no action is taken.
64854 </para>
64855 </listitem>
64856 <listitem>
64857 <para>
64858 <emphasis>mark delivered</emphasis>: A dialog box is displayed into which a recipient address
64859 can be typed. If the address is not qualified and the QUALIFY_DOMAIN parameter
64860 is set in <filename>Local/eximon.conf</filename>, the address is qualified with that domain.
64861 Otherwise it must be entered as a fully qualified address. Pressing RETURN
64862 causes a call to Exim to be made using the <option>-Mmd</option> option to mark the given
64863 recipient address as already delivered, unless the entry box is empty, in which
64864 case no action is taken.
64865 </para>
64866 </listitem>
64867 <listitem>
64868 <para>
64869 <emphasis>mark all delivered</emphasis>: A call to Exim is made using the <option>-Mmad</option> option to
64870 mark all recipient addresses as already delivered.
64871 </para>
64872 </listitem>
64873 <listitem>
64874 <para>
64875 <emphasis>edit sender</emphasis>: A dialog box is displayed initialized with the current
64876 sender&#x2019;s address. Pressing RETURN causes a call to Exim to be made using the
64877 <option>-Mes</option> option to replace the sender address, unless the entry box is empty,
64878 in which case no action is taken. If you want to set an empty sender (as in
64879 bounce messages), you must specify it as <quote>&lt;&gt;</quote>. Otherwise, if the address is
64880 not qualified and the QUALIFY_DOMAIN parameter is set in <filename>Local/eximon.conf</filename>,
64881 the address is qualified with that domain.
64882 </para>
64883 </listitem>
64884 </itemizedlist>
64885 <para>
64886 When a delivery is forced, a window showing the <option>-v</option> output is displayed. In
64887 other cases when a call to Exim is made, if there is any output from Exim (in
64888 particular, if the command fails) a window containing the command and the
64889 output is displayed. Otherwise, the results of the action are normally apparent
64890 from the log and queue displays. However, if you set ACTION_OUTPUT=yes in
64891 <filename>Local/eximon.conf</filename>, a window showing the Exim command is always opened, even
64892 if no output is generated.
64893 </para>
64894 <para>
64895 The queue display is automatically updated for actions such as freezing and
64896 thawing, unless ACTION_QUEUE_UPDATE=no has been set in
64897 <filename>Local/eximon.conf</filename>. In this case the <quote>Update</quote> button has to be used to
64898 force an update of the display after one of these actions.
64899 </para>
64900 <para>
64901 In any text window that is displayed as result of a menu action, the normal
64902 cut-and-paste facility is available, and searching can be carried out using ^R
64903 and ^S, as described above for the log tail window.
64904 <indexterm role="concept" startref="IIDeximon" class="endofrange"/>
64905 </para>
64906 </section>
64907 </chapter>
64908
64909 <chapter id="CHAPsecurity">
64910 <title>Security considerations</title>
64911 <para>
64912 <indexterm role="concept" id="IIDsecurcon" class="startofrange">
64913 <primary>security</primary>
64914 <secondary>discussion of</secondary>
64915 </indexterm>
64916 This chapter discusses a number of issues concerned with security, some of
64917 which are also covered in other parts of this manual.
64918 </para>
64919 <para>
64920 For reasons that this author does not understand, some people have promoted
64921 Exim as a <quote>particularly secure</quote> mailer. Perhaps it is because of the
64922 existence of this chapter in the documentation. However, the intent of the
64923 chapter is simply to describe the way Exim works in relation to certain
64924 security concerns, not to make any specific claims about the effectiveness of
64925 its security as compared with other MTAs.
64926 </para>
64927 <para>
64928 What follows is a description of the way Exim is supposed to be. Best efforts
64929 have been made to try to ensure that the code agrees with the theory, but an
64930 absence of bugs can never be guaranteed. Any that are reported will get fixed
64931 as soon as possible.
64932 </para>
64933 <section id="SECID286">
64934 <title>Building a more <quote>hardened</quote> Exim</title>
64935 <para>
64936 <indexterm role="concept">
64937 <primary>security</primary>
64938 <secondary>build-time features</secondary>
64939 </indexterm>
64940 There are a number of build-time options that can be set in <filename>Local/Makefile</filename>
64941 to create Exim binaries that are <quote>harder</quote> to attack, in particular by a rogue
64942 Exim administrator who does not have the root password, or by someone who has
64943 penetrated the Exim (but not the root) account. These options are as follows:
64944 </para>
64945 <itemizedlist>
64946 <listitem>
64947 <para>
64948 ALT_CONFIG_PREFIX can be set to a string that is required to match the
64949 start of any file names used with the <option>-C</option> option. When it is set, these file
64950 names are also not allowed to contain the sequence <quote>/../</quote>. (However, if the
64951 value of the <option>-C</option> option is identical to the value of CONFIGURE_FILE in
64952 <filename>Local/Makefile</filename>, Exim ignores <option>-C</option> and proceeds as usual.) There is no
64953 default setting for <option>ALT_CONFIG_PREFIX</option>.
64954 </para>
64955 <para>
64956 If the permitted configuration files are confined to a directory to
64957 which only root has access, this guards against someone who has broken
64958 into the Exim account from running a privileged Exim with an arbitrary
64959 configuration file, and using it to break into other accounts.
64960 </para>
64961 </listitem>
64962 <listitem>
64963 <para>
64964 If a non-trusted configuration file (i.e. not the default configuration file
64965 or one which is trusted by virtue of being listed in the TRUSTED_CONFIG_LIST
64966 file) is specified with <option>-C</option>, or if macros are given with <option>-D</option> (but see
64967 the next item), then root privilege is retained only if the caller of Exim is
64968 root. This locks out the possibility of testing a configuration using <option>-C</option>
64969 right through message reception and delivery, even if the caller is root. The
64970 reception works, but by that time, Exim is running as the Exim user, so when
64971 it re-execs to regain privilege for the delivery, the use of <option>-C</option> causes
64972 privilege to be lost. However, root can test reception and delivery using two
64973 separate commands.
64974 </para>
64975 </listitem>
64976 <listitem>
64977 <para>
64978 The WHITELIST_D_MACROS build option declares some macros to be safe to override
64979 with <option>-D</option> if the real uid is one of root, the Exim run-time user or the
64980 CONFIGURE_OWNER, if defined.  The potential impact of this option is limited by
64981 requiring the run-time value supplied to <option>-D</option> to match a regex that errs on
64982 the restrictive side.  Requiring build-time selection of safe macros is onerous
64983 but this option is intended solely as a transition mechanism to permit
64984 previously-working configurations to continue to work after release 4.73.
64985 </para>
64986 </listitem>
64987 <listitem>
64988 <para>
64989 If DISABLE_D_OPTION is defined, the use of the <option>-D</option> command line option
64990 is disabled.
64991 </para>
64992 </listitem>
64993 <listitem>
64994 <para>
64995 FIXED_NEVER_USERS can be set to a colon-separated list of users that are
64996 never to be used for any deliveries. This is like the <option>never_users</option> runtime
64997 option, but it cannot be overridden; the runtime option adds additional users
64998 to the list. The default setting is <quote>root</quote>; this prevents a non-root user who
64999 is permitted to modify the runtime file from using Exim as a way to get root.
65000 </para>
65001 </listitem>
65002 </itemizedlist>
65003 </section>
65004 <section id="SECID270">
65005 <title>Root privilege</title>
65006 <para>
65007 <indexterm role="concept">
65008 <primary>setuid</primary>
65009 </indexterm>
65010 <indexterm role="concept">
65011 <primary>root privilege</primary>
65012 </indexterm>
65013 The Exim binary is normally setuid to root, which means that it gains root
65014 privilege (runs as root) when it starts execution. In some special cases (for
65015 example, when the daemon is not in use and there are no local deliveries), it
65016 may be possible to run Exim setuid to some user other than root. This is
65017 discussed in the next section. However, in most installations, root privilege
65018 is required for two things:
65019 </para>
65020 <itemizedlist>
65021 <listitem>
65022 <para>
65023 To set up a socket connected to the standard SMTP port (25) when initialising
65024 the listening daemon. If Exim is run from <emphasis>inetd</emphasis>, this privileged action is
65025 not required.
65026 </para>
65027 </listitem>
65028 <listitem>
65029 <para>
65030 To be able to change uid and gid in order to read users&#x2019; <filename>.forward</filename> files and
65031 perform local deliveries as the receiving user or as specified in the
65032 configuration.
65033 </para>
65034 </listitem>
65035 </itemizedlist>
65036 <para>
65037 It is not necessary to be root to do any of the other things Exim does, such as
65038 receiving messages and delivering them externally over SMTP, and it is
65039 obviously more secure if Exim does not run as root except when necessary.
65040 For this reason, a user and group for Exim to use must be defined in
65041 <filename>Local/Makefile</filename>. These are known as <quote>the Exim user</quote> and <quote>the Exim
65042 group</quote>. Their values can be changed by the run time configuration, though this
65043 is not recommended. Often a user called <emphasis>exim</emphasis> is used, but some sites use
65044 <emphasis>mail</emphasis> or another user name altogether.
65045 </para>
65046 <para>
65047 Exim uses <function>setuid()</function> whenever it gives up root privilege. This is a permanent
65048 abdication; the process cannot regain root afterwards. Prior to release 4.00,
65049 <function>seteuid()</function> was used in some circumstances, but this is no longer the case.
65050 </para>
65051 <para>
65052 After a new Exim process has interpreted its command line options, it changes
65053 uid and gid in the following cases:
65054 </para>
65055 <itemizedlist>
65056 <listitem>
65057 <para>
65058 <indexterm role="option">
65059 <primary><option>-C</option></primary>
65060 </indexterm>
65061 <indexterm role="option">
65062 <primary><option>-D</option></primary>
65063 </indexterm>
65064 If the <option>-C</option> option is used to specify an alternate configuration file, or if
65065 the <option>-D</option> option is used to define macro values for the configuration, and the
65066 calling process is not running as root, the uid and gid are changed to those of
65067 the calling process.
65068 However, if DISABLE_D_OPTION is defined in <filename>Local/Makefile</filename>, the <option>-D</option>
65069 option may not be used at all.
65070 If WHITELIST_D_MACROS is defined in <filename>Local/Makefile</filename>, then some macro values
65071 can be supplied if the calling process is running as root, the Exim run-time
65072 user or CONFIGURE_OWNER, if defined.
65073 </para>
65074 </listitem>
65075 <listitem>
65076 <para>
65077 <indexterm role="option">
65078 <primary><option>-be</option></primary>
65079 </indexterm>
65080 <indexterm role="option">
65081 <primary><option>-bf</option></primary>
65082 </indexterm>
65083 <indexterm role="option">
65084 <primary><option>-bF</option></primary>
65085 </indexterm>
65086 If the expansion test option (<option>-be</option>) or one of the filter testing options
65087 (<option>-bf</option> or <option>-bF</option>) are used, the uid and gid are changed to those of the
65088 calling process.
65089 </para>
65090 </listitem>
65091 <listitem>
65092 <para>
65093 If the process is not a daemon process or a queue runner process or a delivery
65094 process or a process for testing address routing (started with <option>-bt</option>), the
65095 uid and gid are changed to the Exim user and group. This means that Exim always
65096 runs under its own uid and gid when receiving messages. This also applies when
65097 testing address verification
65098 <indexterm role="option">
65099 <primary><option>-bv</option></primary>
65100 </indexterm>
65101 <indexterm role="option">
65102 <primary><option>-bh</option></primary>
65103 </indexterm>
65104 (the <option>-bv</option> option) and testing incoming message policy controls (the <option>-bh</option>
65105 option).
65106 </para>
65107 </listitem>
65108 <listitem>
65109 <para>
65110 For a daemon, queue runner, delivery, or address testing process, the uid
65111 remains as root at this stage, but the gid is changed to the Exim group.
65112 </para>
65113 </listitem>
65114 </itemizedlist>
65115 <para>
65116 The processes that initially retain root privilege behave as follows:
65117 </para>
65118 <itemizedlist>
65119 <listitem>
65120 <para>
65121 A daemon process changes the gid to the Exim group and the uid to the Exim
65122 user after setting up one or more listening sockets. The <function>initgroups()</function>
65123 function is called, so that if the Exim user is in any additional groups, they
65124 will be used during message reception.
65125 </para>
65126 </listitem>
65127 <listitem>
65128 <para>
65129 A queue runner process retains root privilege throughout its execution. Its
65130 job is to fork a controlled sequence of delivery processes.
65131 </para>
65132 </listitem>
65133 <listitem>
65134 <para>
65135 A delivery process retains root privilege throughout most of its execution,
65136 but any actual deliveries (that is, the transports themselves) are run in
65137 subprocesses which always change to a non-root uid and gid. For local
65138 deliveries this is typically the uid and gid of the owner of the mailbox; for
65139 remote deliveries, the Exim uid and gid are used. Once all the delivery
65140 subprocesses have been run, a delivery process changes to the Exim uid and gid
65141 while doing post-delivery tidying up such as updating the retry database and
65142 generating bounce and warning messages.
65143 </para>
65144 <para>
65145 While the recipient addresses in a message are being routed, the delivery
65146 process runs as root. However, if a user&#x2019;s filter file has to be processed,
65147 this is done in a subprocess that runs under the individual user&#x2019;s uid and
65148 gid. A system filter is run as root unless <option>system_filter_user</option> is set.
65149 </para>
65150 </listitem>
65151 <listitem>
65152 <para>
65153 A process that is testing addresses (the <option>-bt</option> option) runs as root so that
65154 the routing is done in the same environment as a message delivery.
65155 </para>
65156 </listitem>
65157 </itemizedlist>
65158 </section>
65159 <section id="SECTrunexiwitpri">
65160 <title>Running Exim without privilege</title>
65161 <para>
65162 <indexterm role="concept">
65163 <primary>privilege, running without</primary>
65164 </indexterm>
65165 <indexterm role="concept">
65166 <primary>unprivileged running</primary>
65167 </indexterm>
65168 <indexterm role="concept">
65169 <primary>root privilege</primary>
65170 <secondary>running without</secondary>
65171 </indexterm>
65172 Some installations like to run Exim in an unprivileged state for more of its
65173 operation, for added security. Support for this mode of operation is provided
65174 by the global option <option>deliver_drop_privilege</option>. When this is set, the uid and
65175 gid are changed to the Exim user and group at the start of a delivery process
65176 (and also queue runner and address testing processes). This means that address
65177 routing is no longer run as root, and the deliveries themselves cannot change
65178 to any other uid.
65179 </para>
65180 <para>
65181 <indexterm role="concept">
65182 <primary>SIGHUP</primary>
65183 </indexterm>
65184 <indexterm role="concept">
65185 <primary>daemon</primary>
65186 <secondary>restarting</secondary>
65187 </indexterm>
65188 Leaving the binary setuid to root, but setting <option>deliver_drop_privilege</option> means
65189 that the daemon can still be started in the usual way, and it can respond
65190 correctly to SIGHUP because the re-invocation regains root privilege.
65191 </para>
65192 <para>
65193 An alternative approach is to make Exim setuid to the Exim user and also setgid
65194 to the Exim group. If you do this, the daemon must be started from a root
65195 process. (Calling Exim from a root process makes it behave in the way it does
65196 when it is setuid root.) However, the daemon cannot restart itself after a
65197 SIGHUP signal because it cannot regain privilege.
65198 </para>
65199 <para>
65200 It is still useful to set <option>deliver_drop_privilege</option> in this case, because it
65201 stops Exim from trying to re-invoke itself to do a delivery after a message has
65202 been received. Such a re-invocation is a waste of resources because it has no
65203 effect.
65204 </para>
65205 <para>
65206 If restarting the daemon is not an issue (for example, if <option>mua_wrapper</option> is
65207 set, or <emphasis>inetd</emphasis> is being used instead of a daemon), having the binary setuid
65208 to the Exim user seems a clean approach, but there is one complication:
65209 </para>
65210 <para>
65211 In this style of operation, Exim is running with the real uid and gid set to
65212 those of the calling process, and the effective uid/gid set to Exim&#x2019;s values.
65213 Ideally, any association with the calling process&#x2019; uid/gid should be dropped,
65214 that is, the real uid/gid should be reset to the effective values so as to
65215 discard any privileges that the caller may have. While some operating systems
65216 have a function that permits this action for a non-root effective uid, quite a
65217 number of them do not. Because of this lack of standardization, Exim does not
65218 address this problem at this time.
65219 </para>
65220 <para>
65221 For this reason, the recommended approach for <quote>mostly unprivileged</quote> running
65222 is to keep the Exim binary setuid to root, and to set
65223 <option>deliver_drop_privilege</option>. This also has the advantage of allowing a daemon to
65224 be used in the most straightforward way.
65225 </para>
65226 <para>
65227 If you configure Exim not to run delivery processes as root, there are a
65228 number of restrictions on what you can do:
65229 </para>
65230 <itemizedlist>
65231 <listitem>
65232 <para>
65233 You can deliver only as the Exim user/group. You should  explicitly use the
65234 <option>user</option> and <option>group</option> options to override routers or local transports that
65235 normally deliver as the recipient. This makes sure that configurations that
65236 work in this mode function the same way in normal mode. Any implicit or
65237 explicit specification of another user causes an error.
65238 </para>
65239 </listitem>
65240 <listitem>
65241 <para>
65242 Use of <filename>.forward</filename> files is severely restricted, such that it is usually
65243 not worthwhile to include them in the configuration.
65244 </para>
65245 </listitem>
65246 <listitem>
65247 <para>
65248 Users who wish to use <filename>.forward</filename> would have to make their home directory and
65249 the file itself accessible to the Exim user. Pipe and append-to-file entries,
65250 and their equivalents in Exim filters, cannot be used. While they could be
65251 enabled in the Exim user&#x2019;s name, that would be insecure and not very useful.
65252 </para>
65253 </listitem>
65254 <listitem>
65255 <para>
65256 Unless the local user mailboxes are all owned by the Exim user (possible in
65257 some POP3 or IMAP-only environments):
65258 </para>
65259 <orderedlist numeration="arabic">
65260 <listitem>
65261 <para>
65262 They must be owned by the Exim group and be writeable by that group. This
65263 implies you must set <option>mode</option> in the appendfile configuration, as well as the
65264 mode of the mailbox files themselves.
65265 </para>
65266 </listitem>
65267 <listitem>
65268 <para>
65269 You must set <option>no_check_owner</option>, since most or all of the files will not be
65270 owned by the Exim user.
65271 </para>
65272 </listitem>
65273 <listitem>
65274 <para>
65275 You must set <option>file_must_exist</option>, because Exim cannot set the owner correctly
65276 on a newly created mailbox when unprivileged. This also implies that new
65277 mailboxes need to be created manually.
65278 </para>
65279 </listitem>
65280 </orderedlist>
65281 </listitem>
65282 </itemizedlist>
65283 <para>
65284 These restrictions severely restrict what can be done in local deliveries.
65285 However, there are no restrictions on remote deliveries. If you are running a
65286 gateway host that does no local deliveries, setting <option>deliver_drop_privilege</option>
65287 gives more security at essentially no cost.
65288 </para>
65289 <para>
65290 If you are using the <option>mua_wrapper</option> facility (see chapter
65291 <xref linkend="CHAPnonqueueing"/>), <option>deliver_drop_privilege</option> is forced to be true.
65292 </para>
65293 </section>
65294 <section id="SECID271">
65295 <title>Delivering to local files</title>
65296 <para>
65297 Full details of the checks applied by <command>appendfile</command> before it writes to a file
65298 are given in chapter <xref linkend="CHAPappendfile"/>.
65299 </para>
65300 </section>
65301 <section id="SECTsecconslocalcmds">
65302 <title>Running local commands</title>
65303 <para>
65304 <indexterm role="concept">
65305 <primary>security</primary>
65306 <secondary>local commands</secondary>
65307 </indexterm>
65308 <indexterm role="concept">
65309 <primary>security</primary>
65310 <secondary>command injection attacks</secondary>
65311 </indexterm>
65312 There are a number of ways in which an administrator can configure Exim to run
65313 commands based upon received, untrustworthy, data. Further, in some
65314 configurations a user who can control a <filename>.forward</filename> file can also arrange to
65315 run commands. Configuration to check includes, but is not limited to:
65316 </para>
65317 <itemizedlist>
65318 <listitem>
65319 <para>
65320 Use of <option>use_shell</option> in the pipe transport: various forms of shell command
65321 injection may be possible with this option present. It is dangerous and should
65322 be used only with considerable caution. Consider constraints which whitelist
65323 allowed characters in a variable which is to be used in a pipe transport that
65324 has <option>use_shell</option> enabled.
65325 </para>
65326 </listitem>
65327 <listitem>
65328 <para>
65329 A number of options such as <option>forbid_filter_run</option>, <option>forbid_filter_perl</option>,
65330 <option>forbid_filter_dlfunc</option> and so forth which restrict facilities available to
65331 <filename>.forward</filename> files in a redirect router. If Exim is running on a central mail
65332 hub to which ordinary users do not have shell access, but home directories are
65333 NFS mounted (for instance) then administrators should review the list of these
65334 forbid options available, and should bear in mind that the options that may
65335 need forbidding can change as new features are added between releases.
65336 </para>
65337 </listitem>
65338 <listitem>
65339 <para>
65340 The <option>${run...}</option> expansion item does not use a shell by default, but
65341 administrators can configure use of <filename>/bin/sh</filename> as part of the command.
65342 Such invocations should be viewed with prejudicial suspicion.
65343 </para>
65344 </listitem>
65345 <listitem>
65346 <para>
65347 Administrators who use embedded Perl are advised to explore how Perl&#x2019;s
65348 taint checking might apply to their usage.
65349 </para>
65350 </listitem>
65351 <listitem>
65352 <para>
65353 Use of <option>${expand...}</option> is somewhat analagous to shell&#x2019;s eval builtin and
65354 administrators are well advised to view its use with suspicion, in case (for
65355 instance) it allows a local-part to contain embedded Exim directives.
65356 </para>
65357 </listitem>
65358 <listitem>
65359 <para>
65360 Use of <option>${match_local_part...}</option> and friends becomes more dangerous if
65361 Exim was built with EXPAND_LISTMATCH_RHS defined: the second string in
65362 each can reference arbitrary lists and files, rather than just being a list
65363 of opaque strings.
65364 The EXPAND_LISTMATCH_RHS option was added and set false by default because of
65365 real-world security vulnerabilities caused by its use with untrustworthy data
65366 injected in, for SQL injection attacks.
65367 Consider the use of the <option>inlisti</option> expansion condition instead.
65368 </para>
65369 </listitem>
65370 </itemizedlist>
65371 </section>
65372 <section id="SECTsecconfdata">
65373 <title>Trust in configuration data</title>
65374 <para>
65375 <indexterm role="concept">
65376 <primary>security</primary>
65377 <secondary>data sources</secondary>
65378 </indexterm>
65379 <indexterm role="concept">
65380 <primary>security</primary>
65381 <secondary>regular expressions</secondary>
65382 </indexterm>
65383 <indexterm role="concept">
65384 <primary>regular expressions</primary>
65385 <secondary>security</secondary>
65386 </indexterm>
65387 <indexterm role="concept">
65388 <primary>PCRE</primary>
65389 <secondary>security</secondary>
65390 </indexterm>
65391 If configuration data for Exim can come from untrustworthy sources, there
65392 are some issues to be aware of:
65393 </para>
65394 <itemizedlist>
65395 <listitem>
65396 <para>
65397 Use of <option>${expand...}</option> may provide a path for shell injection attacks.
65398 </para>
65399 </listitem>
65400 <listitem>
65401 <para>
65402 Letting untrusted data provide a regular expression is unwise.
65403 </para>
65404 </listitem>
65405 <listitem>
65406 <para>
65407 Using <option>${match...}</option> to apply a fixed regular expression against untrusted
65408 data may result in pathological behaviour within PCRE.  Be aware of what
65409 "backtracking" means and consider options for being more strict with a regular
65410 expression. Avenues to explore include limiting what can match (avoiding <literal>.</literal>
65411 when <literal>[a-z0-9]</literal> or other character class will do), use of atomic grouping and
65412 possessive quantifiers or just not using regular expressions against untrusted
65413 data.
65414 </para>
65415 </listitem>
65416 <listitem>
65417 <para>
65418 It can be important to correctly use <option>${quote:...}</option>,
65419 <option>${quote_local_part:...}</option> and <option>${quote_</option>&lt;<emphasis>lookup-type</emphasis>&gt;<option>:...}</option> expansion
65420 items to ensure that data is correctly constructed.
65421 </para>
65422 </listitem>
65423 <listitem>
65424 <para>
65425 Some lookups might return multiple results, even though normal usage is only
65426 expected to yield one result.
65427 </para>
65428 </listitem>
65429 </itemizedlist>
65430 </section>
65431 <section id="SECID272">
65432 <title>IPv4 source routing</title>
65433 <para>
65434 <indexterm role="concept">
65435 <primary>source routing</primary>
65436 <secondary>in IP packets</secondary>
65437 </indexterm>
65438 <indexterm role="concept">
65439 <primary>IP source routing</primary>
65440 </indexterm>
65441 Many operating systems suppress IP source-routed packets in the kernel, but
65442 some cannot be made to do this, so Exim does its own check. It logs incoming
65443 IPv4 source-routed TCP calls, and then drops them. Things are all different in
65444 IPv6. No special checking is currently done.
65445 </para>
65446 </section>
65447 <section id="SECID273">
65448 <title>The VRFY, EXPN, and ETRN commands in SMTP</title>
65449 <para>
65450 Support for these SMTP commands is disabled by default. If required, they can
65451 be enabled by defining suitable ACLs.
65452 </para>
65453 </section>
65454 <section id="SECID274">
65455 <title>Privileged users</title>
65456 <para>
65457 <indexterm role="concept">
65458 <primary>trusted users</primary>
65459 </indexterm>
65460 <indexterm role="concept">
65461 <primary>admin user</primary>
65462 </indexterm>
65463 <indexterm role="concept">
65464 <primary>privileged user</primary>
65465 </indexterm>
65466 <indexterm role="concept">
65467 <primary>user</primary>
65468 <secondary>trusted</secondary>
65469 </indexterm>
65470 <indexterm role="concept">
65471 <primary>user</primary>
65472 <secondary>admin</secondary>
65473 </indexterm>
65474 Exim recognizes two sets of users with special privileges. Trusted users are
65475 able to submit new messages to Exim locally, but supply their own sender
65476 addresses and information about a sending host. For other users submitting
65477 local messages, Exim sets up the sender address from the uid, and doesn&#x2019;t
65478 permit a remote host to be specified.
65479 </para>
65480 <para>
65481 <indexterm role="option">
65482 <primary><option>-f</option></primary>
65483 </indexterm>
65484 However, an untrusted user is permitted to use the <option>-f</option> command line option
65485 in the special form <option>-f &lt;&gt;</option> to indicate that a delivery failure for the
65486 message should not cause an error report. This affects the message&#x2019;s envelope,
65487 but it does not affect the <emphasis>Sender:</emphasis> header. Untrusted users may also be
65488 permitted to use specific forms of address with the <option>-f</option> option by setting
65489 the <option>untrusted_set_sender</option> option.
65490 </para>
65491 <para>
65492 Trusted users are used to run processes that receive mail messages from some
65493 other mail domain and pass them on to Exim for delivery either locally, or over
65494 the Internet. Exim trusts a caller that is running as root, as the Exim user,
65495 as any user listed in the <option>trusted_users</option> configuration option, or under any
65496 group listed in the <option>trusted_groups</option> option.
65497 </para>
65498 <para>
65499 Admin users are permitted to do things to the messages on Exim&#x2019;s queue. They
65500 can freeze or thaw messages, cause them to be returned to their senders, remove
65501 them entirely, or modify them in various ways. In addition, admin users can run
65502 the Exim monitor and see all the information it is capable of providing, which
65503 includes the contents of files on the spool.
65504 </para>
65505 <para>
65506 <indexterm role="option">
65507 <primary><option>-M</option></primary>
65508 </indexterm>
65509 <indexterm role="option">
65510 <primary><option>-q</option></primary>
65511 </indexterm>
65512 By default, the use of the <option>-M</option> and <option>-q</option> options to cause Exim to attempt
65513 delivery of messages on its queue is restricted to admin users. This
65514 restriction can be relaxed by setting the <option>no_prod_requires_admin</option> option.
65515 Similarly, the use of <option>-bp</option> (and its variants) to list the contents of the
65516 queue is also restricted to admin users. This restriction can be relaxed by
65517 setting <option>no_queue_list_requires_admin</option>.
65518 </para>
65519 <para>
65520 Exim recognizes an admin user if the calling process is running as root or as
65521 the Exim user or if any of the groups associated with the calling process is
65522 the Exim group. It is not necessary actually to be running under the Exim
65523 group. However, if admin users who are not root or the Exim user are to access
65524 the contents of files on the spool via the Exim monitor (which runs
65525 unprivileged), Exim must be built to allow group read access to its spool
65526 files.
65527 </para>
65528 </section>
65529 <section id="SECID275">
65530 <title>Spool files</title>
65531 <para>
65532 <indexterm role="concept">
65533 <primary>spool directory</primary>
65534 <secondary>files</secondary>
65535 </indexterm>
65536 Exim&#x2019;s spool directory and everything it contains is owned by the Exim user and
65537 set to the Exim group. The mode for spool files is defined in the
65538 <filename>Local/Makefile</filename> configuration file, and defaults to 0640. This means that
65539 any user who is a member of the Exim group can access these files.
65540 </para>
65541 </section>
65542 <section id="SECID276">
65543 <title>Use of argv[0]</title>
65544 <para>
65545 Exim examines the last component of <option>argv[0]</option>, and if it matches one of a set
65546 of specific strings, Exim assumes certain options. For example, calling Exim
65547 with the last component of <option>argv[0]</option> set to <quote>rsmtp</quote> is exactly equivalent
65548 to calling it with the option <option>-bS</option>. There are no security implications in
65549 this.
65550 </para>
65551 </section>
65552 <section id="SECID277">
65553 <title>Use of %f formatting</title>
65554 <para>
65555 The only use made of <quote>%f</quote> by Exim is in formatting load average values. These
65556 are actually stored in integer variables as 1000 times the load average.
65557 Consequently, their range is limited and so therefore is the length of the
65558 converted output.
65559 </para>
65560 </section>
65561 <section id="SECID278">
65562 <title>Embedded Exim path</title>
65563 <para>
65564 Exim uses its own path name, which is embedded in the code, only when it needs
65565 to re-exec in order to regain root privilege. Therefore, it is not root when it
65566 does so. If some bug allowed the path to get overwritten, it would lead to an
65567 arbitrary program&#x2019;s being run as exim, not as root.
65568 </para>
65569 </section>
65570 <section id="SECTdynmoddir">
65571 <title>Dynamic module directory</title>
65572 <para>
65573 Any dynamically loadable modules must be installed into the directory
65574 defined in <literal>LOOKUP_MODULE_DIR</literal> in <filename>Local/Makefile</filename> for Exim to permit
65575 loading it.
65576 </para>
65577 </section>
65578 <section id="SECID279">
65579 <title>Use of sprintf()</title>
65580 <para>
65581 <indexterm role="concept">
65582 <primary><function>sprintf()</function></primary>
65583 </indexterm>
65584 A large number of occurrences of <quote>sprintf</quote> in the code are actually calls to
65585 <emphasis>string_sprintf()</emphasis>, a function that returns the result in malloc&#x2019;d store.
65586 The intermediate formatting is done into a large fixed buffer by a function
65587 that runs through the format string itself, and checks the length of each
65588 conversion before performing it, thus preventing buffer overruns.
65589 </para>
65590 <para>
65591 The remaining uses of <function>sprintf()</function> happen in controlled circumstances where
65592 the output buffer is known to be sufficiently long to contain the converted
65593 string.
65594 </para>
65595 </section>
65596 <section id="SECID280">
65597 <title>Use of debug_printf() and log_write()</title>
65598 <para>
65599 Arbitrary strings are passed to both these functions, but they do their
65600 formatting by calling the function <emphasis>string_vformat()</emphasis>, which runs through
65601 the format string itself, and checks the length of each conversion.
65602 </para>
65603 </section>
65604 <section id="SECID281">
65605 <title>Use of strcat() and strcpy()</title>
65606 <para>
65607 These are used only in cases where the output buffer is known to be large
65608 enough to hold the result.
65609 <indexterm role="concept" startref="IIDsecurcon" class="endofrange"/>
65610 </para>
65611 </section>
65612 </chapter>
65613
65614 <chapter id="CHAPspool">
65615 <title>Format of spool files</title>
65616 <para>
65617 <indexterm role="concept" id="IIDforspo1" class="startofrange">
65618 <primary>format</primary>
65619 <secondary>spool files</secondary>
65620 </indexterm>
65621 <indexterm role="concept" id="IIDforspo2" class="startofrange">
65622 <primary>spool directory</primary>
65623 <secondary>format of files</secondary>
65624 </indexterm>
65625 <indexterm role="concept" id="IIDforspo3" class="startofrange">
65626 <primary>spool files</primary>
65627 <secondary>format of</secondary>
65628 </indexterm>
65629 <indexterm role="concept">
65630 <primary>spool files</primary>
65631 <secondary>editing</secondary>
65632 </indexterm>
65633 A message on Exim&#x2019;s queue consists of two files, whose names are the message id
65634 followed by -D and -H, respectively. The data portion of the message is kept in
65635 the -D file on its own. The message&#x2019;s envelope, status, and headers are all
65636 kept in the -H file, whose format is described in this chapter. Each of these
65637 two files contains the final component of its own name as its first line. This
65638 is insurance against disk crashes where the directory is lost but the files
65639 themselves are recoverable.
65640 </para>
65641 <para>
65642 Some people are tempted into editing -D files in order to modify messages. You
65643 need to be extremely careful if you do this; it is not recommended and you are
65644 on your own if you do it. Here are some of the pitfalls:
65645 </para>
65646 <itemizedlist>
65647 <listitem>
65648 <para>
65649 You must ensure that Exim does not try to deliver the message while you are
65650 fiddling with it. The safest way is to take out a write lock on the -D file,
65651 which is what Exim itself does, using <function>fcntl()</function>. If you update the file in
65652 place, the lock will be retained. If you write a new file and rename it, the
65653 lock will be lost at the instant of rename.
65654 </para>
65655 </listitem>
65656 <listitem>
65657 <para>
65658 <indexterm role="variable">
65659 <primary><varname>$body_linecount</varname></primary>
65660 </indexterm>
65661 If you change the number of lines in the file, the value of
65662 <varname>$body_linecount</varname>, which is stored in the -H file, will be incorrect. At
65663 present, this value is not used by Exim, but there is no guarantee that this
65664 will always be the case.
65665 </para>
65666 </listitem>
65667 <listitem>
65668 <para>
65669 If the message is in MIME format, you must take care not to break it.
65670 </para>
65671 </listitem>
65672 <listitem>
65673 <para>
65674 If the message is cryptographically signed, any change will invalidate the
65675 signature.
65676 </para>
65677 </listitem>
65678 </itemizedlist>
65679 <para>
65680 All in all, modifying -D files is fraught with danger.
65681 </para>
65682 <para>
65683 Files whose names end with -J may also be seen in the <filename>input</filename> directory (or
65684 its subdirectories when <option>split_spool_directory</option> is set). These are journal
65685 files, used to record addresses to which the message has been delivered during
65686 the course of a delivery attempt. If there are still undelivered recipients at
65687 the end, the -H file is updated, and the -J file is deleted. If, however, there
65688 is some kind of crash (for example, a power outage) before this happens, the -J
65689 file remains in existence. When Exim next processes the message, it notices the
65690 -J file and uses it to update the -H file before starting the next delivery
65691 attempt.
65692 </para>
65693 <section id="SECID282">
65694 <title>Format of the -H file</title>
65695 <para>
65696 <indexterm role="concept">
65697 <primary>uid (user id)</primary>
65698 <secondary>in spool file</secondary>
65699 </indexterm>
65700 <indexterm role="concept">
65701 <primary>gid (group id)</primary>
65702 <secondary>in spool file</secondary>
65703 </indexterm>
65704 The second line of the -H file contains the login name for the uid of the
65705 process that called Exim to read the message, followed by the numerical uid and
65706 gid. For a locally generated message, this is normally the user who sent the
65707 message. For a message received over TCP/IP via the daemon, it is
65708 normally the Exim user.
65709 </para>
65710 <para>
65711 The third line of the file contains the address of the message&#x2019;s sender as
65712 transmitted in the envelope, contained in angle brackets. The sender address is
65713 empty for bounce messages. For incoming SMTP mail, the sender address is given
65714 in the MAIL command. For locally generated mail, the sender address is
65715 created by Exim from the login name of the current user and the configured
65716 <option>qualify_domain</option>. However, this can be overridden by the <option>-f</option> option or a
65717 leading <quote>From&nbsp;</quote> line if the caller is trusted, or if the supplied address is
65718 <quote>&lt;&gt;</quote> or an address that matches <option>untrusted_set_senders</option>.
65719 </para>
65720 <para>
65721 The fourth line contains two numbers. The first is the time that the message
65722 was received, in the conventional Unix form &ndash; the number of seconds since the
65723 start of the epoch. The second number is a count of the number of messages
65724 warning of delayed delivery that have been sent to the sender.
65725 </para>
65726 <para>
65727 There follow a number of lines starting with a hyphen. These can appear in any
65728 order, and are omitted when not relevant:
65729 </para>
65730 <variablelist>
65731 <varlistentry>
65732 <term><option>-acl</option>&nbsp;&lt;<emphasis>number</emphasis>&gt;&nbsp;&lt;<emphasis>length</emphasis>&gt;</term>
65733 <listitem>
65734 <para>
65735 This item is obsolete, and is not generated from Exim release 4.61 onwards;
65736 <option>-aclc</option> and <option>-aclm</option> are used instead. However, <option>-acl</option> is still
65737 recognized, to provide backward compatibility. In the old format, a line of
65738 this form is present for every ACL variable that is not empty. The number
65739 identifies the variable; the <option>acl_c</option><emphasis role="bold">x</emphasis> variables are numbered 0&ndash;9 and
65740 the <option>acl_m</option><emphasis role="bold">x</emphasis> variables are numbered 10&ndash;19. The length is the length of
65741 the data string for the variable. The string itself starts at the beginning of
65742 the next line, and is followed by a newline character. It may contain internal
65743 newlines.
65744 </para>
65745 </listitem></varlistentry>
65746 <varlistentry>
65747 <term><option>-aclc</option>&nbsp;&lt;<emphasis>rest-of-name</emphasis>&gt;&nbsp;&lt;<emphasis>length</emphasis>&gt;</term>
65748 <listitem>
65749 <para>
65750 A line of this form is present for every ACL connection variable that is
65751 defined. Note that there is a space between <option>-aclc</option> and the rest of the name.
65752 The length is the length of the data string for the variable. The string itself
65753 starts at the beginning of the next line, and is followed by a newline
65754 character. It may contain internal newlines.
65755 </para>
65756 </listitem></varlistentry>
65757 <varlistentry>
65758 <term><option>-aclm</option>&nbsp;&lt;<emphasis>rest-of-name</emphasis>&gt;&nbsp;&lt;<emphasis>length</emphasis>&gt;</term>
65759 <listitem>
65760 <para>
65761 A line of this form is present for every ACL message variable that is defined.
65762 Note that there is a space between <option>-aclm</option> and the rest of the name. The
65763 length is the length of the data string for the variable. The string itself
65764 starts at the beginning of the next line, and is followed by a newline
65765 character. It may contain internal newlines.
65766 </para>
65767 </listitem></varlistentry>
65768 <varlistentry>
65769 <term><option>-active_hostname</option>&nbsp;&lt;<emphasis>hostname</emphasis>&gt;</term>
65770 <listitem>
65771 <para>
65772 This is present if, when the message was received over SMTP, the value of
65773 <varname>$smtp_active_hostname</varname> was different to the value of <varname>$primary_hostname</varname>.
65774 </para>
65775 </listitem></varlistentry>
65776 <varlistentry>
65777 <term><option>-allow_unqualified_recipient</option></term>
65778 <listitem>
65779 <para>
65780 This is present if unqualified recipient addresses are permitted in header
65781 lines (to stop such addresses from being qualified if rewriting occurs at
65782 transport time). Local messages that were input using <option>-bnq</option> and remote
65783 messages from hosts that match <option>recipient_unqualified_hosts</option> set this flag.
65784 </para>
65785 </listitem></varlistentry>
65786 <varlistentry>
65787 <term><option>-allow_unqualified_sender</option></term>
65788 <listitem>
65789 <para>
65790 This is present if unqualified sender addresses are permitted in header lines
65791 (to stop such addresses from being qualified if rewriting occurs at transport
65792 time). Local messages that were input using <option>-bnq</option> and remote messages from
65793 hosts that match <option>sender_unqualified_hosts</option> set this flag.
65794 </para>
65795 </listitem></varlistentry>
65796 <varlistentry>
65797 <term><option>-auth_id</option>&nbsp;&lt;<emphasis>text</emphasis>&gt;</term>
65798 <listitem>
65799 <para>
65800 The id information for a message received on an authenticated SMTP connection
65801 &ndash; the value of the <varname>$authenticated_id</varname> variable.
65802 </para>
65803 </listitem></varlistentry>
65804 <varlistentry>
65805 <term><option>-auth_sender</option>&nbsp;&lt;<emphasis>address</emphasis>&gt;</term>
65806 <listitem>
65807 <para>
65808 The address of an authenticated sender &ndash; the value of the
65809 <varname>$authenticated_sender</varname> variable.
65810 </para>
65811 </listitem></varlistentry>
65812 <varlistentry>
65813 <term><option>-body_linecount</option>&nbsp;&lt;<emphasis>number</emphasis>&gt;</term>
65814 <listitem>
65815 <para>
65816 This records the number of lines in the body of the message, and is always
65817 present.
65818 </para>
65819 </listitem></varlistentry>
65820 <varlistentry>
65821 <term><option>-body_zerocount</option>&nbsp;&lt;<emphasis>number</emphasis>&gt;</term>
65822 <listitem>
65823 <para>
65824 This records the number of binary zero bytes in the body of the message, and is
65825 present if the number is greater than zero.
65826 </para>
65827 </listitem></varlistentry>
65828 <varlistentry>
65829 <term><option>-deliver_firsttime</option></term>
65830 <listitem>
65831 <para>
65832 This is written when a new message is first added to the spool. When the spool
65833 file is updated after a deferral, it is omitted.
65834 </para>
65835 </listitem></varlistentry>
65836 <varlistentry>
65837 <term><option>-frozen</option>&nbsp;&lt;<emphasis>time</emphasis>&gt;</term>
65838 <listitem>
65839 <para>
65840 <indexterm role="concept">
65841 <primary>frozen messages</primary>
65842 <secondary>spool data</secondary>
65843 </indexterm>
65844 The message is frozen, and the freezing happened at &lt;<emphasis>time</emphasis>&gt;.
65845 </para>
65846 </listitem></varlistentry>
65847 <varlistentry>
65848 <term><option>-helo_name</option>&nbsp;&lt;<emphasis>text</emphasis>&gt;</term>
65849 <listitem>
65850 <para>
65851 This records the host name as specified by a remote host in a HELO or EHLO
65852 command.
65853 </para>
65854 </listitem></varlistentry>
65855 <varlistentry>
65856 <term><option>-host_address</option>&nbsp;&lt;<emphasis>address</emphasis>&gt;.&lt;<emphasis>port</emphasis>&gt;</term>
65857 <listitem>
65858 <para>
65859 This records the IP address of the host from which the message was received and
65860 the remote port number that was used. It is omitted for locally generated
65861 messages.
65862 </para>
65863 </listitem></varlistentry>
65864 <varlistentry>
65865 <term><option>-host_auth</option>&nbsp;&lt;<emphasis>text</emphasis>&gt;</term>
65866 <listitem>
65867 <para>
65868 If the message was received on an authenticated SMTP connection, this records
65869 the name of the authenticator &ndash; the value of the
65870 <varname>$sender_host_authenticated</varname> variable.
65871 </para>
65872 </listitem></varlistentry>
65873 <varlistentry>
65874 <term><option>-host_lookup_failed</option></term>
65875 <listitem>
65876 <para>
65877 This is present if an attempt to look up the sending host&#x2019;s name from its IP
65878 address failed. It corresponds to the <varname>$host_lookup_failed</varname> variable.
65879 </para>
65880 </listitem></varlistentry>
65881 <varlistentry>
65882 <term><option>-host_name</option>&nbsp;&lt;<emphasis>text</emphasis>&gt;</term>
65883 <listitem>
65884 <para>
65885 <indexterm role="concept">
65886 <primary>reverse DNS lookup</primary>
65887 </indexterm>
65888 <indexterm role="concept">
65889 <primary>DNS</primary>
65890 <secondary>reverse lookup</secondary>
65891 </indexterm>
65892 This records the name of the remote host from which the message was received,
65893 if the host name was looked up from the IP address when the message was being
65894 received. It is not present if no reverse lookup was done.
65895 </para>
65896 </listitem></varlistentry>
65897 <varlistentry>
65898 <term><option>-ident</option>&nbsp;&lt;<emphasis>text</emphasis>&gt;</term>
65899 <listitem>
65900 <para>
65901 For locally submitted messages, this records the login of the originating user,
65902 unless it was a trusted user and the <option>-oMt</option> option was used to specify an
65903 ident value. For messages received over TCP/IP, this records the ident string
65904 supplied by the remote host, if any.
65905 </para>
65906 </listitem></varlistentry>
65907 <varlistentry>
65908 <term><option>-interface_address</option>&nbsp;&lt;<emphasis>address</emphasis>&gt;.&lt;<emphasis>port</emphasis>&gt;</term>
65909 <listitem>
65910 <para>
65911 This records the IP address of the local interface and the port number through
65912 which a message was received from a remote host. It is omitted for locally
65913 generated messages.
65914 </para>
65915 </listitem></varlistentry>
65916 <varlistentry>
65917 <term><option>-local</option></term>
65918 <listitem>
65919 <para>
65920 The message is from a local sender.
65921 </para>
65922 </listitem></varlistentry>
65923 <varlistentry>
65924 <term><option>-localerror</option></term>
65925 <listitem>
65926 <para>
65927 The message is a locally-generated bounce message.
65928 </para>
65929 </listitem></varlistentry>
65930 <varlistentry>
65931 <term><option>-local_scan</option>&nbsp;&lt;<emphasis>string</emphasis>&gt;</term>
65932 <listitem>
65933 <para>
65934 This records the data string that was returned by the <function>local_scan()</function> function
65935 when the message was received &ndash; the value of the <varname>$local_scan_data</varname>
65936 variable. It is omitted if no data was returned.
65937 </para>
65938 </listitem></varlistentry>
65939 <varlistentry>
65940 <term><option>-manual_thaw</option></term>
65941 <listitem>
65942 <para>
65943 The message was frozen but has been thawed manually, that is, by an explicit
65944 Exim command rather than via the auto-thaw process.
65945 </para>
65946 </listitem></varlistentry>
65947 <varlistentry>
65948 <term><option>-N</option></term>
65949 <listitem>
65950 <para>
65951 A testing delivery process was started using the <option>-N</option> option to suppress any
65952 actual deliveries, but delivery was deferred. At any further delivery attempts,
65953 <option>-N</option> is assumed.
65954 </para>
65955 </listitem></varlistentry>
65956 <varlistentry>
65957 <term><option>-received_protocol</option></term>
65958 <listitem>
65959 <para>
65960 This records the value of the <varname>$received_protocol</varname> variable, which contains
65961 the name of the protocol by which the message was received.
65962 </para>
65963 </listitem></varlistentry>
65964 <varlistentry>
65965 <term><option>-sender_set_untrusted</option></term>
65966 <listitem>
65967 <para>
65968 The envelope sender of this message was set by an untrusted local caller (used
65969 to ensure that the caller is displayed in queue listings).
65970 </para>
65971 </listitem></varlistentry>
65972 <varlistentry>
65973 <term><option>-spam_score_int</option>&nbsp;&lt;<emphasis>number</emphasis>&gt;</term>
65974 <listitem>
65975 <para>
65976 If a message was scanned by SpamAssassin, this is present. It records the value
65977 of <varname>$spam_score_int</varname>.
65978 </para>
65979 </listitem></varlistentry>
65980 <varlistentry>
65981 <term><option>-tls_certificate_verified</option></term>
65982 <listitem>
65983 <para>
65984 A TLS certificate was received from the client that sent this message, and the
65985 certificate was verified by the server.
65986 </para>
65987 </listitem></varlistentry>
65988 <varlistentry>
65989 <term><option>-tls_cipher</option>&nbsp;&lt;<emphasis>cipher name</emphasis>&gt;</term>
65990 <listitem>
65991 <para>
65992 When the message was received over an encrypted connection, this records the
65993 name of the cipher suite that was used.
65994 </para>
65995 </listitem></varlistentry>
65996 <varlistentry>
65997 <term><option>-tls_peerdn</option>&nbsp;&lt;<emphasis>peer DN</emphasis>&gt;</term>
65998 <listitem>
65999 <para>
66000 When the message was received over an encrypted connection, and a certificate
66001 was received from the client, this records the Distinguished Name from that
66002 certificate.
66003 </para>
66004 </listitem></varlistentry>
66005 </variablelist>
66006 <para>
66007 Following the options there is a list of those addresses to which the message
66008 is not to be delivered. This set of addresses is initialized from the command
66009 line when the <option>-t</option> option is used and <option>extract_addresses_remove_arguments</option>
66010 is set; otherwise it starts out empty. Whenever a successful delivery is made,
66011 the address is added to this set. The addresses are kept internally as a
66012 balanced binary tree, and it is a representation of that tree which is written
66013 to the spool file. If an address is expanded via an alias or forward file, the
66014 original address is added to the tree when deliveries to all its child
66015 addresses are complete.
66016 </para>
66017 <para>
66018 If the tree is empty, there is a single line in the spool file containing just
66019 the text <quote>XX</quote>. Otherwise, each line consists of two letters, which are either
66020 Y or N, followed by an address. The address is the value for the node of the
66021 tree, and the letters indicate whether the node has a left branch and/or a
66022 right branch attached to it, respectively. If branches exist, they immediately
66023 follow. Here is an example of a three-node tree:
66024 </para>
66025 <literallayout class="monospaced">
66026 YY darcy@austen.fict.example
66027 NN alice@wonderland.fict.example
66028 NN editor@thesaurus.ref.example
66029 </literallayout>
66030 <para>
66031 After the non-recipients tree, there is a list of the message&#x2019;s recipients.
66032 This is a simple list, preceded by a count. It includes all the original
66033 recipients of the message, including those to whom the message has already been
66034 delivered. In the simplest case, the list contains one address per line. For
66035 example:
66036 </para>
66037 <literallayout class="monospaced">
66038 4
66039 editor@thesaurus.ref.example
66040 darcy@austen.fict.example
66041 rdo@foundation
66042 alice@wonderland.fict.example
66043 </literallayout>
66044 <para>
66045 However, when a child address has been added to the top-level addresses as a
66046 result of the use of the <option>one_time</option> option on a <command>redirect</command> router, each
66047 line is of the following form:
66048 </para>
66049 <literallayout>
66050 &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;
66051 </literallayout>
66052 <para>
66053 The 01 flag bit indicates the presence of the three other fields that follow
66054 the top-level address. Other bits may be used in future to support additional
66055 fields. The &lt;<emphasis>parent number</emphasis>&gt; is the offset in the recipients list of the
66056 original parent of the <quote>one time</quote> address. The first two fields are the
66057 envelope sender that is associated with this address and its length. If the
66058 length is zero, there is no special envelope sender (there are then two space
66059 characters in the line). A non-empty field can arise from a <command>redirect</command> router
66060 that has an <option>errors_to</option> setting.
66061 </para>
66062 <para>
66063 A blank line separates the envelope and status information from the headers
66064 which follow. A header may occupy several lines of the file, and to save effort
66065 when reading it in, each header is preceded by a number and an identifying
66066 character. The number is the number of characters in the header, including any
66067 embedded newlines and the terminating newline. The character is one of the
66068 following:
66069 </para>
66070 <informaltable frame="none">
66071 <tgroup cols="2" colsep="0" rowsep="0">
66072 <colspec colwidth="50pt" align="left"/>
66073 <colspec colwidth="254pt" align="left"/>
66074 <tbody>
66075 <row>
66076 <entry>&lt;<emphasis>blank</emphasis>&gt;</entry>
66077 <entry>header in which Exim has no special interest</entry>
66078 </row>
66079 <row>
66080 <entry><literal>B</literal></entry>
66081 <entry><emphasis>Bcc:</emphasis> header</entry>
66082 </row>
66083 <row>
66084 <entry><literal>C</literal></entry>
66085 <entry><emphasis>Cc:</emphasis> header</entry>
66086 </row>
66087 <row>
66088 <entry><literal>F</literal></entry>
66089 <entry><emphasis>From:</emphasis> header</entry>
66090 </row>
66091 <row>
66092 <entry><literal>I</literal></entry>
66093 <entry><emphasis>Message-id:</emphasis> header</entry>
66094 </row>
66095 <row>
66096 <entry><literal>P</literal></entry>
66097 <entry><emphasis>Received:</emphasis> header &ndash; P for <quote>postmark</quote></entry>
66098 </row>
66099 <row>
66100 <entry><literal>R</literal></entry>
66101 <entry><emphasis>Reply-To:</emphasis> header</entry>
66102 </row>
66103 <row>
66104 <entry><literal>S</literal></entry>
66105 <entry><emphasis>Sender:</emphasis> header</entry>
66106 </row>
66107 <row>
66108 <entry><literal>T</literal></entry>
66109 <entry><emphasis>To:</emphasis> header</entry>
66110 </row>
66111 <row>
66112 <entry><literal>*</literal></entry>
66113 <entry>replaced or deleted header</entry>
66114 </row>
66115 </tbody>
66116 </tgroup>
66117 </informaltable>
66118 <para>
66119 Deleted or replaced (rewritten) headers remain in the spool file for debugging
66120 purposes. They are not transmitted when the message is delivered. Here is a
66121 typical set of headers:
66122 </para>
66123 <literallayout class="monospaced">
66124 111P Received: by hobbit.fict.example with local (Exim 4.00)
66125 id 14y9EI-00026G-00; Fri, 11 May 2001 10:28:59 +0100
66126 049  Message-Id: &lt;E14y9EI-00026G-00@hobbit.fict.example&gt;
66127 038* X-rewrote-sender: bb@hobbit.fict.example
66128 042* From: Bilbo Baggins &lt;bb@hobbit.fict.example&gt;
66129 049F From: Bilbo Baggins &lt;B.Baggins@hobbit.fict.example&gt;
66130 099* To: alice@wonderland.fict.example, rdo@foundation,
66131 darcy@austen.fict.example, editor@thesaurus.ref.example
66132 104T To: alice@wonderland.fict.example, rdo@foundation.example,
66133 darcy@austen.fict.example, editor@thesaurus.ref.example
66134 038  Date: Fri, 11 May 2001 10:28:59 +0100
66135 </literallayout>
66136 <para>
66137 The asterisked headers indicate that the envelope sender, <emphasis>From:</emphasis> header, and
66138 <emphasis>To:</emphasis> header have been rewritten, the last one because routing expanded the
66139 unqualified domain <emphasis>foundation</emphasis>.
66140 <indexterm role="concept" startref="IIDforspo1" class="endofrange"/>
66141 <indexterm role="concept" startref="IIDforspo2" class="endofrange"/>
66142 <indexterm role="concept" startref="IIDforspo3" class="endofrange"/>
66143 </para>
66144 </section>
66145 </chapter>
66146
66147 <chapter id="CHAPdkim">
66148 <title>Support for DKIM (DomainKeys Identified Mail)</title>
66149 <titleabbrev>DKIM Support</titleabbrev>
66150 <para>
66151 <indexterm role="concept">
66152 <primary>DKIM</primary>
66153 </indexterm>
66154 </para>
66155 <para>
66156 DKIM is a mechanism by which messages sent by some entity can be provably
66157 linked to a domain which that entity controls.  It permits reputation to
66158 be tracked on a per-domain basis, rather than merely upon source IP address.
66159 DKIM is documented in RFC 4871.
66160 </para>
66161 <para>
66162 Since version 4.70, DKIM support is compiled into Exim by default. It can be
66163 disabled by setting DISABLE_DKIM=yes in Local/Makefile.
66164 </para>
66165 <para>
66166 Exim&#x2019;s DKIM implementation allows to
66167 </para>
66168 <orderedlist numeration="arabic">
66169 <listitem>
66170 <para>
66171 Sign outgoing messages: This function is implemented in the SMTP transport.
66172 It can co-exist with all other Exim features
66173 (including transport filters)
66174 except cutthrough delivery.
66175 </para>
66176 </listitem>
66177 <listitem>
66178 <para>
66179 Verify signatures in incoming messages: This is implemented by an additional
66180 ACL (acl_smtp_dkim), which can be called several times per message, with
66181 different signature contexts.
66182 </para>
66183 </listitem>
66184 </orderedlist>
66185 <para>
66186 In typical Exim style, the verification implementation does not include any
66187 default "policy". Instead it enables you to build your own policy using
66188 Exim&#x2019;s standard controls.
66189 </para>
66190 <para>
66191 Please note that verification of DKIM signatures in incoming mail is turned
66192 on by default for logging purposes. For each signature in incoming email,
66193 exim will log a line displaying the most important signature details, and the
66194 signature status. Here is an example (with line-breaks added for clarity):
66195 </para>
66196 <literallayout class="monospaced">
66197 2009-09-09 10:22:28 1MlIRf-0003LU-U3 DKIM:
66198     d=facebookmail.com s=q1-2009b
66199     c=relaxed/relaxed a=rsa-sha1
66200     i=@facebookmail.com t=1252484542 [verification succeeded]
66201 </literallayout>
66202 <para>
66203 You might want to turn off DKIM verification processing entirely for internal
66204 or relay mail sources. To do that, set the <option>dkim_disable_verify</option> ACL
66205 control modifier. This should typically be done in the RCPT ACL, at points
66206 where you accept mail from relay sources (internal hosts or authenticated
66207 senders).
66208 </para>
66209 <section id="SECID513">
66210 <title>Signing outgoing messages</title>
66211 <para>
66212 <indexterm role="concept">
66213 <primary>DKIM</primary>
66214 <secondary>signing</secondary>
66215 </indexterm>
66216 </para>
66217 <para>
66218 Signing is implemented by setting private options on the SMTP transport.
66219 These options take (expandable) strings as arguments.
66220 </para>
66221 <para>
66222 <indexterm role="option">
66223 <primary><option>dkim_domain</option></primary>
66224 </indexterm>
66225 </para>
66226 <informaltable frame="all">
66227 <tgroup cols="4" colsep="0" rowsep="0">
66228 <colspec colwidth="8*" align="left"/>
66229 <colspec colwidth="6*" align="center"/>
66230 <colspec colwidth="6*" align="center"/>
66231 <colspec colwidth="6*" align="right"/>
66232 <tbody>
66233 <row>
66234 <entry><option>dkim_domain</option></entry>
66235 <entry>Use: <emphasis>smtp</emphasis></entry>
66236 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
66237 <entry>Default: <emphasis>unset</emphasis></entry>
66238 </row>
66239 </tbody>
66240 </tgroup>
66241 </informaltable>
66242 <para>
66243 MANDATORY:
66244 The domain you want to sign with. The result of this expanded
66245 option is put into the <option>$dkim_domain</option> expansion variable.
66246 </para>
66247 <para>
66248 <indexterm role="option">
66249 <primary><option>dkim_selector</option></primary>
66250 </indexterm>
66251 </para>
66252 <informaltable frame="all">
66253 <tgroup cols="4" colsep="0" rowsep="0">
66254 <colspec colwidth="8*" align="left"/>
66255 <colspec colwidth="6*" align="center"/>
66256 <colspec colwidth="6*" align="center"/>
66257 <colspec colwidth="6*" align="right"/>
66258 <tbody>
66259 <row>
66260 <entry><option>dkim_selector</option></entry>
66261 <entry>Use: <emphasis>smtp</emphasis></entry>
66262 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
66263 <entry>Default: <emphasis>unset</emphasis></entry>
66264 </row>
66265 </tbody>
66266 </tgroup>
66267 </informaltable>
66268 <para>
66269 MANDATORY:
66270 This sets the key selector string. You can use the <option>$dkim_domain</option> expansion
66271 variable to look up a matching selector. The result is put in the expansion
66272 variable <option>$dkim_selector</option> which should be used in the <option>dkim_private_key</option>
66273 option along with <option>$dkim_domain</option>.
66274 </para>
66275 <para>
66276 <indexterm role="option">
66277 <primary><option>dkim_private_key</option></primary>
66278 </indexterm>
66279 </para>
66280 <informaltable frame="all">
66281 <tgroup cols="4" colsep="0" rowsep="0">
66282 <colspec colwidth="8*" align="left"/>
66283 <colspec colwidth="6*" align="center"/>
66284 <colspec colwidth="6*" align="center"/>
66285 <colspec colwidth="6*" align="right"/>
66286 <tbody>
66287 <row>
66288 <entry><option>dkim_private_key</option></entry>
66289 <entry>Use: <emphasis>smtp</emphasis></entry>
66290 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
66291 <entry>Default: <emphasis>unset</emphasis></entry>
66292 </row>
66293 </tbody>
66294 </tgroup>
66295 </informaltable>
66296 <para>
66297 MANDATORY:
66298 This sets the private key to use. You can use the <option>$dkim_domain</option> and
66299 <option>$dkim_selector</option> expansion variables to determine the private key to use.
66300 The result can either
66301 </para>
66302 <itemizedlist>
66303 <listitem>
66304 <para>
66305 be a valid RSA private key in ASCII armor, including line breaks.
66306 </para>
66307 </listitem>
66308 <listitem>
66309 <para>
66310 start with a slash, in which case it is treated as a file that contains
66311 the private key.
66312 </para>
66313 </listitem>
66314 <listitem>
66315 <para>
66316 be "0", "false" or the empty string, in which case the message will not
66317 be signed. This case will not result in an error, even if <option>dkim_strict</option>
66318 is set.
66319 </para>
66320 </listitem>
66321 </itemizedlist>
66322 <para>
66323 <indexterm role="option">
66324 <primary><option>dkim_canon</option></primary>
66325 </indexterm>
66326 </para>
66327 <informaltable frame="all">
66328 <tgroup cols="4" colsep="0" rowsep="0">
66329 <colspec colwidth="8*" align="left"/>
66330 <colspec colwidth="6*" align="center"/>
66331 <colspec colwidth="6*" align="center"/>
66332 <colspec colwidth="6*" align="right"/>
66333 <tbody>
66334 <row>
66335 <entry><option>dkim_canon</option></entry>
66336 <entry>Use: <emphasis>smtp</emphasis></entry>
66337 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
66338 <entry>Default: <emphasis>unset</emphasis></entry>
66339 </row>
66340 </tbody>
66341 </tgroup>
66342 </informaltable>
66343 <para>
66344 OPTIONAL:
66345 This option sets the canonicalization method used when signing a message.
66346 The DKIM RFC currently supports two methods: "simple" and "relaxed".
66347 The option defaults to "relaxed" when unset. Note: the current implementation
66348 only supports using the same canonicalization method for both headers and body.
66349 </para>
66350 <para>
66351 <indexterm role="option">
66352 <primary><option>dkim_strict</option></primary>
66353 </indexterm>
66354 </para>
66355 <informaltable frame="all">
66356 <tgroup cols="4" colsep="0" rowsep="0">
66357 <colspec colwidth="8*" align="left"/>
66358 <colspec colwidth="6*" align="center"/>
66359 <colspec colwidth="6*" align="center"/>
66360 <colspec colwidth="6*" align="right"/>
66361 <tbody>
66362 <row>
66363 <entry><option>dkim_strict</option></entry>
66364 <entry>Use: <emphasis>smtp</emphasis></entry>
66365 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
66366 <entry>Default: <emphasis>unset</emphasis></entry>
66367 </row>
66368 </tbody>
66369 </tgroup>
66370 </informaltable>
66371 <para>
66372 OPTIONAL:
66373 This  option  defines  how  Exim  behaves  when  signing a message that
66374 should be signed fails for some reason.  When the expansion evaluates to
66375 either "1" or "true", Exim will defer. Otherwise Exim will send the message
66376 unsigned. You can use the <option>$dkim_domain</option> and <option>$dkim_selector</option> expansion
66377 variables here.
66378 </para>
66379 <para>
66380 <indexterm role="option">
66381 <primary><option>dkim_sign_headers</option></primary>
66382 </indexterm>
66383 </para>
66384 <informaltable frame="all">
66385 <tgroup cols="4" colsep="0" rowsep="0">
66386 <colspec colwidth="8*" align="left"/>
66387 <colspec colwidth="6*" align="center"/>
66388 <colspec colwidth="6*" align="center"/>
66389 <colspec colwidth="6*" align="right"/>
66390 <tbody>
66391 <row>
66392 <entry><option>dkim_sign_headers</option></entry>
66393 <entry>Use: <emphasis>smtp</emphasis></entry>
66394 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
66395 <entry>Default: <emphasis>unset</emphasis></entry>
66396 </row>
66397 </tbody>
66398 </tgroup>
66399 </informaltable>
66400 <para>
66401 OPTIONAL:
66402 When set, this option must expand to (or be specified as) a colon-separated
66403 list of header names. Headers with these names will be included in the message
66404 signature. When unspecified, the header names recommended in RFC4871 will be
66405 used.
66406 </para>
66407 </section>
66408 <section id="SECID514">
66409 <title>Verifying DKIM signatures in incoming mail</title>
66410 <para>
66411 <indexterm role="concept">
66412 <primary>DKIM</primary>
66413 <secondary>verification</secondary>
66414 </indexterm>
66415 </para>
66416 <para>
66417 Verification of DKIM signatures in incoming email is implemented via the
66418 <option>acl_smtp_dkim</option> ACL. By default, this ACL is called once for each
66419 syntactically(!) correct signature in the incoming message.
66420 A missing ACL definition defaults to accept.
66421 If any ACL call does not acccept, the message is not accepted.
66422 If a cutthrough delivery was in progress for the message it is
66423 summarily dropped (having wasted the transmission effort).
66424 </para>
66425 <para>
66426 To evaluate the signature in the ACL a large number of expansion variables
66427 containing the signature status and its details are set up during the
66428 runtime of the ACL.
66429 </para>
66430 <para>
66431 Calling the ACL only for existing signatures is not sufficient to build
66432 more advanced policies. For that reason, the global option
66433 <option>dkim_verify_signers</option>, and a global expansion variable
66434 <option>$dkim_signers</option> exist.
66435 </para>
66436 <para>
66437 The global option <option>dkim_verify_signers</option> can be set to a colon-separated
66438 list of DKIM domains or identities for which the ACL <option>acl_smtp_dkim</option> is
66439 called. It is expanded when the message has been received. At this point,
66440 the expansion variable <option>$dkim_signers</option> already contains a colon-separated
66441 list of signer domains and identities for the message. When
66442 <option>dkim_verify_signers</option> is not specified in the main configuration,
66443 it defaults as:
66444 </para>
66445 <literallayout class="monospaced">
66446 dkim_verify_signers = $dkim_signers
66447 </literallayout>
66448 <para>
66449 This leads to the default behaviour of calling <option>acl_smtp_dkim</option> for each
66450 DKIM signature in the message. Current DKIM verifiers may want to explicitly
66451 call the ACL for known domains or identities. This would be achieved as follows:
66452 </para>
66453 <literallayout class="monospaced">
66454 dkim_verify_signers = paypal.com:ebay.com:$dkim_signers
66455 </literallayout>
66456 <para>
66457 This would result in <option>acl_smtp_dkim</option> always being called for "paypal.com"
66458 and "ebay.com", plus all domains and identities that have signatures in the message.
66459 You can also be more creative in constructing your policy. For example:
66460 </para>
66461 <literallayout class="monospaced">
66462 dkim_verify_signers = $sender_address_domain:$dkim_signers
66463 </literallayout>
66464 <para>
66465 If a domain or identity is listed several times in the (expanded) value of
66466 <option>dkim_verify_signers</option>, the ACL is only called once for that domain or identity.
66467 </para>
66468 <para>
66469 Inside the <option>acl_smtp_dkim</option>, the following expansion variables are
66470 available (from most to least important):
66471 </para>
66472 <variablelist>
66473 <varlistentry>
66474 <term><option>$dkim_cur_signer</option></term>
66475 <listitem>
66476 <para>
66477 The signer that is being evaluated in this ACL run. This can be a domain or
66478 an identity. This is one of the list items from the expanded main option
66479 <option>dkim_verify_signers</option> (see above).
66480 </para>
66481 </listitem></varlistentry>
66482 <varlistentry>
66483 <term><option>$dkim_verify_status</option></term>
66484 <listitem>
66485 <para>
66486 A string describing the general status of the signature. One of
66487 </para>
66488 <itemizedlist>
66489 <listitem>
66490 <para>
66491 <option>none</option>: There is no signature in the message for the current domain or
66492 identity (as reflected by <option>$dkim_cur_signer</option>).
66493 </para>
66494 </listitem>
66495 <listitem>
66496 <para>
66497 <option>invalid</option>: The signature could not be verified due to a processing error.
66498 More detail is available in <option>$dkim_verify_reason</option>.
66499 </para>
66500 </listitem>
66501 <listitem>
66502 <para>
66503 <option>fail</option>: Verification of the signature failed.  More detail is
66504 available in <option>$dkim_verify_reason</option>.
66505 </para>
66506 </listitem>
66507 <listitem>
66508 <para>
66509 <option>pass</option>: The signature passed verification. It is valid.
66510 </para>
66511 </listitem>
66512 </itemizedlist>
66513 </listitem></varlistentry>
66514 <varlistentry>
66515 <term><option>$dkim_verify_reason</option></term>
66516 <listitem>
66517 <para>
66518 A string giving a litte bit more detail when <option>$dkim_verify_status</option> is either
66519 "fail" or "invalid". One of
66520 </para>
66521 <itemizedlist>
66522 <listitem>
66523 <para>
66524 <option>pubkey_unavailable</option> (when <option>$dkim_verify_status</option>="invalid"): The public
66525 key for the domain could not be retrieved. This may be a temporary problem.
66526 </para>
66527 </listitem>
66528 <listitem>
66529 <para>
66530 <option>pubkey_syntax</option> (when <option>$dkim_verify_status</option>="invalid"): The public key
66531 record for the domain is syntactically invalid.
66532 </para>
66533 </listitem>
66534 <listitem>
66535 <para>
66536 <option>bodyhash_mismatch</option> (when <option>$dkim_verify_status</option>="fail"): The calculated
66537 body hash does not match the one specified in the signature header. This
66538 means that the message body was modified in transit.
66539 </para>
66540 </listitem>
66541 <listitem>
66542 <para>
66543 <option>signature_incorrect</option> (when <option>$dkim_verify_status</option>="fail"): The signature
66544 could not be verified. This may mean that headers were modified,
66545 re-written or otherwise changed in a way which is incompatible with
66546 DKIM verification. It may of course also mean that the signature is forged.
66547 </para>
66548 </listitem>
66549 </itemizedlist>
66550 </listitem></varlistentry>
66551 <varlistentry>
66552 <term><option>$dkim_domain</option></term>
66553 <listitem>
66554 <para>
66555 The signing domain. IMPORTANT: This variable is only populated if there is
66556 an actual signature in the message for the current domain or identity (as
66557 reflected by <option>$dkim_cur_signer</option>).
66558 </para>
66559 </listitem></varlistentry>
66560 <varlistentry>
66561 <term><option>$dkim_identity</option></term>
66562 <listitem>
66563 <para>
66564 The signing identity, if present. IMPORTANT: This variable is only populated
66565 if there is an actual signature in the message for the current domain or
66566 identity (as reflected by <option>$dkim_cur_signer</option>).
66567 </para>
66568 </listitem></varlistentry>
66569 <varlistentry>
66570 <term><option>$dkim_selector</option></term>
66571 <listitem>
66572 <para>
66573 The key record selector string.
66574 </para>
66575 </listitem></varlistentry>
66576 <varlistentry>
66577 <term><option>$dkim_algo</option></term>
66578 <listitem>
66579 <para>
66580 The algorithm used. One of &#x2019;rsa-sha1&#x2019; or &#x2019;rsa-sha256&#x2019;.
66581 </para>
66582 </listitem></varlistentry>
66583 <varlistentry>
66584 <term><option>$dkim_canon_body</option></term>
66585 <listitem>
66586 <para>
66587 The body canonicalization method. One of &#x2019;relaxed&#x2019; or &#x2019;simple&#x2019;.
66588 </para>
66589 </listitem></varlistentry>
66590 <varlistentry>
66591 <term><option>dkim_canon_headers</option></term>
66592 <listitem>
66593 <para>
66594 The header canonicalization method. One of &#x2019;relaxed&#x2019; or &#x2019;simple&#x2019;.
66595 </para>
66596 </listitem></varlistentry>
66597 <varlistentry>
66598 <term><option>$dkim_copiedheaders</option></term>
66599 <listitem>
66600 <para>
66601 A transcript of headers and their values which are included in the signature
66602 (copied from the &#x2019;z=&#x2019; tag of the signature).
66603 </para>
66604 </listitem></varlistentry>
66605 <varlistentry>
66606 <term><option>$dkim_bodylength</option></term>
66607 <listitem>
66608 <para>
66609 The number of signed body bytes. If zero ("0"), the body is unsigned. If no
66610 limit was set by the signer, "9999999999999" is returned. This makes sure
66611 that this variable always expands to an integer value.
66612 </para>
66613 </listitem></varlistentry>
66614 <varlistentry>
66615 <term><option>$dkim_created</option></term>
66616 <listitem>
66617 <para>
66618 UNIX timestamp reflecting the date and time when the signature was created.
66619 When this was not specified by the signer, "0" is returned.
66620 </para>
66621 </listitem></varlistentry>
66622 <varlistentry>
66623 <term><option>$dkim_expires</option></term>
66624 <listitem>
66625 <para>
66626 UNIX timestamp reflecting the date and time when the signer wants the
66627 signature to be treated as "expired". When this was not specified by the
66628 signer, "9999999999999" is returned. This makes it possible to do useful
66629 integer size comparisons against this value.
66630 </para>
66631 </listitem></varlistentry>
66632 <varlistentry>
66633 <term><option>$dkim_headernames</option></term>
66634 <listitem>
66635 <para>
66636 A colon-separated list of names of headers included in the signature.
66637 </para>
66638 </listitem></varlistentry>
66639 <varlistentry>
66640 <term><option>$dkim_key_testing</option></term>
66641 <listitem>
66642 <para>
66643 "1" if the key record has the "testing" flag set, "0" if not.
66644 </para>
66645 </listitem></varlistentry>
66646 <varlistentry>
66647 <term><option>$dkim_key_nosubdomains</option></term>
66648 <listitem>
66649 <para>
66650 "1" if the key record forbids subdomaining, "0" otherwise.
66651 </para>
66652 </listitem></varlistentry>
66653 <varlistentry>
66654 <term><option>$dkim_key_srvtype</option></term>
66655 <listitem>
66656 <para>
66657 Service type (tag s=) from the key record. Defaults to "*" if not specified
66658 in the key record.
66659 </para>
66660 </listitem></varlistentry>
66661 <varlistentry>
66662 <term><option>$dkim_key_granularity</option></term>
66663 <listitem>
66664 <para>
66665 Key granularity (tag g=) from the key record. Defaults to "*" if not specified
66666 in the key record.
66667 </para>
66668 </listitem></varlistentry>
66669 <varlistentry>
66670 <term><option>$dkim_key_notes</option></term>
66671 <listitem>
66672 <para>
66673 Notes from the key record (tag n=).
66674 </para>
66675 </listitem></varlistentry>
66676 </variablelist>
66677 <para>
66678 In addition, two ACL conditions are provided:
66679 </para>
66680 <variablelist>
66681 <varlistentry>
66682 <term><option>dkim_signers</option></term>
66683 <listitem>
66684 <para>
66685 ACL condition that checks a colon-separated list of domains or identities
66686 for a match against the domain or identity that the ACL is currently verifying
66687 (reflected by <option>$dkim_cur_signer</option>). This is typically used to restrict an ACL
66688 verb to a group of domains or identities. For example:
66689 </para>
66690 <literallayout class="monospaced">
66691 # Warn when Mail purportedly from GMail has no signature at all
66692 warn log_message = GMail sender without DKIM signature
66693      sender_domains = gmail.com
66694      dkim_signers = gmail.com
66695      dkim_status = none
66696 </literallayout>
66697 </listitem></varlistentry>
66698 <varlistentry>
66699 <term><option>dkim_status</option></term>
66700 <listitem>
66701 <para>
66702 ACL condition that checks a colon-separated list of possible DKIM verification
66703 results against the actual result of verification. This is typically used
66704 to restrict an ACL verb to a list of verification outcomes, for example:
66705 </para>
66706 <literallayout class="monospaced">
66707 deny message = Mail from Paypal with invalid/missing signature
66708      sender_domains = paypal.com:paypal.de
66709      dkim_signers = paypal.com:paypal.de
66710      dkim_status = none:invalid:fail
66711 </literallayout>
66712 <para>
66713 The possible status keywords are: &#x2019;none&#x2019;,&#x2019;invalid&#x2019;,&#x2019;fail&#x2019; and &#x2019;pass&#x2019;. Please
66714 see the documentation of the <option>$dkim_verify_status</option> expansion variable above
66715 for more information of what they mean.
66716 </para>
66717 </listitem></varlistentry>
66718 </variablelist>
66719 </section>
66720 </chapter>
66721
66722 <chapter id="CHID13">
66723 <title>Adding new drivers or lookup types</title>
66724 <titleabbrev>Adding drivers or lookups</titleabbrev>
66725 <para>
66726 <indexterm role="concept">
66727 <primary>adding drivers</primary>
66728 </indexterm>
66729 <indexterm role="concept">
66730 <primary>new drivers, adding</primary>
66731 </indexterm>
66732 <indexterm role="concept">
66733 <primary>drivers</primary>
66734 <secondary>adding new</secondary>
66735 </indexterm>
66736 The following actions have to be taken in order to add a new router, transport,
66737 authenticator, or lookup type to Exim:
66738 </para>
66739 <orderedlist numeration="arabic">
66740 <listitem>
66741 <para>
66742 Choose a name for the driver or lookup type that does not conflict with any
66743 existing name; I will use <quote>newdriver</quote> in what follows.
66744 </para>
66745 </listitem>
66746 <listitem>
66747 <para>
66748 Add to <filename>src/EDITME</filename> the line:
66749 </para>
66750 <literallayout>
66751 &lt;<emphasis>type</emphasis>&gt;<literal>_NEWDRIVER=yes</literal>
66752 </literallayout>
66753 <para>
66754 where &lt;<emphasis>type</emphasis>&gt; is ROUTER, TRANSPORT, AUTH, or LOOKUP. If the
66755 code is not to be included in the binary by default, comment this line out. You
66756 should also add any relevant comments about the driver or lookup type.
66757 </para>
66758 </listitem>
66759 <listitem>
66760 <para>
66761 Add to <filename>src/config.h.defaults</filename> the line:
66762 </para>
66763 <literallayout class="monospaced">
66764 #define &lt;type&gt;_NEWDRIVER
66765 </literallayout>
66766 </listitem>
66767 <listitem>
66768 <para>
66769 Edit <filename>src/drtables.c</filename>, adding conditional code to pull in the private header
66770 and create a table entry as is done for all the other drivers and lookup types.
66771 </para>
66772 </listitem>
66773 <listitem>
66774 <para>
66775 Edit <filename>scripts/lookups-Makefile</filename> if this is a new lookup; there is a for-loop
66776 near the bottom, ranging the <literal>name_mod</literal> variable over a list of all lookups.
66777 Add your <literal>NEWDRIVER</literal> to that list.
66778 As long as the dynamic module would be named <filename>newdriver.so</filename>, you can use the
66779 simple form that most lookups have.
66780 </para>
66781 </listitem>
66782 <listitem>
66783 <para>
66784 Edit <filename>Makefile</filename> in the appropriate sub-directory (<filename>src/routers</filename>,
66785 <filename>src/transports</filename>, <filename>src/auths</filename>, or <filename>src/lookups</filename>); add a line for the new
66786 driver or lookup type and add it to the definition of OBJ.
66787 </para>
66788 </listitem>
66789 <listitem>
66790 <para>
66791 Create <filename>newdriver.h</filename> and <filename>newdriver.c</filename> in the appropriate sub-directory of
66792 <filename>src</filename>.
66793 </para>
66794 </listitem>
66795 <listitem>
66796 <para>
66797 Edit <filename>scripts/MakeLinks</filename> and add commands to link the <filename>.h</filename> and <filename>.c</filename> files
66798 as for other drivers and lookups.
66799 </para>
66800 </listitem>
66801 </orderedlist>
66802 <para>
66803 Then all you need to do is write the code! A good way to start is to make a
66804 proforma by copying an existing module of the same type, globally changing all
66805 occurrences of the name, and cutting out most of the code. Note that any
66806 options you create must be listed in alphabetical order, because the tables are
66807 searched using a binary chop procedure.
66808 </para>
66809 <para>
66810 There is a <filename>README</filename> file in each of the sub-directories of <filename>src</filename> describing
66811 the interface that is expected.
66812 </para>
66813 <?sdop
66814   format="newpage"
66815   foot_right_recto="&chaptertitle;"
66816   foot_right_verso="&chaptertitle;"
66817 ?>
66818 </chapter>
66819
66820 <index role="option">
66821 <title>Options index</title>
66822 </index>
66823
66824 <index role="variable">
66825 <title>Variables index</title>
66826 </index>
66827
66828 <index role="concept">
66829 <title>Concept index</title>
66830 </index>
66831
66832 </book>